From d947a6ea778e6d1544ba905d89c84fb2d4b8dc9d Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Wed, 10 Dec 2003 14:19:04 +0000 Subject: cleanup, split Cutaway::specialMove() into several methods ; this should allow us minor changes in order to support different/other special moves (demo, interview) svn-id: r11552 --- queen/cutaway.cpp | 593 +------------------------------------------------ queen/cutaway.h | 3 - queen/logic.cpp | 652 +++++++++++++++++++++++++++++++++++++++++++++++++++++- queen/logic.h | 63 +++++- 4 files changed, 704 insertions(+), 607 deletions(-) (limited to 'queen') diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp index dcc0881c49..2ac51f5132 100644 --- a/queen/cutaway.cpp +++ b/queen/cutaway.cpp @@ -33,13 +33,6 @@ namespace Queen { /* - TODO soon - - - Implement SCENE_START and SCENE_END - - - Finish Cutaway::actionSpecialMove - - TODO later - Finish Cutaway::stop @@ -285,588 +278,6 @@ void Cutaway::dumpCutawayObject(int index, CutawayObject &object) } -void Cutaway::actionSpecialMove(int index) { - - if (index <= 0) - return; - - debug(0, "Special move: %i", index); - - switch (index) { - - case 2: - _logic->joeUseDress(false); - break; - - // c74a.cut - use clothes - case 3: - _logic->joeUseClothes(false); - break; - - case 4: - _logic->joeUseUnderwear(); - break; - - // cdres.cut - case 5: - _logic->display()->palSetJoe(JP_DRESS); - break; - - // cdclo.cut - Set Joe's palette - case 6: - _logic->display()->palSetJoe(JP_CLOTHES); - break; - - // c73e.cut - carbam background animation - case 7: - _graphics->initCarBamScene(); - break; - - // c74a.cut - Turn off big oil splat and gun shots! - case 8: - _graphics->cleanupCarBamScene(_logic->findBob(594)); // Oil object - break; - - // c69e.cut - Fight1 background animation - case 9: - _graphics->initFightBamScene(); - _logic->gameState(148, 1); - break; - - // c69e.cut - case 10: - _graphics->bamData()->flag = 2; - while (_graphics->bamData()->flag) { - _logic->update(); - } - break; - - // c69z.cut - Frank growing - case 11: { - _graphics->bankUnpack(1, 38, 15); - BobSlot *bobFrank = _graphics->bob(5); - bobFrank->frameNum = 38; - bobFrank->curPos(160, 200); - bobFrank->box.y2 = GAME_SCREEN_HEIGHT - 1; - - int i; - for (i = 10; i <= 100; i += 4) { - bobFrank->scale = i; - _logic->update(); - } - for (i = 0; i <= 20; ++i) { - _logic->update(); - } - - _logic->objectData(521)->name = ABS(_logic->objectData(521)->name); // Dinoray - _logic->objectData(526)->name = ABS(_logic->objectData(526)->name); // Frank obj - _logic->objectData(522)->name = -ABS(_logic->objectData(522)->name); // TMPD object off - _logic->objectData(525)->name = -ABS(_logic->objectData(525)->name); // Floda guards off - _logic->objectData(523)->name = -ABS(_logic->objectData(523)->name); // Sparky object off - _logic->gameState(157, 1); // No more Ironstein - } - break; - - // c69z.cut - Robot growing - case 12: { - _graphics->bankUnpack(1, 38, 15); - BobSlot *bobRobot = _graphics->bob(5); - bobRobot->frameNum = 38; - bobRobot->curPos(160, 200); - bobRobot->box.y2 = GAME_SCREEN_HEIGHT - 1; - - int i; - for (i = 10; i <= 100; i += 4) { - bobRobot->scale = i; - _logic->update(); - } - for (i = 0; i <= 20; ++i) { - _logic->update(); - } - - _logic->objectData(524)->name = -ABS(_logic->objectData(524)->name); // Azura object off - _logic->objectData(526)->name = -ABS(_logic->objectData(526)->name); // Frank object off - } - break; - - // Robot shrinking - case 13: { - int i; - for (i = 100; i >= 35; i -= 5) { - _graphics->bob(6)->scale = i; - _logic->update(); - } - } - break; - - // End game - case 14: { - int i; - for (i = 0; i < 40; ++i) { - _logic->update(); - } - OSystem::instance()->quit(); - } - break; - - // Dinocam - case 15: - _graphics->cameraBob(-1); - while (_logic->display()->horizontalScroll() < 320) { - _logic->display()->horizontalScroll(_logic->display()->horizontalScroll() + 16); - if (_logic->display()->horizontalScroll() > 320) { - _logic->display()->horizontalScroll(320); - } - _logic->update(); - } - _graphics->cameraBob(1); - break; - - // cdint.cut / room 67 - put camera on Joe - case 16: - _graphics->cameraBob(0); - break; - - // XXX sm17&18 : alternative intro - - case 19: - _logic->gameState(VAR_AZURA_IN_LOVE, 1); - break; - - // Pan right from Joe - case 20: - _graphics->cameraBob(-1); - while (_logic->display()->horizontalScroll() < 320) { - _logic->display()->horizontalScroll(_logic->display()->horizontalScroll() + 16); - if (_logic->display()->horizontalScroll() > 320) { - _logic->display()->horizontalScroll(320); - } - _logic->update(); - } - break; - - case 21: - _logic->display()->palCustomLightsOff(_logic->currentRoom()); - break; - - case 22: - _logic->display()->palCustomLightsOn(_logic->currentRoom()); - break; - - // manequin area on - case 23: - _logic->area(ROOM_FLODA_FRONTDESK, 7)->mapNeighbours = ABS(_logic->area(ROOM_FLODA_FRONTDESK, 7)->mapNeighbours); - break; - - case 24: { - int i = _graphics->bob(0)->x - 160; - if (i < 0) { - i = 0; - } - else if (i > 320) { - i = 320; - } - _graphics->cameraBob(-1); - if (i < _logic->display()->horizontalScroll()) { - while (_logic->display()->horizontalScroll() > i) { - _logic->display()->horizontalScroll(_logic->display()->horizontalScroll() - 16); - if (_logic->display()->horizontalScroll() < i) { - _logic->display()->horizontalScroll(i); - } - _logic->update(); - } - } - else { - while (_logic->display()->horizontalScroll() < i) { - _logic->display()->horizontalScroll(_logic->display()->horizontalScroll() + 16); - if (_logic->display()->horizontalScroll() > i ) { - _logic->display()->horizontalScroll(i); - } - } - _logic->update(); - } - _graphics->cameraBob(0); - } - break; - - // Turn guard on - case 25: - _logic->gameState(85, 1); - break; - - // c69g.CUT - Pan left 320 to 144 - case 26: - _graphics->cameraBob(-1); - while (_logic->display()->horizontalScroll() > 144) { - _logic->display()->horizontalScroll(_logic->display()->horizontalScroll() - 8); - if (_logic->display()->horizontalScroll() < 144) { - _logic->display()->horizontalScroll(144); - } - _logic->update(); - } - break; - - // smooch - case 27: { - _graphics->cameraBob(-1); - BobSlot *bobAzura = _graphics->bob(5); - BobSlot *bobJoe = _graphics->bob(6); - while (_logic->display()->horizontalScroll() < 320) { - _logic->display()->horizontalScroll(_logic->display()->horizontalScroll() + 8); - if (bobJoe->x - bobAzura->x > 128) { - bobAzura->x += 10; - bobJoe->x += 6; - } - else { - bobAzura->x += 8; - bobJoe->x += 8; - } - _logic->update(); - } - } - break; - - // c75b.cut - Lightning hits plane - case 28: - { - _graphics->cameraBob(-1); - - short iy = 0, x, ydir = -1, j, k; - - BobSlot *planeBob = _graphics->bob(5); - BobSlot *lightningBob = _graphics->bob(20); - - planeBob->box.y2 = lightningBob->box.y2 = 199; - planeBob->y = 135; - - planeBob->scale = 20; - - for (x = 660; x > 163; x -= 6) { - planeBob->x = x; - planeBob->y = 135 + iy; - - iy -= ydir; - if (iy < -9 || iy > 9) - ydir = -ydir; - - planeBob->scale++; - if (planeBob->scale > 100) - planeBob->scale = 100; - - int scrollX = x - 163; - if (scrollX > 320) - scrollX = 320; - _logic->display()->horizontalScroll(scrollX); - - _logic->update(); - } - - planeBob->scale = 100; - _logic->display()->horizontalScroll(0); - - planeBob->x -= -8; - planeBob->y += 6; - - lightningBob->x = 160; - lightningBob->y = 0; - - // 23/2/95 - Play lightning SFX - // XXX sfxplay(NULLstr); - - _graphics->bankUnpack(18, lightningBob->frameNum, 15); - _graphics->bankUnpack(4, planeBob ->frameNum, 15); - - // Plane plunges into the jungle! - - BobSlot *fireBob = _graphics->bob(6); - - fireBob->animating = true; - fireBob->x = planeBob->x; - fireBob->y = planeBob->y + 10; - - _graphics->bankUnpack(19, fireBob->frameNum, 15); - _logic->update(); - - k = 20; - j = 1; - - for (x = 163; x > -30; x -= 10) { - planeBob->y += 4; - fireBob->y += 4; - planeBob->x = fireBob->x = x; - - if (k < 40) { - _graphics->bankUnpack(j, planeBob->frameNum, 15); - _graphics->bankUnpack(k, fireBob ->frameNum, 15); - k++; - j++; - - if (j == 4) - j = 1; - } - - _logic->update(); - } - - _graphics->cameraBob(0); - } - break; - - // Scale blimp - end game! - case 29: { - int16 z = 256; - BobSlot *bob = _graphics->bob(7); - int16 x = bob->x; - int16 y = bob->y; - while (bob->x > 150) { - bob->x = x * 256 / z + 150; - bob->x = y * 256 / z + 112; - bob->scale = 100 * 256 / z; - - ++z; - if (z % 6 == 0) { - --x; - } - - _logic->update(); - } - } - break; - - // scale ending - case 30: { - _graphics->bob(7)->active = false; // Turn off blimp - BobSlot *b = _graphics->bob(20); - b->x = 160; - b->y = 100; - int i; - for (i = 5; i <= 100; i += 5) { - b->scale = i; - _logic->update(); - } - for (i = 0; i < 50; ++i) { - _logic->update(); - } - _logic->display()->palFadeOut(0, 255, _logic->currentRoom()); - } - break; - - // c74a.cut - Wait for car to reach correct position before pouring oil - case 31: - while (_graphics->bamData()->index != 60) { - _logic->update(); - } - break; - - // c75b.cut - Screen shake - case 32: - OSystem::instance()->set_shake_pos(3); - _logic->update(); - OSystem::instance()->set_shake_pos(0); - _logic->update(); - break; - - // Attempt puzzle - case 33: { - static short n = 0; - ++n; - if (n & 4) { - _logic->joeSpeak(226, true); - } - } - break; - - // cred.cut - scale title - case 34: - { - BobSlot *bob = _graphics->bob(5); - bob->animating = false; - bob->x = 161; - bob->y = 200; - bob->scale = 100; - - int i; - for (i = 5; i <= 100; i +=5) { - bob->scale = i; - bob->y -= 4; - _logic->update(); - } - } - break; - - // XXX sm35: demo - - // cdint.cut - pan right fast - case 36: - { - Display *display = _logic->display(); - - BobSlot *bob_thugA1 = _graphics->bob(20); - BobSlot *bob_thugA2 = _graphics->bob(21); - BobSlot *bob_thugA3 = _graphics->bob(22); - BobSlot *bob_hugh1 = _graphics->bob(1); - BobSlot *bob_hugh2 = _graphics->bob(23); - BobSlot *bob_hugh3 = _graphics->bob(24); - BobSlot *bob_thugB1 = _graphics->bob(25); - BobSlot *bob_thugB2 = _graphics->bob(26); - - _graphics->cameraBob(-1); - _input->fastMode(true); - _logic->update(); - - int i = 4, k = 160; - - // Adjust thug1 gun so it matches rest of body - bob_thugA1->x += (k / 2) * 2 - 45; - bob_thugA2->x += (k / 2) * 2; - bob_thugA3->x += (k / 2) * 2; - - bob_hugh1->x += (k / 2) * 3 + (k / 2); - bob_hugh2->x += (k / 2) * 3 + (k / 2); - bob_hugh3->x += (k / 2) * 3 + (k / 2); - - bob_thugB1->x += (k / 2) * 4 + k; - bob_thugB2->x += (k / 2) * 4 + k; - - if (i == 3) { - bob_thugB1->x += 10; - bob_thugB2->x += 10; - } - - i *= 2; - - int horizontalScroll = 0; - - while (horizontalScroll < k) { - - horizontalScroll = horizontalScroll + i; - if (horizontalScroll > k) - horizontalScroll = k; - - //debug(0, "horizontalScroll = %i", horizontalScroll); - - display->horizontalScroll(horizontalScroll); - - bob_thugA1->x -= i * 2; - bob_thugA2->x -= i * 2; - bob_thugA3->x -= i * 2; - - bob_hugh1->x -= i * 3; - bob_hugh2->x -= i * 3; - bob_hugh3->x -= i * 3; - - bob_thugB1->x -= i * 4; - bob_thugB2->x -= i * 4; - - _logic->update(); - - if (_input->cutawayQuit()) - return; - } - - _input->fastMode(false); - } - break; - - // cdint.cut - flash white - case 37: - _logic->display()->palCustomFlash(); - break; - - // cdint.cut - pan right - case 38: - { - Display *display = _logic->display(); - - BobSlot *bob_box = _graphics->bob(20); - BobSlot *bob_beam = _graphics->bob(21); - BobSlot *bob_crate = _graphics->bob(22); - BobSlot *bob_clock = _graphics->bob(23); - BobSlot *bob_hands = _graphics->bob(24); - - _graphics->cameraBob(-1); - _input->fastMode(true); - - _logic->update(); - - bob_box ->x += 280 * 2; - bob_beam ->x += 30; - bob_crate->x += 180 * 3; - - int horizontalScroll = display->horizontalScroll(); - - int i = 1; - while (horizontalScroll < 290) { - - horizontalScroll = horizontalScroll + i; - if (horizontalScroll > 290) - horizontalScroll = 290; - - //debug(0, "horizontalScroll = %i", horizontalScroll); - - display->horizontalScroll(horizontalScroll); - - bob_box ->x -= i * 2; - bob_beam ->x -= i; - bob_crate->x -= i * 3; - bob_clock->x -= i * 2; - bob_hands->x -= i * 2; - - _logic->update(); - - if (_input->cutawayQuit()) - return; - - } - - _input->fastMode(false); - } - break; - - // cdint.cut - pan left to bomb - case 39: - { - Display *display = _logic->display(); - - BobSlot *bob21 = _graphics->bob(21); - BobSlot *bob22 = _graphics->bob(22); - - _graphics->cameraBob(-1); - _input->fastMode(true); - - int horizontalScroll = display->horizontalScroll(); - - int i = 5; - while (horizontalScroll > 0 || bob21->x < 136) { - - horizontalScroll -= i; - if (horizontalScroll < 0) - horizontalScroll = 0; - - //debug(0, "horizontalScroll = %i", horizontalScroll); - display->horizontalScroll(horizontalScroll); - - if (horizontalScroll < 272 && bob21->x < 136) - bob21->x += (i/2); - - bob22->x += i; - - _logic->update(); - - if (_input->cutawayQuit()) - return; - - } - - _input->fastMode(false); - } - break; - - default: - warning("Unhandled special move: %i", index); - break; - } -} byte *Cutaway::turnOnPeople(byte *ptr, CutawayObject &object) { // Lines 1248-1259 in cutaway.c @@ -1483,7 +894,7 @@ void Cutaway::run(char *nextFilename) { !object.moveToY && object.specialMove && object.objectNumber >= 0) { - actionSpecialMove(object.specialMove); + _logic->executeSpecialMove(object.specialMove); object.specialMove = 0; } @@ -1778,7 +1189,7 @@ void Cutaway::stop() { } // for() int16 specialMove = (int16)READ_BE_UINT16(ptr); ptr += 2; - actionSpecialMove(specialMove); + _logic->executeSpecialMove(specialMove); _lastSong = (int16)READ_BE_UINT16(ptr); ptr += 2; } diff --git a/queen/cutaway.h b/queen/cutaway.h index 238ae1005f..8ddaa5ff89 100644 --- a/queen/cutaway.h +++ b/queen/cutaway.h @@ -229,9 +229,6 @@ class Cutaway { //! Used by load to read string data void loadStrings(byte *ptr); - //! Do something special - void actionSpecialMove(int index); - //! Get persons byte *turnOnPeople(byte *ptr, CutawayObject &object); diff --git a/queen/logic.cpp b/queen/logic.cpp index 9476cbf20c..9a1a33da7b 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -1103,8 +1103,7 @@ uint16 Logic::roomRefreshObject(uint16 obj) { // check the object is in the current room if (pod->room != _currentRoom) { - warning("Logic::roomRefreshObject() - Trying to display an object (%i=%s) that is not in room (object room=%i, current room=%i)", - obj, _objName[ABS(pod->name)], pod->room, _currentRoom); + debug(0, "Trying to display an object (%i=%s) that is not in room (object room=%i, current room=%i)", obj, _objName[ABS(pod->name)], pod->room, _currentRoom); return curImage; } @@ -2602,5 +2601,654 @@ void Logic::useJournal() { } +void Logic::executeSpecialMove(uint16 sm) { + // FIXME: for now, we initialise the various 'asm' procs here but, + // in order to support the 'interview' mini-game', we will have to do + // that in a proper setupAsmForGame() or setupAsmForInterview() function. + static const SpecialMoveProc proc[40] = { + /* 00 */ + NULL, + NULL, + &Logic::asmMakeJoeUseDress, + &Logic::asmMakeJoeUseNormalClothes, + /* 04 */ + &Logic::asmMakeJoeUseUnderwear, + &Logic::asmSwitchToDressPalette, + &Logic::asmSwitchToNormalPalette, + &Logic::asmStartCarAnimation, + /* 08 */ + &Logic::asmStopCarAnimation, + &Logic::asmStartFightAnimation, + &Logic::asmWaitForFrankPosition, + &Logic::asmMakeFrankGrowing, + /* 12 */ + &Logic::asmMakeRobotGrowing, + &Logic::asmShrinkRobot, + &Logic::asmEndGame, + &Logic::asmPutCameraOnDino, + /* 16 */ + &Logic::asmPutCameraOnJoe, + NULL, // XXX alternative introduction + NULL, // XXX alternative introduction + &Logic::asmSetAzuraInLove, + /* 20 */ + &Logic::asmPanRightFromJoe, + &Logic::asmSetLightsOff, + &Logic::asmSetLightsOn, + &Logic::asmSetManequinAreaOn, + /* 24 */ + &Logic::asmPanToJoe, + &Logic::asmTurnGuardOn, + &Logic::asmPanLeft320To144, + &Logic::asmSmooch, + /* 28 */ + &Logic::asmMakeLightningHitPlane, + &Logic::asmScaleBlimp, + &Logic::asmScaleEnding, + &Logic::asmWaitForCarPosition, + /* 32 */ + &Logic::asmShakeScreen, + &Logic::asmAttemptPuzzle, + &Logic::asmScaleTitle, + NULL, // XXX PC Demo ? + /* 36 */ + &Logic::asmPanRightToHugh, + &Logic::asmMakeWhiteFlash, + &Logic::asmPanRightToJoeAndRita, + &Logic::asmPanLeftToBomb + }; + + if (sm >= ARRAYSIZE(proc) || proc[sm] == NULL) { + warning("unhandled / invalid special move : %d", sm); + } + else { + debug(0, "Special move: %d", sm); + (this->*proc[sm])(); + } +} + + +void Logic::asmMakeJoeUseDress() { + + joeUseDress(false); +} + + +void Logic::asmMakeJoeUseNormalClothes() { + + joeUseClothes(false); +} + + +void Logic::asmMakeJoeUseUnderwear() { + + joeUseUnderwear(); +} + + +void Logic::asmSwitchToDressPalette() { + + _display->palSetJoe(JP_DRESS); +} + + +void Logic::asmSwitchToNormalPalette() { + + _display->palSetJoe(JP_CLOTHES); +} + + +void Logic::asmStartCarAnimation() { + + // Carbam background animation - room 74 + _graphics->initCarBamScene(); +} + + +void Logic::asmStopCarAnimation() { + + // CR 2 - Turn off big oil splat and gun shots! + _graphics->cleanupCarBamScene(findBob(594)); // Oil object +} + + +void Logic::asmStartFightAnimation() { + + // Fight1 background animation - room 69 + _graphics->initFightBamScene(); + gameState(148, 1); +} + + +void Logic::asmWaitForFrankPosition() { + + // c69e.cut + _graphics->bamData()->flag = 2; + while (_graphics->bamData()->flag) { + update(); + } +} + + +void Logic::asmMakeFrankGrowing() { + + // c69z.cut + _graphics->bankUnpack(1, 38, 15); + BobSlot *bobFrank = _graphics->bob(5); + bobFrank->frameNum = 38; + bobFrank->curPos(160, 200); + bobFrank->box.y2 = GAME_SCREEN_HEIGHT - 1; + + int i; + for (i = 10; i <= 100; i += 4) { + bobFrank->scale = i; + update(); + } + for (i = 0; i <= 20; ++i) { + update(); + } + + objectData(521)->name = ABS(objectData(521)->name); // Dinoray + objectData(526)->name = ABS(objectData(526)->name); // Frank obj + objectData(522)->name = -ABS(objectData(522)->name); // TMPD object off + objectData(525)->name = -ABS(objectData(525)->name); // Floda guards off + objectData(523)->name = -ABS(objectData(523)->name); // Sparky object off + gameState(157, 1); // No more Ironstein +} + + +void Logic::asmMakeRobotGrowing() { + + // c69z.cut + _graphics->bankUnpack(1, 38, 15); + BobSlot *bobRobot = _graphics->bob(5); + bobRobot->frameNum = 38; + bobRobot->curPos(160, 200); + bobRobot->box.y2 = GAME_SCREEN_HEIGHT - 1; + + int i; + for (i = 10; i <= 100; i += 4) { + bobRobot->scale = i; + update(); + } + for (i = 0; i <= 20; ++i) { + update(); + } + + objectData(524)->name = -ABS(objectData(524)->name); // Azura object off + objectData(526)->name = -ABS(objectData(526)->name); // Frank object off +} + + +void Logic::asmShrinkRobot() { + + int i; + for (i = 100; i >= 35; i -= 5) { + _graphics->bob(6)->scale = i; + update(); + } +} + + +void Logic::asmEndGame() { + + int i; + for (i = 0; i < 40; ++i) { + update(); + } + OSystem::instance()->quit(); + debug(0, "Game completed"); +} + + +void Logic::asmPutCameraOnDino() { + + _graphics->cameraBob(-1); + while (_display->horizontalScroll() < 320) { + _display->horizontalScroll(_display->horizontalScroll() + 16); + if (_display->horizontalScroll() > 320) { + _display->horizontalScroll(320); + } + update(); + } + _graphics->cameraBob(1); +} + + +void Logic::asmPutCameraOnJoe() { + + _graphics->cameraBob(0); +} + + +void Logic::asmSetAzuraInLove() { + + gameState(VAR_AZURA_IN_LOVE, 1); +} + + +void Logic::asmPanRightFromJoe() { + + _graphics->cameraBob(-1); + while (_display->horizontalScroll() < 320) { + _display->horizontalScroll(_display->horizontalScroll() + 16); + if (_display->horizontalScroll() > 320) { + _display->horizontalScroll(320); + } + update(); + } +} + + +void Logic::asmSetLightsOff() { + + _display->palCustomLightsOff(currentRoom()); +} + + +void Logic::asmSetLightsOn() { + + _display->palCustomLightsOn(currentRoom()); +} + + +void Logic::asmSetManequinAreaOn() { + + area(ROOM_FLODA_FRONTDESK, 7)->mapNeighbours = ABS(area(ROOM_FLODA_FRONTDESK, 7)->mapNeighbours); +} + + +void Logic::asmPanToJoe() { + + int i = _graphics->bob(0)->x - 160; + if (i < 0) { + i = 0; + } + else if (i > 320) { + i = 320; + } + _graphics->cameraBob(-1); + if (i < _display->horizontalScroll()) { + while (_display->horizontalScroll() > i) { + _display->horizontalScroll(_display->horizontalScroll() - 16); + if (_display->horizontalScroll() < i) { + _display->horizontalScroll(i); + } + update(); + } + } + else { + while (_display->horizontalScroll() < i) { + _display->horizontalScroll(_display->horizontalScroll() + 16); + if (_display->horizontalScroll() > i ) { + _display->horizontalScroll(i); + } + } + update(); + } + _graphics->cameraBob(0); +} + + +void Logic::asmTurnGuardOn() { + + gameState(85, 1); +} + + +void Logic::asmPanLeft320To144() { + + _graphics->cameraBob(-1); + while (_display->horizontalScroll() > 144) { + _display->horizontalScroll(_display->horizontalScroll() - 8); + if (_display->horizontalScroll() < 144) { + _display->horizontalScroll(144); + } + update(); + } +} + + +void Logic::asmSmooch() { + + _graphics->cameraBob(-1); + BobSlot *bobAzura = _graphics->bob(5); + BobSlot *bobJoe = _graphics->bob(6); + while (_display->horizontalScroll() < 320) { + _display->horizontalScroll(_display->horizontalScroll() + 8); + if (bobJoe->x - bobAzura->x > 128) { + bobAzura->x += 10; + bobJoe->x += 6; + } + else { + bobAzura->x += 8; + bobJoe->x += 8; + } + update(); + } +} + + +void Logic::asmMakeLightningHitPlane() { + + _graphics->cameraBob(-1); + short iy = 0, x, ydir = -1, j, k; + + BobSlot *planeBob = _graphics->bob(5); + BobSlot *lightningBob = _graphics->bob(20); + + planeBob->box.y2 = lightningBob->box.y2 = 199; + planeBob->y = 135; + + planeBob->scale = 20; + + for (x = 660; x > 163; x -= 6) { + planeBob->x = x; + planeBob->y = 135 + iy; + + iy -= ydir; + if (iy < -9 || iy > 9) + ydir = -ydir; + + planeBob->scale++; + if (planeBob->scale > 100) + planeBob->scale = 100; + + int scrollX = x - 163; + if (scrollX > 320) + scrollX = 320; + _display->horizontalScroll(scrollX); + update(); + } + + planeBob->scale = 100; + _display->horizontalScroll(0); + + planeBob->x -= -8; + planeBob->y += 6; + + lightningBob->x = 160; + lightningBob->y = 0; + + // 23/2/95 - Play lightning SFX + // XXX sfxplay(NULLstr); + + _graphics->bankUnpack(18, lightningBob->frameNum, 15); + _graphics->bankUnpack(4, planeBob ->frameNum, 15); + + // Plane plunges into the jungle! + BobSlot *fireBob = _graphics->bob(6); + + fireBob->animating = true; + fireBob->x = planeBob->x; + fireBob->y = planeBob->y + 10; + + _graphics->bankUnpack(19, fireBob->frameNum, 15); + update(); + + k = 20; + j = 1; + + for (x = 163; x > -30; x -= 10) { + planeBob->y += 4; + fireBob->y += 4; + planeBob->x = fireBob->x = x; + + if (k < 40) { + _graphics->bankUnpack(j, planeBob->frameNum, 15); + _graphics->bankUnpack(k, fireBob ->frameNum, 15); + k++; + j++; + + if (j == 4) + j = 1; + } + + update(); + } + + _graphics->cameraBob(0); +} + + +void Logic::asmScaleBlimp() { + + int16 z = 256; + BobSlot *bob = _graphics->bob(7); + int16 x = bob->x; + int16 y = bob->y; + while (bob->x > 150) { + bob->x = x * 256 / z + 150; + bob->x = y * 256 / z + 112; + bob->scale = 100 * 256 / z; + + ++z; + if (z % 6 == 0) { + --x; + } + + update(); + } +} + + +void Logic::asmScaleEnding() { + + _graphics->bob(7)->active = false; // Turn off blimp + BobSlot *b = _graphics->bob(20); + b->x = 160; + b->y = 100; + int i; + for (i = 5; i <= 100; i += 5) { + b->scale = i; + update(); + } + for (i = 0; i < 50; ++i) { + update(); + } + _display->palFadeOut(0, 255, currentRoom()); +} + + +void Logic::asmWaitForCarPosition() { + + // Wait for car to reach correct position before pouring oil + while (_graphics->bamData()->index != 60) { + update(); + } +} + + +void Logic::asmShakeScreen() { + + OSystem::instance()->set_shake_pos(3); + update(); + OSystem::instance()->set_shake_pos(0); + update(); +} + + +void Logic::asmAttemptPuzzle() { + + static short n = 0; + ++n; + if (n & 4) { + joeSpeak(226, true); + } +} + + +void Logic::asmScaleTitle() { + + BobSlot *bob = _graphics->bob(5); + bob->animating = false; + bob->x = 161; + bob->y = 200; + bob->scale = 100; + + int i; + for (i = 5; i <= 100; i +=5) { + bob->scale = i; + bob->y -= 4; + update(); + } +} + + +void Logic::asmPanRightToHugh() { + + BobSlot *bob_thugA1 = _graphics->bob(20); + BobSlot *bob_thugA2 = _graphics->bob(21); + BobSlot *bob_thugA3 = _graphics->bob(22); + BobSlot *bob_hugh1 = _graphics->bob(1); + BobSlot *bob_hugh2 = _graphics->bob(23); + BobSlot *bob_hugh3 = _graphics->bob(24); + BobSlot *bob_thugB1 = _graphics->bob(25); + BobSlot *bob_thugB2 = _graphics->bob(26); + + _graphics->cameraBob(-1); + _input->fastMode(true); + update(); + + int i = 4, k = 160; + + // Adjust thug1 gun so it matches rest of body + bob_thugA1->x += (k / 2) * 2 - 45; + bob_thugA2->x += (k / 2) * 2; + bob_thugA3->x += (k / 2) * 2; + + bob_hugh1->x += (k / 2) * 3 + (k / 2); + bob_hugh2->x += (k / 2) * 3 + (k / 2); + bob_hugh3->x += (k / 2) * 3 + (k / 2); + + bob_thugB1->x += (k / 2) * 4 + k; + bob_thugB2->x += (k / 2) * 4 + k; + + if (i == 3) { + bob_thugB1->x += 10; + bob_thugB2->x += 10; + } + + i *= 2; + + int horizontalScroll = 0; + while (horizontalScroll < k) { + + horizontalScroll = horizontalScroll + i; + if (horizontalScroll > k) + horizontalScroll = k; + + //debug(0, "horizontalScroll = %i", horizontalScroll); + + _display->horizontalScroll(horizontalScroll); + + bob_thugA1->x -= i * 2; + bob_thugA2->x -= i * 2; + bob_thugA3->x -= i * 2; + + bob_hugh1->x -= i * 3; + bob_hugh2->x -= i * 3; + bob_hugh3->x -= i * 3; + + bob_thugB1->x -= i * 4; + bob_thugB2->x -= i * 4; + + update(); + + if (_input->cutawayQuit()) + return; + } + + _input->fastMode(false); +} + + +void Logic::asmMakeWhiteFlash() { + + _display->palCustomFlash(); +} + + +void Logic::asmPanRightToJoeAndRita() { // cdint.cut + + BobSlot *bob_box = _graphics->bob(20); + BobSlot *bob_beam = _graphics->bob(21); + BobSlot *bob_crate = _graphics->bob(22); + BobSlot *bob_clock = _graphics->bob(23); + BobSlot *bob_hands = _graphics->bob(24); + + _graphics->cameraBob(-1); + _input->fastMode(true); + + update(); + + bob_box ->x += 280 * 2; + bob_beam ->x += 30; + bob_crate->x += 180 * 3; + + int horizontalScroll = _display->horizontalScroll(); + + int i = 1; + while (horizontalScroll < 290) { + + horizontalScroll = horizontalScroll + i; + if (horizontalScroll > 290) + horizontalScroll = 290; + + //debug(0, "horizontalScroll = %i", horizontalScroll); + + _display->horizontalScroll(horizontalScroll); + + bob_box ->x -= i * 2; + bob_beam ->x -= i; + bob_crate->x -= i * 3; + bob_clock->x -= i * 2; + bob_hands->x -= i * 2; + + update(); + + if (_input->cutawayQuit()) + return; + } + _input->fastMode(false); +} + + +void Logic::asmPanLeftToBomb() { // cdint.cut + + BobSlot *bob21 = _graphics->bob(21); + BobSlot *bob22 = _graphics->bob(22); + + _graphics->cameraBob(-1); + _input->fastMode(true); + + int horizontalScroll = _display->horizontalScroll(); + + int i = 5; + while (horizontalScroll > 0 || bob21->x < 136) { + + horizontalScroll -= i; + if (horizontalScroll < 0) + horizontalScroll = 0; + + //debug(0, "horizontalScroll = %i", horizontalScroll); + _display->horizontalScroll(horizontalScroll); + + if (horizontalScroll < 272 && bob21->x < 136) + bob21->x += (i/2); + + bob22->x += i; + + update(); + + if (_input->cutawayQuit()) + return; + } + + _input->fastMode(false); +} + + + } // End of namespace Queen diff --git a/queen/logic.h b/queen/logic.h index 604edb06a6..14575c0250 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -273,15 +273,6 @@ public: void inventoryDeleteItem(uint16 itemNum, bool refresh = true); void inventoryScroll(uint16 count, bool up); - //! Ugly hack from original code - void sceneReset() { _scene = 0; } - - //! Make a scene - void sceneStart(); - - //! Stop making a scene - void sceneStop(); - //! Copy data from dummy object to object void objectCopy(int dummyObjectIndex, int objectIndex); @@ -293,16 +284,66 @@ public: void update(); - void useJournal(); - bool gameSave(uint16 slot, const char *desc); bool gameLoad(uint16 slot); + //! Ugly hack from original code + void sceneReset() { _scene = 0; } + + //! Make a scene + void sceneStart(); + + //! Stop making a scene + void sceneStop(); + + void useJournal(); + + void executeSpecialMove(uint16 sm); + + void asmMakeJoeUseDress(); + void asmMakeJoeUseNormalClothes(); + void asmMakeJoeUseUnderwear(); + void asmSwitchToDressPalette(); + void asmSwitchToNormalPalette(); + void asmStartCarAnimation(); + void asmStopCarAnimation(); + void asmStartFightAnimation(); + void asmWaitForFrankPosition(); + void asmMakeFrankGrowing(); + void asmMakeRobotGrowing(); + void asmShrinkRobot(); + void asmEndGame(); + void asmPutCameraOnDino(); + void asmPutCameraOnJoe(); + void asmSetAzuraInLove(); + void asmPanRightFromJoe(); + void asmSetLightsOff(); + void asmSetLightsOn(); + void asmSetManequinAreaOn(); + void asmPanToJoe(); + void asmTurnGuardOn(); + void asmPanLeft320To144(); + void asmSmooch(); + void asmMakeLightningHitPlane(); + void asmScaleBlimp(); + void asmScaleEnding(); + void asmWaitForCarPosition(); + void asmShakeScreen(); + void asmAttemptPuzzle(); + void asmScaleTitle(); + void asmPanRightToHugh(); + void asmMakeWhiteFlash(); + void asmPanRightToJoeAndRita(); + void asmPanLeftToBomb(); + Walk *walk() const { return _walk; } Display *display() const { return _display; } Command *command() const { return _cmd; } Resource *resource() const { return _resource; } + + typedef void (Logic::*SpecialMoveProc)(); + enum { MAX_ZONES_NUMBER = 32, MAX_AREAS_NUMBER = 11, -- cgit v1.2.3