diff options
Diffstat (limited to 'engines/neverhood/klaymen.cpp')
-rw-r--r-- | engines/neverhood/klaymen.cpp | 3394 |
1 files changed, 1 insertions, 3393 deletions
diff --git a/engines/neverhood/klaymen.cpp b/engines/neverhood/klaymen.cpp index 8ed27c825a..666b20a08a 100644 --- a/engines/neverhood/klaymen.cpp +++ b/engines/neverhood/klaymen.cpp @@ -47,17 +47,6 @@ static const KlaymenIdleTableItem klaymenIdleTable3[] = { {1, kIdleTeleporterHands2} }; -static const KlaymenIdleTableItem klaymenIdleTable4[] = { - {1, kIdleSpinHead}, - {1, kIdleChest}, - {1, kIdleHeadOff}, -}; - -static const KlaymenIdleTableItem klaymenIdleTable1002[] = { - {1, kIdlePickEar}, - {2, kIdleWonderAbout} -}; - // Klaymen Klaymen::Klaymen(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRectArray *clipRects) @@ -65,7 +54,7 @@ Klaymen::Klaymen(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRec _isWalkingOpenDoorNotified(false), _spitOutCountdown(0), _tapesToInsert(0), _keysToInsert(0), _busyStatus(0), _acceptInput(true), _attachedSprite(NULL), _isWalking(false), _actionStatus(1), _parentScene(parentScene), _isSneaking(false), _isLargeStep(false), _doYHitIncr(false), _isLeverDown(false), _isSittingInTeleporter(false), _actionStatusChanged(false), _ladderStatus(0), _pathPoints(NULL), _soundFlag(false), - _idleTableNum(0), _otherSprite(NULL), _moveObjectCountdown(0), _readyToSpit(false), _walkResumeFrameIncr(0) { + _idleTableNum(0), _otherSprite(NULL), _moveObjectCountdown(0), _walkResumeFrameIncr(0) { createSurface(1000, 320, 200); _x = x; @@ -628,36 +617,6 @@ void Klaymen::startWalkToX(int16 x, bool walkExt) { } } -void Klaymen::stWakeUp() { - _busyStatus = 1; - _acceptInput = false; - startAnimation(0x527AC970, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmLowLevelAnimation); - SetSpriteUpdate(NULL); -} - -void Klaymen::stSleeping() { - _busyStatus = 0; - _acceptInput = true; - startAnimation(0x5A38C110, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmSleeping); - SetSpriteUpdate(NULL); -} - -uint32 Klaymen::hmSleeping(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = hmLowLevel(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x03060012) { - playSound(0, 0xC0238244); - } - break; - } - return messageResult; -} - bool Klaymen::stStartAction(AnimationCb callback3) { if (_busyStatus == 1) { _busyStatus = 2; @@ -1512,112 +1471,11 @@ uint32 Klaymen::hmPeekWall(int messageNum, const MessageParam ¶m, Entity *se return hmLowLevelAnimation(messageNum, param, sender); } -void Klaymen::stJumpToRing1() { - if (!stStartAction(AnimationCallback(&Klaymen::stJumpToRing1))) { - _busyStatus = 0; - startAnimation(0xD82890BA, 0, -1); - setupJumpToRing(); - } -} - -void Klaymen::setupJumpToRing() { - _acceptInput = false; - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmJumpToRing); - SetSpriteUpdate(&Klaymen::suUpdateDestX); - NextState(&Klaymen::stHangOnRing); - sendMessage(_attachedSprite, 0x482B, 0); -} - -uint32 Klaymen::hmJumpToRing(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x168050A0) { - sendMessage(_attachedSprite, 0x4806, 0); - _acceptInput = true; - } else if (param.asInteger() == 0x320AC306) { - playSound(0, 0x5860C640); - } else if (param.asInteger() == 0x4AB28209) { - sendMessage(_attachedSprite, 0x482A, 0); - } else if (param.asInteger() == 0x88001184) { - sendMessage(_attachedSprite, 0x482B, 0); - } - break; - } - return messageResult; -} - void Klaymen::suUpdateDestX() { AnimatedSprite::updateDeltaXY(); _destX = _x; } -void Klaymen::stHangOnRing() { - _busyStatus = 0; - _acceptInput = true; - startAnimation(0x4829E0B8, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmLowLevel); - SetSpriteUpdate(NULL); -} - -void Klaymen::stJumpToRing2() { - if (!stStartAction(AnimationCallback(&Klaymen::stJumpToRing2))) { - _busyStatus = 0; - startAnimation(0x900980B2, 0, -1); - setupJumpToRing(); - } -} - -void Klaymen::stJumpToRing3() { - if (!stStartAction(AnimationCallback(&Klaymen::stJumpToRing3))) { - _busyStatus = 0; - _acceptInput = false; - startAnimation(0xBA1910B2, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetSpriteUpdate(&Klaymen::suUpdateDestX); - SetMessageHandler(&Klaymen::hmJumpToRing3); - NextState(&Klaymen::stHoldRing3); - sendMessage(_attachedSprite, 0x482B, 0); - } -} - -uint32 Klaymen::hmJumpToRing3(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x168050A0) { - sendMessage(_attachedSprite, 0x4806, 0); - } else if (param.asInteger() == 0x320AC306) { - playSound(0, 0x5860C640); - } else if (param.asInteger() == 0x4AB28209) { - sendMessage(_attachedSprite, 0x482A, 0); - } else if (param.asInteger() == 0x88001184) { - sendMessage(_attachedSprite, 0x482B, 0); - } - break; - } - return messageResult; -} - -void Klaymen::stHoldRing3() { - _busyStatus = 0; - _acceptInput = true; - startAnimation(0x4A293FB0, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmHoldRing3); - SetSpriteUpdate(NULL); -} - -uint32 Klaymen::hmHoldRing3(int messageNum, const MessageParam ¶m, Entity *sender) { - if (messageNum == 0x1008) { - stReleaseRing(); - return 0; - } - return hmLowLevel(messageNum, param, sender); -} - void Klaymen::stReleaseRing() { _busyStatus = 1; _acceptInput = false; @@ -1629,14 +1487,6 @@ void Klaymen::stReleaseRing() { SetSpriteUpdate(NULL); } -void Klaymen::stJumpToRing4() { - if (!stStartAction(AnimationCallback(&Klaymen::stJumpToRing4))) { - _busyStatus = 0; - startAnimation(0xB8699832, 0, -1); - setupJumpToRing(); - } -} - void Klaymen::startWalkToAttachedSpriteXDistance(int16 distance) { startWalkToXDistance(_attachedSprite->getX(), distance); } @@ -1885,29 +1735,6 @@ uint32 Klaymen::hmTurnToBackToUse(int messageNum, const MessageParam ¶m, Ent return messageResult; } -void Klaymen::stClayDoorOpen() { - if (!stStartAction(AnimationCallback(&Klaymen::stClayDoorOpen))) { - _busyStatus = 2; - _acceptInput = false; - startAnimation(0x5CCCB330, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmClayDoorOpen); - SetSpriteUpdate(&Klaymen::suUpdateDestX); - } -} - -uint32 Klaymen::hmClayDoorOpen(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x040D4186) { - sendMessage(_attachedSprite, 0x4808, 0); - } - break; - } - return messageResult; -} - void Klaymen::stTurnToUse() { if (!stStartAction(AnimationCallback(&Klaymen::stTurnToUse))) { _busyStatus = 2; @@ -2336,29 +2163,6 @@ uint32 Klaymen::hmTeleporterAppearDisappear(int messageNum, const MessageParam & return messageResult; } -uint32 Klaymen::hmShrink(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x80C110B5) - sendMessage(_parentScene, 0x482A, 0); - else if (param.asInteger() == 0x33288344) - playSound(2, 0x10688664); - break; - } - return messageResult; -} - -void Klaymen::stShrink() { - _busyStatus = 0; - _acceptInput = false; - playSound(0, 0x4C69EA53); - startAnimation(0x1AE88904, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmShrink); - SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); -} - void Klaymen::stStandWonderAbout() { if (_x > 260) setDoDeltaX(1); @@ -2537,61 +2341,6 @@ void Klaymen::stInsertKey() { } } -uint32 Klaymen::hmReadNote(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x04684052) { - _acceptInput = true; - sendMessage(_parentScene, 0x2002, 0); - } - break; - } - return messageResult; -} - -void Klaymen::stReadNote() { - _busyStatus = 2; - _acceptInput = false; - startAnimation(0x123E9C9F, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmReadNote); - SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); -} - -uint32 Klaymen::hmHitByDoor(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); - int16 speedUpFrameIndex; - switch (messageNum) { - case 0x1008: - speedUpFrameIndex = getFrameIndex(kKlaymenSpeedUpHash); - if (_currFrameIndex < speedUpFrameIndex) { - startAnimation(0x35AA8059, speedUpFrameIndex, -1); - _y = 438; - } - messageResult = 0; - break; - case 0x100D: - if (param.asInteger() == 0x1A1A0785) { - playSound(0, 0x40F0A342); - } else if (param.asInteger() == 0x60428026) { - playSound(0, 0x40608A59); - } - break; - } - return messageResult; -} - -void Klaymen::stHitByDoor() { - _busyStatus = 1; - _acceptInput = false; - startAnimation(0x35AA8059, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmHitByDoor); - SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); - playSound(0, 0x402E82D4); -} - uint32 Klaymen::hmPeekWallReturn(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); switch (messageNum) { @@ -2657,65 +2406,6 @@ void Klaymen::stPeekWallReturn() { SetSpriteUpdate(NULL); } -void Klaymen::stPullHammerLever() { - if (!stStartAction(AnimationCallback(&Klaymen::stPullHammerLever))) { - _busyStatus = 2; - _acceptInput = false; - startAnimation(0x00648953, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmPullHammerLever); - SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); - } -} - -uint32 Klaymen::hmPullHammerLever(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = Klaymen::hmLever(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x4AB28209) - sendMessage(_attachedSprite, 0x480F, 0); - break; - } - return messageResult; -} - -void Klaymen::suRidePlatformDown() { - _platformDeltaY++; - _y += _platformDeltaY; - if (_y > 600) - sendMessage(this, 0x1019, 0); -} - -void Klaymen::stRidePlatformDown() { - if (!stStartActionFromIdle(AnimationCallback(&Klaymen::stRidePlatformDown))) { - _busyStatus = 1; - sendMessage(_parentScene, 0x4803, 0); - _acceptInput = false; - _platformDeltaY = 0; - startAnimation(0x5420E254, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmLowLevel); - SetSpriteUpdate(&Klaymen::suRidePlatformDown); - _vm->_soundMan->playSoundLooping(0xD3B02847); - } -} - -void Klaymen::stCrashDown() { - playSound(0, 0x41648271); - _busyStatus = 1; - _acceptInput = false; - startAnimationByHash(0x000BAB02, 0x88003000, 0); - SetUpdateHandler(&Klaymen::update); - SetSpriteUpdate(NULL); - SetMessageHandler(&Klaymen::hmLowLevelAnimation); - NextState(&Klaymen::stCrashDownFinished); -} - -void Klaymen::stCrashDownFinished() { - setDoDeltaX(2); - stTryStandIdle(); -} - void Klaymen::upSpitOutFall() { Klaymen::update(); if (_spitOutCountdown != 0 && (--_spitOutCountdown == 0)) { @@ -2724,24 +2414,6 @@ void Klaymen::upSpitOutFall() { } } -uint32 Klaymen::hmJumpToRingVenusFlyTrap(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x168050A0) { - sendMessage(_attachedSprite, 0x480F, 0); - } else if (param.asInteger() == 0x586B0300) { - sendMessage(_otherSprite, 0x480E, 1); - } else if (param.asInteger() == 0x4AB28209) { - sendMessage(_attachedSprite, 0x482A, 0); - } else if (param.asInteger() == 0x88001184) { - sendMessage(_attachedSprite, 0x482B, 0); - } - break; - } - return messageResult; -} - uint32 Klaymen::hmStandIdleSpecial(int messageNum, const MessageParam ¶m, Entity *sender) { switch (messageNum) { case 0x4811: @@ -2784,53 +2456,6 @@ uint32 Klaymen::hmPressDoorButton(int messageNum, const MessageParam ¶m, Ent return messageResult; } -uint32 Klaymen::hmMoveVenusFlyTrap(int messageNum, const MessageParam ¶m, Entity *sender) { - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x01084280) { - sendMessage(_attachedSprite, 0x480B, (uint32)_doDeltaX); - } else if (param.asInteger() == 0x02421405) { - if (_isMoveObjectRequested) { - if (sendMessage(_attachedSprite, 0x480C, (uint32)_doDeltaX) != 0) - stContinueMovingVenusFlyTrap(); - } else { - SetMessageHandler(&Klaymen::hmFirstMoveVenusFlyTrap); - } - } else if (param.asInteger() == 0x4AB28209) { - sendMessage(_attachedSprite, 0x482A, 0); - } else if (param.asInteger() == 0x88001184) { - sendMessage(_attachedSprite, 0x482B, 0); - } else if (param.asInteger() == 0x32180101) { - playSound(0, 0x405002D8); - } else if (param.asInteger() == 0x0A2A9098) { - playSound(0, 0x0460E2FA); - } - break; - case 0x480A: - _isMoveObjectRequested = true; - return 0; - } - return hmLowLevelAnimation(messageNum, param, sender); -} - -uint32 Klaymen::hmFirstMoveVenusFlyTrap(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x4AB28209) { - sendMessage(_attachedSprite, 0x482A, 0); - } else if (param.asInteger() == 0x88001184) { - sendMessage(_attachedSprite, 0x482B, 0); - } else if (param.asInteger() == 0x32180101) { - playSound(0, 0x405002D8); - } else if (param.asInteger() == 0x0A2A9098) { - playSound(0, 0x0460E2FA); - } - break; - } - return messageResult; -} - uint32 Klaymen::hmHitByBoxingGlove(int messageNum, const MessageParam ¶m, Entity *sender) { int16 speedUpFrameIndex; uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); @@ -2854,18 +2479,6 @@ uint32 Klaymen::hmHitByBoxingGlove(int messageNum, const MessageParam ¶m, En return messageResult; } -uint32 Klaymen::hmJumpAndFall(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = hmLowLevel(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x1307050A) { - playSound(0, 0x40428A09); - } - break; - } - return messageResult; -} - void Klaymen::suFallDown() { AnimatedSprite::updateDeltaXY(); HitRect *hitRect = _parentScene->findHitRectAtPos(_x, _y + 10); @@ -2877,19 +2490,6 @@ void Klaymen::suFallDown() { _parentScene->checkCollision(this, 0xFFFF, 0x4810, 0); } -void Klaymen::stJumpToRingVenusFlyTrap() { - if (!stStartAction(AnimationCallback(&Klaymen::stJumpToRingVenusFlyTrap))) { - _busyStatus = 2; - _acceptInput = false; - startAnimation(0x584984B4, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmJumpToRingVenusFlyTrap); - SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); - NextState(&Klaymen::stLandOnFeet); - sendMessage(_attachedSprite, 0x482B, 0); - } -} - void Klaymen::stStandIdleSpecial() { playSound(0, 0x56548280); _busyStatus = 0; @@ -2946,34 +2546,6 @@ void Klaymen::stFallTouchdown() { stTryStandIdle(); } -void Klaymen::stJumpAndFall() { - if (!stStartAction(AnimationCallback(&Klaymen::stJumpAndFall))) { - sendMessage(_parentScene, 0x1024, 3); - _busyStatus = 2; - _acceptInput = false; - startAnimation(0xB93AB151, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmJumpAndFall); - SetSpriteUpdate(&Klaymen::suFallDown); - NextState(&Klaymen::stLandOnFeet); - } -} - -void Klaymen::stDropFromRing() { - if (_attachedSprite) { - _x = _attachedSprite->getX(); - sendMessage(_attachedSprite, 0x4807, 0); - _attachedSprite = NULL; - } - _busyStatus = 2; - _acceptInput = false; - startAnimation(0x586984B1, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmLowLevel); - SetSpriteUpdate(&Klaymen::suFallDown); - NextState(&Klaymen::stLandOnFeet); -} - void Klaymen::stPressDoorButton() { _busyStatus = 2; _acceptInput = true; @@ -2998,34 +2570,6 @@ void Klaymen::evHitByBoxingGloveDone() { sendMessage(_parentScene, 0x1024, 1); } -void Klaymen::stMoveVenusFlyTrap() { - if (!stStartAction(AnimationCallback(&Klaymen::stMoveVenusFlyTrap))) { - _busyStatus = 2; - _isMoveObjectRequested = false; - _acceptInput = true; - setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0); - startAnimation(0x5C01A870, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmMoveVenusFlyTrap); - SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); - FinalizeState(&Klaymen::evMoveVenusFlyTrapDone); - } -} - -void Klaymen::stContinueMovingVenusFlyTrap() { - _isMoveObjectRequested = false; - _acceptInput = true; - startAnimationByHash(0x5C01A870, 0x01084280, 0); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmMoveVenusFlyTrap); - SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); - FinalizeState(&Klaymen::evMoveVenusFlyTrapDone); -} - -void Klaymen::evMoveVenusFlyTrapDone() { - sendMessage(_attachedSprite, 0x482A, 0); -} - void Klaymen::suFallSkipJump() { updateDeltaXY(); HitRect *hitRect = _parentScene->findHitRectAtPos(_x, _y + 10); @@ -3052,49 +2596,6 @@ void Klaymen::upMoveObject() { Klaymen::update(); } -uint32 Klaymen::hmMatch(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = Klaymen::hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x51281850) { - setGlobalVar(V_TNT_DUMMY_FUSE_LIT, 1); - } else if (param.asInteger() == 0x43000538) { - playSound(0, 0x21043059); - } else if (param.asInteger() == 0x02B20220) { - playSound(0, 0xC5408620); - } else if (param.asInteger() == 0x0A720138) { - playSound(0, 0xD4C08010); - } else if (param.asInteger() == 0xB613A180) { - playSound(0, 0x44051000); - } - break; - } - return messageResult; -} - -void Klaymen::stFetchMatch() { - if (!stStartAction(AnimationCallback(&Klaymen::stFetchMatch))) { - _busyStatus = 0; - _acceptInput = false; - setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0); - startAnimation(0x9CAA0218, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmMatch); - SetSpriteUpdate(NULL); - NextState(&Klaymen::stLightMatch); - } -} - -void Klaymen::stLightMatch() { - _busyStatus = 1; - _acceptInput = false; - setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0); - startAnimation(0x1222A513, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmMatch); - SetSpriteUpdate(NULL); -} - uint32 Klaymen::hmMoveObject(int messageNum, const MessageParam ¶m, Entity *sender) { switch (messageNum) { case 0x100D: @@ -3114,18 +2615,6 @@ uint32 Klaymen::hmMoveObject(int messageNum, const MessageParam ¶m, Entity * return Klaymen::hmLowLevelAnimation(messageNum, param, sender); } -uint32 Klaymen::hmTumbleHeadless(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = Klaymen::hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x000F0082) { - playSound(0, 0x74E2810F); - } - break; - } - return messageResult; -} - void Klaymen::stMoveObject() { if (!stStartAction(AnimationCallback(&Klaymen::stMoveObject))) { _busyStatus = 2; @@ -3147,93 +2636,6 @@ void Klaymen::stContinueMoveObject() { SetMessageHandler(&Klaymen::hmMoveObject); } -void Klaymen::stTumbleHeadless() { - if (!stStartActionFromIdle(AnimationCallback(&Klaymen::stTumbleHeadless))) { - _busyStatus = 1; - _acceptInput = false; - setDoDeltaX(0); - startAnimation(0x2821C590, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmTumbleHeadless); - SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); - NextState(&Klaymen::stTryStandIdle); - sendMessage(_parentScene, 0x8000, 0); - playSound(0, 0x62E0A356); - } -} - -void Klaymen::stCloseEyes() { - if (!stStartActionFromIdle(AnimationCallback(&Klaymen::stCloseEyes))) { - _busyStatus = 1; - _acceptInput = false; - startAnimation(0x5420E254, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmLowLevel); - SetSpriteUpdate(NULL); - } -} - -uint32 Klaymen::hmSpit(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = Klaymen::hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x16401CA6) { - _canSpitPipe = true; - if (_contSpitPipe) - spitIntoPipe(); - } else if (param.asInteger() == 0xC11C0008) { - _canSpitPipe = false; - _acceptInput = false; - _readyToSpit = false; - } else if (param.asInteger() == 0x018A0001) { - sendMessage(_parentScene, 0x2001, _spitDestPipeIndex); - } - break; - } - return messageResult; -} - -void Klaymen::stTrySpitIntoPipe() { - if (_readyToSpit) { - _contSpitPipe = true; - _spitContDestPipeIndex = _spitPipeIndex; - if (_canSpitPipe) - spitIntoPipe(); - } else if (!stStartAction(AnimationCallback(&Klaymen::stTrySpitIntoPipe))) { - _busyStatus = 2; - _acceptInput = true; - _spitDestPipeIndex = _spitPipeIndex; - _readyToSpit = true; - _canSpitPipe = false; - _contSpitPipe = false; - startAnimation(0x1808B150, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmSpit); - SetSpriteUpdate(NULL); - } -} - -void Klaymen::spitIntoPipe() { - _contSpitPipe = false; - _spitDestPipeIndex = _spitContDestPipeIndex; - _canSpitPipe = false; - _acceptInput = false; - startAnimation(0x1B08B553, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmSpit); - SetSpriteUpdate(NULL); - NextState(&Klaymen::stContSpitIntoPipe); -} - -void Klaymen::stContSpitIntoPipe() { - _canSpitPipe = true; - _acceptInput = true; - startAnimationByHash(0x1808B150, 0x16401CA6, 0); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmSpit); - SetSpriteUpdate(NULL); -} - void Klaymen::suRidePlatform() { _x = _attachedSprite->getX() - 20; _y = _attachedSprite->getY() + 46; @@ -3344,2798 +2746,4 @@ void Klaymen::stPeekInsideBlink() { _blinkCounterMax = _vm->_rnd->getRandomNumber(64 - 1) + 24; } -// KmScene1001 - -KmScene1001::KmScene1001(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { -} - -uint32 KmScene1001::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4804: - if (param.asInteger() == 2) - GotoState(&Klaymen::stSleeping); - break; - case 0x480D: - GotoState(&Klaymen::stPullHammerLever); - break; - case 0x4812: - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4816: - if (param.asInteger() == 1) - GotoState(&Klaymen::stPressButton); - else if (param.asInteger() == 2) - GotoState(&Klaymen::stPressFloorButton); - else - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481F: - if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalf); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else if (param.asInteger() == 3) - GotoState(&Klaymen::stTurnToUseHalf); - else if (param.asInteger() == 4) - GotoState(&Klaymen::stTurnAwayFromUse); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x4836: - if (param.asInteger() == 1) { - sendMessage(_parentScene, 0x2002, 0); - GotoState(&Klaymen::stWakeUp); - } - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - -// KmScene1002 - -KmScene1002::KmScene1002(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - setKlaymenIdleTable1(); -} - -void KmScene1002::xUpdate() { - if (_x >= 250 && _x <= 435 && _y >= 420) { - if (_idleTableNum == 0) { - setKlaymenIdleTable(klaymenIdleTable1002, ARRAYSIZE(klaymenIdleTable1002)); - _idleTableNum = 1; - } - } else if (_idleTableNum == 1) { - setKlaymenIdleTable1(); - _idleTableNum = 0; - } -} - -uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x2001: - GotoState(&Klaymen::stStandIdleSpecial); - break; - case 0x2007: - _otherSprite = (Sprite*)param.asEntity(); - break; - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4803: - if (param.asInteger() == 1) - GotoState(&Klaymen::stJumpAndFall); - else if (param.asInteger() == 2) - GotoState(&Klaymen::stDropFromRing); - break; - case 0x4804: - GotoState(&Klaymen::stPeekWall); - break; - case 0x4805: - switch (param.asInteger()) { - case 1: - GotoState(&Klaymen::stJumpToRing1); - break; - case 2: - GotoState(&Klaymen::stJumpToRing2); - break; - case 3: - GotoState(&Klaymen::stJumpToRing3); - break; - case 4: - GotoState(&Klaymen::stJumpToRing4); - break; - } - break; - case 0x480A: - GotoState(&Klaymen::stMoveVenusFlyTrap); - break; - case 0x480D: - GotoState(&Klaymen::stJumpToRingVenusFlyTrap); - break; - case 0x4816: - if (param.asInteger() == 0) - GotoState(&Klaymen::stPressDoorButton); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - startWalkToAttachedSpriteXDistance(param.asInteger()); - break; - case 0x4820: - sendMessage(_parentScene, 0x2005, 0); - GotoState(&Klaymen::stContinueClimbLadderUp); - break; - case 0x4821: - sendMessage(_parentScene, 0x2005, 0); - _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderDown); - break; - case 0x4822: - sendMessage(_parentScene, 0x2005, 0); - _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderUp); - break; - case 0x4823: - sendMessage(_parentScene, 0x2006, 0); - GotoState(&Klaymen::stClimbLadderHalf); - break; - case 0x482E: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWalkToFrontNoStep); - else - GotoState(&Klaymen::stWalkToFront); - break; - case 0x482F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stTurnToFront); - else - GotoState(&Klaymen::stTurnToBack); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - -// KmScene1004 - -KmScene1004::KmScene1004(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - _dataResource.load(0x01900A04); -} - -uint32 KmScene1004::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x4818: - startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); - break; - case 0x481E: - GotoState(&Klaymen::stReadNote); - break; - case 0x4820: - sendMessage(_parentScene, 0x2000, 0); - GotoState(&Klaymen::stContinueClimbLadderUp); - break; - case 0x4821: - sendMessage(_parentScene, 0x2000, 0); - _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderDown); - break; - case 0x4822: - sendMessage(_parentScene, 0x2000, 0); - _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderUp); - break; - case 0x4823: - sendMessage(_parentScene, 0x2001, 0); - GotoState(&Klaymen::stClimbLadderHalf); - break; - case 0x4824: - sendMessage(_parentScene, 0x2000, 0); - _destY = _dataResource.getPoint(param.asInteger()).y; - GotoState(&Klaymen::stStartClimbLadderDown); - break; - case 0x4825: - sendMessage(_parentScene, 0x2000, 0); - _destY = _dataResource.getPoint(param.asInteger()).y; - GotoState(&Klaymen::stStartClimbLadderUp); - break; - case 0x4828: - GotoState(&Klaymen::stTurnToBackToUse); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - -KmScene1109::KmScene1109(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam ¶m) { - uint32 messageResult = 0; - switch (messageNum) { - case 0x2000: - _isSittingInTeleporter = param.asInteger() != 0; - messageResult = 1; - break; - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stSitIdleTeleporter); - else - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4804: - if (param.asInteger() != 0) { - _destX = param.asInteger(); - GotoState(&Klaymen::stWalkingFirst); - } else - GotoState(&Klaymen::stPeekWall); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481D: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stTurnToUseInTeleporter); - break; - case 0x481E: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stReturnFromUseInTeleporter); - break; - case 0x4834: - GotoState(&Klaymen::stStepOver); - break; - case 0x4835: - sendMessage(_parentScene, 0x2000, 1); - _isSittingInTeleporter = true; - GotoState(&Klaymen::stSitInTeleporter); - break; - case 0x4836: - sendMessage(_parentScene, 0x2000, 0); - _isSittingInTeleporter = false; - GotoState(&Klaymen::stGetUpFromTeleporter); - break; - case 0x483D: - teleporterAppear(0x2C2A4A1C); - break; - case 0x483E: - teleporterDisappear(0x3C2E4245); - break; - } - return messageResult; -} - -// KmScene1201 - -KmScene1201::KmScene1201(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - setKlaymenIdleTable(klaymenIdleTable4, ARRAYSIZE(klaymenIdleTable4)); - _doYHitIncr = true; -} - -uint32 KmScene1201::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x480A: - GotoState(&Klaymen::stMoveObject); - break; - case 0x4812: - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4813: - GotoState(&Klaymen::stFetchMatch); - break; - case 0x4814: - GotoState(&Klaymen::stTumbleHeadless); - break; - case 0x4815: - GotoState(&Klaymen::stCloseEyes); - break; - case 0x4816: - if (param.asInteger() == 0) - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481D: - GotoState(&Klaymen::stTurnToUse); - break; - case 0x481E: - GotoState(&Klaymen::stReturnFromUse); - break; - case 0x481F: - GotoState(&Klaymen::stWonderAbout); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - -KmScene1303::KmScene1303(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene1303::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4804: - GotoState(&Klaymen::stPeekWall1); - break; - case 0x483B: - GotoState(&Klaymen::stPeekWallReturn); - break; - case 0x483C: - GotoState(&Klaymen::stPeekWall2); - break; - } - return 0; -} - -KmScene1304::KmScene1304(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene1304::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4812: - if (param.asInteger() == 2) - GotoState(&Klaymen::stPickUpNeedle); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stPickUpTube); - else - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stTurnAwayFromUse); - else if (param.asInteger() == 0) - GotoState(&Klaymen::stTurnToUseHalf); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - -KmScene1305::KmScene1305(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene1305::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4804: - GotoState(&Klaymen::stCrashDown); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - } - return 0; -} - -KmScene1306::KmScene1306(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) { - uint32 messageResult = 0; - switch (messageNum) { - case 0x2000: - _isSittingInTeleporter = param.asInteger() != 0; - messageResult = 1; - break; - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stSitIdleTeleporter); - else - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4812: - if (param.asInteger() == 2) - GotoState(&Klaymen::stPickUpNeedle); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stPickUpTube); - else - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4816: - if (param.asInteger() == 1) - GotoState(&Klaymen::stPressButton); - else if (param.asInteger() == 2) - GotoState(&Klaymen::stPressFloorButton); - else - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481A: - GotoState(&Klaymen::stInsertDisk); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481D: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stTurnToUseInTeleporter); - else - GotoState(&Klaymen::stTurnToUse); - break; - case 0x481E: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stReturnFromUseInTeleporter); - else - GotoState(&Klaymen::stReturnFromUse); - break; - case 0x481F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalf); - else if (param.asInteger() == 4) - GotoState(&Klaymen::stTurnAwayFromUse); - else if (param.asInteger() == 3) - GotoState(&Klaymen::stTurnToUseHalf); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x482E: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWalkToFrontNoStep); - else - GotoState(&Klaymen::stWalkToFront); - break; - case 0x482F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stTurnToFront); - else - GotoState(&Klaymen::stTurnToBack); - break; - case 0x4834: - GotoState(&Klaymen::stStepOver); - break; - case 0x4835: - sendMessage(_parentScene, 0x2000, 1); - _isSittingInTeleporter = true; - GotoState(&Klaymen::stSitInTeleporter); - break; - case 0x4836: - sendMessage(_parentScene, 0x2000, 0); - _isSittingInTeleporter = false; - GotoState(&Klaymen::stGetUpFromTeleporter); - break; - case 0x483D: - teleporterAppear(0xEE084A04); - break; - case 0x483E: - teleporterDisappear(0xB86A4274); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return messageResult; -} - -KmScene1308::KmScene1308(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x480A: - if (param.asInteger() == 1) - GotoState(&Klaymen::stMoveObjectSkipTurnFaceObject); - else - GotoState(&Klaymen::stMoveObjectFaceObject); - break; - case 0x480D: - GotoState(&Klaymen::stUseLever); - break; - case 0x4812: - if (param.asInteger() == 2) - GotoState(&Klaymen::stPickUpNeedle); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stPickUpTube); - else - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481A: - if (param.asInteger() == 1) - GotoState(&Klaymen::stInsertKey); - else - GotoState(&Klaymen::stInsertDisk); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481D: - GotoState(&Klaymen::stTurnToUse); - break; - case 0x481E: - GotoState(&Klaymen::stReturnFromUse); - break; - case 0x4827: - GotoState(&Klaymen::stReleaseLever); - break; - case 0x4834: - GotoState(&Klaymen::stStepOver); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - -// KmScene1401 - -KmScene1401::KmScene1401(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene1401::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x480A: - if (param.asInteger() == 1) - GotoState(&Klaymen::stMoveObjectSkipTurnFaceObject); - else - GotoState(&Klaymen::stMoveObjectFaceObject); - break; - case 0x4816: - if (param.asInteger() == 1) - GotoState(&Klaymen::stPressButton); - else if (param.asInteger() == 2) - GotoState(&Klaymen::stPressFloorButton); - else - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stTurnAwayFromUse); - else if (param.asInteger() == 0) - GotoState(&Klaymen::stTurnToUseHalf); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x482E: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWalkToFrontNoStep); - else - GotoState(&Klaymen::stWalkToFront); - break; - case 0x482F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stTurnToFront); - else - GotoState(&Klaymen::stTurnToBack); - break; - } - return 0; -} - -// KmScene1402 - -KmScene1402::KmScene1402(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - SetFilterY(&Sprite::defFilterY); -} - -uint32 KmScene1402::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x480A: - if (param.asInteger() == 1) - GotoState(&Klaymen::stMoveObjectSkipTurnFaceObject); - else - GotoState(&Klaymen::stMoveObjectFaceObject); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481D: - GotoState(&Klaymen::stTurnToUse); - break; - case 0x481E: - GotoState(&Klaymen::stReturnFromUse); - break; - } - return 0; -} - -// KmScene1403 - -KmScene1403::KmScene1403(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - setKlaymenIdleTable(klaymenIdleTable4, ARRAYSIZE(klaymenIdleTable4)); -} - -uint32 KmScene1403::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x480A: - if (param.asInteger() == 1) - GotoState(&Klaymen::stMoveObjectSkipTurnFaceObject); - else - GotoState(&Klaymen::stMoveObjectFaceObject); - break; - case 0x480D: - GotoState(&Klaymen::stUseLever); - break; - case 0x4812: - if (param.asInteger() == 2) - GotoState(&Klaymen::stPickUpNeedle); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stPickUpTube); - else - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x4827: - GotoState(&Klaymen::stReleaseLever); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - -// KmScene1404 - -KmScene1404::KmScene1404(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene1404::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x480A: - if (param.asInteger() == 1) - GotoState(&Klaymen::stMoveObjectSkipTurnFaceObject); - else - GotoState(&Klaymen::stMoveObjectFaceObject); - break; - case 0x4812: - if (param.asInteger() == 2) - GotoState(&Klaymen::stPickUpNeedle); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stPickUpTube); - else - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481A: - GotoState(&Klaymen::stInsertDisk); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481D: - GotoState(&Klaymen::stTurnToUse); - break; - case 0x481E: - GotoState(&Klaymen::stReturnFromUse); - break; - case 0x481F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalf); - else if (param.asInteger() == 4) - GotoState(&Klaymen::stTurnAwayFromUse); - else if (param.asInteger() == 3) - GotoState(&Klaymen::stTurnToUseHalf); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - -KmScene1608::KmScene1608(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam ¶m) { - uint32 messageResult = 0; - switch (messageNum) { - case 0x2032: - _isSittingInTeleporter = param.asInteger() != 0; - messageResult = 1; - break; - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stSitIdleTeleporter); - else - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4812: - if (param.asInteger() == 2) - GotoState(&Klaymen::stPickUpNeedle); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stPickUpTube); - else - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481D: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stTurnToUseInTeleporter); - break; - case 0x481E: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stReturnFromUseInTeleporter); - break; - case 0x481F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalf); - else if (param.asInteger() == 4) - GotoState(&Klaymen::stTurnAwayFromUse); - else if (param.asInteger() == 3) - GotoState(&Klaymen::stTurnToUseHalf); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x4834: - GotoState(&Klaymen::stStepOver); - break; - case 0x4835: - sendMessage(_parentScene, 0x2032, 1); - _isSittingInTeleporter = true; - GotoState(&Klaymen::stSitInTeleporter); - break; - case 0x4836: - sendMessage(_parentScene, 0x2032, 0); - _isSittingInTeleporter = false; - GotoState(&Klaymen::stGetUpFromTeleporter); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return messageResult; -} - -// KmScene1705 - -KmScene1705::KmScene1705(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam ¶m) { - uint32 messageResult = 0; - switch (messageNum) { - case 0x2000: - _isSittingInTeleporter = param.asInteger() != 0; - messageResult = 1; - break; - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stSitIdleTeleporter); - else - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4803: - GotoState(&Klaymen::stFallSkipJump); - break; - case 0x4812: - if (param.asInteger() == 2) - GotoState(&Klaymen::stPickUpNeedle); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stPickUpTube); - else - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481D: - if (_isSittingInTeleporter) { - GotoState(&Klaymen::stTurnToUseInTeleporter); - } - break; - case 0x481E: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stReturnFromUseInTeleporter); - break; - case 0x481F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalf); - else if (param.asInteger() == 4) - GotoState(&Klaymen::stTurnAwayFromUse); - else if (param.asInteger() == 3) - GotoState(&Klaymen::stTurnToUseHalf); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x4834: - GotoState(&Klaymen::stStepOver); - break; - case 0x4835: - sendMessage(_parentScene, 0x2000, 1); - _isSittingInTeleporter = true; - GotoState(&Klaymen::stSitInTeleporter); - break; - case 0x4836: - sendMessage(_parentScene, 0x2000, 0); - _isSittingInTeleporter = false; - GotoState(&Klaymen::stGetUpFromTeleporter); - break; - case 0x483D: - teleporterAppear(0x5E0A4905); - break; - case 0x483E: - teleporterDisappear(0xD86E4477); - break; - } - return messageResult; -} - -KmScene1901::KmScene1901(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene1901::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481D: - GotoState(&Klaymen::stTurnToUse); - break; - case 0x481E: - GotoState(&Klaymen::stReturnFromUse); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - -KmScene2001::KmScene2001(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam ¶m) { - uint32 messageResult = 0; - switch (messageNum) { - case 0x2000: - _isSittingInTeleporter = param.asInteger() != 0; - messageResult = 1; - break; - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stSitIdleTeleporter); - else - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4804: - if (param.asInteger() != 0) { - _destX = param.asInteger(); - GotoState(&Klaymen::stWalkingFirst); - } else - GotoState(&Klaymen::stPeekWall); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481D: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stTurnToUseInTeleporter); - break; - case 0x481E: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stReturnFromUseInTeleporter); - break; - case 0x4834: - GotoState(&Klaymen::stStepOver); - break; - case 0x4835: - sendMessage(_parentScene, 0x2000, 1); - _isSittingInTeleporter = true; - GotoState(&Klaymen::stSitInTeleporter); - break; - case 0x4836: - sendMessage(_parentScene, 0x2000, 0); - _isSittingInTeleporter = false; - GotoState(&Klaymen::stGetUpFromTeleporter); - break; - case 0x483D: - teleporterAppear(0xBE68CC54); - break; - case 0x483E: - teleporterDisappear(0x18AB4ED4); - break; - } - return messageResult; -} - -KmScene2101::KmScene2101(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene2101::xHandleMessage(int messageNum, const MessageParam ¶m) { - uint32 messageResult = 0; - switch (messageNum) { - case 0x2000: - _isSittingInTeleporter = param.asInteger() != 0; - messageResult = 1; - break; - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stSitIdleTeleporter); - else - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4811: - GotoState(&Klaymen::stHitByDoor); - break; - case 0x4812: - if (param.asInteger() == 2) - GotoState(&Klaymen::stPickUpNeedle); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stPickUpTube); - else - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4816: - if (param.asInteger() == 1) - GotoState(&Klaymen::stPressButton); - else if (param.asInteger() == 2) - GotoState(&Klaymen::stPressFloorButton); - else - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481D: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stTurnToUseInTeleporter); - break; - case 0x481E: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stReturnFromUseInTeleporter); - break; - case 0x4834: - GotoState(&Klaymen::stStepOver); - break; - case 0x4835: - sendMessage(_parentScene, 0x2000, 1); - _isSittingInTeleporter = true; - GotoState(&Klaymen::stSitInTeleporter); - break; - case 0x4836: - sendMessage(_parentScene, 0x2000, 0); - _isSittingInTeleporter = false; - GotoState(&Klaymen::stGetUpFromTeleporter); - break; - case 0x483D: - teleporterAppear(0xFF290E30); - break; - case 0x483E: - teleporterDisappear(0x9A28CA1C); - break; - } - return messageResult; -} - -KmScene2201::KmScene2201(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount) - : Klaymen(vm, parentScene, x, y) { - - _surface->setClipRects(clipRects, clipRectsCount); - _dataResource.load(0x04104242); -} - -uint32 KmScene2201::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4812: - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4816: - if (param.asInteger() == 0) - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x4818: - startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481D: - GotoState(&Klaymen::stTurnToUse); - break; - case 0x481E: - GotoState(&Klaymen::stReturnFromUse); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x482E: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWalkToFrontNoStep); - else - GotoState(&Klaymen::stWalkToFront); - break; - case 0x482F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stTurnToFront); - else - GotoState(&Klaymen::stTurnToBack); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - -KmScene2203::KmScene2203(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene2203::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4812: - if (param.asInteger() == 2) - GotoState(&Klaymen::stPickUpNeedle); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stPickUpTube); - else - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4816: - if (param.asInteger() == 1) - GotoState(&Klaymen::stPressButton); - else if (param.asInteger() == 2) - GotoState(&Klaymen::stPressFloorButton); - else - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x4818: - startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); - break; - case 0x4819: - GotoState(&Klaymen::stClayDoorOpen); - break; - case 0x481A: - GotoState(&Klaymen::stInsertDisk); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481D: - GotoState(&Klaymen::stTurnToUse); - break; - case 0x481E: - GotoState(&Klaymen::stReturnFromUse); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - -KmScene2205::KmScene2205(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -void KmScene2205::xUpdate() { - setGlobalVar(V_KLAYMEN_FRAMEINDEX, _currFrameIndex); -} - -uint32 KmScene2205::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4804: - if (param.asInteger() != 0) { - _destX = param.asInteger(); - GotoState(&Klaymen::stStartWalkingResume); - } else - GotoState(&Klaymen::stPeekWall); - break; - case 0x4816: - if (param.asInteger() == 0) - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x4818: - startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - -KmScene2206::KmScene2206(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - _walkResumeFrameIncr = 1; - _vm->_soundMan->addSound(0x80101800, 0xD3B02847); -} - -KmScene2206::~KmScene2206() { - _vm->_soundMan->deleteSoundGroup(0x80101800); -} - -void KmScene2206::xUpdate() { - setGlobalVar(V_KLAYMEN_FRAMEINDEX, _currFrameIndex); -} - -uint32 KmScene2206::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4803: - GotoState(&Klaymen::stRidePlatformDown); - break; - case 0x4804: - if (param.asInteger() != 0) { - _destX = param.asInteger(); - GotoState(&Klaymen::stStartWalkingResume); - } else - GotoState(&Klaymen::stPeekWall); - break; - case 0x4812: - if (param.asInteger() == 1) - GotoState(&Klaymen::stPickUpTube); - else - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4816: - if (param.asInteger() == 1) - GotoState(&Klaymen::stPressButton); - else if (param.asInteger() == 2) - GotoState(&Klaymen::stPressFloorButton); - else - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481F: - if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalf); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else if (param.asInteger() == 3) - GotoState(&Klaymen::stTurnToUseHalf); - else if (param.asInteger() == 4) - GotoState(&Klaymen::stTurnAwayFromUse); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x482E: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWalkToFrontNoStep); - else - GotoState(&Klaymen::stWalkToFront); - break; - case 0x482F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stTurnToFront); - else - GotoState(&Klaymen::stTurnToBack); - break; - case 0x4837: - stopWalking(); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - -KmScene2207::KmScene2207(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene2207::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x2001: - GotoState(&Klaymen::stRidePlatform); - break; - case 0x2005: - suRidePlatform(); - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x480D: - GotoState(&Klaymen::stInteractLever); - break; - case 0x4812: - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4816: - if (param.asInteger() == 1) - GotoState(&Klaymen::stPressButton); - else if (param.asInteger() == 2) - GotoState(&Klaymen::stPressFloorButton); - else - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x4827: - GotoState(&Klaymen::stReleaseLever); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - -KmScene2242::KmScene2242(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -void KmScene2242::xUpdate() { - setGlobalVar(V_KLAYMEN_FRAMEINDEX, _currFrameIndex); -} - -uint32 KmScene2242::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4804: - if (param.asInteger() != 0) { - _destX = param.asInteger(); - GotoState(&Klaymen::stStartWalkingResume); - } else - GotoState(&Klaymen::stPeekWall); - break; - case 0x4812: - if (param.asInteger() == 2) - GotoState(&Klaymen::stPickUpNeedle); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stPickUpTube); - else - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481F: - if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalf); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else if (param.asInteger() == 3) - GotoState(&Klaymen::stTurnToUseHalf); - else if (param.asInteger() == 4) - GotoState(&Klaymen::stTurnAwayFromUse); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x4837: - stopWalking(); - break; - } - return 0; -} - -KmHallOfRecords::KmHallOfRecords(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - // Empty -} - -void KmHallOfRecords::xUpdate() { - setGlobalVar(V_KLAYMEN_FRAMEINDEX, _currFrameIndex); -} - -uint32 KmHallOfRecords::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4804: - if (param.asInteger() != 0) { - _destX = param.asInteger(); - GotoState(&Klaymen::stStartWalkingResume); - } else - GotoState(&Klaymen::stPeekWall); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481F: - if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalf); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else if (param.asInteger() == 3) - GotoState(&Klaymen::stTurnToUseHalf); - else if (param.asInteger() == 4) - GotoState(&Klaymen::stTurnAwayFromUse); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x4837: - stopWalking(); - break; - } - return 0; -} - -KmScene2247::KmScene2247(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -void KmScene2247::xUpdate() { - setGlobalVar(V_KLAYMEN_FRAMEINDEX, _currFrameIndex); -} - -uint32 KmScene2247::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4804: - if (param.asInteger() != 0) { - _destX = param.asInteger(); - GotoState(&Klaymen::stStartWalkingResume); - } else - GotoState(&Klaymen::stPeekWall); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481F: - if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalf); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else if (param.asInteger() == 3) - GotoState(&Klaymen::stTurnToUseHalf); - else if (param.asInteger() == 4) - GotoState(&Klaymen::stTurnAwayFromUse); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x4837: - stopWalking(); - break; - } - return 0; -} - -KmScene2401::KmScene2401(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene2401::xHandleMessage(int messageNum, const MessageParam ¶m) { - uint32 messageResult = 0; - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4816: - if (param.asInteger() == 1) - GotoState(&Klaymen::stPressButton); - else if (param.asInteger() == 2) - GotoState(&Klaymen::stPressFloorButton); - else - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stTurnAwayFromUse); - else if (param.asInteger() == 0) - GotoState(&Klaymen::stTurnToUseHalf); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x482E: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWalkToFrontNoStep); - else - GotoState(&Klaymen::stWalkToFront); - break; - case 0x482F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stTurnToFront); - else - GotoState(&Klaymen::stTurnToBack); - break; - case 0x4832: - GotoState(&Klaymen::stUseTube); - break; - case 0x4833: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAbout); - else { - _spitPipeIndex = sendMessage(_parentScene, 0x2000, 0); - GotoState(&Klaymen::stTrySpitIntoPipe); - } - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return messageResult; -} - -KmScene2402::KmScene2402(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene2402::xHandleMessage(int messageNum, const MessageParam ¶m) { - uint32 messageResult = 0; - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - if (!getGlobalVar(V_TV_JOKE_TOLD)) - GotoState(&Klaymen::stStandWonderAbout); - else - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4804: - if (param.asInteger() != 0) { - _destX = param.asInteger(); - GotoState(&Klaymen::stWalkingFirst); - } else - GotoState(&Klaymen::stPeekWall); - break; - case 0x4812: - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4816: - if (param.asInteger() == 1) - GotoState(&Klaymen::stPressButton); - else if (param.asInteger() == 2) - GotoState(&Klaymen::stPressFloorButton); - else - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481F: - if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalf); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else if (param.asInteger() == 3) - GotoState(&Klaymen::stTurnToUseHalf); - else if (param.asInteger() == 4) - GotoState(&Klaymen::stTurnAwayFromUse); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return messageResult; -} - -KmScene2403::KmScene2403(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene2403::xHandleMessage(int messageNum, const MessageParam ¶m) { - uint32 messageResult = 0; - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x480D: - GotoState(&Klaymen::stPullCord); - break; - case 0x4812: - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4816: - if (param.asInteger() == 1) - GotoState(&Klaymen::stPressButton); - else if (param.asInteger() == 2) - GotoState(&Klaymen::stPressFloorButton); - else - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481F: - if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalf); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else if (param.asInteger() == 3) - GotoState(&Klaymen::stTurnToUseHalf); - else if (param.asInteger() == 4) - GotoState(&Klaymen::stTurnAwayFromUse); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x4820: - sendMessage(_parentScene, 0x2000, 0); - GotoState(&Klaymen::stContinueClimbLadderUp); - break; - case 0x4821: - sendMessage(_parentScene, 0x2000, 0); - _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderDown); - break; - case 0x4822: - sendMessage(_parentScene, 0x2000, 0); - _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderUp); - break; - case 0x4823: - sendMessage(_parentScene, 0x2001, 0); - GotoState(&Klaymen::stClimbLadderHalf); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return messageResult; -} - -KmScene2406::KmScene2406(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount) - : Klaymen(vm, parentScene, x, y) { - - _surface->setClipRects(clipRects, clipRectsCount); -} - -uint32 KmScene2406::xHandleMessage(int messageNum, const MessageParam ¶m) { - uint32 messageResult = 0; - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4804: - if (param.asInteger() != 0) { - _destX = param.asInteger(); - GotoState(&Klaymen::stWalkingFirst); - } else - GotoState(&Klaymen::stPeekWall); - break; - case 0x4812: - if (param.asInteger() == 2) - GotoState(&Klaymen::stPickUpNeedle); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stPickUpTube); - else - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481A: - GotoState(&Klaymen::stInsertDisk); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481D: - GotoState(&Klaymen::stTurnToUse); - break; - case 0x481E: - GotoState(&Klaymen::stReturnFromUse); - break; - case 0x481F: - if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalf); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else if (param.asInteger() == 3) - GotoState(&Klaymen::stTurnToUseHalf); - else if (param.asInteger() == 4) - GotoState(&Klaymen::stTurnAwayFromUse); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x4820: - sendMessage(_parentScene, 0x2000, 0); - GotoState(&Klaymen::stContinueClimbLadderUp); - break; - case 0x4821: - sendMessage(_parentScene, 0x2000, 0); - _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderDown); - break; - case 0x4822: - sendMessage(_parentScene, 0x2000, 0); - _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderUp); - break; - case 0x4823: - sendMessage(_parentScene, 0x2001, 0); - GotoState(&Klaymen::stClimbLadderHalf); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return messageResult; -} - -KmScene2501::KmScene2501(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene2501::xHandleMessage(int messageNum, const MessageParam ¶m) { - uint32 messageResult = 0; - switch (messageNum) { - case 0x2000: - _isSittingInTeleporter = param.asInteger() != 0; - messageResult = 1; - break; - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stSitIdleTeleporter); - else - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481D: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stTurnToUseInTeleporter); - break; - case 0x481E: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stReturnFromUseInTeleporter); - break; - case 0x4834: - GotoState(&Klaymen::stStepOver); - break; - case 0x4835: - sendMessage(_parentScene, 0x2000, 1); - _isSittingInTeleporter = true; - GotoState(&Klaymen::stSitInTeleporter); - break; - case 0x4836: - sendMessage(_parentScene, 0x2000, 0); - _isSittingInTeleporter = false; - GotoState(&Klaymen::stGetUpFromTeleporter); - break; - } - return messageResult; -} - -KmScene2732::KmScene2732(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene2732::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4804: - GotoState(&Klaymen::stPeekInside); - break; - case 0x483C: - GotoState(&Klaymen::stPeekInsideReturn); - break; - } - return 0; -} - -KmScene2801::KmScene2801(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene2801::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4812: - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481D: - GotoState(&Klaymen::stTurnToUse); - break; - case 0x481E: - GotoState(&Klaymen::stReturnFromUse); - break; - case 0x481F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalf); - else if (param.asInteger() == 4) - GotoState(&Klaymen::stTurnAwayFromUse); - else if (param.asInteger() == 3) - GotoState(&Klaymen::stTurnToUseHalf); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x482E: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWalkToFrontNoStep); - else - GotoState(&Klaymen::stWalkToFront); - break; - case 0x482F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stTurnToFront); - else - GotoState(&Klaymen::stTurnToBack); - break; - case 0x4837: - stopWalking(); - break; - } - return 0; -} - -KmScene2803::KmScene2803(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount) - : Klaymen(vm, parentScene, x, y) { - - _surface->setClipRects(clipRects, clipRectsCount); - _dataResource.load(0x00900849); -} - -uint32 KmScene2803::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4803: - _destY = param.asInteger(); - GotoState(&Klaymen::stJumpToGrab); - break; - case 0x4804: - if (param.asInteger() == 3) - GotoState(&Klaymen::stFinishGrow); - break; - case 0x480D: - GotoState(&Klaymen::stPullCord); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x4818: - startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); - break; - case 0x481D: - GotoState(&Klaymen::stTurnToUse); - break; - case 0x481E: - GotoState(&Klaymen::stReturnFromUse); - break; - case 0x481F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else - GotoState(&Klaymen::stWonderAboutHalf); - break; - case 0x482E: - GotoState(&Klaymen::stWalkToFront); - break; - case 0x482F: - GotoState(&Klaymen::stTurnToBack); - break; - case 0x4834: - GotoState(&Klaymen::stStepOver); - break; - case 0x4838: - GotoState(&Klaymen::stJumpToGrabRelease); - break; - } - return 0; -} - -KmScene2803Small::KmScene2803Small(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - _dataResource.load(0x81120132); -} - -uint32 KmScene2803Small::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToXSmall(param.asPoint().x); - break; - case 0x4004: - GotoState(&Klaymen::stStandIdleSmall); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x4818: - startWalkToXSmall(_dataResource.getPoint(param.asInteger()).x); - break; - case 0x481F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfterSmall); - else if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalfSmall); - else - GotoState(&Klaymen::stWonderAboutSmall); - break; - case 0x482E: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWalkToFrontNoStepSmall); - else if (param.asInteger() == 2) - GotoState(&Klaymen::stWalkToFront2Small); - else - GotoState(&Klaymen::stWalkToFrontSmall); - break; - case 0x482F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stTurnToBackHalfSmall); - else if (param.asInteger() == 2) - GotoState(&Klaymen::stTurnToBackWalkSmall); - else - GotoState(&Klaymen::stTurnToBackSmall); - break; - case 0x4830: - GotoState(&Klaymen::stShrink); - break; - } - return 0; -} - -KmScene2805::KmScene2805(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene2805::xHandleMessage(int messageNum, const MessageParam ¶m) { - uint32 messageResult = 0; - switch (messageNum) { - case 0x2000: - _isSittingInTeleporter = param.asInteger() != 0; - messageResult = 1; - break; - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stSitIdleTeleporter); - else - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481D: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stTurnToUseInTeleporter); - break; - case 0x481E: - if (_isSittingInTeleporter) - GotoState(&Klaymen::stReturnFromUseInTeleporter); - break; - case 0x4834: - GotoState(&Klaymen::stStepOver); - break; - case 0x4835: - sendMessage(_parentScene, 0x2000, 1); - _isSittingInTeleporter = true; - GotoState(&Klaymen::stSitInTeleporter); - break; - case 0x4836: - sendMessage(_parentScene, 0x2000, 0); - _isSittingInTeleporter = false; - GotoState(&Klaymen::stGetUpFromTeleporter); - break; - case 0x483D: - teleporterAppear(0xDE284B74); - break; - case 0x483E: - teleporterDisappear(0xD82A4094); - break; - } - return messageResult; -} - -KmScene2806::KmScene2806(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, - bool needsLargeSurface, NRect *clipRects, uint clipRectsCount) - : Klaymen(vm, parentScene, x, y) { - - if (needsLargeSurface) { - NDimensions dimensions = _animResource.loadSpriteDimensions(0x2838C010); - delete _surface; - createSurface(1000, dimensions.width, dimensions.height); - loadSound(3, 0x58E0C341); - loadSound(4, 0x40A00342); - loadSound(5, 0xD0A1C348); - loadSound(6, 0x166FC6E0); - loadSound(7, 0x00018040); - } - - _dataResource.load(0x98182003); - _surface->setClipRects(clipRects, clipRectsCount); -} - -uint32 KmScene2806::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4804: - startWalkToX(440, true); - break; - case 0x480D: - GotoState(&Klaymen::stPullCord); - break; - case 0x4816: - if (param.asInteger() == 0) - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x4818: - startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); - break; - case 0x4831: - GotoState(&Klaymen::stGrow); - break; - case 0x4832: - if (param.asInteger() == 1) - GotoState(&Klaymen::stDrinkPotion); - else - GotoState(&Klaymen::stUseTube); - break; - } - return 0; -} - -KmScene2809::KmScene2809(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, - bool needsLargeSurface, NRect *clipRects, uint clipRectsCount) - : Klaymen(vm, parentScene, x, y) { - - if (needsLargeSurface) { - NDimensions dimensions = _animResource.loadSpriteDimensions(0x2838C010); - delete _surface; - createSurface(1000, dimensions.width, dimensions.height); - loadSound(3, 0x58E0C341); - loadSound(4, 0x40A00342); - loadSound(5, 0xD0A1C348); - loadSound(6, 0x166FC6E0); - loadSound(7, 0x00018040); - } - - _dataResource.load(0x1830009A); - _surface->setClipRects(clipRects, clipRectsCount); -} - -uint32 KmScene2809::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4804: - startWalkToX(226, true); - break; - case 0x480D: - GotoState(&Klaymen::stPullCord); - break; - case 0x4816: - if (param.asInteger() == 0) - GotoState(&Klaymen::stPressButtonSide); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x4818: - startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); - break; - case 0x4831: - GotoState(&Klaymen::stGrow); - break; - case 0x4832: - if (param.asInteger() == 1) - GotoState(&Klaymen::stDrinkPotion); - else - GotoState(&Klaymen::stUseTube); - break; - } - return 0; -} - -KmScene2810Small::KmScene2810Small(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene2810Small::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToXSmall(param.asPoint().x); - break; - case 0x4004: - GotoState(&Klaymen::stStandIdleSmall); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x4818: - startWalkToXSmall(_dataResource.getPoint(param.asInteger()).x); - break; - case 0x481F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfterSmall); - else if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalfSmall); - else - GotoState(&Klaymen::stWonderAboutSmall); - break; - case 0x482E: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWalkToFrontNoStepSmall); - else - GotoState(&Klaymen::stWalkToFrontSmall); - break; - case 0x482F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stTurnToBackHalfSmall); - else - GotoState(&Klaymen::stTurnToBackSmall); - break; - case 0x4837: - stopWalking(); - break; - } - return 0; -} - -KmScene2810::KmScene2810(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, uint clipRectsCount) - : Klaymen(vm, parentScene, x, y) { - - _surface->setClipRects(clipRects, clipRectsCount); -} - -uint32 KmScene2810::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4803: - _destY = param.asInteger(); - GotoState(&Klaymen::stJumpToGrab); - break; - case 0x4804: - if (param.asInteger() == 3) - GotoState(&Klaymen::stFinishGrow); - break; - case 0x4812: - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x4818: - startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481F: - if (param.asInteger() == 0) - GotoState(&Klaymen::stWonderAboutHalf); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stWonderAboutAfter); - else if (param.asInteger() == 3) - GotoState(&Klaymen::stTurnToUseHalf); - else if (param.asInteger() == 4) - GotoState(&Klaymen::stTurnAwayFromUse); - else if (param.asInteger() == 5) - GotoState(&Klaymen::stTurnToUseExt); - else - GotoState(&Klaymen::stWonderAbout); - break; - case 0x4820: - sendMessage(_parentScene, 0x2000, 0); - GotoState(&Klaymen::stContinueClimbLadderUp); - break; - case 0x4821: - sendMessage(_parentScene, 0x2000, 0); - _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderDown); - break; - case 0x4822: - sendMessage(_parentScene, 0x2000, 0); - _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderUp); - break; - case 0x4823: - sendMessage(_parentScene, 0x2001, 0); - GotoState(&Klaymen::stClimbLadderHalf); - break; - case 0x4824: - sendMessage(_parentScene, 0x2000, 0); - _destY = _dataResource.getPoint(param.asInteger()).y; - GotoState(&Klaymen::stStartClimbLadderDown); - break; - case 0x4825: - sendMessage(_parentScene, 0x2000, 0); - _destY = _dataResource.getPoint(param.asInteger()).y; - GotoState(&Klaymen::stStartClimbLadderUp); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x4837: - stopWalking(); - break; - } - return 0; -} - -KmScene2812::KmScene2812(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { - - // Empty -} - -uint32 KmScene2812::xHandleMessage(int messageNum, const MessageParam ¶m) { - switch (messageNum) { - case 0x4001: - case 0x4800: - startWalkToX(param.asPoint().x, false); - break; - case 0x4004: - GotoState(&Klaymen::stTryStandIdle); - break; - case 0x4805: - _destY = param.asInteger(); - GotoState(&Klaymen::stJumpToGrabFall); - break; - case 0x4812: - if (param.asInteger() == 2) - GotoState(&Klaymen::stPickUpNeedle); - else if (param.asInteger() == 1) - GotoState(&Klaymen::stPickUpTube); - else - GotoState(&Klaymen::stPickUpGeneric); - break; - case 0x4817: - setDoDeltaX(param.asInteger()); - gotoNextStateExt(); - break; - case 0x481A: - GotoState(&Klaymen::stInsertDisk); - break; - case 0x481B: - if (param.asPoint().y != 0) - startWalkToXDistance(param.asPoint().y, param.asPoint().x); - else - startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; - case 0x481D: - GotoState(&Klaymen::stTurnToUse); - break; - case 0x481E: - GotoState(&Klaymen::stReturnFromUse); - break; - case 0x4820: - sendMessage(_parentScene, 0x2001, 0); - GotoState(&Klaymen::stContinueClimbLadderUp); - break; - case 0x4821: - sendMessage(_parentScene, 0x2001, 0); - _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderDown); - break; - case 0x4822: - sendMessage(_parentScene, 0x2001, 0); - _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderUp); - break; - case 0x4823: - sendMessage(_parentScene, 0x2002, 0); - GotoState(&Klaymen::stClimbLadderHalf); - break; - case 0x482D: - setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); - gotoNextStateExt(); - break; - case 0x482E: - if (param.asInteger() == 1) - GotoState(&Klaymen::stWalkToFrontNoStep); - else - GotoState(&Klaymen::stWalkToFront); - break; - case 0x482F: - if (param.asInteger() == 1) - GotoState(&Klaymen::stTurnToFront); - else - GotoState(&Klaymen::stTurnToBack); - break; - case 0x483F: - startSpecialWalkRight(param.asInteger()); - break; - case 0x4840: - startSpecialWalkLeft(param.asInteger()); - break; - } - return 0; -} - } // End of namespace Neverhood |