diff options
author | Filippos Karapetis | 2013-11-02 16:38:58 +0200 |
---|---|---|
committer | Filippos Karapetis | 2013-11-02 16:38:58 +0200 |
commit | 5510a285edbe276e6c52d30d3a98154d4407f004 (patch) | |
tree | e5f4171d9d2ede5c659f289c7a508d6c6ab58fa3 /engines | |
parent | 1a59030b71cf1eefc1bac257e0ac67d7cb3a50dc (diff) | |
download | scummvm-rg350-5510a285edbe276e6c52d30d3a98154d4407f004.tar.gz scummvm-rg350-5510a285edbe276e6c52d30d3a98154d4407f004.tar.bz2 scummvm-rg350-5510a285edbe276e6c52d30d3a98154d4407f004.zip |
NEVERHOOD: Move some Klaymen animations specific to scene 1002
Also, reorganize some of the functions in modules/module1000_sprites.cpp
Diffstat (limited to 'engines')
-rw-r--r-- | engines/neverhood/klaymen.cpp | 65 | ||||
-rw-r--r-- | engines/neverhood/klaymen.h | 7 | ||||
-rw-r--r-- | engines/neverhood/modules/module1000_sprites.cpp | 229 | ||||
-rw-r--r-- | engines/neverhood/modules/module1000_sprites.h | 5 |
4 files changed, 152 insertions, 154 deletions
diff --git a/engines/neverhood/klaymen.cpp b/engines/neverhood/klaymen.cpp index 666b20a08a..a942bcae8c 100644 --- a/engines/neverhood/klaymen.cpp +++ b/engines/neverhood/klaymen.cpp @@ -2438,47 +2438,6 @@ uint32 Klaymen::hmStandIdleSpecial(int messageNum, const MessageParam ¶m, En return 0; } -uint32 Klaymen::hmPressDoorButton(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x942D2081) { - _acceptInput = false; - sendMessage(_attachedSprite, 0x2003, 0); - } else if (param.asInteger() == 0xDA600012) { - stHitByBoxingGlove(); - } else if (param.asInteger() == 0x0D01B294) { - _acceptInput = false; - sendMessage(_attachedSprite, 0x480B, 0); - } - break; - } - return messageResult; -} - -uint32 Klaymen::hmHitByBoxingGlove(int messageNum, const MessageParam ¶m, Entity *sender) { - int16 speedUpFrameIndex; - uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); - switch (messageNum) { - case 0x1008: - speedUpFrameIndex = getFrameIndex(kKlaymenSpeedUpHash); - if (_currFrameIndex < speedUpFrameIndex) { - startAnimation(0x35AA8059, speedUpFrameIndex, -1); - _y = 435; - } - messageResult = 0; - break; - case 0x100D: - if (param.asInteger() == 0x1A1A0785) { - playSound(0, 0x40F0A342); - } else if (param.asInteger() == 0x60428026) { - playSound(0, 0x40608A59); - } - break; - } - return messageResult; -} - void Klaymen::suFallDown() { AnimatedSprite::updateDeltaXY(); HitRect *hitRect = _parentScene->findHitRectAtPos(_x, _y + 10); @@ -2546,30 +2505,6 @@ void Klaymen::stFallTouchdown() { stTryStandIdle(); } -void Klaymen::stPressDoorButton() { - _busyStatus = 2; - _acceptInput = true; - setDoDeltaX(0); - startAnimation(0x1CD89029, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmPressDoorButton); - SetSpriteUpdate(&Klaymen::suAction); -} - -void Klaymen::stHitByBoxingGlove() { - _busyStatus = 1; - _acceptInput = false; - startAnimation(0x35AA8059, 0, -1); - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&Klaymen::hmHitByBoxingGlove); - SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); - FinalizeState(&Klaymen::evHitByBoxingGloveDone); -} - -void Klaymen::evHitByBoxingGloveDone() { - sendMessage(_parentScene, 0x1024, 1); -} - void Klaymen::suFallSkipJump() { updateDeltaXY(); HitRect *hitRect = _parentScene->findHitRectAtPos(_x, _y + 10); diff --git a/engines/neverhood/klaymen.h b/engines/neverhood/klaymen.h index 524bb9a9f2..a614560fc0 100644 --- a/engines/neverhood/klaymen.h +++ b/engines/neverhood/klaymen.h @@ -248,10 +248,6 @@ public: uint32 hmMoveObject(int messageNum, const MessageParam ¶m, Entity *sender); void upMoveObject(); - void stHitByBoxingGlove(); - uint32 hmHitByBoxingGlove(int messageNum, const MessageParam ¶m, Entity *sender); - void evHitByBoxingGloveDone(); - void stStandIdleSmall(); void stWonderAboutSmall(); void stWonderAboutHalfSmall(); @@ -271,9 +267,6 @@ public: void stStandIdleSpecial(); uint32 hmStandIdleSpecial(int messageNum, const MessageParam ¶m, Entity *sender); - void stPressDoorButton(); - uint32 hmPressDoorButton(int messageNum, const MessageParam ¶m, Entity *sender); - void stSpitOutFall0(); void stSpitOutFall2(); void suFallDown(); diff --git a/engines/neverhood/modules/module1000_sprites.cpp b/engines/neverhood/modules/module1000_sprites.cpp index 55618f0124..573474de02 100644 --- a/engines/neverhood/modules/module1000_sprites.cpp +++ b/engines/neverhood/modules/module1000_sprites.cpp @@ -1112,23 +1112,6 @@ KmScene1002::KmScene1002(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 setKlaymenIdleTable1(); } -void KmScene1002::setupJumpToRing() { - _acceptInput = false; - SetUpdateHandler(&Klaymen::update); - SetMessageHandler(&KmScene1002::hmJumpToRing); - SetSpriteUpdate(&Klaymen::suUpdateDestX); - NextState(&KmScene1002::stHangOnRing); - sendMessage(_attachedSprite, 0x482B, 0); -} - -void KmScene1002::stJumpToRing1() { - if (!stStartAction(AnimationCallback(&KmScene1002::stJumpToRing1))) { - _busyStatus = 0; - startAnimation(0xD82890BA, 0, -1); - setupJumpToRing(); - } -} - void KmScene1002::xUpdate() { if (_x >= 250 && _x <= 435 && _y >= 420) { if (_idleTableNum == 0) { @@ -1189,7 +1172,7 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4816: if (param.asInteger() == 0) - GotoState(&Klaymen::stPressDoorButton); + GotoState(&KmScene1002::stPressDoorButton); break; case 0x4817: setDoDeltaX(param.asInteger()); @@ -1238,70 +1221,13 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) { 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(&KmScene1004::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; +void KmScene1002::setupJumpToRing() { + _acceptInput = false; + SetUpdateHandler(&Klaymen::update); + SetMessageHandler(&KmScene1002::hmJumpToRing); + SetSpriteUpdate(&Klaymen::suUpdateDestX); + NextState(&KmScene1002::stHangOnRing); + sendMessage(_attachedSprite, 0x482B, 0); } uint32 KmScene1002::hmJumpToRing(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -1332,6 +1258,14 @@ void KmScene1002::stHangOnRing() { SetSpriteUpdate(NULL); } +void KmScene1002::stJumpToRing1() { + if (!stStartAction(AnimationCallback(&KmScene1002::stJumpToRing1))) { + _busyStatus = 0; + startAnimation(0xD82890BA, 0, -1); + setupJumpToRing(); + } +} + void KmScene1002::stJumpToRing2() { if (!stStartAction(AnimationCallback(&KmScene1002::stJumpToRing2))) { _busyStatus = 0; @@ -1542,6 +1476,137 @@ uint32 KmScene1002::hmFirstMoveVenusFlyTrap(int messageNum, const MessageParam & return messageResult; } +void KmScene1002::stPressDoorButton() { + _busyStatus = 2; + _acceptInput = true; + setDoDeltaX(0); + startAnimation(0x1CD89029, 0, -1); + SetUpdateHandler(&Klaymen::update); + SetMessageHandler(&KmScene1002::hmPressDoorButton); + SetSpriteUpdate(&Klaymen::suAction); +} + +void KmScene1002::stHitByBoxingGlove() { + _busyStatus = 1; + _acceptInput = false; + startAnimation(0x35AA8059, 0, -1); + SetUpdateHandler(&Klaymen::update); + SetMessageHandler(&KmScene1002::hmHitByBoxingGlove); + SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); + FinalizeState(&KmScene1002::evHitByBoxingGloveDone); +} + +void KmScene1002::evHitByBoxingGloveDone() { + sendMessage(_parentScene, 0x1024, 1); +} + +uint32 KmScene1002::hmPressDoorButton(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); + switch (messageNum) { + case 0x100D: + if (param.asInteger() == 0x942D2081) { + _acceptInput = false; + sendMessage(_attachedSprite, 0x2003, 0); + } else if (param.asInteger() == 0xDA600012) { + stHitByBoxingGlove(); + } else if (param.asInteger() == 0x0D01B294) { + _acceptInput = false; + sendMessage(_attachedSprite, 0x480B, 0); + } + break; + } + return messageResult; +} + +uint32 KmScene1002::hmHitByBoxingGlove(int messageNum, const MessageParam ¶m, Entity *sender) { + int16 speedUpFrameIndex; + uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); + switch (messageNum) { + case 0x1008: + speedUpFrameIndex = getFrameIndex(kKlaymenSpeedUpHash); + if (_currFrameIndex < speedUpFrameIndex) { + startAnimation(0x35AA8059, speedUpFrameIndex, -1); + _y = 435; + } + messageResult = 0; + break; + case 0x100D: + if (param.asInteger() == 0x1A1A0785) { + playSound(0, 0x40F0A342); + } else if (param.asInteger() == 0x60428026) { + playSound(0, 0x40608A59); + } + break; + } + return messageResult; +} + +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(&KmScene1004::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; +} + uint32 KmScene1004::hmReadNote(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender); switch (messageNum) { diff --git a/engines/neverhood/modules/module1000_sprites.h b/engines/neverhood/modules/module1000_sprites.h index 540a258ddc..564b3cc335 100644 --- a/engines/neverhood/modules/module1000_sprites.h +++ b/engines/neverhood/modules/module1000_sprites.h @@ -230,6 +230,9 @@ protected: void stMoveVenusFlyTrap(); void stContinueMovingVenusFlyTrap(); void evMoveVenusFlyTrapDone(); + void stPressDoorButton(); + void stHitByBoxingGlove(); + void evHitByBoxingGloveDone(); uint32 hmJumpToRing(int messageNum, const MessageParam ¶m, Entity *sender); uint32 hmJumpToRing3(int messageNum, const MessageParam ¶m, Entity *sender); @@ -238,6 +241,8 @@ protected: uint32 hmJumpAndFall(int messageNum, const MessageParam ¶m, Entity *sender); uint32 hmMoveVenusFlyTrap(int messageNum, const MessageParam ¶m, Entity *sender); uint32 hmFirstMoveVenusFlyTrap(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmPressDoorButton(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmHitByBoxingGlove(int messageNum, const MessageParam ¶m, Entity *sender); void xUpdate(); uint32 xHandleMessage(int messageNum, const MessageParam ¶m); |