diff options
author | Filippos Karapetis | 2013-10-06 18:55:10 +0300 |
---|---|---|
committer | Filippos Karapetis | 2013-10-06 18:57:44 +0300 |
commit | 0fffbac36bee764b3479b5d3fb631faf5bcd5f76 (patch) | |
tree | c65bdc2c46039aaca067abf6ae3b5808803125db | |
parent | 8c8b1b7da749d69078b1be88a00d5ba29e64413a (diff) | |
download | scummvm-rg350-0fffbac36bee764b3479b5d3fb631faf5bcd5f76.tar.gz scummvm-rg350-0fffbac36bee764b3479b5d3fb631faf5bcd5f76.tar.bz2 scummvm-rg350-0fffbac36bee764b3479b5d3fb631faf5bcd5f76.zip |
NEVERHOOD: Move more scene-specific Klaymen animations to their scenes
-rw-r--r-- | engines/neverhood/klaymen.cpp | 167 | ||||
-rw-r--r-- | engines/neverhood/klaymen.h | 29 | ||||
-rw-r--r-- | engines/neverhood/modules/module1200_sprites.cpp | 87 | ||||
-rw-r--r-- | engines/neverhood/modules/module1200_sprites.h | 8 | ||||
-rw-r--r-- | engines/neverhood/modules/module2200_sprites.cpp | 25 | ||||
-rw-r--r-- | engines/neverhood/modules/module2200_sprites.h | 3 | ||||
-rw-r--r-- | engines/neverhood/modules/module2400_sprites.cpp | 67 | ||||
-rw-r--r-- | engines/neverhood/modules/module2400_sprites.h | 12 |
8 files changed, 197 insertions, 201 deletions
diff --git a/engines/neverhood/klaymen.cpp b/engines/neverhood/klaymen.cpp index 8d9cfbcea6..666b20a08a 100644 --- a/engines/neverhood/klaymen.cpp +++ b/engines/neverhood/klaymen.cpp @@ -54,7 +54,7 @@ Klaymen::Klaymen(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRec _isWalkingOpenDoorNotified(false), _spitOutCountdown(0), _tapesToInsert(0), _keysToInsert(0), _busyStatus(0), _acceptInput(true), _attachedSprite(NULL), _isWalking(false), _actionStatus(1), _parentScene(parentScene), _isSneaking(false), _isLargeStep(false), _doYHitIncr(false), _isLeverDown(false), _isSittingInTeleporter(false), _actionStatusChanged(false), _ladderStatus(0), _pathPoints(NULL), _soundFlag(false), - _idleTableNum(0), _otherSprite(NULL), _moveObjectCountdown(0), _readyToSpit(false), _walkResumeFrameIncr(0) { + _idleTableNum(0), _otherSprite(NULL), _moveObjectCountdown(0), _walkResumeFrameIncr(0) { createSurface(1000, 320, 200); _x = x; @@ -1735,29 +1735,6 @@ uint32 Klaymen::hmTurnToBackToUse(int messageNum, const MessageParam ¶m, Ent return messageResult; } -void Klaymen::stClayDoorOpen() { - if (!stStartAction(AnimationCallback(&Klaymen::stClayDoorOpen))) { - _busyStatus = 2; - _acceptInput = false; - startAnimation(0x5CCCB330, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmClayDoorOpen); - SetSpriteUpdate(&Klaymen::suUpdateDestX); - } -} - -uint32 Klaymen::hmClayDoorOpen(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x040D4186) { - sendMessage(_attachedSprite, 0x4808, 0); - } - break; - } - return messageResult; -} - void Klaymen::stTurnToUse() { if (!stStartAction(AnimationCallback(&Klaymen::stTurnToUse))) { _busyStatus = 2; @@ -2619,49 +2596,6 @@ void Klaymen::upMoveObject() { Klaymen::update(); } -uint32 Klaymen::hmMatch(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = Klaymen::hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x51281850) { - setGlobalVar(V_TNT_DUMMY_FUSE_LIT, 1); - } else if (param.asInteger() == 0x43000538) { - playSound(0, 0x21043059); - } else if (param.asInteger() == 0x02B20220) { - playSound(0, 0xC5408620); - } else if (param.asInteger() == 0x0A720138) { - playSound(0, 0xD4C08010); - } else if (param.asInteger() == 0xB613A180) { - playSound(0, 0x44051000); - } - break; - } - return messageResult; -} - -void Klaymen::stFetchMatch() { - if (!stStartAction(AnimationCallback(&Klaymen::stFetchMatch))) { - _busyStatus = 0; - _acceptInput = false; - setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0); - startAnimation(0x9CAA0218, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmMatch); - SetSpriteUpdate(NULL); - NextState(&Klaymen::stLightMatch); - } -} - -void Klaymen::stLightMatch() { - _busyStatus = 1; - _acceptInput = false; - setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0); - startAnimation(0x1222A513, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmMatch); - SetSpriteUpdate(NULL); -} - uint32 Klaymen::hmMoveObject(int messageNum, const MessageParam ¶m, Entity *sender) { switch (messageNum) { case 0x100D: @@ -2681,18 +2615,6 @@ uint32 Klaymen::hmMoveObject(int messageNum, const MessageParam ¶m, Entity * return Klaymen::hmLowLevelAnimation(messageNum, param, sender); } -uint32 Klaymen::hmTumbleHeadless(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = Klaymen::hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x000F0082) { - playSound(0, 0x74E2810F); - } - break; - } - return messageResult; -} - void Klaymen::stMoveObject() { if (!stStartAction(AnimationCallback(&Klaymen::stMoveObject))) { _busyStatus = 2; @@ -2714,93 +2636,6 @@ void Klaymen::stContinueMoveObject() { SetMessageHandler(&Klaymen::hmMoveObject); } -void Klaymen::stTumbleHeadless() { - if (!stStartActionFromIdle(AnimationCallback(&Klaymen::stTumbleHeadless))) { - _busyStatus = 1; - _acceptInput = false; - setDoDeltaX(0); - startAnimation(0x2821C590, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmTumbleHeadless); - SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); - NextState(&Klaymen::stTryStandIdle); - sendMessage(_parentScene, 0x8000, 0); - playSound(0, 0x62E0A356); - } -} - -void Klaymen::stCloseEyes() { - if (!stStartActionFromIdle(AnimationCallback(&Klaymen::stCloseEyes))) { - _busyStatus = 1; - _acceptInput = false; - startAnimation(0x5420E254, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmLowLevel); - SetSpriteUpdate(NULL); - } -} - -uint32 Klaymen::hmSpit(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = Klaymen::hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x16401CA6) { - _canSpitPipe = true; - if (_contSpitPipe) - spitIntoPipe(); - } else if (param.asInteger() == 0xC11C0008) { - _canSpitPipe = false; - _acceptInput = false; - _readyToSpit = false; - } else if (param.asInteger() == 0x018A0001) { - sendMessage(_parentScene, 0x2001, _spitDestPipeIndex); - } - break; - } - return messageResult; -} - -void Klaymen::stTrySpitIntoPipe() { - if (_readyToSpit) { - _contSpitPipe = true; - _spitContDestPipeIndex = _spitPipeIndex; - if (_canSpitPipe) - spitIntoPipe(); - } else if (!stStartAction(AnimationCallback(&Klaymen::stTrySpitIntoPipe))) { - _busyStatus = 2; - _acceptInput = true; - _spitDestPipeIndex = _spitPipeIndex; - _readyToSpit = true; - _canSpitPipe = false; - _contSpitPipe = false; - startAnimation(0x1808B150, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmSpit); - SetSpriteUpdate(NULL); - } -} - -void Klaymen::spitIntoPipe() { - _contSpitPipe = false; - _spitDestPipeIndex = _spitContDestPipeIndex; - _canSpitPipe = false; - _acceptInput = false; - startAnimation(0x1B08B553, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmSpit); - SetSpriteUpdate(NULL); - NextState(&Klaymen::stContSpitIntoPipe); -} - -void Klaymen::stContSpitIntoPipe() { - _canSpitPipe = true; - _acceptInput = true; - startAnimationByHash(0x1808B150, 0x16401CA6, 0); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmSpit); - SetSpriteUpdate(NULL); -} - void Klaymen::suRidePlatform() { _x = _attachedSprite->getX() - 20; _y = _attachedSprite->getY() + 46; diff --git a/engines/neverhood/klaymen.h b/engines/neverhood/klaymen.h index d3dc3c590f..524bb9a9f2 100644 --- a/engines/neverhood/klaymen.h +++ b/engines/neverhood/klaymen.h @@ -229,24 +229,17 @@ public: void stSitIdleTeleporter(); void upSitIdleTeleporter(); - void stSitIdleTeleporterBlink(); - void stSitIdleTeleporterBlinkSecond(); void stTurnToUseInTeleporter(); - void stReturnFromUseInTeleporter(); - void stGetUpFromTeleporter(); void teleporterAppear(uint32 fileHash); void teleporterDisappear(uint32 fileHash); uint32 hmTeleporterAppearDisappear(int messageNum, const MessageParam ¶m, Entity *sender); - void stClayDoorOpen(); - uint32 hmClayDoorOpen(int messageNum, const MessageParam ¶m, Entity *sender); - void stFallSkipJump(); void suFallSkipJump(); @@ -255,15 +248,6 @@ public: uint32 hmMoveObject(int messageNum, const MessageParam ¶m, Entity *sender); void upMoveObject(); - void stCloseEyes(); - - void stTumbleHeadless(); - uint32 hmTumbleHeadless(int messageNum, const MessageParam ¶m, Entity *sender); - - void stFetchMatch(); - void stLightMatch(); - uint32 hmMatch(int messageNum, const MessageParam ¶m, Entity *sender); - void stHitByBoxingGlove(); uint32 hmHitByBoxingGlove(int messageNum, const MessageParam ¶m, Entity *sender); void evHitByBoxingGloveDone(); @@ -321,11 +305,6 @@ public: void setSoundFlag(bool value) { _soundFlag = value; } - void spitIntoPipe(); - void stTrySpitIntoPipe(); - void stContSpitIntoPipe(); - uint32 hmSpit(int messageNum, const MessageParam ¶m, Entity *sender); - void stRidePlatform(); void suRidePlatform(); void stPullLever(); @@ -375,13 +354,6 @@ protected: int _moveObjectCountdown; - bool _canSpitPipe; - bool _contSpitPipe; - bool _readyToSpit; - uint32 _spitPipeIndex; - uint32 _spitDestPipeIndex; - uint32 _spitContDestPipeIndex; - virtual void xUpdate(); virtual uint32 xHandleMessage(int messageNum, const MessageParam ¶m); @@ -402,7 +374,6 @@ protected: void enterIdleAnimation(uint idleAnimation); void walkAlongPathPoints(); - }; } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module1200_sprites.cpp b/engines/neverhood/modules/module1200_sprites.cpp index 9511793408..da38924d9a 100644 --- a/engines/neverhood/modules/module1200_sprites.cpp +++ b/engines/neverhood/modules/module1200_sprites.cpp @@ -681,13 +681,13 @@ uint32 KmScene1201::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klaymen::stPickUpGeneric); break; case 0x4813: - GotoState(&Klaymen::stFetchMatch); + GotoState(&KmScene1201::stFetchMatch); break; case 0x4814: - GotoState(&Klaymen::stTumbleHeadless); + GotoState(&KmScene1201::stTumbleHeadless); break; case 0x4815: - GotoState(&Klaymen::stCloseEyes); + GotoState(&KmScene1201::stCloseEyes); break; case 0x4816: if (param.asInteger() == 0) @@ -726,4 +726,85 @@ uint32 KmScene1201::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } +void KmScene1201::stTumbleHeadless() { + if (!stStartActionFromIdle(AnimationCallback(&KmScene1201::stTumbleHeadless))) { + _busyStatus = 1; + _acceptInput = false; + setDoDeltaX(0); + startAnimation(0x2821C590, 0, -1); + SetUpdateHandler(&Klaymen::update); + SetMessageHandler(&KmScene1201::hmTumbleHeadless); + SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); + NextState(&Klaymen::stTryStandIdle); + sendMessage(_parentScene, 0x8000, 0); + playSound(0, 0x62E0A356); + } +} + +void KmScene1201::stCloseEyes() { + if (!stStartActionFromIdle(AnimationCallback(&KmScene1201::stCloseEyes))) { + _busyStatus = 1; + _acceptInput = false; + startAnimation(0x5420E254, 0, -1); + SetUpdateHandler(&Klaymen::update); + SetMessageHandler(&Klaymen::hmLowLevel); + SetSpriteUpdate(NULL); + } +} + +uint32 KmScene1201::hmMatch(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Klaymen::hmLowLevelAnimation(messageNum, param, sender); + switch (messageNum) { + case 0x100D: + if (param.asInteger() == 0x51281850) { + setGlobalVar(V_TNT_DUMMY_FUSE_LIT, 1); + } else if (param.asInteger() == 0x43000538) { + playSound(0, 0x21043059); + } else if (param.asInteger() == 0x02B20220) { + playSound(0, 0xC5408620); + } else if (param.asInteger() == 0x0A720138) { + playSound(0, 0xD4C08010); + } else if (param.asInteger() == 0xB613A180) { + playSound(0, 0x44051000); + } + break; + } + return messageResult; +} + +void KmScene1201::stFetchMatch() { + if (!stStartAction(AnimationCallback(&KmScene1201::stFetchMatch))) { + _busyStatus = 0; + _acceptInput = false; + setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0); + startAnimation(0x9CAA0218, 0, -1); + SetUpdateHandler(&Klaymen::update); + SetMessageHandler(&KmScene1201::hmMatch); + SetSpriteUpdate(NULL); + NextState(&KmScene1201::stLightMatch); + } +} + +void KmScene1201::stLightMatch() { + _busyStatus = 1; + _acceptInput = false; + setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0); + startAnimation(0x1222A513, 0, -1); + SetUpdateHandler(&Klaymen::update); + SetMessageHandler(&KmScene1201::hmMatch); + SetSpriteUpdate(NULL); +} + +uint32 KmScene1201::hmTumbleHeadless(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Klaymen::hmLowLevelAnimation(messageNum, param, sender); + switch (messageNum) { + case 0x100D: + if (param.asInteger() == 0x000F0082) { + playSound(0, 0x74E2810F); + } + break; + } + return messageResult; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module1200_sprites.h b/engines/neverhood/modules/module1200_sprites.h index 964ad87d35..ef1ec40ced 100644 --- a/engines/neverhood/modules/module1200_sprites.h +++ b/engines/neverhood/modules/module1200_sprites.h @@ -171,6 +171,14 @@ class KmScene1201 : public Klaymen { public: KmScene1201(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: + void stCloseEyes(); + void stTumbleHeadless(); + void stFetchMatch(); + void stLightMatch(); + + uint32 hmTumbleHeadless(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmMatch(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; diff --git a/engines/neverhood/modules/module2200_sprites.cpp b/engines/neverhood/modules/module2200_sprites.cpp index 82fd5e32cc..30f0404cf1 100644 --- a/engines/neverhood/modules/module2200_sprites.cpp +++ b/engines/neverhood/modules/module2200_sprites.cpp @@ -970,7 +970,7 @@ uint32 KmScene2203::xHandleMessage(int messageNum, const MessageParam ¶m) { startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); break; case 0x4819: - GotoState(&Klaymen::stClayDoorOpen); + GotoState(&KmScene2203::stClayDoorOpen); break; case 0x481A: GotoState(&Klaymen::stInsertDisk); @@ -1001,6 +1001,29 @@ uint32 KmScene2203::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } +void KmScene2203::stClayDoorOpen() { + if (!stStartAction(AnimationCallback(&KmScene2203::stClayDoorOpen))) { + _busyStatus = 2; + _acceptInput = false; + startAnimation(0x5CCCB330, 0, -1); + SetUpdateHandler(&Klaymen::update); + SetMessageHandler(&KmScene2203::hmClayDoorOpen); + SetSpriteUpdate(&Klaymen::suUpdateDestX); + } +} + +uint32 KmScene2203::hmClayDoorOpen(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); + switch (messageNum) { + case 0x100D: + if (param.asInteger() == 0x040D4186) { + sendMessage(_attachedSprite, 0x4808, 0); + } + break; + } + return messageResult; +} + KmScene2205::KmScene2205(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { diff --git a/engines/neverhood/modules/module2200_sprites.h b/engines/neverhood/modules/module2200_sprites.h index 276df33204..9aaf3b6aae 100644 --- a/engines/neverhood/modules/module2200_sprites.h +++ b/engines/neverhood/modules/module2200_sprites.h @@ -213,6 +213,9 @@ class KmScene2203 : public Klaymen { public: KmScene2203(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: + void stClayDoorOpen(); + uint32 hmClayDoorOpen(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; diff --git a/engines/neverhood/modules/module2400_sprites.cpp b/engines/neverhood/modules/module2400_sprites.cpp index b6e91cac6e..bf85b0dc37 100644 --- a/engines/neverhood/modules/module2400_sprites.cpp +++ b/engines/neverhood/modules/module2400_sprites.cpp @@ -354,7 +354,9 @@ uint32 AsScene2402TV::hmJoke(int messageNum, const MessageParam ¶m, Entity * } KmScene2401::KmScene2401(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) - : Klaymen(vm, parentScene, x, y) { + : Klaymen(vm, parentScene, x, y), + _canSpitPipe(false), _contSpitPipe(false), _readyToSpit(false), + _spitPipeIndex(0), _spitDestPipeIndex(0), _spitContDestPipeIndex(0) { // Empty } @@ -419,7 +421,7 @@ uint32 KmScene2401::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klaymen::stWonderAbout); else { _spitPipeIndex = sendMessage(_parentScene, 0x2000, 0); - GotoState(&Klaymen::stTrySpitIntoPipe); + GotoState(&KmScene2401::stTrySpitIntoPipe); } break; case 0x483F: @@ -432,6 +434,67 @@ uint32 KmScene2401::xHandleMessage(int messageNum, const MessageParam ¶m) { return messageResult; } +uint32 KmScene2401::hmSpit(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Klaymen::hmLowLevelAnimation(messageNum, param, sender); + switch (messageNum) { + case 0x100D: + if (param.asInteger() == 0x16401CA6) { + _canSpitPipe = true; + if (_contSpitPipe) + spitIntoPipe(); + } else if (param.asInteger() == 0xC11C0008) { + _canSpitPipe = false; + _acceptInput = false; + _readyToSpit = false; + } else if (param.asInteger() == 0x018A0001) { + sendMessage(_parentScene, 0x2001, _spitDestPipeIndex); + } + break; + } + return messageResult; +} + +void KmScene2401::stTrySpitIntoPipe() { + if (_readyToSpit) { + _contSpitPipe = true; + _spitContDestPipeIndex = _spitPipeIndex; + if (_canSpitPipe) + spitIntoPipe(); + } else if (!stStartAction(AnimationCallback(&KmScene2401::stTrySpitIntoPipe))) { + _busyStatus = 2; + _acceptInput = true; + _spitDestPipeIndex = _spitPipeIndex; + _readyToSpit = true; + _canSpitPipe = false; + _contSpitPipe = false; + startAnimation(0x1808B150, 0, -1); + SetUpdateHandler(&Klaymen::update); + SetMessageHandler(&KmScene2401::hmSpit); + SetSpriteUpdate(NULL); + } +} + +void KmScene2401::spitIntoPipe() { + _contSpitPipe = false; + _spitDestPipeIndex = _spitContDestPipeIndex; + _canSpitPipe = false; + _acceptInput = false; + startAnimation(0x1B08B553, 0, -1); + SetUpdateHandler(&Klaymen::update); + SetMessageHandler(&KmScene2401::hmSpit); + SetSpriteUpdate(NULL); + NextState(&KmScene2401::stContSpitIntoPipe); +} + +void KmScene2401::stContSpitIntoPipe() { + _canSpitPipe = true; + _acceptInput = true; + startAnimationByHash(0x1808B150, 0x16401CA6, 0); + SetUpdateHandler(&Klaymen::update); + SetMessageHandler(&KmScene2401::hmSpit); + SetSpriteUpdate(NULL); +} + KmScene2402::KmScene2402(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { diff --git a/engines/neverhood/modules/module2400_sprites.h b/engines/neverhood/modules/module2400_sprites.h index 0536195c08..a901eb101c 100644 --- a/engines/neverhood/modules/module2400_sprites.h +++ b/engines/neverhood/modules/module2400_sprites.h @@ -98,6 +98,18 @@ class KmScene2401 : public Klaymen { public: KmScene2401(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: + bool _canSpitPipe; + bool _contSpitPipe; + bool _readyToSpit; + uint32 _spitPipeIndex; + uint32 _spitDestPipeIndex; + uint32 _spitContDestPipeIndex; + + void spitIntoPipe(); + void stTrySpitIntoPipe(); + void stContSpitIntoPipe(); + uint32 hmSpit(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; |