- revise the way special moves are handled (demo and interview don't need a table)

- slighlty modified some asm funcs which could let the game in fast mode
- minor cleanup

svn-id: r12018
This commit is contained in:
Gregory Montoir 2003-12-29 20:17:43 +00:00
parent 40419b1aee
commit 865797cbee
2 changed files with 46 additions and 80 deletions

View file

@ -50,15 +50,13 @@ Logic::Logic(QueenEngine *vm)
initialise(); initialise();
if (_vm->resource()->isDemo()) { if (_vm->resource()->isDemo()) {
_preChangeRoom = &Logic::preChangeRoom_Demo; _preChangeRoom = &Logic::preChangeRoom_Demo;
setupASM_Demo(); _executeASM = &Logic::executeASM_Demo;
} } else if (_vm->resource()->isInterview()) {
else if (_vm->resource()->isInterview()) {
_preChangeRoom = &Logic::preChangeRoom_Interview; _preChangeRoom = &Logic::preChangeRoom_Interview;
setupASM_Interview(); _executeASM = &Logic::executeASM_Interview;
} } else {
else {
_preChangeRoom = &Logic::preChangeRoom_Game; _preChangeRoom = &Logic::preChangeRoom_Game;
setupASM_Game(); _executeASM = &Logic::executeASM_Game;
} }
} }
@ -1101,8 +1099,6 @@ void Logic::roomDisplay(uint16 room, RoomDisplayMode mode, uint16 scale, int com
roomErase(); roomErase();
// XXX _vm->sound()->loadSFX(SFXNAME[_currentRoom]);
roomSetup(roomName(room), comPanel, inCutaway); roomSetup(roomName(room), comPanel, inCutaway);
ObjectData *pod = NULL; ObjectData *pod = NULL;
if (mode != RDM_FADE_NOJOE) { if (mode != RDM_FADE_NOJOE) {
@ -2446,7 +2442,7 @@ void Logic::sceneStart() {
_vm->display()->showMouseCursor(false); _vm->display()->showMouseCursor(false);
if (1 == _scene) { // && _vm->input()->cutawayRunning()) { // sceneStart is always called when cutaway is running if (1 == _scene) {
_vm->display()->palFadePanel(); _vm->display()->palFadePanel();
} }
@ -2624,40 +2620,33 @@ bool Logic::preChangeRoom_Game() {
} }
void Logic::setupASM_Demo() { bool Logic::executeASM_Demo(uint16 sm) {
static const SpecialMoveProc proc[] = { switch (sm) {
/* 00 */ case 4:
NULL, asmMakeJoeUseUnderwear();
NULL, break;
&Logic::asmMakeJoeUseDress, case 5:
&Logic::asmMakeJoeUseNormalClothes, asmSwitchToDressPalette();
/* 04 */ break;
&Logic::asmMakeJoeUseUnderwear, case 14:
&Logic::asmSwitchToDressPalette, asmEndDemo();
&Logic::asmSwitchToNormalPalette, break;
NULL, default:
/* 08 */ return false;
NULL, break;
NULL, }
NULL, return true;
NULL,
/* 12 */
NULL,
NULL,
&Logic::asmEndDemo
};
_asmTable = proc;
_asmCount = ARRAYSIZE(proc);
} }
bool Logic::executeASM_Interview(uint16 sm) {
void Logic::setupASM_Interview() {
// XXX // XXX
return false;
} }
void Logic::setupASM_Game() { bool Logic::executeASM_Game(uint16 sm) {
static const SpecialMoveProc proc[] = { typedef void (Logic::*SpecialMoveProc)();
static const SpecialMoveProc asmTable[] = {
/* 00 */ /* 00 */
NULL, NULL,
NULL, NULL,
@ -2667,10 +2656,10 @@ void Logic::setupASM_Game() {
&Logic::asmMakeJoeUseUnderwear, &Logic::asmMakeJoeUseUnderwear,
&Logic::asmSwitchToDressPalette, &Logic::asmSwitchToDressPalette,
&Logic::asmSwitchToNormalPalette, &Logic::asmSwitchToNormalPalette,
&Logic::asmStartCarAnimation, &Logic::asmStartCarAnimation, // room 74
/* 08 */ /* 08 */
&Logic::asmStopCarAnimation, &Logic::asmStopCarAnimation, // room 74
&Logic::asmStartFightAnimation, &Logic::asmStartFightAnimation, // room 69
&Logic::asmWaitForFrankPosition, // c69e.cut &Logic::asmWaitForFrankPosition, // c69e.cut
&Logic::asmMakeFrankGrowing, // c69z.cut &Logic::asmMakeFrankGrowing, // c69z.cut
/* 12 */ /* 12 */
@ -2702,26 +2691,25 @@ void Logic::setupASM_Game() {
&Logic::asmShakeScreen, &Logic::asmShakeScreen,
&Logic::asmAttemptPuzzle, &Logic::asmAttemptPuzzle,
&Logic::asmScaleTitle, &Logic::asmScaleTitle,
NULL, // XXX PC Demo ? NULL,
/* 36 */ /* 36 */
&Logic::asmPanRightToHugh, &Logic::asmPanRightToHugh,
&Logic::asmMakeWhiteFlash, &Logic::asmMakeWhiteFlash,
&Logic::asmPanRightToJoeAndRita, &Logic::asmPanRightToJoeAndRita,
&Logic::asmPanLeftToBomb // cdint.cut &Logic::asmPanLeftToBomb // cdint.cut
}; };
_asmTable = proc; if (sm >= ARRAYSIZE(asmTable) || asmTable[sm] == NULL)
_asmCount = ARRAYSIZE(proc); return false;
(this->*asmTable[sm])();
return true;
} }
void Logic::executeSpecialMove(uint16 sm) { void Logic::executeSpecialMove(uint16 sm) {
if (sm >= _asmCount || _asmTable[sm] == NULL) {
warning("unhandled / invalid special move : %d", sm);
}
else {
debug(0, "Special move: %d", sm); debug(0, "Special move: %d", sm);
(this->*_asmTable[sm])(); if (!(this->*_executeASM)(sm))
} warning("unhandled / invalid special move : %d", sm);
} }
@ -2751,7 +2739,6 @@ void Logic::asmSwitchToNormalPalette() {
void Logic::asmStartCarAnimation() { void Logic::asmStartCarAnimation() {
// Carbam background animation - room 74
_vm->bam()->_flag = BamScene::F_PLAY; _vm->bam()->_flag = BamScene::F_PLAY;
_vm->bam()->prepareAnimation(); _vm->bam()->prepareAnimation();
} }
@ -2766,7 +2753,6 @@ void Logic::asmStopCarAnimation() {
void Logic::asmStartFightAnimation() { void Logic::asmStartFightAnimation() {
// Fight1 background animation - room 69
_vm->bam()->_flag = BamScene::F_PLAY; _vm->bam()->_flag = BamScene::F_PLAY;
_vm->bam()->prepareAnimation(); _vm->bam()->prepareAnimation();
gameState(148, 1); gameState(148, 1);
@ -3191,14 +3177,12 @@ void Logic::asmPanRightToHugh() {
i *= 2; i *= 2;
int horizontalScroll = 0; int horizontalScroll = 0;
while (horizontalScroll < k) { while (horizontalScroll < k && !_vm->input()->cutawayQuit()) {
horizontalScroll = horizontalScroll + i; horizontalScroll = horizontalScroll + i;
if (horizontalScroll > k) if (horizontalScroll > k)
horizontalScroll = k; horizontalScroll = k;
//debug(0, "horizontalScroll = %i", horizontalScroll);
_vm->display()->horizontalScroll(horizontalScroll); _vm->display()->horizontalScroll(horizontalScroll);
bob_thugA1->x -= i * 2; bob_thugA1->x -= i * 2;
@ -3213,9 +3197,6 @@ void Logic::asmPanRightToHugh() {
bob_thugB2->x -= i * 4; bob_thugB2->x -= i * 4;
update(); update();
if (_vm->input()->cutawayQuit())
return;
} }
_vm->input()->fastMode(false); _vm->input()->fastMode(false);
@ -3246,14 +3227,12 @@ void Logic::asmPanRightToJoeAndRita() { // cdint.cut
int horizontalScroll = _vm->display()->horizontalScroll(); int horizontalScroll = _vm->display()->horizontalScroll();
int i = 1; int i = 1;
while (horizontalScroll < 290) { while (horizontalScroll < 290 && !_vm->input()->cutawayQuit()) {
horizontalScroll = horizontalScroll + i; horizontalScroll = horizontalScroll + i;
if (horizontalScroll > 290) if (horizontalScroll > 290)
horizontalScroll = 290; horizontalScroll = 290;
//debug(0, "horizontalScroll = %i", horizontalScroll);
_vm->display()->horizontalScroll(horizontalScroll); _vm->display()->horizontalScroll(horizontalScroll);
bob_box ->x -= i * 2; bob_box ->x -= i * 2;
@ -3263,9 +3242,6 @@ void Logic::asmPanRightToJoeAndRita() { // cdint.cut
bob_hands->x -= i * 2; bob_hands->x -= i * 2;
update(); update();
if (_vm->input()->cutawayQuit())
return;
} }
_vm->input()->fastMode(false); _vm->input()->fastMode(false);
} }
@ -3281,13 +3257,12 @@ void Logic::asmPanLeftToBomb() {
int horizontalScroll = _vm->display()->horizontalScroll(); int horizontalScroll = _vm->display()->horizontalScroll();
int i = 5; int i = 5;
while (horizontalScroll > 0 || bob21->x < 136) { while ((horizontalScroll > 0 || bob21->x < 136) && !_vm->input()->cutawayQuit()) {
horizontalScroll -= i; horizontalScroll -= i;
if (horizontalScroll < 0) if (horizontalScroll < 0)
horizontalScroll = 0; horizontalScroll = 0;
//debug(0, "horizontalScroll = %i", horizontalScroll);
_vm->display()->horizontalScroll(horizontalScroll); _vm->display()->horizontalScroll(horizontalScroll);
if (horizontalScroll < 272 && bob21->x < 136) if (horizontalScroll < 272 && bob21->x < 136)
@ -3296,9 +3271,6 @@ void Logic::asmPanLeftToBomb() {
bob22->x += i; bob22->x += i;
update(); update();
if (_vm->input()->cutawayQuit())
return;
} }
_vm->input()->fastMode(false); _vm->input()->fastMode(false);
@ -3306,10 +3278,6 @@ void Logic::asmPanLeftToBomb() {
void Logic::asmEndDemo() { void Logic::asmEndDemo() {
int i;
for (i = 0; i < 40; ++i) {
update();
}
debug(0, "Flight of the Amazon Queen, released January 95"); debug(0, "Flight of the Amazon Queen, released January 95");
OSystem::instance()->quit(); OSystem::instance()->quit();
} }

View file

@ -251,9 +251,9 @@ public:
bool preChangeRoom_Interview(); bool preChangeRoom_Interview();
bool preChangeRoom_Game(); bool preChangeRoom_Game();
void setupASM_Demo(); bool executeASM_Demo(uint16 sm);
void setupASM_Interview(); bool executeASM_Interview(uint16 sm);
void setupASM_Game(); bool executeASM_Game(uint16 sm);
void executeSpecialMove(uint16 sm); void executeSpecialMove(uint16 sm);
@ -296,8 +296,8 @@ public:
void asmPanLeftToBomb(); void asmPanLeftToBomb();
void asmEndDemo(); void asmEndDemo();
typedef bool (Logic::*ExecuteASMProc)(uint16);
typedef bool (Logic::*PreChangeRoomProc)(); typedef bool (Logic::*PreChangeRoomProc)();
typedef void (Logic::*SpecialMoveProc)();
enum { enum {
MAX_ZONES_NUMBER = 32, MAX_ZONES_NUMBER = 32,
@ -434,9 +434,7 @@ protected:
bool _subtitles; bool _subtitles;
const SpecialMoveProc *_asmTable; ExecuteASMProc _executeASM;
uint16 _asmCount;
PreChangeRoomProc _preChangeRoom; PreChangeRoomProc _preChangeRoom;
QueenEngine *_vm; QueenEngine *_vm;