diff options
author | Filippos Karapetis | 2013-10-06 04:55:52 +0300 |
---|---|---|
committer | Filippos Karapetis | 2013-10-06 04:56:41 +0300 |
commit | f35298f9eed0c98a9ec839e80f95c9fcab075223 (patch) | |
tree | 3ec95ff547d1da89f4f236cfb0866689cfe69b68 /engines | |
parent | a1719ac3d0c895ce428fe91ccc90792f3ac2d43a (diff) | |
download | scummvm-rg350-f35298f9eed0c98a9ec839e80f95c9fcab075223.tar.gz scummvm-rg350-f35298f9eed0c98a9ec839e80f95c9fcab075223.tar.bz2 scummvm-rg350-f35298f9eed0c98a9ec839e80f95c9fcab075223.zip |
NEVERHOOD: Move module-specific Klaymen code to its respective module
Diffstat (limited to 'engines')
39 files changed, 3039 insertions, 3107 deletions
diff --git a/engines/neverhood/klaymen.cpp b/engines/neverhood/klaymen.cpp index 100299f123..ff6738abe8 100644 --- a/engines/neverhood/klaymen.cpp +++ b/engines/neverhood/klaymen.cpp @@ -47,12 +47,6 @@ static const KlaymenIdleTableItem klaymenIdleTable3[] = { {1, kIdleTeleporterHands2} }; -static const KlaymenIdleTableItem klaymenIdleTable4[] = { - {1, kIdleSpinHead}, - {1, kIdleChest}, - {1, kIdleHeadOff}, -}; - // Klaymen Klaymen::Klaymen(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRectArray *clipRects) @@ -3339,2473 +3333,4 @@ void Klaymen::stPeekInsideBlink() { _blinkCounterMax = _vm->_rnd->getRandomNumber(64 - 1) + 24; } -// 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 diff --git a/engines/neverhood/klaymen.h b/engines/neverhood/klaymen.h index 45b7140b9d..23259f4deb 100644 --- a/engines/neverhood/klaymen.h +++ b/engines/neverhood/klaymen.h @@ -462,281 +462,6 @@ protected: }; -class KmScene1201 : public Klaymen { -public: - KmScene1201(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene1303 : public Klaymen { -public: - KmScene1303(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene1304 : public Klaymen { -public: - KmScene1304(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene1305 : public Klaymen { -public: - KmScene1305(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene1306 : public Klaymen { -public: - KmScene1306(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene1308 : public Klaymen { -public: - KmScene1308(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene1401 : public Klaymen { -public: - KmScene1401(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene1402 : public Klaymen { -public: - KmScene1402(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene1403 : public Klaymen { -public: - KmScene1403(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene1404 : public Klaymen { -public: - KmScene1404(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene1608 : public Klaymen { -public: - KmScene1608(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene1705 : public Klaymen { -public: - KmScene1705(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene1901 : public Klaymen { -public: - KmScene1901(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2001 : public Klaymen { -public: - KmScene2001(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2101 : public Klaymen { -public: - KmScene2101(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2201 : public Klaymen { -public: - KmScene2201(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2203 : public Klaymen { -public: - KmScene2203(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2205 : public Klaymen { -public: - KmScene2205(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - void xUpdate(); - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2206 : public Klaymen { -public: - KmScene2206(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); - ~KmScene2206(); -protected: - void xUpdate(); - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2207 : public Klaymen { -public: - KmScene2207(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2242 : public Klaymen { -public: - KmScene2242(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - void xUpdate(); - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmHallOfRecords : public Klaymen { -public: - KmHallOfRecords(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - void xUpdate(); - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2247 : public Klaymen { -public: - KmScene2247(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - void xUpdate(); - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2401 : public Klaymen { -public: - KmScene2401(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2402 : public Klaymen { -public: - KmScene2402(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2403 : public Klaymen { -public: - KmScene2403(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2406 : public Klaymen { -public: - KmScene2406(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2501 : public Klaymen { -public: - KmScene2501(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2732 : public Klaymen { -public: - KmScene2732(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2801 : public Klaymen { -public: - KmScene2801(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2803 : public Klaymen { -public: - KmScene2803(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2803Small : public Klaymen { -public: - KmScene2803Small(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2805 : public Klaymen { -public: - KmScene2805(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2806 : public Klaymen { -public: - KmScene2806(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, - bool needsLargeSurface, NRect *clipRects, uint clipRectsCount); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2809 : public Klaymen { -public: - KmScene2809(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, - bool needsLargeSurface, NRect *clipRects, uint clipRectsCount); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2810Small : public Klaymen { -public: - KmScene2810Small(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2810 : public Klaymen { -public: - KmScene2810(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, - NRect *clipRects, uint clipRectsCount); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene2812 : public Klaymen { -public: - KmScene2812(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - } // End of namespace Neverhood #endif /* NEVERHOOD_KLAYMEN_H */ diff --git a/engines/neverhood/module.mk b/engines/neverhood/module.mk index f3e28c106e..9c1220134c 100644 --- a/engines/neverhood/module.mk +++ b/engines/neverhood/module.mk @@ -15,10 +15,8 @@ MODULE_OBJS = \ microtiles.o \ module.o \ modules/module1000.o \ - modules/module1000_klaymen.o \ modules/module1000_sprites.o \ modules/module1100.o \ - modules/module1100_klaymen.o \ modules/module1100_sprites.o \ modules/module1200.o \ modules/module1200_sprites.o \ @@ -35,6 +33,7 @@ MODULE_OBJS = \ modules/module1900.o \ modules/module1900_sprites.o \ modules/module2000.o \ + modules/module2000_sprites.o \ modules/module2100.o \ modules/module2100_sprites.o \ modules/module2200.o \ diff --git a/engines/neverhood/modules/module1000.cpp b/engines/neverhood/modules/module1000.cpp index afacc99f62..534fb2ec2f 100644 --- a/engines/neverhood/modules/module1000.cpp +++ b/engines/neverhood/modules/module1000.cpp @@ -21,7 +21,6 @@ */ #include "neverhood/modules/module1000.h" -#include "neverhood/modules/module1000_klaymen.h" #include "neverhood/modules/module1000_sprites.h" namespace Neverhood { diff --git a/engines/neverhood/modules/module1000_klaymen.cpp b/engines/neverhood/modules/module1000_klaymen.cpp deleted file mode 100644 index 154959ce2b..0000000000 --- a/engines/neverhood/modules/module1000_klaymen.cpp +++ /dev/null @@ -1,286 +0,0 @@ -/* 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. - * - */ - -#include "neverhood/modules/module1000_klaymen.h" - -namespace Neverhood { - -static const KlaymenIdleTableItem klaymenIdleTable1002[] = { - {1, kIdlePickEar}, - {2, kIdleWonderAbout} -}; - -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(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(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; -} - -} // End of namespace Neverhood diff --git a/engines/neverhood/modules/module1000_klaymen.h b/engines/neverhood/modules/module1000_klaymen.h deleted file mode 100644 index a4cde2040e..0000000000 --- a/engines/neverhood/modules/module1000_klaymen.h +++ /dev/null @@ -1,56 +0,0 @@ -/* 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 NEVERHOOD_MODULES_MODULE1000_KLAYMEN_H -#define NEVERHOOD_MODULES_MODULE1000_KLAYMEN_H - -#include "neverhood/neverhood.h" -#include "neverhood/module.h" -#include "neverhood/scene.h" - -namespace Neverhood { - -class KmScene1001 : public Klaymen { -public: - KmScene1001(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene1002 : public Klaymen { -public: - KmScene1002(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - void xUpdate(); - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -class KmScene1004 : public Klaymen { -public: - KmScene1004(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: - uint32 xHandleMessage(int messageNum, const MessageParam ¶m); -}; - -} // End of namespace Neverhood - -#endif /* NEVERHOOD_MODULES_MODULE1000_KLAYMEN_H */ diff --git a/engines/neverhood/modules/module1000_sprites.cpp b/engines/neverhood/modules/module1000_sprites.cpp index d75d721f01..447fd9df8c 100644 --- a/engines/neverhood/modules/module1000_sprites.cpp +++ b/engines/neverhood/modules/module1000_sprites.cpp @@ -976,4 +976,263 @@ uint32 AsScene1004TrashCan::handleMessage(int messageNum, const MessageParam &pa return 0; } +static const KlaymenIdleTableItem klaymenIdleTable1002[] = { + {1, kIdlePickEar}, + {2, kIdleWonderAbout} +}; + +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(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(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; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module1000_sprites.h b/engines/neverhood/modules/module1000_sprites.h index 51c24863bc..7a7e44333b 100644 --- a/engines/neverhood/modules/module1000_sprites.h +++ b/engines/neverhood/modules/module1000_sprites.h @@ -200,6 +200,28 @@ protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; +class KmScene1001 : public Klaymen { +public: + KmScene1001(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene1002 : public Klaymen { +public: + KmScene1002(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + void xUpdate(); + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene1004 : public Klaymen { +public: + KmScene1004(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULES_MODULE1000_SPRITES_H */ diff --git a/engines/neverhood/modules/module1100.cpp b/engines/neverhood/modules/module1100.cpp index 200a19bd3b..af2df2e742 100644 --- a/engines/neverhood/modules/module1100.cpp +++ b/engines/neverhood/modules/module1100.cpp @@ -23,7 +23,6 @@ #include "neverhood/gamemodule.h" #include "neverhood/navigationscene.h" #include "neverhood/modules/module1100.h" -#include "neverhood/modules/module1100_klaymen.h" #include "neverhood/modules/module1100_sprites.h" namespace Neverhood { diff --git a/engines/neverhood/modules/module1100_sprites.cpp b/engines/neverhood/modules/module1100_sprites.cpp index d421d85f68..51e0bb3f49 100644 --- a/engines/neverhood/modules/module1100_sprites.cpp +++ b/engines/neverhood/modules/module1100_sprites.cpp @@ -197,4 +197,69 @@ uint32 SsScene1105OpenButton::handleMessage(int messageNum, const MessageParam & return messageResult; } +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; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module1100_sprites.h b/engines/neverhood/modules/module1100_sprites.h index d4858cdc0f..c8e5a838da 100644 --- a/engines/neverhood/modules/module1100_sprites.h +++ b/engines/neverhood/modules/module1100_sprites.h @@ -76,6 +76,13 @@ protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; +class KmScene1109 : public Klaymen { +public: + KmScene1109(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULES_MODULE1100_SPRITES_H */ diff --git a/engines/neverhood/modules/module1200_sprites.cpp b/engines/neverhood/modules/module1200_sprites.cpp index d5ba12fc65..9511793408 100644 --- a/engines/neverhood/modules/module1200_sprites.cpp +++ b/engines/neverhood/modules/module1200_sprites.cpp @@ -652,4 +652,78 @@ void AsScene1202TntItem::stChangePositionDone() { stShowIdle(); } +static const KlaymenIdleTableItem klaymenIdleTable1201[] = { + {1, kIdleSpinHead}, + {1, kIdleChest}, + {1, kIdleHeadOff}, +}; + +KmScene1201::KmScene1201(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) + : Klaymen(vm, parentScene, x, y) { + + setKlaymenIdleTable(klaymenIdleTable1201, ARRAYSIZE(klaymenIdleTable1201)); + _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; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module1200_sprites.h b/engines/neverhood/modules/module1200_sprites.h index a5d7b68472..964ad87d35 100644 --- a/engines/neverhood/modules/module1200_sprites.h +++ b/engines/neverhood/modules/module1200_sprites.h @@ -167,6 +167,13 @@ protected: void stChangePositionDone(); }; +class KmScene1201 : public Klaymen { +public: + KmScene1201(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULES_MODULE1200_SPRITES_H */ diff --git a/engines/neverhood/modules/module1300.cpp b/engines/neverhood/modules/module1300.cpp index 9216773c03..312fb85ae7 100644 --- a/engines/neverhood/modules/module1300.cpp +++ b/engines/neverhood/modules/module1300.cpp @@ -23,7 +23,6 @@ #include "neverhood/diskplayerscene.h" #include "neverhood/gamemodule.h" #include "neverhood/menumodule.h" -#include "neverhood/modules/module1000_klaymen.h" #include "neverhood/modules/module1000_sprites.h" #include "neverhood/modules/module1200_sprites.h" #include "neverhood/modules/module1300.h" diff --git a/engines/neverhood/modules/module1300_sprites.cpp b/engines/neverhood/modules/module1300_sprites.cpp index 1ddee349d2..14e6e59b67 100644 --- a/engines/neverhood/modules/module1300_sprites.cpp +++ b/engines/neverhood/modules/module1300_sprites.cpp @@ -627,4 +627,293 @@ uint32 AsScene1308Mouse::handleMessage(int messageNum, const MessageParam ¶m return messageResult; } +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; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module1300_sprites.h b/engines/neverhood/modules/module1300_sprites.h index 31775559e2..eb98c3dd88 100644 --- a/engines/neverhood/modules/module1300_sprites.h +++ b/engines/neverhood/modules/module1300_sprites.h @@ -157,6 +157,41 @@ protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; +class KmScene1303 : public Klaymen { +public: + KmScene1303(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene1304 : public Klaymen { +public: + KmScene1304(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene1305 : public Klaymen { +public: + KmScene1305(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene1306 : public Klaymen { +public: + KmScene1306(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene1308 : public Klaymen { +public: + KmScene1308(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULES_MODULE1300_SPRITES_H */ diff --git a/engines/neverhood/modules/module1400_sprites.cpp b/engines/neverhood/modules/module1400_sprites.cpp index 413b666103..c0ab73c93d 100644 --- a/engines/neverhood/modules/module1400_sprites.cpp +++ b/engines/neverhood/modules/module1400_sprites.cpp @@ -881,4 +881,249 @@ void AsScene1405Tile::hide() { } } +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(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; +} + +static const KlaymenIdleTableItem klaymenIdleTable1403[] = { + {1, kIdleSpinHead}, + {1, kIdleChest}, + {1, kIdleHeadOff}, +}; + +KmScene1403::KmScene1403(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) + : Klaymen(vm, parentScene, x, y) { + + setKlaymenIdleTable(klaymenIdleTable1403, ARRAYSIZE(klaymenIdleTable1403)); +} + +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; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module1400_sprites.h b/engines/neverhood/modules/module1400_sprites.h index 036267e8dc..49b91fe0cf 100644 --- a/engines/neverhood/modules/module1400_sprites.h +++ b/engines/neverhood/modules/module1400_sprites.h @@ -165,6 +165,34 @@ protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; +class KmScene1401 : public Klaymen { +public: + KmScene1401(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene1402 : public Klaymen { +public: + KmScene1402(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene1403 : public Klaymen { +public: + KmScene1403(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene1404 : public Klaymen { +public: + KmScene1404(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULES_MODULE1400_SPRITES_H */ diff --git a/engines/neverhood/modules/module1600_sprites.cpp b/engines/neverhood/modules/module1600_sprites.cpp index 4473a83ec9..06a00c82c0 100644 --- a/engines/neverhood/modules/module1600_sprites.cpp +++ b/engines/neverhood/modules/module1600_sprites.cpp @@ -843,4 +843,92 @@ void Tracks::findTrackPoint(NPoint pt, int &minMatchTrackIndex, int &minMatchDis } } +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; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module1600_sprites.h b/engines/neverhood/modules/module1600_sprites.h index 13fcf6cdbc..fa59475dad 100644 --- a/engines/neverhood/modules/module1600_sprites.h +++ b/engines/neverhood/modules/module1600_sprites.h @@ -114,6 +114,13 @@ public: DataResource &dataResource); }; +class KmScene1608 : public Klaymen { +public: + KmScene1608(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULES_MODULE1600_SPRITES_H */ diff --git a/engines/neverhood/modules/module1700_sprites.cpp b/engines/neverhood/modules/module1700_sprites.cpp index 87c8397cf4..6274e5a8cc 100644 --- a/engines/neverhood/modules/module1700_sprites.cpp +++ b/engines/neverhood/modules/module1700_sprites.cpp @@ -65,4 +65,92 @@ uint32 SsScene1705Tape::handleMessage(int messageNum, const MessageParam ¶m, return messageResult; } +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; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module1700_sprites.h b/engines/neverhood/modules/module1700_sprites.h index 3d0432549b..4117de01d9 100644 --- a/engines/neverhood/modules/module1700_sprites.h +++ b/engines/neverhood/modules/module1700_sprites.h @@ -43,6 +43,13 @@ protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; +class KmScene1705 : public Klaymen { +public: + KmScene1705(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULES_MODULE1700_SPRITES_H */ diff --git a/engines/neverhood/modules/module1900_sprites.cpp b/engines/neverhood/modules/module1900_sprites.cpp index 176731aa3d..09c0b132d5 100644 --- a/engines/neverhood/modules/module1900_sprites.cpp +++ b/engines/neverhood/modules/module1900_sprites.cpp @@ -414,4 +414,43 @@ void AsScene1907WaterHint::hide() { SetMessageHandler(&Sprite::handleMessage); } +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; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module1900_sprites.h b/engines/neverhood/modules/module1900_sprites.h index 7035e50371..7e57b11618 100644 --- a/engines/neverhood/modules/module1900_sprites.h +++ b/engines/neverhood/modules/module1900_sprites.h @@ -95,6 +95,13 @@ protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; +class KmScene1901 : public Klaymen { +public: + KmScene1901(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULES_MODULE1900_SPRITES_H */ diff --git a/engines/neverhood/modules/module2000.cpp b/engines/neverhood/modules/module2000.cpp index e5f0b3fa42..3364f60f8b 100644 --- a/engines/neverhood/modules/module2000.cpp +++ b/engines/neverhood/modules/module2000.cpp @@ -21,6 +21,7 @@ */ #include "neverhood/modules/module2000.h" +#include "neverhood/modules/module2000_sprites.h" namespace Neverhood { diff --git a/engines/neverhood/modules/module1100_klaymen.cpp b/engines/neverhood/modules/module2000_sprites.cpp index 497c9fb6ed..c9c1481aa7 100644 --- a/engines/neverhood/modules/module1100_klaymen.cpp +++ b/engines/neverhood/modules/module2000_sprites.cpp @@ -20,17 +20,17 @@ * */ -#include "neverhood/modules/module1100_klaymen.h" +#include "neverhood/modules/module2000_sprites.h" namespace Neverhood { -KmScene1109::KmScene1109(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) +KmScene2001::KmScene2001(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { // Empty } -uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam ¶m) { +uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam ¶m) { uint32 messageResult = 0; switch (messageNum) { case 0x2000: @@ -80,10 +80,10 @@ uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klaymen::stGetUpFromTeleporter); break; case 0x483D: - teleporterAppear(0x2C2A4A1C); + teleporterAppear(0xBE68CC54); break; case 0x483E: - teleporterDisappear(0x3C2E4245); + teleporterDisappear(0x18AB4ED4); break; } return messageResult; diff --git a/engines/neverhood/modules/module1100_klaymen.h b/engines/neverhood/modules/module2000_sprites.h index aea3041d3f..ca84aa73ca 100644 --- a/engines/neverhood/modules/module1100_klaymen.h +++ b/engines/neverhood/modules/module2000_sprites.h @@ -20,8 +20,8 @@ * */ -#ifndef NEVERHOOD_MODULES_MODULE1000_KLAYMEN_H -#define NEVERHOOD_MODULES_MODULE1000_KLAYMEN_H +#ifndef NEVERHOOD_MODULES_MODULE2000_SPRITES_H +#define NEVERHOOD_MODULES_MODULE2000_SPRITES_H #include "neverhood/neverhood.h" #include "neverhood/module.h" @@ -29,13 +29,13 @@ namespace Neverhood { -class KmScene1109 : public Klaymen { +class KmScene2001 : public Klaymen { public: - KmScene1109(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); + KmScene2001(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; } // End of namespace Neverhood -#endif /* NEVERHOOD_MODULES_MODULE1000_KLAYMEN_H */ +#endif /* NEVERHOOD_MODULES_MODULE2000_SPRITES_H */ diff --git a/engines/neverhood/modules/module2100_sprites.cpp b/engines/neverhood/modules/module2100_sprites.cpp index 0dd904c24d..48d1ee1d6c 100644 --- a/engines/neverhood/modules/module2100_sprites.cpp +++ b/engines/neverhood/modules/module2100_sprites.cpp @@ -141,4 +141,87 @@ uint32 SsCommonFloorButton::handleMessage(int messageNum, const MessageParam &pa 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; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module2100_sprites.h b/engines/neverhood/modules/module2100_sprites.h index a10d06ffdb..2a3aac7522 100644 --- a/engines/neverhood/modules/module2100_sprites.h +++ b/engines/neverhood/modules/module2100_sprites.h @@ -59,6 +59,13 @@ protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; +class KmScene2101 : public Klaymen { +public: + KmScene2101(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULES_MODULE2100_SPRITES_H */ diff --git a/engines/neverhood/modules/module2200_sprites.cpp b/engines/neverhood/modules/module2200_sprites.cpp index 5a641068a3..8cdaf6c49c 100644 --- a/engines/neverhood/modules/module2200_sprites.cpp +++ b/engines/neverhood/modules/module2200_sprites.cpp @@ -863,4 +863,523 @@ SsScene2207Symbol::SsScene2207Symbol(NeverhoodEngine *vm, uint32 fileHash, int i updatePosition(); } +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; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module2200_sprites.h b/engines/neverhood/modules/module2200_sprites.h index 696f3a6e1e..f1529cbe9b 100644 --- a/engines/neverhood/modules/module2200_sprites.h +++ b/engines/neverhood/modules/module2200_sprites.h @@ -202,6 +202,68 @@ public: SsScene2207Symbol(NeverhoodEngine *vm, uint32 fileHash, int index); }; +class KmScene2201 : public Klaymen { +public: + KmScene2201(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2203 : public Klaymen { +public: + KmScene2203(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2205 : public Klaymen { +public: + KmScene2205(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + void xUpdate(); + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2206 : public Klaymen { +public: + KmScene2206(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); + ~KmScene2206(); +protected: + void xUpdate(); + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2207 : public Klaymen { +public: + KmScene2207(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2242 : public Klaymen { +public: + KmScene2242(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + void xUpdate(); + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmHallOfRecords : public Klaymen { +public: + KmHallOfRecords(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + void xUpdate(); + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2247 : public Klaymen { +public: + KmScene2247(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + void xUpdate(); + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULES_MODULE2200_SPRITES_H */ diff --git a/engines/neverhood/modules/module2400_sprites.cpp b/engines/neverhood/modules/module2400_sprites.cpp index 4767670d75..b6e91cac6e 100644 --- a/engines/neverhood/modules/module2400_sprites.cpp +++ b/engines/neverhood/modules/module2400_sprites.cpp @@ -353,4 +353,326 @@ uint32 AsScene2402TV::hmJoke(int messageNum, const MessageParam ¶m, Entity * return messageResult; } +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; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module2400_sprites.h b/engines/neverhood/modules/module2400_sprites.h index 1c4ab24ae9..0536195c08 100644 --- a/engines/neverhood/modules/module2400_sprites.h +++ b/engines/neverhood/modules/module2400_sprites.h @@ -94,6 +94,34 @@ protected: uint32 hmJoke(int messageNum, const MessageParam ¶m, Entity *sender); }; +class KmScene2401 : public Klaymen { +public: + KmScene2401(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2402 : public Klaymen { +public: + KmScene2402(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2403 : public Klaymen { +public: + KmScene2403(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2406 : public Klaymen { +public: + KmScene2406(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULES_MODULE2400_SPRITES_H */ diff --git a/engines/neverhood/modules/module2500_sprites.cpp b/engines/neverhood/modules/module2500_sprites.cpp index 490c07ab2f..ab6b3dcfbe 100644 --- a/engines/neverhood/modules/module2500_sprites.cpp +++ b/engines/neverhood/modules/module2500_sprites.cpp @@ -72,4 +72,56 @@ uint32 SsScene2504Button::handleMessage(int messageNum, const MessageParam ¶ 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; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module2500_sprites.h b/engines/neverhood/modules/module2500_sprites.h index 4b964e7fb2..e7f7b05702 100644 --- a/engines/neverhood/modules/module2500_sprites.h +++ b/engines/neverhood/modules/module2500_sprites.h @@ -39,6 +39,13 @@ protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; +class KmScene2501 : public Klaymen { +public: + KmScene2501(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULES_MODULE2500_SPRITES_H */ diff --git a/engines/neverhood/modules/module2700_sprites.cpp b/engines/neverhood/modules/module2700_sprites.cpp index fe0dd60aee..8dd2fa3461 100644 --- a/engines/neverhood/modules/module2700_sprites.cpp +++ b/engines/neverhood/modules/module2700_sprites.cpp @@ -157,4 +157,22 @@ void AsCommonCarTrackShadow::update() { AnimatedSprite::update(); } +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; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module2700_sprites.h b/engines/neverhood/modules/module2700_sprites.h index 662a357d58..394ba896a1 100644 --- a/engines/neverhood/modules/module2700_sprites.h +++ b/engines/neverhood/modules/module2700_sprites.h @@ -62,6 +62,13 @@ protected: void update(); }; +class KmScene2732 : public Klaymen { +public: + KmScene2732(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULES_MODULE2700_SPRITES_H */ diff --git a/engines/neverhood/modules/module2800_sprites.cpp b/engines/neverhood/modules/module2800_sprites.cpp index c7f4268042..c167f414a6 100644 --- a/engines/neverhood/modules/module2800_sprites.cpp +++ b/engines/neverhood/modules/module2800_sprites.cpp @@ -1011,4 +1011,593 @@ uint32 AsScene2812TrapDoor::handleMessage(int messageNum, const MessageParam &pa return messageResult; } +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 diff --git a/engines/neverhood/modules/module2800_sprites.h b/engines/neverhood/modules/module2800_sprites.h index 39ca88ef73..2b6c83a1cb 100644 --- a/engines/neverhood/modules/module2800_sprites.h +++ b/engines/neverhood/modules/module2800_sprites.h @@ -263,6 +263,72 @@ protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; +class KmScene2801 : public Klaymen { +public: + KmScene2801(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2803 : public Klaymen { +public: + KmScene2803(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2803Small : public Klaymen { +public: + KmScene2803Small(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2805 : public Klaymen { +public: + KmScene2805(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2806 : public Klaymen { +public: + KmScene2806(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, + bool needsLargeSurface, NRect *clipRects, uint clipRectsCount); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2809 : public Klaymen { +public: + KmScene2809(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, + bool needsLargeSurface, NRect *clipRects, uint clipRectsCount); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2810Small : public Klaymen { +public: + KmScene2810Small(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2810 : public Klaymen { +public: + KmScene2810(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, + NRect *clipRects, uint clipRectsCount); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + +class KmScene2812 : public Klaymen { +public: + KmScene2812(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); +protected: + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULES_MODULE2800_SPRITES_H */ |