GNAP: Refactor scenes 25 & 26

This commit is contained in:
Strangerke 2016-04-23 12:11:01 +02:00 committed by Eugene Sandulenko
parent 417d8066c9
commit 7479a2b73c
6 changed files with 409 additions and 320 deletions

View File

@ -606,21 +606,6 @@ public:
// Scene 18
int _s18_garbageCanPos;
// Scene 25
int _s25_currTicketVendorSequenceId, _s25_nextTicketVendorSequenceId;
int scene25_init();
void scene25_updateHotspots();
void scene25_playAnims(int index);
void scene25_run();
void scene25_updateAnimations();
// Scene 26
int _s26_currKidSequenceId, _s26_nextKidSequenceId;
int scene26_init();
void scene26_updateHotspots();
void scene26_run();
void scene26_updateAnimations();
// Scene 27
int _s27_nextJanitorSequenceId;
int _s27_currJanitorSequenceId;

View File

@ -23,6 +23,7 @@
#include "gnap/gnap.h"
#include "gnap/gamesys.h"
#include "gnap/resource.h"
#include "gnap/scenes/scene25.h"
namespace Gnap {
@ -49,127 +50,128 @@ enum {
kASLeaveScene = 5
};
int GnapEngine::scene25_init() {
Scene25::Scene25(GnapEngine *vm) : Scene(vm) {
_s25_currTicketVendorSequenceId = -1;
_s25_nextTicketVendorSequenceId = -1;
}
int Scene25::init() {
return 0x62;
}
void GnapEngine::scene25_updateHotspots() {
setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
setHotspot(kHSTicketVendor, 416, 94, 574, 324, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 5);
setHotspot(kHSExitOutsideCircusWorld, 0, 519, 205, 600, SF_EXIT_SW_CURSOR, 5, 10);
setHotspot(kHSExitInsideCircusWorld, 321, 70, 388, 350, SF_EXIT_NE_CURSOR, 3, 6);
setHotspot(kHSPosters1, 0, 170, 106, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7);
setHotspot(kHSPosters2, 146, 192, 254, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7);
setHotspot(kHSPosters3, 606, 162, 654, 368, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 7);
setHotspot(kHSPosters4, 708, 114, 754, 490, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8);
setHotspot(kHSWalkArea1, 0, 0, 800, 439);
setHotspot(kHSWalkArea2, 585, 0, 800, 600);
setDeviceHotspot(kHSDevice, -1, -1, -1, -1);
_hotspotsCount = 11;
void Scene25::updateHotspots() {
_vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
_vm->setHotspot(kHSTicketVendor, 416, 94, 574, 324, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 5);
_vm->setHotspot(kHSExitOutsideCircusWorld, 0, 519, 205, 600, SF_EXIT_SW_CURSOR, 5, 10);
_vm->setHotspot(kHSExitInsideCircusWorld, 321, 70, 388, 350, SF_EXIT_NE_CURSOR, 3, 6);
_vm->setHotspot(kHSPosters1, 0, 170, 106, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7);
_vm->setHotspot(kHSPosters2, 146, 192, 254, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7);
_vm->setHotspot(kHSPosters3, 606, 162, 654, 368, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 7);
_vm->setHotspot(kHSPosters4, 708, 114, 754, 490, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8);
_vm->setHotspot(kHSWalkArea1, 0, 0, 800, 439);
_vm->setHotspot(kHSWalkArea2, 585, 0, 800, 600);
_vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1);
_vm->_hotspotsCount = 11;
}
void GnapEngine::scene25_playAnims(int index) {
void Scene25::playAnims(int index) {
if (index > 4)
return;
hideCursor();
setGrabCursorSprite(-1);
_vm->hideCursor();
_vm->setGrabCursorSprite(-1);
switch (index) {
case 1:
_largeSprite = _gameSys->createSurface(0x25);
_vm->_largeSprite = _vm->_gameSys->createSurface(0x25);
break;
case 2:
_largeSprite = _gameSys->createSurface(0x26);
_vm->_largeSprite = _vm->_gameSys->createSurface(0x26);
break;
case 3:
_largeSprite = _gameSys->createSurface(0x27);
_vm->_largeSprite = _vm->_gameSys->createSurface(0x27);
break;
case 4:
_largeSprite = _gameSys->createSurface(0x28);
_vm->_largeSprite = _vm->_gameSys->createSurface(0x28);
break;
}
_gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300);
delayTicksCursor(5);
while (!_mouseClickState._left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && !isKeyStatus1(Common::KEYCODE_SPACE) &&
!isKeyStatus1(29)) {
gameUpdateTick();
_vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300);
_vm->delayTicksCursor(5);
while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && !_vm->isKeyStatus1(Common::KEYCODE_SPACE) &&
!_vm->isKeyStatus1(29)) {
_vm->gameUpdateTick();
}
_mouseClickState._left = false;
clearKeyStatus1(Common::KEYCODE_ESCAPE);
clearKeyStatus1(29);
clearKeyStatus1(Common::KEYCODE_SPACE);
_gameSys->removeSpriteDrawItem(_largeSprite, 300);
delayTicksCursor(5);
deleteSurface(&_largeSprite);
showCursor();
_vm->_mouseClickState._left = false;
_vm->clearKeyStatus1(Common::KEYCODE_ESCAPE);
_vm->clearKeyStatus1(29);
_vm->clearKeyStatus1(Common::KEYCODE_SPACE);
_vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300);
_vm->delayTicksCursor(5);
_vm->deleteSurface(&_vm->_largeSprite);
_vm->showCursor();
}
void GnapEngine::scene25_run() {
playSound(0x10940, true);
startSoundTimerA(5);
void Scene25::run() {
_vm->playSound(0x10940, true);
_vm->startSoundTimerA(5);
_s25_currTicketVendorSequenceId = 0x52;
_gameSys->setAnimation(0x52, 39, 3);
_gameSys->insertSequence(_s25_currTicketVendorSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0);
_vm->_gameSys->setAnimation(0x52, 39, 3);
_vm->_gameSys->insertSequence(_s25_currTicketVendorSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0);
_s25_nextTicketVendorSequenceId = -1;
_timers[4] = getRandom(20) + 20;
_vm->_timers[4] = _vm->getRandom(20) + 20;
queueInsertDeviceIcon();
_vm->queueInsertDeviceIcon();
if (_prevSceneNum == 24) {
initGnapPos(5, 11, kDirUpLeft);
initPlatypusPos(6, 11, kDirUnk4);
endSceneInit();
gnapWalkTo(5, 7, -1, 0x107BA, 1);
platypusWalkTo(6, 7, -1, 0x107C2, 1);
if (_vm->_prevSceneNum == 24) {
_vm->initGnapPos(5, 11, kDirUpLeft);
_vm->initPlatypusPos(6, 11, kDirUnk4);
_vm->endSceneInit();
_vm->gnapWalkTo(5, 7, -1, 0x107BA, 1);
_vm->platypusWalkTo(6, 7, -1, 0x107C2, 1);
} else {
initGnapPos(5, 6, kDirBottomRight);
initPlatypusPos(6, 6, kDirNone);
endSceneInit();
gnapWalkTo(5, 8, -1, 0x107B9, 1);
platypusWalkTo(6, 8, -1, 0x107C2, 1);
_vm->initGnapPos(5, 6, kDirBottomRight);
_vm->initPlatypusPos(6, 6, kDirNone);
_vm->endSceneInit();
_vm->gnapWalkTo(5, 8, -1, 0x107B9, 1);
_vm->platypusWalkTo(6, 8, -1, 0x107C2, 1);
}
while (!_sceneDone) {
while (!_vm->_sceneDone) {
_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 kHSDevice:
if (_gnapActionStatus < 0) {
runMenu();
scene25_updateHotspots();
if (_vm->_gnapActionStatus < 0) {
_vm->runMenu();
updateHotspots();
}
break;
case kHSPlatypus:
if (_gnapActionStatus < 0) {
if (_grabCursorSpriteIndex == kItemJoint) {
gnapUseJointOnPlatypus();
} else if (_grabCursorSpriteIndex >= 0) {
playGnapImpossible(0, 0);
if (_vm->_gnapActionStatus < 0) {
if (_vm->_grabCursorSpriteIndex == kItemJoint) {
_vm->gnapUseJointOnPlatypus();
} else if (_vm->_grabCursorSpriteIndex >= 0) {
_vm->playGnapImpossible(0, 0);
} else {
switch (_verbCursor) {
switch (_vm->_verbCursor) {
case LOOK_CURSOR:
playGnapScratchingHead(_platX, _platY);
_vm->playGnapScratchingHead(_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:
playGnapImpossible(0, 0);
_vm->playGnapImpossible(0, 0);
break;
}
}
@ -177,30 +179,30 @@ void GnapEngine::scene25_run() {
break;
case kHSTicketVendor:
if (_gnapActionStatus < 0) {
if (_grabCursorSpriteIndex == kItemTickets) {
_gnapActionStatus = kASShowTicketToVendor;
gnapWalkTo(_hotspotsWalkPos[kHSTicketVendor].x, _hotspotsWalkPos[kHSTicketVendor].y,
0, getGnapSequenceId(gskIdle, 9, 4) | 0x10000, 1);
playGnapPullOutDevice(0, 0);
playGnapUseDevice(0, 0);
} else if (_grabCursorSpriteIndex >= 0) {
playGnapShowCurrItem(_hotspotsWalkPos[kHSTicketVendor].x, _hotspotsWalkPos[kHSTicketVendor].y, 6, 1);
if (_vm->_gnapActionStatus < 0) {
if (_vm->_grabCursorSpriteIndex == kItemTickets) {
_vm->_gnapActionStatus = kASShowTicketToVendor;
_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSTicketVendor].x, _vm->_hotspotsWalkPos[kHSTicketVendor].y,
0, _vm->getGnapSequenceId(gskIdle, 9, 4) | 0x10000, 1);
_vm->playGnapPullOutDevice(0, 0);
_vm->playGnapUseDevice(0, 0);
} else if (_vm->_grabCursorSpriteIndex >= 0) {
_vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSTicketVendor].x, _vm->_hotspotsWalkPos[kHSTicketVendor].y, 6, 1);
_s25_nextTicketVendorSequenceId = 0x5B;
} else {
switch (_verbCursor) {
switch (_vm->_verbCursor) {
case LOOK_CURSOR:
playGnapScratchingHead(6, 1);
_s25_nextTicketVendorSequenceId = (getRandom(2) == 1) ? 0x59 : 0x56;
_vm->playGnapScratchingHead(6, 1);
_s25_nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x59 : 0x56;
break;
case TALK_CURSOR:
_gnapIdleFacing = kDirUpRight;
gnapWalkTo(_hotspotsWalkPos[kHSTicketVendor].x, _hotspotsWalkPos[kHSTicketVendor].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1);
_gnapActionStatus = kASTalkTicketVendor;
_vm->_gnapIdleFacing = kDirUpRight;
_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSTicketVendor].x, _vm->_hotspotsWalkPos[kHSTicketVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1);
_vm->_gnapActionStatus = kASTalkTicketVendor;
break;
case GRAB_CURSOR:
case PLAT_CURSOR:
playGnapImpossible(0, 0);
_vm->playGnapImpossible(0, 0);
break;
}
}
@ -208,30 +210,30 @@ void GnapEngine::scene25_run() {
break;
case kHSExitOutsideCircusWorld:
if (_gnapActionStatus < 0) {
_isLeavingScene = true;
_newSceneNum = 24;
gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107B4, 1);
_gnapActionStatus = kASLeaveScene;
platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideCircusWorld].x + 1, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, -1, 0x107C2, 1);
if (_vm->_gnapActionStatus < 0) {
_vm->_isLeavingScene = true;
_vm->_newSceneNum = 24;
_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107B4, 1);
_vm->_gnapActionStatus = kASLeaveScene;
_vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, -1, 0x107C2, 1);
}
break;
case kHSExitInsideCircusWorld:
if (_gnapActionStatus < 0) {
if (isFlag(kGFNeedleTaken)) {
_isLeavingScene = true;
_newSceneNum = 26;
_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE;
gnapWalkTo(_hotspotsWalkPos[kHSExitInsideCircusWorld].x, _hotspotsWalkPos[kHSExitInsideCircusWorld].y, 0, 0x107B1, 1);
_gnapActionStatus = kASLeaveScene;
platypusWalkTo(_hotspotsWalkPos[kHSExitInsideCircusWorld].x + 1, _hotspotsWalkPos[kHSExitInsideCircusWorld].y, -1, 0x107C2, 1);
_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE;
if (_vm->_gnapActionStatus < 0) {
if (_vm->isFlag(kGFNeedleTaken)) {
_vm->_isLeavingScene = true;
_vm->_newSceneNum = 26;
_vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE;
_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].y, 0, 0x107B1, 1);
_vm->_gnapActionStatus = kASLeaveScene;
_vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].y, -1, 0x107C2, 1);
_vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE;
} else {
_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE;
gnapWalkTo(4, 5, 0, 0x107BB, 1);
_gnapActionStatus = kASEnterCircusWihoutTicket;
_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE;
_vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE;
_vm->gnapWalkTo(4, 5, 0, 0x107BB, 1);
_vm->_gnapActionStatus = kASEnterCircusWihoutTicket;
_vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE;
}
}
break;
@ -240,26 +242,26 @@ void GnapEngine::scene25_run() {
case kHSPosters2:
case kHSPosters3:
case kHSPosters4:
if (_gnapActionStatus < 0) {
if (_grabCursorSpriteIndex >= 0) {
playGnapImpossible(0, 0);
if (_vm->_gnapActionStatus < 0) {
if (_vm->_grabCursorSpriteIndex >= 0) {
_vm->playGnapImpossible(0, 0);
} else {
switch (_verbCursor) {
switch (_vm->_verbCursor) {
case LOOK_CURSOR:
gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, -1, -1, 1);
if (_sceneClickedHotspot == 5 || _sceneClickedHotspot == 6)
_gnapIdleFacing = kDirUpLeft;
else if (_sceneClickedHotspot == 8)
_gnapIdleFacing = kDirBottomRight;
_vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, -1, -1, 1);
if (_vm->_sceneClickedHotspot == 5 || _vm->_sceneClickedHotspot == 6)
_vm->_gnapIdleFacing = kDirUpLeft;
else if (_vm->_sceneClickedHotspot == 8)
_vm->_gnapIdleFacing = kDirBottomRight;
else
_gnapIdleFacing = kDirUpRight;
playGnapIdle(0, 0);
scene25_playAnims(8 - _sceneClickedHotspot + 1);
_vm->_gnapIdleFacing = kDirUpRight;
_vm->playGnapIdle(0, 0);
playAnims(8 - _vm->_sceneClickedHotspot + 1);
break;
case GRAB_CURSOR:
case TALK_CURSOR:
case PLAT_CURSOR:
playGnapMoan2(0, 0);
_vm->playGnapMoan2(0, 0);
break;
}
}
@ -268,27 +270,26 @@ void GnapEngine::scene25_run() {
case kHSWalkArea1:
case kHSWalkArea2:
if (_gnapActionStatus < 0)
gnapWalkTo(-1, -1, -1, -1, 1);
if (_vm->_gnapActionStatus < 0)
_vm->gnapWalkTo(-1, -1, -1, -1, 1);
break;
default:
if (_mouseClickState._left) {
gnapWalkTo(-1, -1, -1, -1, 1);
_mouseClickState._left = false;
if (_vm->_mouseClickState._left) {
_vm->gnapWalkTo(-1, -1, -1, -1, 1);
_vm->_mouseClickState._left = false;
}
break;
}
scene25_updateAnimations();
updateAnimations();
if (!_isLeavingScene) {
updatePlatypusIdleSequence();
updateGnapIdleSequence();
if (!_timers[4] && _s25_nextTicketVendorSequenceId == -1 && _gnapActionStatus == -1) {
_timers[4] = getRandom(20) + 20;
switch (getRandom(13)) {
if (!_vm->_isLeavingScene) {
_vm->updatePlatypusIdleSequence();
_vm->updateGnapIdleSequence();
if (!_vm->_timers[4] && _s25_nextTicketVendorSequenceId == -1 && _vm->_gnapActionStatus == -1) {
_vm->_timers[4] = _vm->getRandom(20) + 20;
switch (_vm->getRandom(13)) {
case 0:
_s25_nextTicketVendorSequenceId = 0x54;
break;
@ -321,80 +322,76 @@ void GnapEngine::scene25_run() {
break;
}
}
playSoundA();
_vm->playSoundA();
}
checkGameKeys();
_vm->checkGameKeys();
if (isKeyStatus1(8)) {
clearKeyStatus1(8);
runMenu();
scene25_updateHotspots();
if (_vm->isKeyStatus1(8)) {
_vm->clearKeyStatus1(8);
_vm->runMenu();
updateHotspots();
}
gameUpdateTick();
_vm->gameUpdateTick();
}
}
void GnapEngine::scene25_updateAnimations() {
if (_gameSys->getAnimationStatus(0) == 2) {
_gameSys->setAnimation(0, 0, 0);
switch (_gnapActionStatus) {
void Scene25::updateAnimations() {
if (_vm->_gameSys->getAnimationStatus(0) == 2) {
_vm->_gameSys->setAnimation(0, 0, 0);
switch (_vm->_gnapActionStatus) {
case kASTalkTicketVendor:
_s25_nextTicketVendorSequenceId = (getRandom(2) == 1) ? 0x57 : 0x5F;
_gnapActionStatus = -1;
_s25_nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x57 : 0x5F;
_vm->_gnapActionStatus = -1;
break;
case kASEnterCircusWihoutTicket:
_s25_nextTicketVendorSequenceId = 0x5E;
_gameSys->setAnimation(0x5E, 39, 0);
_gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3);
_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncExists, 0, 0, 0);
_gameSys->insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0);
_vm->_gameSys->setAnimation(0x5E, 39, 0);
_vm->_gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3);
_vm->_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncExists, 0, 0, 0);
_vm->_gameSys->insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0);
_s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId;
_s25_nextTicketVendorSequenceId = -1;
_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE;
playGnapIdle(0, 0);
gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, -1, 0x107BB, 1);
_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE;
_gnapActionStatus = kASEnterCircusWihoutTicketDone;
_vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE;
_vm->playGnapIdle(0, 0);
_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, -1, 0x107BB, 1);
_vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE;
_vm->_gnapActionStatus = kASEnterCircusWihoutTicketDone;
break;
case kASEnterCircusWihoutTicketDone:
_gnapActionStatus = -1;
_vm->_gnapActionStatus = -1;
break;
case kASShowTicketToVendor:
setGrabCursorSprite(-1);
invRemove(kItemTickets);
setFlag(kGFNeedleTaken);
_gameSys->setAnimation(0x61, 40, 0);
_gameSys->insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0);
_gnapActionStatus = kASShowTicketToVendorDone;
_vm->setGrabCursorSprite(-1);
_vm->invRemove(kItemTickets);
_vm->setFlag(kGFNeedleTaken);
_vm->_gameSys->setAnimation(0x61, 40, 0);
_vm->_gameSys->insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0);
_vm->_gnapActionStatus = kASShowTicketToVendorDone;
break;
case kASShowTicketToVendorDone:
_s25_nextTicketVendorSequenceId = 0x53;
break;
case kASLeaveScene:
_sceneDone = true;
_vm->_sceneDone = true;
break;
}
}
if (_gameSys->getAnimationStatus(3) == 2) {
if (_vm->_gameSys->getAnimationStatus(3) == 2) {
if (_s25_nextTicketVendorSequenceId == 0x53) {
_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0);
_vm->_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0);
_s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId;
_s25_nextTicketVendorSequenceId = -1;
_gnapActionStatus = -1;
_vm->_gnapActionStatus = -1;
} else if (_s25_nextTicketVendorSequenceId != -1) {
_gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3);
_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0);
_vm->_gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3);
_vm->_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0);
_s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId;
_s25_nextTicketVendorSequenceId = -1;
}
}
}
} // End of namespace Gnap

View File

@ -0,0 +1,52 @@
/* 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_SCENE25_H
#define GNAP_SCENE25_H
#include "gnap/debugger.h"
#include "gnap/scenes/scenecore.h"
namespace Gnap {
class GnapEngine;
class Scene25: public Scene {
public:
Scene25(GnapEngine *vm);
~Scene25() {}
virtual int init();
virtual void updateHotspots();
virtual void run();
virtual void updateAnimations();
virtual void updateAnimationsCb() {};
private:
int _s25_currTicketVendorSequenceId;
int _s25_nextTicketVendorSequenceId;
void playAnims(int index);
};
} // End of namespace Gnap
#endif // GNAP_SCENE25_H

View File

@ -23,6 +23,7 @@
#include "gnap/gnap.h"
#include "gnap/gamesys.h"
#include "gnap/resource.h"
#include "gnap/scenes/scene26.h"
namespace Gnap {
@ -42,93 +43,95 @@ enum {
kASLeaveScene = 0
};
int GnapEngine::scene26_init() {
return isFlag(kGFUnk23) ? 0x61 : 0x60;
Scene26::Scene26(GnapEngine *vm) : Scene(vm) {
_s26_currKidSequenceId = -1;
_s26_nextKidSequenceId = -1;
}
void GnapEngine::scene26_updateHotspots() {
setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
setHotspot(kHSExitOutsideCircusWorld, 0, 590, 300, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 1, 10);
setHotspot(kHSExitOutsideClown, 200, 265, 265, 350, SF_EXIT_U_CURSOR, 3, 8);
setHotspot(kHSExitArcade, 0, 295, 150, 400, SF_EXIT_NW_CURSOR, 2, 8);
setHotspot(kHSExitElephant, 270, 290, 485, 375, SF_EXIT_U_CURSOR, 5, 8);
setHotspot(kHSExitBeerStand, 530, 290, 620, 350, SF_EXIT_NE_CURSOR, 5, 8);
setHotspot(kHSWalkArea1, 0, 0, 800, 500);
setHotspot(kHSWalkArea2, 281, 0, 800, 600);
setDeviceHotspot(kHSDevice, -1, -1, -1, -1);
_hotspotsCount = 9;
int Scene26::init() {
return _vm->isFlag(kGFUnk23) ? 0x61 : 0x60;
}
void GnapEngine::scene26_run() {
startSoundTimerB(7);
playSound(0x1093B, true);
void Scene26::updateHotspots() {
_vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
_vm->setHotspot(kHSExitOutsideCircusWorld, 0, 590, 300, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 1, 10);
_vm->setHotspot(kHSExitOutsideClown, 200, 265, 265, 350, SF_EXIT_U_CURSOR, 3, 8);
_vm->setHotspot(kHSExitArcade, 0, 295, 150, 400, SF_EXIT_NW_CURSOR, 2, 8);
_vm->setHotspot(kHSExitElephant, 270, 290, 485, 375, SF_EXIT_U_CURSOR, 5, 8);
_vm->setHotspot(kHSExitBeerStand, 530, 290, 620, 350, SF_EXIT_NE_CURSOR, 5, 8);
_vm->setHotspot(kHSWalkArea1, 0, 0, 800, 500);
_vm->setHotspot(kHSWalkArea2, 281, 0, 800, 600);
_vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1);
_vm->_hotspotsCount = 9;
}
void Scene26::run() {
_vm->startSoundTimerB(7);
_vm->playSound(0x1093B, true);
_s26_currKidSequenceId = 0x5B;
_s26_nextKidSequenceId = -1;
_gameSys->setAnimation(0x5B, 160, 3);
_gameSys->insertSequence(_s26_currKidSequenceId, 160, 0, 0, kSeqNone, 0, 0, 0);
_vm->_gameSys->setAnimation(0x5B, 160, 3);
_vm->_gameSys->insertSequence(_s26_currKidSequenceId, 160, 0, 0, kSeqNone, 0, 0, 0);
_timers[5] = getRandom(20) + 50;
_timers[4] = getRandom(20) + 50;
_timers[6] = getRandom(50) + 100;
_vm->_timers[5] = _vm->getRandom(20) + 50;
_vm->_timers[4] = _vm->getRandom(20) + 50;
_vm->_timers[6] = _vm->getRandom(50) + 100;
queueInsertDeviceIcon();
_vm->queueInsertDeviceIcon();
_gameSys->insertSequence(0x58, 40, 0, 0, kSeqLoop, 0, 0, 0);
_gameSys->insertSequence(0x5C, 40, 0, 0, kSeqLoop, 0, 0, 0);
_gameSys->insertSequence(0x5D, 40, 0, 0, kSeqLoop, 0, 0, 0);
_gameSys->insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0);
_vm->_gameSys->insertSequence(0x58, 40, 0, 0, kSeqLoop, 0, 0, 0);
_vm->_gameSys->insertSequence(0x5C, 40, 0, 0, kSeqLoop, 0, 0, 0);
_vm->_gameSys->insertSequence(0x5D, 40, 0, 0, kSeqLoop, 0, 0, 0);
_vm->_gameSys->insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0);
if (_prevSceneNum == 25) {
initGnapPos(-1, 8, kDirBottomRight);
initPlatypusPos(-2, 8, kDirNone);
endSceneInit();
gnapWalkTo(2, 8, -1, 0x107B9, 1);
platypusWalkTo(1, 8, -1, 0x107C2, 1);
if (_vm->_prevSceneNum == 25) {
_vm->initGnapPos(-1, 8, kDirBottomRight);
_vm->initPlatypusPos(-2, 8, kDirNone);
_vm->endSceneInit();
_vm->gnapWalkTo(2, 8, -1, 0x107B9, 1);
_vm->platypusWalkTo(1, 8, -1, 0x107C2, 1);
} else {
initGnapPos(2, 8, kDirBottomRight);
initPlatypusPos(3, 8, kDirNone);
endSceneInit();
_vm->initGnapPos(2, 8, kDirBottomRight);
_vm->initPlatypusPos(3, 8, kDirNone);
_vm->endSceneInit();
}
while (!_sceneDone) {
while (!_vm->_sceneDone) {
_vm->updateMouseCursor();
_vm->updateCursorByHotspot();
updateMouseCursor();
updateCursorByHotspot();
_sceneClickedHotspot = getClickedHotspotId();
updateGrabCursorSprite(0, 0);
switch (_sceneClickedHotspot) {
_vm->_sceneClickedHotspot = _vm->getClickedHotspotId();
_vm->updateGrabCursorSprite(0, 0);
switch (_vm->_sceneClickedHotspot) {
case kHSDevice:
if (_gnapActionStatus < 0) {
runMenu();
scene26_updateHotspots();
if (_vm->_gnapActionStatus < 0) {
_vm->runMenu();
updateHotspots();
}
break;
case kHSPlatypus:
if (_gnapActionStatus < 0) {
if (_grabCursorSpriteIndex == kItemJoint) {
gnapUseJointOnPlatypus();
} else if (_grabCursorSpriteIndex >= 0) {
playGnapImpossible(0, 0);
if (_vm->_gnapActionStatus < 0) {
if (_vm->_grabCursorSpriteIndex == kItemJoint) {
_vm->gnapUseJointOnPlatypus();
} else 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:
playGnapImpossible(0, 0);
_vm->playGnapImpossible(0, 0);
break;
}
}
@ -136,117 +139,113 @@ void GnapEngine::scene26_run() {
break;
case kHSExitOutsideCircusWorld:
if (_gnapActionStatus < 0) {
_isLeavingScene = true;
_newSceneNum = 25;
gnapWalkTo(-1, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107AE, 1);
_gnapActionStatus = kASLeaveScene;
if (_vm->_gnapActionStatus < 0) {
_vm->_isLeavingScene = true;
_vm->_newSceneNum = 25;
_vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107AE, 1);
_vm->_gnapActionStatus = kASLeaveScene;
}
break;
case kHSExitOutsideClown:
if (_gnapActionStatus < 0) {
_isLeavingScene = true;
_newSceneNum = 27;
gnapWalkTo(-1, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BC, 1);
_gnapActionStatus = kASLeaveScene;
if (_vm->_gnapActionStatus < 0) {
_vm->_isLeavingScene = true;
_vm->_newSceneNum = 27;
_vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BC, 1);
_vm->_gnapActionStatus = kASLeaveScene;
}
break;
case kHSExitArcade:
if (_gnapActionStatus < 0) {
_isLeavingScene = true;
_newSceneNum = 29;
gnapWalkTo(-1, _hotspotsWalkPos[kHSExitArcade].y, 0, 0x107BC, 1);
_gnapActionStatus = kASLeaveScene;
if (_vm->_gnapActionStatus < 0) {
_vm->_isLeavingScene = true;
_vm->_newSceneNum = 29;
_vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitArcade].y, 0, 0x107BC, 1);
_vm->_gnapActionStatus = kASLeaveScene;
}
break;
case kHSExitElephant:
if (_gnapActionStatus < 0) {
_isLeavingScene = true;
_newSceneNum = 30;
gnapWalkTo(-1, _hotspotsWalkPos[4].y, 0, 0x107BC, 1);
_gnapActionStatus = kASLeaveScene;
if (_vm->_gnapActionStatus < 0) {
_vm->_isLeavingScene = true;
_vm->_newSceneNum = 30;
_vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1);
_vm->_gnapActionStatus = kASLeaveScene;
}
break;
case kHSExitBeerStand:
if (_gnapActionStatus < 0) {
_isLeavingScene = true;
_newSceneNum = 31;
gnapWalkTo(-1, _hotspotsWalkPos[kHSExitBeerStand].y, 0, 0x107BB, 1);
_gnapActionStatus = kASLeaveScene;
if (_vm->_gnapActionStatus < 0) {
_vm->_isLeavingScene = true;
_vm->_newSceneNum = 31;
_vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitBeerStand].y, 0, 0x107BB, 1);
_vm->_gnapActionStatus = kASLeaveScene;
}
break;
case kHSWalkArea1:
case kHSWalkArea2:
if (_gnapActionStatus < 0)
gnapWalkTo(-1, -1, -1, -1, 1);
if (_vm->_gnapActionStatus < 0)
_vm->gnapWalkTo(-1, -1, -1, -1, 1);
break;
default:
if (_mouseClickState._left) {
gnapWalkTo(-1, -1, -1, -1, 1);
_mouseClickState._left = false;
if (_vm->_mouseClickState._left) {
_vm->gnapWalkTo(-1, -1, -1, -1, 1);
_vm->_mouseClickState._left = false;
}
break;
}
scene26_updateAnimations();
updateAnimations();
if (!isSoundPlaying(0x1093B))
playSound(0x1093B, true);
if (!_vm->isSoundPlaying(0x1093B))
_vm->playSound(0x1093B, true);
if (!_isLeavingScene) {
updatePlatypusIdleSequence();
updateGnapIdleSequence();
if (!_timers[5] && _s26_nextKidSequenceId == -1) {
_timers[5] = getRandom(20) + 50;
if (getRandom(5) != 0)
if (!_vm->_isLeavingScene) {
_vm->updatePlatypusIdleSequence();
_vm->updateGnapIdleSequence();
if (!_vm->_timers[5] && _s26_nextKidSequenceId == -1) {
_vm->_timers[5] = _vm->getRandom(20) + 50;
if (_vm->getRandom(5) != 0)
_s26_nextKidSequenceId = 0x5B;
else
_s26_nextKidSequenceId = 0x5A;
}
if (!_timers[4]) {
_timers[4] = getRandom(20) + 130;
_gameSys->insertSequence(0x59, 40, 0, 0, kSeqNone, 0, 0, 0);
if (!_vm->_timers[4]) {
_vm->_timers[4] = _vm->getRandom(20) + 130;
_vm->_gameSys->insertSequence(0x59, 40, 0, 0, kSeqNone, 0, 0, 0);
}
if (!_timers[6]) {
_timers[6] = getRandom(50) + 100;
_gameSys->insertSequence(0x5F, 40, 0, 0, kSeqNone, 0, 0, 0);
if (!_vm->_timers[6]) {
_vm->_timers[6] = _vm->getRandom(50) + 100;
_vm->_gameSys->insertSequence(0x5F, 40, 0, 0, kSeqNone, 0, 0, 0);
}
playSoundB();
_vm->playSoundB();
}
checkGameKeys();
_vm->checkGameKeys();
if (isKeyStatus1(8)) {
clearKeyStatus1(8);
runMenu();
scene26_updateHotspots();
if (_vm->isKeyStatus1(8)) {
_vm->clearKeyStatus1(8);
_vm->runMenu();
updateHotspots();
}
gameUpdateTick();
_vm->gameUpdateTick();
}
}
void GnapEngine::scene26_updateAnimations() {
if (_gameSys->getAnimationStatus(0) == 2) {
_gameSys->setAnimation(0, 0, 0);
if (_gnapActionStatus == kASLeaveScene)
_sceneDone = true;
_gnapActionStatus = -1;
void Scene26::updateAnimations() {
if (_vm->_gameSys->getAnimationStatus(0) == 2) {
_vm->_gameSys->setAnimation(0, 0, 0);
if (_vm->_gnapActionStatus == kASLeaveScene)
_vm->_sceneDone = true;
_vm->_gnapActionStatus = -1;
}
if (_gameSys->getAnimationStatus(3) == 2 && _s26_nextKidSequenceId != -1) {
_gameSys->insertSequence(_s26_nextKidSequenceId, 160, _s26_currKidSequenceId, 160, kSeqSyncWait, 0, 0, 0);
_gameSys->setAnimation(_s26_nextKidSequenceId, 160, 3);
if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s26_nextKidSequenceId != -1) {
_vm->_gameSys->insertSequence(_s26_nextKidSequenceId, 160, _s26_currKidSequenceId, 160, kSeqSyncWait, 0, 0, 0);
_vm->_gameSys->setAnimation(_s26_nextKidSequenceId, 160, 3);
_s26_currKidSequenceId = _s26_nextKidSequenceId;
_s26_nextKidSequenceId = -1;
}

View File

@ -0,0 +1,50 @@
/* 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_SCENE26_H
#define GNAP_SCENE26_H
#include "gnap/debugger.h"
#include "gnap/scenes/scenecore.h"
namespace Gnap {
class GnapEngine;
class Scene26: public Scene {
public:
Scene26(GnapEngine *vm);
~Scene26() {}
virtual int init();
virtual void updateHotspots();
virtual void run();
virtual void updateAnimations();
virtual void updateAnimationsCb() {};
private:
int _s26_currKidSequenceId;
int _s26_nextKidSequenceId;
};
} // End of namespace Gnap
#endif // GNAP_SCENE26_H

View File

@ -50,6 +50,8 @@
#include "gnap/scenes/scene22.h"
#include "gnap/scenes/scene23.h"
#include "gnap/scenes/scene24.h"
#include "gnap/scenes/scene25.h"
#include "gnap/scenes/scene26.h"
#include "gnap/scenes/scene47.h"
#include "gnap/scenes/scene48.h"
#include "gnap/scenes/scene54.h"
@ -232,14 +234,16 @@ int GnapEngine::initSceneLogic() {
initSceneGrid(21, 136, 11, 10);
break;
case 25:
backgroundId = scene25_init();
scene25_updateHotspots();
_scene = new Scene25(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 26:
backgroundId = scene26_init();
scene26_updateHotspots();
_scene = new Scene26(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
@ -554,12 +558,14 @@ void GnapEngine::runSceneLogic() {
_newSceneNum = 20;
break;
case 25:
scene25_run();
_scene->run();
delete _scene;
if (_newSceneNum == 55)
_newSceneNum = 20;
break;
case 26:
scene26_run();
_scene->run();
delete _scene;
if (_newSceneNum == 55)
_newSceneNum = 20;
break;