aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorjohndoe1232011-10-21 09:13:49 +0000
committerWillem Jan Palenstijn2013-05-08 20:39:43 +0200
commit9cf2c83e5e5a35816ab153bf8443dac691829ea8 (patch)
treeaaae7f06e6d26055b7cca20d5ef359cc2084101b /engines
parent023c36f2b6f1906c28d246a1b861e2287d85d851 (diff)
downloadscummvm-rg350-9cf2c83e5e5a35816ab153bf8443dac691829ea8.tar.gz
scummvm-rg350-9cf2c83e5e5a35816ab153bf8443dac691829ea8.tar.bz2
scummvm-rg350-9cf2c83e5e5a35816ab153bf8443dac691829ea8.zip
NEVERHOOD: Major renaming:
- Give better names to animation callback functions/vars - Give better names to animation functions (previously known as subXXXX - not completed yet) - Add dumpAllResources (which is a lie, since it only dumps animations for now) - More renaming to come
Diffstat (limited to 'engines')
-rw-r--r--engines/neverhood/diskplayerscene.cpp4
-rw-r--r--engines/neverhood/klayman.cpp1138
-rw-r--r--engines/neverhood/klayman.h163
-rw-r--r--engines/neverhood/module1000.cpp40
-rw-r--r--engines/neverhood/module1100.cpp2
-rw-r--r--engines/neverhood/module1200.cpp34
-rw-r--r--engines/neverhood/module1300.cpp34
-rw-r--r--engines/neverhood/module1400.cpp34
-rw-r--r--engines/neverhood/module1600.cpp46
-rw-r--r--engines/neverhood/module1900.cpp18
-rw-r--r--engines/neverhood/module2100.cpp6
-rw-r--r--engines/neverhood/module2200.cpp20
-rw-r--r--engines/neverhood/module2600.cpp2
-rw-r--r--engines/neverhood/module3000.cpp18
-rw-r--r--engines/neverhood/neverhood.cpp138
-rw-r--r--engines/neverhood/neverhood.h2
-rw-r--r--engines/neverhood/resourceman.h2
-rw-r--r--engines/neverhood/sprite.cpp59
-rw-r--r--engines/neverhood/sprite.h24
19 files changed, 891 insertions, 893 deletions
diff --git a/engines/neverhood/diskplayerscene.cpp b/engines/neverhood/diskplayerscene.cpp
index ace2b5ba6d..4fdc736dc5 100644
--- a/engines/neverhood/diskplayerscene.cpp
+++ b/engines/neverhood/diskplayerscene.cpp
@@ -179,7 +179,7 @@ uint32 Class494::handleMessage(int messageNum, const MessageParam &param, Entity
}
void Class494::sub43BE00() {
- setFileHash1();
+ stopAnimation();
SetUpdateHandler(&AnimatedSprite::update);
SetMessageHandler(&Sprite::handleMessage);
_surface->setVisible(false);
@@ -189,7 +189,7 @@ void Class494::sub43BE20() {
setFileHash(0x100B90B4, 0, -1);
SetUpdateHandler(&AnimatedSprite::update);
SetMessageHandler(&Class494::handleMessage);
- SetAnimationCallback3(&Class494::sub43BE00);
+ NextState(&Class494::sub43BE00);
_surface->setVisible(true);
}
diff --git a/engines/neverhood/klayman.cpp b/engines/neverhood/klayman.cpp
index 865c91a7a8..567788b729 100644
--- a/engines/neverhood/klayman.cpp
+++ b/engines/neverhood/klayman.cpp
@@ -28,17 +28,17 @@
namespace Neverhood {
static const KlaymanTableItem klaymanTable1[] = {
- {1, &Klayman::sub41FD30},
+ {1, &Klayman::stDoIdlePickEar},
{1, &Klayman::sub41FDA0},
{1, &Klayman::sub41FDF0},
- {1, &Klayman::sub41FE60},
+ {1, &Klayman::stDoIdleChest},
{1, &Klayman::sub41FEB0}
};
static const KlaymanTableItem klaymanTable2[] = {
- {1, &Klayman::sub41FD30},
+ {1, &Klayman::stDoIdlePickEar},
{1, &Klayman::sub41FDA0},
- {1, &Klayman::sub41FE60},
+ {1, &Klayman::stDoIdleChest},
{1, &Klayman::sub41FEB0}
};
@@ -51,7 +51,7 @@ static const KlaymanTableItem klaymanTable3[] = {
static const KlaymanTableItem klaymanTable4[] = {
{1, &Klayman::sub41FDA0},
- {1, &Klayman::sub41FE60},
+ {1, &Klayman::stDoIdleChest},
{1, &Klayman::sub41FEB0},
};
@@ -72,7 +72,7 @@ Klayman::Klayman(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, int
_y4 = y;
_flags = 2;
setKlaymanTable1();
- sub41FC80();
+ stTryStandIdle();
SetUpdateHandler(&Klayman::update);
}
@@ -87,7 +87,7 @@ uint32 Klayman::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4818:
sub41C930(_dataResource.getPoint(param.asInteger()).x, false);
@@ -122,22 +122,22 @@ void Klayman::setKlaymanTable3() {
// TODO setKlaymanTable(klaymanTable3, ARRAYSIZE(klaymanTable3));
}
-void Klayman::sub41FD30() {
- sub41D320(0x5B20C814, AnimationCallback(&Klayman::sub41FD40));
+void Klayman::stDoIdlePickEar() {
+ sub41D320(0x5B20C814, AnimationCallback(&Klayman::stIdlePickEar));
}
-void Klayman::sub41FD40() {
+void Klayman::stIdlePickEar() {
_status2 = 1;
_flagE5 = true;
setFileHash(0x5B20C814, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetMessageHandler(&Klayman::handleMessage41EB10);
+ SetMessageHandler(&Klayman::hmIdlePickEar);
SetSpriteCallback(NULL);
- SetAnimationCallback3(&Klayman::sub41FCF0);
- setCallback1(AnimationCallback(&Klayman::sub41FD90));
+ NextState(&Klayman::stStandAround);
+ FinalizeState(&Klayman::evIdlePickEarDone);
}
-uint32 Klayman::handleMessage41EB10(int messageNum, const MessageParam &param, Entity *sender) {
+uint32 Klayman::hmIdlePickEar(int messageNum, const MessageParam &param, Entity *sender) {
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
switch (messageNum) {
case 0x100D:
@@ -149,7 +149,7 @@ uint32 Klayman::handleMessage41EB10(int messageNum, const MessageParam &param, E
return messageResult;
}
-void Klayman::sub41FD90() {
+void Klayman::evIdlePickEarDone() {
_soundResource1.stop();
}
@@ -164,7 +164,7 @@ void Klayman::sub41FDB0() {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41E980);
SetSpriteCallback(NULL);
- SetAnimationCallback3(&Klayman::sub41FCF0);
+ NextState(&Klayman::stStandAround);
}
uint32 Klayman::handleMessage41E980(int messageNum, const MessageParam &param, Entity *sender) {
@@ -190,8 +190,8 @@ void Klayman::sub41FE00() {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41E9E0);
SetSpriteCallback(NULL);
- SetAnimationCallback3(&Klayman::sub41FCF0);
- setCallback1(AnimationCallback(&Klayman::sub41FE50));
+ NextState(&Klayman::stStandAround);
+ FinalizeState(&Klayman::sub41FE50);
}
void Klayman::sub41FE50() {
@@ -214,21 +214,21 @@ uint32 Klayman::handleMessage41E9E0(int messageNum, const MessageParam &param, E
return messageResult;
}
-void Klayman::sub41FE60() {
- sub41D320(0x40A0C034, AnimationCallback(&Klayman::sub41FE70));
+void Klayman::stDoIdleChest() {
+ sub41D320(0x40A0C034, AnimationCallback(&Klayman::stIdleChest));
}
-void Klayman::sub41FE70() {
+void Klayman::stIdleChest() {
_status2 = 1;
_flagE5 = true;
setFileHash(0x40A0C034, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetMessageHandler(&Klayman::handleMessage41EF80);
+ SetMessageHandler(&Klayman::hmIdleChest);
SetSpriteCallback(NULL);
- SetAnimationCallback3(&Klayman::sub41FCF0);
+ NextState(&Klayman::stStandAround);
}
-uint32 Klayman::handleMessage41EF80(int messageNum, const MessageParam &param, Entity *sender) {
+uint32 Klayman::hmIdleChest(int messageNum, const MessageParam &param, Entity *sender) {
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
switch (messageNum) {
case 0x100D:
@@ -251,7 +251,7 @@ void Klayman::sub41FEC0() {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41EFE0);
SetSpriteCallback(NULL);
- SetAnimationCallback3(&Klayman::sub41FCF0);
+ NextState(&Klayman::stStandAround);
}
uint32 Klayman::handleMessage41EFE0(int messageNum, const MessageParam &param, Entity *sender) {
@@ -306,22 +306,22 @@ void Klayman::update41D1C0() {
if (_counter3 >= _counter3Max) {
_counter3 = 0;
_counter3Max = _vm->_rnd->getRandomNumber(64) + 24;
- sub4213F0();
+ stIdleSitBlink();
}
}
}
-void Klayman::sub4213F0() {
+void Klayman::stIdleSitBlink() {
_status2 = 0;
_flagE5 = true;
setFileHash(0x5C24C018, 0, -1);
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41D480);
SetSpriteCallback(NULL);
- SetAnimationCallback3(&Klayman::sub4213B0);
+ NextState(&Klayman::stIdleSitBlinkSecond);
}
-void Klayman::sub4213B0() {
+void Klayman::stIdleSitBlinkSecond() {
_status2 = 0;
_flagE5 = true;
setFileHash(0x5C24C018, 0, -1);
@@ -330,21 +330,21 @@ void Klayman::sub4213B0() {
SetSpriteCallback(NULL);
}
-void Klayman::sub420060() {
- setDoDeltaX(((Sprite*)_attachedSprite)->getX() < _x ? 1 : 0);
- if (!sub41CEB0(AnimationCallback(&Klayman::sub420060))) {
+void Klayman::stPickUpNeedle() {
+ setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
+ if (!stStartAction(AnimationCallback(&Klayman::stPickUpNeedle))) {
_status2 = 1;
_flagE5 = false;
setFileHash(0x1449C169, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetMessageHandler(&Klayman::handleMessage41D4C0);
+ SetMessageHandler(&Klayman::hmPickUpGeneric);
SetSpriteCallback(NULL);
}
}
void Klayman::sub41FFF0() {
- setDoDeltaX(((Sprite*)_attachedSprite)->getX() < _x ? 1 : 0);
- if (!sub41CEB0(AnimationCallback(&Klayman::sub41FFF0))) {
+ setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
+ if (!stStartAction(AnimationCallback(&Klayman::sub41FFF0))) {
_status2 = 1;
_flagE5 = false;
setFileHash(0x0018C032, 0, -1);
@@ -395,8 +395,8 @@ void Klayman::sub421510() {
SetSpriteCallback(NULL);
}
-void Klayman::sub421160() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub421160))) {
+void Klayman::stStepOver() {
+ if (!stStartAction(AnimationCallback(&Klayman::stStepOver))) {
_status2 = 2;
_flagE5 = false;
setFileHash(0x004AA310, 0, -1);
@@ -406,8 +406,8 @@ void Klayman::sub421160() {
}
}
-void Klayman::sub4212C0() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub4212C0))) {
+void Klayman::stSitInTeleporter() {
+ if (!stStartAction(AnimationCallback(&Klayman::stSitInTeleporter))) {
_status2 = 0;
_flagE5 = false;
setFileHash(0x392A0330, 0, -1);
@@ -443,7 +443,7 @@ void Klayman::sub421310() {
void Klayman::sub41CE70() {
_x4 = _x;
if (!_flagE1 && !_flagE2 && !_flagE3) {
- setCallback2(NULL);
+ gotoState(NULL);
sub41C7B0();
}
}
@@ -452,7 +452,7 @@ void Klayman::sub41D320(uint32 fileHash, AnimationCb callback) {
_resourceHandle = _vm->_res->useResource(fileHash);
if (_resourceHandle != -1) {
// TODO _vm->_res->moveToFront(_resourceHandle);
- SetAnimationCallback3(callback);
+ NextState(callback);
SetUpdateHandler(&Klayman::update41D2B0);
}
}
@@ -470,7 +470,7 @@ void Klayman::update41D2B0() {
update();
}
-bool Klayman::sub41CF10(AnimationCb callback) {
+bool Klayman::stStartActionFromIdle(AnimationCb callback) {
if (_status2 == 2) {
_status2 = 1;
_flagE5 = false;
@@ -478,21 +478,21 @@ bool Klayman::sub41CF10(AnimationCb callback) {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41F140);
SetSpriteCallback(NULL);
- SetAnimationCallback3(callback);
+ NextState(callback);
return true;
}
return false;
}
void Klayman::sub41C7B0() {
- if (_callback1Cb) {
- AnimationCb cb = _callback1Cb;
- _callback1Cb = NULL;
+ if (_finalizeStateCb) {
+ AnimationCb cb = _finalizeStateCb;
+ _finalizeStateCb = NULL;
(this->*cb)();
}
- if (_callback3Cb) {
- AnimationCb cb = _callback3Cb;
- _callback3Cb = NULL;
+ if (_nextStateCb) {
+ AnimationCb cb = _nextStateCb;
+ _nextStateCb = NULL;
(this->*cb)();
#if 0 // TODO
} else if (_callbackList) {
@@ -513,8 +513,8 @@ void Klayman::sub41C790() {
_status3 = 0;
}
-void Klayman::sub41FC80() {
- if (!sub41CF10(AnimationCallback(&Klayman::sub41FC80))) {
+void Klayman::stTryStandIdle() {
+ if (!stStartActionFromIdle(AnimationCallback(&Klayman::stTryStandIdle))) {
_status2 = 1;
_flagE5 = true;
setFileHash(0x5420E254, 0, -1);
@@ -547,7 +547,7 @@ void Klayman::update41D0F0() {
if (_counter3 >= _counter3Max) {
_counter3 = 0;
_counter3Max = _vm->_rnd->getRandomNumber(64) + 24;
- sub41FF00();
+ stStand();
}
}
}
@@ -560,7 +560,7 @@ uint32 Klayman::handleMessage41D360(int messageNum, const MessageParam &param, E
messageResult = _flagE5;
break;
case 0x1014:
- _attachedSprite = param.asEntity();
+ _attachedSprite = (Sprite*)(param.asEntity());
break;
case 0x1019:
sub41C7B0();
@@ -589,14 +589,14 @@ uint32 Klayman::handleMessage41D360(int messageNum, const MessageParam &param, E
return messageResult;
}
-void Klayman::sub41FF00() {
+void Klayman::stStand() {
_status2 = 1;
_flagE5 = true;
setFileHash(0x5900C41E, 0, -1);
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41D480);
SetSpriteCallback(NULL);
- SetAnimationCallback3(&Klayman::sub41FCF0);
+ NextState(&Klayman::stStandAround);
}
uint32 Klayman::handleMessage41D480(int messageNum, const MessageParam &param, Entity *sender) {
@@ -609,7 +609,7 @@ uint32 Klayman::handleMessage41D480(int messageNum, const MessageParam &param, E
return messageResult;
}
-void Klayman::sub41FCF0() {
+void Klayman::stStandAround() {
_status2 = 1;
_flagE5 = true;
setFileHash(0x5420E254, 0, -1);
@@ -638,33 +638,33 @@ void Klayman::sub41C930(int16 x, bool flag) {
if (x == _x) {
_x4 = x;
if (!_flagE1 && !_flagE2 && !_flagE3) {
- setCallback2(NULL);
+ gotoState(NULL);
sub41C7B0();
}
} else if (xdiff <= 36 && !_flagE1 && !_flagE2 && !_flagE3) {
_x4 = x;
- setCallback2(NULL);
+ gotoState(NULL);
sub41C7B0();
} else if (xdiff <= 42 && _status3 != 3) {
if (_flagE2 && ((!_doDeltaX && x - _x > 0) || (_doDeltaX && x - _x < 0)) && ABS(_x4 - _x) > xdiff) {
_x4 = x;
} else {
_x4 = x;
- setCallback2(AnimationCallback(&Klayman::sub41FB40));
+ GotoState(&Klayman::stSneak);
}
} else if (_flagE1 && ((!_doDeltaX && x - _x > 0) || (_doDeltaX && x - _x < 0))) {
_x4 = x;
} else if (flag) {
_x4 = x;
- error("// TODO AnimatedSprite_setCallback2(AnimationCallback(&Klayman::sub421550));");
- // TODO AnimatedSprite_setCallback2(AnimationCallback(&Klayman::sub421550));
+ error("// TODO AnimatedSprite_GotoState(&Klayman::sub421550));");
+ // TODO AnimatedSprite_GotoState(&Klayman::sub421550);
} else {
_x4 = x;
- setCallback2(AnimationCallback(&Klayman::sub41F950));
+ GotoState(&Klayman::stStartWalking);
}
}
-void Klayman::sub4211F0() {
+void Klayman::stWakeUp() {
_status2 = 1;
_flagE5 = false;
setFileHash(0x527AC970, 0, -1);
@@ -673,16 +673,16 @@ void Klayman::sub4211F0() {
SetSpriteCallback(NULL);
}
-void Klayman::sub4211B0() {
+void Klayman::stSleeping() {
_status2 = 0;
_flagE5 = true;
setFileHash(0x5A38C110, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetMessageHandler(&Klayman::handleMessage41E920);
+ SetMessageHandler(&Klayman::hmSleeping);
SetSpriteCallback(NULL);
}
-uint32 Klayman::handleMessage41E920(int messageNum, const MessageParam &param, Entity *sender) {
+uint32 Klayman::hmSleeping(int messageNum, const MessageParam &param, Entity *sender) {
uint32 messageResult = handleMessage41D360(messageNum, param, sender);
switch (messageNum) {
case 0x100D:
@@ -694,7 +694,7 @@ uint32 Klayman::handleMessage41E920(int messageNum, const MessageParam &param, E
return messageResult;
}
-bool Klayman::sub41CEB0(AnimationCb callback3) {
+bool Klayman::stStartAction(AnimationCb callback3) {
if (_status2 == 1) {
_status2 = 2;
_flagE5 = false;
@@ -702,7 +702,7 @@ bool Klayman::sub41CEB0(AnimationCb callback3) {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41F140);
SetSpriteCallback(&Klayman::spriteUpdate41F250);
- SetAnimationCallback3(callback3);
+ NextState(callback3);
return true;
} else {
_x = _x4;
@@ -789,7 +789,7 @@ void Klayman::spriteUpdate41F5F0() {
}
-void Klayman::sub41FB40() {
+void Klayman::stSneak() {
_status2 = 1;
_flagE2 = true;
_flagE5 = true;
@@ -798,10 +798,10 @@ void Klayman::sub41FB40() {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41DD80);
SetSpriteCallback(&Klayman::spriteUpdate41F5F0);
- setCallback1(AnimationCallback(&Klayman::sub41FBB0));
+ FinalizeState(&Klayman::stSneakDone);
}
-void Klayman::sub41FBB0() {
+void Klayman::stSneakDone() {
_flagE2 = false;
}
@@ -844,15 +844,15 @@ void Klayman::sub41CD70(int16 x) {
}
} else if (x == _x) {
_x4 = x;
- setCallback2(NULL);
+ gotoState(NULL);
sub41C7B0();
} else {
sub41C930(x, false);
}
}
-void Klayman::sub41F950() {
- if (!sub41CF10(AnimationCallback(&Klayman::sub41F950))) {
+void Klayman::stStartWalking() {
+ if (!stStartActionFromIdle(AnimationCallback(&Klayman::stStartWalking))) {
_status2 = 0;
_flagE1 = true;
_flagE5 = true;
@@ -861,12 +861,12 @@ void Klayman::sub41F950() {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41EC70);
SetSpriteCallback(&Klayman::spriteUpdate41F320);
- setCallback1(AnimationCallback(&Klayman::sub41FB30));
- SetAnimationCallback3(&Klayman::sub41F9E0);
+ FinalizeState(&Klayman::stStartWalkingDone);
+ NextState(&Klayman::stWalking);
}
}
-void Klayman::sub41FB30() {
+void Klayman::stStartWalkingDone() {
_flagE1 = false;
}
@@ -892,7 +892,7 @@ uint32 Klayman::handleMessage41EC70(int messageNum, const MessageParam &param, E
return messageResult;
}
-void Klayman::sub41F9E0() {
+void Klayman::stWalking() {
_status2 = 0;
_flagE1 = true;
_flagE5 = true;
@@ -900,8 +900,8 @@ void Klayman::sub41F9E0() {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41EB70);
SetSpriteCallback(&Klayman::spriteUpdate41F300);
- setCallback1(AnimationCallback(&Klayman::sub41FB30));
- SetAnimationCallback3(&Klayman::sub41FA40);
+ FinalizeState(&Klayman::stStartWalkingDone);
+ NextState(&Klayman::sub41FA40);
}
void Klayman::spriteUpdate41F300() {
@@ -959,7 +959,7 @@ void Klayman::sub41FA40() {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41DD80);
SetSpriteCallback(&Klayman::spriteUpdate41F5F0);
- setCallback1(AnimationCallback(&Klayman::sub41FBB0));
+ FinalizeState(&Klayman::stSneakDone);
}
}
@@ -1035,19 +1035,19 @@ uint32 Klayman::handleMessage41E210(int messageNum, const MessageParam &param, E
return messageResult;
}
-void Klayman::sub41FF80() {
- setDoDeltaX(((Sprite*)_attachedSprite)->getX() < _x ? 1 : 0);
- if (!sub41CEB0(AnimationCallback(&Klayman::sub41FF80))) {
+void Klayman::stPickUpGeneric() {
+ setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
+ if (!stStartAction(AnimationCallback(&Klayman::stPickUpGeneric))) {
_status2 = 1;
_flagE5 = false;
setFileHash(0x1C28C178, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetMessageHandler(&Klayman::handleMessage41D4C0);
+ SetMessageHandler(&Klayman::hmPickUpGeneric);
SetSpriteCallback(NULL);
}
}
-uint32 Klayman::handleMessage41D4C0(int messageNum, const MessageParam &param, Entity *sender) {
+uint32 Klayman::hmPickUpGeneric(int messageNum, const MessageParam &param, Entity *sender) {
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
switch (messageNum) {
case 0x100D:
@@ -1073,18 +1073,18 @@ uint32 Klayman::handleMessage41D4C0(int messageNum, const MessageParam &param, E
}
-void Klayman::sub420120() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub420120))) {
+void Klayman::stTurnPressButton() {
+ if (!stStartAction(AnimationCallback(&Klayman::stTurnPressButton))) {
_status2 = 2;
_flagE5 = true;
setFileHash(0x1C02B03D, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetMessageHandler(&Klayman::handleMessage41DAD0);
+ SetMessageHandler(&Klayman::hmPressButton);
SetSpriteCallback(NULL);
}
}
-uint32 Klayman::handleMessage41DAD0(int messageNum, const MessageParam &param, Entity *sender) {
+uint32 Klayman::hmPressButton(int messageNum, const MessageParam &param, Entity *sender) {
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
switch (messageNum) {
case 0x100D:
@@ -1102,24 +1102,24 @@ uint32 Klayman::handleMessage41DAD0(int messageNum, const MessageParam &param, E
return messageResult;
}
-void Klayman::sub420170() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub420170))) {
+void Klayman::stStampFloorButton() {
+ if (!stStartAction(AnimationCallback(&Klayman::stStampFloorButton))) {
_status2 = 2;
_flagE5 = true;
setFileHash(0x1C16B033, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetMessageHandler(&Klayman::handleMessage41DAD0);
+ SetMessageHandler(&Klayman::hmPressButton);
SetSpriteCallback(NULL);
}
}
-void Klayman::sub4200D0() {
- if (!sub41CF10(AnimationCallback(&Klayman::sub4200D0))) {
+void Klayman::stPressButtonSide() {
+ if (!stStartActionFromIdle(AnimationCallback(&Klayman::stPressButtonSide))) {
_status2 = 1;
_flagE5 = true;
setFileHash(0x1CD89029, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetMessageHandler(&Klayman::handleMessage41DAD0);
+ SetMessageHandler(&Klayman::hmPressButton);
SetSpriteCallback(&Klayman::spriteUpdate41F250);
}
}
@@ -1135,7 +1135,7 @@ void Klayman::sub41CD00(int16 x) {
sub41C930(x, false);
} else {
_x4 = x;
- setCallback2(NULL);
+ gotoState(NULL);
sub41C7B0();
}
}
@@ -1144,7 +1144,7 @@ void Klayman::sub41CC40(int16 x1, int16 x2) {
if (_x > x1) {
if (_x == x1 + x2) {
_x4 = x1 + x2;
- setCallback2(NULL);
+ gotoState(NULL);
sub41C7B0();
} else if (_x < x1 + x2) {
sub41CAC0(x1 + x2);
@@ -1154,7 +1154,7 @@ void Klayman::sub41CC40(int16 x1, int16 x2) {
} else {
if (_x == x1 - x2) {
_x4 = x1 - x2;
- setCallback2(NULL);
+ gotoState(NULL);
sub41C7B0();
} else if (_x > x1 - x2) {
sub41CAC0(x1 - x2);
@@ -1169,45 +1169,45 @@ void Klayman::sub41CAC0(int16 x) {
if (x == _x) {
_x4 = x;
if (!_flagE1 && !_flagE2 && !_flagE3) {
- setCallback2(NULL);
+ gotoState(NULL);
sub41C7B0();
}
} else if (xdiff <= 36 && !_flagE1 && !_flagE2 && !_flagE3) {
_x4 = x;
- setCallback2(NULL);
+ gotoState(NULL);
sub41C7B0();
} else if (xdiff <= 42 && _status3 != 3) {
if (_flagE2 && ((!_doDeltaX && x - _x > 0) || (_doDeltaX && x - _x < 0)) && ABS(_x4 - _x) > xdiff) {
_x4 = x;
} else {
_x4 = x;
- setCallback2(AnimationCallback(&Klayman::sub41FB40));
+ GotoState(&Klayman::stSneak);
}
} else if (_flagE3 && ((!_doDeltaX && x - _x > 0) || (_doDeltaX && x - _x < 0))) {
_x4 = x;
} else {
_x4 = x;
- setCallback2(AnimationCallback(&Klayman::sub41FBC0));
+ GotoState(&Klayman::stLargeStep);
}
}
-void Klayman::sub41FBC0() {
+void Klayman::stLargeStep() {
_status2 = 2;
_flagE3 = true;
_flagE5 = true;
setDoDeltaX(_x4 >= _x ? 1 : 0);
setFileHash(0x08B28116, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetMessageHandler(&Klayman::handleMessage41DF10);
- SetSpriteCallback(&Klayman::spriteUpdate41F780);
- setCallback1(AnimationCallback(&Klayman::sub41FC30));
+ SetMessageHandler(&Klayman::hmLargeStep);
+ SetSpriteCallback(&Klayman::suLargeStep);
+ FinalizeState(&Klayman::stLargeStepDone);
}
-void Klayman::sub41FC30() {
+void Klayman::stLargeStepDone() {
_flagE3 = false;
}
-void Klayman::spriteUpdate41F780() {
+void Klayman::suLargeStep() {
int16 xdiff = _x4 - _x;
if (_doDeltaX) {
@@ -1253,7 +1253,7 @@ void Klayman::spriteUpdate41F780() {
}
}
-uint32 Klayman::handleMessage41DF10(int messageNum, const MessageParam &param, Entity *sender) {
+uint32 Klayman::hmLargeStep(int messageNum, const MessageParam &param, Entity *sender) {
uint32 messageResult = handleMessage41D360(messageNum, param, sender);
switch (messageNum) {
case 0x100D:
@@ -1271,7 +1271,7 @@ uint32 Klayman::handleMessage41DF10(int messageNum, const MessageParam &param, E
return messageResult;
}
-void Klayman::sub420870() {
+void Klayman::stWonderAboutHalf() {
_status2 = 0;
_flagE5 = true;
setFileHash(0xD820A114, 0, 10);
@@ -1280,7 +1280,7 @@ void Klayman::sub420870() {
SetSpriteCallback(NULL);
}
-void Klayman::sub4208B0() {
+void Klayman::stWonderAboutAfter() {
_status2 = 1;
_flagE5 = true;
setFileHash(0xD820A114, 30, -1);
@@ -1289,7 +1289,7 @@ void Klayman::sub4208B0() {
SetSpriteCallback(NULL);
}
-void Klayman::sub4208F0() {
+void Klayman::stTurnToUseHalf() {
_status2 = 0;
_flagE5 = true;
setFileHash(0x9B250AD2, 0, 7);
@@ -1312,7 +1312,7 @@ uint32 Klayman::handleMessage41EEF0(int messageNum, const MessageParam &param, E
return messageResult;
}
-void Klayman::sub420930() {
+void Klayman::stTurnAwayFromUse() {
_status2 = 1;
_flagE5 = true;
setFileHash(0x98F88391, 4, -1);
@@ -1321,7 +1321,7 @@ void Klayman::sub420930() {
SetSpriteCallback(NULL);
}
-void Klayman::sub420830() {
+void Klayman::stWonderAbout() {
_status2 = 1;
_flagE5 = true;
setFileHash(0xD820A114, 0, -1);
@@ -1330,23 +1330,22 @@ void Klayman::sub420830() {
SetSpriteCallback(NULL);
}
-void Klayman::sub41FC40() {
+void Klayman::stPeekWall() {
_status2 = 1;
_flagE5 = true;
setFileHash(0xAC20C012, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetMessageHandler(&Klayman::handleMessage41E3C0);
+ SetMessageHandler(&Klayman::hmPeekWall);
SetSpriteCallback(NULL);
}
-uint32 Klayman::handleMessage41E3C0(int messageNum, const MessageParam &param, Entity *sender) {
+uint32 Klayman::hmPeekWall(int messageNum, const MessageParam &param, Entity *sender) {
int16 speedUpFrameIndex;
switch (messageNum) {
case 0x1008:
speedUpFrameIndex = getFrameIndex(kKlaymanSpeedUpHash);
- if (_frameIndex < speedUpFrameIndex) {
+ if (_frameIndex < speedUpFrameIndex)
setFileHash(0xAC20C012, speedUpFrameIndex, -1);
- }
return 0;
case 0x100D:
if (param.asInteger() == 0x32180101) {
@@ -1360,7 +1359,7 @@ uint32 Klayman::handleMessage41E3C0(int messageNum, const MessageParam &param, E
}
void Klayman::sub420210() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub420210))) {
+ if (!stStartAction(AnimationCallback(&Klayman::sub420210))) {
_status2 = 0;
setFileHash(0xD82890BA, 0, -1);
sub4201C0();
@@ -1372,7 +1371,7 @@ void Klayman::sub4201C0() {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41D790);
SetSpriteCallback(&Klayman::spriteUpdate41F230);
- SetAnimationCallback3(&Klayman::sub420340);
+ NextState(&Klayman::sub420340);
sendMessage(_attachedSprite, 0x482B, 0);
}
@@ -1412,7 +1411,7 @@ void Klayman::sub420340() {
}
void Klayman::sub420250() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub420250))) {
+ if (!stStartAction(AnimationCallback(&Klayman::sub420250))) {
_status2 = 0;
setFileHash(0x900980B2, 0, -1);
sub4201C0();
@@ -1420,14 +1419,14 @@ void Klayman::sub420250() {
}
void Klayman::sub420290() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub420290))) {
+ if (!stStartAction(AnimationCallback(&Klayman::sub420290))) {
_status2 = 0;
_flagE5 = false;
setFileHash(0xBA1910B2, 0, -1);
SetUpdateHandler(&Klayman::update);
SetSpriteCallback(&Klayman::spriteUpdate41F230);
SetMessageHandler(&Klayman::handleMessage41D880);
- SetAnimationCallback3(&Klayman::sub420380);
+ NextState(&Klayman::sub420380);
sendMessage(_attachedSprite, 0x482B, 0);
}
}
@@ -1483,7 +1482,7 @@ void Klayman::sub4203C0() {
}
void Klayman::sub420300() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub420300))) {
+ if (!stStartAction(AnimationCallback(&Klayman::sub420300))) {
_status2 = 0;
setFileHash(0xB8699832, 0, -1);
sub4201C0();
@@ -1491,7 +1490,7 @@ void Klayman::sub420300() {
}
void Klayman::sub41CCE0(int16 x) {
- sub41CC40(((Sprite*)_attachedSprite)->getX(), x);
+ sub41CC40(_attachedSprite->getX(), x);
}
void Klayman::sub420970() {
@@ -1507,7 +1506,7 @@ void Klayman::sub420970() {
}
void Klayman::sub4209D0() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub4209D0))) {
+ if (!stStartAction(AnimationCallback(&Klayman::sub4209D0))) {
_status2 = 0;
if (_y4 < _y) {
if (_statusE0 == 1) {
@@ -1609,7 +1608,7 @@ uint32 Klayman::handleMessage41E0D0(int messageNum, const MessageParam &param, E
}
void Klayman::sub420AD0() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub420AD0))) {
+ if (!stStartAction(AnimationCallback(&Klayman::sub420AD0))) {
_status2 = 0;
if (_y4 >= _y - 30) {
sub41C7B0();
@@ -1671,7 +1670,7 @@ uint32 Klayman::handleMessage41E490(int messageNum, const MessageParam &param, E
}
void Klayman::sub420FE0() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub420FE0))) {
+ if (!stStartAction(AnimationCallback(&Klayman::sub420FE0))) {
_status2 = 2;
_flagE5 = false;
setFileHash(0xF229C003, 0, -1);
@@ -1682,7 +1681,7 @@ void Klayman::sub420FE0() {
}
void Klayman::sub4210C0() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub4210C0))) {
+ if (!stStartAction(AnimationCallback(&Klayman::sub4210C0))) {
_status2 = 0;
_flagE5 = false;
setFileHash2(0xCA221107, 0x8520108C, 0);
@@ -1693,7 +1692,7 @@ void Klayman::sub4210C0() {
}
void Klayman::sub421070() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub421070))) {
+ if (!stStartAction(AnimationCallback(&Klayman::sub421070))) {
_status2 = 2;
_flagE5 = false;
setFileHash(0xCA221107, 0, -1);
@@ -1703,7 +1702,7 @@ void Klayman::sub421070() {
}
}
-void Klayman::sub420420() {
+void Klayman::stLandOnFeet() {
_status2 = 1;
_flagE5 = true;
setFileHash(0x18118554, 0, -1);
@@ -1725,7 +1724,7 @@ uint32 Klayman::handleMessage41E290(int messageNum, const MessageParam &param, E
}
void Klayman::sub420ED0() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub420ED0))) {
+ if (!stStartAction(AnimationCallback(&Klayman::sub420ED0))) {
_status2 = 2;
_flagE5 = false;
setFileHash(0x91540140, 0, -1);
@@ -1752,7 +1751,7 @@ uint32 Klayman::handleMessage41E2F0(int messageNum, const MessageParam &param, E
}
void Klayman::sub420750() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub420750))) {
+ if (!stStartAction(AnimationCallback(&Klayman::sub420750))) {
_status2 = 2;
_flagE5 = false;
setFileHash(0x5CCCB330, 0, -1);
@@ -1762,8 +1761,8 @@ void Klayman::sub420750() {
}
}
-void Klayman::sub4207A0() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub4207A0))) {
+void Klayman::stTurnToUse() {
+ if (!stStartAction(AnimationCallback(&Klayman::stTurnToUse))) {
_status2 = 2;
_flagE5 = false;
setFileHash(0x9B250AD2, 0, -1);
@@ -1799,8 +1798,8 @@ void Klayman::spriteUpdate41F5A0() {
AnimatedSprite::updateDeltaXY();
}
-void Klayman::sub420600() {
- setDoDeltaX(((Sprite*)_attachedSprite)->getX() < _x ? 1 : 0);
+void Klayman::stMoveObjectSkipTurnFaceObject() {
+ setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
_flagE4 = false;
_flagE5 = true;
setFileHash2(0x0C1CA072, 0x01084280, 0);
@@ -1820,10 +1819,10 @@ uint32 Klayman::handleMessage41D970(int messageNum, const MessageParam &param, E
if (_attachedSprite)
sendMessage(_attachedSprite, 0x480B, _doDeltaX ? 1 : 0);
} else if (param.asInteger() == 0x02421405) {
- if (_flagE4 && _attachedSprite->hasMessageHandler() && sendMessage(_attachedSprite, 0x480C, _doDeltaX ? 1 : 0) != 0) {
- sub4205C0();
+ if (_flagE4 && sendMessage(_attachedSprite, 0x480C, _doDeltaX ? 1 : 0) != 0) {
+ stMoveObjectSkipTurn();
} else {
- setCallback1(AnimationCallback(&Klayman::sub420660));
+ FinalizeState(&Klayman::sub420660);
SetMessageHandler(&Klayman::handleMessage41D480);
}
} else if (param.asInteger() == 0x32180101) {
@@ -1839,7 +1838,7 @@ uint32 Klayman::handleMessage41D970(int messageNum, const MessageParam &param, E
return handleMessage41D480(messageNum, param, sender);
}
-void Klayman::sub4205C0() {
+void Klayman::stMoveObjectSkipTurn() {
_flagE4 = false;
_flagE5 = true;
setFileHash2(0x0C1CA072, 0x01084280, 0);
@@ -1848,9 +1847,9 @@ void Klayman::sub4205C0() {
SetMessageHandler(&Klayman::handleMessage41D970);
}
-void Klayman::sub420550() {
- setDoDeltaX(((Sprite*)_attachedSprite)->getX() < _x ? 1 : 0);
- if (!sub41CEB0(AnimationCallback(&Klayman::sub420550))) {
+void Klayman::stMoveObjectFaceObject() {
+ setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
+ if (!stStartAction(AnimationCallback(&Klayman::stMoveObjectFaceObject))) {
_status2 = 2;
_flagE4 = false;
_flagE5 = true;
@@ -1862,29 +1861,30 @@ void Klayman::sub420550() {
}
void Klayman::sub420C50() {
- if (!sub41CEB0(AnimationCallback(&Klayman::sub420C50))) {
+ if (!stStartAction(AnimationCallback(&Klayman::sub420C50))) {
_status2 = 0;
if (_flagF7) {
- sub420D50();
+ stReleaseLeverUp();
} else {
sendMessage(_attachedSprite, 0x482B, 0);
setFileHash(0x0C303040, 0, -1);
SetUpdateHandler(&Klayman::update);
SetSpriteCallback(&Klayman::spriteUpdate41F230);
SetMessageHandler(&Klayman::handleMessage41E210);
- SetAnimationCallback3(&Klayman::sub420CD0);
+ NextState(&Klayman::stPullLeverDown);
_flagE5 = false;
}
}
}
-void Klayman::sub420CD0() {
+// Exactly the same code as sub420DA0 which was removed
+void Klayman::stPullLeverDown() {
setFileHash(0x0D318140, 0, -1);
sendMessage(_attachedSprite, 0x480F, 0);
- SetAnimationCallback3(&Klayman::sub420D10);
+ NextState(&Klayman::stHoldLeverDown);
}
-void Klayman::sub420D10() {
+void Klayman::stHoldLeverDown() {
setFileHash(0x4464A440, 0, -1);
SetUpdateHandler(&Klayman::update);
SetSpriteCallback(&Klayman::spriteUpdate41F230);
@@ -1893,31 +1893,16 @@ void Klayman::sub420D10() {
_flagE5 = true;
}
-void Klayman::sub420D50() {
+void Klayman::stReleaseLeverUp() {
setFileHash(0x09018068, 0, -1);
SetUpdateHandler(&Klayman::update);
SetSpriteCallback(&Klayman::spriteUpdate41F230);
SetMessageHandler(&Klayman::handleMessage41E210);
sendMessage(_attachedSprite, 0x4807, 0);
- SetAnimationCallback3(&Klayman::sub420DA0);
+ NextState(&Klayman::stPullLeverDown);
_flagE5 = false;
}
-void Klayman::sub420DA0() {
- setFileHash(0x0D318140, 0, -1);
- sendMessage(_attachedSprite, 0x480F, 0);
- SetAnimationCallback3(&Klayman::sub420DE0);
-}
-
-void Klayman::sub420DE0() {
- setFileHash(0x4464A440, 0, -1);
- SetUpdateHandler(&Klayman::update);
- SetSpriteCallback(&Klayman::spriteUpdate41F230);
- SetMessageHandler(&Klayman::handleMessage41D360);
- _flagF7 = true;
- _flagE5 = true;
-}
-
void Klayman::sub420E20() {
if (_flagF7) {
_status2 = 2;
@@ -1926,7 +1911,7 @@ void Klayman::sub420E20() {
SetSpriteCallback(&Klayman::spriteUpdate41F230);
SetMessageHandler(&Klayman::handleMessage41E210);
sendMessage(_attachedSprite, 0x4807, 0);
- SetAnimationCallback3(&Klayman::sub420E90);
+ NextState(&Klayman::sub420E90);
_flagE5 = false;
_flagF7 = false;
} else {
@@ -1936,7 +1921,7 @@ void Klayman::sub420E20() {
void Klayman::sub420E90() {
setFileHash(0x0928C048, 0, -1);
- setCallback1(AnimationCallback(&Klayman::sub420EB0));
+ FinalizeState(&Klayman::sub420EB0);
}
void Klayman::sub420EB0() {
@@ -1944,7 +1929,7 @@ void Klayman::sub420EB0() {
}
void Klayman::sub420680() {
- if (!sub41CF10(AnimationCallback(&Klayman::sub420680))) {
+ if (!stStartActionFromIdle(AnimationCallback(&Klayman::sub420680))) {
_status2 = 2;
_counter2 = 0;
for (uint32 i = 0; i < 20; i++) {
@@ -1955,7 +1940,7 @@ void Klayman::sub420680() {
}
}
if (_counter2 == 0) {
- setCallback2(NULL);
+ gotoState(NULL);
sub41C7B0();
} else {
setFileHash(0xD8C8D100, 0, -1);
@@ -2023,26 +2008,25 @@ uint32 KmScene1001::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4804:
- if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub4211B0));
- }
+ if (param.asInteger() == 2)
+ GotoState(&Klayman::stSleeping);
break;
case 0x480D:
- setCallback2(AnimationCallback(&KmScene1001::sub44FA50));
+ GotoState(&KmScene1001::sub44FA50);
break;
case 0x4812:
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
break;
case 0x4816:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub420120));
+ GotoState(&Klayman::stTurnPressButton);
} else if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420170));
- }else {
- setCallback2(AnimationCallback(&Klayman::sub4200D0));
+ GotoState(&Klayman::stStampFloorButton);
+ } else {
+ GotoState(&Klayman::stPressButtonSide);
}
break;
case 0x4817:
@@ -2059,15 +2043,15 @@ uint32 KmScene1001::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x481F:
if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&Klayman::sub420870));
+ GotoState(&Klayman::stWonderAboutHalf);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub4208B0));
+ GotoState(&Klayman::stWonderAboutAfter);
} else if (param.asInteger() == 3) {
- setCallback2(AnimationCallback(&Klayman::sub4208F0));
+ GotoState(&Klayman::stTurnToUseHalf);
} else if (param.asInteger() == 4) {
- setCallback2(AnimationCallback(&Klayman::sub420930));
+ GotoState(&Klayman::stTurnAwayFromUse);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420830));
+ GotoState(&Klayman::stWonderAbout);
}
break;
case 0x482D:
@@ -2077,7 +2061,7 @@ uint32 KmScene1001::xHandleMessage(int messageNum, const MessageParam &param) {
case 0x4836:
if (param.asInteger() == 1) {
sendMessage(_parentScene, 0x2002, 0);
- setCallback2(AnimationCallback(&Klayman::sub4211F0));
+ GotoState(&Klayman::stWakeUp);
}
break;
case 0x483F:
@@ -2091,7 +2075,7 @@ uint32 KmScene1001::xHandleMessage(int messageNum, const MessageParam &param) {
}
void KmScene1001::sub44FA50() {
- if (!sub41CEB0(AnimationCallback(&KmScene1001::sub44FA50))) {
+ if (!stStartAction(AnimationCallback(&KmScene1001::sub44FA50))) {
_status2 = 2;
_flagE5 = false;
setFileHash(0x00648953, 0, -1);
@@ -2138,7 +2122,7 @@ void KmScene1002::xUpdate() {
uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam &param) {
switch (messageNum) {
case 0x2001:
- setCallback2(AnimationCallback(&KmScene1002::sub449E90));
+ GotoState(&KmScene1002::sub449E90);
break;
case 0x2007:
_otherSprite = (Sprite*)param.asEntity();
@@ -2148,43 +2132,43 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4803:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&KmScene1002::sub44A250));
+ GotoState(&KmScene1002::stJumpAndFall);
} else if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&KmScene1002::sub44A2C0));
+ GotoState(&KmScene1002::stDropFromRing);
}
break;
case 0x4804:
- setCallback2(AnimationCallback(&Klayman::sub41FC40));
+ GotoState(&Klayman::stPeekWall);
break;
case 0x4805:
switch (param.asInteger()) {
case 1:
- setCallback2(AnimationCallback(&Klayman::sub420210));
+ GotoState(&Klayman::sub420210);
break;
case 2:
- setCallback2(AnimationCallback(&Klayman::sub420250));
+ GotoState(&Klayman::sub420250);
break;
case 3:
- setCallback2(AnimationCallback(&Klayman::sub420290));
+ GotoState(&Klayman::sub420290);
break;
case 4:
- setCallback2(AnimationCallback(&Klayman::sub420300));
+ GotoState(&Klayman::sub420300);
break;
}
break;
case 0x480A:
- setCallback2(AnimationCallback(&KmScene1002::sub44A3E0));
+ GotoState(&KmScene1002::stMoveVenusFlyTrap);
break;
case 0x480D:
- setCallback2(AnimationCallback(&KmScene1002::sub449E20));
+ GotoState(&KmScene1002::sub449E20);
break;
case 0x4816:
if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&KmScene1002::sub44A330));
+ GotoState(&KmScene1002::stPressDoorButton);
}
break;
case 0x4817:
@@ -2196,34 +2180,34 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x4820:
sendMessage(_parentScene, 0x2005, 0);
- setCallback2(AnimationCallback(&Klayman::sub420970));
+ GotoState(&Klayman::sub420970);
break;
case 0x4821:
sendMessage(_parentScene, 0x2005, 0);
_y4 = param.asInteger();
- setCallback2(AnimationCallback(&Klayman::sub4209D0));
+ GotoState(&Klayman::sub4209D0);
break;
case 0x4822:
sendMessage(_parentScene, 0x2005, 0);
_y4 = param.asInteger();
- setCallback2(AnimationCallback(&Klayman::sub420AD0));
+ GotoState(&Klayman::sub420AD0);
break;
case 0x4823:
sendMessage(_parentScene, 0x2006, 0);
- setCallback2(AnimationCallback(&Klayman::sub420BC0));
+ GotoState(&Klayman::sub420BC0);
break;
case 0x482E:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub421030));
+ GotoState(&Klayman::sub421030);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420FE0));
+ GotoState(&Klayman::sub420FE0);
}
break;
case 0x482F:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub4210C0));
+ GotoState(&Klayman::sub4210C0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub421070));
+ GotoState(&Klayman::sub421070);
}
break;
case 0x483F:
@@ -2286,14 +2270,14 @@ uint32 KmScene1002::handleMessage4498E0(int messageNum, const MessageParam &para
} else if (param.asInteger() == 1) {
sub44A0D0();
} else if (param.asInteger() == 2) {
- sub44A050();
+ stSpitOutFall();
}
break;
}
return 0;
}
-uint32 KmScene1002::handleMessage449990(int messageNum, const MessageParam &param, Entity *sender) {
+uint32 KmScene1002::hmPressDoorButton(int messageNum, const MessageParam &param, Entity *sender) {
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
switch (messageNum) {
case 0x100D:
@@ -2301,7 +2285,7 @@ uint32 KmScene1002::handleMessage449990(int messageNum, const MessageParam &para
_flagE5 = false;
sendMessage(_attachedSprite, 0x2003, 0);
} else if (param.asInteger() == 0xDA600012) {
- sub44A370();
+ stHitByBoxingGlove();
} else if (param.asInteger() == 0x0D01B294) {
_flagE5 = false;
sendMessage(_attachedSprite, 0x480B, 0);
@@ -2311,7 +2295,7 @@ uint32 KmScene1002::handleMessage449990(int messageNum, const MessageParam &para
return messageResult;
}
-uint32 KmScene1002::handleMessage449A30(int messageNum, const MessageParam &param, Entity *sender) {
+uint32 KmScene1002::hmMoveVenusFlyTrap(int messageNum, const MessageParam &param, Entity *sender) {
switch (messageNum) {
case 0x100D:
if (param.asInteger() == 0x01084280) {
@@ -2322,7 +2306,7 @@ uint32 KmScene1002::handleMessage449A30(int messageNum, const MessageParam &para
if (_flagE4) {
if (_attachedSprite) {
if (sendMessage(_attachedSprite, 0x480C, (uint32)_doDeltaX) != 0) {
- sub44A460();
+ stContinueMovingVenusFlyTrap();
}
}
} else {
@@ -2398,7 +2382,7 @@ uint32 KmScene1002::handleMessage449D60(int messageNum, const MessageParam &para
return messageResult;
}
-void KmScene1002::spriteUpdate449DC0() {
+void KmScene1002::suFallDown() {
AnimatedSprite::updateDeltaXY();
HitRect *hitRect = _vm->_collisionMan->findHitRectAtPos(_x, _y + 10);
if (hitRect->type == 0x5001) {
@@ -2410,14 +2394,14 @@ void KmScene1002::spriteUpdate449DC0() {
}
void KmScene1002::sub449E20() {
- if (!sub41CEB0(AnimationCallback(&KmScene1002::sub449E20))) {
+ if (!stStartAction(AnimationCallback(&KmScene1002::sub449E20))) {
_status2 = 2;
_flagE5 = false;
setFileHash(0x584984B4, 0, -1);
SetUpdateHandler(&Klayman::update);
SetSpriteCallback(&AnimatedSprite::updateDeltaXY);
SetMessageHandler(&KmScene1002::handleMessage449800);
- SetAnimationCallback3(&Klayman::sub420420);
+ NextState(&Klayman::stLandOnFeet);
sendMessage(_attachedSprite, 0x482B, 0);
}
}
@@ -2439,13 +2423,11 @@ void KmScene1002::sub449EF0() {
_flagE5 = false;
setFileHash(0x000BAB02, 0, -1);
SetUpdateHandler(&KmScene1002::update4497D0);
-
// Weird stuff happening
SetMessageHandler(&Klayman::handleMessage41D360);
//SetMessageHandler(&Klayman::handleMessage41D480);
-
- SetSpriteCallback(&KmScene1002::spriteUpdate449DC0);
- SetAnimationCallback3(&KmScene1002::sub449F70);
+ SetSpriteCallback(&KmScene1002::suFallDown);
+ NextState(&KmScene1002::sub449F70);
sendMessage(_class599, 0x482A, 0);
sendMessage(_ssLadderArch, 0x482A, 0);
}
@@ -2460,7 +2442,7 @@ void KmScene1002::sub449F70() {
SetUpdateHandler(&Klayman::update);
SetSpriteCallback(NULL);
SetMessageHandler(&KmScene1002::handleMessage41D480);
- SetAnimationCallback3(&KmScene1002::sub44A230);
+ NextState(&KmScene1002::sub44A230);
sendMessage(_parentScene, 0x2002, 0);
// TODO _callbackList = NULL;
_attachedSprite = NULL;
@@ -2468,15 +2450,15 @@ void KmScene1002::sub449F70() {
sendMessage(_ssLadderArch, 0x482B, 0);
}
-void KmScene1002::sub44A050() {
+void KmScene1002::stSpitOutFall() {
_counter1 = 1;
_status2 = 0;
_flagE5 = false;
setFileHash(0x9308C132, 0, -1);
SetUpdateHandler(&KmScene1002::update4497D0);
- SetSpriteCallback(&KmScene1002::spriteUpdate449DC0);
+ SetSpriteCallback(&KmScene1002::suFallDown);
SetMessageHandler(&Klayman::handleMessage41D480);
- SetAnimationCallback3(&KmScene1002::sub449F70);
+ NextState(&KmScene1002::sub449F70);
sendMessage(_class599, 0x482A, 0);
sendMessage(_ssLadderArch, 0x482A, 0);
}
@@ -2488,8 +2470,8 @@ void KmScene1002::sub44A0D0() {
setFileHash(0x0013A206, 0, -1);
SetUpdateHandler(&KmScene1002::update4497D0);
SetMessageHandler(&Klayman::handleMessage41D360);
- SetSpriteCallback(&KmScene1002::spriteUpdate449DC0);
- SetAnimationCallback3(&KmScene1002::sub44A150);
+ SetSpriteCallback(&KmScene1002::suFallDown);
+ NextState(&KmScene1002::sub44A150);
sendMessage(_class599, 0x482A, 0);
sendMessage(_ssLadderArch, 0x482A, 0);
}
@@ -2504,7 +2486,7 @@ void KmScene1002::sub44A150() {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&KmScene1002::handleMessage41D480);
SetSpriteCallback(NULL);
- SetAnimationCallback3(&KmScene1002::sub44A230);
+ NextState(&KmScene1002::sub44A230);
sendMessage(_parentScene, 0x2002, 0);
// TODO _callbackList = NULL;
_attachedSprite = NULL;
@@ -2514,25 +2496,25 @@ void KmScene1002::sub44A150() {
void KmScene1002::sub44A230() {
setDoDeltaX(2);
- sub41FC80();
+ stTryStandIdle();
}
-void KmScene1002::sub44A250() {
- if (!sub41CEB0(AnimationCallback(&KmScene1002::sub44A250))) {
+void KmScene1002::stJumpAndFall() {
+ if (!stStartAction(AnimationCallback(&KmScene1002::stJumpAndFall))) {
sendMessage(_parentScene, 0x1024, 3);
_status2 = 2;
_flagE5 = false;
setFileHash(0xB93AB151, 0, -1);
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&KmScene1002::handleMessage449D60);
- SetSpriteCallback(&KmScene1002::spriteUpdate449DC0);
- SetAnimationCallback3(&Klayman::sub420420);
+ SetSpriteCallback(&KmScene1002::suFallDown);
+ NextState(&Klayman::stLandOnFeet);
}
}
-void KmScene1002::sub44A2C0() {
+void KmScene1002::stDropFromRing() {
if (_attachedSprite) {
- _x = ((Sprite*)_attachedSprite)->getX();
+ _x = _attachedSprite->getX();
sendMessage(_attachedSprite, 0x4807, 0);
_attachedSprite = NULL;
}
@@ -2541,59 +2523,59 @@ void KmScene1002::sub44A2C0() {
setFileHash(0x586984B1, 0, -1);
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&KmScene1002::handleMessage41D360);
- SetSpriteCallback(&KmScene1002::spriteUpdate449DC0);
- SetAnimationCallback3(&Klayman::sub420420);
+ SetSpriteCallback(&KmScene1002::suFallDown);
+ NextState(&Klayman::stLandOnFeet);
}
-void KmScene1002::sub44A330() {
+void KmScene1002::stPressDoorButton() {
_status2 = 2;
_flagE5 = true;
setDoDeltaX(0);
setFileHash(0x1CD89029, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetMessageHandler(&KmScene1002::handleMessage449990);
+ SetMessageHandler(&KmScene1002::hmPressDoorButton);
SetSpriteCallback(&Klayman::spriteUpdate41F250);
}
-void KmScene1002::sub44A370() {
+void KmScene1002::stHitByBoxingGlove() {
_status2 = 1;
_flagE5 = false;
setFileHash(0x35AA8059, 0, -1);
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&KmScene1002::handleMessage449C90);
SetSpriteCallback(&AnimatedSprite::updateDeltaXY);
- setCallback1(AnimationCallback(&KmScene1002::sub44A3C0));
+ FinalizeState(&KmScene1002::stHitByBoxingGloveDone);
}
-void KmScene1002::sub44A3C0() {
+void KmScene1002::stHitByBoxingGloveDone() {
sendMessage(_parentScene, 0x1024, 1);
}
-void KmScene1002::sub44A3E0() {
- if (!sub41CEB0(AnimationCallback(&KmScene1002::sub44A3E0))) {
+void KmScene1002::stMoveVenusFlyTrap() {
+ if (!stStartAction(AnimationCallback(&KmScene1002::stMoveVenusFlyTrap))) {
_status2 = 2;
_flagE4 = false;
_flagE5 = true;
- setDoDeltaX(((Sprite*)_attachedSprite)->getX() < _x ? 1 : 0);
+ setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
setFileHash(0x5C01A870, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetMessageHandler(&KmScene1002::handleMessage449A30);
+ SetMessageHandler(&KmScene1002::hmMoveVenusFlyTrap);
SetSpriteCallback(&AnimatedSprite::updateDeltaXY);
- setCallback1(AnimationCallback(&KmScene1002::sub44A4B0));
+ FinalizeState(&KmScene1002::stMoveVenusFlyTrapDone);
}
}
-void KmScene1002::sub44A460() {
+void KmScene1002::stContinueMovingVenusFlyTrap() {
_flagE4 = false;
_flagE5 = true;
setFileHash2(0x5C01A870, 0x01084280, 0);
SetUpdateHandler(&Klayman::update);
- SetMessageHandler(&KmScene1002::handleMessage449A30);
+ SetMessageHandler(&KmScene1002::hmMoveVenusFlyTrap);
SetSpriteCallback(&AnimatedSprite::updateDeltaXY);
- setCallback1(AnimationCallback(&KmScene1002::sub44A4B0));
+ FinalizeState(&KmScene1002::stMoveVenusFlyTrapDone);
}
-void KmScene1002::sub44A4B0() {
+void KmScene1002::stMoveVenusFlyTrapDone() {
sendMessage(_attachedSprite, 0x482A, 0);
}
@@ -2612,7 +2594,7 @@ uint32 KmScene1004::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4817:
setDoDeltaX(param.asInteger());
@@ -2622,38 +2604,38 @@ uint32 KmScene1004::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(_dataResource.getPoint(param.asInteger()).x, false);
break;
case 0x481E:
- setCallback2(AnimationCallback(&KmScene1004::sub478170));
+ GotoState(&KmScene1004::stReadNote);
break;
case 0x4820:
sendMessage(_parentScene, 0x2000, 0);
- setCallback2(AnimationCallback(&Klayman::sub420970));
+ GotoState(&Klayman::sub420970);
break;
case 0x4821:
sendMessage(_parentScene, 0x2000, 0);
_y4 = param.asInteger();
- setCallback2(AnimationCallback(&Klayman::sub4209D0));
+ GotoState(&Klayman::sub4209D0);
break;
case 0x4822:
sendMessage(_parentScene, 0x2000, 0);
_y4 = param.asInteger();
- setCallback2(AnimationCallback(&Klayman::sub420AD0));
+ GotoState(&Klayman::sub420AD0);
break;
case 0x4823:
sendMessage(_parentScene, 0x2001, 0);
- setCallback2(AnimationCallback(&Klayman::sub420BC0));
+ GotoState(&Klayman::sub420BC0);
break;
case 0x4824:
sendMessage(_parentScene, 0x2000, 0);
_y4 = _dataResource.getPoint(param.asInteger()).y;
- setCallback2(AnimationCallback(&Klayman::sub4209D0));
+ GotoState(&Klayman::sub4209D0);
break;
case 0x4825:
sendMessage(_parentScene, 0x2000, 0);
_y4 = _dataResource.getPoint(param.asInteger()).y;
- setCallback2(AnimationCallback(&Klayman::sub420AD0));
+ GotoState(&Klayman::sub420AD0);
break;
case 0x4828:
- setCallback2(AnimationCallback(&Klayman::sub420ED0));
+ GotoState(&Klayman::sub420ED0);
break;
case 0x483F:
sub41CD00(param.asInteger());
@@ -2665,7 +2647,7 @@ uint32 KmScene1004::xHandleMessage(int messageNum, const MessageParam &param) {
return 0;
}
-uint32 KmScene1004::handleMessage478110(int messageNum, const MessageParam &param, Entity *sender) {
+uint32 KmScene1004::hmReadNote(int messageNum, const MessageParam &param, Entity *sender) {
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
switch (messageNum) {
case 0x100D:
@@ -2678,12 +2660,12 @@ uint32 KmScene1004::handleMessage478110(int messageNum, const MessageParam &para
return messageResult;
}
-void KmScene1004::sub478170() {
+void KmScene1004::stReadNote() {
_status2 = 2;
_flagE5 = false;
setFileHash(0x123E9C9F, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetMessageHandler(&KmScene1004::handleMessage478110);
+ SetMessageHandler(&KmScene1004::hmReadNote);
SetSpriteCallback(&AnimatedSprite::updateDeltaXY);
}
@@ -2704,16 +2686,16 @@ uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x4004:
if (_flag1)
- setCallback2(AnimationCallback(&Klayman::sub421350));
+ GotoState(&Klayman::sub421350);
else
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4804:
if (param.asInteger() != 0) {
_x4 = param.asInteger();
- setCallback2(AnimationCallback(&Klayman::sub41F9E0));
+ GotoState(&Klayman::stWalking);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FC40));
+ GotoState(&Klayman::stPeekWall);
}
break;
case 0x4817:
@@ -2722,24 +2704,24 @@ uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x481D:
if (_flag1)
- setCallback2(AnimationCallback(&Klayman::sub4214D0));
+ GotoState(&Klayman::sub4214D0);
break;
case 0x481E:
if (_flag)
- setCallback2(AnimationCallback(&Klayman::sub421510));
+ GotoState(&Klayman::sub421510);
break;
case 0x4834:
- setCallback2(AnimationCallback(&Klayman::sub421160));
+ GotoState(&Klayman::stStepOver);
break;
case 0x4835:
sendMessage(_parentScene, 0x2000, 1);
_flag1 = true;
- setCallback2(AnimationCallback(&Klayman::sub4212C0));
+ GotoState(&Klayman::stSitInTeleporter);
break;
case 0x4836:
sendMessage(_parentScene, 0x2000, 0);
_flag1 = false;
- setCallback2(AnimationCallback(&Klayman::sub421310));
+ GotoState(&Klayman::sub421310);
break;
case 0x483D:
sub461F30();
@@ -2800,26 +2782,26 @@ uint32 KmScene1201::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x480A:
- setCallback2(AnimationCallback(&KmScene1201::sub40DF00));
+ GotoState(&KmScene1201::sub40DF00);
break;
case 0x4812:
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
break;
case 0x4813:
- setCallback2(AnimationCallback(&KmScene1201::sub40DD20));
+ GotoState(&KmScene1201::stFetchMatch);
break;
case 0x4814:
- setCallback2(AnimationCallback(&KmScene1201::sub40DFA0));
+ GotoState(&KmScene1201::stTumbleHeadless);
break;
case 0x4815:
- setCallback2(AnimationCallback(&KmScene1201::sub40E040));
+ GotoState(&KmScene1201::sub40E040);
break;
case 0x4816:
if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&Klayman::sub4200D0));
+ GotoState(&Klayman::stPressButtonSide);
}
break;
case 0x4817:
@@ -2834,13 +2816,13 @@ uint32 KmScene1201::xHandleMessage(int messageNum, const MessageParam &param) {
}
break;
case 0x481D:
- setCallback2(AnimationCallback(&Klayman::sub4207A0));
+ GotoState(&Klayman::stTurnToUse);
break;
case 0x481E:
- setCallback2(AnimationCallback(&Klayman::sub4207F0));
+ GotoState(&Klayman::sub4207F0);
break;
case 0x481F:
- setCallback2(AnimationCallback(&Klayman::sub420830));
+ GotoState(&Klayman::stWonderAbout);
break;
case 0x482D:
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
@@ -2862,7 +2844,7 @@ void KmScene1201::update40DBE0() {
Klayman::update();
}
-uint32 KmScene1201::handleMessage40DC00(int messageNum, const MessageParam &param, Entity *sender) {
+uint32 KmScene1201::hmMatch(int messageNum, const MessageParam &param, Entity *sender) {
uint32 messageResult = Klayman::handleMessage41D480(messageNum, param, sender);
switch (messageNum) {
case 0x100D:
@@ -2882,27 +2864,27 @@ uint32 KmScene1201::handleMessage40DC00(int messageNum, const MessageParam &para
return messageResult;
}
-void KmScene1201::sub40DD20() {
- if (!sub41CEB0(AnimationCallback(&KmScene1201::sub40DD20))) {
+void KmScene1201::stFetchMatch() {
+ if (!stStartAction(AnimationCallback(&KmScene1201::stFetchMatch))) {
_status2 = 0;
_flagE5 = false;
- setDoDeltaX(((Sprite*)_attachedSprite)->getX() < _x ? 1 : 0);
+ setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
setFileHash(0x9CAA0218, 0, -1);
SetUpdateHandler(&Klayman::update);
SetSpriteCallback(NULL);
- SetMessageHandler(&KmScene1201::handleMessage40DC00);
- SetAnimationCallback3(&KmScene1201::sub40DD90);
+ SetMessageHandler(&KmScene1201::hmMatch);
+ NextState(&KmScene1201::stLightMatch);
}
}
-void KmScene1201::sub40DD90() {
+void KmScene1201::stLightMatch() {
_status2 = 1;
_flagE5 = false;
- setDoDeltaX(((Sprite*)_attachedSprite)->getX() < _x ? 1 : 0);
+ setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
setFileHash(0x1222A513, 0, -1);
SetUpdateHandler(&Klayman::update);
SetSpriteCallback(NULL);
- SetMessageHandler(&KmScene1201::handleMessage40DC00);
+ SetMessageHandler(&KmScene1201::hmMatch);
}
uint32 KmScene1201::handleMessage40DDF0(int messageNum, const MessageParam &param, Entity *sender) {
@@ -2916,7 +2898,7 @@ uint32 KmScene1201::handleMessage40DDF0(int messageNum, const MessageParam &para
} else if (param.asInteger() == 0x02421405) {
if (_countdown != 0) {
_countdown--;
- sub40DF60();
+ stMoveObjectSkipTurn();
} else {
SetMessageHandler(&Klayman::handleMessage41D480);
}
@@ -2926,7 +2908,7 @@ uint32 KmScene1201::handleMessage40DDF0(int messageNum, const MessageParam &para
return Klayman::handleMessage41D480(messageNum, param, sender);
}
-uint32 KmScene1201::handleMessage40DEA0(int messageNum, const MessageParam &param, Entity *sender) {
+uint32 KmScene1201::hmTumbleHeadless(int messageNum, const MessageParam &param, Entity *sender) {
uint32 messageResult = Klayman::handleMessage41D480(messageNum, param, sender);
switch (messageNum) {
case 0x100D:
@@ -2939,7 +2921,7 @@ uint32 KmScene1201::handleMessage40DEA0(int messageNum, const MessageParam &para
}
void KmScene1201::sub40DF00() {
- if (!sub41CEB0(AnimationCallback(&KmScene1201::sub40DF00))) {
+ if (!stStartAction(AnimationCallback(&KmScene1201::sub40DF00))) {
_status2 = 2;
_flagE5 = false;
_countdown = 8;
@@ -2951,31 +2933,31 @@ void KmScene1201::sub40DF00() {
}
}
-void KmScene1201::sub40DF60() {
- _flagE5 = false;
- setFileHash2(0x0C1CA072, 0x01084280, 0);
- SetUpdateHandler(&KmScene1201::update40DBE0);
- SetSpriteCallback(&AnimatedSprite::updateDeltaXY);
- SetMessageHandler(&KmScene1201::handleMessage40DDF0);
+void KmScene1201::stMoveObjectSkipTurn() {
+ _flagE5 = false;
+ setFileHash2(0x0C1CA072, 0x01084280, 0);
+ SetUpdateHandler(&KmScene1201::update40DBE0);
+ SetSpriteCallback(&AnimatedSprite::updateDeltaXY);
+ SetMessageHandler(&KmScene1201::handleMessage40DDF0);
}
-void KmScene1201::sub40DFA0() {
- if (!sub41CF10(AnimationCallback(&KmScene1201::sub40DFA0))) {
+void KmScene1201::stTumbleHeadless() {
+ if (!stStartActionFromIdle(AnimationCallback(&KmScene1201::stTumbleHeadless))) {
_status2 = 1;
_flagE5 = false;
setDoDeltaX(0);
setFileHash(0x2821C590, 0, -1);
SetUpdateHandler(&Klayman::update);
SetSpriteCallback(&AnimatedSprite::updateDeltaXY);
- SetMessageHandler(&KmScene1201::handleMessage40DEA0);
- SetAnimationCallback3(&Klayman::sub41FC80);
+ SetMessageHandler(&KmScene1201::hmTumbleHeadless);
+ NextState(&Klayman::stTryStandIdle);
sendMessage(_class464, 0x2006, 0);
_soundResource1.play(0x62E0A356);
}
}
void KmScene1201::sub40E040() {
- if (!sub41CF10(AnimationCallback(&KmScene1201::sub40E040))) {
+ if (!stStartActionFromIdle(AnimationCallback(&KmScene1201::sub40E040))) {
_status2 = 1;
_flagE5 = false;
setFileHash(0x5420E254, 0, -1);
@@ -2994,19 +2976,19 @@ KmScene1303::KmScene1303(NeverhoodEngine *vm, Entity *parentScene, int16 x, int1
uint32 KmScene1303::xHandleMessage(int messageNum, const MessageParam &param) {
switch (messageNum) {
case 0x4804:
- setCallback2(AnimationCallback(&KmScene1303::sub4161D0));
+ GotoState(&KmScene1303::stPeekWall1);
break;
case 0x483B:
- setCallback2(AnimationCallback(&KmScene1303::sub4162B0));
+ GotoState(&KmScene1303::stPeekWallReturn);
break;
case 0x483C:
- setCallback2(AnimationCallback(&KmScene1303::sub416210));
+ GotoState(&KmScene1303::stPeekWall2);
break;
}
return 0;
}
-uint32 KmScene1303::handleMessage4160A0(int messageNum, const MessageParam &param, Entity *sender) {
+uint32 KmScene1303::hmPeekWallReturn(int messageNum, const MessageParam &param, Entity *sender) {
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
switch (messageNum) {
case 0x100D:
@@ -3028,20 +3010,20 @@ void KmScene1303::update4161A0() {
Klayman::update();
_counter3++;
if (_counter3 >= _counter3Max)
- sub416250();
+ stPeekWall3();
}
-void KmScene1303::sub4161D0() {
+void KmScene1303::stPeekWall1() {
_status2 = 0;
_flagE5 = true;
setFileHash(0xAC20C012, 8, 37);
SetUpdateHandler(&Klayman::update);
SetSpriteCallback(NULL);
SetMessageHandler(&Klayman::handleMessage41D480);
- SetAnimationCallback3(&KmScene1303::sub416250);
+ NextState(&KmScene1303::stPeekWall3);
}
-void KmScene1303::sub416210() {
+void KmScene1303::stPeekWall2() {
_status2 = 1;
_flagE5 = false;
setFileHash(0xAC20C012, 43, 49);
@@ -3050,7 +3032,7 @@ void KmScene1303::sub416210() {
SetMessageHandler(&Klayman::handleMessage41D480);
}
-void KmScene1303::sub416250() {
+void KmScene1303::stPeekWall3() {
_counter3 = 0;
_status2 = 0;
_flagE5 = true;
@@ -3062,13 +3044,13 @@ void KmScene1303::sub416250() {
_newHashListIndex = 42;
}
-void KmScene1303::sub4162B0() {
+void KmScene1303::stPeekWallReturn() {
_status2 = 0;
_flagE5 = false;
setFileHash(0x2426932E, 0, -1);
SetUpdateHandler(&Klayman::update);
SetSpriteCallback(NULL);
- SetMessageHandler(&KmScene1303::handleMessage4160A0);
+ SetMessageHandler(&KmScene1303::hmPeekWallReturn);
}
KmScene1304::KmScene1304(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
@@ -3084,15 +3066,15 @@ uint32 KmScene1304::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4812:
if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420060));
+ GotoState(&Klayman::stPickUpNeedle);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub41FFF0));
+ GotoState(&Klayman::sub41FFF0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
}
break;
case 0x4817:
@@ -3108,11 +3090,11 @@ uint32 KmScene1304::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x481F:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub420930));
+ GotoState(&Klayman::stTurnAwayFromUse);
} else if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&Klayman::sub4208F0));
+ GotoState(&Klayman::stTurnToUseHalf);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420830));
+ GotoState(&Klayman::stWonderAbout);
}
break;
case 0x483F:
@@ -3138,10 +3120,10 @@ uint32 KmScene1305::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4804:
- setCallback2(AnimationCallback(&KmScene1305::sub46BEF0));
+ GotoState(&KmScene1305::stCrashDown);
break;
case 0x4817:
setDoDeltaX(param.asInteger());
@@ -3151,7 +3133,7 @@ uint32 KmScene1305::xHandleMessage(int messageNum, const MessageParam &param) {
return 0;
}
-void KmScene1305::sub46BEF0() {
+void KmScene1305::stCrashDown() {
_soundResource1.play(0x41648271);
_status2 = 1;
_flagE5 = false;
@@ -3159,12 +3141,12 @@ void KmScene1305::sub46BEF0() {
SetUpdateHandler(&Klayman::update);
SetSpriteCallback(NULL);
SetMessageHandler(&Klayman::handleMessage41D480);
- SetAnimationCallback3(&KmScene1305::sub46BF60);
+ NextState(&KmScene1305::cbCrashDownEvent);
}
-void KmScene1305::sub46BF60() {
+void KmScene1305::cbCrashDownEvent() {
setDoDeltaX(2);
- sub41FC80();
+ stTryStandIdle();
}
KmScene1306::KmScene1306(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
@@ -3185,26 +3167,26 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x4004:
if (_flag1)
- setCallback2(AnimationCallback(&Klayman::sub421350));
+ GotoState(&Klayman::sub421350);
else
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4812:
if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420060));
+ GotoState(&Klayman::stPickUpNeedle);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub41FFF0));
+ GotoState(&Klayman::sub41FFF0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
}
break;
case 0x4816:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub420120));
+ GotoState(&Klayman::stTurnPressButton);
} else if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420170));
+ GotoState(&Klayman::stStampFloorButton);
} else {
- setCallback2(AnimationCallback(&Klayman::sub4200D0));
+ GotoState(&Klayman::stPressButtonSide);
}
break;
case 0x4817:
@@ -3212,7 +3194,7 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C7B0();
break;
case 0x481A:
- setCallback2(AnimationCallback(&Klayman::sub420680));
+ GotoState(&Klayman::sub420680);
break;
case 0x481B:
if (param.asPoint().y != 0) {
@@ -3223,27 +3205,27 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x481D:
if (_flag1)
- setCallback2(AnimationCallback(&Klayman::sub4214D0));
+ GotoState(&Klayman::sub4214D0);
else
- setCallback2(AnimationCallback(&Klayman::sub4207A0));
+ GotoState(&Klayman::stTurnToUse);
break;
case 0x481E:
if (_flag1)
- setCallback2(AnimationCallback(&Klayman::sub421510));
+ GotoState(&Klayman::sub421510);
else
- setCallback2(AnimationCallback(&Klayman::sub4207F0));
+ GotoState(&Klayman::sub4207F0);
break;
case 0x481F:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub4208B0));
+ GotoState(&Klayman::stWonderAboutAfter);
} else if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&Klayman::sub420870));
+ GotoState(&Klayman::stWonderAboutHalf);
} else if (param.asInteger() == 4) {
- setCallback2(AnimationCallback(&Klayman::sub420930));
+ GotoState(&Klayman::stTurnAwayFromUse);
} else if (param.asInteger() == 3) {
- setCallback2(AnimationCallback(&Klayman::sub4208F0));
+ GotoState(&Klayman::stTurnToUseHalf);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420830));
+ GotoState(&Klayman::stWonderAbout);
}
break;
case 0x482D:
@@ -3252,30 +3234,30 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x482E:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub421030));
+ GotoState(&Klayman::sub421030);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420FE0));
+ GotoState(&Klayman::sub420FE0);
}
break;
case 0x482F:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub4210C0));
+ GotoState(&Klayman::sub4210C0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub421070));
+ GotoState(&Klayman::sub421070);
}
break;
case 0x4834:
- setCallback2(AnimationCallback(&Klayman::sub421160));
+ GotoState(&Klayman::stStepOver);
break;
case 0x4835:
sendMessage(_parentScene, 0x2000, 1);
_flag1 = true;
- setCallback2(AnimationCallback(&Klayman::sub4212C0));
+ GotoState(&Klayman::stSitInTeleporter);
break;
case 0x4836:
sendMessage(_parentScene, 0x2000, 0);
_flag1 = false;
- setCallback2(AnimationCallback(&Klayman::sub421310));
+ GotoState(&Klayman::sub421310);
break;
case 0x483D:
sub417D40();
@@ -3337,25 +3319,25 @@ uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x480A:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub420600));
+ GotoState(&Klayman::stMoveObjectSkipTurnFaceObject);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420550));
+ GotoState(&Klayman::stMoveObjectFaceObject);
}
break;
case 0x480D:
- setCallback2(AnimationCallback(&KmScene1001::sub420C50));
+ GotoState(&KmScene1001::sub420C50);
break;
case 0x4812:
if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420060));
+ GotoState(&Klayman::stPickUpNeedle);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub41FFF0));
+ GotoState(&Klayman::sub41FFF0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
}
break;
case 0x4817:
@@ -3364,9 +3346,9 @@ uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x481A:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&KmScene1308::sub456150));
+ GotoState(&KmScene1308::sub456150);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420680));
+ GotoState(&Klayman::sub420680);
}
break;
case 0x481B:
@@ -3377,16 +3359,16 @@ uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam &param) {
}
break;
case 0x481D:
- setCallback2(AnimationCallback(&Klayman::sub4207A0));
+ GotoState(&Klayman::stTurnToUse);
break;
case 0x481E:
- setCallback2(AnimationCallback(&Klayman::sub4207F0));
+ GotoState(&Klayman::sub4207F0);
break;
case 0x4827:
- setCallback2(AnimationCallback(&Klayman::sub420E20));
+ GotoState(&Klayman::sub420E20);
break;
case 0x4834:
- setCallback2(AnimationCallback(&Klayman::sub421160));
+ GotoState(&Klayman::stStepOver);
break;
case 0x483F:
sub41CD00(param.asInteger());
@@ -3424,7 +3406,7 @@ uint32 KmScene1308::handleMessage(int messageNum, const MessageParam &param, Ent
}
void KmScene1308::sub456150() {
- if (!sub41CF10(AnimationCallback(&KmScene1308::sub456150))) {
+ if (!stStartActionFromIdle(AnimationCallback(&KmScene1308::sub456150))) {
_status2 = 2;
_flag1 = false;
for (uint i = 0; i < 3; i++) {
@@ -3446,7 +3428,7 @@ void KmScene1308::sub456150() {
}
}
if (!_flag1) {
- setCallback2(NULL);
+ gotoState(NULL);
sub41C7B0();
} else {
_flagE5 = false;
@@ -3474,22 +3456,22 @@ uint32 KmScene1401::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x480A:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub420600));
+ GotoState(&Klayman::stMoveObjectSkipTurnFaceObject);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420550));
+ GotoState(&Klayman::stMoveObjectFaceObject);
}
break;
case 0x4816:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub420120));
+ GotoState(&Klayman::stTurnPressButton);
} else if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420170));
+ GotoState(&Klayman::stStampFloorButton);
} else {
- setCallback2(AnimationCallback(&Klayman::sub4200D0));
+ GotoState(&Klayman::stPressButtonSide);
}
break;
case 0x4817:
@@ -3505,11 +3487,11 @@ uint32 KmScene1401::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x481F:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub420930));
+ GotoState(&Klayman::stTurnAwayFromUse);
} else if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&Klayman::sub4208F0));
+ GotoState(&Klayman::stTurnToUseHalf);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420830));
+ GotoState(&Klayman::stWonderAbout);
}
break;
case 0x482D:
@@ -3518,16 +3500,16 @@ uint32 KmScene1401::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x482E:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub421030));
+ GotoState(&Klayman::sub421030);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420FE0));
+ GotoState(&Klayman::sub420FE0);
}
break;
case 0x482F:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub4210C0));
+ GotoState(&Klayman::sub4210C0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub421070));
+ GotoState(&Klayman::sub421070);
}
break;
}
@@ -3549,13 +3531,13 @@ uint32 KmScene1402::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x480A:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub420600));
+ GotoState(&Klayman::stMoveObjectSkipTurnFaceObject);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420550));
+ GotoState(&Klayman::stMoveObjectFaceObject);
}
break;
case 0x4817:
@@ -3570,10 +3552,10 @@ uint32 KmScene1402::xHandleMessage(int messageNum, const MessageParam &param) {
}
break;
case 0x481D:
- setCallback2(AnimationCallback(&Klayman::sub4207A0));
+ GotoState(&Klayman::stTurnToUse);
break;
case 0x481E:
- setCallback2(AnimationCallback(&Klayman::sub4207F0));
+ GotoState(&Klayman::sub4207F0);
break;
}
return 0;
@@ -3594,25 +3576,25 @@ uint32 KmScene1403::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x480A:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub420600));
+ GotoState(&Klayman::stMoveObjectSkipTurnFaceObject);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420550));
+ GotoState(&Klayman::stMoveObjectFaceObject);
}
break;
case 0x480D:
- setCallback2(AnimationCallback(&KmScene1001::sub420C50));
+ GotoState(&KmScene1001::sub420C50);
break;
case 0x4812:
if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420060));
+ GotoState(&Klayman::stPickUpNeedle);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub41FFF0));
+ GotoState(&Klayman::sub41FFF0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
}
break;
case 0x4817:
@@ -3627,7 +3609,7 @@ uint32 KmScene1403::xHandleMessage(int messageNum, const MessageParam &param) {
}
break;
case 0x4827:
- setCallback2(AnimationCallback(&Klayman::sub420E20));
+ GotoState(&Klayman::sub420E20);
break;
case 0x483F:
sub41CD00(param.asInteger());
@@ -3654,22 +3636,22 @@ uint32 KmScene1404::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x480A:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub420600));
+ GotoState(&Klayman::stMoveObjectSkipTurnFaceObject);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420550));
+ GotoState(&Klayman::stMoveObjectFaceObject);
}
break;
case 0x4812:
if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420060));
+ GotoState(&Klayman::stPickUpNeedle);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub41FFF0));
+ GotoState(&Klayman::sub41FFF0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
}
break;
case 0x4817:
@@ -3677,7 +3659,7 @@ uint32 KmScene1404::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C7B0();
break;
case 0x481A:
- setCallback2(AnimationCallback(&Klayman::sub420680));
+ GotoState(&Klayman::sub420680);
break;
case 0x481B:
if (param.asPoint().y != 0) {
@@ -3687,22 +3669,22 @@ uint32 KmScene1404::xHandleMessage(int messageNum, const MessageParam &param) {
}
break;
case 0x481D:
- setCallback2(AnimationCallback(&Klayman::sub4207A0));
+ GotoState(&Klayman::stTurnToUse);
break;
case 0x481E:
- setCallback2(AnimationCallback(&Klayman::sub4207F0));
+ GotoState(&Klayman::sub4207F0);
break;
case 0x481F:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub4208B0));
+ GotoState(&Klayman::stWonderAboutAfter);
} else if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&Klayman::sub420870));
+ GotoState(&Klayman::stWonderAboutHalf);
} else if (param.asInteger() == 4) {
- setCallback2(AnimationCallback(&Klayman::sub420930));
+ GotoState(&Klayman::stTurnAwayFromUse);
} else if (param.asInteger() == 3) {
- setCallback2(AnimationCallback(&Klayman::sub4208F0));
+ GotoState(&Klayman::stTurnToUseHalf);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420830));
+ GotoState(&Klayman::stWonderAbout);
}
break;
case 0x482D:
@@ -3734,17 +3716,17 @@ uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x4004:
if (_flag1)
- setCallback2(AnimationCallback(&Klayman::sub421350));
+ GotoState(&Klayman::sub421350);
else
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4812:
if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420060));
+ GotoState(&Klayman::stPickUpNeedle);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub41FFF0));
+ GotoState(&Klayman::sub41FFF0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
}
break;
case 0x4817:
@@ -3760,23 +3742,23 @@ uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x481D:
if (_flag1)
- setCallback2(AnimationCallback(&Klayman::sub4214D0));
+ GotoState(&Klayman::sub4214D0);
break;
case 0x481E:
if (_flag)
- setCallback2(AnimationCallback(&Klayman::sub421510));
+ GotoState(&Klayman::sub421510);
break;
case 0x481F:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub4208B0));
+ GotoState(&Klayman::stWonderAboutAfter);
} else if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&Klayman::sub420870));
+ GotoState(&Klayman::stWonderAboutHalf);
} else if (param.asInteger() == 4) {
- setCallback2(AnimationCallback(&Klayman::sub420930));
+ GotoState(&Klayman::stTurnAwayFromUse);
} else if (param.asInteger() == 3) {
- setCallback2(AnimationCallback(&Klayman::sub4208F0));
+ GotoState(&Klayman::stTurnToUseHalf);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420830));
+ GotoState(&Klayman::stWonderAbout);
}
break;
case 0x482D:
@@ -3784,17 +3766,17 @@ uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C7B0();
break;
case 0x4834:
- setCallback2(AnimationCallback(&Klayman::sub421160));
+ GotoState(&Klayman::stStepOver);
break;
case 0x4835:
sendMessage(_parentScene, 0x2032, 1);
_flag1 = true;
- setCallback2(AnimationCallback(&Klayman::sub4212C0));
+ GotoState(&Klayman::stSitInTeleporter);
break;
case 0x4836:
sendMessage(_parentScene, 0x2032, 0);
_flag1 = false;
- setCallback2(AnimationCallback(&Klayman::sub421310));
+ GotoState(&Klayman::sub421310);
break;
case 0x483F:
sub41CD00(param.asInteger());
@@ -3827,21 +3809,21 @@ uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x4004:
if (_flag) {
- setCallback2(AnimationCallback(&Klayman::sub421350));
+ GotoState(&Klayman::sub421350);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
}
break;
case 0x4803:
- setCallback2(AnimationCallback(&KmScene1705::sub468A80));
+ GotoState(&KmScene1705::stFallSkipJump);
break;
case 0x4812:
if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420060));
+ GotoState(&Klayman::stPickUpNeedle);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub41FFF0));
+ GotoState(&Klayman::sub41FFF0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
}
break;
case 0x4817:
@@ -3857,39 +3839,39 @@ uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x481D:
if (_flag) {
- setCallback2(AnimationCallback(&Klayman::sub4214D0));
+ GotoState(&Klayman::sub4214D0);
}
break;
case 0x481E:
if (_flag) {
- setCallback2(AnimationCallback(&Klayman::sub421510));
+ GotoState(&Klayman::sub421510);
}
break;
case 0x481F:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub4208B0));
+ GotoState(&Klayman::stWonderAboutAfter);
} else if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&Klayman::sub420870));
+ GotoState(&Klayman::stWonderAboutHalf);
} else if (param.asInteger() == 4) {
- setCallback2(AnimationCallback(&Klayman::sub420930));
+ GotoState(&Klayman::stTurnAwayFromUse);
} else if (param.asInteger() == 3) {
- setCallback2(AnimationCallback(&Klayman::sub4208F0));
+ GotoState(&Klayman::stTurnToUseHalf);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420830));
+ GotoState(&Klayman::stWonderAbout);
}
break;
case 0x4834:
- setCallback2(AnimationCallback(&Klayman::sub421160));
+ GotoState(&Klayman::stStepOver);
break;
case 0x4835:
sendMessage(_parentScene, 0x2000, 1);
_flag = true;
- setCallback2(AnimationCallback(&Klayman::sub4212C0));
+ GotoState(&Klayman::stSitInTeleporter);
break;
case 0x4836:
sendMessage(_parentScene, 0x2000, 0);
_flag = false;
- setCallback2(AnimationCallback(&Klayman::sub421310));
+ GotoState(&Klayman::sub421310);
break;
case 0x483D:
sub468AD0();
@@ -3925,14 +3907,14 @@ void KmScene1705::spriteUpdate468A30() {
}
}
-void KmScene1705::sub468A80() {
+void KmScene1705::stFallSkipJump() {
_status2 = 2;
_flagE5 = false;
setFileHash2(0xB93AB151, 0x40A100F8, 0);
SetUpdateHandler(&Klayman::update);
SetSpriteCallback(&KmScene1705::spriteUpdate468A30);
SetMessageHandler(&Klayman::handleMessage41D360);
- SetAnimationCallback3(&Klayman::sub420420);
+ NextState(&Klayman::stLandOnFeet);
}
void KmScene1705::sub468AD0() {
@@ -3966,17 +3948,17 @@ uint32 KmScene1901::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4817:
setDoDeltaX(param.asInteger());
sub41C7B0();
break;
case 0x481D:
- setCallback2(AnimationCallback(&Klayman::sub4207A0));
+ GotoState(&Klayman::stTurnToUse);
break;
case 0x481E:
- setCallback2(AnimationCallback(&Klayman::sub4207F0));
+ GotoState(&Klayman::sub4207F0);
break;
case 0x482D:
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
@@ -4009,17 +3991,17 @@ uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x4004:
if (_flag) {
- setCallback2(AnimationCallback(&Klayman::sub421350));
+ GotoState(&Klayman::sub421350);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
}
break;
case 0x4804:
if (param.asInteger() != 0) {
_x4 = param.asInteger();
- setCallback2(AnimationCallback(&Klayman::sub41F9E0));
+ GotoState(&Klayman::stWalking);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FC40));
+ GotoState(&Klayman::stPeekWall);
}
break;
case 0x4817:
@@ -4028,32 +4010,32 @@ uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x481D:
if (_flag) {
- setCallback2(AnimationCallback(&Klayman::sub4214D0));
+ GotoState(&Klayman::sub4214D0);
}
break;
case 0x481E:
if (_flag) {
- setCallback2(AnimationCallback(&Klayman::sub421510));
+ GotoState(&Klayman::sub421510);
}
break;
case 0x4834:
- setCallback2(AnimationCallback(&Klayman::sub421160));
+ GotoState(&Klayman::stStepOver);
break;
case 0x4835:
sendMessage(_parentScene, 0x2000, 1);
_flag = true;
- setCallback2(AnimationCallback(&Klayman::sub4212C0));
+ GotoState(&Klayman::stSitInTeleporter);
break;
case 0x4836:
sendMessage(_parentScene, 0x2000, 0);
_flag = false;
- setCallback2(AnimationCallback(&Klayman::sub421310));
+ GotoState(&Klayman::sub421310);
break;
case 0x483D:
sub440230();
break;
case 0x483E:
- sub440270();
+ stDoTeleport();
break;
}
return 0;
@@ -4082,7 +4064,7 @@ void KmScene2001::sub440230() {
SetMessageHandler(&KmScene2001::handleMessage4401A0);
}
-void KmScene2001::sub440270() {
+void KmScene2001::stDoTeleport() {
_status2 = 0;
_flagE5 = false;
setFileHash(0x18AB4ED4, 0, -1);
@@ -4110,29 +4092,29 @@ uint32 KmScene2101::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x4004:
if (_flag1)
- setCallback2(AnimationCallback(&Klayman::sub421350));
+ GotoState(&Klayman::sub421350);
else
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4811:
- setCallback2(AnimationCallback(&KmScene2101::sub4862C0));
+ GotoState(&KmScene2101::sub4862C0);
break;
case 0x4812:
if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420060));
+ GotoState(&Klayman::stPickUpNeedle);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub41FFF0));
+ GotoState(&Klayman::sub41FFF0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
}
break;
case 0x4816:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub420120));
+ GotoState(&Klayman::stTurnPressButton);
} else if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420170));
- }else {
- setCallback2(AnimationCallback(&Klayman::sub4200D0));
+ GotoState(&Klayman::stStampFloorButton);
+ } else {
+ GotoState(&Klayman::stPressButtonSide);
}
break;
case 0x4817:
@@ -4148,24 +4130,24 @@ uint32 KmScene2101::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x481D:
if (_flag1)
- setCallback2(AnimationCallback(&Klayman::sub4214D0));
+ GotoState(&Klayman::sub4214D0);
break;
case 0x481E:
if (_flag)
- setCallback2(AnimationCallback(&Klayman::sub421510));
+ GotoState(&Klayman::sub421510);
break;
case 0x4834:
- setCallback2(AnimationCallback(&Klayman::sub421160));
+ GotoState(&Klayman::stStepOver);
break;
case 0x4835:
sendMessage(_parentScene, 0x2000, 1);
_flag1 = true;
- setCallback2(AnimationCallback(&Klayman::sub4212C0));
+ GotoState(&Klayman::stSitInTeleporter);
break;
case 0x4836:
sendMessage(_parentScene, 0x2000, 0);
_flag1 = false;
- setCallback2(AnimationCallback(&Klayman::sub421310));
+ GotoState(&Klayman::sub421310);
break;
case 0x483D:
sub486320();
@@ -4257,14 +4239,14 @@ uint32 KmScene2201::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4812:
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
break;
case 0x4816:
if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&Klayman::sub4200D0));
+ GotoState(&Klayman::stPressButtonSide);
}
break;
case 0x4817:
@@ -4282,10 +4264,10 @@ uint32 KmScene2201::xHandleMessage(int messageNum, const MessageParam &param) {
}
break;
case 0x481D:
- setCallback2(AnimationCallback(&Klayman::sub4207A0));
+ GotoState(&Klayman::stTurnToUse);
break;
case 0x481E:
- setCallback2(AnimationCallback(&Klayman::sub4207F0));
+ GotoState(&Klayman::sub4207F0);
break;
case 0x482D:
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
@@ -4293,16 +4275,16 @@ uint32 KmScene2201::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x482E:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub421030));
+ GotoState(&Klayman::sub421030);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420FE0));
+ GotoState(&Klayman::sub420FE0);
}
break;
case 0x482F:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub4210C0));
+ GotoState(&Klayman::sub4210C0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub421070));
+ GotoState(&Klayman::sub421070);
}
break;
case 0x483F:
@@ -4327,24 +4309,24 @@ uint32 KmScene2203::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4812:
if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420060));
+ GotoState(&Klayman::stPickUpNeedle);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub41FFF0));
+ GotoState(&Klayman::sub41FFF0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
}
break;
case 0x4816:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub420120));
+ GotoState(&Klayman::stTurnPressButton);
} else if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420170));
- }else {
- setCallback2(AnimationCallback(&Klayman::sub4200D0));
+ GotoState(&Klayman::stStampFloorButton);
+ } else {
+ GotoState(&Klayman::stPressButtonSide);
}
break;
case 0x4817:
@@ -4355,10 +4337,10 @@ uint32 KmScene2203::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(_dataResource.getPoint(param.asInteger()).x, false);
break;
case 0x4819:
- setCallback2(AnimationCallback(&Klayman::sub420750));
+ GotoState(&Klayman::sub420750);
break;
case 0x481A:
- setCallback2(AnimationCallback(&Klayman::sub420680));
+ GotoState(&Klayman::sub420680);
break;
case 0x481B:
if (param.asPoint().y != 0) {
@@ -4368,10 +4350,10 @@ uint32 KmScene2203::xHandleMessage(int messageNum, const MessageParam &param) {
}
break;
case 0x481D:
- setCallback2(AnimationCallback(&Klayman::sub4207A0));
+ GotoState(&Klayman::stTurnToUse);
break;
case 0x481E:
- setCallback2(AnimationCallback(&Klayman::sub4207F0));
+ GotoState(&Klayman::sub4207F0);
break;
case 0x482D:
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
@@ -4403,19 +4385,19 @@ uint32 KmScene2205::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4804:
if (param.asInteger() != 0) {
_x4 = param.asInteger();
- setCallback2(AnimationCallback(&KmScene2205::sub423980));
+ GotoState(&KmScene2205::sub423980);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FC40));
+ GotoState(&Klayman::stPeekWall);
}
break;
case 0x4816:
if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&Klayman::sub4200D0));
+ GotoState(&Klayman::stPressButtonSide);
}
break;
case 0x4817:
@@ -4446,8 +4428,8 @@ void KmScene2205::sub423980() {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41EB70);
SetSpriteCallback(&Klayman::spriteUpdate41F300);
- SetAnimationCallback3(&Klayman::sub41FA40);
- setCallback1(AnimationCallback(&Klayman::sub41FB30));
+ NextState(&Klayman::sub41FA40);
+ FinalizeState(&Klayman::stStartWalkingDone);
}
KmScene2206::KmScene2206(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
@@ -4471,33 +4453,33 @@ uint32 KmScene2206::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4803:
- setCallback2(AnimationCallback(&KmScene2206::sub482490));
+ GotoState(&KmScene2206::sub482490);
break;
case 0x4804:
if (param.asInteger() != 0) {
_x4 = param.asInteger();
- setCallback2(AnimationCallback(&KmScene2206::sub482530));
+ GotoState(&KmScene2206::sub482530);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FC40));
+ GotoState(&Klayman::stPeekWall);
}
break;
case 0x4812:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub41FFF0));
+ GotoState(&Klayman::sub41FFF0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
}
break;
case 0x4816:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub420120));
+ GotoState(&Klayman::stTurnPressButton);
} else if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420170));
- }else {
- setCallback2(AnimationCallback(&Klayman::sub4200D0));
+ GotoState(&Klayman::stStampFloorButton);
+ } else {
+ GotoState(&Klayman::stPressButtonSide);
}
break;
case 0x4817:
@@ -4513,15 +4495,15 @@ uint32 KmScene2206::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x481F:
if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&Klayman::sub420870));
+ GotoState(&Klayman::stWonderAboutHalf);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub4208B0));
+ GotoState(&Klayman::stWonderAboutAfter);
} else if (param.asInteger() == 3) {
- setCallback2(AnimationCallback(&Klayman::sub4208F0));
+ GotoState(&Klayman::stTurnToUseHalf);
} else if (param.asInteger() == 4) {
- setCallback2(AnimationCallback(&Klayman::sub420930));
+ GotoState(&Klayman::stTurnAwayFromUse);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420830));
+ GotoState(&Klayman::stWonderAbout);
}
break;
case 0x482D:
@@ -4530,16 +4512,16 @@ uint32 KmScene2206::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x482E:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub421030));
+ GotoState(&Klayman::sub421030);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420FE0));
+ GotoState(&Klayman::sub420FE0);
}
break;
case 0x482F:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub4210C0));
+ GotoState(&Klayman::sub4210C0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub421070));
+ GotoState(&Klayman::sub421070);
}
break;
case 0x4837:
@@ -4564,7 +4546,7 @@ void KmScene2206::spriteUpdate482450() {
}
void KmScene2206::sub482490() {
- if (!sub41CF10(AnimationCallback(&KmScene2206::sub482490))) {
+ if (!stStartActionFromIdle(AnimationCallback(&KmScene2206::sub482490))) {
_status2 = 1;
sendMessage(_parentScene, 0x4803, 0);
_flagE5 = false;
@@ -4588,8 +4570,8 @@ void KmScene2206::sub482530() {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41EB70);
SetSpriteCallback(&Klayman::spriteUpdate41F300);
- SetAnimationCallback3(&Klayman::sub41FA40);
- setCallback1(AnimationCallback(&Klayman::sub41FB30));
+ NextState(&Klayman::sub41FA40);
+ FinalizeState(&Klayman::stStartWalkingDone);
}
KmScene2207::KmScene2207(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
@@ -4600,32 +4582,32 @@ KmScene2207::KmScene2207(NeverhoodEngine *vm, Entity *parentScene, int16 x, int1
uint32 KmScene2207::xHandleMessage(int messageNum, const MessageParam &param) {
switch (messageNum) {
case 0x2001:
- setCallback2(AnimationCallback(&KmScene2207::sub442460));
+ GotoState(&KmScene2207::sub442460);
break;
case 0x2005:
spriteUpdate442430();
- setCallback2(AnimationCallback(&KmScene2207::sub41FC80));
+ GotoState(&KmScene2207::stTryStandIdle);
break;
case 0x4001:
case 0x4800:
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x480D:
- setCallback2(AnimationCallback(&KmScene2207::sub4424B0));
+ GotoState(&KmScene2207::sub4424B0);
break;
case 0x4812:
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
break;
case 0x4816:
if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub420120));
+ GotoState(&Klayman::stTurnPressButton);
} else if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420170));
- }else {
- setCallback2(AnimationCallback(&Klayman::sub4200D0));
+ GotoState(&Klayman::stStampFloorButton);
+ } else {
+ GotoState(&Klayman::stPressButtonSide);
}
break;
case 0x4817:
@@ -4640,7 +4622,7 @@ uint32 KmScene2207::xHandleMessage(int messageNum, const MessageParam &param) {
}
break;
case 0x4827:
- setCallback2(AnimationCallback(&Klayman::sub420E20));
+ GotoState(&Klayman::sub420E20);
break;
case 0x482D:
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
@@ -4657,13 +4639,13 @@ uint32 KmScene2207::xHandleMessage(int messageNum, const MessageParam &param) {
}
void KmScene2207::spriteUpdate442430() {
- _x = ((Sprite*)_attachedSprite)->getX() - 20;
- _y = ((Sprite*)_attachedSprite)->getY() + 46;
+ _x = _attachedSprite->getX() - 20;
+ _y = _attachedSprite->getY() + 46;
processDelta();
}
void KmScene2207::sub442460() {
- if (!sub41CF10(AnimationCallback(&KmScene2207::sub442460))) {
+ if (!stStartActionFromIdle(AnimationCallback(&KmScene2207::sub442460))) {
_status2 = 1;
_flagE5 = true;
setFileHash(0x5420E254, 0, -1);
@@ -4674,43 +4656,43 @@ void KmScene2207::sub442460() {
}
void KmScene2207::sub4424B0() {
- if (!sub41CEB0(AnimationCallback(&KmScene2207::sub4424B0))) {
+ if (!stStartAction(AnimationCallback(&KmScene2207::sub4424B0))) {
_status2 = 0;
if (_flagF7) {
- sub420D50();
+ stReleaseLeverUp();
} else {
_flagE5 = false;
setFileHash(0x0C303040, 0, -1);
SetUpdateHandler(&Klayman::update);
SetSpriteCallback(&KmScene2207::spriteUpdate41F230);
SetMessageHandler(&Klayman::handleMessage41E210);
- SetAnimationCallback3(&KmScene2207::sub442520);
+ NextState(&KmScene2207::sub442520);
}
}
}
void KmScene2207::sub442520() {
setFileHash(0x0D318140, 0, -1);
- SetAnimationCallback3(&KmScene2207::sub442560);
sendMessage(_attachedSprite, 0x480F, 0);
+ NextState(&KmScene2207::sub442560);
}
void KmScene2207::sub442560() {
- _flagE5 = true;
- _flagF7 = true;
setFileHash(0x1564A2C0, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetSpriteCallback(&KmScene2207::spriteUpdate41F230);
- SetAnimationCallback3(&KmScene2207::sub4425A0);
+ SetSpriteCallback(&Klayman::spriteUpdate41F230);
+ NextState(&KmScene2207::sub4425A0);
+ _flagE5 = true;
+ _flagF7 = true;
}
void KmScene2207::sub4425A0() {
- _flagE5 = true;
- _flagF7 = true;
setFileHash(0x4464A440, 0, -1);
SetUpdateHandler(&Klayman::update);
- SetSpriteCallback(&KmScene2207::spriteUpdate41F230);
+ SetSpriteCallback(&Klayman::spriteUpdate41F230);
SetMessageHandler(&Klayman::handleMessage41D360);
+ _flagE5 = true;
+ _flagF7 = true;
}
KmScene2242::KmScene2242(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
@@ -4729,23 +4711,23 @@ uint32 KmScene2242::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4804:
if (param.asInteger() != 0) {
_x4 = param.asInteger();
- setCallback2(AnimationCallback(&KmScene2242::sub444D20));
+ GotoState(&KmScene2242::sub444D20);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FC40));
+ GotoState(&Klayman::stPeekWall);
}
break;
case 0x4812:
if (param.asInteger() == 2) {
- setCallback2(AnimationCallback(&Klayman::sub420060));
+ GotoState(&Klayman::stPickUpNeedle);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub41FFF0));
+ GotoState(&Klayman::sub41FFF0);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FF80));
+ GotoState(&Klayman::stPickUpGeneric);
}
break;
case 0x4817:
@@ -4761,15 +4743,15 @@ uint32 KmScene2242::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x481F:
if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&Klayman::sub420870));
+ GotoState(&Klayman::stWonderAboutHalf);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub4208B0));
+ GotoState(&Klayman::stWonderAboutAfter);
} else if (param.asInteger() == 3) {
- setCallback2(AnimationCallback(&Klayman::sub4208F0));
+ GotoState(&Klayman::stTurnToUseHalf);
} else if (param.asInteger() == 4) {
- setCallback2(AnimationCallback(&Klayman::sub420930));
+ GotoState(&Klayman::stTurnAwayFromUse);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420830));
+ GotoState(&Klayman::stWonderAbout);
}
break;
case 0x482D:
@@ -4794,8 +4776,8 @@ void KmScene2242::sub444D20() {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41EB70);
SetSpriteCallback(&Klayman::spriteUpdate41F300);
- SetAnimationCallback3(&Klayman::sub41FA40);
- setCallback1(AnimationCallback(&Klayman::sub41FB30));
+ NextState(&Klayman::sub41FA40);
+ FinalizeState(&Klayman::stStartWalkingDone);
}
KmHallOfRecords::KmHallOfRecords(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
@@ -4814,14 +4796,14 @@ uint32 KmHallOfRecords::xHandleMessage(int messageNum, const MessageParam &param
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4804:
if (param.asInteger() != 0) {
_x4 = param.asInteger();
- setCallback2(AnimationCallback(&KmHallOfRecords::sub43B130));
+ GotoState(&KmHallOfRecords::sub43B130);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FC40));
+ GotoState(&Klayman::stPeekWall);
}
break;
case 0x4817:
@@ -4830,15 +4812,15 @@ uint32 KmHallOfRecords::xHandleMessage(int messageNum, const MessageParam &param
break;
case 0x481F:
if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&Klayman::sub420870));
+ GotoState(&Klayman::stWonderAboutHalf);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub4208B0));
+ GotoState(&Klayman::stWonderAboutAfter);
} else if (param.asInteger() == 3) {
- setCallback2(AnimationCallback(&Klayman::sub4208F0));
+ GotoState(&Klayman::stTurnToUseHalf);
} else if (param.asInteger() == 4) {
- setCallback2(AnimationCallback(&Klayman::sub420930));
+ GotoState(&Klayman::stTurnAwayFromUse);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420830));
+ GotoState(&Klayman::stWonderAbout);
}
break;
case 0x482D:
@@ -4863,8 +4845,8 @@ void KmHallOfRecords::sub43B130() {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41EB70);
SetSpriteCallback(&Klayman::spriteUpdate41F300);
- SetAnimationCallback3(&Klayman::sub41FA40);
- setCallback1(AnimationCallback(&Klayman::sub41FB30));
+ NextState(&Klayman::sub41FA40);
+ FinalizeState(&Klayman::stStartWalkingDone);
}
KmScene2247::KmScene2247(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
@@ -4883,14 +4865,14 @@ uint32 KmScene2247::xHandleMessage(int messageNum, const MessageParam &param) {
sub41C930(param.asPoint().x, false);
break;
case 0x4004:
- setCallback2(AnimationCallback(&Klayman::sub41FC80));
+ GotoState(&Klayman::stTryStandIdle);
break;
case 0x4804:
if (param.asInteger() != 0) {
_x4 = param.asInteger();
- setCallback2(AnimationCallback(&KmScene2247::sub453520));
+ GotoState(&KmScene2247::sub453520);
} else {
- setCallback2(AnimationCallback(&Klayman::sub41FC40));
+ GotoState(&Klayman::stPeekWall);
}
break;
case 0x4817:
@@ -4899,15 +4881,15 @@ uint32 KmScene2247::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x481F:
if (param.asInteger() == 0) {
- setCallback2(AnimationCallback(&Klayman::sub420870));
+ GotoState(&Klayman::stWonderAboutHalf);
} else if (param.asInteger() == 1) {
- setCallback2(AnimationCallback(&Klayman::sub4208B0));
+ GotoState(&Klayman::stWonderAboutAfter);
} else if (param.asInteger() == 3) {
- setCallback2(AnimationCallback(&Klayman::sub4208F0));
+ GotoState(&Klayman::stTurnToUseHalf);
} else if (param.asInteger() == 4) {
- setCallback2(AnimationCallback(&Klayman::sub420930));
+ GotoState(&Klayman::stTurnAwayFromUse);
} else {
- setCallback2(AnimationCallback(&Klayman::sub420830));
+ GotoState(&Klayman::stWonderAbout);
}
break;
case 0x482D:
@@ -4932,8 +4914,8 @@ void KmScene2247::sub453520() {
SetUpdateHandler(&Klayman::update);
SetMessageHandler(&Klayman::handleMessage41EB70);
SetSpriteCallback(&Klayman::spriteUpdate41F300);
- SetAnimationCallback3(&Klayman::sub41FA40);
- setCallback1(AnimationCallback(&Klayman::sub41FB30));
+ NextState(&Klayman::sub41FA40);
+ FinalizeState(&Klayman::stStartWalkingDone);
}
} // End of namespace Neverhood
diff --git a/engines/neverhood/klayman.h b/engines/neverhood/klayman.h
index eb6ab40931..645ed74226 100644
--- a/engines/neverhood/klayman.h
+++ b/engines/neverhood/klayman.h
@@ -47,25 +47,25 @@ public:
void update();
- void sub41FD30();
+ void stDoIdlePickEar();
void sub41FDA0();
void sub41FDF0();
- void sub41FE60();
+ void stDoIdleChest();
void sub41FEB0();
- void sub41FC80();
- void sub4211F0();
- void sub4211B0();
- void sub41FF80();
- void sub420120();
- void sub420170();
- void sub4200D0();
- void sub41FBC0();
- void sub420870();
- void sub4208B0();
- void sub4208F0();
- void sub420930();
- void sub420830();
- void sub41FC40();
+ void stTryStandIdle();
+ void stWakeUp();
+ void stSleeping();
+ void stPickUpGeneric();
+ void stTurnPressButton();
+ void stStampFloorButton();
+ void stPressButtonSide();
+ void stLargeStep();
+ void stWonderAboutHalf();
+ void stWonderAboutAfter();
+ void stTurnToUseHalf();
+ void stTurnAwayFromUse();
+ void stWonderAbout();
+ void stPeekWall();
void sub420210();
void sub4201C0();
void sub420340();
@@ -82,45 +82,43 @@ public:
void sub420FE0();
void sub4210C0();
void sub421070();
- void sub420420();
+ void stLandOnFeet();
void sub420ED0();
void sub420750();
- void sub4207A0();
+ void stTurnToUse();
void sub4207F0();
void sub420F20();
void sub421350();
- void sub4213F0();
- void sub4213B0();
- void sub420060();
+ void stIdleSitBlink();
+ void stIdleSitBlinkSecond();
+ void stPickUpNeedle();
void sub41FFF0();
void sub4214D0();
void sub421510();
- void sub421160();
- void sub4212C0();
+ void stStepOver();
+ void stSitInTeleporter();
void sub421310();
- void sub420600();
+ void stMoveObjectSkipTurnFaceObject();
void sub420660();
- void sub4205C0();
- void sub420550();
+ void stMoveObjectSkipTurn();
+ void stMoveObjectFaceObject();
void sub420C50();
- void sub420CD0();
- void sub420D10();
- void sub420D50();
- void sub420DA0();
- void sub420DE0();
+ void stPullLeverDown();
+ void stHoldLeverDown();
+ void stReleaseLeverUp();
void sub420E20();
void sub420E90();
void sub420EB0();
void sub420680();
- void sub41F9E0();
+ void stWalking();
void sub41FA40();
- void sub41FB30();
+ void stStartWalkingDone();
void sub41CE70();
void spriteUpdate41F250();
void spriteUpdate41F5F0();
- void spriteUpdate41F780();
+ void suLargeStep();
void spriteUpdate41F230();
void spriteUpdate41F5A0();
void spriteUpdate41F300();
@@ -140,7 +138,7 @@ public:
protected:
Entity *_parentScene;
- Entity *_attachedSprite;
+ Sprite *_attachedSprite;
int _statusE0;
bool _flagE1;
bool _flagE2;
@@ -172,9 +170,9 @@ protected:
virtual void xUpdate();
virtual uint32 xHandleMessage(int messageNum, const MessageParam &param);
- void sub41FD40();
- void sub41FD90();
- uint32 handleMessage41EB10(int messageNum, const MessageParam &param, Entity *sender);
+ void stIdlePickEar();
+ void evIdlePickEarDone();
+ uint32 hmIdlePickEar(int messageNum, const MessageParam &param, Entity *sender);
void sub41FDB0();
uint32 handleMessage41E980(int messageNum, const MessageParam &param, Entity *sender);
@@ -183,8 +181,8 @@ protected:
void sub41FE50();
uint32 handleMessage41E9E0(int messageNum, const MessageParam &param, Entity *sender);
- void sub41FE70();
- uint32 handleMessage41EF80(int messageNum, const MessageParam &param, Entity *sender);
+ void stIdleChest();
+ uint32 hmIdleChest(int messageNum, const MessageParam &param, Entity *sender);
void sub41FEC0();
uint32 handleMessage41EFE0(int messageNum, const MessageParam &param, Entity *sender);
@@ -192,45 +190,44 @@ protected:
void sub41D320(uint32 fileHash, AnimationCb callback);
void update41D2B0();
- bool sub41CF10(AnimationCb callback);
+ bool stStartActionFromIdle(AnimationCb callback);
void sub41C7B0();
void sub41C770();
void sub41C790();
void update41D0F0();
- void sub41FF00();
-
- void sub41FCF0();
+ void stStand();
+ void stStandAround();
uint32 handleMessage41F140(int messageNum, const MessageParam &param, Entity *sender);
void sub41C930(int16 x, bool flag);
- uint32 handleMessage41E920(int messageNum, const MessageParam &param, Entity *sender);
+ uint32 hmSleeping(int messageNum, const MessageParam &param, Entity *sender);
- bool sub41CEB0(AnimationCb callback3);
+ bool stStartAction(AnimationCb callback3);
- void sub41FB40();
- void sub41FBB0();
+ void stSneak();
+ void stSneakDone();
uint32 handleMessage41DD80(int messageNum, const MessageParam &param, Entity *sender);
void sub41CD70(int16 x);
- void sub41F950();
+ void stStartWalking();
uint32 handleMessage41EC70(int messageNum, const MessageParam &param, Entity *sender);
- uint32 handleMessage41D4C0(int messageNum, const MessageParam &param, Entity *sender);
+ uint32 hmPickUpGeneric(int messageNum, const MessageParam &param, Entity *sender);
- uint32 handleMessage41DAD0(int messageNum, const MessageParam &param, Entity *sender);
+ uint32 hmPressButton(int messageNum, const MessageParam &param, Entity *sender);
void sub41CD00(int16 x);
void sub41CC40(int16 x1, int16 x2);
void sub41CAC0(int16 x);
void sub41CCE0(int16 x);
- void sub41FC30();
+ void stLargeStepDone();
- uint32 handleMessage41DF10(int messageNum, const MessageParam &param, Entity *sender);
+ uint32 hmLargeStep(int messageNum, const MessageParam &param, Entity *sender);
uint32 handleMessage41EEF0(int messageNum, const MessageParam &param, Entity *sender);
- uint32 handleMessage41E3C0(int messageNum, const MessageParam &param, Entity *sender);
+ uint32 hmPeekWall(int messageNum, const MessageParam &param, Entity *sender);
uint32 handleMessage41D790(int messageNum, const MessageParam &param, Entity *sender);
uint32 handleMessage41D880(int messageNum, const MessageParam &param, Entity *sender);
uint32 handleMessage41DAA0(int messageNum, const MessageParam &param, Entity *sender);
@@ -272,28 +269,28 @@ protected:
void update4497D0();
uint32 handleMessage449800(int messageNum, const MessageParam &param, Entity *sender);
uint32 handleMessage4498E0(int messageNum, const MessageParam &param, Entity *sender);
- uint32 handleMessage449990(int messageNum, const MessageParam &param, Entity *sender);
- uint32 handleMessage449A30(int messageNum, const MessageParam &param, Entity *sender);
+ uint32 hmPressDoorButton(int messageNum, const MessageParam &param, Entity *sender);
+ uint32 hmMoveVenusFlyTrap(int messageNum, const MessageParam &param, Entity *sender);
uint32 handleMessage449BA0(int messageNum, const MessageParam &param, Entity *sender);
uint32 handleMessage449C90(int messageNum, const MessageParam &param, Entity *sender);
uint32 handleMessage449D60(int messageNum, const MessageParam &param, Entity *sender);
- void spriteUpdate449DC0();
+ void suFallDown();
void sub449E20();
void sub449E90();
void sub449EF0();
void sub449F70();
- void sub44A050();
+ void stSpitOutFall();
void sub44A0D0();
void sub44A150();
void sub44A230();
- void sub44A250();
- void sub44A2C0();
- void sub44A330();
- void sub44A370();
- void sub44A3C0();
- void sub44A3E0();
- void sub44A460();
- void sub44A4B0();
+ void stJumpAndFall();
+ void stDropFromRing();
+ void stPressDoorButton();
+ void stHitByBoxingGlove();
+ void stHitByBoxingGloveDone();
+ void stMoveVenusFlyTrap();
+ void stContinueMovingVenusFlyTrap();
+ void stMoveVenusFlyTrapDone();
};
class KmScene1004 : public Klayman {
@@ -301,8 +298,8 @@ public:
KmScene1004(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y);
protected:
uint32 xHandleMessage(int messageNum, const MessageParam &param);
- uint32 handleMessage478110(int messageNum, const MessageParam &param, Entity *sender);
- void sub478170();
+ uint32 hmReadNote(int messageNum, const MessageParam &param, Entity *sender);
+ void stReadNote();
};
class KmScene1109 : public Klayman {
@@ -324,14 +321,14 @@ protected:
int _countdown;
uint32 xHandleMessage(int messageNum, const MessageParam &param);
void update40DBE0();
- uint32 handleMessage40DC00(int messageNum, const MessageParam &param, Entity *sender);
- void sub40DD20();
- void sub40DD90();
+ uint32 hmMatch(int messageNum, const MessageParam &param, Entity *sender);
+ void stFetchMatch();
+ void stLightMatch();
uint32 handleMessage40DDF0(int messageNum, const MessageParam &param, Entity *sender);
- uint32 handleMessage40DEA0(int messageNum, const MessageParam &param, Entity *sender);
+ uint32 hmTumbleHeadless(int messageNum, const MessageParam &param, Entity *sender);
void sub40DF00();
- void sub40DF60();
- void sub40DFA0();
+ void stMoveObjectSkipTurn();
+ void stTumbleHeadless();
void sub40E040();
};
@@ -340,12 +337,12 @@ public:
KmScene1303(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y);
protected:
uint32 xHandleMessage(int messageNum, const MessageParam &param);
- uint32 handleMessage4160A0(int messageNum, const MessageParam &param, Entity *sender);
+ uint32 hmPeekWallReturn(int messageNum, const MessageParam &param, Entity *sender);
void update4161A0();
- void sub4161D0();
- void sub416210();
- void sub416250();
- void sub4162B0();
+ void stPeekWall1();
+ void stPeekWall2();
+ void stPeekWall3();
+ void stPeekWallReturn();
};
class KmScene1304 : public Klayman {
@@ -360,8 +357,8 @@ public:
KmScene1305(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y);
protected:
uint32 xHandleMessage(int messageNum, const MessageParam &param);
- void sub46BEF0();
- void sub46BF60();
+ void stCrashDown();
+ void cbCrashDownEvent();
};
class KmScene1306 : public Klayman {
@@ -429,7 +426,7 @@ protected:
uint32 xHandleMessage(int messageNum, const MessageParam &param);
uint32 handleMessage4689A0(int messageNum, const MessageParam &param, Entity *sender);
void spriteUpdate468A30();
- void sub468A80();
+ void stFallSkipJump();
void sub468AD0();
void sub468B10();
};
@@ -449,7 +446,7 @@ protected:
uint32 xHandleMessage(int messageNum, const MessageParam &param);
uint32 handleMessage4401A0(int messageNum, const MessageParam &param, Entity *sender);
void sub440230();
- void sub440270();
+ void stDoTeleport();
};
class KmScene2101 : public Klayman {
diff --git a/engines/neverhood/module1000.cpp b/engines/neverhood/module1000.cpp
index 26b68e1c9a..b60c3182d0 100644
--- a/engines/neverhood/module1000.cpp
+++ b/engines/neverhood/module1000.cpp
@@ -145,12 +145,12 @@ void AsScene1001Door::handleMessage2000h() {
case 1:
_soundResource1.play(0x65482F03);
setFileHash(0x624C0498, 1, 3);
- SetAnimationCallback3(&AsScene1001Door::callback1);
+ NextState(&AsScene1001Door::callback1);
break;
case 2:
_soundResource2.play();
setFileHash(0x624C0498, 6, 6);
- SetAnimationCallback3(&AsScene1001Door::callback2);
+ NextState(&AsScene1001Door::callback2);
break;
default:
// Nothing
@@ -170,7 +170,7 @@ void AsScene1001Door::callback1() {
_newHashListIndex = 1;
break;
case 3:
- setFileHash1();
+ stopAnimation();
setVisible(false);
break;
default:
@@ -183,13 +183,13 @@ void AsScene1001Door::callback1() {
void AsScene1001Door::callback2() {
setGlobalVar(0xD217189D, 1);
setFileHash(0x624C0498, 6, 6);
- SetAnimationCallback3(&AsScene1001Door::callback3);
+ NextState(&AsScene1001Door::callback3);
_x = 30;
}
void AsScene1001Door::callback3() {
_soundResource1.play();
- setFileHash1();
+ stopAnimation();
setVisible(false);
}
@@ -734,7 +734,7 @@ uint32 Class505::handleMessage(int messageNum, const MessageParam &param, Entity
setVisible(true);
break;
case 0x3002:
- setFileHash1();
+ stopAnimation();
setVisible(false);
break;
}
@@ -799,7 +799,7 @@ void AsScene1002DoorSpy::sub448B10() {
_parentScene->setSurfacePriority(getSurface(), 1200);
setFileHash(0x586C1D48, 1, -1);
SetMessageHandler(&AsScene1002DoorSpy::handleMessage448A60);
- SetAnimationCallback3(&AsScene1002DoorSpy::sub448AC0);
+ NextState(&AsScene1002DoorSpy::sub448AC0);
}
Class426::Class426(NeverhoodEngine *vm, Scene *parentScene, uint32 fileHash1, uint32 fileHash2, int surfacePriority, uint32 soundFileHash)
@@ -1071,14 +1071,14 @@ void AsScene1002VenusFlyTrap::sub4484F0() {
setFileHash(0xC4080034, 0, -1);
SetUpdateHandler(&AsScene1002VenusFlyTrap::update);
SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage448320);
- SetAnimationCallback3(&AsScene1002VenusFlyTrap::sub448660);
+ NextState(&AsScene1002VenusFlyTrap::sub448660);
}
void AsScene1002VenusFlyTrap::sub448530() {
setFileHash(0xC4080034, 0, -1);
SetUpdateHandler(&AsScene1002VenusFlyTrap::update);
SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage4482E0);
- SetAnimationCallback3(&AsScene1002VenusFlyTrap::sub448660);
+ NextState(&AsScene1002VenusFlyTrap::sub448660);
}
void AsScene1002VenusFlyTrap::sub448560() {
@@ -1086,7 +1086,7 @@ void AsScene1002VenusFlyTrap::sub448560() {
setFileHash(0x82292851, 0, -1);
SetUpdateHandler(&AsScene1002VenusFlyTrap::update);
SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage4482E0);
- SetAnimationCallback3(&AsScene1002VenusFlyTrap::sub448660);
+ NextState(&AsScene1002VenusFlyTrap::sub448660);
}
void AsScene1002VenusFlyTrap::sub4485B0() {
@@ -1094,7 +1094,7 @@ void AsScene1002VenusFlyTrap::sub4485B0() {
setFileHash(0x86A82A11, 0, -1);
SetUpdateHandler(&AsScene1002VenusFlyTrap::update);
SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage4482E0);
- SetAnimationCallback3(&AsScene1002VenusFlyTrap::sub4485F0);
+ NextState(&AsScene1002VenusFlyTrap::sub4485F0);
}
void AsScene1002VenusFlyTrap::sub4485F0() {
@@ -1107,7 +1107,7 @@ void AsScene1002VenusFlyTrap::sub448620() {
setFileHash(0x31303094, 0, -1);
SetUpdateHandler(&AsScene1002VenusFlyTrap::update);
SetMessageHandler(NULL);
- SetAnimationCallback3(&AsScene1002VenusFlyTrap::sub448720);
+ NextState(&AsScene1002VenusFlyTrap::sub448720);
_countdown = 24;
}
@@ -1119,14 +1119,14 @@ void AsScene1002VenusFlyTrap::sub448660() {
if (_x >= 154 && _x <= 346) {
setGlobalVar(0x86341E88, (_x - 186) / 32);
} else {
- SetAnimationCallback3(&AsScene1002VenusFlyTrap::sub4484F0);
+ NextState(&AsScene1002VenusFlyTrap::sub4484F0);
_countdown = 12;
}
} else {
if (_x >= 174 && _x <= 430) {
setGlobalVar(0x1B144052, (_x - 174) / 32);
} else {
- SetAnimationCallback3(&AsScene1002VenusFlyTrap::sub4484F0);
+ NextState(&AsScene1002VenusFlyTrap::sub4484F0);
_countdown = 12;
}
}
@@ -1136,14 +1136,14 @@ void AsScene1002VenusFlyTrap::sub448720() {
setFileHash(0x152920C4, 0, -1);
SetUpdateHandler(&AsScene1002VenusFlyTrap::update);
SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage448320);
- SetAnimationCallback3(&AsScene1002VenusFlyTrap::sub448750);
+ NextState(&AsScene1002VenusFlyTrap::sub448750);
}
void AsScene1002VenusFlyTrap::sub448750() {
setFileHash(0x84001117, 0, -1);
SetUpdateHandler(&AsScene1002VenusFlyTrap::update);
SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage448320);
- SetAnimationCallback3(&AsScene1002VenusFlyTrap::sub448660);
+ NextState(&AsScene1002VenusFlyTrap::sub448660);
}
void AsScene1002VenusFlyTrap::sub448780() {
@@ -1157,7 +1157,7 @@ void AsScene1002VenusFlyTrap::sub448780() {
setFileHash(0x8C2C80D4, 0, -1);
SetUpdateHandler(&AsScene1002VenusFlyTrap::update);
SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage448320);
- SetAnimationCallback3(&AsScene1002VenusFlyTrap::sub448620);
+ NextState(&AsScene1002VenusFlyTrap::sub448620);
}
}
@@ -1224,13 +1224,13 @@ void Class506::sub449280() {
setFileHash(0x004A4495, -1, -1);
_playBackwards = true;
SetMessageHandler(&Class506::handleMessage449210);
- SetAnimationCallback3(&Class506::sub4492C0);
+ NextState(&Class506::sub4492C0);
setVisible(true);
}
void Class506::sub4492C0() {
setVisible(false);
- setFileHash1();
+ stopAnimation();
}
Class478::Class478(NeverhoodEngine *vm, Klayman *klayman)
@@ -1610,7 +1610,7 @@ uint32 AsScene1004TrashCan::handleMessage(int messageNum, const MessageParam &pa
setVisible(true);
break;
case 0x3002:
- setFileHash1();
+ stopAnimation();
setVisible(false);
break;
}
diff --git a/engines/neverhood/module1100.cpp b/engines/neverhood/module1100.cpp
index 740e4875bd..52c9d92a33 100644
--- a/engines/neverhood/module1100.cpp
+++ b/engines/neverhood/module1100.cpp
@@ -371,7 +371,7 @@ uint32 AsScene1105TeddyBear::handleMessage(int messageNum, const MessageParam &p
break;
case 0x3002:
sendMessage(_parentScene, 0x2003, 0);
- setFileHash1();
+ stopAnimation();
break;
}
return messageResult;
diff --git a/engines/neverhood/module1200.cpp b/engines/neverhood/module1200.cpp
index ffb4f206ca..25abf95643 100644
--- a/engines/neverhood/module1200.cpp
+++ b/engines/neverhood/module1200.cpp
@@ -278,7 +278,7 @@ AsScene1201RightDoor::AsScene1201RightDoor(NeverhoodEngine *vm, Sprite *klayman,
_newHashListIndex = -2;
_countdown = 25;
} else {
- setFileHash1();
+ stopAnimation();
setVisible(false);
}
}
@@ -315,11 +315,11 @@ void AsScene1201RightDoor::sub40D830() {
_playBackwards = true;
setVisible(true);
_soundResource.play(calcHash("fxDoorClose20"));
- SetAnimationCallback3(&AsScene1201RightDoor::sub40D880);
+ NextState(&AsScene1201RightDoor::sub40D880);
}
void AsScene1201RightDoor::sub40D880() {
- setFileHash1();
+ stopAnimation();
setVisible(false);
}
@@ -343,7 +343,7 @@ uint32 Class464::handleMessage(int messageNum, const MessageParam &param, Entity
setVisible(true);
break;
case 0x3002:
- setFileHash1();
+ stopAnimation();
setVisible(false);
removeCallbacks();
break;
@@ -422,7 +422,7 @@ void AsScene1201TntMan::sub40CD60() {
setFileHash(0x356803D0, 0, -1);
SetMessageHandler(&AsScene1201TntMan::handleMessage40CCD0);
SetSpriteCallback(&AnimatedSprite::updateDeltaXY);
- SetAnimationCallback3(&AsScene1201TntMan::sub40CD30);
+ NextState(&AsScene1201TntMan::sub40CD30);
}
void AsScene1201TntMan::sub40CD90() {
@@ -547,9 +547,9 @@ void AsScene1201Match::sub40C3E0() {
setFileHash(0x00842374, 0, -1);
SetMessageHandler(&AsScene1201Match::handleMessage40C320);
if (_status == 0) {
- SetAnimationCallback3(&AsScene1201Match::sub40C420);
+ NextState(&AsScene1201Match::sub40C420);
} else {
- SetAnimationCallback3(&AsScene1201Match::sub40C470);
+ NextState(&AsScene1201Match::sub40C470);
}
}
@@ -559,7 +559,7 @@ void AsScene1201Match::sub40C420() {
_y += 119;
setFileHash(0x018D0240, 0, -1);
SetMessageHandler(&AsScene1201Match::handleMessage40C320);
- SetAnimationCallback3(&AsScene1201Match::sub40C4F0);
+ NextState(&AsScene1201Match::sub40C4F0);
}
void AsScene1201Match::sub40C470() {
@@ -569,7 +569,7 @@ void AsScene1201Match::sub40C470() {
if (_status != 0) {
_countdown = 36;
_status--;
- SetAnimationCallback3(&AsScene1201Match::sub40C3E0);
+ NextState(&AsScene1201Match::sub40C3E0);
}
}
@@ -623,10 +623,10 @@ uint32 AsScene1201Creature::handleMessage40C710(int messageNum, const MessagePar
}
break;
case 0x2004:
- setCallback2(AnimationCallback(&AsScene1201Creature::sub40C960));
+ GotoState(&AsScene1201Creature::sub40C960);
break;
case 0x2006:
- setCallback2(AnimationCallback(&AsScene1201Creature::sub40C9B0));
+ GotoState(&AsScene1201Creature::sub40C9B0);
break;
}
return messageResult;
@@ -672,7 +672,7 @@ void AsScene1201Creature::sub40C8E0() {
_countdown3 = 3;
setFileHash(0x08081513, 0, -1);
SetMessageHandler(&AsScene1201Creature::handleMessage40C710);
- SetAnimationCallback3(&AsScene1201Creature::sub40C930);
+ NextState(&AsScene1201Creature::sub40C930);
_countdown1 = 36;
}
@@ -680,14 +680,14 @@ void AsScene1201Creature::sub40C930() {
if (!_flag) {
setFileHash(0xCA287133, 0, -1);
SetMessageHandler(&AsScene1201Creature::handleMessage40C7B0);
- SetAnimationCallback3(&AsScene1201Creature::sub40C8E0);
+ NextState(&AsScene1201Creature::sub40C8E0);
}
}
void AsScene1201Creature::sub40C960() {
setFileHash(0x08081513, 0, -1);
SetMessageHandler(&AsScene1201Creature::handleMessage40C710);
- SetAnimationCallback3(&AsScene1201Creature::sub40C9E0);
+ NextState(&AsScene1201Creature::sub40C9E0);
_countdown1 = 48;
}
@@ -698,7 +698,7 @@ void AsScene1201Creature::sub40C990() {
void AsScene1201Creature::sub40C9B0() {
setFileHash(0xCA287133, 0, -1);
SetMessageHandler(&AsScene1201Creature::handleMessage40C830);
- SetAnimationCallback3(&AsScene1201Creature::sub40C8E0);
+ NextState(&AsScene1201Creature::sub40C8E0);
_countdown1 = 0;
}
@@ -1091,7 +1091,7 @@ void AsScene1202TntItem::sub4540A0() {
void AsScene1202TntItem::sub4540D0() {
setFileHash(kScene1202FileHashes[_index], 0, -1);
SetMessageHandler(&AsScene1202TntItem::handleMessage454060);
- SetAnimationCallback3(&AsScene1202TntItem::sub454100);
+ NextState(&AsScene1202TntItem::sub454100);
}
void AsScene1202TntItem::sub454100() {
@@ -1099,7 +1099,7 @@ void AsScene1202TntItem::sub454100() {
_y = kScene1202Points[_index2].y;
setFileHash(kScene1202FileHashes[_index], 6, -1);
SetMessageHandler(&AsScene1202TntItem::handleMessage454060);
- SetAnimationCallback3(&AsScene1202TntItem::sub454160);
+ NextState(&AsScene1202TntItem::sub454160);
_playBackwards = true;
}
diff --git a/engines/neverhood/module1300.cpp b/engines/neverhood/module1300.cpp
index 26b61f0e52..cb5ed15d99 100644
--- a/engines/neverhood/module1300.cpp
+++ b/engines/neverhood/module1300.cpp
@@ -324,7 +324,7 @@ uint32 AsScene1302Bridge::handleMessage(int messageNum, const MessageParam &para
void AsScene1302Bridge::stLowerBridge() {
setFileHash(0x88148150, 0, -1);
- SetAnimationCallback3(&AsScene1302Bridge::cbLowerBridgeEvent);
+ NextState(&AsScene1302Bridge::cbLowerBridgeEvent);
_soundResource2.play();
}
@@ -618,7 +618,7 @@ uint32 AsScene1303Balloon::hmBalloonPopped(int messageNum, const MessageParam &p
break;
case 0x3002:
_soundResource.play(0x470007EE);
- setFileHash1();
+ stopAnimation();
SetMessageHandler(NULL);
setVisible(false);
break;
@@ -849,7 +849,7 @@ void AsScene1306Elevator::stGoingUp() {
_isDown = false;
SetUpdateHandler(&AsScene1306Elevator::update);
setFileHash(0x043B0270, 0, -1);
- SetAnimationCallback3(&AsScene1306Elevator::cbGoingUpEvent);
+ NextState(&AsScene1306Elevator::cbGoingUpEvent);
_soundResource1.play();
}
@@ -858,7 +858,7 @@ void AsScene1306Elevator::cbGoingUpEvent() {
sendMessage(_parentScene, 0x4808, 0);
_isUp = true;
_countdown = 144;
- setFileHash1();
+ stopAnimation();
setVisible(false);
}
@@ -868,7 +868,7 @@ void AsScene1306Elevator::stGoingDown() {
setVisible(true);
setFileHash(0x043B0270, -1, -1);
_playBackwards = true;
- SetAnimationCallback3(&AsScene1306Elevator::cbGoingDownEvent);
+ NextState(&AsScene1306Elevator::cbGoingDownEvent);
_soundResource2.play();
}
@@ -876,7 +876,7 @@ void AsScene1306Elevator::cbGoingDownEvent() {
_isDown = true;
sendMessage(_parentScene, 0x4809, 0);
SetUpdateHandler(&AsScene1306Elevator::update);
- setFileHash1();
+ stopAnimation();
}
Scene1306::Scene1306(NeverhoodEngine *vm, Module *parentModule, int which)
@@ -1433,7 +1433,7 @@ Class549::Class549(NeverhoodEngine *vm, Scene *parentScene)
SetMessageHandler(&Class549::handleMessage);
setVisible(false);
- setFileHash1();
+ stopAnimation();
}
uint32 Class549::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
@@ -1455,13 +1455,13 @@ uint32 Class549::handleMessage(int messageNum, const MessageParam &param, Entity
void Class549::sub455470() {
setFileHash(0xBA0AE050, 0, -1);
setVisible(true);
- SetAnimationCallback3(&Class549::hide);
+ NextState(&Class549::hide);
_soundResource.play(calcHash("fxDoorOpen38"));
}
void Class549::hide() {
sendMessage(_parentScene, 0x2000, 0);
- setFileHash1();
+ stopAnimation();
setVisible(false);
}
@@ -1469,13 +1469,13 @@ void Class549::sub4554F0() {
setFileHash(0xBA0AE050, -1, -1);
_playBackwards = true;
setVisible(true);
- SetAnimationCallback3(&Class549::sub455550);
+ NextState(&Class549::sub455550);
_soundResource.play(calcHash("fxDoorClose38"));
}
void Class549::sub455550() {
sendMessage(_parentScene, 0x2001, 0);
- setFileHash1();
+ stopAnimation();
}
Class592::Class592(NeverhoodEngine *vm, Scene *parentScene)
@@ -1483,7 +1483,7 @@ Class592::Class592(NeverhoodEngine *vm, Scene *parentScene)
_parentScene(parentScene) {
SetMessageHandler(&Class592::handleMessage);
- SetAnimationCallback3(&Class592::sub455710);
+ NextState(&Class592::sub455710);
_soundResource.play(0x51456049);
}
@@ -1499,14 +1499,14 @@ uint32 Class592::handleMessage(int messageNum, const MessageParam &param, Entity
void Class592::sub455710() {
setFileHash(0x6238B191, 0, -1);
- SetAnimationCallback3(&Class592::sub455740);
+ NextState(&Class592::sub455740);
_x = 580;
_y = 383;
}
void Class592::sub455740() {
sendMessage(_parentScene, 0x2004, 0);
- setFileHash1();
+ stopAnimation();
setVisible(false);
}
@@ -1515,7 +1515,7 @@ Class593::Class593(NeverhoodEngine *vm, Scene *parentScene)
SetMessageHandler(&Class593::handleMessage);
setVisible(false);
- setFileHash1();
+ stopAnimation();
Entity::_priority = 1200;
}
@@ -1543,12 +1543,12 @@ void Class593::sub4558F0() {
void Class593::sub455920() {
setFileHash(0x80180A10, -1, -1);
_playBackwards = true;
- SetAnimationCallback3(&Class593::sub455950);
+ NextState(&Class593::sub455950);
}
void Class593::sub455950() {
sendMessage(_parentScene, 0x2003, 0);
- setFileHash1();
+ stopAnimation();
setVisible(false);
}
diff --git a/engines/neverhood/module1400.cpp b/engines/neverhood/module1400.cpp
index 8d42c7fa2c..42dfdb3d5b 100644
--- a/engines/neverhood/module1400.cpp
+++ b/engines/neverhood/module1400.cpp
@@ -257,7 +257,7 @@ void Class526::spriteUpdate466720() {
AnimatedSprite::updateDeltaXY();
if (_rect.y1 <= 150) {
_soundResource.play(0x0E32247F);
- setFileHash1();
+ stopAnimation();
SetSpriteCallback(NULL);
SetMessageHandler(NULL);
setVisible(false);
@@ -295,7 +295,7 @@ void Class527::spriteUpdate466920() {
AnimatedSprite::updateDeltaXY();
if (_rect.y1 <= 150) {
_soundResource.play(0x18020439);
- setFileHash1();
+ stopAnimation();
SetSpriteCallback(NULL);
SetMessageHandler(NULL);
setVisible(false);
@@ -322,7 +322,7 @@ Class528::Class528(NeverhoodEngine *vm, Sprite *klayman, bool flag)
_countdown = 48;
} else {
_flag = false;
- setFileHash1();
+ stopAnimation();
setVisible(false);
}
}
@@ -369,11 +369,11 @@ void Class528::sub466C50() {
setFileHash(0x04551900, -1, -1);
_soundResource.play(calcHash("fxDoorClose24"));
_playBackwards = true;
- SetAnimationCallback3(&Class528::sub466CB0);
+ NextState(&Class528::sub466CB0);
}
void Class528::sub466CB0() {
- setFileHash1();
+ stopAnimation();
setVisible(false);
}
@@ -575,7 +575,7 @@ void Class489::sub434D80() {
AnimatedSprite::updateDeltaXY();
if (_rect.y1 <= 150) {
sendMessage(_class525, 0x483A, 0);
- setFileHash1();
+ stopAnimation();
SetMessageHandler(&Sprite::handleMessage);
SetSpriteCallback(NULL);
setVisible(false);
@@ -600,7 +600,7 @@ void Class489::sub434E60() {
SetSpriteCallback(NULL);
SetMessageHandler(&Class489::handleMessage434B20);
setFileHash(0x80C32213, 0, -1);
- SetAnimationCallback3(&Class489::sub434E90);
+ NextState(&Class489::sub434E90);
}
void Class489::sub434E90() {
@@ -613,7 +613,7 @@ void Class489::sub434EC0() {
setFileHash(0x50A80517, 0, -1);
SetMessageHandler(&Class489::handleMessage434B20);
SetSpriteCallback(NULL);
- SetAnimationCallback3(&Class489::sub434F40);
+ NextState(&Class489::sub434F40);
setGlobalVar(0x12A10DB3, 1);
_soundResource1.play(0xCC4A8456);
// TODO Sound1ChList_addSoundResource(0x05331081, 0xCE428854, true);
@@ -631,7 +631,7 @@ void Class489::sub434F80() {
setFileHash(0x50A94417, 0, -1);
SetSpriteCallback(NULL);
SetMessageHandler(&Class489::handleMessage434B20);
- SetAnimationCallback3(&Class489::sub434E90);
+ NextState(&Class489::sub434E90);
setGlobalVar(0x12A10DB3, 0);
_soundResource1.play(0xCC4A8456);
// TODO Sound1ChList_deleteSoundByHash(0xCE428854);
@@ -642,7 +642,7 @@ void Class489::sub434FF0() {
setFileHash(0x22CB4A33, 0, -1);
SetSpriteCallback(&Class489::spriteUpdate434B60);
SetMessageHandler(&Class489::handleMessage434B20);
- SetAnimationCallback3(&Class489::sub434DF0);
+ NextState(&Class489::sub434DF0);
}
void Class489::sub435040() {
@@ -845,7 +845,7 @@ uint32 Class482::handleMessage(int messageNum, const MessageParam &param, Entity
_soundResource2.play();
setFileHash(0x20060259, -1, -1);
_playBackwards = true;
- SetAnimationCallback3(&Class482::sub428530);
+ NextState(&Class482::sub428530);
break;
case 0x3002:
removeCallbacks();
@@ -856,19 +856,19 @@ uint32 Class482::handleMessage(int messageNum, const MessageParam &param, Entity
void Class482::sub428500() {
sendMessage(_parentScene, 0x2000, 0);
- setFileHash1();
+ stopAnimation();
setVisible(false);
}
void Class482::sub428530() {
sendMessage(_parentScene, 0x2001, 0);
- setFileHash1();
+ stopAnimation();
setVisible(false);
}
void Class482::sub428560() {
sendMessage(_parentScene, 0x2003, 0);
- setFileHash1();
+ stopAnimation();
}
Scene1402::Scene1402(NeverhoodEngine *vm, Module *parentModule, int which)
@@ -1218,7 +1218,7 @@ void AsScene1407Mouse::stWalkToDest() {
setFileHash(0x22291510, 0, -1);
SetSpriteCallback(&AsScene1407Mouse::suWalkTo);
SetMessageHandler(&AsScene1407Mouse::handleMessage);
- SetAnimationCallback3(&AsScene1407Mouse::stIdleLookAtGoodHole);
+ NextState(&AsScene1407Mouse::stIdleLookAtGoodHole);
}
}
@@ -1227,7 +1227,7 @@ void AsScene1407Mouse::stWalkToHole() {
setFileHash(0x22291510, 0, -1);
SetSpriteCallback(&AsScene1407Mouse::suWalkTo);
SetMessageHandler(&AsScene1407Mouse::handleMessage);
- SetAnimationCallback3(&AsScene1407Mouse::stGoThroughHole);
+ NextState(&AsScene1407Mouse::stGoThroughHole);
}
void AsScene1407Mouse::stGoThroughHole() {
@@ -1235,7 +1235,7 @@ void AsScene1407Mouse::stGoThroughHole() {
SetSpriteCallback(NULL);
SetMessageHandler(NULL);
SetUpdateHandler(&AsScene1407Mouse::upGoThroughHole);
- SetAnimationCallback3(&AsScene1407Mouse::stArriveAtHole);
+ NextState(&AsScene1407Mouse::stArriveAtHole);
setVisible(false);
_countdown = 12;
}
diff --git a/engines/neverhood/module1600.cpp b/engines/neverhood/module1600.cpp
index 15e24743a6..c510601642 100644
--- a/engines/neverhood/module1600.cpp
+++ b/engines/neverhood/module1600.cpp
@@ -206,7 +206,7 @@ Class521::Class521(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y)
}
Class521::~Class521() {
- if (_callback1Cb == AnimationCallback(&Class521::sub45D620)) {
+ if (_finalizeStateCb == AnimationCallback(&Class521::sub45D620)) {
setGlobalVar(0x21E60190, !getGlobalVar(0x21E60190));
}
}
@@ -407,11 +407,11 @@ void Class521::sub45CD00() {
_flag11A = 0;
_rectList = NULL;
SetMessageHandler(&Class521::handleMessage45CC30);
- SetAnimationCallback3(&Class521::sub45CFE0);
+ NextState(&Class521::sub45CFE0);
setFileHash(0x35698F78, 0, -1);
SetMessageHandler(&Class521::handleMessage45CC30);
SetUpdateHandler(&Class521::update45C790);
- setCallback1(AnimationCallback(&Class521::sub45D040));
+ FinalizeState(&Class521::sub45D040);
setDoDeltaX(doDeltaX ? 1 : 0);
_currMoveDirection = 0;
_newMoveDirection = 0;
@@ -442,14 +442,14 @@ void Class521::sub45CE10() {
setFileHash(0x192ADD30, 0, -1);
SetMessageHandler(&Class521::handleMessage45CC30);
SetUpdateHandler(&Class521::update);
- SetAnimationCallback3(&Class521::sub45CFE0);
+ NextState(&Class521::sub45CFE0);
} else if (!_flag10E && _steps && _flag113) {
removeCallbacks();
_flag113 = 0;
setFileHash(0x9966B138, 0, -1);
SetMessageHandler(&Class521::handleMessage45CC30);
SetUpdateHandler(&Class521::update);
- SetAnimationCallback3(&Class521::sub45D100);
+ NextState(&Class521::sub45D100);
} else {
bool flag = false;
uint index = 0;
@@ -478,7 +478,7 @@ void Class521::sub45CF80() {
setFileHash(0xA86A9538, 0, -1);
SetMessageHandler(&Class521::handleMessage45CC30);
SetUpdateHandler(&Class521::update);
- SetAnimationCallback3(&Class521::sub45CFE0);
+ NextState(&Class521::sub45CFE0);
}
void Class521::sub45CFB0() {
@@ -492,7 +492,7 @@ void Class521::sub45CFE0() {
setFileHash(0x35698F78, 0, -1);
SetMessageHandler(&Class521::handleMessage);
SetUpdateHandler(&Class521::update45C790);
- setCallback1(AnimationCallback(&Class521::sub45D040));
+ FinalizeState(&Class521::sub45D040);
_idleCounter = 0;
_currMoveDirection = 0;
_newMoveDirection = 0;
@@ -508,7 +508,7 @@ void Class521::sub45D050() {
setFileHash(0xB579A77C, 0, -1);
SetMessageHandler(&Class521::handleMessage45CC30);
SetUpdateHandler(&Class521::update);
- SetAnimationCallback3(&Class521::sub45CFE0);
+ NextState(&Class521::sub45CFE0);
_idleCounter = 0;
_idleCounterMax = _vm->_rnd->getRandomNumber(64 - 1) + 24;
}
@@ -519,7 +519,7 @@ void Class521::sub45D0A0() {
setFileHash(0x9C220DA4, 0, -1);
SetMessageHandler(&Class521::handleMessage45CC30);
SetUpdateHandler(&Class521::update);
- setCallback1(AnimationCallback(&Class521::sub45D0E0));
+ FinalizeState(&Class521::sub45D0E0);
}
void Class521::sub45D0E0() {
@@ -549,7 +549,7 @@ void Class521::sub45D180() {
_value112 = 0;
SetMessageHandler(&Class521::handleMessage45CC30);
SetUpdateHandler(&Class521::update);
- setCallback1(AnimationCallback(&Class521::sub45D620));
+ FinalizeState(&Class521::sub45D620);
sub45CDC0();
}
@@ -578,7 +578,7 @@ void Class521::moveToNextPoint() {
setFileHash(0x9966B138, 0, -1);
SetMessageHandler(&Class521::handleMessage45CC30);
SetUpdateHandler(&Class521::update);
- SetAnimationCallback3(&Class521::sub45D100);
+ NextState(&Class521::sub45D100);
}
_flag10E = 0;
SetSpriteCallback(&Class521::suMoveToNextPoint);
@@ -594,7 +594,7 @@ void Class521::sub45D350() {
setFileHash(0x192ADD30, 0, -1);
SetMessageHandler(&Class521::handleMessage45CC30);
SetUpdateHandler(&Class521::update);
- SetAnimationCallback3(&Class521::sub45D390);
+ NextState(&Class521::sub45D390);
}
void Class521::sub45D390() {
@@ -603,7 +603,7 @@ void Class521::sub45D390() {
setFileHash(0xF46A0324, 0, -1);
SetMessageHandler(&Class521::handleMessage45CC30);
SetUpdateHandler(&Class521::update);
- setCallback1(AnimationCallback(&Class521::sub45D620));
+ FinalizeState(&Class521::sub45D620);
_value112 = 1;
sub45CDC0();
}
@@ -640,7 +640,7 @@ void Class521::moveToPrevPoint() {
setFileHash(0x9966B138, 0, -1);
SetMessageHandler(&Class521::handleMessage45CC30);
SetUpdateHandler(&Class521::update);
- SetAnimationCallback3(&Class521::sub45D100);
+ NextState(&Class521::sub45D100);
}
_flag10E = 0;
SetSpriteCallback(&Class521::suMoveToPrevPoint);
@@ -652,20 +652,20 @@ void Class521::moveToPrevPoint() {
void Class521::sub45D580() {
_flag10F = 1;
_flag10E = 1;
- setCallback1(NULL);
+ FinalizeState(NULL);
setFileHash(0x192ADD30, 0, -1);
SetMessageHandler(&Class521::handleMessage45CC30);
SetUpdateHandler(&Class521::update);
- SetAnimationCallback3(&Class521::sub45D5D0);
+ NextState(&Class521::sub45D5D0);
}
void Class521::sub45D5D0() {
_flag10F = 1;
- setCallback1(NULL);
+ FinalizeState(NULL);
setFileHash(0xF46A0324, 0, -1);
SetMessageHandler(&Class521::handleMessage45CC30);
SetUpdateHandler(&Class521::update);
- setCallback1(AnimationCallback(&Class521::sub45D620));
+ FinalizeState(&Class521::sub45D620);
_value112 = 2;
sub45CDC0();
}
@@ -979,7 +979,7 @@ Class546::Class546(NeverhoodEngine *vm, Scene *parentScene)
setVisible(false);
SetMessageHandler(&Class546::handleMessage);
- setFileHash1();
+ stopAnimation();
}
uint32 Class546::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
@@ -1001,26 +1001,26 @@ uint32 Class546::handleMessage(int messageNum, const MessageParam &param, Entity
void Class546::sub44D710() {
setFileHash(0x08C80144, 0, -1);
setVisible(true);
- SetAnimationCallback3(&Class546::sub44D760);
+ NextState(&Class546::sub44D760);
_soundResource.play(calcHash("fxDoorOpen23"));
}
void Class546::sub44D760() {
sendMessage(_parentScene, 0x2033, 0);
- setFileHash1();
+ stopAnimation();
setVisible(false);
}
void Class546::sub44D790() {
setFileHash(0x08C80144, -1, -1);
setVisible(true);
- SetAnimationCallback3(&Class546::sub44D7F0);
+ NextState(&Class546::sub44D7F0);
_soundResource.play(calcHash("fxDoorClose23"));
}
void Class546::sub44D7F0() {
sendMessage(_parentScene, 0x2034, 0);
- setFileHash1();
+ stopAnimation();
}
Class547::Class547(NeverhoodEngine *vm, int16 x, int16 y)
diff --git a/engines/neverhood/module1900.cpp b/engines/neverhood/module1900.cpp
index 7a34a2bd28..7bac3ffc96 100644
--- a/engines/neverhood/module1900.cpp
+++ b/engines/neverhood/module1900.cpp
@@ -355,10 +355,10 @@ void AsScene1907Symbol::tryToPlugIn() {
_deltaY = (_y - kAsScene1907SymbolPluggedInPositions[_newPositionIndex].y) / 16;
_smallDeltaY = _y - _deltaY * 16 - kAsScene1907SymbolPluggedInPositions[_newPositionIndex].y;
if (_elementIndex == _newPositionIndex) {
- SetAnimationCallback3(&AsScene1907Symbol::stPlugIn);
+ NextState(&AsScene1907Symbol::stPlugIn);
} else {
_symbolFlag1 = 1;
- SetAnimationCallback3(&AsScene1907Symbol::stPlugInFail);
+ NextState(&AsScene1907Symbol::stPlugInFail);
}
}
@@ -389,7 +389,7 @@ void AsScene1907Symbol::stFallOffHitGround() {
_vm->_collisionMan->removeSprite(this);
_vm->_collisionMan->addSprite(this);
SetSpriteCallback(&AsScene1907Symbol::suFallOffHitGround);
- SetAnimationCallback3(&AsScene1907Symbol::cbFallOffHitGroundEvent);
+ NextState(&AsScene1907Symbol::cbFallOffHitGroundEvent);
_newHashListIndex = 0;
_currStep = 0;
_yAccel = 30;
@@ -417,7 +417,7 @@ void AsScene1907Symbol::cbFallOffHitGroundEvent() {
void AsScene1907Symbol::stPlugIn() {
_soundResource1.play();
_currPositionIndex = _newPositionIndex;
- setFileHash1();
+ stopAnimation();
SetMessageHandler(&AsScene1907Symbol::handleMessage);
SetSpriteCallback(NULL);
if (_elementIndex == 8)
@@ -426,13 +426,13 @@ void AsScene1907Symbol::stPlugIn() {
void AsScene1907Symbol::stPlugInFail() {
_currPositionIndex = _newPositionIndex;
- setFileHash1();
+ stopAnimation();
_parentScene->plugInFailed();
}
void AsScene1907Symbol::moveUp() {
setFileHash(kAsScene1907SymbolFileHashes[_elementIndex], -1, -1);//????
- setFileHash1();
+ stopAnimation();
SetMessageHandler(&AsScene1907Symbol::handleMessage);
SetSpriteCallback(&AsScene1907Symbol::suMoveUp);
_yIncr = 1;
@@ -441,7 +441,7 @@ void AsScene1907Symbol::moveUp() {
void AsScene1907Symbol::moveDown() {
setFileHash(kAsScene1907SymbolFileHashes[_elementIndex], -1, -1);//????
- setFileHash1();
+ stopAnimation();
SetMessageHandler(&AsScene1907Symbol::handleMessage);
SetSpriteCallback(&AsScene1907Symbol::suMoveDown);
_yIncr = 4;
@@ -541,11 +541,11 @@ void AsScene1907WaterHint::show() {
setVisible(true);
setFileHash(0x110A1061, 0, -1);
SetMessageHandler(&AsScene1907WaterHint::handleMessage46BA20);
- SetAnimationCallback3(&AsScene1907WaterHint::hide);
+ NextState(&AsScene1907WaterHint::hide);
}
void AsScene1907WaterHint::hide() {
- setFileHash1();
+ stopAnimation();
setVisible(false);
SetMessageHandler(&Sprite::handleMessage);
}
diff --git a/engines/neverhood/module2100.cpp b/engines/neverhood/module2100.cpp
index fa0d111f8b..66f8631b8a 100644
--- a/engines/neverhood/module2100.cpp
+++ b/engines/neverhood/module2100.cpp
@@ -121,12 +121,12 @@ void Class538::closeDoor() {
setFileHash(0xC222A8D4, 0, -1);
_newHashListIndex = -2;
setVisible(true);
- SetAnimationCallback3(&Class538::hide);
+ NextState(&Class538::hide);
_soundResource.play(calcHash("fxDoorClose32"));
}
void Class538::hide() {
- setFileHash1();
+ stopAnimation();
setVisible(false);
}
@@ -149,7 +149,7 @@ uint32 Class539::handleMessage(int messageNum, const MessageParam &param, Entity
setVisible(true);
break;
case 0x3002:
- setFileHash1();
+ stopAnimation();
setVisible(false);
break;
}
diff --git a/engines/neverhood/module2200.cpp b/engines/neverhood/module2200.cpp
index ff0afa6f58..ab1fac8c5e 100644
--- a/engines/neverhood/module2200.cpp
+++ b/engines/neverhood/module2200.cpp
@@ -1088,7 +1088,7 @@ uint32 AsScene2203Door::handleMessage(int messageNum, const MessageParam &param,
case 0x3002:
if (_index == getGlobalVar(0x9A500914))
sendMessage(_parentScene, 0x4808, 0);
- setFileHash1();
+ stopAnimation();
break;
case 0x4808:
setGlobalVar(0x9A500914, _index);
@@ -1832,7 +1832,7 @@ uint32 AsScene2207Lever::handleMessage(int messageNum, const MessageParam &param
break;
case 0x3002:
removeCallbacks();
- setFileHash1();
+ stopAnimation();
break;
case 0x4807:
stLeverUp();
@@ -1852,7 +1852,7 @@ uint32 AsScene2207Lever::handleMessage(int messageNum, const MessageParam &param
void AsScene2207Lever::stLeverDown() {
setFileHash(0x80880090, 1, -1);
- setCallback1(AnimationCallback(&AsScene2207Lever::stLeverDownEvent));
+ FinalizeState(&AsScene2207Lever::stLeverDownEvent);
_soundResource.play(0x40581882);
}
@@ -1862,7 +1862,7 @@ void AsScene2207Lever::stLeverDownEvent() {
void AsScene2207Lever::stLeverUp() {
setFileHash(0x80880090, 6, -1);
- setCallback1(AnimationCallback(&AsScene2207Lever::stLeverUpEvent));
+ FinalizeState(&AsScene2207Lever::stLeverUpEvent);
_playBackwards = true;
_soundResource.play(0x40581882);
}
@@ -1931,7 +1931,7 @@ uint32 AsScene2207WallRobotAnimation::handleMessage(int messageNum, const Messag
void AsScene2207WallRobotAnimation::stStartAnimation() {
if (!_idle) {
- SetAnimationCallback3(NULL);
+ NextState(NULL);
} else {
setFileHash(0xCCFD6090, 0, -1);
_idle = false;
@@ -1940,11 +1940,11 @@ void AsScene2207WallRobotAnimation::stStartAnimation() {
}
void AsScene2207WallRobotAnimation::stStopAnimation() {
- SetAnimationCallback3(&AsScene2207WallRobotAnimation::cbStopAnimation);
+ NextState(&AsScene2207WallRobotAnimation::cbStopAnimation);
}
void AsScene2207WallRobotAnimation::cbStopAnimation() {
- setFileHash1();
+ stopAnimation();
_soundResource1.stop();
_soundResource2.stop();
_soundResource3.stop();
@@ -1984,7 +1984,7 @@ uint32 AsScene2207WallCannonAnimation::handleMessage(int messageNum, const Messa
void AsScene2207WallCannonAnimation::stStartAnimation() {
if (!_idle) {
- SetAnimationCallback3(NULL);
+ NextState(NULL);
} else {
setVisible(true);
setFileHash(0x8CAA0099, 0, -1);
@@ -1993,11 +1993,11 @@ void AsScene2207WallCannonAnimation::stStartAnimation() {
}
void AsScene2207WallCannonAnimation::stStopAnimation() {
- SetAnimationCallback3(&AsScene2207WallCannonAnimation::cbStopAnimation);
+ NextState(&AsScene2207WallCannonAnimation::cbStopAnimation);
}
void AsScene2207WallCannonAnimation::cbStopAnimation() {
- setFileHash1();
+ stopAnimation();
setVisible(false);
_idle = true;
}
diff --git a/engines/neverhood/module2600.cpp b/engines/neverhood/module2600.cpp
index 0163e978ba..5823e4dcb2 100644
--- a/engines/neverhood/module2600.cpp
+++ b/engines/neverhood/module2600.cpp
@@ -279,7 +279,7 @@ uint32 AsScene2609Water::handleMessage(int messageNum, const MessageParam &param
uint32 messageResult = Sprite::handleMessage(messageNum, param, sender);
switch (messageNum) {
case 0x2001:
- setFileHash1();
+ stopAnimation();
setVisible(false);
// TODO Sound1ChList_stop(0xDC2769B0);
break;
diff --git a/engines/neverhood/module3000.cpp b/engines/neverhood/module3000.cpp
index d979bbb7a8..783e6166ea 100644
--- a/engines/neverhood/module3000.cpp
+++ b/engines/neverhood/module3000.cpp
@@ -1200,7 +1200,7 @@ uint32 AsScene3010DeadBolt::hmAnimation(int messageNum, const MessageParam &para
}
void AsScene3010DeadBolt::stIdle() {
- setFileHash1();
+ stopAnimation();
SetUpdateHandler(&AsScene3010DeadBolt::update);
SetMessageHandler(&Sprite::handleMessage);
_locked = false;
@@ -1215,8 +1215,8 @@ void AsScene3010DeadBolt::unlock(bool skipAnim) {
} else {
setFileHash(kAsScene3010DeadBoltFileHashes1[_boltIndex], 0, -1);
SetMessageHandler(&AsScene3010DeadBolt::hmAnimation);
- setCallback1(AnimationCallback(&AsScene3010DeadBolt::stIdleMessage));
- SetAnimationCallback3(&AsScene3010DeadBolt::stIdle);
+ FinalizeState(&AsScene3010DeadBolt::stIdleMessage);
+ NextState(&AsScene3010DeadBolt::stIdle);
_soundResource1.play();
}
_unlocked = true;
@@ -1225,7 +1225,7 @@ void AsScene3010DeadBolt::unlock(bool skipAnim) {
}
void AsScene3010DeadBolt::stIdleMessage() {
- setFileHash1();
+ stopAnimation();
SetMessageHandler(&Sprite::handleMessage);
sendMessage(_parentScene, 0x2001, _boltIndex);
}
@@ -1236,8 +1236,8 @@ void AsScene3010DeadBolt::lock() {
setVisible(true);
setFileHash(kAsScene3010DeadBoltFileHashes2[_boltIndex], 0, -1);
SetMessageHandler(&AsScene3010DeadBolt::hmAnimation);
- setCallback1(AnimationCallback(&AsScene3010DeadBolt::stDisabledMessage));
- SetAnimationCallback3(&AsScene3010DeadBolt::stIdle);
+ FinalizeState(&AsScene3010DeadBolt::stDisabledMessage);
+ NextState(&AsScene3010DeadBolt::stIdle);
if (_soundToggle) {
_soundResource1.play();
} else {
@@ -1255,8 +1255,8 @@ void AsScene3010DeadBolt::stDisabled() {
setVisible(true);
setFileHash(kAsScene3010DeadBoltFileHashes1[_boltIndex], 0, -1);
SetMessageHandler(&AsScene3010DeadBolt::hmAnimation);
- setCallback1(AnimationCallback(&AsScene3010DeadBolt::stDisabledMessage));
- SetAnimationCallback3(&AsScene3010DeadBolt::stIdle);
+ FinalizeState(&AsScene3010DeadBolt::stDisabledMessage);
+ NextState(&AsScene3010DeadBolt::stIdle);
_playBackwards = true;
_soundResource3.play();
}
@@ -1493,7 +1493,7 @@ void AsScene3011Symbol::show(bool flag) {
}
void AsScene3011Symbol::hide() {
- setFileHash1();
+ stopAnimation();
setVisible(false);
}
diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp
index d94d3db128..f1f4bab9cd 100644
--- a/engines/neverhood/neverhood.cpp
+++ b/engines/neverhood/neverhood.cpp
@@ -92,63 +92,8 @@ Common::Error NeverhoodEngine::run() {
}
#if 0
- BlbArchive *blb = new BlbArchive();
- blb->open("m.blb");
- delete blb;
-#endif
-
-#if 0
- ResourceFileEntry *r = _res->findEntry(0x50A80517);
-#endif
-
-#if 0
- int resourceHandle = _res->useResource(0x0CA04202);
- debug("resourceHandle = %d", resourceHandle);
- byte *data = _res->loadResource(resourceHandle);
- bool rle;
- NDimensions dimensions;
- NUnknown unknown;
- byte *palette, *pixels;
- parseBitmapResource(data, &rle, &dimensions, &unknown, &palette, &pixels);
- debug("%d, %d", dimensions.width, dimensions.height);
- byte *rawpixels = new byte[dimensions.width * dimensions.height];
- memset(rawpixels, 0, dimensions.width * dimensions.height);
- debug("rle = %d", rle);
- unpackSpriteRle(pixels, dimensions.width, dimensions.height, rawpixels, dimensions.width, false, false);
- Common::DumpFile d;
- d.open("dump.0");
- d.write(rawpixels, dimensions.width * dimensions.height);
- d.close();
- delete[] rawpixels;
- _res->unloadResource(resourceHandle);
- _res->unuseResource(resourceHandle);
-#endif
-
-#if 0
- { // Create a new scope
- SpriteResource r(this);
- BaseSurface *surf = new BaseSurface(this, 0, 640, 480);
- r.load(0x0CA04202);
- debug("r: width = %d; height = %d", r.getDimensions().width, r.getDimensions().height);
- surf->drawSpriteResource(r);
- delete surf;
- }
-#endif
-
-#if 0
- { // Create a new scope
- AnimResource r(this);
- r.load(0x000540B0);
- }
-#endif
-
-#if 0
- { // Create a new scope
- DataResource dataResource(this);
- //dataResource.load(0x01801002);
- //dataResource.load(0x84500132);
- dataResource.load(0x81120132);
- }
+ // TODO: This should probably be implemented as debug command later
+ dumpAllResources();
#endif
#if 1
@@ -220,5 +165,84 @@ NPoint NeverhoodEngine::getMousePos() {
pt.y = _mouseY;
return pt;
}
+
+void writeTga(const char *filename, byte *pixels, byte *palette, int16 width, int16 height) {
+ byte identsize = 0;
+ byte colourmaptype = 1;
+ byte imagetype = 1;
+ uint16 colourmapstart = 0;
+ uint16 colourmaplength = 256;
+ byte colourmapbits = 24;
+ uint16 xstart = 0;
+ uint16 ystart = 0;
+ byte bits = 8;
+ byte descriptor = 0x20;
+ Common::DumpFile tga;
+ tga.open(filename);
+ tga.writeByte(identsize);
+ tga.writeByte(colourmaptype);
+ tga.writeByte(imagetype);
+ tga.writeUint16LE(colourmapstart);
+ tga.writeUint16LE(colourmaplength);
+ tga.writeByte(colourmapbits);
+ tga.writeUint16LE(xstart);
+ tga.writeUint16LE(ystart);
+ tga.writeUint16LE(width);
+ tga.writeUint16LE(height);
+ tga.writeByte(bits);
+ tga.writeByte(descriptor);
+ tga.write(palette, 768);
+ tga.write(pixels, width * height);
+ tga.close();
+}
+
+void NeverhoodEngine::dumpAllResources() {
+
+ PaletteResource paletteResource(this);
+ byte *vgaPalette = new byte[768];
+ paletteResource.load(0x4086520E);
+ byte *srcpalette = paletteResource.palette();
+ for (int i = 0; i < 256; i++) {
+ vgaPalette[i * 3 + 2] = srcpalette[i * 4 + 0];
+ vgaPalette[i * 3 + 1] = srcpalette[i * 4 + 1];
+ vgaPalette[i * 3 + 0] = srcpalette[i * 4 + 2];
+ }
+
+#if 0
+ for (int i = 0; i < 768; i++)
+ vgaPalette[i] <<= 2;
+#endif
+
+ uint entriesCount = _res->getEntryCount();
+ debug("%d entries", entriesCount);
+
+ for (uint i = 0; i < entriesCount; i++) {
+ const ResourceFileEntry &entry = _res->getEntry(i);
+ int type = _res->getResourceTypeByHash(entry.fileHash);
+ debug("hash: %08X; type: %d", entry.fileHash, type);
+ if (type == 4) {
+ AnimResource anim(this);
+ anim.load(entry.fileHash);
+ for (uint frameIndex = 0; frameIndex < anim.getFrameCount(); frameIndex++) {
+ const AnimFrameInfo &frameInfo = anim.getFrameInfo(frameIndex);
+ int16 width = (frameInfo.rect.width + 3) & 0xFFFC;
+ byte *pixels = new byte[width * frameInfo.rect.height];
+ memset(pixels, 0, width * frameInfo.rect.height);
+ anim.draw(frameIndex, pixels, width, false, false);
+ Common::String filename =
+ frameInfo.frameHash != 0
+ ? Common::String::format("%08X_%03d_%08X.tga", entry.fileHash, frameIndex, frameInfo.frameHash)
+ : Common::String::format("%08X_%03d.tga", entry.fileHash, frameIndex);
+ writeTga(filename.c_str(), pixels, vgaPalette, width, frameInfo.rect.height);
+ delete[] pixels;
+ }
+ static int n = 0;
+ //if (n++ == 25) break;
+ }
+ }
+
+ delete[] vgaPalette;
+
+}
} // End of namespace Neverhood
diff --git a/engines/neverhood/neverhood.h b/engines/neverhood/neverhood.h
index b4bc333e98..adc46198d6 100644
--- a/engines/neverhood/neverhood.h
+++ b/engines/neverhood/neverhood.h
@@ -124,6 +124,8 @@ public:
int16 getMouseY() const { return _mouseY; }
NPoint getMousePos();
+ void dumpAllResources();
+
public:
};
diff --git a/engines/neverhood/resourceman.h b/engines/neverhood/resourceman.h
index 22614401f8..ed5bffaf9b 100644
--- a/engines/neverhood/resourceman.h
+++ b/engines/neverhood/resourceman.h
@@ -68,6 +68,8 @@ public:
void unloadResource(int resourceHandle);
void freeResource(Resource *resource);
Common::SeekableReadStream *createStream(uint32 fileHash);
+ const ResourceFileEntry& getEntry(uint index) { return _entries[index]; }
+ uint getEntryCount() { return _entries.size(); }
private:
Common::Array<BlbArchive*> _archives;
Common::Array<ResourceFileEntry> _entries;
diff --git a/engines/neverhood/sprite.cpp b/engines/neverhood/sprite.cpp
index 480e9e9299..697bd6e262 100644
--- a/engines/neverhood/sprite.cpp
+++ b/engines/neverhood/sprite.cpp
@@ -237,9 +237,9 @@ void AnimatedSprite::init() {
_frameIndex3 = 0;
_frameIndex = 0;
_hashListIndex = -1;
- _callback1Cb = NULL;
- _callback2Cb = NULL;
- _callback3Cb = NULL;
+ _finalizeStateCb = NULL;
+ _currStateCb = NULL;
+ _nextStateCb = NULL;
_newHashListIndex = -1;
_fileHash4 = 0;
_flag = false;
@@ -458,7 +458,7 @@ void AnimatedSprite::setFileHash(uint32 fileHash, int16 frameIndex3, int16 frame
_hashListIndex = -1;
}
-void AnimatedSprite::setFileHash1() {
+void AnimatedSprite::stopAnimation() {
_fileHash1 = 1;
_animStatus = 2;
}
@@ -486,52 +486,43 @@ void AnimatedSprite::setFileHash3(uint32 fileHash2, uint32 fileHash6, uint32 fil
_hashListIndex = -1;
}
-void AnimatedSprite::setCallback1(AnimationCb callback1) {
- if (_callback1Cb) {
- (this->*_callback1Cb)();
- }
- _callback1Cb = callback1;
+void AnimatedSprite::setFinalizeState(AnimationCb finalizeStateCb) {
+ if (_finalizeStateCb)
+ (this->*_finalizeStateCb)();
+ _finalizeStateCb = finalizeStateCb;
}
-void AnimatedSprite::setCallback2(AnimationCb callback2) {
-
- if (_callback1Cb) {
- AnimationCb cb = _callback1Cb;
- _callback1Cb = NULL;
+void AnimatedSprite::gotoState(AnimationCb currStateCb) {
+ if (_finalizeStateCb) {
+ AnimationCb cb = _finalizeStateCb;
+ _finalizeStateCb = NULL;
(this->*cb)();
}
-
// TODO _callbackList = NULL;
- _callback3Cb = NULL;
- _callback2Cb = callback2;
-
- if (_callback2Cb) {
- (this->*_callback2Cb)();
- }
-
+ _nextStateCb = NULL;
+ _currStateCb = currStateCb;
+ if (_currStateCb)
+ (this->*_currStateCb)();
}
void AnimatedSprite::removeCallbacks() {
-
- if (_callback1Cb) {
- AnimationCb cb = _callback1Cb;
- _callback1Cb = NULL;
+ if (_finalizeStateCb) {
+ AnimationCb cb = _finalizeStateCb;
+ _finalizeStateCb = NULL;
(this->*cb)();
}
-
- if (_callback3Cb) {
- _callback2Cb = _callback3Cb;
- _callback3Cb = NULL;
- debug("Fire _callback3Cb '%s'", _callback3CbName.c_str());
- (this->*_callback2Cb)();
+ if (_nextStateCb) {
+ _currStateCb = _nextStateCb;
+ _nextStateCb = NULL;
+ debug("Fire _nextStateCb '%s'", _nextStateCbName.c_str());
+ (this->*_currStateCb)();
#if 0 // TODO
} else if (_callbackList) {
removeCallbackList();
#endif
} else {
- _callback2Cb = NULL;
+ _currStateCb = NULL;
}
-
}
} // End of namespace Neverhood
diff --git a/engines/neverhood/sprite.h b/engines/neverhood/sprite.h
index 10ebc197b3..aa2272464e 100644
--- a/engines/neverhood/sprite.h
+++ b/engines/neverhood/sprite.h
@@ -107,10 +107,10 @@ protected:
void init(uint32 fileHash, int surfacePriority, int16 x = kDefPosition, int16 y = kDefPosition, int16 width = 0, int16 height = 0);
};
-#define SetAnimationCallback1(callback) _callback1Cb = static_cast <void (AnimatedSprite::*)(void)> (callback); debug(2, "SetAnimationCallback1(" #callback ")"); _callback1CbName = #callback
-#define SetAnimationCallback2(callback) _callback2Cb = static_cast <void (AnimatedSprite::*)(void)> (callback); debug(2, "SetAnimationCallback2(" #callback ")"); _callback2CbName = #callback
-#define SetAnimationCallback3(callback) _callback3Cb = static_cast <void (AnimatedSprite::*)(void)> (callback); debug(2, "SetAnimationCallback3(" #callback ")"); _callback3CbName = #callback
#define AnimationCallback(callback) static_cast <void (AnimatedSprite::*)()> (callback)
+#define GotoState(callback) gotoState(static_cast <void (AnimatedSprite::*)()> (callback))
+#define NextState(callback) _nextStateCb = static_cast <void (AnimatedSprite::*)(void)> (callback); debug(2, "NextState(" #callback ")"); _nextStateCbName = #callback
+#define FinalizeState(callback) setFinalizeState(static_cast <void (AnimatedSprite::*)()> (callback));
class AnimatedSprite : public Sprite {
public:
@@ -152,24 +152,24 @@ protected:
callbackListCount dw ?
callbackList dd ?
*/
- AnimationCb _callback1Cb;
- AnimationCb _callback2Cb;
- AnimationCb _callback3Cb;
+ AnimationCb _finalizeStateCb;
+ AnimationCb _currStateCb;
+ AnimationCb _nextStateCb;
// For debugging purposes
- Common::String _callback1CbName;
- Common::String _callback2CbName;
- Common::String _callback3CbName;
+ Common::String _finalizeStateCbName;
+ Common::String _currStateCbName;
+ Common::String _nextStateCbName;
void init();
void updateAnim();
void updatePosition();
void updateFrameIndex();
void updateFrameInfo();
void createSurface1(uint32 fileHash, int surfacePriority);
- void setFileHash1();
+ void stopAnimation();
void setFileHash2(uint32 fileHash, uint32 fileHash6, uint32 fileHash5);
void setFileHash3(uint32 fileHash2, uint32 fileHash6, uint32 fileHash5);
- void setCallback1(AnimationCb callback1);
- void setCallback2(AnimationCb callback2);
+ void setFinalizeState(AnimationCb finalizeStateCb);
+ void gotoState(AnimationCb currStateCb);
void removeCallbacks();
};