GNAP: Refactor scene 11

This commit is contained in:
Strangerke 2016-04-21 07:11:15 +02:00 committed by Eugene Sandulenko
parent 076d23fdb6
commit b535ef3abe
5 changed files with 268 additions and 224 deletions

View File

@ -2018,9 +2018,6 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) {
////////////////////////////////////////////////////////////////////////////////
void GnapEngine::initGlobalSceneVars() {
// Scene 11
_s11_billardBallCtr = 0;
// Scene 13
_s13_backToiletCtr = -1;

View File

@ -603,15 +603,6 @@ public:
void sceneXX_playRandomSound(int timerIndex);
void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3);
// Scene 11
int _s11_billardBallCtr;
int _s11_nextHookGuySequenceId, _s11_currHookGuySequenceId;
int _s11_nextGoggleGuySequenceId, _s11_currGoggleGuySequenceId;
int scene11_init();
void scene11_updateHotspots();
void scene11_run();
void scene11_updateAnimations();
// Scene 12
int _s12_nextBeardGuySequenceId, _s12_currBeardGuySequenceId;
int _s12_nextToothGuySequenceId, _s12_currToothGuySequenceId;

View File

@ -23,6 +23,7 @@
#include "gnap/gnap.h"
#include "gnap/gamesys.h"
#include "gnap/resource.h"
#include "gnap/scenes/scene11.h"
namespace Gnap {
@ -52,118 +53,122 @@ enum {
kASGrabBillardBall = 11
};
int GnapEngine::scene11_init() {
_gameSys->setAnimation(0, 0, 0);
_gameSys->setAnimation(0, 0, 3);
_gameSys->setAnimation(0, 0, 2);
if (_prevSceneNum == 10 || _prevSceneNum == 13) {
playSound(0x108EC, false);
playSound(0x10928, false);
Scene11::Scene11(GnapEngine *vm) : Scene(vm) {
_s11_billardBallCtr = 0;
_s11_nextHookGuySequenceId = -1;
_s11_currHookGuySequenceId = -1;
_s11_nextGoggleGuySequenceId = -1;
_s11_currGoggleGuySequenceId = -1;
}
int Scene11::init() {
_vm->_gameSys->setAnimation(0, 0, 0);
_vm->_gameSys->setAnimation(0, 0, 3);
_vm->_gameSys->setAnimation(0, 0, 2);
if (_vm->_prevSceneNum == 10 || _vm->_prevSceneNum == 13) {
_vm->playSound(0x108EC, false);
_vm->playSound(0x10928, false);
}
return 0x209;
}
void GnapEngine::scene11_updateHotspots() {
setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
setHotspot(kHSExitKitchen, 420, 140, 520, 345, SF_EXIT_U_CURSOR);
setHotspot(kHSExitToilet, 666, 130, 740, 364, SF_EXIT_R_CURSOR);
setHotspot(kHSExitLeft, 0, 350, 10, 599, SF_EXIT_L_CURSOR | SF_WALKABLE);
setHotspot(kHSGoggleGuy, 90, 185, 185, 340, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
setHotspot(kHSHookGuy, 210, 240, 340, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
setHotspot(kHSBillard, 640, 475, 700, 530, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
setHotspot(kHSWalkArea1, 0, 0, 365, 453);
setHotspot(kHSWalkArea2, 0, 0, 629, 353);
setHotspot(kHSWalkArea3, 629, 0, 799, 364);
setHotspot(kHSWalkArea4, 735, 0, 799, 397);
setHotspot(kHSWalkArea5, 510, 540, 799, 599);
setDeviceHotspot(kHSDevice, -1, -1, -1, -1);
_hotspotsCount = 13;
void Scene11::updateHotspots() {
_vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
_vm->setHotspot(kHSExitKitchen, 420, 140, 520, 345, SF_EXIT_U_CURSOR);
_vm->setHotspot(kHSExitToilet, 666, 130, 740, 364, SF_EXIT_R_CURSOR);
_vm->setHotspot(kHSExitLeft, 0, 350, 10, 599, SF_EXIT_L_CURSOR | SF_WALKABLE);
_vm->setHotspot(kHSGoggleGuy, 90, 185, 185, 340, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
_vm->setHotspot(kHSHookGuy, 210, 240, 340, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
_vm->setHotspot(kHSBillard, 640, 475, 700, 530, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
_vm->setHotspot(kHSWalkArea1, 0, 0, 365, 453);
_vm->setHotspot(kHSWalkArea2, 0, 0, 629, 353);
_vm->setHotspot(kHSWalkArea3, 629, 0, 799, 364);
_vm->setHotspot(kHSWalkArea4, 735, 0, 799, 397);
_vm->setHotspot(kHSWalkArea5, 510, 540, 799, 599);
_vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1);
_vm->_hotspotsCount = 13;
}
void GnapEngine::scene11_run() {
void Scene11::run() {
bool flag = true;
_timers[7] = 50;
_hotspots[kHSBillard]._flags |= SF_DISABLED;
_vm->_timers[7] = 50;
_vm->_hotspots[kHSBillard]._flags |= SF_DISABLED;
_s11_currGoggleGuySequenceId = 0x1F9;
_s11_currHookGuySequenceId = 0x201;
switch (_prevSceneNum) {
switch (_vm->_prevSceneNum) {
case 13:
initGnapPos(8, 5, kDirBottomLeft);
initPlatypusPos(9, 6, kDirUnk4);
_vm->initGnapPos(8, 5, kDirBottomLeft);
_vm->initPlatypusPos(9, 6, kDirUnk4);
break;
case 47:
initGnapPos(8, 5, kDirBottomLeft);
initPlatypusPos(9, 5, kDirUnk4);
_vm->initGnapPos(8, 5, kDirBottomLeft);
_vm->initPlatypusPos(9, 5, kDirUnk4);
_s11_currGoggleGuySequenceId = 0x1FA;
_s11_currHookGuySequenceId = 0x1FF;
_timers[7] = 180;
_vm->_timers[7] = 180;
break;
case 12:
initGnapPos(-1, 9, kDirBottomRight);
initPlatypusPos(-2, 8, kDirNone);
_vm->initGnapPos(-1, 9, kDirBottomRight);
_vm->initPlatypusPos(-2, 8, kDirNone);
break;
default:
initGnapPos(6, 6, kDirBottomLeft);
initPlatypusPos(6, 5, kDirUnk4);
_vm->initGnapPos(6, 6, kDirBottomLeft);
_vm->initPlatypusPos(6, 5, kDirUnk4);
break;
}
queueInsertDeviceIcon();
_vm->queueInsertDeviceIcon();
_gameSys->insertSequence(_s11_currHookGuySequenceId, 120, 0, 0, kSeqNone, 0, 0, 0);
_vm->_gameSys->insertSequence(_s11_currHookGuySequenceId, 120, 0, 0, kSeqNone, 0, 0, 0);
_s11_nextHookGuySequenceId = -1;
_gameSys->setAnimation(_s11_currHookGuySequenceId, 120, 3);
_gameSys->insertSequence(_s11_currGoggleGuySequenceId, 121, 0, 0, kSeqNone, 0, 0, 0);
_vm->_gameSys->setAnimation(_s11_currHookGuySequenceId, 120, 3);
_vm->_gameSys->insertSequence(_s11_currGoggleGuySequenceId, 121, 0, 0, kSeqNone, 0, 0, 0);
_s11_nextGoggleGuySequenceId = -1;
_gameSys->setAnimation(_s11_currGoggleGuySequenceId, 121, 2);
_vm->_gameSys->setAnimation(_s11_currGoggleGuySequenceId, 121, 2);
_timers[5] = getRandom(100) + 75;
_timers[4] = getRandom(40) + 20;
_timers[6] = getRandom(100) + 100;
endSceneInit();
_vm->_timers[5] = _vm->getRandom(100) + 75;
_vm->_timers[4] = _vm->getRandom(40) + 20;
_vm->_timers[6] = _vm->getRandom(100) + 100;
_vm->endSceneInit();
if (_prevSceneNum == 12) {
gnapWalkTo(2, 8, -1, 0x107B9, 1);
platypusWalkTo(1, 8, -1, 0x107C2, 1);
if (_vm->_prevSceneNum == 12) {
_vm->gnapWalkTo(2, 8, -1, 0x107B9, 1);
_vm->platypusWalkTo(1, 8, -1, 0x107C2, 1);
}
_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0);
_vm->_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0);
while (!_sceneDone) {
while (!_vm->_sceneDone) {
_vm->testWalk(0, 0, -1, -1, -1, -1);
testWalk(0, 0, -1, -1, -1, -1);
_vm->updateMouseCursor();
_vm->updateCursorByHotspot();
updateMouseCursor();
updateCursorByHotspot();
_vm->_sceneClickedHotspot = _vm->getClickedHotspotId();
_vm->updateGrabCursorSprite(0, 0);
_sceneClickedHotspot = getClickedHotspotId();
updateGrabCursorSprite(0, 0);
switch (_sceneClickedHotspot) {
switch (_vm->_sceneClickedHotspot) {
case kHSPlatypus:
if (_grabCursorSpriteIndex >= 0) {
playGnapImpossible(0, 0);
if (_vm->_grabCursorSpriteIndex >= 0) {
_vm->playGnapImpossible(0, 0);
} else {
switch (_verbCursor) {
switch (_vm->_verbCursor) {
case LOOK_CURSOR:
playGnapMoan1(_platX, _platY);
_vm->playGnapMoan1(_vm->_platX, _vm->_platY);
break;
case GRAB_CURSOR:
gnapKissPlatypus(0);
_vm->gnapKissPlatypus(0);
break;
case TALK_CURSOR:
playGnapBrainPulsating(_platX, _platY);
playPlatypusSequence(getPlatypusSequenceId());
_vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY);
_vm->playPlatypusSequence(_vm->getPlatypusSequenceId());
break;
case PLAT_CURSOR:
break;
@ -172,50 +177,50 @@ void GnapEngine::scene11_run() {
break;
case kHSExitKitchen:
_isLeavingScene = true;
gnapWalkTo(6, 5, 0, 0x107BF, 1);
_gnapActionStatus = kASLeaveScene;
platypusWalkTo(6, 6, -1, -1, 1);
_newSceneNum = 10;
_vm->_isLeavingScene = true;
_vm->gnapWalkTo(6, 5, 0, 0x107BF, 1);
_vm->_gnapActionStatus = kASLeaveScene;
_vm->platypusWalkTo(6, 6, -1, -1, 1);
_vm->_newSceneNum = 10;
break;
case kHSExitToilet:
_isLeavingScene = true;
gnapWalkTo(8, 5, 0, 0x107BF, 1);
_gnapActionStatus = kASLeaveScene;
platypusWalkTo(8, 6, -1, -1, 1);
_newSceneNum = 13;
_vm->_isLeavingScene = true;
_vm->gnapWalkTo(8, 5, 0, 0x107BF, 1);
_vm->_gnapActionStatus = kASLeaveScene;
_vm->platypusWalkTo(8, 6, -1, -1, 1);
_vm->_newSceneNum = 13;
break;
case kHSExitLeft:
_isLeavingScene = true;
gnapWalkTo(-1, 8, 0, 0x107AF, 1);
_gnapActionStatus = kASLeaveScene;
platypusWalkTo(-1, 9, -1, 0x107CF, 1);
_newSceneNum = 12;
_vm->_isLeavingScene = true;
_vm->gnapWalkTo(-1, 8, 0, 0x107AF, 1);
_vm->_gnapActionStatus = kASLeaveScene;
_vm->platypusWalkTo(-1, 9, -1, 0x107CF, 1);
_vm->_newSceneNum = 12;
break;
case kHSGoggleGuy:
if (_gnapActionStatus < 0) {
if (_grabCursorSpriteIndex == kItemMagazine) {
gnapWalkTo(3, 7, 0, 0x107BC, 1);
_gnapActionStatus = kASShowMagazineToGoggleGuy;
playGnapShowItem(_grabCursorSpriteIndex, 2, 0);
} else if (_grabCursorSpriteIndex >= 0) {
playGnapShowCurrItem(3, 7, 2, 0);
if (_vm->_gnapActionStatus < 0) {
if (_vm->_grabCursorSpriteIndex == kItemMagazine) {
_vm->gnapWalkTo(3, 7, 0, 0x107BC, 1);
_vm->_gnapActionStatus = kASShowMagazineToGoggleGuy;
_vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0);
} else if (_vm->_grabCursorSpriteIndex >= 0) {
_vm->playGnapShowCurrItem(3, 7, 2, 0);
} else {
switch (_verbCursor) {
switch (_vm->_verbCursor) {
case LOOK_CURSOR:
playGnapScratchingHead(1, 6);
_vm->playGnapScratchingHead(1, 6);
break;
case GRAB_CURSOR:
case PLAT_CURSOR:
playGnapImpossible(0, 0);
_vm->playGnapImpossible(0, 0);
break;
case TALK_CURSOR:
_gnapIdleFacing = kDirUpLeft;
gnapWalkTo(3, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1);
_gnapActionStatus = kASTalkGoggleGuy;
_vm->_gnapIdleFacing = kDirUpLeft;
_vm->gnapWalkTo(3, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1);
_vm->_gnapActionStatus = kASTalkGoggleGuy;
break;
}
}
@ -223,28 +228,28 @@ void GnapEngine::scene11_run() {
break;
case kHSHookGuy:
if (_gnapActionStatus < 0) {
_gnapIdleFacing = kDirUpRight;
if (_grabCursorSpriteIndex >= 0) {
gnapWalkTo(5, 6, 0, 0x107BC, 9);
_gnapActionStatus = kASShowItemToHookGuy;
playGnapShowItem(_grabCursorSpriteIndex, 4, 0);
if (_vm->_gnapActionStatus < 0) {
_vm->_gnapIdleFacing = kDirUpRight;
if (_vm->_grabCursorSpriteIndex >= 0) {
_vm->gnapWalkTo(5, 6, 0, 0x107BC, 9);
_vm->_gnapActionStatus = kASShowItemToHookGuy;
_vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 4, 0);
} else {
switch (_verbCursor) {
switch (_vm->_verbCursor) {
case LOOK_CURSOR:
playGnapSequence(getGnapSequenceId(gskDeflect, 3, 6) | 0x10000);
_vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 3, 6) | 0x10000);
break;
case GRAB_CURSOR:
gnapWalkTo(5, 6, 0, 0x107BC, 1);
_gnapActionStatus = kASGrabHookGuy;
_vm->gnapWalkTo(5, 6, 0, 0x107BC, 1);
_vm->_gnapActionStatus = kASGrabHookGuy;
break;
case TALK_CURSOR:
_gnapIdleFacing = kDirBottomLeft;
gnapWalkTo(5, 6, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1);
_gnapActionStatus = kASTalkHookGuy;
_vm->_gnapIdleFacing = kDirBottomLeft;
_vm->gnapWalkTo(5, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1);
_vm->_gnapActionStatus = kASTalkHookGuy;
break;
case PLAT_CURSOR:
playGnapImpossible(0, 0);
_vm->playGnapImpossible(0, 0);
break;
}
}
@ -252,21 +257,21 @@ void GnapEngine::scene11_run() {
break;
case kHSBillard:
if (_gnapActionStatus < 0) {
if (_grabCursorSpriteIndex >= 0) {
playGnapImpossible(9, 8);
if (_vm->_gnapActionStatus < 0) {
if (_vm->_grabCursorSpriteIndex >= 0) {
_vm->playGnapImpossible(9, 8);
} else {
switch (_verbCursor) {
switch (_vm->_verbCursor) {
case LOOK_CURSOR:
playGnapScratchingHead(9, 8);
_vm->playGnapScratchingHead(9, 8);
break;
case GRAB_CURSOR:
gnapWalkTo(9, 8, 0, 0x107BA, 1);
_gnapActionStatus = kASGrabBillardBall;
_vm->gnapWalkTo(9, 8, 0, 0x107BA, 1);
_vm->_gnapActionStatus = kASGrabBillardBall;
break;
case TALK_CURSOR:
case PLAT_CURSOR:
playGnapImpossible(9, 8);
_vm->playGnapImpossible(9, 8);
break;
}
}
@ -278,50 +283,50 @@ void GnapEngine::scene11_run() {
case kHSWalkArea3:
case kHSWalkArea4:
case kHSWalkArea5:
if (_gnapActionStatus < 0)
gnapWalkTo(-1, -1, -1, -1, 1);
if (_vm->_gnapActionStatus < 0)
_vm->gnapWalkTo(-1, -1, -1, -1, 1);
break;
case kHSDevice:
if (_gnapActionStatus < 0) {
runMenu();
scene11_updateHotspots();
if (_vm->_gnapActionStatus < 0) {
_vm->runMenu();
updateHotspots();
}
break;
default:
if (_mouseClickState._left && _gnapActionStatus < 0) {
gnapWalkTo(-1, -1, -1, -1, 1);
_mouseClickState._left = false;
if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) {
_vm->gnapWalkTo(-1, -1, -1, -1, 1);
_vm->_mouseClickState._left = false;
}
break;
}
scene11_updateAnimations();
updateAnimations();
if (!_isLeavingScene) {
if (flag && !_timers[7]) {
if (!_vm->_isLeavingScene) {
if (flag && !_vm->_timers[7]) {
flag = false;
_gameSys->setAnimation(0x207, 257, 4);
_gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0);
_vm->_gameSys->setAnimation(0x207, 257, 4);
_vm->_gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0);
}
platypusSub426234();
updateGnapIdleSequence2();
if (!_timers[5]) {
_timers[5] = getRandom(100) + 75;
if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s11_nextGoggleGuySequenceId == -1) {
if (getRandom(2))
_vm->platypusSub426234();
_vm->updateGnapIdleSequence2();
if (!_vm->_timers[5]) {
_vm->_timers[5] = _vm->getRandom(100) + 75;
if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s11_nextGoggleGuySequenceId == -1) {
if (_vm->getRandom(2))
_s11_nextGoggleGuySequenceId = 0x1F6;
else
_s11_nextGoggleGuySequenceId = 0x1F9;
}
}
if (!_timers[4]) {
_timers[4] = getRandom(40) + 20;
if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s11_nextHookGuySequenceId == -1) {
if (!_vm->_timers[4]) {
_vm->_timers[4] = _vm->getRandom(40) + 20;
if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s11_nextHookGuySequenceId == -1) {
if (_s11_currHookGuySequenceId == 0x201) {
switch (getRandom(7)) {
switch (_vm->getRandom(7)) {
case 0:
_s11_nextHookGuySequenceId = 0x200;
break;
@ -340,47 +345,44 @@ void GnapEngine::scene11_run() {
}
}
}
if (!_timers[6]) {
_timers[6] = getRandom(100) + 100;
int _gnapRandomValue = getRandom(3);
if (!_vm->_timers[6]) {
_vm->_timers[6] = _vm->getRandom(100) + 100;
int _gnapRandomValue = _vm->getRandom(3);
switch (_gnapRandomValue) {
case 0:
_gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0);
_vm->_gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0);
break;
case 1:
_gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0);
_vm->_gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0);
break;
case 2:
_gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0);
_vm->_gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0);
break;
}
}
}
checkGameKeys();
_vm->checkGameKeys();
if (isKeyStatus1(8)) {
clearKeyStatus1(8);
runMenu();
scene11_updateHotspots();
_timers[5] = getRandom(50) + 75;
_timers[4] = getRandom(40) + 20;
if (_vm->isKeyStatus1(8)) {
_vm->clearKeyStatus1(8);
_vm->runMenu();
updateHotspots();
_vm->_timers[5] = _vm->getRandom(50) + 75;
_vm->_timers[4] = _vm->getRandom(40) + 20;
}
gameUpdateTick();
_vm->gameUpdateTick();
}
}
void GnapEngine::scene11_updateAnimations() {
if (_gameSys->getAnimationStatus(0) == 2) {
if (_gnapActionStatus != kASGrabBillardBall)
_gameSys->setAnimation(0, 0, 0);
switch (_gnapActionStatus) {
void Scene11::updateAnimations() {
if (_vm->_gameSys->getAnimationStatus(0) == 2) {
if (_vm->_gnapActionStatus != kASGrabBillardBall)
_vm->_gameSys->setAnimation(0, 0, 0);
switch (_vm->_gnapActionStatus) {
case kASLeaveScene:
_sceneDone = true;
_vm->_sceneDone = true;
break;
case kASShowMagazineToGoggleGuy:
_s11_nextGoggleGuySequenceId = 0x1F7;
@ -398,20 +400,20 @@ void GnapEngine::scene11_updateAnimations() {
_s11_nextHookGuySequenceId = 0x206;
break;
case kASGrabBillardBall:
if (_gameSys->getAnimationStatus(2) == 2 && _gameSys->getAnimationStatus(3) == 2) {
_gameSys->setAnimation(0, 0, 0);
_timers[2] = getRandom(30) + 20;
_timers[3] = getRandom(50) + 200;
_gameSys->insertSequence(0x1F4, 255, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0);
_gnapSequenceId = 0x1F4;
_gnapId = 255;
_gnapSequenceDatNum = 0;
_gameSys->removeSequence(0x207, 257, true);
_gameSys->removeSequence(0x208, 256, true);
if (_vm->_gameSys->getAnimationStatus(2) == 2 && _vm->_gameSys->getAnimationStatus(3) == 2) {
_vm->_gameSys->setAnimation(0, 0, 0);
_vm->_timers[2] = _vm->getRandom(30) + 20;
_vm->_timers[3] = _vm->getRandom(50) + 200;
_vm->_gameSys->insertSequence(0x1F4, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0);
_vm->_gnapSequenceId = 0x1F4;
_vm->_gnapId = 255;
_vm->_gnapSequenceDatNum = 0;
_vm->_gameSys->removeSequence(0x207, 257, true);
_vm->_gameSys->removeSequence(0x208, 256, true);
_s11_nextGoggleGuySequenceId = 0x1F8;
_timers[5] = getRandom(100) + 75;
_gameSys->insertSequence(_s11_nextGoggleGuySequenceId, 121, _s11_currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0);
_gameSys->setAnimation(_s11_nextGoggleGuySequenceId, 121, 2);
_vm->_timers[5] = _vm->getRandom(100) + 75;
_vm->_gameSys->insertSequence(_s11_nextGoggleGuySequenceId, 121, _s11_currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0);
_vm->_gameSys->setAnimation(_s11_nextGoggleGuySequenceId, 121, 2);
_s11_currGoggleGuySequenceId = _s11_nextGoggleGuySequenceId;
_s11_nextGoggleGuySequenceId = -1;
switch (_s11_billardBallCtr) {
@ -426,61 +428,60 @@ void GnapEngine::scene11_updateAnimations() {
break;
}
++_s11_billardBallCtr;
_gameSys->insertSequence(_s11_nextHookGuySequenceId, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0);
_gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3);
_vm->_gameSys->insertSequence(_s11_nextHookGuySequenceId, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0);
_vm->_gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3);
_s11_currHookGuySequenceId = _s11_nextHookGuySequenceId;
_s11_nextHookGuySequenceId = -1;
_timers[4] = getRandom(40) + 20;
_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, getSequenceTotalDuration(0x1F4) - 5, 0, 0);
_hotspots[kHSBillard]._flags |= SF_DISABLED;
_gameSys->setAnimation(0x207, 257, 4);
_gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, getSequenceTotalDuration(0x1FE), 0, 0);
_gnapActionStatus = -1;
_vm->_timers[4] = _vm->getRandom(40) + 20;
_vm->_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1F4) - 5, 0, 0);
_vm->_hotspots[kHSBillard]._flags |= SF_DISABLED;
_vm->_gameSys->setAnimation(0x207, 257, 4);
_vm->_gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1FE), 0, 0);
_vm->_gnapActionStatus = -1;
}
break;
}
}
if (_gameSys->getAnimationStatus(2) == 2 && _s11_nextGoggleGuySequenceId != -1) {
_timers[5] = getRandom(100) + 75;
_gameSys->insertSequence(_s11_nextGoggleGuySequenceId, 121, _s11_currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0);
_gameSys->setAnimation(_s11_nextGoggleGuySequenceId, 121, 2);
if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s11_nextGoggleGuySequenceId != -1) {
_vm->_timers[5] = _vm->getRandom(100) + 75;
_vm->_gameSys->insertSequence(_s11_nextGoggleGuySequenceId, 121, _s11_currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0);
_vm->_gameSys->setAnimation(_s11_nextGoggleGuySequenceId, 121, 2);
_s11_currGoggleGuySequenceId = _s11_nextGoggleGuySequenceId;
_s11_nextGoggleGuySequenceId = -1;
if (_gnapActionStatus >= 1 && _gnapActionStatus <= 4)
_gnapActionStatus = -1;
if (_vm->_gnapActionStatus >= 1 && _vm->_gnapActionStatus <= 4)
_vm->_gnapActionStatus = -1;
}
if (_gameSys->getAnimationStatus(3) == 2) {
if (_vm->_gameSys->getAnimationStatus(3) == 2) {
if (_s11_nextHookGuySequenceId == 0x204) {
_gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3);
_gameSys->insertSequence(0x204, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0);
_gameSys->insertSequence(0x1F5, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0);
_vm->_gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3);
_vm->_gameSys->insertSequence(0x204, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0);
_vm->_gameSys->insertSequence(0x1F5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0);
_s11_currHookGuySequenceId = 0x204;
_s11_nextHookGuySequenceId = -1;
_gnapSequenceId = 0x1F5;
_gnapSequenceDatNum = 0;
_timers[4] = getRandom(40) + 20;
_timers[2] = getRandom(20) + 70;
_timers[3] = getRandom(50) + 200;
if (_gnapActionStatus == kASGrabHookGuy)
_gnapActionStatus = -1;
_vm->_gnapSequenceId = 0x1F5;
_vm->_gnapSequenceDatNum = 0;
_vm->_timers[4] = _vm->getRandom(40) + 20;
_vm->_timers[2] = _vm->getRandom(20) + 70;
_vm->_timers[3] = _vm->getRandom(50) + 200;
if (_vm->_gnapActionStatus == kASGrabHookGuy)
_vm->_gnapActionStatus = -1;
} else if (_s11_nextHookGuySequenceId != -1) {
_gameSys->insertSequence(_s11_nextHookGuySequenceId, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0);
_gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3);
_vm->_gameSys->insertSequence(_s11_nextHookGuySequenceId, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0);
_vm->_gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3);
_s11_currHookGuySequenceId = _s11_nextHookGuySequenceId;
_s11_nextHookGuySequenceId = -1;
_timers[4] = getRandom(40) + 20;
if (_gnapActionStatus >= 6 && _gnapActionStatus <= 9)
_gnapActionStatus = -1;
_vm->_timers[4] = _vm->getRandom(40) + 20;
if (_vm->_gnapActionStatus >= 6 && _vm->_gnapActionStatus <= 9)
_vm->_gnapActionStatus = -1;
}
}
if (_gameSys->getAnimationStatus(4) == 2) {
_gameSys->setAnimation(0, 0, 4);
_hotspots[kHSBillard]._flags &= ~SF_DISABLED;
if (_vm->_gameSys->getAnimationStatus(4) == 2) {
_vm->_gameSys->setAnimation(0, 0, 4);
_vm->_hotspots[kHSBillard]._flags &= ~SF_DISABLED;
}
}
} // End of namespace Gnap

View File

@ -0,0 +1,53 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef GNAP_SCENE11_H
#define GNAP_SCENE11_H
#include "gnap/debugger.h"
#include "gnap/scenes/scenecore.h"
namespace Gnap {
class GnapEngine;
class Scene11: public Scene {
public:
Scene11(GnapEngine *vm);
~Scene11() {}
virtual int init();
virtual void updateHotspots();
virtual void run();
virtual void updateAnimations();
virtual void updateAnimationsCb() {};
private:
int _s11_billardBallCtr;
int _s11_nextHookGuySequenceId;
int _s11_currHookGuySequenceId;
int _s11_nextGoggleGuySequenceId;
int _s11_currGoggleGuySequenceId;
};
} // End of namespace Gnap
#endif // GNAP_SCENE11_H

View File

@ -36,6 +36,7 @@
#include "gnap/scenes/scene08.h"
#include "gnap/scenes/scene09.h"
#include "gnap/scenes/scene10.h"
#include "gnap/scenes/scene11.h"
namespace Gnap {
@ -119,8 +120,9 @@ int GnapEngine::initSceneLogic() {
initSceneGrid(21, 146, 11, 10);
break;
case 11:
backgroundId = scene11_init();
scene11_updateHotspots();
_scene = new Scene11(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
@ -438,7 +440,7 @@ void GnapEngine::runSceneLogic() {
_newSceneNum = 11;
break;
case 11:
scene11_run();
_scene->run();
if (_newSceneNum == 55)
_newSceneNum = 12;
break;