From dac95f3f7361a69dbd5eacfd181f294f9def53d9 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Thu, 27 Oct 2011 11:33:12 +0000 Subject: NEVERHOOD: More renaming (mostly in Klayman and AnimatedSprite) --- engines/neverhood/diskplayerscene.cpp | 8 +- engines/neverhood/klayman.cpp | 1108 ++++++++++++++++----------------- engines/neverhood/klayman.h | 122 ++-- engines/neverhood/module1000.cpp | 130 ++-- engines/neverhood/module1100.cpp | 12 +- engines/neverhood/module1200.cpp | 102 +-- engines/neverhood/module1300.cpp | 88 +-- engines/neverhood/module1400.cpp | 78 +-- engines/neverhood/module1600.cpp | 78 +-- engines/neverhood/module1700.cpp | 4 +- engines/neverhood/module1900.cpp | 34 +- engines/neverhood/module2000.cpp | 4 +- engines/neverhood/module2100.cpp | 20 +- engines/neverhood/module2200.cpp | 76 +-- engines/neverhood/module2600.cpp | 2 +- engines/neverhood/module3000.cpp | 32 +- engines/neverhood/sprite.cpp | 176 +++--- engines/neverhood/sprite.h | 38 +- 18 files changed, 1046 insertions(+), 1066 deletions(-) diff --git a/engines/neverhood/diskplayerscene.cpp b/engines/neverhood/diskplayerscene.cpp index 4fdc736dc5..94a53239b1 100644 --- a/engines/neverhood/diskplayerscene.cpp +++ b/engines/neverhood/diskplayerscene.cpp @@ -161,8 +161,8 @@ Class494::Class494(NeverhoodEngine *vm) createSurface1(0x100B90B4, 1200); _x = 211; _y = 195; - setFileHash(0x100B90B4, 0, -1); - _newHashListIndex = 0; + startAnimation(0x100B90B4, 0, -1); + _newStickFrameIndex = 0; _needRefresh = true; updatePosition(); _surface->setVisible(false); @@ -172,7 +172,7 @@ uint32 Class494::handleMessage(int messageNum, const MessageParam ¶m, Entity uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -186,7 +186,7 @@ void Class494::sub43BE00() { } void Class494::sub43BE20() { - setFileHash(0x100B90B4, 0, -1); + startAnimation(0x100B90B4, 0, -1); SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&Class494::handleMessage); NextState(&Class494::sub43BE00); diff --git a/engines/neverhood/klayman.cpp b/engines/neverhood/klayman.cpp index 567788b729..2358df4c8b 100644 --- a/engines/neverhood/klayman.cpp +++ b/engines/neverhood/klayman.cpp @@ -27,7 +27,7 @@ namespace Neverhood { -static const KlaymanTableItem klaymanTable1[] = { +static const KlaymanIdleTableItem klaymanTable1[] = { {1, &Klayman::stDoIdlePickEar}, {1, &Klayman::sub41FDA0}, {1, &Klayman::sub41FDF0}, @@ -35,7 +35,7 @@ static const KlaymanTableItem klaymanTable1[] = { {1, &Klayman::sub41FEB0} }; -static const KlaymanTableItem klaymanTable2[] = { +static const KlaymanIdleTableItem klaymanTable2[] = { {1, &Klayman::stDoIdlePickEar}, {1, &Klayman::sub41FDA0}, {1, &Klayman::stDoIdleChest}, @@ -43,13 +43,13 @@ static const KlaymanTableItem klaymanTable2[] = { }; #if 0 -static const KlaymanTableItem klaymanTable3[] = { +static const KlaymanIdleTableItem klaymanTable3[] = { {1, &Klayman::sub421430}, {1, &Klayman::sub421480} }; #endif -static const KlaymanTableItem klaymanTable4[] = { +static const KlaymanIdleTableItem klaymanTable4[] = { {1, &Klayman::sub41FDA0}, {1, &Klayman::stDoIdleChest}, {1, &Klayman::sub41FEB0}, @@ -60,8 +60,8 @@ static const KlaymanTableItem klaymanTable4[] = { Klayman::Klayman(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, int surfacePriority, int objectPriority, NRectArray *clipRects) : AnimatedSprite(vm, objectPriority), _soundResource1(vm), _soundResource2(vm), _counterMax(0), _counter(0), _flagE4(false), _counter3Max(0), _flagF8(false), _counter1(0), - _counter2(0), /*_field118(0), */_status2(0), _flagE5(true), _attachedSprite(NULL), _flagE1(false), - _status3(1), _parentScene(parentScene), _flagE2(false), _flagE3(false), _flagF6(false), _flagF7(false), + _counter2(0), /*_field118(0), */_status2(0), _acceptInput(true), _attachedSprite(NULL), _flagE1(false), + _status3(1), _parentScene(parentScene), _flagE2(false), _flagE3(false), _flagF6(false), _isLeverDown(false), _flagFA(false), _statusE0(0), _field114(0), _resourceHandle(-1), _soundFlag(false) { // TODO DirtySurface @@ -71,7 +71,7 @@ Klayman::Klayman(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, int _x4 = x; _y4 = y; _flags = 2; - setKlaymanTable1(); + setKlaymanIdleTable1(); stTryStandIdle(); SetUpdateHandler(&Klayman::update); } @@ -101,25 +101,25 @@ void Klayman::update() { xUpdate(); } -void Klayman::setKlaymanTable(const KlaymanTableItem *table, int tableCount) { - _table = table; - _tableCount = tableCount; - _tableMaxValue = 0; +void Klayman::setKlaymanIdleTable(const KlaymanIdleTableItem *table, int tableCount) { + _idleTable = table; + _idleTableCount = tableCount; + _idleTableMaxValue = 0; for (int i = 0; i < tableCount; i++) { - _tableMaxValue += table[i].value; + _idleTableMaxValue += table[i].value; } } -void Klayman::setKlaymanTable1() { - setKlaymanTable(klaymanTable1, ARRAYSIZE(klaymanTable1)); +void Klayman::setKlaymanIdleTable1() { + setKlaymanIdleTable(klaymanTable1, ARRAYSIZE(klaymanTable1)); } -void Klayman::setKlaymanTable2() { - setKlaymanTable(klaymanTable2, ARRAYSIZE(klaymanTable2)); +void Klayman::setKlaymanIdleTable2() { + setKlaymanIdleTable(klaymanTable2, ARRAYSIZE(klaymanTable2)); } -void Klayman::setKlaymanTable3() { - // TODO setKlaymanTable(klaymanTable3, ARRAYSIZE(klaymanTable3)); +void Klayman::setKlaymanIdleTable3() { + // TODO setKlaymanIdleTable(klaymanTable3, ARRAYSIZE(klaymanTable3)); } void Klayman::stDoIdlePickEar() { @@ -128,8 +128,8 @@ void Klayman::stDoIdlePickEar() { void Klayman::stIdlePickEar() { _status2 = 1; - _flagE5 = true; - setFileHash(0x5B20C814, 0, -1); + _acceptInput = true; + startAnimation(0x5B20C814, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::hmIdlePickEar); SetSpriteCallback(NULL); @@ -159,8 +159,8 @@ void Klayman::sub41FDA0() { void Klayman::sub41FDB0() { _status2 = 1; - _flagE5 = true; - setFileHash(0xD122C137, 0, -1); + _acceptInput = true; + startAnimation(0xD122C137, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41E980); SetSpriteCallback(NULL); @@ -185,8 +185,8 @@ void Klayman::sub41FDF0() { void Klayman::sub41FE00() { _status2 = 1; - _flagE5 = true; - setFileHash(0x543CD054, 0, -1); + _acceptInput = true; + startAnimation(0x543CD054, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41E9E0); SetSpriteCallback(NULL); @@ -220,8 +220,8 @@ void Klayman::stDoIdleChest() { void Klayman::stIdleChest() { _status2 = 1; - _flagE5 = true; - setFileHash(0x40A0C034, 0, -1); + _acceptInput = true; + startAnimation(0x40A0C034, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::hmIdleChest); SetSpriteCallback(NULL); @@ -246,8 +246,8 @@ void Klayman::sub41FEB0() { void Klayman::sub41FEC0() { _status2 = 1; - _flagE5 = true; - setFileHash(0x5120E137, 0, -1); + _acceptInput = true; + startAnimation(0x5120E137, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41EFE0); SetSpriteCallback(NULL); @@ -274,8 +274,8 @@ uint32 Klayman::handleMessage41EFE0(int messageNum, const MessageParam ¶m, E void Klayman::sub421350() { _status2 = 0; - _flagE5 = true; - setFileHash(0x582EC138, 0, -1); + _acceptInput = true; + startAnimation(0x582EC138, 0, -1); _counter = 0; SetSpriteCallback(NULL); SetUpdateHandler(&Klayman::update41D1C0); @@ -290,15 +290,15 @@ void Klayman::update41D1C0() { _counter++; if (_counter >= _counterMax) { _counter = 0; - if (_table) { - int randomValue = _vm->_rnd->getRandomNumber(_tableMaxValue); - for (int i = 0; i < _tableCount; i++) { - if (randomValue < _table[_tableCount].value) { - (this->*(_table[_tableCount].callback))(); + if (_idleTable) { + int randomValue = _vm->_rnd->getRandomNumber(_idleTableMaxValue); + for (int i = 0; i < _idleTableCount; i++) { + if (randomValue < _idleTable[_idleTableCount].value) { + (this->*(_idleTable[_idleTableCount].callback))(); _counterMax = _vm->_rnd->getRandomNumber(128) + 24; break; } - randomValue -= _table[_tableCount].value; + randomValue -= _idleTable[_idleTableCount].value; } } } else { @@ -313,8 +313,8 @@ void Klayman::update41D1C0() { void Klayman::stIdleSitBlink() { _status2 = 0; - _flagE5 = true; - setFileHash(0x5C24C018, 0, -1); + _acceptInput = true; + startAnimation(0x5C24C018, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41D480); SetSpriteCallback(NULL); @@ -323,8 +323,8 @@ void Klayman::stIdleSitBlink() { void Klayman::stIdleSitBlinkSecond() { _status2 = 0; - _flagE5 = true; - setFileHash(0x5C24C018, 0, -1); + _acceptInput = true; + startAnimation(0x5C24C018, 0, -1); SetUpdateHandler(&Klayman::update41D1C0); SetMessageHandler(&Klayman::handleMessage41D360); SetSpriteCallback(NULL); @@ -334,8 +334,8 @@ void Klayman::stPickUpNeedle() { setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0); if (!stStartAction(AnimationCallback(&Klayman::stPickUpNeedle))) { _status2 = 1; - _flagE5 = false; - setFileHash(0x1449C169, 0, -1); + _acceptInput = false; + startAnimation(0x1449C169, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::hmPickUpGeneric); SetSpriteCallback(NULL); @@ -346,8 +346,8 @@ void Klayman::sub41FFF0() { setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0); if (!stStartAction(AnimationCallback(&Klayman::sub41FFF0))) { _status2 = 1; - _flagE5 = false; - setFileHash(0x0018C032, 0, -1); + _acceptInput = false; + startAnimation(0x0018C032, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41D640); SetSpriteCallback(NULL); @@ -377,19 +377,19 @@ uint32 Klayman::handleMessage41D640(int messageNum, const MessageParam ¶m, E return messageResult; } -void Klayman::sub4214D0() { +void Klayman::stTurnToUseInTeleporter() { _status2 = 0; - _flagE5 = false; - setFileHash(0xD229823D, 0, -1); + _acceptInput = false; + startAnimation(0xD229823D, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41D480); SetSpriteCallback(NULL); } -void Klayman::sub421510() { +void Klayman::stReturnFromUseInTeleporter() { _status2 = 0; - _flagE5 = false; - setFileHash(0x9A2801E0, 0, -1); + _acceptInput = false; + startAnimation(0x9A2801E0, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41D480); SetSpriteCallback(NULL); @@ -398,10 +398,10 @@ void Klayman::sub421510() { void Klayman::stStepOver() { if (!stStartAction(AnimationCallback(&Klayman::stStepOver))) { _status2 = 2; - _flagE5 = false; - setFileHash(0x004AA310, 0, -1); + _acceptInput = false; + startAnimation(0x004AA310, 0, -1); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41EC70); + SetMessageHandler(&Klayman::hmStartWalking); SetSpriteCallback(&Klayman::spriteUpdate41F230); } } @@ -409,15 +409,15 @@ void Klayman::stStepOver() { void Klayman::stSitInTeleporter() { if (!stStartAction(AnimationCallback(&Klayman::stSitInTeleporter))) { _status2 = 0; - _flagE5 = false; - setFileHash(0x392A0330, 0, -1); + _acceptInput = false; + startAnimation(0x392A0330, 0, -1); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41EAB0); + SetMessageHandler(&Klayman::hmSitInTeleporter); SetSpriteCallback(&Klayman::spriteUpdate41F230); } } -uint32 Klayman::handleMessage41EAB0(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 Klayman::hmSitInTeleporter(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = handleMessage41D480(messageNum, param, sender); switch (messageNum) { case 0x100D: @@ -429,10 +429,10 @@ uint32 Klayman::handleMessage41EAB0(int messageNum, const MessageParam ¶m, E return messageResult; } -void Klayman::sub421310() { +void Klayman::stGetUpFromTeleporter() { _status2 = 0; - _flagE5 = false; - setFileHash(0x913AB120, 0, -1); + _acceptInput = false; + startAnimation(0x913AB120, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41D480); SetSpriteCallback(&Klayman::spriteUpdate41F230); @@ -473,10 +473,10 @@ void Klayman::update41D2B0() { bool Klayman::stStartActionFromIdle(AnimationCb callback) { if (_status2 == 2) { _status2 = 1; - _flagE5 = false; - setFileHash(0x9A7020B8, 0, -1); + _acceptInput = false; + startAnimation(0x9A7020B8, 0, -1); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41F140); + SetMessageHandler(&Klayman::hmStartAction); SetSpriteCallback(NULL); NextState(callback); return true; @@ -516,8 +516,8 @@ void Klayman::sub41C790() { void Klayman::stTryStandIdle() { if (!stStartActionFromIdle(AnimationCallback(&Klayman::stTryStandIdle))) { _status2 = 1; - _flagE5 = true; - setFileHash(0x5420E254, 0, -1); + _acceptInput = true; + startAnimation(0x5420E254, 0, -1); _counter = 0; _counter3 = 0; _counter3Max = _vm->_rnd->getRandomNumber(64) + 24; @@ -529,26 +529,22 @@ void Klayman::stTryStandIdle() { void Klayman::update41D0F0() { update(); - _counter++; - if (_counter >= 720) { + if (++_counter >= 720) { _counter = 0; - if (_table) { - int randomValue = _vm->_rnd->getRandomNumber(_tableMaxValue); - for (int i = 0; i < _tableCount; i++) { - if (randomValue < _table[_tableCount].value) { - (this->*(_table[_tableCount].callback))(); + if (_idleTable) { + int randomValue = _vm->_rnd->getRandomNumber(_idleTableMaxValue); + for (int i = 0; i < _idleTableCount; i++) { + if (randomValue < _idleTable[_idleTableCount].value) { + (this->*(_idleTable[_idleTableCount].callback))(); break; } - randomValue -= _table[_tableCount].value; + randomValue -= _idleTable[_idleTableCount].value; } } - } else { - _counter3++; - if (_counter3 >= _counter3Max) { - _counter3 = 0; - _counter3Max = _vm->_rnd->getRandomNumber(64) + 24; - stStand(); - } + } else if (++_counter3 >= _counter3Max) { + _counter3 = 0; + _counter3Max = _vm->_rnd->getRandomNumber(64) + 24; + stStand(); } } @@ -557,7 +553,7 @@ uint32 Klayman::handleMessage41D360(int messageNum, const MessageParam ¶m, E uint32 messageResult = xHandleMessage(messageNum, param); switch (messageNum) { case 0x1008: - messageResult = _flagE5; + messageResult = _acceptInput; break; case 0x1014: _attachedSprite = (Sprite*)(param.asEntity()); @@ -591,8 +587,8 @@ uint32 Klayman::handleMessage41D360(int messageNum, const MessageParam ¶m, E void Klayman::stStand() { _status2 = 1; - _flagE5 = true; - setFileHash(0x5900C41E, 0, -1); + _acceptInput = true; + startAnimation(0x5900C41E, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41D480); SetSpriteCallback(NULL); @@ -611,14 +607,14 @@ uint32 Klayman::handleMessage41D480(int messageNum, const MessageParam ¶m, E void Klayman::stStandAround() { _status2 = 1; - _flagE5 = true; - setFileHash(0x5420E254, 0, -1); + _acceptInput = true; + startAnimation(0x5420E254, 0, -1); SetUpdateHandler(&Klayman::update41D0F0); SetMessageHandler(&Klayman::handleMessage41D360); SetSpriteCallback(NULL); } -uint32 Klayman::handleMessage41F140(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 Klayman::hmStartAction(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = handleMessage41D480(messageNum, param, sender); switch (messageNum) { case 0x100D: @@ -666,8 +662,8 @@ void Klayman::sub41C930(int16 x, bool flag) { void Klayman::stWakeUp() { _status2 = 1; - _flagE5 = false; - setFileHash(0x527AC970, 0, -1); + _acceptInput = false; + startAnimation(0x527AC970, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41D480); SetSpriteCallback(NULL); @@ -675,8 +671,8 @@ void Klayman::stWakeUp() { void Klayman::stSleeping() { _status2 = 0; - _flagE5 = true; - setFileHash(0x5A38C110, 0, -1); + _acceptInput = true; + startAnimation(0x5A38C110, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::hmSleeping); SetSpriteCallback(NULL); @@ -697,10 +693,10 @@ uint32 Klayman::hmSleeping(int messageNum, const MessageParam ¶m, Entity *se bool Klayman::stStartAction(AnimationCb callback3) { if (_status2 == 1) { _status2 = 2; - _flagE5 = false; - setFileHash(0x5C7080D4, 0, -1); + _acceptInput = false; + startAnimation(0x5C7080D4, 0, -1); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41F140); + SetMessageHandler(&Klayman::hmStartAction); SetSpriteCallback(&Klayman::spriteUpdate41F250); NextState(callback3); return true; @@ -728,7 +724,7 @@ void Klayman::spriteUpdate41F250() { } _deltaY = 0; - if (_flag) { + if (_frameChanged) { if (xdiff > 6) _x += 6; else if (xdiff < -6) @@ -741,11 +737,11 @@ void Klayman::spriteUpdate41F250() { } -void Klayman::spriteUpdate41F5F0() { +void Klayman::suWalking() { int16 xdiff = _x4 - _x; - if (_frameIndex == 9) { + if (_currFrameIndex == 9) { if (xdiff > 26) _deltaX += xdiff - 26; else if (xdiff < -26) @@ -792,20 +788,20 @@ void Klayman::spriteUpdate41F5F0() { void Klayman::stSneak() { _status2 = 1; _flagE2 = true; - _flagE5 = true; + _acceptInput = true; setDoDeltaX(_x4 < _x ? 1 : 0); - setFileHash(0x5C48C506, 0, -1); + startAnimation(0x5C48C506, 0, -1); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41DD80); - SetSpriteCallback(&Klayman::spriteUpdate41F5F0); - FinalizeState(&Klayman::stSneakDone); + SetMessageHandler(&Klayman::hmWalking); + SetSpriteCallback(&Klayman::suWalking); + FinalizeState(&Klayman::stWalkingDone); } -void Klayman::stSneakDone() { +void Klayman::stWalkingDone() { _flagE2 = false; } -uint32 Klayman::handleMessage41DD80(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 Klayman::hmWalking(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = handleMessage41D360(messageNum, param, sender); switch (messageNum) { case 0x100D: @@ -855,11 +851,11 @@ void Klayman::stStartWalking() { if (!stStartActionFromIdle(AnimationCallback(&Klayman::stStartWalking))) { _status2 = 0; _flagE1 = true; - _flagE5 = true; + _acceptInput = true; setDoDeltaX(_x4 < _x ? 1 : 0); - setFileHash(0x242C0198, 0, -1); + startAnimation(0x242C0198, 0, -1); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41EC70); + SetMessageHandler(&Klayman::hmStartWalking); SetSpriteCallback(&Klayman::spriteUpdate41F320); FinalizeState(&Klayman::stStartWalkingDone); NextState(&Klayman::stWalking); @@ -870,7 +866,7 @@ void Klayman::stStartWalkingDone() { _flagE1 = false; } -uint32 Klayman::handleMessage41EC70(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 Klayman::hmStartWalking(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = handleMessage41D480(messageNum, param, sender); switch (messageNum) { case 0x100D: @@ -895,13 +891,13 @@ uint32 Klayman::handleMessage41EC70(int messageNum, const MessageParam ¶m, E void Klayman::stWalking() { _status2 = 0; _flagE1 = true; - _flagE5 = true; - setFileHash(0x1A249001, 0, -1); + _acceptInput = true; + startAnimation(0x1A249001, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41EB70); SetSpriteCallback(&Klayman::spriteUpdate41F300); FinalizeState(&Klayman::stStartWalkingDone); - NextState(&Klayman::sub41FA40); + NextState(&Klayman::stUpdateWalking); } void Klayman::spriteUpdate41F300() { @@ -931,35 +927,35 @@ uint32 Klayman::handleMessage41EB70(int messageNum, const MessageParam ¶m, E return messageResult; } -void Klayman::sub41FA40() { +void Klayman::stUpdateWalking() { if (_status3 == 2) { sub41C7B0(); } else if (_status3 == 3) { - sub420F20(); + stWalkingOpenDoor(); } else { _flagE2 = true; - _flagE5 = true; - if (ABS(_x4 - _x) <= 42 && _frameIndex >= 5 && _frameIndex <= 11) { + _acceptInput = true; + if (ABS(_x4 - _x) <= 42 && _currFrameIndex >= 5 && _currFrameIndex <= 11) { if (_status3 == 0) { _status2 = 1; - setFileHash(0xF234EE31, 0, -1); + startAnimation(0xF234EE31, 0, -1); } else { _status2 = 2; - setFileHash(0xF135CC21, 0, -1); + startAnimation(0xF135CC21, 0, -1); } - } else if (ABS(_x4 - _x) <= 10 && (_frameIndex >= 12 || _frameIndex <= 4)) { + } else if (ABS(_x4 - _x) <= 10 && (_currFrameIndex >= 12 || _currFrameIndex <= 4)) { if (_status3 == 0) { _status2 = 1; - setFileHash(0x8604A152, 0, -1); + startAnimation(0x8604A152, 0, -1); } else { _status2 = 2; - setFileHash(0xA246A132, 0, -1); + startAnimation(0xA246A132, 0, -1); } } SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41DD80); - SetSpriteCallback(&Klayman::spriteUpdate41F5F0); - FinalizeState(&Klayman::stSneakDone); + SetMessageHandler(&Klayman::hmWalking); + SetSpriteCallback(&Klayman::suWalking); + FinalizeState(&Klayman::stWalkingDone); } } @@ -976,13 +972,13 @@ void Klayman::spriteUpdate41F320() { if (xdiff == 0) { sendMessage(this, 0x1019, 0); - } else if (_status3 != 2 && _status3 != 3 && xdiff <= 42 && _frameIndex >= 5 && _frameIndex <= 11) { + } else if (_status3 != 2 && _status3 != 3 && xdiff <= 42 && _currFrameIndex >= 5 && _currFrameIndex <= 11) { sendMessage(this, 0x1019, 0); - } else if (_status3 != 2 && _status3 != 3 && xdiff <= 10 && (_frameIndex >= 12 || _frameIndex <= 4)) { + } else if (_status3 != 2 && _status3 != 3 && xdiff <= 10 && (_currFrameIndex >= 12 || _currFrameIndex <= 4)) { sendMessage(this, 0x1019, 0); } else if (_status3 == 3 && xdiff < 30) { sendMessage(this, 0x1019, 0); - } else if (_status3 == 3 && xdiff < 150 && _frameIndex >= 6) { + } else if (_status3 == 3 && xdiff < 150 && _currFrameIndex >= 6) { sendMessage(this, 0x1019, 0); } else { HitRect *hitRectPrev = _vm->_collisionMan->findHitRectAtPos(_x, _y); @@ -1039,8 +1035,8 @@ void Klayman::stPickUpGeneric() { setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0); if (!stStartAction(AnimationCallback(&Klayman::stPickUpGeneric))) { _status2 = 1; - _flagE5 = false; - setFileHash(0x1C28C178, 0, -1); + _acceptInput = false; + startAnimation(0x1C28C178, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::hmPickUpGeneric); SetSpriteCallback(NULL); @@ -1076,8 +1072,8 @@ uint32 Klayman::hmPickUpGeneric(int messageNum, const MessageParam ¶m, Entit void Klayman::stTurnPressButton() { if (!stStartAction(AnimationCallback(&Klayman::stTurnPressButton))) { _status2 = 2; - _flagE5 = true; - setFileHash(0x1C02B03D, 0, -1); + _acceptInput = true; + startAnimation(0x1C02B03D, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::hmPressButton); SetSpriteCallback(NULL); @@ -1105,8 +1101,8 @@ uint32 Klayman::hmPressButton(int messageNum, const MessageParam ¶m, Entity void Klayman::stStampFloorButton() { if (!stStartAction(AnimationCallback(&Klayman::stStampFloorButton))) { _status2 = 2; - _flagE5 = true; - setFileHash(0x1C16B033, 0, -1); + _acceptInput = true; + startAnimation(0x1C16B033, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::hmPressButton); SetSpriteCallback(NULL); @@ -1116,8 +1112,8 @@ void Klayman::stStampFloorButton() { void Klayman::stPressButtonSide() { if (!stStartActionFromIdle(AnimationCallback(&Klayman::stPressButtonSide))) { _status2 = 1; - _flagE5 = true; - setFileHash(0x1CD89029, 0, -1); + _acceptInput = true; + startAnimation(0x1CD89029, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::hmPressButton); SetSpriteCallback(&Klayman::spriteUpdate41F250); @@ -1194,9 +1190,9 @@ void Klayman::sub41CAC0(int16 x) { void Klayman::stLargeStep() { _status2 = 2; _flagE3 = true; - _flagE5 = true; + _acceptInput = true; setDoDeltaX(_x4 >= _x ? 1 : 0); - setFileHash(0x08B28116, 0, -1); + startAnimation(0x08B28116, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::hmLargeStep); SetSpriteCallback(&Klayman::suLargeStep); @@ -1214,7 +1210,7 @@ void Klayman::suLargeStep() { _deltaX = -_deltaX; } - if (_frameIndex == 7) { + if (_currFrameIndex == 7) { _deltaX = xdiff; } @@ -1273,8 +1269,8 @@ uint32 Klayman::hmLargeStep(int messageNum, const MessageParam ¶m, Entity *s void Klayman::stWonderAboutHalf() { _status2 = 0; - _flagE5 = true; - setFileHash(0xD820A114, 0, 10); + _acceptInput = true; + startAnimation(0xD820A114, 0, 10); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41D480); SetSpriteCallback(NULL); @@ -1282,8 +1278,8 @@ void Klayman::stWonderAboutHalf() { void Klayman::stWonderAboutAfter() { _status2 = 1; - _flagE5 = true; - setFileHash(0xD820A114, 30, -1); + _acceptInput = true; + startAnimation(0xD820A114, 30, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41D480); SetSpriteCallback(NULL); @@ -1291,14 +1287,14 @@ void Klayman::stWonderAboutAfter() { void Klayman::stTurnToUseHalf() { _status2 = 0; - _flagE5 = true; - setFileHash(0x9B250AD2, 0, 7); + _acceptInput = true; + startAnimation(0x9B250AD2, 0, 7); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41EEF0); + SetMessageHandler(&Klayman::hmTurnToUse); SetSpriteCallback(NULL); } -uint32 Klayman::handleMessage41EEF0(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 Klayman::hmTurnToUse(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = handleMessage41D480(messageNum, param, sender); switch (messageNum) { case 0x100D: @@ -1314,17 +1310,17 @@ uint32 Klayman::handleMessage41EEF0(int messageNum, const MessageParam ¶m, E void Klayman::stTurnAwayFromUse() { _status2 = 1; - _flagE5 = true; - setFileHash(0x98F88391, 4, -1); + _acceptInput = true; + startAnimation(0x98F88391, 4, -1); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41EEF0); + SetMessageHandler(&Klayman::hmTurnToUse); SetSpriteCallback(NULL); } void Klayman::stWonderAbout() { _status2 = 1; - _flagE5 = true; - setFileHash(0xD820A114, 0, -1); + _acceptInput = true; + startAnimation(0xD820A114, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41D480); SetSpriteCallback(NULL); @@ -1332,8 +1328,8 @@ void Klayman::stWonderAbout() { void Klayman::stPeekWall() { _status2 = 1; - _flagE5 = true; - setFileHash(0xAC20C012, 0, -1); + _acceptInput = true; + startAnimation(0xAC20C012, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::hmPeekWall); SetSpriteCallback(NULL); @@ -1344,8 +1340,8 @@ uint32 Klayman::hmPeekWall(int messageNum, const MessageParam ¶m, Entity *se switch (messageNum) { case 0x1008: speedUpFrameIndex = getFrameIndex(kKlaymanSpeedUpHash); - if (_frameIndex < speedUpFrameIndex) - setFileHash(0xAC20C012, speedUpFrameIndex, -1); + if (_currFrameIndex < speedUpFrameIndex) + startAnimation(0xAC20C012, speedUpFrameIndex, -1); return 0; case 0x100D: if (param.asInteger() == 0x32180101) { @@ -1358,24 +1354,24 @@ uint32 Klayman::hmPeekWall(int messageNum, const MessageParam ¶m, Entity *se return handleMessage41D480(messageNum, param, sender); } -void Klayman::sub420210() { - if (!stStartAction(AnimationCallback(&Klayman::sub420210))) { +void Klayman::stJumpToRing1() { + if (!stStartAction(AnimationCallback(&Klayman::stJumpToRing1))) { _status2 = 0; - setFileHash(0xD82890BA, 0, -1); - sub4201C0(); + startAnimation(0xD82890BA, 0, -1); + setupJumpToRing(); } } -void Klayman::sub4201C0() { - _flagE5 = false; +void Klayman::setupJumpToRing() { + _acceptInput = false; SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41D790); + SetMessageHandler(&Klayman::hmJumpToRing); SetSpriteCallback(&Klayman::spriteUpdate41F230); NextState(&Klayman::sub420340); sendMessage(_attachedSprite, 0x482B, 0); } -uint32 Klayman::handleMessage41D790(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 Klayman::hmJumpToRing(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = handleMessage41D480(messageNum, param, sender); switch (messageNum) { case 0x100D: @@ -1383,7 +1379,7 @@ uint32 Klayman::handleMessage41D790(int messageNum, const MessageParam ¶m, E if (_attachedSprite) { sendMessage(_attachedSprite, 0x4806, 0); } - _flagE5 = true; + _acceptInput = true; } else if (param.asInteger() == 0x320AC306) { _soundResource1.play(0x5860C640); } else if (param.asInteger() == 0x4AB28209) { @@ -1403,35 +1399,35 @@ void Klayman::spriteUpdate41F230() { void Klayman::sub420340() { _status2 = 0; - _flagE5 = true; - setFileHash(0x4829E0B8, 0, -1); + _acceptInput = true; + startAnimation(0x4829E0B8, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41D360); SetSpriteCallback(NULL); } -void Klayman::sub420250() { - if (!stStartAction(AnimationCallback(&Klayman::sub420250))) { +void Klayman::stJumpToRing2() { + if (!stStartAction(AnimationCallback(&Klayman::stJumpToRing2))) { _status2 = 0; - setFileHash(0x900980B2, 0, -1); - sub4201C0(); + startAnimation(0x900980B2, 0, -1); + setupJumpToRing(); } } -void Klayman::sub420290() { - if (!stStartAction(AnimationCallback(&Klayman::sub420290))) { +void Klayman::stJumpToRing3() { + if (!stStartAction(AnimationCallback(&Klayman::stJumpToRing3))) { _status2 = 0; - _flagE5 = false; - setFileHash(0xBA1910B2, 0, -1); + _acceptInput = false; + startAnimation(0xBA1910B2, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); - SetMessageHandler(&Klayman::handleMessage41D880); - NextState(&Klayman::sub420380); + SetMessageHandler(&Klayman::hmJumpToRing3); + NextState(&Klayman::stHoldRing); sendMessage(_attachedSprite, 0x482B, 0); } } -uint32 Klayman::handleMessage41D880(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 Klayman::hmJumpToRing3(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = handleMessage41D480(messageNum, param, sender); switch (messageNum) { case 0x100D: @@ -1451,41 +1447,41 @@ uint32 Klayman::handleMessage41D880(int messageNum, const MessageParam ¶m, E return messageResult; } -void Klayman::sub420380() { +void Klayman::stHoldRing() { _status2 = 0; - _flagE5 = true; - setFileHash(0x4A293FB0, 0, -1); + _acceptInput = true; + startAnimation(0x4A293FB0, 0, -1); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41DAA0); + SetMessageHandler(&Klayman::hmHoldRing); SetSpriteCallback(NULL); } -uint32 Klayman::handleMessage41DAA0(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 Klayman::hmHoldRing(int messageNum, const MessageParam ¶m, Entity *sender) { if (messageNum == 0x1008) { - sub4203C0(); + stReleaseRing(); return 0; } return handleMessage41D360(messageNum, param, sender); } -void Klayman::sub4203C0() { +void Klayman::stReleaseRing() { _status2 = 1; - _flagE5 = false; + _acceptInput = false; if (_attachedSprite) { sendMessage(_attachedSprite, 0x4807, 0); _attachedSprite = NULL; } - setFileHash(0xB869A4B9, 0, -1); + startAnimation(0xB869A4B9, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41D480); SetSpriteCallback(NULL); } -void Klayman::sub420300() { - if (!stStartAction(AnimationCallback(&Klayman::sub420300))) { +void Klayman::stJumpToRing4() { + if (!stStartAction(AnimationCallback(&Klayman::stJumpToRing4))) { _status2 = 0; - setFileHash(0xB8699832, 0, -1); - sub4201C0(); + startAnimation(0xB8699832, 0, -1); + setupJumpToRing(); } } @@ -1493,12 +1489,12 @@ void Klayman::sub41CCE0(int16 x) { sub41CC40(_attachedSprite->getX(), x); } -void Klayman::sub420970() { +void Klayman::stContinueClimbLadderUp() { _status2 = 0; - _flagE5 = true; + _acceptInput = true; _statusE0 = 3; - setFileHash2(0x3A292504, 0x01084280, 0); - _fileHash4 = 0x01084280; + startAnimationByHash(0x3A292504, 0x01084280, 0); + _newStickFrameHash = 0x01084280; SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41D360); SetSpriteCallback(NULL); @@ -1517,22 +1513,22 @@ void Klayman::sub4209D0() { } } else if (_statusE0 == 0) { _statusE0 = 2; - _flagE5 = false; - setFileHash(0x122D1505, 0, -1); + _acceptInput = false; + startAnimation(0x122D1505, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41E0D0); SetSpriteCallback(&Klayman::spriteUpdate41F230); } else if (_statusE0 == 3) { _statusE0 = 2; - _flagE5 = false; - setFileHash2(0x122D1505, 0x01084280, 0); + _acceptInput = false; + startAnimationByHash(0x122D1505, 0x01084280, 0); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41E0D0); SetSpriteCallback(&Klayman::spriteUpdate41F230); } else if (_statusE0 == 1) { _statusE0 = 2; - _flagE5 = true; - setFileHash(0x122D1505, 29 - _frameIndex, -1); + _acceptInput = true; + startAnimation(0x122D1505, 29 - _currFrameIndex, -1); } } } @@ -1541,15 +1537,15 @@ void Klayman::sub420BC0() { _status2 = 2; if (_statusE0 == 1) { _statusE0 = 0; - _flagE5 = false; - setFileHash2(0x3A292504, 0x02421405, 0); + _acceptInput = false; + startAnimationByHash(0x3A292504, 0x02421405, 0); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41DFD0); SetSpriteCallback(&Klayman::spriteUpdate41F230); } else if (_statusE0 == 1) { _statusE0 = 0; - _flagE5 = false; - setFileHash2(0x122D1505, 0x02421405, 0); + _acceptInput = false; + startAnimationByHash(0x122D1505, 0x02421405, 0); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41DFD0); SetSpriteCallback(&Klayman::spriteUpdate41F230); @@ -1581,16 +1577,16 @@ uint32 Klayman::handleMessage41E0D0(int messageNum, const MessageParam ¶m, E switch (messageNum) { case 0x100D: if (param.asInteger() == 0x01084280) { - _flagE5 = true; + _acceptInput = true; } else if (param.asInteger() == 0x489B025C) { _soundResource1.play(0x52C4C2D7); } else if (param.asInteger() == 0x400A0E64) { _soundResource1.play(0x50E081D9); } else if (param.asInteger() == 0x02421405) { if (_statusE0 == 1) { - setFileHash2(0x3A292504, 0x01084280, 0); + startAnimationByHash(0x3A292504, 0x01084280, 0); } else { - setFileHash2(0x122D1505, 0x01084280, 0); + startAnimationByHash(0x122D1505, 0x01084280, 0); } if (_statusE0 == 1) { if (_y4 >= _y - 30) { @@ -1614,36 +1610,36 @@ void Klayman::sub420AD0() { sub41C7B0(); } else if (_statusE0 == 0) { _statusE0 = 1; - _flagE5 = false; - setFileHash(0x3A292504, 0, -1); + _acceptInput = false; + startAnimation(0x3A292504, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41E0D0); SetSpriteCallback(&Klayman::spriteUpdate41F230); } else if (_statusE0 == 3) { _statusE0 = 1; - _flagE5 = true; - setFileHash2(0x3A292504, 0x01084280, 0); + _acceptInput = true; + startAnimationByHash(0x3A292504, 0x01084280, 0); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41E0D0); SetSpriteCallback(&Klayman::spriteUpdate41F230); } else if (_statusE0 == 2) { _statusE0 = 1; - _flagE5 = true; - setFileHash(0x3A292504, 29 - _frameIndex, -1); + _acceptInput = true; + startAnimation(0x3A292504, 29 - _currFrameIndex, -1); } } } -void Klayman::sub421030() { +void Klayman::stWalkToFrontNoStep() { _status2 = 2; - _flagE5 = false; - setFileHash2(0xF229C003, 0x14884392, 0); + _acceptInput = false; + startAnimationByHash(0xF229C003, 0x14884392, 0); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41E490); + SetMessageHandler(&Klayman::hmWalkToFront); SetSpriteCallback(&Klayman::spriteUpdate41F230); } -uint32 Klayman::handleMessage41E490(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 Klayman::hmWalkToFront(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = handleMessage41D480(messageNum, param, sender); switch (messageNum) { case 0x100D: @@ -1669,49 +1665,49 @@ uint32 Klayman::handleMessage41E490(int messageNum, const MessageParam ¶m, E return messageResult; } -void Klayman::sub420FE0() { - if (!stStartAction(AnimationCallback(&Klayman::sub420FE0))) { +void Klayman::stWalkToFront() { + if (!stStartAction(AnimationCallback(&Klayman::stWalkToFront))) { _status2 = 2; - _flagE5 = false; - setFileHash(0xF229C003, 0, -1); + _acceptInput = false; + startAnimation(0xF229C003, 0, -1); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41E490); + SetMessageHandler(&Klayman::hmWalkToFront); SetSpriteCallback(&Klayman::spriteUpdate41F230); } } -void Klayman::sub4210C0() { - if (!stStartAction(AnimationCallback(&Klayman::sub4210C0))) { +void Klayman::stTurnToFront() { + if (!stStartAction(AnimationCallback(&Klayman::stTurnToFront))) { _status2 = 0; - _flagE5 = false; - setFileHash2(0xCA221107, 0x8520108C, 0); + _acceptInput = false; + startAnimationByHash(0xCA221107, 0x8520108C, 0); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41E490); + SetMessageHandler(&Klayman::hmWalkToFront); SetSpriteCallback(&Klayman::spriteUpdate41F230); } } -void Klayman::sub421070() { - if (!stStartAction(AnimationCallback(&Klayman::sub421070))) { +void Klayman::stTurnToBack() { + if (!stStartAction(AnimationCallback(&Klayman::stTurnToBack))) { _status2 = 2; - _flagE5 = false; - setFileHash(0xCA221107, 0, -1); + _acceptInput = false; + startAnimation(0xCA221107, 0, -1); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41E490); + SetMessageHandler(&Klayman::hmWalkToFront); SetSpriteCallback(&Klayman::spriteUpdate41F230); } } void Klayman::stLandOnFeet() { _status2 = 1; - _flagE5 = true; - setFileHash(0x18118554, 0, -1); + _acceptInput = true; + startAnimation(0x18118554, 0, -1); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41E290); + SetMessageHandler(&Klayman::hmLandOnFeet); SetSpriteCallback(NULL); } -uint32 Klayman::handleMessage41E290(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 Klayman::hmLandOnFeet(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = handleMessage41D480(messageNum, param, sender); switch (messageNum) { case 0x100D: @@ -1723,18 +1719,18 @@ uint32 Klayman::handleMessage41E290(int messageNum, const MessageParam ¶m, E return messageResult; } -void Klayman::sub420ED0() { - if (!stStartAction(AnimationCallback(&Klayman::sub420ED0))) { +void Klayman::stTurnToBackToUse() { + if (!stStartAction(AnimationCallback(&Klayman::stTurnToBackToUse))) { _status2 = 2; - _flagE5 = false; - setFileHash(0x91540140, 0, -1); + _acceptInput = false; + startAnimation(0x91540140, 0, -1); SetUpdateHandler(&Klayman::update); - SetMessageHandler(&Klayman::handleMessage41E2F0); + SetMessageHandler(&Klayman::hmTurnToBackToUse); SetSpriteCallback(&Klayman::spriteUpdate41F230); } } -uint32 Klayman::handleMessage41E2F0(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 Klayman::hmTurnToBackToUse(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = handleMessage41D480(messageNum, param, sender); switch (messageNum) { case 0x100D: @@ -1750,47 +1746,61 @@ uint32 Klayman::handleMessage41E2F0(int messageNum, const MessageParam ¶m, E return messageResult; } -void Klayman::sub420750() { - if (!stStartAction(AnimationCallback(&Klayman::sub420750))) { +void Klayman::stClayDoorOpen() { + if (!stStartAction(AnimationCallback(&Klayman::stClayDoorOpen))) { _status2 = 2; - _flagE5 = false; - setFileHash(0x5CCCB330, 0, -1); + _acceptInput = false; + startAnimation(0x5CCCB330, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); - SetMessageHandler(&Klayman::handleMessage41DD20); + SetMessageHandler(&Klayman::hmClayDoorOpen); + } +} + +uint32 Klayman::hmClayDoorOpen(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = handleMessage41D480(messageNum, param, sender); + switch (messageNum) { + case 0x100D: + if (param.asInteger() == 0x040D4186) { + if (_attachedSprite) { + sendMessage(_attachedSprite, 0x4808, 0); + } + } + break; } + return messageResult; } void Klayman::stTurnToUse() { if (!stStartAction(AnimationCallback(&Klayman::stTurnToUse))) { _status2 = 2; - _flagE5 = false; - setFileHash(0x9B250AD2, 0, -1); + _acceptInput = false; + startAnimation(0x9B250AD2, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); - SetMessageHandler(&Klayman::handleMessage41EEF0); + SetMessageHandler(&Klayman::hmTurnToUse); } } -void Klayman::sub4207F0() { +void Klayman::stReturnFromUse() { _status2 = 2; - _flagE5 = false; - setFileHash(0x98F88391, 0, -1); + _acceptInput = false; + startAnimation(0x98F88391, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); - SetMessageHandler(&Klayman::handleMessage41EEF0); + SetMessageHandler(&Klayman::hmTurnToUse); } -void Klayman::sub420F20() { +void Klayman::stWalkingOpenDoor() { _flagF8 = false; - _flagE5 = false; - setFileHash(0x11A8E012, 0, -1); + _acceptInput = false; + startAnimation(0x11A8E012, 0, -1); SetUpdateHandler(&Klayman::update); - SetSpriteCallback(&Klayman::spriteUpdate41F5A0); - SetMessageHandler(&Klayman::handleMessage41EC70); + SetSpriteCallback(&Klayman::suWalkingOpenDoor); + SetMessageHandler(&Klayman::hmStartWalking); } -void Klayman::spriteUpdate41F5A0() { +void Klayman::suWalkingOpenDoor() { if (!_flagF8 && ABS(_x4 - _x) < 80) { sendMessage(_parentScene, 0x4829, 0); _flagF8 = true; @@ -1801,18 +1811,18 @@ void Klayman::spriteUpdate41F5A0() { void Klayman::stMoveObjectSkipTurnFaceObject() { setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0); _flagE4 = false; - _flagE5 = true; - setFileHash2(0x0C1CA072, 0x01084280, 0); + _acceptInput = true; + startAnimationByHash(0x0C1CA072, 0x01084280, 0); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); - SetMessageHandler(&Klayman::handleMessage41D970); + SetMessageHandler(&Klayman::hmMoveObjectTurn); } void Klayman::sub420660() { sendMessage(_attachedSprite, 0x4807, 0); } -uint32 Klayman::handleMessage41D970(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 Klayman::hmMoveObjectTurn(int messageNum, const MessageParam ¶m, Entity *sender) { switch (messageNum) { case 0x100D: if (param.asInteger() == 0x01084280) { @@ -1840,11 +1850,11 @@ uint32 Klayman::handleMessage41D970(int messageNum, const MessageParam ¶m, E void Klayman::stMoveObjectSkipTurn() { _flagE4 = false; - _flagE5 = true; - setFileHash2(0x0C1CA072, 0x01084280, 0); + _acceptInput = true; + startAnimationByHash(0x0C1CA072, 0x01084280, 0); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); - SetMessageHandler(&Klayman::handleMessage41D970); + SetMessageHandler(&Klayman::hmMoveObjectTurn); } void Klayman::stMoveObjectFaceObject() { @@ -1852,84 +1862,84 @@ void Klayman::stMoveObjectFaceObject() { if (!stStartAction(AnimationCallback(&Klayman::stMoveObjectFaceObject))) { _status2 = 2; _flagE4 = false; - _flagE5 = true; - setFileHash(0x0C1CA072, 0, -1); + _acceptInput = true; + startAnimation(0x0C1CA072, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); - SetMessageHandler(&Klayman::handleMessage41D970); + SetMessageHandler(&Klayman::hmMoveObjectTurn); } } -void Klayman::sub420C50() { - if (!stStartAction(AnimationCallback(&Klayman::sub420C50))) { +void Klayman::stUseLever() { + if (!stStartAction(AnimationCallback(&Klayman::stUseLever))) { _status2 = 0; - if (_flagF7) { - stReleaseLeverUp(); + if (_isLeverDown) { + stUseLeverRelease(); } else { sendMessage(_attachedSprite, 0x482B, 0); - setFileHash(0x0C303040, 0, -1); + startAnimation(0x0C303040, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); SetMessageHandler(&Klayman::handleMessage41E210); NextState(&Klayman::stPullLeverDown); - _flagE5 = false; + _acceptInput = false; } } } // Exactly the same code as sub420DA0 which was removed void Klayman::stPullLeverDown() { - setFileHash(0x0D318140, 0, -1); + startAnimation(0x0D318140, 0, -1); sendMessage(_attachedSprite, 0x480F, 0); NextState(&Klayman::stHoldLeverDown); } void Klayman::stHoldLeverDown() { - setFileHash(0x4464A440, 0, -1); + startAnimation(0x4464A440, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); SetMessageHandler(&Klayman::handleMessage41D360); - _flagF7 = true; - _flagE5 = true; + _isLeverDown = true; + _acceptInput = true; } -void Klayman::stReleaseLeverUp() { - setFileHash(0x09018068, 0, -1); +void Klayman::stUseLeverRelease() { + startAnimation(0x09018068, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); SetMessageHandler(&Klayman::handleMessage41E210); sendMessage(_attachedSprite, 0x4807, 0); NextState(&Klayman::stPullLeverDown); - _flagE5 = false; + _acceptInput = false; } -void Klayman::sub420E20() { - if (_flagF7) { +void Klayman::stReleaseLever() { + if (_isLeverDown) { _status2 = 2; - setFileHash(0x09018068, 0, -1); + startAnimation(0x09018068, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); SetMessageHandler(&Klayman::handleMessage41E210); sendMessage(_attachedSprite, 0x4807, 0); - NextState(&Klayman::sub420E90); - _flagE5 = false; - _flagF7 = false; + NextState(&Klayman::stLetGoOfLever); + _acceptInput = false; + _isLeverDown = false; } else { sub41C7B0(); } } -void Klayman::sub420E90() { - setFileHash(0x0928C048, 0, -1); - FinalizeState(&Klayman::sub420EB0); +void Klayman::stLetGoOfLever() { + startAnimation(0x0928C048, 0, -1); + FinalizeState(&Klayman::cbLeverReleasedEvent); } -void Klayman::sub420EB0() { +void Klayman::cbLeverReleasedEvent() { sendMessage(_attachedSprite, 0x482A, 0); } -void Klayman::sub420680() { - if (!stStartActionFromIdle(AnimationCallback(&Klayman::sub420680))) { +void Klayman::stInsertDisk() { + if (!stStartActionFromIdle(AnimationCallback(&Klayman::stInsertDisk))) { _status2 = 2; _counter2 = 0; for (uint32 i = 0; i < 20; i++) { @@ -1943,27 +1953,27 @@ void Klayman::sub420680() { gotoState(NULL); sub41C7B0(); } else { - setFileHash(0xD8C8D100, 0, -1); + startAnimation(0xD8C8D100, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F250); - SetMessageHandler(&Klayman::handleMessage41DB90); - _flagE5 = false; + SetMessageHandler(&Klayman::hmInsertDisk); + _acceptInput = false; _counter2--; } } } -uint32 Klayman::handleMessage41DB90(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 Klayman::hmInsertDisk(int messageNum, const MessageParam ¶m, Entity *sender) { switch (messageNum) { case 0x100D: if (param.asInteger() == 0x06040580) { if (_counter2 == 0) { // TODO: Calc calcHash value somewhere else - setFileHash3(0xD8C8D100, calcHash("GoToStartLoop/Finish"), 0); + nextAnimationByHash(0xD8C8D100, calcHash("GoToStartLoop/Finish"), 0); } } else if (_counter2 != 0 && param.asInteger() == calcHash("GoToStartLoop/Finish")) { _counter2--; - setFileHash2(0xD8C8D100, 0x01084280, 0); + startAnimationByHash(0xD8C8D100, 0x01084280, 0); } else if (param.asInteger() == 0x062A1510) { _soundResource1.play(0x41688704); } else if (param.asInteger() == 0x02B20220) { @@ -1979,20 +1989,6 @@ uint32 Klayman::handleMessage41DB90(int messageNum, const MessageParam ¶m, E return handleMessage41D480(messageNum, param, sender); } -uint32 Klayman::handleMessage41DD20(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = handleMessage41D480(messageNum, param, sender); - switch (messageNum) { - case 0x100D: - if (param.asInteger() == 0x040D4186) { - if (_attachedSprite) { - sendMessage(_attachedSprite, 0x4808, 0); - } - } - break; - } - return messageResult; -} - //############################################################################## // KmScene1001 @@ -2077,8 +2073,8 @@ uint32 KmScene1001::xHandleMessage(int messageNum, const MessageParam ¶m) { void KmScene1001::sub44FA50() { if (!stStartAction(AnimationCallback(&KmScene1001::sub44FA50))) { _status2 = 2; - _flagE5 = false; - setFileHash(0x00648953, 0, -1); + _acceptInput = false; + startAnimation(0x00648953, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&KmScene1001::handleMessage44FA00); SetSpriteCallback(&AnimatedSprite::updateDeltaXY); @@ -2103,18 +2099,18 @@ KmScene1002::KmScene1002(NeverhoodEngine *vm, Entity *parentScene, int16 x, int1 : Klayman(vm, parentScene, x, y, 1000, 1000), _otherSprite(NULL), _class599(class599), _ssLadderArch(ssLadderArch), _status(0) { - setKlaymanTable1(); + setKlaymanIdleTable1(); } void KmScene1002::xUpdate() { if (_x >= 250 && _x <= 435 && _y >= 420) { if (_status == 0) { - // TODO setKlaymanTable(stru_4B44C8); + // TODO setKlaymanIdleTable(stru_4B44C8); _status = 1; } } else if (_status == 1) { - setKlaymanTable1(); + setKlaymanIdleTable1(); _status = 0; } } @@ -2147,16 +2143,16 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4805: switch (param.asInteger()) { case 1: - GotoState(&Klayman::sub420210); + GotoState(&Klayman::stJumpToRing1); break; case 2: - GotoState(&Klayman::sub420250); + GotoState(&Klayman::stJumpToRing2); break; case 3: - GotoState(&Klayman::sub420290); + GotoState(&Klayman::stJumpToRing3); break; case 4: - GotoState(&Klayman::sub420300); + GotoState(&Klayman::stJumpToRing4); break; } break; @@ -2180,7 +2176,7 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4820: sendMessage(_parentScene, 0x2005, 0); - GotoState(&Klayman::sub420970); + GotoState(&Klayman::stContinueClimbLadderUp); break; case 0x4821: sendMessage(_parentScene, 0x2005, 0); @@ -2198,16 +2194,16 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x482E: if (param.asInteger() == 1) { - GotoState(&Klayman::sub421030); + GotoState(&Klayman::stWalkToFrontNoStep); } else { - GotoState(&Klayman::sub420FE0); + GotoState(&Klayman::stWalkToFront); } break; case 0x482F: if (param.asInteger() == 1) { - GotoState(&Klayman::sub4210C0); + GotoState(&Klayman::stTurnToFront); } else { - GotoState(&Klayman::sub421070); + GotoState(&Klayman::stTurnToBack); } break; case 0x483F: @@ -2282,12 +2278,12 @@ uint32 KmScene1002::hmPressDoorButton(int messageNum, const MessageParam ¶m, switch (messageNum) { case 0x100D: if (param.asInteger() == 0x942D2081) { - _flagE5 = false; + _acceptInput = false; sendMessage(_attachedSprite, 0x2003, 0); } else if (param.asInteger() == 0xDA600012) { stHitByBoxingGlove(); } else if (param.asInteger() == 0x0D01B294) { - _flagE5 = false; + _acceptInput = false; sendMessage(_attachedSprite, 0x480B, 0); } break; @@ -2353,8 +2349,8 @@ uint32 KmScene1002::handleMessage449C90(int messageNum, const MessageParam ¶ switch (messageNum) { case 0x1008: speedUpFrameIndex = getFrameIndex(kKlaymanSpeedUpHash); - if (_frameIndex < speedUpFrameIndex) { - setFileHash(0x35AA8059, speedUpFrameIndex, -1); + if (_currFrameIndex < speedUpFrameIndex) { + startAnimation(0x35AA8059, speedUpFrameIndex, -1); _y = 435; } messageResult = 0; @@ -2396,8 +2392,8 @@ void KmScene1002::suFallDown() { void KmScene1002::sub449E20() { if (!stStartAction(AnimationCallback(&KmScene1002::sub449E20))) { _status2 = 2; - _flagE5 = false; - setFileHash(0x584984B4, 0, -1); + _acceptInput = false; + startAnimation(0x584984B4, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&AnimatedSprite::updateDeltaXY); SetMessageHandler(&KmScene1002::handleMessage449800); @@ -2409,9 +2405,9 @@ void KmScene1002::sub449E20() { void KmScene1002::sub449E90() { _soundResource1.play(0x56548280); _status2 = 0; - _flagE5 = false; + _acceptInput = false; _surface->setVisible(false); - setFileHash(0x5420E254, 0, -1); + startAnimation(0x5420E254, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene1002::handleMessage4498E0); @@ -2420,8 +2416,8 @@ void KmScene1002::sub449E90() { void KmScene1002::sub449EF0() { _counter1 = 1; _status2 = 0; - _flagE5 = false; - setFileHash(0x000BAB02, 0, -1); + _acceptInput = false; + startAnimation(0x000BAB02, 0, -1); SetUpdateHandler(&KmScene1002::update4497D0); // Weird stuff happening SetMessageHandler(&Klayman::handleMessage41D360); @@ -2436,9 +2432,9 @@ void KmScene1002::sub449F70() { sendMessage(_parentScene, 0x1024, 1); _soundResource1.play(0x41648271); _status2 = 1; - _flagE5 = false; + _acceptInput = false; _flagE1 = false; - setFileHash2(0x000BAB02, 0x88003000, 0); + startAnimationByHash(0x000BAB02, 0x88003000, 0); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene1002::handleMessage41D480); @@ -2453,8 +2449,8 @@ void KmScene1002::sub449F70() { void KmScene1002::stSpitOutFall() { _counter1 = 1; _status2 = 0; - _flagE5 = false; - setFileHash(0x9308C132, 0, -1); + _acceptInput = false; + startAnimation(0x9308C132, 0, -1); SetUpdateHandler(&KmScene1002::update4497D0); SetSpriteCallback(&KmScene1002::suFallDown); SetMessageHandler(&Klayman::handleMessage41D480); @@ -2466,8 +2462,8 @@ void KmScene1002::stSpitOutFall() { void KmScene1002::sub44A0D0() { _counter1 = 1; _status2 = 0; - _flagE5 = false; - setFileHash(0x0013A206, 0, -1); + _acceptInput = false; + startAnimation(0x0013A206, 0, -1); SetUpdateHandler(&KmScene1002::update4497D0); SetMessageHandler(&Klayman::handleMessage41D360); SetSpriteCallback(&KmScene1002::suFallDown); @@ -2480,9 +2476,9 @@ void KmScene1002::sub44A150() { sendMessage(_parentScene, 0x1024, 1); _soundResource1.play(0x41648271); _status2 = 1; - _flagE5 = false; + _acceptInput = false; _flagE1 = false; - setFileHash2(0x0013A206, 0x88003000, 0); + startAnimationByHash(0x0013A206, 0x88003000, 0); SetUpdateHandler(&Klayman::update); SetMessageHandler(&KmScene1002::handleMessage41D480); SetSpriteCallback(NULL); @@ -2503,8 +2499,8 @@ void KmScene1002::stJumpAndFall() { if (!stStartAction(AnimationCallback(&KmScene1002::stJumpAndFall))) { sendMessage(_parentScene, 0x1024, 3); _status2 = 2; - _flagE5 = false; - setFileHash(0xB93AB151, 0, -1); + _acceptInput = false; + startAnimation(0xB93AB151, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&KmScene1002::handleMessage449D60); SetSpriteCallback(&KmScene1002::suFallDown); @@ -2519,8 +2515,8 @@ void KmScene1002::stDropFromRing() { _attachedSprite = NULL; } _status2 = 2; - _flagE5 = false; - setFileHash(0x586984B1, 0, -1); + _acceptInput = false; + startAnimation(0x586984B1, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&KmScene1002::handleMessage41D360); SetSpriteCallback(&KmScene1002::suFallDown); @@ -2529,9 +2525,9 @@ void KmScene1002::stDropFromRing() { void KmScene1002::stPressDoorButton() { _status2 = 2; - _flagE5 = true; + _acceptInput = true; setDoDeltaX(0); - setFileHash(0x1CD89029, 0, -1); + startAnimation(0x1CD89029, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&KmScene1002::hmPressDoorButton); SetSpriteCallback(&Klayman::spriteUpdate41F250); @@ -2539,8 +2535,8 @@ void KmScene1002::stPressDoorButton() { void KmScene1002::stHitByBoxingGlove() { _status2 = 1; - _flagE5 = false; - setFileHash(0x35AA8059, 0, -1); + _acceptInput = false; + startAnimation(0x35AA8059, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&KmScene1002::handleMessage449C90); SetSpriteCallback(&AnimatedSprite::updateDeltaXY); @@ -2555,9 +2551,9 @@ void KmScene1002::stMoveVenusFlyTrap() { if (!stStartAction(AnimationCallback(&KmScene1002::stMoveVenusFlyTrap))) { _status2 = 2; _flagE4 = false; - _flagE5 = true; + _acceptInput = true; setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0); - setFileHash(0x5C01A870, 0, -1); + startAnimation(0x5C01A870, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&KmScene1002::hmMoveVenusFlyTrap); SetSpriteCallback(&AnimatedSprite::updateDeltaXY); @@ -2567,8 +2563,8 @@ void KmScene1002::stMoveVenusFlyTrap() { void KmScene1002::stContinueMovingVenusFlyTrap() { _flagE4 = false; - _flagE5 = true; - setFileHash2(0x5C01A870, 0x01084280, 0); + _acceptInput = true; + startAnimationByHash(0x5C01A870, 0x01084280, 0); SetUpdateHandler(&Klayman::update); SetMessageHandler(&KmScene1002::hmMoveVenusFlyTrap); SetSpriteCallback(&AnimatedSprite::updateDeltaXY); @@ -2608,7 +2604,7 @@ uint32 KmScene1004::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4820: sendMessage(_parentScene, 0x2000, 0); - GotoState(&Klayman::sub420970); + GotoState(&Klayman::stContinueClimbLadderUp); break; case 0x4821: sendMessage(_parentScene, 0x2000, 0); @@ -2635,7 +2631,7 @@ uint32 KmScene1004::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klayman::sub420AD0); break; case 0x4828: - GotoState(&Klayman::sub420ED0); + GotoState(&Klayman::stTurnToBackToUse); break; case 0x483F: sub41CD00(param.asInteger()); @@ -2652,7 +2648,7 @@ uint32 KmScene1004::hmReadNote(int messageNum, const MessageParam ¶m, Entity switch (messageNum) { case 0x100D: if (param.asInteger() == 0x04684052) { - _flagE5 = true; + _acceptInput = true; sendMessage(_parentScene, 0x2002, 0); } break; @@ -2662,15 +2658,15 @@ uint32 KmScene1004::hmReadNote(int messageNum, const MessageParam ¶m, Entity void KmScene1004::stReadNote() { _status2 = 2; - _flagE5 = false; - setFileHash(0x123E9C9F, 0, -1); + _acceptInput = false; + startAnimation(0x123E9C9F, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&KmScene1004::hmReadNote); SetSpriteCallback(&AnimatedSprite::updateDeltaXY); } KmScene1109::KmScene1109(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) - : Klayman(vm, parentScene, x, y, 1000, 1000), _flag1(false) { + : Klayman(vm, parentScene, x, y, 1000, 1000), _isSittingInTeleporter(false) { // Empty } @@ -2678,14 +2674,14 @@ KmScene1109::KmScene1109(NeverhoodEngine *vm, Entity *parentScene, int16 x, int1 uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam ¶m) { switch (messageNum) { case 0x2000: - _flag1 = param.asInteger() != 0; + _isSittingInTeleporter = param.asInteger() != 0; break; case 0x4001: case 0x4800: sub41C930(param.asPoint().x, false); break; case 0x4004: - if (_flag1) + if (_isSittingInTeleporter) GotoState(&Klayman::sub421350); else GotoState(&Klayman::stTryStandIdle); @@ -2703,25 +2699,25 @@ uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam ¶m) { sub41C7B0(); break; case 0x481D: - if (_flag1) - GotoState(&Klayman::sub4214D0); + if (_isSittingInTeleporter) + GotoState(&Klayman::stTurnToUseInTeleporter); break; case 0x481E: - if (_flag) - GotoState(&Klayman::sub421510); + if (_isSittingInTeleporter)//CHECKME + GotoState(&Klayman::stReturnFromUseInTeleporter); break; case 0x4834: GotoState(&Klayman::stStepOver); break; case 0x4835: sendMessage(_parentScene, 0x2000, 1); - _flag1 = true; + _isSittingInTeleporter = true; GotoState(&Klayman::stSitInTeleporter); break; case 0x4836: sendMessage(_parentScene, 0x2000, 0); - _flag1 = false; - GotoState(&Klayman::sub421310); + _isSittingInTeleporter = false; + GotoState(&Klayman::stGetUpFromTeleporter); break; case 0x483D: sub461F30(); @@ -2749,20 +2745,20 @@ uint32 KmScene1109::handleMessage461EA0(int messageNum, const MessageParam ¶ void KmScene1109::sub461F30() { _status2 = 0; - _flagE5 = false; + _acceptInput = false; SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene1109::handleMessage461EA0); - setFileHash(0x2C2A4A1C, 0, -1); + startAnimation(0x2C2A4A1C, 0, -1); } void KmScene1109::sub461F70() { _status2 = 0; - _flagE5 = false; + _acceptInput = false; SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene1109::handleMessage461EA0); - setFileHash(0x3C2E4245, 0, -1); + startAnimation(0x3C2E4245, 0, -1); } // KmScene1201 @@ -2770,7 +2766,7 @@ void KmScene1109::sub461F70() { KmScene1201::KmScene1201(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, Entity *class464) : Klayman(vm, parentScene, x, y, 1000, 1000), _class464(class464), _countdown(0) { - // TODO setKlaymanTable(dword_4AEF10, 3); + // TODO setKlaymanIdleTable(dword_4AEF10, 3); _flagF6 = true; } @@ -2785,7 +2781,7 @@ uint32 KmScene1201::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klayman::stTryStandIdle); break; case 0x480A: - GotoState(&KmScene1201::sub40DF00); + GotoState(&KmScene1201::stMoveObject); break; case 0x4812: GotoState(&Klayman::stPickUpGeneric); @@ -2819,7 +2815,7 @@ uint32 KmScene1201::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klayman::stTurnToUse); break; case 0x481E: - GotoState(&Klayman::sub4207F0); + GotoState(&Klayman::stReturnFromUse); break; case 0x481F: GotoState(&Klayman::stWonderAbout); @@ -2867,9 +2863,9 @@ uint32 KmScene1201::hmMatch(int messageNum, const MessageParam ¶m, Entity *s void KmScene1201::stFetchMatch() { if (!stStartAction(AnimationCallback(&KmScene1201::stFetchMatch))) { _status2 = 0; - _flagE5 = false; + _acceptInput = false; setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0); - setFileHash(0x9CAA0218, 0, -1); + startAnimation(0x9CAA0218, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene1201::hmMatch); @@ -2879,15 +2875,15 @@ void KmScene1201::stFetchMatch() { void KmScene1201::stLightMatch() { _status2 = 1; - _flagE5 = false; + _acceptInput = false; setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0); - setFileHash(0x1222A513, 0, -1); + startAnimation(0x1222A513, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene1201::hmMatch); } -uint32 KmScene1201::handleMessage40DDF0(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 KmScene1201::hmMoveObject(int messageNum, const MessageParam ¶m, Entity *sender) { switch (messageNum) { case 0x100D: if (param.asInteger() == 0x01084280) { @@ -2920,33 +2916,33 @@ uint32 KmScene1201::hmTumbleHeadless(int messageNum, const MessageParam ¶m, return messageResult; } -void KmScene1201::sub40DF00() { - if (!stStartAction(AnimationCallback(&KmScene1201::sub40DF00))) { +void KmScene1201::stMoveObject() { + if (!stStartAction(AnimationCallback(&KmScene1201::stMoveObject))) { _status2 = 2; - _flagE5 = false; + _acceptInput = false; _countdown = 8; setDoDeltaX(0); - setFileHash(0x0C1CA072, 0, -1); + startAnimation(0x0C1CA072, 0, -1); SetUpdateHandler(&KmScene1201::update40DBE0); SetSpriteCallback(&AnimatedSprite::updateDeltaXY); - SetMessageHandler(&KmScene1201::handleMessage40DDF0); + SetMessageHandler(&KmScene1201::hmMoveObject); } } void KmScene1201::stMoveObjectSkipTurn() { - _flagE5 = false; - setFileHash2(0x0C1CA072, 0x01084280, 0); + _acceptInput = false; + startAnimationByHash(0x0C1CA072, 0x01084280, 0); SetUpdateHandler(&KmScene1201::update40DBE0); SetSpriteCallback(&AnimatedSprite::updateDeltaXY); - SetMessageHandler(&KmScene1201::handleMessage40DDF0); + SetMessageHandler(&KmScene1201::hmMoveObject); } void KmScene1201::stTumbleHeadless() { if (!stStartActionFromIdle(AnimationCallback(&KmScene1201::stTumbleHeadless))) { _status2 = 1; - _flagE5 = false; + _acceptInput = false; setDoDeltaX(0); - setFileHash(0x2821C590, 0, -1); + startAnimation(0x2821C590, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&AnimatedSprite::updateDeltaXY); SetMessageHandler(&KmScene1201::hmTumbleHeadless); @@ -2959,8 +2955,8 @@ void KmScene1201::stTumbleHeadless() { void KmScene1201::sub40E040() { if (!stStartActionFromIdle(AnimationCallback(&KmScene1201::sub40E040))) { _status2 = 1; - _flagE5 = false; - setFileHash(0x5420E254, 0, -1); + _acceptInput = false; + startAnimation(0x5420E254, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&Klayman::handleMessage41D360); @@ -3015,8 +3011,8 @@ void KmScene1303::update4161A0() { void KmScene1303::stPeekWall1() { _status2 = 0; - _flagE5 = true; - setFileHash(0xAC20C012, 8, 37); + _acceptInput = true; + startAnimation(0xAC20C012, 8, 37); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&Klayman::handleMessage41D480); @@ -3025,8 +3021,8 @@ void KmScene1303::stPeekWall1() { void KmScene1303::stPeekWall2() { _status2 = 1; - _flagE5 = false; - setFileHash(0xAC20C012, 43, 49); + _acceptInput = false; + startAnimation(0xAC20C012, 43, 49); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&Klayman::handleMessage41D480); @@ -3035,19 +3031,19 @@ void KmScene1303::stPeekWall2() { void KmScene1303::stPeekWall3() { _counter3 = 0; _status2 = 0; - _flagE5 = true; + _acceptInput = true; _counter3Max = _vm->_rnd->getRandomNumber(64) + 24; - setFileHash(0xAC20C012, 38, 42); + startAnimation(0xAC20C012, 38, 42); SetUpdateHandler(&KmScene1303::update4161A0); SetSpriteCallback(NULL); SetMessageHandler(&Klayman::handleMessage41D360); - _newHashListIndex = 42; + _newStickFrameIndex = 42; } void KmScene1303::stPeekWallReturn() { _status2 = 0; - _flagE5 = false; - setFileHash(0x2426932E, 0, -1); + _acceptInput = false; + startAnimation(0x2426932E, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene1303::hmPeekWallReturn); @@ -3136,8 +3132,8 @@ uint32 KmScene1305::xHandleMessage(int messageNum, const MessageParam ¶m) { void KmScene1305::stCrashDown() { _soundResource1.play(0x41648271); _status2 = 1; - _flagE5 = false; - setFileHash2(0x000BAB02, 0x88003000, 0); + _acceptInput = false; + startAnimationByHash(0x000BAB02, 0x88003000, 0); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&Klayman::handleMessage41D480); @@ -3152,21 +3148,21 @@ void KmScene1305::cbCrashDownEvent() { KmScene1306::KmScene1306(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { - _flag1 = false; + _isSittingInTeleporter = false; } uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) { uint32 messageResult = 0; switch (messageNum) { case 0x2000: - _flag1 = param.asInteger() != 0; + _isSittingInTeleporter = param.asInteger() != 0; break; case 0x4001: case 0x4800: sub41C930(param.asPoint().x, false); break; case 0x4004: - if (_flag1) + if (_isSittingInTeleporter) GotoState(&Klayman::sub421350); else GotoState(&Klayman::stTryStandIdle); @@ -3194,7 +3190,7 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) { sub41C7B0(); break; case 0x481A: - GotoState(&Klayman::sub420680); + GotoState(&Klayman::stInsertDisk); break; case 0x481B: if (param.asPoint().y != 0) { @@ -3204,16 +3200,16 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) { } break; case 0x481D: - if (_flag1) - GotoState(&Klayman::sub4214D0); + if (_isSittingInTeleporter) + GotoState(&Klayman::stTurnToUseInTeleporter); else GotoState(&Klayman::stTurnToUse); break; case 0x481E: - if (_flag1) - GotoState(&Klayman::sub421510); + if (_isSittingInTeleporter) + GotoState(&Klayman::stReturnFromUseInTeleporter); else - GotoState(&Klayman::sub4207F0); + GotoState(&Klayman::stReturnFromUse); break; case 0x481F: if (param.asInteger() == 1) { @@ -3234,16 +3230,16 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x482E: if (param.asInteger() == 1) { - GotoState(&Klayman::sub421030); + GotoState(&Klayman::stWalkToFrontNoStep); } else { - GotoState(&Klayman::sub420FE0); + GotoState(&Klayman::stWalkToFront); } break; case 0x482F: if (param.asInteger() == 1) { - GotoState(&Klayman::sub4210C0); + GotoState(&Klayman::stTurnToFront); } else { - GotoState(&Klayman::sub421070); + GotoState(&Klayman::stTurnToBack); } break; case 0x4834: @@ -3251,13 +3247,13 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4835: sendMessage(_parentScene, 0x2000, 1); - _flag1 = true; + _isSittingInTeleporter = true; GotoState(&Klayman::stSitInTeleporter); break; case 0x4836: sendMessage(_parentScene, 0x2000, 0); - _flag1 = false; - GotoState(&Klayman::sub421310); + _isSittingInTeleporter = false; + GotoState(&Klayman::stGetUpFromTeleporter); break; case 0x483D: sub417D40(); @@ -3277,8 +3273,8 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) { void KmScene1306::sub417D40() { _status2 = 0; - _flagE5 = false; - setFileHash(0xEE084A04, 0, -1); + _acceptInput = false; + startAnimation(0xEE084A04, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene1306::handleMessage417CB0); @@ -3286,8 +3282,8 @@ void KmScene1306::sub417D40() { void KmScene1306::sub417D80() { _status2 = 0; - _flagE5 = false; - setFileHash(0xB86A4274, 0, -1); + _acceptInput = false; + startAnimation(0xB86A4274, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene1306::handleMessage417CB0); @@ -3307,9 +3303,9 @@ uint32 KmScene1306::handleMessage417CB0(int messageNum, const MessageParam ¶ } KmScene1308::KmScene1308(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) - : Klayman(vm, parentScene, x, y, 1000, 1000) { - - _flag1 = false; + : Klayman(vm, parentScene, x, y, 1000, 1000), _flag1(false) { + + // Empty } uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -3329,7 +3325,7 @@ uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam ¶m) { } break; case 0x480D: - GotoState(&KmScene1001::sub420C50); + GotoState(&KmScene1001::stUseLever); break; case 0x4812: if (param.asInteger() == 2) { @@ -3348,7 +3344,7 @@ uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam ¶m) { if (param.asInteger() == 1) { GotoState(&KmScene1308::sub456150); } else { - GotoState(&Klayman::sub420680); + GotoState(&Klayman::stInsertDisk); } break; case 0x481B: @@ -3362,10 +3358,10 @@ uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klayman::stTurnToUse); break; case 0x481E: - GotoState(&Klayman::sub4207F0); + GotoState(&Klayman::stReturnFromUse); break; case 0x4827: - GotoState(&Klayman::sub420E20); + GotoState(&Klayman::stReleaseLever); break; case 0x4834: GotoState(&Klayman::stStepOver); @@ -3385,10 +3381,10 @@ uint32 KmScene1308::handleMessage(int messageNum, const MessageParam ¶m, Ent switch (messageNum) { case 0x100D: if (!_flag1 && param.asInteger() == 0x06040580) { - setFileHash3(0xDC409440, 0x46431401, 0); + nextAnimationByHash(0xDC409440, 0x46431401, 0); } else if (_flag1 && param.asInteger() == 0x46431401) { _flag1 = false; - setFileHash2(0xDC409440, 0x01084280, 0); + startAnimationByHash(0xDC409440, 0x01084280, 0); } else if (param.asInteger() == 0x062A1510) { _soundResource1.play(0x41688704); } else if (param.asInteger() == 0x02B20220) { @@ -3431,8 +3427,8 @@ void KmScene1308::sub456150() { gotoState(NULL); sub41C7B0(); } else { - _flagE5 = false; - setFileHash(0xDC409440, 0, -1); + _acceptInput = false; + startAnimation(0xDC409440, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F250); SetMessageHandler(&KmScene1308::handleMessage); @@ -3500,16 +3496,16 @@ uint32 KmScene1401::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x482E: if (param.asInteger() == 1) { - GotoState(&Klayman::sub421030); + GotoState(&Klayman::stWalkToFrontNoStep); } else { - GotoState(&Klayman::sub420FE0); + GotoState(&Klayman::stWalkToFront); } break; case 0x482F: if (param.asInteger() == 1) { - GotoState(&Klayman::sub4210C0); + GotoState(&Klayman::stTurnToFront); } else { - GotoState(&Klayman::sub421070); + GotoState(&Klayman::stTurnToBack); } break; } @@ -3555,7 +3551,7 @@ uint32 KmScene1402::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klayman::stTurnToUse); break; case 0x481E: - GotoState(&Klayman::sub4207F0); + GotoState(&Klayman::stReturnFromUse); break; } return 0; @@ -3566,7 +3562,7 @@ uint32 KmScene1402::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1403::KmScene1403(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { - setKlaymanTable(klaymanTable4, ARRAYSIZE(klaymanTable4)); + setKlaymanIdleTable(klaymanTable4, ARRAYSIZE(klaymanTable4)); } uint32 KmScene1403::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -3586,7 +3582,7 @@ uint32 KmScene1403::xHandleMessage(int messageNum, const MessageParam ¶m) { } break; case 0x480D: - GotoState(&KmScene1001::sub420C50); + GotoState(&KmScene1001::stUseLever); break; case 0x4812: if (param.asInteger() == 2) { @@ -3609,7 +3605,7 @@ uint32 KmScene1403::xHandleMessage(int messageNum, const MessageParam ¶m) { } break; case 0x4827: - GotoState(&Klayman::sub420E20); + GotoState(&Klayman::stReleaseLever); break; case 0x483F: sub41CD00(param.asInteger()); @@ -3659,7 +3655,7 @@ uint32 KmScene1404::xHandleMessage(int messageNum, const MessageParam ¶m) { sub41C7B0(); break; case 0x481A: - GotoState(&Klayman::sub420680); + GotoState(&Klayman::stInsertDisk); break; case 0x481B: if (param.asPoint().y != 0) { @@ -3672,7 +3668,7 @@ uint32 KmScene1404::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klayman::stTurnToUse); break; case 0x481E: - GotoState(&Klayman::sub4207F0); + GotoState(&Klayman::stReturnFromUse); break; case 0x481F: if (param.asInteger() == 1) { @@ -3702,20 +3698,20 @@ uint32 KmScene1404::xHandleMessage(int messageNum, const MessageParam ¶m) { } KmScene1608::KmScene1608(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) - : Klayman(vm, parentScene, x, y, 1000, 1000), _flag1(false) { + : Klayman(vm, parentScene, x, y, 1000, 1000), _isSittingInTeleporter(false) { } uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam ¶m) { switch (messageNum) { case 0x2032: - _flag1 = param.asInteger() != 0; + _isSittingInTeleporter = param.asInteger() != 0; break; case 0x4001: case 0x4800: sub41C930(param.asPoint().x, false); break; case 0x4004: - if (_flag1) + if (_isSittingInTeleporter) GotoState(&Klayman::sub421350); else GotoState(&Klayman::stTryStandIdle); @@ -3741,12 +3737,12 @@ uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam ¶m) { } break; case 0x481D: - if (_flag1) - GotoState(&Klayman::sub4214D0); + if (_isSittingInTeleporter) + GotoState(&Klayman::stTurnToUseInTeleporter); break; case 0x481E: - if (_flag) - GotoState(&Klayman::sub421510); + if (_isSittingInTeleporter)//CHECKME + GotoState(&Klayman::stReturnFromUseInTeleporter); break; case 0x481F: if (param.asInteger() == 1) { @@ -3770,13 +3766,13 @@ uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4835: sendMessage(_parentScene, 0x2032, 1); - _flag1 = true; + _isSittingInTeleporter = true; GotoState(&Klayman::stSitInTeleporter); break; case 0x4836: sendMessage(_parentScene, 0x2032, 0); - _flag1 = false; - GotoState(&Klayman::sub421310); + _isSittingInTeleporter = false; + GotoState(&Klayman::stGetUpFromTeleporter); break; case 0x483F: sub41CD00(param.asInteger()); @@ -3791,7 +3787,7 @@ uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam ¶m) { // KmScene1705 KmScene1705::KmScene1705(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) - : Klayman(vm, parentScene, x, y, 1000, 1000), _flag(false) { + : Klayman(vm, parentScene, x, y, 1000, 1000), _isSittingInTeleporter(false) { // Empty } @@ -3800,7 +3796,7 @@ uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam ¶m) { uint32 messageResult = 0; switch (messageNum) { case 0x2000: - _flag = param.asInteger() != 0; + _isSittingInTeleporter = param.asInteger() != 0; messageResult = 1; break; case 0x4001: @@ -3808,7 +3804,7 @@ uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam ¶m) { sub41C930(param.asPoint().x, false); break; case 0x4004: - if (_flag) { + if (_isSittingInTeleporter) { GotoState(&Klayman::sub421350); } else { GotoState(&Klayman::stTryStandIdle); @@ -3838,13 +3834,13 @@ uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam ¶m) { } break; case 0x481D: - if (_flag) { - GotoState(&Klayman::sub4214D0); + if (_isSittingInTeleporter) { + GotoState(&Klayman::stTurnToUseInTeleporter); } break; case 0x481E: - if (_flag) { - GotoState(&Klayman::sub421510); + if (_isSittingInTeleporter) { + GotoState(&Klayman::stReturnFromUseInTeleporter); } break; case 0x481F: @@ -3865,13 +3861,13 @@ uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4835: sendMessage(_parentScene, 0x2000, 1); - _flag = true; + _isSittingInTeleporter = true; GotoState(&Klayman::stSitInTeleporter); break; case 0x4836: sendMessage(_parentScene, 0x2000, 0); - _flag = false; - GotoState(&Klayman::sub421310); + _isSittingInTeleporter = false; + GotoState(&Klayman::stGetUpFromTeleporter); break; case 0x483D: sub468AD0(); @@ -3909,8 +3905,8 @@ void KmScene1705::spriteUpdate468A30() { void KmScene1705::stFallSkipJump() { _status2 = 2; - _flagE5 = false; - setFileHash2(0xB93AB151, 0x40A100F8, 0); + _acceptInput = false; + startAnimationByHash(0xB93AB151, 0x40A100F8, 0); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&KmScene1705::spriteUpdate468A30); SetMessageHandler(&Klayman::handleMessage41D360); @@ -3919,8 +3915,8 @@ void KmScene1705::stFallSkipJump() { void KmScene1705::sub468AD0() { _status2 = 0; - _flagE5 = false; - setFileHash(0x5E0A4905, 0, -1); + _acceptInput = false; + startAnimation(0x5E0A4905, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene1705::handleMessage4689A0); @@ -3928,8 +3924,8 @@ void KmScene1705::sub468AD0() { void KmScene1705::sub468B10() { _status2 = 0; - _flagE5 = false; - setFileHash(0xD86E4477, 0, -1); + _acceptInput = false; + startAnimation(0xD86E4477, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene1705::handleMessage4689A0); @@ -3958,7 +3954,7 @@ uint32 KmScene1901::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klayman::stTurnToUse); break; case 0x481E: - GotoState(&Klayman::sub4207F0); + GotoState(&Klayman::stReturnFromUse); break; case 0x482D: setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); @@ -3975,7 +3971,7 @@ uint32 KmScene1901::xHandleMessage(int messageNum, const MessageParam ¶m) { } KmScene2001::KmScene2001(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) - : Klayman(vm, parentScene, x, y, 1000, 1000), _flag(false) { + : Klayman(vm, parentScene, x, y, 1000, 1000), _isSittingInTeleporter(false) { // Empty } @@ -3983,14 +3979,14 @@ KmScene2001::KmScene2001(NeverhoodEngine *vm, Entity *parentScene, int16 x, int1 uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam ¶m) { switch (messageNum) { case 0x2000: - _flag = param.asInteger() != 0; + _isSittingInTeleporter = param.asInteger() != 0; break; case 0x4001: case 0x4800: sub41C930(param.asPoint().x, false); break; case 0x4004: - if (_flag) { + if (_isSittingInTeleporter) { GotoState(&Klayman::sub421350); } else { GotoState(&Klayman::stTryStandIdle); @@ -4009,13 +4005,13 @@ uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam ¶m) { sub41C7B0(); break; case 0x481D: - if (_flag) { - GotoState(&Klayman::sub4214D0); + if (_isSittingInTeleporter) { + GotoState(&Klayman::stTurnToUseInTeleporter); } break; case 0x481E: - if (_flag) { - GotoState(&Klayman::sub421510); + if (_isSittingInTeleporter) { + GotoState(&Klayman::stReturnFromUseInTeleporter); } break; case 0x4834: @@ -4023,13 +4019,13 @@ uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4835: sendMessage(_parentScene, 0x2000, 1); - _flag = true; + _isSittingInTeleporter = true; GotoState(&Klayman::stSitInTeleporter); break; case 0x4836: sendMessage(_parentScene, 0x2000, 0); - _flag = false; - GotoState(&Klayman::sub421310); + _isSittingInTeleporter = false; + GotoState(&Klayman::stGetUpFromTeleporter); break; case 0x483D: sub440230(); @@ -4057,8 +4053,8 @@ uint32 KmScene2001::handleMessage4401A0(int messageNum, const MessageParam ¶ void KmScene2001::sub440230() { _status2 = 0; - _flagE5 = false; - setFileHash(0xBE68CC54, 0, -1); + _acceptInput = false; + startAnimation(0xBE68CC54, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene2001::handleMessage4401A0); @@ -4066,15 +4062,15 @@ void KmScene2001::sub440230() { void KmScene2001::stDoTeleport() { _status2 = 0; - _flagE5 = false; - setFileHash(0x18AB4ED4, 0, -1); + _acceptInput = false; + startAnimation(0x18AB4ED4, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene2001::handleMessage4401A0); } KmScene2101::KmScene2101(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) - : Klayman(vm, parentScene, x, y, 1000, 1000), _flag1(false) { + : Klayman(vm, parentScene, x, y, 1000, 1000), _isSittingInTeleporter(false) { // Empty } @@ -4083,7 +4079,7 @@ uint32 KmScene2101::xHandleMessage(int messageNum, const MessageParam ¶m) { uint32 messageResult = 0; switch (messageNum) { case 0x2000: - _flag1 = param.asInteger() != 0; + _isSittingInTeleporter = param.asInteger() != 0; messageResult = 1; break; case 0x4001: @@ -4091,7 +4087,7 @@ uint32 KmScene2101::xHandleMessage(int messageNum, const MessageParam ¶m) { sub41C930(param.asPoint().x, false); break; case 0x4004: - if (_flag1) + if (_isSittingInTeleporter) GotoState(&Klayman::sub421350); else GotoState(&Klayman::stTryStandIdle); @@ -4129,25 +4125,25 @@ uint32 KmScene2101::xHandleMessage(int messageNum, const MessageParam ¶m) { } break; case 0x481D: - if (_flag1) - GotoState(&Klayman::sub4214D0); + if (_isSittingInTeleporter) + GotoState(&Klayman::stTurnToUseInTeleporter); break; case 0x481E: - if (_flag) - GotoState(&Klayman::sub421510); + if (_isSittingInTeleporter)//CHECKME + GotoState(&Klayman::stReturnFromUseInTeleporter); break; case 0x4834: GotoState(&Klayman::stStepOver); break; case 0x4835: sendMessage(_parentScene, 0x2000, 1); - _flag1 = true; + _isSittingInTeleporter = true; GotoState(&Klayman::stSitInTeleporter); break; case 0x4836: sendMessage(_parentScene, 0x2000, 0); - _flag1 = false; - GotoState(&Klayman::sub421310); + _isSittingInTeleporter = false; + GotoState(&Klayman::stGetUpFromTeleporter); break; case 0x483D: sub486320(); @@ -4165,8 +4161,8 @@ uint32 KmScene2101::handleMessage486160(int messageNum, const MessageParam ¶ switch (messageNum) { case 0x1008: speedUpFrameIndex = getFrameIndex(kKlaymanSpeedUpHash); - if (_frameIndex < speedUpFrameIndex) { - setFileHash(0x35AA8059, speedUpFrameIndex, -1); + if (_currFrameIndex < speedUpFrameIndex) { + startAnimation(0x35AA8059, speedUpFrameIndex, -1); _y = 438; } messageResult = 0; @@ -4198,8 +4194,8 @@ uint32 KmScene2101::handleMessage486230(int messageNum, const MessageParam ¶ void KmScene2101::sub4862C0() { _status2 = 1; - _flagE5 = false; - setFileHash(0x35AA8059, 0, -1); + _acceptInput = false; + startAnimation(0x35AA8059, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&AnimatedSprite::updateDeltaXY); SetMessageHandler(&KmScene2101::handleMessage486160); @@ -4208,8 +4204,8 @@ void KmScene2101::sub4862C0() { void KmScene2101::sub486320() { _status2 = 0; - _flagE5 = false; - setFileHash(0xFF290E30, 0, -1); + _acceptInput = false; + startAnimation(0xFF290E30, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene2101::handleMessage486230); @@ -4217,8 +4213,8 @@ void KmScene2101::sub486320() { void KmScene2101::sub486360() { _status2 = 0; - _flagE5 = false; - setFileHash(0x9A28CA1C, 0, -1); + _acceptInput = false; + startAnimation(0x9A28CA1C, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(NULL); SetMessageHandler(&KmScene2101::handleMessage486230); @@ -4267,7 +4263,7 @@ uint32 KmScene2201::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klayman::stTurnToUse); break; case 0x481E: - GotoState(&Klayman::sub4207F0); + GotoState(&Klayman::stReturnFromUse); break; case 0x482D: setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); @@ -4275,16 +4271,16 @@ uint32 KmScene2201::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x482E: if (param.asInteger() == 1) { - GotoState(&Klayman::sub421030); + GotoState(&Klayman::stWalkToFrontNoStep); } else { - GotoState(&Klayman::sub420FE0); + GotoState(&Klayman::stWalkToFront); } break; case 0x482F: if (param.asInteger() == 1) { - GotoState(&Klayman::sub4210C0); + GotoState(&Klayman::stTurnToFront); } else { - GotoState(&Klayman::sub421070); + GotoState(&Klayman::stTurnToBack); } break; case 0x483F: @@ -4337,10 +4333,10 @@ uint32 KmScene2203::xHandleMessage(int messageNum, const MessageParam ¶m) { sub41C930(_dataResource.getPoint(param.asInteger()).x, false); break; case 0x4819: - GotoState(&Klayman::sub420750); + GotoState(&Klayman::stClayDoorOpen); break; case 0x481A: - GotoState(&Klayman::sub420680); + GotoState(&Klayman::stInsertDisk); break; case 0x481B: if (param.asPoint().y != 0) { @@ -4353,7 +4349,7 @@ uint32 KmScene2203::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klayman::stTurnToUse); break; case 0x481E: - GotoState(&Klayman::sub4207F0); + GotoState(&Klayman::stReturnFromUse); break; case 0x482D: setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); @@ -4375,7 +4371,7 @@ KmScene2205::KmScene2205(NeverhoodEngine *vm, Entity *parentScene, int16 x, int1 } void KmScene2205::xUpdate() { - setGlobalVar(0x18288913, _frameIndex); + setGlobalVar(0x18288913, _currFrameIndex); } uint32 KmScene2205::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -4423,12 +4419,12 @@ void KmScene2205::sub423980() { frameIndex = 0; _status2 = 0; _flagE1 = true; - _flagE5 = true; - setFileHash(0x1A249001, frameIndex, -1); + _acceptInput = true; + startAnimation(0x1A249001, frameIndex, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41EB70); SetSpriteCallback(&Klayman::spriteUpdate41F300); - NextState(&Klayman::sub41FA40); + NextState(&Klayman::stUpdateWalking); FinalizeState(&Klayman::stStartWalkingDone); } @@ -4443,7 +4439,7 @@ KmScene2206::~KmScene2206() { } void KmScene2206::xUpdate() { - setGlobalVar(0x18288913, _frameIndex); + setGlobalVar(0x18288913, _currFrameIndex); } uint32 KmScene2206::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -4512,16 +4508,16 @@ uint32 KmScene2206::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x482E: if (param.asInteger() == 1) { - GotoState(&Klayman::sub421030); + GotoState(&Klayman::stWalkToFrontNoStep); } else { - GotoState(&Klayman::sub420FE0); + GotoState(&Klayman::stWalkToFront); } break; case 0x482F: if (param.asInteger() == 1) { - GotoState(&Klayman::sub4210C0); + GotoState(&Klayman::stTurnToFront); } else { - GotoState(&Klayman::sub421070); + GotoState(&Klayman::stTurnToBack); } break; case 0x4837: @@ -4549,9 +4545,9 @@ void KmScene2206::sub482490() { if (!stStartActionFromIdle(AnimationCallback(&KmScene2206::sub482490))) { _status2 = 1; sendMessage(_parentScene, 0x4803, 0); - _flagE5 = false; + _acceptInput = false; _yDelta = 0; - setFileHash(0x5420E254, 0, -1); + startAnimation(0x5420E254, 0, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41D360); SetSpriteCallback(&KmScene2206::spriteUpdate482450); @@ -4565,12 +4561,12 @@ void KmScene2206::sub482530() { frameIndex = 0; _status2 = 0; _flagE1 = true; - _flagE5 = true; - setFileHash(0x1A249001, frameIndex, -1); + _acceptInput = true; + startAnimation(0x1A249001, frameIndex, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41EB70); SetSpriteCallback(&Klayman::spriteUpdate41F300); - NextState(&Klayman::sub41FA40); + NextState(&Klayman::stUpdateWalking); FinalizeState(&Klayman::stStartWalkingDone); } @@ -4622,7 +4618,7 @@ uint32 KmScene2207::xHandleMessage(int messageNum, const MessageParam ¶m) { } break; case 0x4827: - GotoState(&Klayman::sub420E20); + GotoState(&Klayman::stReleaseLever); break; case 0x482D: setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); @@ -4647,8 +4643,8 @@ void KmScene2207::spriteUpdate442430() { void KmScene2207::sub442460() { if (!stStartActionFromIdle(AnimationCallback(&KmScene2207::sub442460))) { _status2 = 1; - _flagE5 = true; - setFileHash(0x5420E254, 0, -1); + _acceptInput = true; + startAnimation(0x5420E254, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&KmScene2207::spriteUpdate442430); SetMessageHandler(&Klayman::handleMessage41D360); @@ -4658,11 +4654,11 @@ void KmScene2207::sub442460() { void KmScene2207::sub4424B0() { if (!stStartAction(AnimationCallback(&KmScene2207::sub4424B0))) { _status2 = 0; - if (_flagF7) { - stReleaseLeverUp(); + if (_isLeverDown) { + stUseLeverRelease(); } else { - _flagE5 = false; - setFileHash(0x0C303040, 0, -1); + _acceptInput = false; + startAnimation(0x0C303040, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&KmScene2207::spriteUpdate41F230); SetMessageHandler(&Klayman::handleMessage41E210); @@ -4672,27 +4668,27 @@ void KmScene2207::sub4424B0() { } void KmScene2207::sub442520() { - setFileHash(0x0D318140, 0, -1); + startAnimation(0x0D318140, 0, -1); sendMessage(_attachedSprite, 0x480F, 0); NextState(&KmScene2207::sub442560); } void KmScene2207::sub442560() { - setFileHash(0x1564A2C0, 0, -1); + startAnimation(0x1564A2C0, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); NextState(&KmScene2207::sub4425A0); - _flagE5 = true; - _flagF7 = true; + _acceptInput = true; + _isLeverDown = true; } void KmScene2207::sub4425A0() { - setFileHash(0x4464A440, 0, -1); + startAnimation(0x4464A440, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); SetMessageHandler(&Klayman::handleMessage41D360); - _flagE5 = true; - _flagF7 = true; + _acceptInput = true; + _isLeverDown = true; } KmScene2242::KmScene2242(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) @@ -4701,7 +4697,7 @@ KmScene2242::KmScene2242(NeverhoodEngine *vm, Entity *parentScene, int16 x, int1 } void KmScene2242::xUpdate() { - setGlobalVar(0x18288913, _frameIndex); + setGlobalVar(0x18288913, _currFrameIndex); } uint32 KmScene2242::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -4771,12 +4767,12 @@ void KmScene2242::sub444D20() { frameIndex = 0; _status2 = 0; _flagE1 = true; - _flagE5 = true; - setFileHash(0x1A249001, frameIndex, -1); + _acceptInput = true; + startAnimation(0x1A249001, frameIndex, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41EB70); SetSpriteCallback(&Klayman::spriteUpdate41F300); - NextState(&Klayman::sub41FA40); + NextState(&Klayman::stUpdateWalking); FinalizeState(&Klayman::stStartWalkingDone); } @@ -4786,7 +4782,7 @@ KmHallOfRecords::KmHallOfRecords(NeverhoodEngine *vm, Entity *parentScene, int16 } void KmHallOfRecords::xUpdate() { - setGlobalVar(0x18288913, _frameIndex); + setGlobalVar(0x18288913, _currFrameIndex); } uint32 KmHallOfRecords::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -4840,12 +4836,12 @@ void KmHallOfRecords::sub43B130() { frameIndex = 0; _status2 = 0; _flagE1 = true; - _flagE5 = true; - setFileHash(0x1A249001, frameIndex, -1); + _acceptInput = true; + startAnimation(0x1A249001, frameIndex, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41EB70); SetSpriteCallback(&Klayman::spriteUpdate41F300); - NextState(&Klayman::sub41FA40); + NextState(&Klayman::stUpdateWalking); FinalizeState(&Klayman::stStartWalkingDone); } @@ -4855,7 +4851,7 @@ KmScene2247::KmScene2247(NeverhoodEngine *vm, Entity *parentScene, int16 x, int1 } void KmScene2247::xUpdate() { - setGlobalVar(0x18288913, _frameIndex); + setGlobalVar(0x18288913, _currFrameIndex); } uint32 KmScene2247::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -4909,12 +4905,12 @@ void KmScene2247::sub453520() { frameIndex = 0; _status2 = 0; _flagE1 = true; - _flagE5 = true; - setFileHash(0x1A249001, frameIndex, -1); + _acceptInput = true; + startAnimation(0x1A249001, frameIndex, -1); SetUpdateHandler(&Klayman::update); SetMessageHandler(&Klayman::handleMessage41EB70); SetSpriteCallback(&Klayman::spriteUpdate41F300); - NextState(&Klayman::sub41FA40); + NextState(&Klayman::stUpdateWalking); FinalizeState(&Klayman::stStartWalkingDone); } diff --git a/engines/neverhood/klayman.h b/engines/neverhood/klayman.h index 645ed74226..3b8ee69262 100644 --- a/engines/neverhood/klayman.h +++ b/engines/neverhood/klayman.h @@ -36,7 +36,7 @@ class Klayman; const uint32 kKlaymanSpeedUpHash = 0x004A2148; -struct KlaymanTableItem { +struct KlaymanIdleTableItem { int value; void (Klayman::*callback)(); }; @@ -66,61 +66,61 @@ public: void stTurnAwayFromUse(); void stWonderAbout(); void stPeekWall(); - void sub420210(); - void sub4201C0(); + void stJumpToRing1(); + void setupJumpToRing(); void sub420340(); - void sub420250(); - void sub420290(); - void sub420380(); - void sub4203C0(); - void sub420300(); - void sub420970(); + void stJumpToRing2(); + void stJumpToRing3(); + void stHoldRing(); + void stReleaseRing(); + void stJumpToRing4(); + void stContinueClimbLadderUp(); void sub4209D0(); void sub420BC0(); void sub420AD0(); - void sub421030(); - void sub420FE0(); - void sub4210C0(); - void sub421070(); + void stWalkToFrontNoStep(); + void stWalkToFront(); + void stTurnToFront(); + void stTurnToBack(); void stLandOnFeet(); - void sub420ED0(); - void sub420750(); + void stTurnToBackToUse(); + void stClayDoorOpen(); void stTurnToUse(); - void sub4207F0(); - void sub420F20(); + void stReturnFromUse(); + void stWalkingOpenDoor(); void sub421350(); void stIdleSitBlink(); void stIdleSitBlinkSecond(); void stPickUpNeedle(); void sub41FFF0(); - void sub4214D0(); - void sub421510(); + void stTurnToUseInTeleporter(); + void stReturnFromUseInTeleporter(); void stStepOver(); void stSitInTeleporter(); - void sub421310(); + void stGetUpFromTeleporter(); void stMoveObjectSkipTurnFaceObject(); void sub420660(); void stMoveObjectSkipTurn(); void stMoveObjectFaceObject(); - void sub420C50(); + void stUseLever(); void stPullLeverDown(); void stHoldLeverDown(); - void stReleaseLeverUp(); - void sub420E20(); - void sub420E90(); - void sub420EB0(); - void sub420680(); + void stUseLeverRelease(); + void stReleaseLever(); + void stLetGoOfLever(); + void cbLeverReleasedEvent(); + void stInsertDisk(); void stWalking(); - void sub41FA40(); + void stUpdateWalking(); void stStartWalkingDone(); void sub41CE70(); void spriteUpdate41F250(); - void spriteUpdate41F5F0(); + void suWalking(); void suLargeStep(); void spriteUpdate41F230(); - void spriteUpdate41F5A0(); + void suWalkingOpenDoor(); void spriteUpdate41F300(); void spriteUpdate41F320(); @@ -129,10 +129,10 @@ public: uint32 handleMessage41EB70(int messageNum, const MessageParam ¶m, Entity *sender); uint32 handleMessage41E210(int messageNum, const MessageParam ¶m, Entity *sender); - void setKlaymanTable(const KlaymanTableItem *table, int tableCount); - void setKlaymanTable1(); - void setKlaymanTable2(); - void setKlaymanTable3(); + void setKlaymanIdleTable(const KlaymanIdleTableItem *table, int tableCount); + void setKlaymanIdleTable1(); + void setKlaymanIdleTable2(); + void setKlaymanIdleTable3(); void setSoundFlag(bool value) { _soundFlag = value; } @@ -144,23 +144,23 @@ protected: bool _flagE2; bool _flagE3; bool _flagE4; - bool _flagE5; + bool _acceptInput; int16 _x4, _y4; int16 _counter, _counterMax; int16 _counter3, _counter3Max; int16 _counter1; int16 _counter2; bool _flagF6; - bool _flagF7; + bool _isLeverDown; bool _flagF8; int _status2; bool _flagFA; SoundResource _soundResource1; SoundResource _soundResource2; int _status3; - const KlaymanTableItem *_table; - int _tableCount; - int _tableMaxValue; + const KlaymanIdleTableItem *_idleTable; + int _idleTableCount; + int _idleTableMaxValue; uint32 _field114; /* 00000118 field118 dw ? @@ -200,7 +200,7 @@ protected: void stStand(); void stStandAround(); - uint32 handleMessage41F140(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmStartAction(int messageNum, const MessageParam ¶m, Entity *sender); void sub41C930(int16 x, bool flag); @@ -209,11 +209,11 @@ protected: bool stStartAction(AnimationCb callback3); void stSneak(); - void stSneakDone(); - uint32 handleMessage41DD80(int messageNum, const MessageParam ¶m, Entity *sender); + void stWalkingDone(); + uint32 hmWalking(int messageNum, const MessageParam ¶m, Entity *sender); void sub41CD70(int16 x); void stStartWalking(); - uint32 handleMessage41EC70(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmStartWalking(int messageNum, const MessageParam ¶m, Entity *sender); uint32 hmPickUpGeneric(int messageNum, const MessageParam ¶m, Entity *sender); @@ -226,24 +226,24 @@ protected: void stLargeStepDone(); uint32 hmLargeStep(int messageNum, const MessageParam ¶m, Entity *sender); - uint32 handleMessage41EEF0(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmTurnToUse(int messageNum, const MessageParam ¶m, Entity *sender); uint32 hmPeekWall(int messageNum, const MessageParam ¶m, Entity *sender); - uint32 handleMessage41D790(int messageNum, const MessageParam ¶m, Entity *sender); - uint32 handleMessage41D880(int messageNum, const MessageParam ¶m, Entity *sender); - uint32 handleMessage41DAA0(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmJumpToRing(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmJumpToRing3(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmHoldRing(int messageNum, const MessageParam ¶m, Entity *sender); uint32 handleMessage41DFD0(int messageNum, const MessageParam ¶m, Entity *sender); uint32 handleMessage41E0D0(int messageNum, const MessageParam ¶m, Entity *sender); - uint32 handleMessage41E490(int messageNum, const MessageParam ¶m, Entity *sender); - uint32 handleMessage41E290(int messageNum, const MessageParam ¶m, Entity *sender); - uint32 handleMessage41E2F0(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmWalkToFront(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmLandOnFeet(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmTurnToBackToUse(int messageNum, const MessageParam ¶m, Entity *sender); uint32 handleMessage41D640(int messageNum, const MessageParam ¶m, Entity *sender); - uint32 handleMessage41EAB0(int messageNum, const MessageParam ¶m, Entity *sender); - uint32 handleMessage41D970(int messageNum, const MessageParam ¶m, Entity *sender); - uint32 handleMessage41DD20(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmSitInTeleporter(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmMoveObjectTurn(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmClayDoorOpen(int messageNum, const MessageParam ¶m, Entity *sender); void update41D1C0(); - uint32 handleMessage41DB90(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmInsertDisk(int messageNum, const MessageParam ¶m, Entity *sender); }; @@ -306,7 +306,7 @@ class KmScene1109 : public Klayman { public: KmScene1109(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); protected: - bool _flag1; + bool _isSittingInTeleporter; uint32 xHandleMessage(int messageNum, const MessageParam ¶m); uint32 handleMessage461EA0(int messageNum, const MessageParam ¶m, Entity *sender); void sub461F30(); @@ -324,9 +324,9 @@ protected: uint32 hmMatch(int messageNum, const MessageParam ¶m, Entity *sender); void stFetchMatch(); void stLightMatch(); - uint32 handleMessage40DDF0(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmMoveObject(int messageNum, const MessageParam ¶m, Entity *sender); uint32 hmTumbleHeadless(int messageNum, const MessageParam ¶m, Entity *sender); - void sub40DF00(); + void stMoveObject(); void stMoveObjectSkipTurn(); void stTumbleHeadless(); void sub40E040(); @@ -365,7 +365,7 @@ class KmScene1306 : public Klayman { public: KmScene1306(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); protected: - bool _flag1; + bool _isSittingInTeleporter; uint32 xHandleMessage(int messageNum, const MessageParam ¶m); uint32 handleMessage417CB0(int messageNum, const MessageParam ¶m, Entity *sender); void sub417D40(); @@ -414,7 +414,7 @@ class KmScene1608 : public Klayman { public: KmScene1608(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); protected: - bool _flag1; + bool _isSittingInTeleporter; uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; @@ -422,7 +422,7 @@ class KmScene1705 : public Klayman { public: KmScene1705(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); protected: - bool _flag; + bool _isSittingInTeleporter; uint32 xHandleMessage(int messageNum, const MessageParam ¶m); uint32 handleMessage4689A0(int messageNum, const MessageParam ¶m, Entity *sender); void spriteUpdate468A30(); @@ -442,7 +442,7 @@ class KmScene2001 : public Klayman { public: KmScene2001(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); protected: - bool _flag; + bool _isSittingInTeleporter; uint32 xHandleMessage(int messageNum, const MessageParam ¶m); uint32 handleMessage4401A0(int messageNum, const MessageParam ¶m, Entity *sender); void sub440230(); @@ -453,7 +453,7 @@ class KmScene2101 : public Klayman { public: KmScene2101(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); protected: - bool _flag1; + bool _isSittingInTeleporter; uint32 xHandleMessage(int messageNum, const MessageParam ¶m); uint32 handleMessage486160(int messageNum, const MessageParam ¶m, Entity *sender); uint32 handleMessage486230(int messageNum, const MessageParam ¶m, Entity *sender); diff --git a/engines/neverhood/module1000.cpp b/engines/neverhood/module1000.cpp index b60c3182d0..ea1400e965 100644 --- a/engines/neverhood/module1000.cpp +++ b/engines/neverhood/module1000.cpp @@ -133,7 +133,7 @@ uint32 AsScene1001Door::handleMessage(int messageNum, const MessageParam ¶m, handleMessage2000h(); break; case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return 0; @@ -144,12 +144,12 @@ void AsScene1001Door::handleMessage2000h() { case 0: case 1: _soundResource1.play(0x65482F03); - setFileHash(0x624C0498, 1, 3); + startAnimation(0x624C0498, 1, 3); NextState(&AsScene1001Door::callback1); break; case 2: _soundResource2.play(); - setFileHash(0x624C0498, 6, 6); + startAnimation(0x624C0498, 6, 6); NextState(&AsScene1001Door::callback2); break; default: @@ -162,27 +162,27 @@ void AsScene1001Door::handleMessage2000h() { void AsScene1001Door::callback1() { switch (getGlobalVar(0x52371C95)) { case 1: - setFileHash(0x624C0498, 4, -1); - _newHashListIndex = 4; + startAnimation(0x624C0498, 4, -1); + _newStickFrameIndex = 4; break; case 2: - setFileHash(0x624C0498, 1, -1); - _newHashListIndex = 1; + startAnimation(0x624C0498, 1, -1); + _newStickFrameIndex = 1; break; case 3: stopAnimation(); setVisible(false); break; default: - setFileHash(0x624C0498, 0, -1); - _newHashListIndex = 0; + startAnimation(0x624C0498, 0, -1); + _newStickFrameIndex = 0; break; } } void AsScene1001Door::callback2() { setGlobalVar(0xD217189D, 1); - setFileHash(0x624C0498, 6, 6); + startAnimation(0x624C0498, 6, 6); NextState(&AsScene1001Door::callback3); _x = 30; } @@ -199,8 +199,8 @@ AsScene1001Hammer::AsScene1001Hammer(NeverhoodEngine *vm, Sprite *asDoor) _x = 547; _y = 206; createSurface(900, 177, 192); - setFileHash(0x022C90D4, -1, -1); - _newHashListIndex = -2; + startAnimation(0x022C90D4, -1, -1); + _newStickFrameIndex = -2; SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene1001Hammer::handleMessage); } @@ -216,9 +216,9 @@ uint32 AsScene1001Hammer::handleMessage(int messageNum, const MessageParam ¶ } break; case 0x2000: - setFileHash(0x022C90D4, 1, -1); + startAnimation(0x022C90D4, 1, -1); _soundResource.play(0xE741020A); - _newHashListIndex = -2; + _newStickFrameIndex = -2; break; } return 0; @@ -230,8 +230,8 @@ AsScene1001Window::AsScene1001Window(NeverhoodEngine *vm) _x = 320; _y = 240; createSurface(100, 66, 129); - setFileHash(0xC68C2299, 0, -1); - _newHashListIndex = 0; + startAnimation(0xC68C2299, 0, -1); + _newStickFrameIndex = 0; SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene1001Window::handleMessage); } @@ -245,7 +245,7 @@ uint32 AsScene1001Window::handleMessage(int messageNum, const MessageParam ¶ } break; case 0x2001: - setFileHash(0xC68C2299, 0, -1); + startAnimation(0xC68C2299, 0, -1); break; case 0x3002: SetMessageHandler(NULL); @@ -261,8 +261,8 @@ AsScene1001Lever::AsScene1001Lever(NeverhoodEngine *vm, Scene *parentScene, int1 createSurface(1010, 71, 73); setDoDeltaX(deltaXType); - setFileHash(0x04A98C36, 0, -1); - _newHashListIndex = 0; + startAnimation(0x04A98C36, 0, -1); + _newStickFrameIndex = 0; _x = x; _y = y; SetUpdateHandler(&AnimatedSprite::update); @@ -284,11 +284,11 @@ uint32 AsScene1001Lever::handleMessage(int messageNum, const MessageParam ¶m messageResult = 1; break; case 0x3002: - setFileHash(0x04A98C36, 0, -1); - _newHashListIndex = 0; + startAnimation(0x04A98C36, 0, -1); + _newStickFrameIndex = 0; break; case 0x480F: - setFileHash(0x04A98C36, 0, -1); + startAnimation(0x04A98C36, 0, -1); break; case 0x482A: sendMessage(_parentScene, 0x1022, 990); @@ -504,15 +504,15 @@ AsScene1002Ring::AsScene1002Ring(NeverhoodEngine *vm, Scene *parentScene, bool f if (flag1) { createSurface(990, 68, 314); if (flag2) { - setFileHash(0x04103090, 0, -1); + startAnimation(0x04103090, 0, -1); SetMessageHandler(&AsScene1002Ring::handleMessage447930); } else { - setFileHash(0xA85C4011, _vm->_rnd->getRandomNumber(15), -1); + startAnimation(0xA85C4011, _vm->_rnd->getRandomNumber(15), -1); SetMessageHandler(&AsScene1002Ring::handleMessage4475E0); } } else { createSurface(990, 68, 138); - setFileHash(0xA85C4011, _vm->_rnd->getRandomNumber(15), -1); + startAnimation(0xA85C4011, _vm->_rnd->getRandomNumber(15), -1); SetMessageHandler(&AsScene1002Ring::handleMessage4475E0); } @@ -538,16 +538,16 @@ uint32 AsScene1002Ring::handleMessage4475E0(int messageNum, const MessageParam & sendMessage(_parentScene, 0x4806, 0); SetMessageHandler(&AsScene1002Ring::handleMessage447760); if (_flag1) { - setFileHash(0x87502558, 0, -1); + startAnimation(0x87502558, 0, -1); } else { - setFileHash(0x80DD4010, 0, -1); + startAnimation(0x80DD4010, 0, -1); } break; case 0x480F: setDoDeltaX(((Sprite*)sender)->isDoDeltaX() ? 1 : 0); sendMessage(_parentScene, 0x480F, 0); SetMessageHandler(&AsScene1002Ring::handleMessage447890); - setFileHash(0x861A2020, 0, -1); + startAnimation(0x861A2020, 0, -1); break; case 0x482A: sendMessage(_parentScene, 0x1022, 990); @@ -564,17 +564,17 @@ uint32 AsScene1002Ring::handleMessage447760(int messageNum, const MessageParam & switch (messageNum) { case 0x3002: if (_flag1) { - setFileHash(0x78D0A812, 0, -1); + startAnimation(0x78D0A812, 0, -1); SetMessageHandler(&AsScene1002Ring::handleMessage447930); } else { - setFileHash(0xB85D2A10, 0, -1); + startAnimation(0xB85D2A10, 0, -1); SetMessageHandler(&AsScene1002Ring::handleMessage447930); } break; case 0x4807: sendMessage(_parentScene, 0x4807, 0); setDoDeltaX(_vm->_rnd->getRandomNumber(1)); - setFileHash(0x8258A030, 0, -1); + startAnimation(0x8258A030, 0, -1); SetMessageHandler(&AsScene1002Ring::handleMessage447A00); break; case 0x482A: @@ -591,7 +591,7 @@ uint32 AsScene1002Ring::handleMessage447890(int messageNum, const MessageParam & uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - setFileHash(0x04103090, 0, -1); + startAnimation(0x04103090, 0, -1); SetMessageHandler(&AsScene1002Ring::handleMessage447930); break; case 0x482A: @@ -610,7 +610,7 @@ uint32 AsScene1002Ring::handleMessage447930(int messageNum, const MessageParam & case 0x4807: sendMessage(_parentScene, 0x4807, 0); setDoDeltaX(_vm->_rnd->getRandomNumber(1)); - setFileHash(0x8258A030, 0, -1); + startAnimation(0x8258A030, 0, -1); SetMessageHandler(&AsScene1002Ring::handleMessage447A00); break; case 0x482A: @@ -632,7 +632,7 @@ uint32 AsScene1002Ring::handleMessage447A00(int messageNum, const MessageParam & } break; case 0x3002: - setFileHash(0xA85C4011, 0, -1); + startAnimation(0xA85C4011, 0, -1); break; case 0x482A: sendMessage(_parentScene, 0x1022, 990); @@ -730,7 +730,7 @@ uint32 Class505::handleMessage(int messageNum, const MessageParam ¶m, Entity case 0x2004: _x = ((Sprite*)sender)->getX() - 98; _y = ((Sprite*)sender)->getY() - 111; - setFileHash(0x0422255A, 0, -1); + startAnimation(0x0422255A, 0, -1); setVisible(true); break; case 0x3002: @@ -752,7 +752,7 @@ AsScene1002DoorSpy::AsScene1002DoorSpy(NeverhoodEngine *vm, NRect &clipRect, Sce setClipRect(clipRect); spriteUpdate448AA0(); _soundResource.load(0xC0C40298); - setFileHash(0x586C1D48, 0, 0); + startAnimation(0x586C1D48, 0, 0); } uint32 AsScene1002DoorSpy::handleMessage4489D0(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -776,7 +776,7 @@ uint32 AsScene1002DoorSpy::handleMessage448A60(int messageNum, const MessagePara uint32 messageResult = handleMessage4489D0(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -790,14 +790,14 @@ void AsScene1002DoorSpy::spriteUpdate448AA0() { void AsScene1002DoorSpy::sub448AC0() { setClipRect(_rect); _parentScene->setSurfacePriority(getSurface(), 800); - setFileHash(0x586C1D48, 0, 0); + startAnimation(0x586C1D48, 0, 0); SetMessageHandler(&AsScene1002DoorSpy::handleMessage4489D0); } void AsScene1002DoorSpy::sub448B10() { setClipRect(0, 0, 640, 480); _parentScene->setSurfacePriority(getSurface(), 1200); - setFileHash(0x586C1D48, 1, -1); + startAnimation(0x586C1D48, 1, -1); SetMessageHandler(&AsScene1002DoorSpy::handleMessage448A60); NextState(&AsScene1002DoorSpy::sub448AC0); } @@ -937,7 +937,7 @@ AsScene1002VenusFlyTrap::AsScene1002VenusFlyTrap(NeverhoodEngine *vm, Scene *par void AsScene1002VenusFlyTrap::update() { if (_countdown != 0 && (--_countdown == 0)) { - removeCallbacks(); + gotoNextState(); } AnimatedSprite::update(); } @@ -1025,7 +1025,7 @@ uint32 AsScene1002VenusFlyTrap::handleMessage4482E0(int messageNum, const Messag uint32 messageResult = handleMessage448000(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -1054,7 +1054,7 @@ uint32 AsScene1002VenusFlyTrap::handleMessage448320(int messageNum, const Messag } break; case 0x3002: - removeCallbacks(); + gotoNextState(); break; case 0x482A: sendMessage(_parentScene, 0x1022, 995); @@ -1068,14 +1068,14 @@ uint32 AsScene1002VenusFlyTrap::handleMessage448320(int messageNum, const Messag void AsScene1002VenusFlyTrap::sub4484F0() { setDoDeltaX(2); - setFileHash(0xC4080034, 0, -1); + startAnimation(0xC4080034, 0, -1); SetUpdateHandler(&AsScene1002VenusFlyTrap::update); SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage448320); NextState(&AsScene1002VenusFlyTrap::sub448660); } void AsScene1002VenusFlyTrap::sub448530() { - setFileHash(0xC4080034, 0, -1); + startAnimation(0xC4080034, 0, -1); SetUpdateHandler(&AsScene1002VenusFlyTrap::update); SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage4482E0); NextState(&AsScene1002VenusFlyTrap::sub448660); @@ -1083,7 +1083,7 @@ void AsScene1002VenusFlyTrap::sub448530() { void AsScene1002VenusFlyTrap::sub448560() { sendMessage(_parentScene, 0x4807, 0); - setFileHash(0x82292851, 0, -1); + startAnimation(0x82292851, 0, -1); SetUpdateHandler(&AsScene1002VenusFlyTrap::update); SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage4482E0); NextState(&AsScene1002VenusFlyTrap::sub448660); @@ -1091,20 +1091,20 @@ void AsScene1002VenusFlyTrap::sub448560() { void AsScene1002VenusFlyTrap::sub4485B0() { setDoDeltaX(1); - setFileHash(0x86A82A11, 0, -1); + startAnimation(0x86A82A11, 0, -1); SetUpdateHandler(&AsScene1002VenusFlyTrap::update); SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage4482E0); NextState(&AsScene1002VenusFlyTrap::sub4485F0); } void AsScene1002VenusFlyTrap::sub4485F0() { - setFileHash(0xB5A86034, 0, -1); + startAnimation(0xB5A86034, 0, -1); SetUpdateHandler(&AsScene1002VenusFlyTrap::update); SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage448000); } void AsScene1002VenusFlyTrap::sub448620() { - setFileHash(0x31303094, 0, -1); + startAnimation(0x31303094, 0, -1); SetUpdateHandler(&AsScene1002VenusFlyTrap::update); SetMessageHandler(NULL); NextState(&AsScene1002VenusFlyTrap::sub448720); @@ -1112,7 +1112,7 @@ void AsScene1002VenusFlyTrap::sub448620() { } void AsScene1002VenusFlyTrap::sub448660() { - setFileHash(0xC8204250, 0, -1); + startAnimation(0xC8204250, 0, -1); SetUpdateHandler(&AsScene1002VenusFlyTrap::update447FB0); SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage448000); if (_flag) { @@ -1133,14 +1133,14 @@ void AsScene1002VenusFlyTrap::sub448660() { } void AsScene1002VenusFlyTrap::sub448720() { - setFileHash(0x152920C4, 0, -1); + startAnimation(0x152920C4, 0, -1); SetUpdateHandler(&AsScene1002VenusFlyTrap::update); SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage448320); NextState(&AsScene1002VenusFlyTrap::sub448750); } void AsScene1002VenusFlyTrap::sub448750() { - setFileHash(0x84001117, 0, -1); + startAnimation(0x84001117, 0, -1); SetUpdateHandler(&AsScene1002VenusFlyTrap::update); SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage448320); NextState(&AsScene1002VenusFlyTrap::sub448660); @@ -1154,7 +1154,7 @@ void AsScene1002VenusFlyTrap::sub448780() { setDoDeltaX(_x > 320 ? 1 : 0); } sendMessage(_klayman, 0x2001, 0); - setFileHash(0x8C2C80D4, 0, -1); + startAnimation(0x8C2C80D4, 0, -1); SetUpdateHandler(&AsScene1002VenusFlyTrap::update); SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage448320); NextState(&AsScene1002VenusFlyTrap::sub448620); @@ -1168,8 +1168,8 @@ Class506::Class506(NeverhoodEngine *vm) _x = 320; _y = 240; if (getGlobalVar(0x8306F218)) { - setFileHash(0x004A4495, -1, -1); - _newHashListIndex = -2; + startAnimation(0x004A4495, -1, -1); + _newStickFrameIndex = -2; } else { setVisible(false); } @@ -1207,21 +1207,21 @@ uint32 Class506::handleMessage449210(int messageNum, const MessageParam ¶m, uint32 messageResult = handleMessage4491B0(messageNum, param, sender); switch (messageResult) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; } void Class506::sub449250() { - setFileHash(0x004A4495, 0, -1); + startAnimation(0x004A4495, 0, -1); SetMessageHandler(&Class506::handleMessage4491B0); - _newHashListIndex = -2; + _newStickFrameIndex = -2; setVisible(true); } void Class506::sub449280() { - setFileHash(0x004A4495, -1, -1); + startAnimation(0x004A4495, -1, -1); _playBackwards = true; SetMessageHandler(&Class506::handleMessage449210); NextState(&Class506::sub4492C0); @@ -1244,15 +1244,15 @@ Class478::Class478(NeverhoodEngine *vm, Klayman *klayman) void Class478::update() { if (_klayman->getCurrAnimFileHash() == 0x3A292504) { - setFileHash(0xBA280522, _frameIndex, -1); - _newHashListIndex = _klayman->getFrameIndex(); + startAnimation(0xBA280522, _currFrameIndex, -1); + _newStickFrameIndex = _klayman->getFrameIndex(); setVisible(true); _x = _klayman->getX(); _y = _klayman->getY(); setDoDeltaX(_klayman->isDoDeltaX() ? 1 : 0); } else if (_klayman->getCurrAnimFileHash() == 0x122D1505) { - setFileHash(0x1319150C, _frameIndex, -1); - _newHashListIndex = _klayman->getFrameIndex(); + startAnimation(0x1319150C, _currFrameIndex, -1); + _newStickFrameIndex = _klayman->getFrameIndex(); setVisible(true); _x = _klayman->getX(); _y = _klayman->getY(); @@ -1275,8 +1275,8 @@ Class479::Class479(NeverhoodEngine *vm, Scene *parentScene, Klayman *klayman) void Class479::update() { if (_klayman->getCurrAnimFileHash() == 0xAC20C012 && _klayman->getFrameIndex() < 50) { - setFileHash(0x9820C913, _klayman->getFrameIndex(), -1); - _newHashListIndex = _klayman->getFrameIndex(); + startAnimation(0x9820C913, _klayman->getFrameIndex(), -1); + _newStickFrameIndex = _klayman->getFrameIndex(); setVisible(true); _x = _klayman->getX(); _y = _klayman->getY(); @@ -1606,7 +1606,7 @@ uint32 AsScene1004TrashCan::handleMessage(int messageNum, const MessageParam &pa } break; case 0x2002: - setFileHash(0xEB312C11, 0, -1); + startAnimation(0xEB312C11, 0, -1); setVisible(true); break; case 0x3002: diff --git a/engines/neverhood/module1100.cpp b/engines/neverhood/module1100.cpp index 52c9d92a33..1efd7e3ea7 100644 --- a/engines/neverhood/module1100.cpp +++ b/engines/neverhood/module1100.cpp @@ -348,8 +348,8 @@ AsScene1105TeddyBear::AsScene1105TeddyBear(NeverhoodEngine *vm, Scene *parentSce _y = 240; SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene1105TeddyBear::handleMessage); - setFileHash(0x65084002, 0, -1); - _newHashListIndex = 0; + startAnimation(0x65084002, 0, -1); + _newStickFrameIndex = 0; setVisible(false); _needRefresh = true; updatePosition(); @@ -362,10 +362,10 @@ uint32 AsScene1105TeddyBear::handleMessage(int messageNum, const MessageParam &p switch (messageNum) { case 0x2002: if (getGlobalVar(0x610210B7)) { - setFileHash(0x6B0C0432, 0, -1); + startAnimation(0x6B0C0432, 0, -1); _soundResource1.play(); } else { - setFileHash(0x65084002, 0, -1); + startAnimation(0x65084002, 0, -1); _soundResource2.play(); } break; @@ -706,10 +706,10 @@ uint32 Scene1109::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x2000: if (param.asInteger()) { setRectList(0x004B63A8); - _klayman->setKlaymanTable3(); + _klayman->setKlaymanIdleTable3(); } else { setRectList(0x004B6398); - _klayman->setKlaymanTable1(); + _klayman->setKlaymanIdleTable1(); } break; } diff --git a/engines/neverhood/module1200.cpp b/engines/neverhood/module1200.cpp index 25abf95643..fc28917734 100644 --- a/engines/neverhood/module1200.cpp +++ b/engines/neverhood/module1200.cpp @@ -250,18 +250,18 @@ uint32 Class466::handleMessage(int messageNum, const MessageParam ¶m, Entity } void Class466::sub40D340() { - setFileHash(0x928F0C10, 0, -1); - _newHashListIndex = 0; + startAnimation(0x928F0C10, 0, -1); + _newStickFrameIndex = 0; } void Class466::sub40D360() { - setFileHash(0x928F0C10, 1, -1); - _newHashListIndex = -2; + startAnimation(0x928F0C10, 1, -1); + _newStickFrameIndex = -2; } void Class466::sub40D380() { - setFileHash(0x928F0C10, 15, -1); - _newHashListIndex = -2; + startAnimation(0x928F0C10, 15, -1); + _newStickFrameIndex = -2; } AsScene1201RightDoor::AsScene1201RightDoor(NeverhoodEngine *vm, Sprite *klayman, bool flag) @@ -272,10 +272,10 @@ AsScene1201RightDoor::AsScene1201RightDoor(NeverhoodEngine *vm, Sprite *klayman, _y = 240; SetUpdateHandler(&AsScene1201RightDoor::update); SetMessageHandler(&AsScene1201RightDoor::handleMessage); - _newHashListIndex = -2; + _newStickFrameIndex = -2; if (flag) { - setFileHash(0xD088AC30, -1, -1); - _newHashListIndex = -2; + startAnimation(0xD088AC30, -1, -1); + _newStickFrameIndex = -2; _countdown = 25; } else { stopAnimation(); @@ -294,7 +294,7 @@ uint32 AsScene1201RightDoor::handleMessage(int messageNum, const MessageParam &p uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; case 0x4829: sub40D7E0(); @@ -304,14 +304,14 @@ uint32 AsScene1201RightDoor::handleMessage(int messageNum, const MessageParam &p } void AsScene1201RightDoor::sub40D7E0() { - setFileHash(0xD088AC30, 0, -1); - _newHashListIndex = -2; + startAnimation(0xD088AC30, 0, -1); + _newStickFrameIndex = -2; setVisible(true); _soundResource.play(calcHash("fxDoorOpen20")); } void AsScene1201RightDoor::sub40D830() { - setFileHash(0xD088AC30, -1, -1); + startAnimation(0xD088AC30, -1, -1); _playBackwards = true; setVisible(true); _soundResource.play(calcHash("fxDoorClose20")); @@ -339,13 +339,13 @@ uint32 Class464::handleMessage(int messageNum, const MessageParam ¶m, Entity case 0x2006: _x = 436; _y = 339; - setFileHash(0xA060C599, 0, -1); + startAnimation(0xA060C599, 0, -1); setVisible(true); break; case 0x3002: stopAnimation(); setVisible(false); - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -402,7 +402,7 @@ uint32 AsScene1201TntMan::handleMessage40CCD0(int messageNum, const MessageParam uint32 messageResult = AsScene1201TntMan::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -413,13 +413,13 @@ void AsScene1201TntMan::spriteUpdate40CD10() { } void AsScene1201TntMan::sub40CD30() { - setFileHash(0x654913D0, 0, -1); + startAnimation(0x654913D0, 0, -1); SetMessageHandler(&AsScene1201TntMan::handleMessage); SetSpriteCallback(NULL); } void AsScene1201TntMan::sub40CD60() { - setFileHash(0x356803D0, 0, -1); + startAnimation(0x356803D0, 0, -1); SetMessageHandler(&AsScene1201TntMan::handleMessage40CCD0); SetSpriteCallback(&AnimatedSprite::updateDeltaXY); NextState(&AsScene1201TntMan::sub40CD30); @@ -429,10 +429,10 @@ void AsScene1201TntMan::sub40CD90() { // TODO Sound1ChList_addSoundResource(0x01D00560, 0x4B044624, true); // TODO Sound1ChList_playLooping(0x4B044624); _flag = true; - setFileHash(0x85084190, 0, -1); + startAnimation(0x85084190, 0, -1); SetMessageHandler(&AsScene1201TntMan::handleMessage); SetSpriteCallback(&AsScene1201TntMan::spriteUpdate40CD10); - _newHashListIndex = -2; + _newStickFrameIndex = -2; } Class465::Class465(NeverhoodEngine *vm, Sprite *asTntMan) @@ -442,7 +442,7 @@ Class465::Class465(NeverhoodEngine *vm, Sprite *asTntMan) SetUpdateHandler(&Class465::update); SetMessageHandler(&Sprite::handleMessage); SetSpriteCallback(&Class465::spriteUpdate40D150); - setFileHash(0x828C0411, 0, -1); + startAnimation(0x828C0411, 0, -1); setVisible(false); } @@ -499,7 +499,7 @@ AsScene1201Match::AsScene1201Match(NeverhoodEngine *vm, Scene *parentScene) void AsScene1201Match::update() { if (_countdown != 0 && (--_countdown == 0)) { - removeCallbacks(); + gotoNextState(); } updateAnim(); handleSpriteUpdate(); @@ -522,7 +522,7 @@ uint32 AsScene1201Match::handleMessage40C320(int messageNum, const MessageParam uint32 messageResult = handleMessage40C2D0(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -544,7 +544,7 @@ uint32 AsScene1201Match::handleMessage40C360(int messageNum, const MessageParam } void AsScene1201Match::sub40C3E0() { - setFileHash(0x00842374, 0, -1); + startAnimation(0x00842374, 0, -1); SetMessageHandler(&AsScene1201Match::handleMessage40C320); if (_status == 0) { NextState(&AsScene1201Match::sub40C420); @@ -557,15 +557,15 @@ void AsScene1201Match::sub40C420() { setGlobalVar(0x0112090A, 2); _x -= 199; _y += 119; - setFileHash(0x018D0240, 0, -1); + startAnimation(0x018D0240, 0, -1); SetMessageHandler(&AsScene1201Match::handleMessage40C320); NextState(&AsScene1201Match::sub40C4F0); } void AsScene1201Match::sub40C470() { - setFileHash(0x00842374, 0, -1); + startAnimation(0x00842374, 0, -1); SetMessageHandler(&AsScene1201Match::handleMessage40C2D0); - _newHashListIndex = 0; + _newStickFrameIndex = 0; if (_status != 0) { _countdown = 36; _status--; @@ -574,18 +574,18 @@ void AsScene1201Match::sub40C470() { } void AsScene1201Match::sub40C4C0() { - setFileHash(0x00842374, 0, -1); + startAnimation(0x00842374, 0, -1); SetMessageHandler(&AsScene1201Match::handleMessage40C360); - _newHashListIndex = 0; + _newStickFrameIndex = 0; } void AsScene1201Match::sub40C4F0() { setDoDeltaX(1); _x = 403; _y = 337; - setFileHash(0x00842374, 0, -1); + startAnimation(0x00842374, 0, -1); SetMessageHandler(&AsScene1201Match::handleMessage40C360); - _newHashListIndex = 0; + _newStickFrameIndex = 0; } AsScene1201Creature::AsScene1201Creature(NeverhoodEngine *vm, Scene *parentScene, Sprite *klayman) @@ -607,7 +607,7 @@ void AsScene1201Creature::update() { if (_flag != oldFlag) sub40C8E0(); if (_countdown1 != 0 && (--_countdown1 == 0)) { - removeCallbacks(); + gotoNextState(); } updateAnim(); handleSpriteUpdate(); @@ -643,7 +643,7 @@ uint32 AsScene1201Creature::handleMessage40C7B0(int messageNum, const MessagePar } break; case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -660,7 +660,7 @@ uint32 AsScene1201Creature::handleMessage40C830(int messageNum, const MessagePar } break; case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -670,7 +670,7 @@ void AsScene1201Creature::sub40C8E0() { _countdown3--; if (_countdown3 == 0) _countdown3 = 3; - setFileHash(0x08081513, 0, -1); + startAnimation(0x08081513, 0, -1); SetMessageHandler(&AsScene1201Creature::handleMessage40C710); NextState(&AsScene1201Creature::sub40C930); _countdown1 = 36; @@ -678,32 +678,32 @@ void AsScene1201Creature::sub40C8E0() { void AsScene1201Creature::sub40C930() { if (!_flag) { - setFileHash(0xCA287133, 0, -1); + startAnimation(0xCA287133, 0, -1); SetMessageHandler(&AsScene1201Creature::handleMessage40C7B0); NextState(&AsScene1201Creature::sub40C8E0); } } void AsScene1201Creature::sub40C960() { - setFileHash(0x08081513, 0, -1); + startAnimation(0x08081513, 0, -1); SetMessageHandler(&AsScene1201Creature::handleMessage40C710); NextState(&AsScene1201Creature::sub40C9E0); _countdown1 = 48; } void AsScene1201Creature::sub40C990() { - setFileHash2(0x0B6E13FB, 0x01084280, 0); + startAnimationByHash(0x0B6E13FB, 0x01084280, 0); } void AsScene1201Creature::sub40C9B0() { - setFileHash(0xCA287133, 0, -1); + startAnimation(0xCA287133, 0, -1); SetMessageHandler(&AsScene1201Creature::handleMessage40C830); NextState(&AsScene1201Creature::sub40C8E0); _countdown1 = 0; } void AsScene1201Creature::sub40C9E0() { - setFileHash(0x5A201453, 0, -1); + startAnimation(0x5A201453, 0, -1); SetMessageHandler(&AsScene1201Creature::handleMessage40C710); _countdown1 = 0; } @@ -715,12 +715,12 @@ AsScene1201LeftDoor::AsScene1201LeftDoor(NeverhoodEngine *vm, Sprite *klayman) _y = 240; createSurface(800, 55, 199); if (_klayman->getX() < 100) { - setFileHash(0x508A111B, 0, -1); - _newHashListIndex = -2; + startAnimation(0x508A111B, 0, -1); + _newStickFrameIndex = -2; _soundResource.play(calcHash("fxDoorOpen03")); } else { - setFileHash(0x508A111B, -1, -1); - _newHashListIndex = -2; + startAnimation(0x508A111B, -1, -1); + _newStickFrameIndex = -2; } SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene1201LeftDoor::handleMessage); @@ -737,9 +737,9 @@ uint32 AsScene1201LeftDoor::handleMessage(int messageNum, const MessageParam &pa } void AsScene1201LeftDoor::sub40D590() { - setFileHash(0x508A111B, -1, -1); + startAnimation(0x508A111B, -1, -1); _playBackwards = true; - _newHashListIndex = 0; + _newStickFrameIndex = 0; } Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) @@ -1076,20 +1076,20 @@ uint32 AsScene1202TntItem::handleMessage454060(int messageNum, const MessagePara uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; } void AsScene1202TntItem::sub4540A0() { - setFileHash(kScene1202FileHashes[_index], 0, -1); + startAnimation(kScene1202FileHashes[_index], 0, -1); SetMessageHandler(&AsScene1202TntItem::handleMessage453FE0); - _newHashListIndex = 0; + _newStickFrameIndex = 0; } void AsScene1202TntItem::sub4540D0() { - setFileHash(kScene1202FileHashes[_index], 0, -1); + startAnimation(kScene1202FileHashes[_index], 0, -1); SetMessageHandler(&AsScene1202TntItem::handleMessage454060); NextState(&AsScene1202TntItem::sub454100); } @@ -1097,7 +1097,7 @@ void AsScene1202TntItem::sub4540D0() { void AsScene1202TntItem::sub454100() { _x = kScene1202Points[_index2].x; _y = kScene1202Points[_index2].y; - setFileHash(kScene1202FileHashes[_index], 6, -1); + startAnimation(kScene1202FileHashes[_index], 6, -1); SetMessageHandler(&AsScene1202TntItem::handleMessage454060); NextState(&AsScene1202TntItem::sub454160); _playBackwards = true; diff --git a/engines/neverhood/module1300.cpp b/engines/neverhood/module1300.cpp index cb5ed15d99..38dd356946 100644 --- a/engines/neverhood/module1300.cpp +++ b/engines/neverhood/module1300.cpp @@ -296,11 +296,11 @@ AsScene1302Bridge::AsScene1302Bridge(NeverhoodEngine *vm, Scene *parentScene) SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene1302Bridge::handleMessage); if (!getGlobalVar(0x13206309)) { - setFileHash(0x88148150, 0, -1); - _newHashListIndex = 0; + startAnimation(0x88148150, 0, -1); + _newStickFrameIndex = 0; } else { - setFileHash(0x88148150, -1, -1); - _newHashListIndex = -2; + startAnimation(0x88148150, -1, -1); + _newStickFrameIndex = -2; } _soundResource1.load(0x68895082); _soundResource2.load(0x689BD0C1); @@ -310,7 +310,7 @@ uint32 AsScene1302Bridge::handleMessage(int messageNum, const MessageParam ¶ uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; case 0x4808: stLowerBridge(); @@ -323,22 +323,22 @@ uint32 AsScene1302Bridge::handleMessage(int messageNum, const MessageParam ¶ } void AsScene1302Bridge::stLowerBridge() { - setFileHash(0x88148150, 0, -1); + startAnimation(0x88148150, 0, -1); NextState(&AsScene1302Bridge::cbLowerBridgeEvent); _soundResource2.play(); } void AsScene1302Bridge::stRaiseBridge() { - setFileHash(0x88148150, 7, -1); + startAnimation(0x88148150, 7, -1); _playBackwards = true; - _newHashListIndex = 0; + _newStickFrameIndex = 0; _soundResource1.play(); } void AsScene1302Bridge::cbLowerBridgeEvent() { sendMessage(_parentScene, 0x2032, 0); - setFileHash(0x88148150, -1, -1); - _newHashListIndex = -2; + startAnimation(0x88148150, -1, -1); + _newStickFrameIndex = -2; } SsScene1302Fence::SsScene1302Fence(NeverhoodEngine *vm) @@ -591,7 +591,7 @@ AsScene1303Balloon::AsScene1303Balloon(NeverhoodEngine *vm, Scene *parentScene) SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene1303Balloon::handleMessage); SetSpriteCallback(&AnimatedSprite::updateDeltaXY); - setFileHash(0x800278D2, 0, -1); + startAnimation(0x800278D2, 0, -1); } uint32 AsScene1303Balloon::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -627,7 +627,7 @@ uint32 AsScene1303Balloon::hmBalloonPopped(int messageNum, const MessageParam &p } void AsScene1303Balloon::stPopBalloon() { - setFileHash(0xAC004CD0, 0, -1); + startAnimation(0xAC004CD0, 0, -1); SetMessageHandler(&AsScene1303Balloon::hmBalloonPopped); } @@ -799,8 +799,8 @@ AsScene1306Elevator::AsScene1306Elevator(NeverhoodEngine *vm, Scene *parentScene _x = 320; _y = 240; createSurface1(0x043B0270, 100); - setFileHash(0x043B0270, 0, -1); - _newHashListIndex = 0; + startAnimation(0x043B0270, 0, -1); + _newStickFrameIndex = 0; SetMessageHandler(&AsScene1306Elevator::handleMessage); _soundResource1.load(0x1C100E83); _soundResource2.load(0x1C08CEC5); @@ -812,7 +812,7 @@ void AsScene1306Elevator::update() { stGoingDown(); } AnimatedSprite::update(); - if (_frameIndex == 7) { + if (_currFrameIndex == 7) { _soundResource3.play(); _asElevatorDoor->setVisible(false); } @@ -820,7 +820,7 @@ void AsScene1306Elevator::update() { void AsScene1306Elevator::upGoingDown() { AnimatedSprite::update(); - if (_frameIndex == 5) { + if (_currFrameIndex == 5) { _asElevatorDoor->setVisible(true); } } @@ -834,7 +834,7 @@ uint32 AsScene1306Elevator::handleMessage(int messageNum, const MessageParam &pa messageResult = _isUp ? 1 : 0; break; case 0x3002: - removeCallbacks(); + gotoNextState(); break; case 0x4808: if (_isDown) @@ -848,7 +848,7 @@ void AsScene1306Elevator::stGoingUp() { setVisible(true); _isDown = false; SetUpdateHandler(&AsScene1306Elevator::update); - setFileHash(0x043B0270, 0, -1); + startAnimation(0x043B0270, 0, -1); NextState(&AsScene1306Elevator::cbGoingUpEvent); _soundResource1.play(); } @@ -866,7 +866,7 @@ void AsScene1306Elevator::stGoingDown() { SetUpdateHandler(&AsScene1306Elevator::upGoingDown); _isUp = false; setVisible(true); - setFileHash(0x043B0270, -1, -1); + startAnimation(0x043B0270, -1, -1); _playBackwards = true; NextState(&AsScene1306Elevator::cbGoingDownEvent); _soundResource2.play(); @@ -902,7 +902,7 @@ Scene1306::Scene1306(NeverhoodEngine *vm, Module *parentModule, int which) _asTape = insertSprite(this, 19, 1100, 359, 445, 0x9148A011); _asElevatorDoor = insertSprite(0x043B0270, 90, 320, 240); - _asElevatorDoor->setFileHash(0x043B0270, 6, -1); + _asElevatorDoor->startAnimation(0x043B0270, 6, -1); _asElevatorDoor->setNewHashListIndex(6); _asElevator = insertSprite(this, _asElevatorDoor); @@ -987,10 +987,10 @@ uint32 Scene1306::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x2000: if (param.asInteger() != 0) { setRectList(0x004AFD28); - _klayman->setKlaymanTable3(); + _klayman->setKlaymanIdleTable3(); } else { setRectList(0x004AFD18); - _klayman->setKlaymanTable1(); + _klayman->setKlaymanIdleTable1(); } break; case 0x480B: @@ -1134,7 +1134,7 @@ AsScene1307Key::AsScene1307Key(NeverhoodEngine *vm, Scene *parentScene, uint ind SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene1307Key::handleMessage); - setFileHash(fileHashes[0], 0, -1); + startAnimation(fileHashes[0], 0, -1); _soundResource1.load(0xDC4A1280); _soundResource2.load(0xCC021233); @@ -1199,9 +1199,9 @@ void AsScene1307Key::suInsertKey() { void AsScene1307Key::suMoveKey() { if (_pointIndex < kAsScene1307KeyFrameIndicesCount) { - _frameIndex += kAsScene1307KeyFrameIndices[_pointIndex]; - _x = _prevX + (_deltaX * _frameIndex) / kAsScene1307KeyDivValue; - _y = _prevY + (_deltaY * _frameIndex) / kAsScene1307KeyDivValue; + _currFrameIndex += kAsScene1307KeyFrameIndices[_pointIndex]; + _x = _prevX + (_deltaX * _currFrameIndex) / kAsScene1307KeyDivValue; + _y = _prevY + (_deltaY * _currFrameIndex) / kAsScene1307KeyDivValue; processDelta(); _pointIndex++; } else { @@ -1216,7 +1216,7 @@ void AsScene1307Key::stRemoveKey() { const uint32 *fileHashes = kAsScene1307KeyResourceLists[_index]; _pointIndex = 0; SetSpriteCallback(&AsScene1307Key::suRemoveKey); - setFileHash(fileHashes[0], 0, -1); + startAnimation(fileHashes[0], 0, -1); _soundResource2.play(); } @@ -1225,7 +1225,7 @@ void AsScene1307Key::stInsertKey() { sendMessage(_parentScene, 0x1022, kAsScene1307KeySurfacePriorities[getSubVar(0xA010B810, _index) % 4]); setClipRect(_clipRects[getSubVar(0xA010B810, _index) % 4]); SetSpriteCallback(&AsScene1307Key::suInsertKey); - _newHashListIndex = -2; + _newStickFrameIndex = -2; } void AsScene1307Key::stMoveKey() { @@ -1241,24 +1241,24 @@ void AsScene1307Key::stMoveKey() { } else { const uint32 *fileHashes = kAsScene1307KeyResourceLists[_index]; _pointIndex = 0; - _frameIndex = 0; + _currFrameIndex = 0; _deltaX = newX - _x; _deltaY = newY - _y; SetSpriteCallback(&AsScene1307Key::suMoveKey); - setFileHash(fileHashes[0], 0, -1); + startAnimation(fileHashes[0], 0, -1); } } void AsScene1307Key::stUnlock() { const uint32 *fileHashes = kAsScene1307KeyResourceLists[_index]; - setFileHash(fileHashes[1], 0, -1); - _newHashListIndex = -2; + startAnimation(fileHashes[1], 0, -1); + _newStickFrameIndex = -2; } void AsScene1307Key::stInsert() { const uint32 *fileHashes = kAsScene1307KeyResourceLists[_index]; - setFileHash(fileHashes[2], 0, -1); - _newHashListIndex = -2; + startAnimation(fileHashes[2], 0, -1); + _newStickFrameIndex = -2; } Scene1307::Scene1307(NeverhoodEngine *vm, Module *parentModule, int which) @@ -1440,7 +1440,7 @@ uint32 Class549::handleMessage(int messageNum, const MessageParam ¶m, Entity uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; case 0x4808: sub455470(); @@ -1453,7 +1453,7 @@ uint32 Class549::handleMessage(int messageNum, const MessageParam ¶m, Entity } void Class549::sub455470() { - setFileHash(0xBA0AE050, 0, -1); + startAnimation(0xBA0AE050, 0, -1); setVisible(true); NextState(&Class549::hide); _soundResource.play(calcHash("fxDoorOpen38")); @@ -1466,7 +1466,7 @@ void Class549::hide() { } void Class549::sub4554F0() { - setFileHash(0xBA0AE050, -1, -1); + startAnimation(0xBA0AE050, -1, -1); _playBackwards = true; setVisible(true); NextState(&Class549::sub455550); @@ -1491,14 +1491,14 @@ uint32 Class592::handleMessage(int messageNum, const MessageParam ¶m, Entity uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; } void Class592::sub455710() { - setFileHash(0x6238B191, 0, -1); + startAnimation(0x6238B191, 0, -1); NextState(&Class592::sub455740); _x = 580; _y = 383; @@ -1528,20 +1528,20 @@ uint32 Class593::handleMessage(int messageNum, const MessageParam ¶m, Entity case 0x2003: sub455920(); case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; } void Class593::sub4558F0() { - setFileHash(0x80180A10, 0, -1); + startAnimation(0x80180A10, 0, -1); setVisible(false); - _newHashListIndex = -2; + _newStickFrameIndex = -2; } void Class593::sub455920() { - setFileHash(0x80180A10, -1, -1); + startAnimation(0x80180A10, -1, -1); _playBackwards = true; NextState(&Class593::sub455950); } @@ -1568,7 +1568,7 @@ Class513::Class513(NeverhoodEngine *vm) _x = 286; _y = 429; createSurface1(0xA282C472, 100); - setFileHash(0xA282C472, 0, -1); + startAnimation(0xA282C472, 0, -1); } uint32 Class513::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { diff --git a/engines/neverhood/module1400.cpp b/engines/neverhood/module1400.cpp index 42dfdb3d5b..ecf6326f9b 100644 --- a/engines/neverhood/module1400.cpp +++ b/engines/neverhood/module1400.cpp @@ -144,7 +144,7 @@ Class525::Class525(NeverhoodEngine *vm) _y = 217; SetUpdateHandler(&Class525::update4662A0); SetMessageHandler(&Class525::handleMessage466320); - setFileHash(0x4C210500, 0, -1); + startAnimation(0x4C210500, 0, -1); } Class525::~Class525() { @@ -206,18 +206,18 @@ uint32 Class525::handleMessage4663C0(int messageNum, const MessageParam ¶m, } void Class525::sub466420() { - setFileHash(0x4C240100, 0, -1); + startAnimation(0x4C240100, 0, -1); _soundResource1.play(0x4A30063F); } void Class525::sub466460() { // TODO Sound1ChList_deleteSoundByHash(0x4A116437); _soundResource1.play(0x4A120435); - setFileHash(0x4C210500, 0, -1); + startAnimation(0x4C210500, 0, -1); } void Class525::sub4664B0() { - setFileHash(0x6C210810, 0, -1); + startAnimation(0x6C210810, 0, -1); SetMessageHandler(&Class525::handleMessage4663C0); SetUpdateHandler(&Class525::update466300); } @@ -231,7 +231,7 @@ Class526::Class526(NeverhoodEngine *vm, Sprite *class525) _y = 433; SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&Class526::handleMessage); - setFileHash(0xA282C472, 0, -1); + startAnimation(0xA282C472, 0, -1); } uint32 Class526::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -265,7 +265,7 @@ void Class526::spriteUpdate466720() { } void Class526::sub466770() { - setFileHash(0x34880040, 0, -1); + startAnimation(0x34880040, 0, -1); SetSpriteCallback(&Class526::spriteUpdate466720); } @@ -278,7 +278,7 @@ Class527::Class527(NeverhoodEngine *vm, Sprite *class526) _y = 433; SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&Class527::handleMessage); - setFileHash(0x461A1490, 0, -1); + startAnimation(0x461A1490, 0, -1); } uint32 Class527::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -303,7 +303,7 @@ void Class527::spriteUpdate466920() { } void Class527::sub466970() { - setFileHash(0x103B8020, 0, -1); + startAnimation(0x103B8020, 0, -1); SetSpriteCallback(&Class527::spriteUpdate466920); } @@ -315,10 +315,10 @@ Class528::Class528(NeverhoodEngine *vm, Sprite *klayman, bool flag) createSurface1(0x04551900, 100); SetUpdateHandler(&Class528::update); SetMessageHandler(&Class528::handleMessage); - _newHashListIndex = -2; + _newStickFrameIndex = -2; if (flag) { _flag = true; - setFileHash(0x04551900, -1,- 1); + startAnimation(0x04551900, -1,- 1); _countdown = 48; } else { _flag = false; @@ -344,7 +344,7 @@ uint32 Class528::handleMessage(int messageNum, const MessageParam ¶m, Entity messageResult = _flag ? 1 : 0; break; case 0x3002: - removeCallbacks(); + gotoNextState(); break; case 0x4808: _countdown = 168; @@ -358,15 +358,15 @@ uint32 Class528::handleMessage(int messageNum, const MessageParam ¶m, Entity void Class528::sub466BF0() { _flag = true; setVisible(true); - setFileHash(0x04551900, 0, -1); - _newHashListIndex = -2; + startAnimation(0x04551900, 0, -1); + _newStickFrameIndex = -2; _soundResource.play(calcHash("fxDoorOpen24")); } void Class528::sub466C50() { _flag = false; setVisible(true); - setFileHash(0x04551900, -1, -1); + startAnimation(0x04551900, -1, -1); _soundResource.play(calcHash("fxDoorClose24")); _playBackwards = true; NextState(&Class528::sub466CB0); @@ -392,7 +392,7 @@ Class489::Class489(NeverhoodEngine *vm, Scene *parentScene, Sprite *klayman, Spr _class489Item = &kClass489Items[getGlobalVar(0x04A105B3)]; // TODO createSurface3(990, dword_4B26D8); createSurface(990, 640, 480); //TODO: Remeove once the line above is done - setFileHash(0x10E3042B, 0, -1); + startAnimation(0x10E3042B, 0, -1); SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&Class489::handleMessage); _x = getGlobalVar(0x04A10F33) * 108 + _class489Item->point.x; @@ -504,7 +504,7 @@ uint32 Class489::handleMessage434B20(int messageNum, const MessageParam ¶m, uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -585,12 +585,12 @@ void Class489::sub434D80() { void Class489::sub434DD0() { SetSpriteCallback(NULL); SetMessageHandler(&Class489::handleMessage); - setFileHash(0x10E3042B, 0, -1); + startAnimation(0x10E3042B, 0, -1); } void Class489::sub434DF0() { _remX = getGlobalVar(0x04A10F33) * 108 + _class489Item->point.x; - setFileHash(0x14A10137, 0, -1); + startAnimation(0x14A10137, 0, -1); SetSpriteCallback(&Class489::spriteUpdate434B60); SetMessageHandler(&Class489::handleMessage); _soundResource2.play(0xEC008474); @@ -599,18 +599,18 @@ void Class489::sub434DF0() { void Class489::sub434E60() { SetSpriteCallback(NULL); SetMessageHandler(&Class489::handleMessage434B20); - setFileHash(0x80C32213, 0, -1); + startAnimation(0x80C32213, 0, -1); NextState(&Class489::sub434E90); } void Class489::sub434E90() { SetSpriteCallback(NULL); SetMessageHandler(&Class489::handleMessage4348E0); - setFileHash(0xD23B207F, 0, -1); + startAnimation(0xD23B207F, 0, -1); } void Class489::sub434EC0() { - setFileHash(0x50A80517, 0, -1); + startAnimation(0x50A80517, 0, -1); SetMessageHandler(&Class489::handleMessage434B20); SetSpriteCallback(NULL); NextState(&Class489::sub434F40); @@ -622,13 +622,13 @@ void Class489::sub434EC0() { void Class489::sub434F40() { sendMessage(_parentScene, 0x480F, 0); - setFileHash(0xD833207F, 0, -1); + startAnimation(0xD833207F, 0, -1); SetSpriteCallback(NULL); SetMessageHandler(&Class489::handleMessage4348E0); } void Class489::sub434F80() { - setFileHash(0x50A94417, 0, -1); + startAnimation(0x50A94417, 0, -1); SetSpriteCallback(NULL); SetMessageHandler(&Class489::handleMessage434B20); NextState(&Class489::sub434E90); @@ -639,7 +639,7 @@ void Class489::sub434F80() { void Class489::sub434FF0() { _remX = getGlobalVar(0x04A10F33) * 108 + _class489Item->point.x; - setFileHash(0x22CB4A33, 0, -1); + startAnimation(0x22CB4A33, 0, -1); SetSpriteCallback(&Class489::spriteUpdate434B60); SetMessageHandler(&Class489::handleMessage434B20); NextState(&Class489::sub434DF0); @@ -650,7 +650,7 @@ void Class489::sub435040() { setGlobalVar(0x04A10F33, 0); SetSpriteCallback(&Class489::sub434D80); SetMessageHandler(&Sprite::handleMessage); - setFileHash(0x708D4712, 0, -1); + startAnimation(0x708D4712, 0, -1); _soundResource3.play(); } @@ -825,16 +825,16 @@ Class482::Class482(NeverhoodEngine *vm, Scene *parentScene, int which) _x = 279; _y = 270; if (which == 2) { - setFileHash(0x20060259, 0, -1); + startAnimation(0x20060259, 0, -1); _soundResource1.play(0x419014AC); _soundResource2.load(0x61901C29); } else if (which == 1) { - setFileHash(0x210A0213, 0, -1); + startAnimation(0x210A0213, 0, -1); _soundResource1.play(0x41809C6C); } else { - setFileHash(0x20060259, 0, -1); + startAnimation(0x20060259, 0, -1); _soundResource2.load(0x61901C29); - _newHashListIndex = -2; + _newStickFrameIndex = -2; } } @@ -843,12 +843,12 @@ uint32 Class482::handleMessage(int messageNum, const MessageParam ¶m, Entity switch (messageNum) { case 0x2002: _soundResource2.play(); - setFileHash(0x20060259, -1, -1); + startAnimation(0x20060259, -1, -1); _playBackwards = true; NextState(&Class482::sub428530); break; case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -1142,7 +1142,7 @@ void AsScene1407Mouse::suWalkTo() { void AsScene1407Mouse::upGoThroughHole() { if (_countdown != 0 && (--_countdown == 0)) { SetUpdateHandler(&AnimatedSprite::update); - removeCallbacks(); + gotoNextState(); } AnimatedSprite::update(); } @@ -1178,7 +1178,7 @@ uint32 AsScene1407Mouse::handleMessage(int messageNum, const MessageParam ¶m } break; case 0x1019: - removeCallbacks(); + gotoNextState(); break; case 0x2001: { @@ -1207,7 +1207,7 @@ uint32 AsScene1407Mouse::handleMessage(int messageNum, const MessageParam ¶m void AsScene1407Mouse::stIdleLookAtGoodHole() { setDoDeltaX(kScene1407MouseHoles[kScene1407MouseSections[_currSectionIndex].goodHoleIndex].x < _x ? 1 : 0); - setFileHash(0x72215194, 0, -1); + startAnimation(0x72215194, 0, -1); SetSpriteCallback(NULL); SetMessageHandler(&AsScene1407Mouse::handleMessage); } @@ -1215,7 +1215,7 @@ void AsScene1407Mouse::stIdleLookAtGoodHole() { void AsScene1407Mouse::stWalkToDest() { if (_walkDestX != _x) { setDoDeltaX(_walkDestX < _x ? 1 : 0); - setFileHash(0x22291510, 0, -1); + startAnimation(0x22291510, 0, -1); SetSpriteCallback(&AsScene1407Mouse::suWalkTo); SetMessageHandler(&AsScene1407Mouse::handleMessage); NextState(&AsScene1407Mouse::stIdleLookAtGoodHole); @@ -1224,14 +1224,14 @@ void AsScene1407Mouse::stWalkToDest() { void AsScene1407Mouse::stWalkToHole() { setDoDeltaX(_walkDestX < _x ? 1 : 0); - setFileHash(0x22291510, 0, -1); + startAnimation(0x22291510, 0, -1); SetSpriteCallback(&AsScene1407Mouse::suWalkTo); SetMessageHandler(&AsScene1407Mouse::handleMessage); NextState(&AsScene1407Mouse::stGoThroughHole); } void AsScene1407Mouse::stGoThroughHole() { - setFileHash(0x72215194, 0, -1); + startAnimation(0x72215194, 0, -1); SetSpriteCallback(NULL); SetMessageHandler(NULL); SetUpdateHandler(&AsScene1407Mouse::upGoThroughHole); @@ -1603,8 +1603,8 @@ AsScene1405Tile::AsScene1405Tile(NeverhoodEngine *vm, Scene1405 *parentScene, ui debug("getSubVar(0x0C65F80B, _index) = %d", getSubVar(0x0C65F80B, _index)); - setFileHash(0x844B805C, getSubVar(0x0C65F80B, _index), -1); - _newHashListIndex = (int16)getSubVar(0x0C65F80B, _index); + startAnimation(0x844B805C, getSubVar(0x0C65F80B, _index), -1); + _newStickFrameIndex = (int16)getSubVar(0x0C65F80B, _index); } void AsScene1405Tile::update() { diff --git a/engines/neverhood/module1600.cpp b/engines/neverhood/module1600.cpp index c510601642..44c8721d6d 100644 --- a/engines/neverhood/module1600.cpp +++ b/engines/neverhood/module1600.cpp @@ -200,7 +200,7 @@ Class521::Class521(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) _pathPoints = NULL; _rectList = NULL; - setFileHash(0xD4220027, 0, -1); + startAnimation(0xD4220027, 0, -1); setDoDeltaX(getGlobalVar(0x21E60190)); } @@ -372,11 +372,11 @@ uint32 Class521::handleMessage45CC30(int messageNum, const MessageParam ¶m, switch (messageNum) { case 0x100D: if (_flag10F && param.asInteger() == 0x025424A2) { - removeCallbacks(); + gotoNextState(); } break; case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -408,7 +408,7 @@ void Class521::sub45CD00() { _rectList = NULL; SetMessageHandler(&Class521::handleMessage45CC30); NextState(&Class521::sub45CFE0); - setFileHash(0x35698F78, 0, -1); + startAnimation(0x35698F78, 0, -1); SetMessageHandler(&Class521::handleMessage45CC30); SetUpdateHandler(&Class521::update45C790); FinalizeState(&Class521::sub45D040); @@ -436,17 +436,17 @@ void Class521::sub45CDC0() { void Class521::sub45CE10() { if (_flag10E && !_flag113 && !_flag10F) { - removeCallbacks(); + gotoNextState(); _flag114 = 0; _flag113 = 1; - setFileHash(0x192ADD30, 0, -1); + startAnimation(0x192ADD30, 0, -1); SetMessageHandler(&Class521::handleMessage45CC30); SetUpdateHandler(&Class521::update); NextState(&Class521::sub45CFE0); } else if (!_flag10E && _steps && _flag113) { - removeCallbacks(); + gotoNextState(); _flag113 = 0; - setFileHash(0x9966B138, 0, -1); + startAnimation(0x9966B138, 0, -1); SetMessageHandler(&Class521::handleMessage45CC30); SetUpdateHandler(&Class521::update); NextState(&Class521::sub45D100); @@ -464,10 +464,10 @@ void Class521::sub45CE10() { _flag11A = index < _rectList->size(); } if (flag) { - removeCallbacks(); + gotoNextState(); sub45D0A0(); } else if (_newMoveDirection != _currMoveDirection && _flag114 && !_flag10F) { - removeCallbacks(); + gotoNextState(); _currMoveDirection = _newMoveDirection; sub45D100(); } @@ -475,21 +475,21 @@ void Class521::sub45CE10() { } void Class521::sub45CF80() { - setFileHash(0xA86A9538, 0, -1); + startAnimation(0xA86A9538, 0, -1); SetMessageHandler(&Class521::handleMessage45CC30); SetUpdateHandler(&Class521::update); NextState(&Class521::sub45CFE0); } void Class521::sub45CFB0() { - setFileHash(0xA86A9538, -1, -1); + startAnimation(0xA86A9538, -1, -1); _playBackwards = true; SetMessageHandler(&Class521::handleMessage45CCA0); SetUpdateHandler(&Class521::update); } void Class521::sub45CFE0() { - setFileHash(0x35698F78, 0, -1); + startAnimation(0x35698F78, 0, -1); SetMessageHandler(&Class521::handleMessage); SetUpdateHandler(&Class521::update45C790); FinalizeState(&Class521::sub45D040); @@ -505,7 +505,7 @@ void Class521::sub45D040() { } void Class521::sub45D050() { - setFileHash(0xB579A77C, 0, -1); + startAnimation(0xB579A77C, 0, -1); SetMessageHandler(&Class521::handleMessage45CC30); SetUpdateHandler(&Class521::update); NextState(&Class521::sub45CFE0); @@ -515,8 +515,8 @@ void Class521::sub45D050() { void Class521::sub45D0A0() { _flag10F = 1; - removeCallbacks(); - setFileHash(0x9C220DA4, 0, -1); + gotoNextState(); + startAnimation(0x9C220DA4, 0, -1); SetMessageHandler(&Class521::handleMessage45CC30); SetUpdateHandler(&Class521::update); FinalizeState(&Class521::sub45D0E0); @@ -531,21 +531,21 @@ void Class521::sub45D0E0() { void Class521::sub45D100() { _flag114 = 1; if (_currMoveDirection == 1) { - setFileHash(0xD4AA03A4, 0, -1); + startAnimation(0xD4AA03A4, 0, -1); } else if (_currMoveDirection == 3) { - setFileHash(0xD00A1364, 0, -1); + startAnimation(0xD00A1364, 0, -1); } else if ((_currMoveDirection == 2 && _doDeltaX) || (_currMoveDirection == 4 && !_doDeltaX)) { sub45D180(); } else { - setFileHash(0xD4220027, 0, -1); + startAnimation(0xD4220027, 0, -1); } setGlobalVar(0x21E60190, _doDeltaX ? 1 : 0); } void Class521::sub45D180() { _flag10F = 1; - removeCallbacks(); - setFileHash(0xF46A0324, 0, -1); + gotoNextState(); + startAnimation(0xF46A0324, 0, -1); _value112 = 0; SetMessageHandler(&Class521::handleMessage45CC30); SetUpdateHandler(&Class521::update); @@ -573,9 +573,9 @@ void Class521::moveToNextPoint() { sub45D350(); } else { if (_steps == 0) { - removeCallbacks(); + gotoNextState(); _flag113 = 0; - setFileHash(0x9966B138, 0, -1); + startAnimation(0x9966B138, 0, -1); SetMessageHandler(&Class521::handleMessage45CC30); SetUpdateHandler(&Class521::update); NextState(&Class521::sub45D100); @@ -588,19 +588,19 @@ void Class521::moveToNextPoint() { } void Class521::sub45D350() { - removeCallbacks(); + gotoNextState(); _flag10F = 1; _flag10E = 1; - setFileHash(0x192ADD30, 0, -1); + startAnimation(0x192ADD30, 0, -1); SetMessageHandler(&Class521::handleMessage45CC30); SetUpdateHandler(&Class521::update); NextState(&Class521::sub45D390); } void Class521::sub45D390() { - removeCallbacks(); + gotoNextState(); _flag10F = 1; - setFileHash(0xF46A0324, 0, -1); + startAnimation(0xF46A0324, 0, -1); SetMessageHandler(&Class521::handleMessage45CC30); SetUpdateHandler(&Class521::update); FinalizeState(&Class521::sub45D620); @@ -635,9 +635,9 @@ void Class521::moveToPrevPoint() { sub45D580(); } else { if (_steps == 0) { - removeCallbacks(); + gotoNextState(); _flag113 = 0; - setFileHash(0x9966B138, 0, -1); + startAnimation(0x9966B138, 0, -1); SetMessageHandler(&Class521::handleMessage45CC30); SetUpdateHandler(&Class521::update); NextState(&Class521::sub45D100); @@ -653,7 +653,7 @@ void Class521::sub45D580() { _flag10F = 1; _flag10E = 1; FinalizeState(NULL); - setFileHash(0x192ADD30, 0, -1); + startAnimation(0x192ADD30, 0, -1); SetMessageHandler(&Class521::handleMessage45CC30); SetUpdateHandler(&Class521::update); NextState(&Class521::sub45D5D0); @@ -662,7 +662,7 @@ void Class521::sub45D580() { void Class521::sub45D5D0() { _flag10F = 1; FinalizeState(NULL); - setFileHash(0xF46A0324, 0, -1); + startAnimation(0xF46A0324, 0, -1); SetMessageHandler(&Class521::handleMessage45CC30); SetUpdateHandler(&Class521::update); FinalizeState(&Class521::sub45D620); @@ -986,7 +986,7 @@ uint32 Class546::handleMessage(int messageNum, const MessageParam ¶m, Entity uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; case 0x4808: sub44D710(); @@ -999,7 +999,7 @@ uint32 Class546::handleMessage(int messageNum, const MessageParam ¶m, Entity } void Class546::sub44D710() { - setFileHash(0x08C80144, 0, -1); + startAnimation(0x08C80144, 0, -1); setVisible(true); NextState(&Class546::sub44D760); _soundResource.play(calcHash("fxDoorOpen23")); @@ -1012,7 +1012,7 @@ void Class546::sub44D760() { } void Class546::sub44D790() { - setFileHash(0x08C80144, -1, -1); + startAnimation(0x08C80144, -1, -1); setVisible(true); NextState(&Class546::sub44D7F0); _soundResource.play(calcHash("fxDoorClose23")); @@ -1027,15 +1027,15 @@ Class547::Class547(NeverhoodEngine *vm, int16 x, int16 y) : AnimatedSprite(vm, 0x1209E09F, 1100, x, y) { setDoDeltaX(1); - setFileHash(0x1209E09F, 1, -1); - _newHashListIndex = 1; + startAnimation(0x1209E09F, 1, -1); + _newStickFrameIndex = 1; } Class548::Class548(NeverhoodEngine *vm, int16 x, int16 y) : AnimatedSprite(vm, 0x1209E09F, 100, x, y) { setDoDeltaX(1); - _newHashListIndex = 0; + _newStickFrameIndex = 0; } Class518::Class518(NeverhoodEngine *vm, Class521 *class521) @@ -1043,8 +1043,8 @@ Class518::Class518(NeverhoodEngine *vm, Class521 *class521) SetUpdateHandler(&Class518::update); createSurface1(0x60281C10, 150); - setFileHash(0x60281C10, -1, -1); - _newHashListIndex = -2; + startAnimation(0x60281C10, -1, -1); + _newStickFrameIndex = -2; } void Class518::update() { diff --git a/engines/neverhood/module1700.cpp b/engines/neverhood/module1700.cpp index ae7a7fdc7a..f9dc6b7fa8 100644 --- a/engines/neverhood/module1700.cpp +++ b/engines/neverhood/module1700.cpp @@ -259,10 +259,10 @@ uint32 Scene1705::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x2000: if (param.asInteger()) { setRectList(0x004B6B40); - _klayman->setKlaymanTable3(); + _klayman->setKlaymanIdleTable3(); } else { setRectList(0x004B6B30); - _klayman->setKlaymanTable1(); + _klayman->setKlaymanIdleTable1(); } break; case 0x4826: diff --git a/engines/neverhood/module1900.cpp b/engines/neverhood/module1900.cpp index 7bac3ffc96..e9be86a926 100644 --- a/engines/neverhood/module1900.cpp +++ b/engines/neverhood/module1900.cpp @@ -200,8 +200,8 @@ AsScene1907Symbol::AsScene1907Symbol(NeverhoodEngine *vm, Scene1907 *parentScene _y = kAsScene1907SymbolPluggedInDownPositions[_currPositionIndex].y; } createSurface1(kAsScene1907SymbolFileHashes[_elementIndex], 1000 + _currPositionIndex); - setFileHash(kAsScene1907SymbolFileHashes[_elementIndex], -1, -1); - _newHashListIndex = -2; + startAnimation(kAsScene1907SymbolFileHashes[_elementIndex], -1, -1); + _newStickFrameIndex = -2; } else { _isPluggedIn = false; _currPositionIndex = positionIndex; @@ -212,8 +212,8 @@ AsScene1907Symbol::AsScene1907Symbol(NeverhoodEngine *vm, Scene1907 *parentScene _x = kAsScene1907SymbolGroundPositions[_currPositionIndex].x; _y = kAsScene1907SymbolGroundPositions[_currPositionIndex].y; createSurface1(kAsScene1907SymbolFileHashes[_elementIndex], 1000 + _currPositionIndex); - setFileHash(kAsScene1907SymbolFileHashes[_elementIndex], 0, -1); - _newHashListIndex = 0; + startAnimation(kAsScene1907SymbolFileHashes[_elementIndex], 0, -1); + _newStickFrameIndex = 0; } _deltaRect.set(0, 0, 80, 80); Sprite::processDelta(); @@ -249,7 +249,7 @@ uint32 AsScene1907Symbol::hmTryToPlugIn(int messageNum, const MessageParam ¶ uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -345,7 +345,7 @@ void AsScene1907Symbol::tryToPlugIn() { _newPositionIndex = _parentScene->getNextPosition(); _parentScene->setPositionFree(_currPositionIndex, true); sendMessage(_parentScene, 0x1022, 1100 + _newPositionIndex); - setFileHash(kAsScene1907SymbolFileHashes[_elementIndex], 0, -1); + startAnimation(kAsScene1907SymbolFileHashes[_elementIndex], 0, -1); SetUpdateHandler(&AsScene1907Symbol::update); SetMessageHandler(&AsScene1907Symbol::hmTryToPlugIn); SetSpriteCallback(&AsScene1907Symbol::suTryToPlugIn); @@ -371,9 +371,9 @@ void AsScene1907Symbol::fallOff(int newPositionIndex, int fallOffDelay) { _y = kAsScene1907SymbolPluggedInPositions[_currPositionIndex].y; _someX = _x; _someY = _y; - setFileHash(kAsScene1907SymbolFileHashes[_elementIndex], -1, 0); + startAnimation(kAsScene1907SymbolFileHashes[_elementIndex], -1, 0); _playBackwards = true; - _newHashListIndex = -2; + _newStickFrameIndex = -2; _currStep = 0; _yAccel = 1; SetUpdateHandler(&AsScene1907Symbol::update); @@ -390,7 +390,7 @@ void AsScene1907Symbol::stFallOffHitGround() { _vm->_collisionMan->addSprite(this); SetSpriteCallback(&AsScene1907Symbol::suFallOffHitGround); NextState(&AsScene1907Symbol::cbFallOffHitGroundEvent); - _newHashListIndex = 0; + _newStickFrameIndex = 0; _currStep = 0; _yAccel = 30; _deltaX = (_x - kAsScene1907SymbolGroundPositions[_newPositionIndex].x) / 15; @@ -405,8 +405,8 @@ void AsScene1907Symbol::cbFallOffHitGroundEvent() { _currPositionIndex = _newPositionIndex; if (_symbolFlag2) _symbolFlag2--; - setFileHash(kAsScene1907SymbolFileHashes[_elementIndex], 0, -1); - _newHashListIndex = 0; + startAnimation(kAsScene1907SymbolFileHashes[_elementIndex], 0, -1); + _newStickFrameIndex = 0; SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene1907Symbol::handleMessage); SetSpriteCallback(NULL); @@ -431,7 +431,7 @@ void AsScene1907Symbol::stPlugInFail() { } void AsScene1907Symbol::moveUp() { - setFileHash(kAsScene1907SymbolFileHashes[_elementIndex], -1, -1);//???? + startAnimation(kAsScene1907SymbolFileHashes[_elementIndex], -1, -1);//???? stopAnimation(); SetMessageHandler(&AsScene1907Symbol::handleMessage); SetSpriteCallback(&AsScene1907Symbol::suMoveUp); @@ -440,7 +440,7 @@ void AsScene1907Symbol::moveUp() { } void AsScene1907Symbol::moveDown() { - setFileHash(kAsScene1907SymbolFileHashes[_elementIndex], -1, -1);//???? + startAnimation(kAsScene1907SymbolFileHashes[_elementIndex], -1, -1);//???? stopAnimation(); SetMessageHandler(&AsScene1907Symbol::handleMessage); SetSpriteCallback(&AsScene1907Symbol::suMoveDown); @@ -513,8 +513,8 @@ AsScene1907WaterHint::AsScene1907WaterHint(NeverhoodEngine *vm) createSurface1(0x110A1061, 1500); _x = 320; _y = 240; - setFileHash(0x110A1061, 0, -1); - _newHashListIndex = 0; + startAnimation(0x110A1061, 0, -1); + _newStickFrameIndex = 0; setVisible(false); _needRefresh = true; AnimatedSprite::updatePosition(); @@ -531,7 +531,7 @@ uint32 AsScene1907WaterHint::handleMessage46BA20(int messageNum, const MessagePa uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -539,7 +539,7 @@ uint32 AsScene1907WaterHint::handleMessage46BA20(int messageNum, const MessagePa void AsScene1907WaterHint::show() { setVisible(true); - setFileHash(0x110A1061, 0, -1); + startAnimation(0x110A1061, 0, -1); SetMessageHandler(&AsScene1907WaterHint::handleMessage46BA20); NextState(&AsScene1907WaterHint::hide); } diff --git a/engines/neverhood/module2000.cpp b/engines/neverhood/module2000.cpp index 9c0843c3e1..bd22c7b154 100644 --- a/engines/neverhood/module2000.cpp +++ b/engines/neverhood/module2000.cpp @@ -143,10 +143,10 @@ uint32 Scene2001::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x2000: if (param.asInteger()) { setRectList(0x004B3680); - _klayman->setKlaymanTable3(); + _klayman->setKlaymanIdleTable3(); } else { setRectList(0x004B3670); - _klayman->setKlaymanTable1(); + _klayman->setKlaymanIdleTable1(); } } return 0; diff --git a/engines/neverhood/module2100.cpp b/engines/neverhood/module2100.cpp index 66f8631b8a..c6de482cf8 100644 --- a/engines/neverhood/module2100.cpp +++ b/engines/neverhood/module2100.cpp @@ -87,8 +87,8 @@ Class538::Class538(NeverhoodEngine *vm, bool flag) SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&Class538::handleMessage); if (flag) { - setFileHash(0x0C202B9C, -1, -1); - _newHashListIndex = -2; + startAnimation(0x0C202B9C, -1, -1); + _newStickFrameIndex = -2; } else { setVisible(false); } @@ -98,7 +98,7 @@ uint32 Class538::handleMessage(int messageNum, const MessageParam ¶m, Entity uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; case 0x4808: openDoor(); @@ -111,15 +111,15 @@ uint32 Class538::handleMessage(int messageNum, const MessageParam ¶m, Entity } void Class538::openDoor() { - setFileHash(0x0C202B9C, 0, -1); - _newHashListIndex = -2; + startAnimation(0x0C202B9C, 0, -1); + _newStickFrameIndex = -2; setVisible(true); _soundResource.play(calcHash("fxDoorOpen32")); } void Class538::closeDoor() { - setFileHash(0xC222A8D4, 0, -1); - _newHashListIndex = -2; + startAnimation(0xC222A8D4, 0, -1); + _newStickFrameIndex = -2; setVisible(true); NextState(&Class538::hide); _soundResource.play(calcHash("fxDoorClose32")); @@ -145,7 +145,7 @@ uint32 Class539::handleMessage(int messageNum, const MessageParam ¶m, Entity case 0x2001: _x = _klayman->getX(); _y = _klayman->getY() - 132; - setFileHash(0x0422255A, 0, -1); + startAnimation(0x0422255A, 0, -1); setVisible(true); break; case 0x3002: @@ -311,10 +311,10 @@ uint32 Scene2101::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x2000: if (param.asInteger() != 0) { setRectList(0x004B9008); - _klayman->setKlaymanTable3(); + _klayman->setKlaymanIdleTable3(); } else { setRectList(0x004B8FF8); - _klayman->setKlaymanTable1(); + _klayman->setKlaymanIdleTable1(); } break; case 0x480B: diff --git a/engines/neverhood/module2200.cpp b/engines/neverhood/module2200.cpp index ab1fac8c5e..e886accfef 100644 --- a/engines/neverhood/module2200.cpp +++ b/engines/neverhood/module2200.cpp @@ -407,7 +407,7 @@ AsScene2201CeilingFan::AsScene2201CeilingFan(NeverhoodEngine *vm) _x = 403; _y = 259; createSurface(100, 233, 96); - setFileHash(0x8600866, 0, -1); + startAnimation(0x8600866, 0, -1); SetUpdateHandler(&AnimatedSprite::update); } @@ -421,12 +421,12 @@ AsScene2201Door::AsScene2201Door(NeverhoodEngine *vm, Klayman *klayman, Sprite * SetUpdateHandler(&AsScene2201Door::update); SetMessageHandler(&AsScene2201Door::handleMessage); if (_doorOpen) { - setFileHash(0xE2CB0412, -1, -1); + startAnimation(0xE2CB0412, -1, -1); _countdown = 48; - _newHashListIndex = -2; + _newStickFrameIndex = -2; } else { - setFileHash(0xE2CB0412, 0, -1); - _newHashListIndex = 0; + startAnimation(0xE2CB0412, 0, -1); + _newStickFrameIndex = 0; _doorLightSprite->setVisible(false); } } @@ -456,7 +456,7 @@ uint32 AsScene2201Door::handleMessage(int messageNum, const MessageParam ¶m, messageResult = _doorOpen ? 1 : 0; break; case 0x3002: - removeCallbacks(); + gotoNextState(); break; case 0x4808: _countdown = 144; @@ -469,16 +469,16 @@ uint32 AsScene2201Door::handleMessage(int messageNum, const MessageParam ¶m, void AsScene2201Door::stOpenDoor() { _doorOpen = true; - setFileHash(0xE2CB0412, 0, -1); - _newHashListIndex = -2; + startAnimation(0xE2CB0412, 0, -1); + _newStickFrameIndex = -2; _soundResource.play(calcHash("fxDoorOpen33")); } void AsScene2201Door::stCloseDoor() { _doorOpen = false; - setFileHash(0xE2CB0412, -1, -1); + startAnimation(0xE2CB0412, -1, -1); _playBackwards = true; - _newHashListIndex = 0; + _newStickFrameIndex = 0; _soundResource.play(calcHash("fxDoorClose33")); } @@ -1064,11 +1064,11 @@ AsScene2203Door::AsScene2203Door(NeverhoodEngine *vm, Scene *parentScene, uint i _y = 240; createSurface1(kAsScene2203DoorFileHashes[_index], 900); if (getGlobalVar(0x9A500914) == _index) { - setFileHash(kAsScene2203DoorFileHashes[_index], -1, -1); - _newHashListIndex = -2; + startAnimation(kAsScene2203DoorFileHashes[_index], -1, -1); + _newStickFrameIndex = -2; } else { - setFileHash(kAsScene2203DoorFileHashes[_index], 0, -1); - _newHashListIndex = 0; + startAnimation(kAsScene2203DoorFileHashes[_index], 0, -1); + _newStickFrameIndex = 0; } } @@ -1105,13 +1105,13 @@ uint32 AsScene2203Door::handleMessage(int messageNum, const MessageParam ¶m, void AsScene2203Door::openDoor() { _soundResource.play(0x341014C4); - setFileHash(kAsScene2203DoorFileHashes[_index], 1, -1); + startAnimation(kAsScene2203DoorFileHashes[_index], 1, -1); } void AsScene2203Door::closeDoor() { - setFileHash(kAsScene2203DoorFileHashes[_index], -1, -1); + startAnimation(kAsScene2203DoorFileHashes[_index], -1, -1); _playBackwards = true; - _newHashListIndex = 0; + _newStickFrameIndex = 0; } Scene2203::Scene2203(NeverhoodEngine *vm, Module *parentModule, int which) @@ -1592,7 +1592,7 @@ Scene2206::Scene2206(NeverhoodEngine *vm, Module *parentModule, int which) } _klayman->setSoundFlag(true); - _klayman->setKlaymanTable2(); + _klayman->setKlaymanIdleTable2(); } @@ -1706,11 +1706,11 @@ AsScene2207Elevator::AsScene2207Elevator(NeverhoodEngine *vm, Scene *parentScene _x = pt.x; _y = pt.y; createSurface(1100, 129, 103); - setFileHash(getGlobalVar(0x4D080E54) ? 0xC858CC19 : 0x294B3377, 0, 0); + startAnimation(getGlobalVar(0x4D080E54) ? 0xC858CC19 : 0x294B3377, 0, 0); SetUpdateHandler(&AsScene2207Elevator::update); SetSpriteCallback(&AsScene2207Elevator::suSetPosition); SetMessageHandler(&AsScene2207Elevator::handleMessage); - _newHashListIndex = 0; + _newStickFrameIndex = 0; } AsScene2207Elevator::~AsScene2207Elevator() { @@ -1721,8 +1721,8 @@ void AsScene2207Elevator::update() { if (_destPointIndex + _destPointIndexDelta > _pointIndex) { _pointIndex++; - setFileHash(getGlobalVar(0x4D080E54) ? 0xC858CC19 : 0x294B3377, _pointIndex, _pointIndex); - _newHashListIndex = _pointIndex; + startAnimation(getGlobalVar(0x4D080E54) ? 0xC858CC19 : 0x294B3377, _pointIndex, _pointIndex); + _newStickFrameIndex = _pointIndex; if (_destPointIndex + _destPointIndexDelta == _pointIndex) { if (_destPointIndexDelta != 0) { _destPointIndexDelta = 0; @@ -1737,8 +1737,8 @@ void AsScene2207Elevator::update() { _pointIndex--; if (_pointIndex == 0) sendMessage(_parentScene, 0x2003, 0); - setFileHash(getGlobalVar(0x4D080E54) ? 0xC858CC19 : 0x294B3377, _pointIndex, _pointIndex); - _newHashListIndex = _pointIndex; + startAnimation(getGlobalVar(0x4D080E54) ? 0xC858CC19 : 0x294B3377, _pointIndex, _pointIndex); + _newStickFrameIndex = _pointIndex; if (_destPointIndex + _destPointIndexDelta == _pointIndex) { if (_destPointIndexDelta != 0) { _destPointIndexDelta = 0; @@ -1817,8 +1817,8 @@ AsScene2207Lever::AsScene2207Lever(NeverhoodEngine *vm, Scene *parentScene, int1 SetMessageHandler(&AsScene2207Lever::handleMessage); createSurface(1010, 71, 73); setDoDeltaX(doDeltaX); - setFileHash(0x80880090, 0, -1); - _newHashListIndex = 0; + startAnimation(0x80880090, 0, -1); + _newStickFrameIndex = 0; _x = x; _y = y; } @@ -1831,7 +1831,7 @@ uint32 AsScene2207Lever::handleMessage(int messageNum, const MessageParam ¶m messageResult = 1; break; case 0x3002: - removeCallbacks(); + gotoNextState(); stopAnimation(); break; case 0x4807: @@ -1851,7 +1851,7 @@ uint32 AsScene2207Lever::handleMessage(int messageNum, const MessageParam ¶m } void AsScene2207Lever::stLeverDown() { - setFileHash(0x80880090, 1, -1); + startAnimation(0x80880090, 1, -1); FinalizeState(&AsScene2207Lever::stLeverDownEvent); _soundResource.play(0x40581882); } @@ -1861,7 +1861,7 @@ void AsScene2207Lever::stLeverDownEvent() { } void AsScene2207Lever::stLeverUp() { - setFileHash(0x80880090, 6, -1); + startAnimation(0x80880090, 6, -1); FinalizeState(&AsScene2207Lever::stLeverUpEvent); _playBackwards = true; _soundResource.play(0x40581882); @@ -1880,8 +1880,8 @@ AsScene2207WallRobotAnimation::AsScene2207WallRobotAnimation(NeverhoodEngine *vm createSurface1(0xCCFD6090, 100); _x = 309; _y = 320; - setFileHash(0xCCFD6090, 0, -1); - _newHashListIndex = 0; + startAnimation(0xCCFD6090, 0, -1); + _newStickFrameIndex = 0; _soundResource2.load(0x40330872); _soundResource3.load(0x72A2914A); _soundResource4.load(0xD4226080); @@ -1923,7 +1923,7 @@ uint32 AsScene2207WallRobotAnimation::handleMessage(int messageNum, const Messag stStopAnimation(); break; case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -1933,7 +1933,7 @@ void AsScene2207WallRobotAnimation::stStartAnimation() { if (!_idle) { NextState(NULL); } else { - setFileHash(0xCCFD6090, 0, -1); + startAnimation(0xCCFD6090, 0, -1); _idle = false; setVisible(true); } @@ -1962,8 +1962,8 @@ AsScene2207WallCannonAnimation::AsScene2207WallCannonAnimation(NeverhoodEngine * createSurface1(0x8CAA0099, 100); _x = 309; _y = 320; - setFileHash(0x8CAA0099, 0, -1); - _newHashListIndex = 0; + startAnimation(0x8CAA0099, 0, -1); + _newStickFrameIndex = 0; } uint32 AsScene2207WallCannonAnimation::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -1976,7 +1976,7 @@ uint32 AsScene2207WallCannonAnimation::handleMessage(int messageNum, const Messa stStopAnimation(); break; case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -1987,7 +1987,7 @@ void AsScene2207WallCannonAnimation::stStartAnimation() { NextState(NULL); } else { setVisible(true); - setFileHash(0x8CAA0099, 0, -1); + startAnimation(0x8CAA0099, 0, -1); _idle = false; } } @@ -2593,7 +2593,7 @@ HallOfRecordsScene::HallOfRecordsScene(NeverhoodEngine *vm, Module *parentModule } _klayman->setSoundFlag(true); - _klayman->setKlaymanTable2(); + _klayman->setKlaymanIdleTable2(); } diff --git a/engines/neverhood/module2600.cpp b/engines/neverhood/module2600.cpp index 5823e4dcb2..7975fcbb5d 100644 --- a/engines/neverhood/module2600.cpp +++ b/engines/neverhood/module2600.cpp @@ -284,7 +284,7 @@ uint32 AsScene2609Water::handleMessage(int messageNum, const MessageParam ¶m // TODO Sound1ChList_stop(0xDC2769B0); break; case 0x2002: - setFileHash(0x9C210C90, 0, -1); + startAnimation(0x9C210C90, 0, -1); setVisible(true); // TODO Sound1ChList_playLooping(0xDC2769B0); break; diff --git a/engines/neverhood/module3000.cpp b/engines/neverhood/module3000.cpp index 783e6166ea..8c5fd6c59d 100644 --- a/engines/neverhood/module3000.cpp +++ b/engines/neverhood/module3000.cpp @@ -639,7 +639,7 @@ AsScene3009VerticalIndicator::AsScene3009VerticalIndicator(NeverhoodEngine *vm, } void AsScene3009VerticalIndicator::show() { - setFileHash(0xC2463913, 0, -1); + startAnimation(0xC2463913, 0, -1); setVisible(true); updatePosition(); _enabled = true; @@ -705,7 +705,7 @@ void AsScene3009HorizontalIndicator::suMoveRight() { } void AsScene3009HorizontalIndicator::show() { - setFileHash(0xC0C12954, 0, -1); + startAnimation(0xC0C12954, 0, -1); setVisible(true); updatePosition(); _enabled = true; @@ -729,8 +729,8 @@ AsScene3009Symbol::AsScene3009Symbol(NeverhoodEngine *vm, Scene3009 *parentScene _x = kAsScene3009SymbolPoints[_index].x; _y = kAsScene3009SymbolPoints[_index].y; createSurface1(kAsScene3009SymbolFileHashes[_index / 3], 1200); - setFileHash(kAsScene3009SymbolFileHashes[_index / 3], _symbolIndex, -1); - _newHashListIndex = _symbolIndex; + startAnimation(kAsScene3009SymbolFileHashes[_index / 3], _symbolIndex, -1); + _newStickFrameIndex = _symbolIndex; _needRefresh = true; updatePosition(); SetUpdateHandler(&AnimatedSprite::update); @@ -756,8 +756,8 @@ uint32 AsScene3009Symbol::handleMessage(int messageNum, const MessageParam ¶ else _symbolIndex--; } - setFileHash(kAsScene3009SymbolFileHashes[_index / 3], _symbolIndex, -1); - _newHashListIndex = _symbolIndex; + startAnimation(kAsScene3009SymbolFileHashes[_index / 3], _symbolIndex, -1); + _newStickFrameIndex = _symbolIndex; setSubVar(0x00000914, _index, _symbolIndex); if (_index / 3 == 0) { sendMessage(_parentScene, 0x2001, 0); @@ -1162,11 +1162,11 @@ AsScene3010DeadBolt::AsScene3010DeadBolt(NeverhoodEngine *vm, Scene *parentScene if (getSubVar(0x14800353, kScene3010ButtonNameHashes[_boltIndex])) { createSurface1(kAsScene3010DeadBoltFileHashes1[_boltIndex], 1200); - setFileHash(kAsScene3010DeadBoltFileHashes1[_boltIndex], 0, -1); + startAnimation(kAsScene3010DeadBoltFileHashes1[_boltIndex], 0, -1); _soundResource1.load(0x46005BC4); } else { createSurface1(kAsScene3010DeadBoltFileHashes2[_boltIndex], 1200); - setFileHash(kAsScene3010DeadBoltFileHashes2[_boltIndex], 0, -1); + startAnimation(kAsScene3010DeadBoltFileHashes2[_boltIndex], 0, -1); _soundResource1.load(0x420073DC); _soundResource2.load(0x420073DC); } @@ -1193,7 +1193,7 @@ uint32 AsScene3010DeadBolt::hmAnimation(int messageNum, const MessageParam ¶ uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - removeCallbacks(); + gotoNextState(); break; } return messageResult; @@ -1210,10 +1210,10 @@ void AsScene3010DeadBolt::unlock(bool skipAnim) { if (!_unlocked) { setVisible(true); if (skipAnim) { - setFileHash(kAsScene3010DeadBoltFileHashes1[_boltIndex], -1, 0); - _newHashListIndex = -2; + startAnimation(kAsScene3010DeadBoltFileHashes1[_boltIndex], -1, 0); + _newStickFrameIndex = -2; } else { - setFileHash(kAsScene3010DeadBoltFileHashes1[_boltIndex], 0, -1); + startAnimation(kAsScene3010DeadBoltFileHashes1[_boltIndex], 0, -1); SetMessageHandler(&AsScene3010DeadBolt::hmAnimation); FinalizeState(&AsScene3010DeadBolt::stIdleMessage); NextState(&AsScene3010DeadBolt::stIdle); @@ -1234,7 +1234,7 @@ void AsScene3010DeadBolt::lock() { if (!_locked) { _locked = true; setVisible(true); - setFileHash(kAsScene3010DeadBoltFileHashes2[_boltIndex], 0, -1); + startAnimation(kAsScene3010DeadBoltFileHashes2[_boltIndex], 0, -1); SetMessageHandler(&AsScene3010DeadBolt::hmAnimation); FinalizeState(&AsScene3010DeadBolt::stDisabledMessage); NextState(&AsScene3010DeadBolt::stIdle); @@ -1253,7 +1253,7 @@ void AsScene3010DeadBolt::setCountdown(int count) { void AsScene3010DeadBolt::stDisabled() { setVisible(true); - setFileHash(kAsScene3010DeadBoltFileHashes1[_boltIndex], 0, -1); + startAnimation(kAsScene3010DeadBoltFileHashes1[_boltIndex], 0, -1); SetMessageHandler(&AsScene3010DeadBolt::hmAnimation); FinalizeState(&AsScene3010DeadBolt::stDisabledMessage); NextState(&AsScene3010DeadBolt::stIdle); @@ -1483,7 +1483,7 @@ AsScene3011Symbol::AsScene3011Symbol(NeverhoodEngine *vm, int index, bool flag) void AsScene3011Symbol::show(bool flag) { _flag2 = flag; - setFileHash(kAsScene3011SymbolFileHashes[_index], 0, -1); + startAnimation(kAsScene3011SymbolFileHashes[_index], 0, -1); setVisible(true); if (flag) { _soundResource2.play(); @@ -1508,7 +1508,7 @@ void AsScene3011Symbol::stopSound() { void AsScene3011Symbol::change(int index, bool flag) { _index = index; _flag2 = flag; - setFileHash(kAsScene3011SymbolFileHashes[_index], 0, -1); + startAnimation(kAsScene3011SymbolFileHashes[_index], 0, -1); setVisible(true); if (flag) { _soundResource2.play(); diff --git a/engines/neverhood/sprite.cpp b/engines/neverhood/sprite.cpp index 697bd6e262..b68434b493 100644 --- a/engines/neverhood/sprite.cpp +++ b/engines/neverhood/sprite.cpp @@ -223,26 +223,26 @@ AnimatedSprite::AnimatedSprite(NeverhoodEngine *vm, uint32 fileHash, int surface createSurface1(fileHash, surfacePriority); _x = x; _y = y; - setFileHash(fileHash, 0, -1); + startAnimation(fileHash, 0, -1); } void AnimatedSprite::init() { _name = "AnimatedSprite"; - _counter = 0; - _fileHash1 = 0; + _currFrameTicks = 0; + _newAnimFileHash = 0; _deltaX = 0; _deltaY = 0; - _fileHash2 = 0; + _nextAnimFileHash = 0; // TODO _callbackList = 0; - _frameIndex3 = 0; - _frameIndex = 0; - _hashListIndex = -1; + _plFirstFrameIndex = 0; + _currFrameIndex = 0; + _currStickFrameIndex = -1; _finalizeStateCb = NULL; _currStateCb = NULL; _nextStateCb = NULL; - _newHashListIndex = -1; - _fileHash4 = 0; - _flag = false; + _newStickFrameIndex = -1; + _newStickFrameHash = 0; + _frameChanged = false; _replOldColor = 0; _replNewColor = 0; _animResource.setReplEnabled(false); @@ -285,24 +285,22 @@ void AnimatedSprite::clearRepl() { void AnimatedSprite::updateAnim() { - _flag = false; + _frameChanged = false; - if (_fileHash1 == 0) { - if (_newHashListIndex != -1) { - _hashListIndex = _newHashListIndex == -2 ? _animResource.getFrameCount() - 1 : _newHashListIndex; - _newHashListIndex = -1; - } else if (_fileHash4 != 0) { - _hashListIndex = MAX(0, _animResource.getFrameIndex(_fileHash4)); - _fileHash4 = 0; + if (_newAnimFileHash == 0) { + if (_newStickFrameIndex != -1) { + _currStickFrameIndex = _newStickFrameIndex == -2 ? _animResource.getFrameCount() - 1 : _newStickFrameIndex; + _newStickFrameIndex = -1; + } else if (_newStickFrameHash != 0) { + _currStickFrameIndex = MAX(0, _animResource.getFrameIndex(_newStickFrameHash)); + _newStickFrameHash = 0; } - if (_fileHash1 == 0 && _frameIndex != _hashListIndex) { - if (_counter != 0) - _counter--; - if (_counter == 0 && _animResource.getFrameCount() != 0) { + if (_newAnimFileHash == 0 && _currFrameIndex != _currStickFrameIndex) { + if (_currFrameTicks != 0 && (--_currFrameTicks == 0) && _animResource.getFrameCount() != 0) { - if (_fileHash2 != 0) { - if (_animResource.loadInternal(_fileHash2)) { - _currAnimFileHash = _fileHash2; + if (_nextAnimFileHash != 0) { + if (_animResource.loadInternal(_nextAnimFileHash)) { + _currAnimFileHash = _nextAnimFileHash; } else { _animResource.loadInternal(calcHash("sqDefault")); _currAnimFileHash = 0; @@ -310,30 +308,30 @@ void AnimatedSprite::updateAnim() { if (_replOldColor != _replNewColor) { _animResource.setRepl(_replOldColor, _replNewColor); } - _fileHash2 = 0; + _nextAnimFileHash = 0; if (_animStatus != 0) { - _frameIndex = _fileHash6 != 0 ? MAX(0, _animResource.getFrameIndex(_fileHash6)) : 0; - _frameIndex2 = _fileHash5 != 0 ? MAX(0, _animResource.getFrameIndex(_fileHash5)) : _animResource.getFrameCount() - 1; + _currFrameIndex = _plFirstFrameHash != 0 ? MAX(0, _animResource.getFrameIndex(_plFirstFrameHash)) : 0; + _lastFrameIndex = _plLastFrameHash != 0 ? MAX(0, _animResource.getFrameIndex(_plLastFrameHash)) : _animResource.getFrameCount() - 1; } else { - _frameIndex = _frameIndex3 != -1 ? _frameIndex3 : _animResource.getFrameCount() - 1; - _frameIndex2 = _frameIndex4 != -1 ? _frameIndex4 : _animResource.getFrameCount() - 1; + _currFrameIndex = _plFirstFrameIndex != -1 ? _plFirstFrameIndex : _animResource.getFrameCount() - 1; + _lastFrameIndex = _plLastFrameIndex != -1 ? _plLastFrameIndex : _animResource.getFrameCount() - 1; } } else { updateFrameIndex(); } - if (_fileHash1 == 0) + if (_newAnimFileHash == 0) updateFrameInfo(); } } } - if (_fileHash1 != 0) { + if (_newAnimFileHash != 0) { if (_animStatus == 2) { - _hashListIndex = _frameIndex; + _currStickFrameIndex = _currFrameIndex; } else { if (_animStatus == 1) { - if (_animResource.loadInternal(_fileHash1)) { - _currAnimFileHash = _fileHash1; + if (_animResource.loadInternal(_newAnimFileHash)) { + _currAnimFileHash = _newAnimFileHash; } else { _animResource.loadInternal(calcHash("sqDefault")); _currAnimFileHash = 0; @@ -341,12 +339,12 @@ void AnimatedSprite::updateAnim() { if (_replOldColor != _replNewColor) { _animResource.setRepl(_replOldColor, _replNewColor); } - _fileHash1 = 0; - _frameIndex = _fileHash6 != 0 ? MAX(0, _animResource.getFrameIndex(_fileHash6)) : 0; - _frameIndex2 = _fileHash5 != 0 ? MAX(0, _animResource.getFrameIndex(_fileHash5)) : _animResource.getFrameCount() - 1; + _newAnimFileHash = 0; + _currFrameIndex = _plFirstFrameHash != 0 ? MAX(0, _animResource.getFrameIndex(_plFirstFrameHash)) : 0; + _lastFrameIndex = _plLastFrameHash != 0 ? MAX(0, _animResource.getFrameIndex(_plLastFrameHash)) : _animResource.getFrameCount() - 1; } else { - if (_animResource.loadInternal(_fileHash1)) { - _currAnimFileHash = _fileHash1; + if (_animResource.loadInternal(_newAnimFileHash)) { + _currAnimFileHash = _newAnimFileHash; } else { _animResource.loadInternal(calcHash("sqDefault")); _currAnimFileHash = 0; @@ -354,19 +352,19 @@ void AnimatedSprite::updateAnim() { if (_replOldColor != _replNewColor) { _animResource.setRepl(_replOldColor, _replNewColor); } - _fileHash1 = 0; - _frameIndex = _frameIndex3 != -1 ? _frameIndex3 : _animResource.getFrameCount() - 1; - _frameIndex2 = _frameIndex4 != -1 ? _frameIndex4 : _animResource.getFrameCount() - 1; + _newAnimFileHash = 0; + _currFrameIndex = _plFirstFrameIndex != -1 ? _plFirstFrameIndex : _animResource.getFrameCount() - 1; + _lastFrameIndex = _plLastFrameIndex != -1 ? _plLastFrameIndex : _animResource.getFrameCount() - 1; } updateFrameInfo(); } - if (_newHashListIndex != -1) { - _hashListIndex = _newHashListIndex == -2 ? _animResource.getFrameCount() - 1 : _newHashListIndex; - _newHashListIndex = -1; - } else if (_fileHash4 != 0) { - _hashListIndex = MAX(0, _animResource.getFrameIndex(_fileHash4)); - _fileHash4 = 0; + if (_newStickFrameIndex != -1) { + _currStickFrameIndex = _newStickFrameIndex == -2 ? _animResource.getFrameCount() - 1 : _newStickFrameIndex; + _newStickFrameIndex = -1; + } else if (_newStickFrameHash != 0) { + _currStickFrameIndex = MAX(0, _animResource.getFrameIndex(_newStickFrameHash)); + _newStickFrameHash = 0; } } @@ -391,7 +389,7 @@ void AnimatedSprite::updatePosition() { } if (_needRefresh) { - _surface->drawAnimResource(_animResource, _frameIndex, _doDeltaX, _doDeltaY, _drawRect.width, _drawRect.height); + _surface->drawAnimResource(_animResource, _currFrameIndex, _doDeltaX, _doDeltaY, _drawRect.width, _drawRect.height); _needRefresh = false; } @@ -399,46 +397,40 @@ void AnimatedSprite::updatePosition() { void AnimatedSprite::updateFrameIndex() { if (!_playBackwards) { - if (_frameIndex < _frameIndex2) { - _frameIndex++; + if (_currFrameIndex < _lastFrameIndex) { + _currFrameIndex++; } else { // Inform self about end of current animation // The caller can then e.g. set a new animation fileHash sendMessage(this, 0x3002, 0); - if (_fileHash1 == 0) - _frameIndex = 0; + if (_newAnimFileHash == 0) + _currFrameIndex = 0; } } else { - if (_frameIndex > 0) { - _frameIndex--; + if (_currFrameIndex > 0) { + _currFrameIndex--; } else { sendMessage(this, 0x3002, 0); - if (_fileHash1 == 0) - _frameIndex = _frameIndex2; + if (_newAnimFileHash == 0) + _currFrameIndex = _lastFrameIndex; } } } void AnimatedSprite::updateFrameInfo() { debug(8, "AnimatedSprite::updateFrameInfo()"); - - const AnimFrameInfo &frameInfo = _animResource.getFrameInfo(_frameIndex); - - _flag = true; + const AnimFrameInfo &frameInfo = _animResource.getFrameInfo(_currFrameIndex); + _frameChanged = true; _drawRect = frameInfo.rect; _deltaX = frameInfo.deltaX; _deltaY = frameInfo.deltaY; _deltaRect = frameInfo.deltaRect; - _counter = frameInfo.counter; - + _currFrameTicks = frameInfo.counter; processDelta(); - _needRefresh = true; - if (frameInfo.frameHash != 0) { sendMessage(this, 0x100D, frameInfo.frameHash); } - } void AnimatedSprite::createSurface1(uint32 fileHash, int surfacePriority) { @@ -446,44 +438,44 @@ void AnimatedSprite::createSurface1(uint32 fileHash, int surfacePriority) { _surface = new BaseSurface(_vm, surfacePriority, dimensions.width, dimensions.height); } -void AnimatedSprite::setFileHash(uint32 fileHash, int16 frameIndex3, int16 frameIndex4) { - debug(2, "AnimatedSprite::setFileHash(%08X, %d, %d)", fileHash, frameIndex3, frameIndex4); - _fileHash1 = fileHash; - _frameIndex3 = frameIndex3; - _frameIndex4 = frameIndex4; - _fileHash4 = 0; +void AnimatedSprite::startAnimation(uint32 fileHash, int16 plFirstFrameIndex, int16 plLastFrameIndex) { + debug(2, "AnimatedSprite::startAnimation(%08X, %d, %d)", fileHash, plFirstFrameIndex, plLastFrameIndex); + _newAnimFileHash = fileHash; + _plFirstFrameIndex = plFirstFrameIndex; + _plLastFrameIndex = plLastFrameIndex; + _newStickFrameHash = 0; _animStatus = 0; _playBackwards = false; - _newHashListIndex = -1; - _hashListIndex = -1; + _newStickFrameIndex = -1; + _currStickFrameIndex = -1; } void AnimatedSprite::stopAnimation() { - _fileHash1 = 1; + _newAnimFileHash = 1; _animStatus = 2; } -void AnimatedSprite::setFileHash2(uint32 fileHash, uint32 fileHash6, uint32 fileHash5) { - debug(2, "AnimatedSprite::setFileHash2(%08X, %08X, %08X)", fileHash, fileHash6, fileHash5); - _fileHash1 = fileHash; - _fileHash6 = fileHash6; - _fileHash5 = fileHash5; - _fileHash4 = 0; +void AnimatedSprite::startAnimationByHash(uint32 fileHash, uint32 plFirstFrameHash, uint32 plLastFrameHash) { + debug(2, "AnimatedSprite::startAnimationByHash(%08X, %08X, %08X)", fileHash, plFirstFrameHash, plLastFrameHash); + _newAnimFileHash = fileHash; + _plFirstFrameHash = plFirstFrameHash; + _plLastFrameHash = plLastFrameHash; + _newStickFrameHash = 0; _animStatus = 1; _playBackwards = false; - _newHashListIndex = -1; - _hashListIndex = -1; + _newStickFrameIndex = -1; + _currStickFrameIndex = -1; } -void AnimatedSprite::setFileHash3(uint32 fileHash2, uint32 fileHash6, uint32 fileHash5) { - _fileHash2 = fileHash2; - _fileHash6 = fileHash6; - _fileHash5 = fileHash5; - _fileHash4 = 0; +void AnimatedSprite::nextAnimationByHash(uint32 fileHash2, uint32 plFirstFrameHash, uint32 plLastFrameHash) { + _nextAnimFileHash = fileHash2; + _plFirstFrameHash = plFirstFrameHash; + _plLastFrameHash = plLastFrameHash; + _newStickFrameHash = 0; _animStatus = 1; _playBackwards = false; - _newHashListIndex = -1; - _hashListIndex = -1; + _newStickFrameIndex = -1; + _currStickFrameIndex = -1; } void AnimatedSprite::setFinalizeState(AnimationCb finalizeStateCb) { @@ -505,7 +497,7 @@ void AnimatedSprite::gotoState(AnimationCb currStateCb) { (this->*_currStateCb)(); } -void AnimatedSprite::removeCallbacks() { +void AnimatedSprite::gotoNextState() { if (_finalizeStateCb) { AnimationCb cb = _finalizeStateCb; _finalizeStateCb = NULL; diff --git a/engines/neverhood/sprite.h b/engines/neverhood/sprite.h index aa2272464e..b9decefd0a 100644 --- a/engines/neverhood/sprite.h +++ b/engines/neverhood/sprite.h @@ -121,32 +121,24 @@ public: void setRepl(byte oldColor, byte newColor); void clearRepl(); uint32 getCurrAnimFileHash() const { return _currAnimFileHash; } - int16 getFrameIndex() const { return _frameIndex; } + int16 getFrameIndex() const { return _currFrameIndex; } int16 getFrameIndex(uint32 frameHash) { return _animResource.getFrameIndex(frameHash); } - void setNewHashListIndex(int value) { _newHashListIndex = value; } - void setFileHash(uint32 fileHash, int16 frameIndex3, int16 frameIndex4); + void setNewHashListIndex(int value) { _newStickFrameIndex = value; } + void startAnimation(uint32 fileHash, int16 plFirstFrameIndex, int16 plLastFrameIndex); protected: typedef void (AnimatedSprite::*AnimationCb)(); AnimResource _animResource; - uint32 _currAnimFileHash; - uint32 _fileHash1; - uint32 _fileHash2; - int16 _frameIndex; - int16 _frameIndex3; - int16 _frameIndex2; - int16 _frameIndex4; - uint32 _fileHash6; - uint32 _fileHash5; + uint32 _currAnimFileHash, _newAnimFileHash, _nextAnimFileHash; + int16 _currFrameIndex, _lastFrameIndex; + int16 _plFirstFrameIndex, _plLastFrameIndex; + uint32 _plFirstFrameHash, _plLastFrameHash; int16 _animStatus; - int16 _counter; - int _hashListIndex; - int _newHashListIndex; - uint32 _fileHash4; + int16 _currFrameTicks; + int _currStickFrameIndex, _newStickFrameIndex; + uint32 _newStickFrameHash; int16 _deltaX, _deltaY; - byte _replOldColor; - byte _replNewColor; - bool _playBackwards; - bool _flag; + byte _replOldColor, _replNewColor; + bool _playBackwards, _frameChanged; /* TODO callbackListIndex dw ? callbackListCount dw ? @@ -166,11 +158,11 @@ protected: void updateFrameInfo(); void createSurface1(uint32 fileHash, int surfacePriority); void stopAnimation(); - void setFileHash2(uint32 fileHash, uint32 fileHash6, uint32 fileHash5); - void setFileHash3(uint32 fileHash2, uint32 fileHash6, uint32 fileHash5); + void startAnimationByHash(uint32 fileHash, uint32 plFirstFrameHash, uint32 plLastFrameHash); + void nextAnimationByHash(uint32 fileHash2, uint32 plFirstFrameHash, uint32 plLastFrameHash); void setFinalizeState(AnimationCb finalizeStateCb); void gotoState(AnimationCb currStateCb); - void removeCallbacks(); + void gotoNextState(); }; } // End of namespace Neverhood -- cgit v1.2.3