2011-07-07 17:26:22 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "neverhood/klayman.h"
|
2011-07-08 19:09:33 +00:00
|
|
|
#include "neverhood/collisionman.h"
|
2011-07-07 17:26:22 +00:00
|
|
|
#include "neverhood/resourceman.h"
|
2011-07-08 19:09:33 +00:00
|
|
|
#include "neverhood/staticdata.h"
|
2011-07-07 17:26:22 +00:00
|
|
|
|
|
|
|
namespace Neverhood {
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
static const KlaymanIdleTableItem klaymanTable1[] = {
|
2011-10-21 09:13:49 +00:00
|
|
|
{1, &Klayman::stDoIdlePickEar},
|
2011-07-07 17:26:22 +00:00
|
|
|
{1, &Klayman::sub41FDA0},
|
|
|
|
{1, &Klayman::sub41FDF0},
|
2011-10-21 09:13:49 +00:00
|
|
|
{1, &Klayman::stDoIdleChest},
|
2011-07-07 17:26:22 +00:00
|
|
|
{1, &Klayman::sub41FEB0}
|
|
|
|
};
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
static const KlaymanIdleTableItem klaymanTable2[] = {
|
2011-10-21 09:13:49 +00:00
|
|
|
{1, &Klayman::stDoIdlePickEar},
|
2011-07-07 17:26:22 +00:00
|
|
|
{1, &Klayman::sub41FDA0},
|
2011-10-21 09:13:49 +00:00
|
|
|
{1, &Klayman::stDoIdleChest},
|
2011-07-07 17:26:22 +00:00
|
|
|
{1, &Klayman::sub41FEB0}
|
|
|
|
};
|
|
|
|
|
|
|
|
#if 0
|
2011-10-27 11:33:12 +00:00
|
|
|
static const KlaymanIdleTableItem klaymanTable3[] = {
|
2011-07-07 17:26:22 +00:00
|
|
|
{1, &Klayman::sub421430},
|
|
|
|
{1, &Klayman::sub421480}
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
static const KlaymanIdleTableItem klaymanTable4[] = {
|
2011-07-27 18:02:30 +00:00
|
|
|
{1, &Klayman::sub41FDA0},
|
2011-10-21 09:13:49 +00:00
|
|
|
{1, &Klayman::stDoIdleChest},
|
2011-07-27 18:02:30 +00:00
|
|
|
{1, &Klayman::sub41FEB0},
|
|
|
|
};
|
|
|
|
|
2011-07-11 18:47:03 +00:00
|
|
|
// Klayman
|
|
|
|
|
2011-09-16 12:23:26 +00:00
|
|
|
Klayman::Klayman(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, int surfacePriority, int objectPriority, NRectArray *clipRects)
|
2011-07-07 17:26:22 +00:00
|
|
|
: AnimatedSprite(vm, objectPriority), _soundResource1(vm), _soundResource2(vm),
|
2011-10-28 10:37:07 +00:00
|
|
|
_counterMax(0), _counter(0), _isMoveObjectRequested(false), _counter3Max(0), _isWalkingOpenDoorNotified(false), _counter1(0),
|
|
|
|
_counter2(0), /*_field118(0), */_status2(0), _acceptInput(true), _attachedSprite(NULL), _isWalking(false),
|
|
|
|
_status3(1), _parentScene(parentScene), _isSneaking(false), _isLargeStep(false), _flagF6(false), _isLeverDown(false),
|
2012-08-17 15:03:38 +00:00
|
|
|
_flagFA(false), _ladderStatus(0), _pathPoints(NULL), _resourceHandle(-1), _soundFlag(false) {
|
2011-07-07 17:26:22 +00:00
|
|
|
|
2011-07-13 18:38:40 +00:00
|
|
|
// TODO DirtySurface
|
2011-07-07 17:26:22 +00:00
|
|
|
createSurface(surfacePriority, 320, 200);
|
|
|
|
_x = x;
|
|
|
|
_y = y;
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = x;
|
|
|
|
_destY = y;
|
2011-07-07 17:26:22 +00:00
|
|
|
_flags = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
setKlaymanIdleTable1();
|
2011-10-21 09:13:49 +00:00
|
|
|
stTryStandIdle();
|
2011-07-07 17:26:22 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::xUpdate() {
|
2011-07-07 20:26:12 +00:00
|
|
|
// Empty
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Klayman::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
2011-07-07 20:26:12 +00:00
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-07-07 20:26:12 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-07-07 20:26:12 +00:00
|
|
|
break;
|
|
|
|
case 0x4818:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(_dataResource.getPoint(param.asInteger()).x, false);
|
2011-07-07 20:26:12 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-07-07 17:26:22 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::update() {
|
2011-07-07 17:28:51 +00:00
|
|
|
AnimatedSprite::update();
|
|
|
|
xUpdate();
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::setKlaymanIdleTable(const KlaymanIdleTableItem *table, int tableCount) {
|
|
|
|
_idleTable = table;
|
|
|
|
_idleTableCount = tableCount;
|
|
|
|
_idleTableMaxValue = 0;
|
2011-07-07 17:26:22 +00:00
|
|
|
for (int i = 0; i < tableCount; i++) {
|
2011-10-27 11:33:12 +00:00
|
|
|
_idleTableMaxValue += table[i].value;
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::setKlaymanIdleTable1() {
|
|
|
|
setKlaymanIdleTable(klaymanTable1, ARRAYSIZE(klaymanTable1));
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::setKlaymanIdleTable2() {
|
|
|
|
setKlaymanIdleTable(klaymanTable2, ARRAYSIZE(klaymanTable2));
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::setKlaymanIdleTable3() {
|
|
|
|
// TODO setKlaymanIdleTable(klaymanTable3, ARRAYSIZE(klaymanTable3));
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stDoIdlePickEar() {
|
2011-10-28 10:37:07 +00:00
|
|
|
startIdleAnimation(0x5B20C814, AnimationCallback(&Klayman::stIdlePickEar));
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stIdlePickEar() {
|
2011-07-07 17:26:22 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x5B20C814, 0, -1);
|
2011-07-07 17:26:22 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&Klayman::hmIdlePickEar);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::stStandAround);
|
|
|
|
FinalizeState(&Klayman::evIdlePickEarDone);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
uint32 Klayman::hmIdlePickEar(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-07 17:26:22 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
2011-07-08 19:09:33 +00:00
|
|
|
if (param.asInteger() == 0x04DBC02C) {
|
|
|
|
_soundResource1.play(0x44528AA1);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::evIdlePickEarDone() {
|
2011-09-12 19:09:01 +00:00
|
|
|
_soundResource1.stop();
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub41FDA0() {
|
2011-10-28 10:37:07 +00:00
|
|
|
startIdleAnimation(0xD122C137, AnimationCallback(&Klayman::sub41FDB0));
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub41FDB0() {
|
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0xD122C137, 0, -1);
|
2011-07-07 17:26:22 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41E980);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::stStandAround);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Klayman::handleMessage41E980(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
2011-07-08 19:09:33 +00:00
|
|
|
if (param.asInteger() == 0x808A0008) {
|
|
|
|
_soundResource1.play(0xD948A340);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub41FDF0() {
|
2011-10-28 10:37:07 +00:00
|
|
|
startIdleAnimation(0x543CD054, AnimationCallback(&Klayman::sub41FE00));
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub41FE00() {
|
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x543CD054, 0, -1);
|
2011-07-07 17:26:22 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41E9E0);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::stStandAround);
|
|
|
|
FinalizeState(&Klayman::sub41FE50);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub41FE50() {
|
2011-09-12 19:09:01 +00:00
|
|
|
_soundResource1.stop();
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Klayman::handleMessage41E9E0(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
2011-07-08 19:09:33 +00:00
|
|
|
if (param.asInteger() == 0x5A0F0104) {
|
|
|
|
_soundResource1.play(0x7970A100);
|
|
|
|
} else if (param.asInteger() == 0x9A9A0109) {
|
|
|
|
_soundResource1.play(0xD170CF04);
|
|
|
|
} else if (param.asInteger() == 0x989A2169) {
|
|
|
|
_soundResource1.play(0xD073CF14);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stDoIdleChest() {
|
2011-10-28 10:37:07 +00:00
|
|
|
startIdleAnimation(0x40A0C034, AnimationCallback(&Klayman::stIdleChest));
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stIdleChest() {
|
2011-07-07 17:26:22 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x40A0C034, 0, -1);
|
2011-07-07 17:26:22 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&Klayman::hmIdleChest);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::stStandAround);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
uint32 Klayman::hmIdleChest(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-07 17:26:22 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
2011-07-08 19:09:33 +00:00
|
|
|
if (param.asInteger() == 0x0D2A0288) {
|
|
|
|
_soundResource1.play(0xD192A368);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub41FEB0() {
|
2011-10-28 10:37:07 +00:00
|
|
|
startIdleAnimation(0x5120E137, AnimationCallback(&Klayman::sub41FEC0));
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub41FEC0() {
|
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x5120E137, 0, -1);
|
2011-07-07 17:26:22 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41EFE0);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::stStandAround);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Klayman::handleMessage41EFE0(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
2011-07-08 19:09:33 +00:00
|
|
|
if (param.asInteger() == 0xC006000C) {
|
|
|
|
_soundResource1.play(0x9D406340);
|
|
|
|
} else if (param.asInteger() == 0x2E4A2940) {
|
|
|
|
_soundResource1.play(0x53A4A1D4);
|
|
|
|
} else if (param.asInteger() == 0xAA0A0860) {
|
|
|
|
_soundResource1.play(0x5BE0A3C6);
|
|
|
|
} else if (param.asInteger() == 0xC0180260) {
|
|
|
|
_soundResource1.play(0x5D418366);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-07-26 08:38:19 +00:00
|
|
|
void Klayman::sub421350() {
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x582EC138, 0, -1);
|
2011-07-26 08:38:19 +00:00
|
|
|
_counter = 0;
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update41D1C0);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
|
|
|
_counter3 = 0;
|
|
|
|
_counterMax = 8;
|
2011-09-23 15:21:24 +00:00
|
|
|
_counter3Max = _vm->_rnd->getRandomNumber(64 - 1) + 24;
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::update41D1C0() {
|
|
|
|
update();
|
|
|
|
_counter++;
|
|
|
|
if (_counter >= _counterMax) {
|
|
|
|
_counter = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_idleTable) {
|
|
|
|
int randomValue = _vm->_rnd->getRandomNumber(_idleTableMaxValue);
|
|
|
|
for (int i = 0; i < _idleTableCount; i++) {
|
|
|
|
if (randomValue < _idleTable[_idleTableCount].value) {
|
|
|
|
(this->*(_idleTable[_idleTableCount].callback))();
|
2011-07-26 08:38:19 +00:00
|
|
|
_counterMax = _vm->_rnd->getRandomNumber(128) + 24;
|
|
|
|
break;
|
|
|
|
}
|
2011-10-27 11:33:12 +00:00
|
|
|
randomValue -= _idleTable[_idleTableCount].value;
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_counter3++;
|
|
|
|
if (_counter3 >= _counter3Max) {
|
|
|
|
_counter3 = 0;
|
|
|
|
_counter3Max = _vm->_rnd->getRandomNumber(64) + 24;
|
2011-10-21 09:13:49 +00:00
|
|
|
stIdleSitBlink();
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stIdleSitBlink() {
|
2011-07-26 08:38:19 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x5C24C018, 0, -1);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::stIdleSitBlinkSecond);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stIdleSitBlinkSecond() {
|
2011-07-26 08:38:19 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x5C24C018, 0, -1);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update41D1C0);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stPickUpNeedle() {
|
|
|
|
setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stPickUpNeedle))) {
|
2011-07-26 08:38:19 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x1449C169, 0, -1);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&Klayman::hmPickUpGeneric);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub41FFF0() {
|
2011-10-21 09:13:49 +00:00
|
|
|
setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::sub41FFF0))) {
|
2011-07-26 08:38:19 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x0018C032, 0, -1);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D640);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Klayman::handleMessage41D640(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0xC1380080) {
|
|
|
|
if (_attachedSprite) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x4806, 0);
|
2011-07-26 08:38:19 +00:00
|
|
|
_soundResource1.play(0xC8004340);
|
|
|
|
}
|
|
|
|
} else if (param.asInteger() == 0x02B20220) {
|
|
|
|
_soundResource1.play(0xC5408620);
|
|
|
|
} else if (param.asInteger() == 0x03020231) {
|
|
|
|
_soundResource1.play(0xD4C08010);
|
|
|
|
} else if (param.asInteger() == 0x67221A03) {
|
|
|
|
_soundResource1.play(0x44051000);
|
|
|
|
} else if (param.asInteger() == 0x925A0C1E) {
|
|
|
|
_soundResource1.play(0x40E5884D);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stTurnToUseInTeleporter() {
|
2011-07-26 08:38:19 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0xD229823D, 0, -1);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stReturnFromUseInTeleporter() {
|
2011-07-26 08:38:19 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x9A2801E0, 0, -1);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stStepOver() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stStepOver))) {
|
2011-07-26 08:38:19 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x004AA310, 0, -1);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmStartWalking);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stSitInTeleporter() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stSitInTeleporter))) {
|
2011-07-26 08:38:19 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x392A0330, 0, -1);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmSitInTeleporter);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
uint32 Klayman::hmSitInTeleporter(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-26 08:38:19 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x001A2832) {
|
|
|
|
_soundResource1.play(0xC0E4884C);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stGetUpFromTeleporter() {
|
2011-07-26 08:38:19 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x913AB120, 0, -1);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
|
2011-07-07 17:26:22 +00:00
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
2011-09-09 09:04:28 +00:00
|
|
|
void Klayman::sub41CE70() {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = _x;
|
|
|
|
if (!_isWalking && !_isSneaking && !_isLargeStep) {
|
2011-10-21 09:13:49 +00:00
|
|
|
gotoState(NULL);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-09 09:04:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
void Klayman::startIdleAnimation(uint32 fileHash, AnimationCb callback) {
|
2011-07-07 17:26:22 +00:00
|
|
|
_resourceHandle = _vm->_res->useResource(fileHash);
|
|
|
|
if (_resourceHandle != -1) {
|
|
|
|
// TODO _vm->_res->moveToFront(_resourceHandle);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(callback);
|
2011-10-28 10:37:07 +00:00
|
|
|
SetUpdateHandler(&Klayman::upIdleAnimation);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
void Klayman::upIdleAnimation() {
|
2011-07-07 17:26:22 +00:00
|
|
|
// TODO Check if this odd stuff is needed or just some cache optimization
|
|
|
|
if (_vm->_res->isResourceDataValid(_resourceHandle)) {
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-07 17:26:22 +00:00
|
|
|
// TODO _vm->_res->moveToBack(_resourceHandle);
|
|
|
|
_vm->_res->unuseResource(_resourceHandle);
|
|
|
|
_resourceHandle = -1;
|
|
|
|
} else {
|
|
|
|
// TODO _vm->_res->moveToFront(_resourceHandle);
|
|
|
|
}
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
bool Klayman::stStartActionFromIdle(AnimationCb callback) {
|
2011-07-09 18:45:51 +00:00
|
|
|
if (_status2 == 2) {
|
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x9A7020B8, 0, -1);
|
2011-07-09 18:45:51 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmStartAction);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(callback);
|
2011-07-09 18:45:51 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
void Klayman::gotoNextStateExt() {
|
2011-10-21 09:13:49 +00:00
|
|
|
if (_finalizeStateCb) {
|
|
|
|
AnimationCb cb = _finalizeStateCb;
|
|
|
|
_finalizeStateCb = NULL;
|
2011-07-09 18:45:51 +00:00
|
|
|
(this->*cb)();
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
2011-10-21 09:13:49 +00:00
|
|
|
if (_nextStateCb) {
|
|
|
|
AnimationCb cb = _nextStateCb;
|
|
|
|
_nextStateCb = NULL;
|
2011-07-07 17:26:22 +00:00
|
|
|
(this->*cb)();
|
|
|
|
#if 0 // TODO
|
|
|
|
} else if (_callbackList) {
|
|
|
|
removeCallbackList();
|
|
|
|
#endif
|
|
|
|
} else {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x1006, 0);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub41C770() {
|
|
|
|
_flagFA = false;
|
2011-07-09 18:45:51 +00:00
|
|
|
_status3 = 1;
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub41C790() {
|
|
|
|
if (_flagFA)
|
2011-07-09 18:45:51 +00:00
|
|
|
_status3 = 0;
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stTryStandIdle() {
|
|
|
|
if (!stStartActionFromIdle(AnimationCallback(&Klayman::stTryStandIdle))) {
|
2011-07-09 18:45:51 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x5420E254, 0, -1);
|
2011-07-07 17:26:22 +00:00
|
|
|
_counter = 0;
|
|
|
|
_counter3 = 0;
|
|
|
|
_counter3Max = _vm->_rnd->getRandomNumber(64) + 24;
|
|
|
|
SetUpdateHandler(&Klayman::update41D0F0);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::update41D0F0() {
|
|
|
|
update();
|
2011-10-27 11:33:12 +00:00
|
|
|
if (++_counter >= 720) {
|
2011-07-07 17:26:22 +00:00
|
|
|
_counter = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_idleTable) {
|
|
|
|
int randomValue = _vm->_rnd->getRandomNumber(_idleTableMaxValue);
|
|
|
|
for (int i = 0; i < _idleTableCount; i++) {
|
|
|
|
if (randomValue < _idleTable[_idleTableCount].value) {
|
|
|
|
(this->*(_idleTable[_idleTableCount].callback))();
|
2011-07-07 17:26:22 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-10-27 11:33:12 +00:00
|
|
|
randomValue -= _idleTable[_idleTableCount].value;
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
}
|
2011-10-27 11:33:12 +00:00
|
|
|
} else if (++_counter3 >= _counter3Max) {
|
|
|
|
_counter3 = 0;
|
|
|
|
_counter3Max = _vm->_rnd->getRandomNumber(64) + 24;
|
|
|
|
stStand();
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Klayman::handleMessage41D360(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
Sprite::handleMessage(messageNum, param, sender);
|
|
|
|
uint32 messageResult = xHandleMessage(messageNum, param);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x1008:
|
2011-10-27 11:33:12 +00:00
|
|
|
messageResult = _acceptInput;
|
2011-07-07 17:26:22 +00:00
|
|
|
break;
|
|
|
|
case 0x1014:
|
2011-10-21 09:13:49 +00:00
|
|
|
_attachedSprite = (Sprite*)(param.asEntity());
|
2011-07-07 17:26:22 +00:00
|
|
|
break;
|
|
|
|
case 0x1019:
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-07 17:26:22 +00:00
|
|
|
break;
|
|
|
|
case 0x101C:
|
|
|
|
sub41C770();
|
|
|
|
break;
|
|
|
|
case 0x1021:
|
|
|
|
sub41C790();
|
|
|
|
break;
|
|
|
|
case 0x481C:
|
2011-07-09 18:45:51 +00:00
|
|
|
_status3 = param.asInteger();
|
2011-07-07 17:26:22 +00:00
|
|
|
_flagFA = true;
|
|
|
|
messageResult = 1;
|
|
|
|
break;
|
|
|
|
case 0x482C:
|
2011-07-08 19:09:33 +00:00
|
|
|
if (param.asInteger() != 0) {
|
2012-08-17 15:03:38 +00:00
|
|
|
_pathPoints = _dataResource.getPointArray(param.asInteger());
|
2011-07-07 17:26:22 +00:00
|
|
|
} else {
|
2012-08-17 15:03:38 +00:00
|
|
|
_pathPoints = NULL;
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stStand() {
|
2011-07-07 17:26:22 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x5900C41E, 0, -1);
|
2011-07-07 17:26:22 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::stStandAround);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Klayman::handleMessage41D480(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D360(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x3002:
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-07 17:26:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stStandAround() {
|
2011-07-07 17:26:22 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x5420E254, 0, -1);
|
2011-07-07 17:26:22 +00:00
|
|
|
SetUpdateHandler(&Klayman::update41D0F0);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-07 17:26:22 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
uint32 Klayman::hmStartAction(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-07 20:26:12 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
2011-07-08 19:09:33 +00:00
|
|
|
if (param.asInteger() == 0x271AA210) {
|
|
|
|
_soundResource1.play(0x4924AAC4);
|
|
|
|
} else if (param.asInteger() == 0x2B22AA81) {
|
|
|
|
_soundResource1.play(0x0A2AA8E0);
|
2011-07-07 20:26:12 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
void Klayman::startWalkToX(int16 x, bool flag) {
|
2011-07-07 20:26:12 +00:00
|
|
|
int16 xdiff = ABS(x - _x);
|
2011-07-09 18:45:51 +00:00
|
|
|
if (x == _x) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = x;
|
|
|
|
if (!_isWalking && !_isSneaking && !_isLargeStep) {
|
2011-10-21 09:13:49 +00:00
|
|
|
gotoState(NULL);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-07 20:26:12 +00:00
|
|
|
}
|
2011-10-28 10:37:07 +00:00
|
|
|
} else if (xdiff <= 36 && !_isWalking && !_isSneaking && !_isLargeStep) {
|
|
|
|
_destX = x;
|
2011-10-21 09:13:49 +00:00
|
|
|
gotoState(NULL);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-09 18:45:51 +00:00
|
|
|
} else if (xdiff <= 42 && _status3 != 3) {
|
2011-10-28 10:37:07 +00:00
|
|
|
if (_isSneaking && ((!_doDeltaX && x - _x > 0) || (_doDeltaX && x - _x < 0)) && ABS(_destX - _x) > xdiff) {
|
|
|
|
_destX = x;
|
2011-07-07 20:26:12 +00:00
|
|
|
} else {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = x;
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stSneak);
|
2011-07-07 20:26:12 +00:00
|
|
|
}
|
2011-10-28 10:37:07 +00:00
|
|
|
} else if (_isWalking && ((!_doDeltaX && x - _x > 0) || (_doDeltaX && x - _x < 0))) {
|
|
|
|
_destX = x;
|
2011-07-07 20:26:12 +00:00
|
|
|
} else if (flag) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = x;
|
2012-08-29 17:54:46 +00:00
|
|
|
GotoState(&Klayman::sub421550);
|
2011-07-07 20:26:12 +00:00
|
|
|
} else {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = x;
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStartWalking);
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stWakeUp() {
|
2011-07-08 19:09:33 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x527AC970, 0, -1);
|
2011-07-08 19:09:33 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stSleeping() {
|
2011-07-08 19:09:33 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x5A38C110, 0, -1);
|
2011-07-08 19:09:33 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&Klayman::hmSleeping);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
uint32 Klayman::hmSleeping(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-08 19:09:33 +00:00
|
|
|
uint32 messageResult = handleMessage41D360(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x03060012) {
|
|
|
|
_soundResource1.play(0xC0238244);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
bool Klayman::stStartAction(AnimationCb callback3) {
|
2011-07-08 19:09:33 +00:00
|
|
|
if (_status2 == 1) {
|
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x5C7080D4, 0, -1);
|
2011-07-08 19:09:33 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmStartAction);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F250);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(callback3);
|
2011-07-08 19:09:33 +00:00
|
|
|
return true;
|
|
|
|
} else {
|
2011-10-28 10:37:07 +00:00
|
|
|
_x = _destX;
|
2011-07-08 19:09:33 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::spriteUpdate41F250() {
|
2011-07-09 18:45:51 +00:00
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
int16 xdiff = _destX - _x;
|
2011-07-09 18:45:51 +00:00
|
|
|
|
|
|
|
if (_doDeltaX) {
|
|
|
|
_x -= _deltaX;
|
|
|
|
} else {
|
|
|
|
_x += _deltaX;
|
|
|
|
}
|
|
|
|
_deltaX = 0;
|
|
|
|
|
|
|
|
if (_doDeltaY) {
|
|
|
|
_y -= _deltaY;
|
|
|
|
} else {
|
|
|
|
_y += _deltaY;
|
|
|
|
}
|
|
|
|
_deltaY = 0;
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_frameChanged) {
|
2011-07-09 18:45:51 +00:00
|
|
|
if (xdiff > 6)
|
|
|
|
_x += 6;
|
|
|
|
else if (xdiff < -6)
|
|
|
|
_x -= 6;
|
|
|
|
else
|
2011-10-28 10:37:07 +00:00
|
|
|
_x = _destX;
|
2011-07-09 18:45:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
processDelta();
|
|
|
|
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::suWalking() {
|
2011-07-09 18:45:51 +00:00
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
int16 xdiff = _destX - _x;
|
2011-07-09 18:45:51 +00:00
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_currFrameIndex == 9) {
|
2011-07-09 18:45:51 +00:00
|
|
|
if (xdiff > 26)
|
|
|
|
_deltaX += xdiff - 26;
|
|
|
|
else if (xdiff < -26)
|
|
|
|
_deltaX -= xdiff + 26;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xdiff > _deltaX)
|
|
|
|
xdiff = _deltaX;
|
|
|
|
else if (xdiff < -_deltaX)
|
|
|
|
xdiff = -_deltaX;
|
|
|
|
_deltaX = 0;
|
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
if (_destX != _x) {
|
2011-07-09 18:45:51 +00:00
|
|
|
HitRect *hitRectPrev = _vm->_collisionMan->findHitRectAtPos(_x, _y);
|
|
|
|
_x += xdiff;
|
2012-08-17 15:03:38 +00:00
|
|
|
if (_pathPoints) {
|
|
|
|
walkAlongPathPoints();
|
2011-07-09 18:45:51 +00:00
|
|
|
} else {
|
|
|
|
HitRect *hitRectNext = _vm->_collisionMan->findHitRectAtPos(_x, _y);
|
|
|
|
if (hitRectNext->type == 0x5002) {
|
|
|
|
_y = MAX<int16>(hitRectNext->rect.y1, hitRectNext->rect.y2 - (hitRectNext->rect.x2 - _x) / 2);
|
|
|
|
} else if (hitRectNext->type == 0x5003) {
|
|
|
|
_y = MAX<int16>(hitRectNext->rect.y1, hitRectNext->rect.y2 - (_x - hitRectNext->rect.x1) / 2);
|
|
|
|
} else if (hitRectPrev->type == 0x5002) {
|
|
|
|
if (xdiff > 0) {
|
|
|
|
_y = hitRectPrev->rect.y2;
|
|
|
|
} else {
|
|
|
|
_y = hitRectPrev->rect.y1;
|
|
|
|
}
|
|
|
|
} else if (hitRectPrev->type == 0x5003) {
|
|
|
|
if (xdiff < 0) {
|
|
|
|
_y = hitRectPrev->rect.y2;
|
|
|
|
} else {
|
|
|
|
_y = hitRectPrev->rect.y1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
processDelta();
|
|
|
|
}
|
|
|
|
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stSneak() {
|
2011-07-08 19:09:33 +00:00
|
|
|
_status2 = 1;
|
2011-10-28 10:37:07 +00:00
|
|
|
_isSneaking = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
2011-10-28 10:37:07 +00:00
|
|
|
setDoDeltaX(_destX < _x ? 1 : 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x5C48C506, 0, -1);
|
2011-07-08 19:09:33 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmWalking);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::suWalking);
|
2011-10-27 11:33:12 +00:00
|
|
|
FinalizeState(&Klayman::stWalkingDone);
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stWalkingDone() {
|
2011-10-28 10:37:07 +00:00
|
|
|
_isSneaking = false;
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
uint32 Klayman::hmWalking(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-08 19:09:33 +00:00
|
|
|
uint32 messageResult = handleMessage41D360(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x32180101) {
|
|
|
|
_soundResource1.play(0x4924AAC4);
|
|
|
|
} else if (param.asInteger() == 0x0A2A9098) {
|
|
|
|
_soundResource1.play(0x0A2AA8E0);
|
|
|
|
} else if (param.asInteger() == 0x32188010) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_soundResource1.play(_soundFlag ? 0x48498E46 : 0x405002D8);
|
2011-07-08 19:09:33 +00:00
|
|
|
} else if (param.asInteger() == 0x02A2909C) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_soundResource1.play(_soundFlag ? 0x50399F64 : 0x0460E2FA);
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x3002:
|
2011-10-28 10:37:07 +00:00
|
|
|
_x = _destX;
|
|
|
|
gotoNextStateExt();
|
2011-07-08 19:09:33 +00:00
|
|
|
break;
|
2011-07-07 20:26:12 +00:00
|
|
|
}
|
2011-07-08 19:09:33 +00:00
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stStartWalking() {
|
|
|
|
if (!stStartActionFromIdle(AnimationCallback(&Klayman::stStartWalking))) {
|
2011-07-08 19:09:33 +00:00
|
|
|
_status2 = 0;
|
2011-10-28 10:37:07 +00:00
|
|
|
_isWalking = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
2011-10-28 10:37:07 +00:00
|
|
|
setDoDeltaX(_destX < _x ? 1 : 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x242C0198, 0, -1);
|
2011-07-08 19:09:33 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmStartWalking);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::suWalkingTestExit);
|
2011-10-21 09:13:49 +00:00
|
|
|
FinalizeState(&Klayman::stStartWalkingDone);
|
|
|
|
NextState(&Klayman::stWalking);
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stStartWalkingDone() {
|
2011-10-28 10:37:07 +00:00
|
|
|
_isWalking = false;
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
uint32 Klayman::hmStartWalking(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-09 18:45:51 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
2011-07-08 19:09:33 +00:00
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x32180101) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_soundResource1.play(_soundFlag ? 0x48498E46 : 0x405002D8);
|
2011-07-08 19:09:33 +00:00
|
|
|
} else if (param.asInteger() == 0x0A2A9098) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_soundResource1.play(_soundFlag ? 0x50399F64 : 0x0460E2FA);
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stWalking() {
|
2011-07-08 19:09:33 +00:00
|
|
|
_status2 = 0;
|
2011-10-28 10:37:07 +00:00
|
|
|
_isWalking = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x1A249001, 0, -1);
|
2011-07-08 19:09:33 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41EB70);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F300);
|
2011-10-21 09:13:49 +00:00
|
|
|
FinalizeState(&Klayman::stStartWalkingDone);
|
2011-10-27 11:33:12 +00:00
|
|
|
NextState(&Klayman::stUpdateWalking);
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::spriteUpdate41F300() {
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::suWalkingTestExit);
|
2011-07-08 19:09:33 +00:00
|
|
|
_deltaX = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Klayman::handleMessage41EB70(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D360(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x32180101) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_soundResource1.play(_soundFlag ? 0x48498E46 : 0x405002D8);
|
2011-07-08 19:09:33 +00:00
|
|
|
} else if (param.asInteger() == 0x0A2A9098) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_soundResource1.play(_soundFlag ? 0x50399F64 : 0x0460E2FA);
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stUpdateWalking() {
|
2011-07-09 18:45:51 +00:00
|
|
|
if (_status3 == 2) {
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-09 18:45:51 +00:00
|
|
|
} else if (_status3 == 3) {
|
2011-10-27 11:33:12 +00:00
|
|
|
stWalkingOpenDoor();
|
2011-07-08 19:09:33 +00:00
|
|
|
} else {
|
2011-10-28 10:37:07 +00:00
|
|
|
_isSneaking = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
2011-10-28 10:37:07 +00:00
|
|
|
if (ABS(_destX - _x) <= 42 && _currFrameIndex >= 5 && _currFrameIndex <= 11) {
|
2011-07-09 18:45:51 +00:00
|
|
|
if (_status3 == 0) {
|
2011-07-08 19:09:33 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xF234EE31, 0, -1);
|
2011-07-08 19:09:33 +00:00
|
|
|
} else {
|
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xF135CC21, 0, -1);
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
2011-10-28 10:37:07 +00:00
|
|
|
} else if (ABS(_destX - _x) <= 10 && (_currFrameIndex >= 12 || _currFrameIndex <= 4)) {
|
2011-07-09 18:45:51 +00:00
|
|
|
if (_status3 == 0) {
|
2011-07-08 19:09:33 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x8604A152, 0, -1);
|
2011-07-08 19:09:33 +00:00
|
|
|
} else {
|
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xA246A132, 0, -1);
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmWalking);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::suWalking);
|
2011-10-27 11:33:12 +00:00
|
|
|
FinalizeState(&Klayman::stWalkingDone);
|
2011-07-08 19:09:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
void Klayman::suWalkingTestExit() {
|
|
|
|
int16 xdiff = ABS(_destX - _x);
|
|
|
|
int16 xdelta = _destX - _x;
|
2011-07-08 19:09:33 +00:00
|
|
|
|
|
|
|
if (xdelta > _deltaX)
|
|
|
|
xdelta = _deltaX;
|
2011-07-09 18:45:51 +00:00
|
|
|
else if (xdelta < -_deltaX)
|
2011-07-08 19:09:33 +00:00
|
|
|
xdelta = -_deltaX;
|
|
|
|
|
|
|
|
_deltaX = 0;
|
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
if (xdiff == 0 ||
|
|
|
|
(_status3 != 2 && _status3 != 3 && xdiff <= 42 && _currFrameIndex >= 5 && _currFrameIndex <= 11) ||
|
|
|
|
(_status3 != 2 && _status3 != 3 && xdiff <= 10 && (_currFrameIndex >= 12 || _currFrameIndex <= 4)) ||
|
|
|
|
(_status3 == 3 && xdiff < 30) ||
|
|
|
|
(_status3 == 3 && xdiff < 150 && _currFrameIndex >= 6)) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(this, 0x1019, 0);
|
2011-07-08 19:09:33 +00:00
|
|
|
} else {
|
|
|
|
HitRect *hitRectPrev = _vm->_collisionMan->findHitRectAtPos(_x, _y);
|
|
|
|
_x += xdelta;
|
2012-08-17 15:03:38 +00:00
|
|
|
if (_pathPoints) {
|
|
|
|
walkAlongPathPoints();
|
2011-07-08 19:09:33 +00:00
|
|
|
} else {
|
|
|
|
HitRect *hitRectNext = _vm->_collisionMan->findHitRectAtPos(_x, _y);
|
|
|
|
if (hitRectNext->type == 0x5002) {
|
|
|
|
_y = MAX<int16>(hitRectNext->rect.y1, hitRectNext->rect.y2 - (hitRectNext->rect.x2 - _x) / 2);
|
|
|
|
} else if (hitRectNext->type == 0x5003) {
|
|
|
|
_y = MAX<int16>(hitRectNext->rect.y1, hitRectNext->rect.y2 - (_x - hitRectNext->rect.x1) / 2);
|
|
|
|
} else if (hitRectPrev->type == 0x5002) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_y = xdelta > 0 ? hitRectPrev->rect.y2 : hitRectPrev->rect.y1;
|
2011-07-08 19:09:33 +00:00
|
|
|
} else if (hitRectPrev->type == 0x5003) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_y = xdelta < 0 ? hitRectPrev->rect.y2 : hitRectPrev->rect.y1;
|
2011-07-08 19:09:33 +00:00
|
|
|
} else if (_flagF6 && xdelta != 0) {
|
|
|
|
if (hitRectNext->type == 0x5000) {
|
|
|
|
_y++;
|
|
|
|
} else if (hitRectNext->type == 0x5001 && _y > hitRectNext->rect.y1) {
|
|
|
|
_y--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
processDelta();
|
|
|
|
}
|
|
|
|
|
2011-07-07 20:26:12 +00:00
|
|
|
}
|
2011-07-07 17:26:22 +00:00
|
|
|
|
2011-07-09 18:45:51 +00:00
|
|
|
uint32 Klayman::handleMessage41E210(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x4AB28209) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482A, 0);
|
2011-07-09 18:45:51 +00:00
|
|
|
} else if (param.asInteger() == 0x88001184) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482B, 0);
|
2011-07-09 18:45:51 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stPickUpGeneric() {
|
|
|
|
setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stPickUpGeneric))) {
|
2011-07-10 18:21:48 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x1C28C178, 0, -1);
|
2011-07-10 18:21:48 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&Klayman::hmPickUpGeneric);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
uint32 Klayman::hmPickUpGeneric(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-10 18:21:48 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0xC1380080) {
|
|
|
|
if (_attachedSprite) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x4806, 0);
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
|
|
|
_soundResource1.play(0x40208200);
|
|
|
|
} else if (param.asInteger() == 0x02B20220) {
|
|
|
|
_soundResource1.play(0xC5408620);
|
|
|
|
} else if (param.asInteger() == 0x03020231) {
|
|
|
|
_soundResource1.play(0xD4C08010);
|
|
|
|
} else if (param.asInteger() == 0x67221A03) {
|
|
|
|
_soundResource1.play(0x44051000);
|
|
|
|
} else if (param.asInteger() == 0x2EAE0303) {
|
|
|
|
_soundResource1.play(0x03630300);
|
|
|
|
} else if (param.asInteger() == 0x61CE4467) {
|
|
|
|
_soundResource1.play(0x03630300);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stTurnPressButton() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stTurnPressButton))) {
|
2011-07-10 18:21:48 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x1C02B03D, 0, -1);
|
2011-07-10 18:21:48 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&Klayman::hmPressButton);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
uint32 Klayman::hmPressButton(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-10 18:21:48 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x0D01B294) {
|
|
|
|
if (_attachedSprite) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x480B, 0);
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
|
|
|
} else if (param.asInteger() == 0x32180101) {
|
|
|
|
_soundResource1.play(0x4924AAC4);
|
|
|
|
} else if (param.asInteger() == 0x0A2A9098) {
|
|
|
|
_soundResource1.play(0x0A2AA8E0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stStampFloorButton() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stStampFloorButton))) {
|
2011-07-10 18:21:48 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x1C16B033, 0, -1);
|
2011-07-10 18:21:48 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&Klayman::hmPressButton);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stPressButtonSide() {
|
|
|
|
if (!stStartActionFromIdle(AnimationCallback(&Klayman::stPressButtonSide))) {
|
2011-07-10 18:21:48 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x1CD89029, 0, -1);
|
2011-07-10 18:21:48 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&Klayman::hmPressButton);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F250);
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
void Klayman::startSpecialWalkRight(int16 x) {
|
|
|
|
if (_x == x) {
|
|
|
|
_destX = x;
|
|
|
|
gotoState(NULL);
|
|
|
|
gotoNextStateExt();
|
2011-07-10 18:21:48 +00:00
|
|
|
} else if (_x < x) {
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(x, false);
|
|
|
|
} else if (_x - x <= 105) {
|
|
|
|
sub41CAC0(x);
|
2011-07-10 18:21:48 +00:00
|
|
|
} else {
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(x, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::startSpecialWalkLeft(int16 x) {
|
|
|
|
if (x == _x) {
|
|
|
|
_destX = x;
|
2011-10-21 09:13:49 +00:00
|
|
|
gotoState(NULL);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
|
|
|
} else if (x < _x) {
|
|
|
|
startWalkToX(x, false);
|
|
|
|
} else if (x - _x <= 105) {
|
|
|
|
sub41CAC0(x);
|
|
|
|
} else {
|
|
|
|
startWalkToX(x, false);
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-17 15:03:38 +00:00
|
|
|
void Klayman::sub41CDE0(int16 x) {
|
|
|
|
_status3 = 2;
|
|
|
|
if (_x == x) {
|
|
|
|
_destX = x;
|
|
|
|
if (_isWalking) {
|
|
|
|
GotoState(NULL);
|
|
|
|
gotoNextStateExt();
|
|
|
|
}
|
|
|
|
} else if (_isWalking && ((!_doDeltaX && x - _x > 0) || (_doDeltaX && x - _x < 0))) {
|
|
|
|
_destX = x;
|
|
|
|
} else {
|
|
|
|
_destX = x;
|
|
|
|
GotoState(&Klayman::sub421680);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub421680() {
|
|
|
|
_isWalking = true;
|
|
|
|
_acceptInput = true;
|
|
|
|
_status3 = 2;
|
|
|
|
setDoDeltaX(_destX < _x ? 1 : 0);
|
|
|
|
startAnimation(0x3A4CD934, 0, -1);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41ED70);
|
|
|
|
SetSpriteUpdate(&Klayman::suWalkingTestExit);
|
|
|
|
FinalizeState(&Klayman::stStartWalkingDone);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Klayman::handleMessage41ED70(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D360(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x32180101)
|
|
|
|
_soundResource1.play(0x4924AAC4);
|
|
|
|
else if (param.asInteger() == 0x0A2A9098)
|
|
|
|
_soundResource1.play(0x0A2AA8E0);
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub421640() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x90D0D1D0, 0, -1);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
|
|
|
SetSpriteUpdate(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub421740() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x11C8D156, 30, -1);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
|
|
|
SetSpriteUpdate(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub421780() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x11C8D156, 0, 10);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
|
|
|
SetSpriteUpdate(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub421700() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x11C8D156, 0, -1);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
|
|
|
SetSpriteUpdate(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub421840() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = false;
|
|
|
|
startAnimationByHash(0x3F9CC394, 0x14884392, 0);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41EE00);
|
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Klayman::handleMessage41EE00(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x80C110B5)
|
|
|
|
sendMessage(_parentScene, 0x482A, 0);
|
|
|
|
else if (param.asInteger() == 0x110010D1)
|
|
|
|
sendMessage(_parentScene, 0x482B, 0);
|
|
|
|
else if (param.asInteger() == 0x32180101)
|
|
|
|
_soundResource1.play(0x4924AAC4);
|
|
|
|
else if (param.asInteger() == 0x0A2A9098)
|
|
|
|
_soundResource1.play(0x0A2AA8E0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub421800() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x2F1C4694, 0, -1);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41EE00);
|
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub4217C0() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x3F9CC394, 0, -1);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41EE00);
|
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub421900() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = false;
|
|
|
|
startAnimationByHash(0x37ECD436, 0, 0x8520108C);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41EE00);
|
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub4218C0() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x16EDDE36, 0, -1);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41EE00);
|
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub421880() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x37ECD436, 0, -1);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41EE00);
|
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
|
|
|
}
|
|
|
|
|
2012-08-29 17:54:46 +00:00
|
|
|
void Klayman::sub420F60() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::sub420F60))) {
|
|
|
|
_status2 = 2;
|
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x3F28E094, 0, -1);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41E6C0);
|
|
|
|
SetSpriteUpdate(NULL);
|
|
|
|
NextState(&Klayman::sub420FB0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub420FB0() {
|
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x3A28C094, 0, -1);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41E6C0);
|
|
|
|
SetSpriteUpdate(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Klayman::handleMessage41E6C0(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x4AB28209) {
|
|
|
|
sendMessage(_attachedSprite, 0x482A, 0);
|
|
|
|
sendMessage(_attachedSprite, 0x480F, 0);
|
|
|
|
} else if (param.asInteger() == 0x88001184) {
|
|
|
|
sendMessage(_attachedSprite, 0x482B, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub421110() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::sub421110))) {
|
|
|
|
_status2 = 1;
|
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x1A38A814, 0, -1);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41E750);
|
|
|
|
SetSpriteUpdate(NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Klayman::handleMessage41E750(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x02B20220)
|
|
|
|
_soundResource1.play(0xC5408620);
|
|
|
|
else if (param.asInteger() == 0x0A720138)
|
|
|
|
_soundResource1.play(0xD4C08010);
|
|
|
|
else if (param.asInteger() == 0x03020231)
|
|
|
|
_soundResource1.play(0xD4C08010);
|
|
|
|
else if (param.asInteger() == 0xB613A180)
|
|
|
|
_soundResource1.play(0x44051000);
|
|
|
|
else if (param.asInteger() == 0x67221A03)
|
|
|
|
_soundResource1.play(0x44051000);
|
|
|
|
else if (param.asInteger() == 0x038A010B)
|
|
|
|
_soundResource1.play(0x00018040);
|
|
|
|
else if (param.asInteger() == 0x422B0280)
|
|
|
|
_soundResource1.play(0x166FC6E0);
|
|
|
|
else if (param.asInteger() == 0x925A0C1E)
|
|
|
|
_soundResource1.play(0x40E5884D);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub4215E0() {
|
|
|
|
_status2 = 0;
|
|
|
|
_isWalking = true;
|
|
|
|
_acceptInput = true;
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41EB70);
|
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F300);
|
|
|
|
NextState(&Klayman::stUpdateWalking);
|
|
|
|
FinalizeState(&Klayman::stStartWalkingDone);
|
|
|
|
startAnimation(0x5A2CBC00, 0, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub421550() {
|
|
|
|
if (!stStartActionFromIdle(AnimationCallback(&Klayman::sub421550))) {
|
|
|
|
_status2 = 0;
|
|
|
|
_isWalking = true;
|
|
|
|
_acceptInput = true;
|
|
|
|
setDoDeltaX(_destX < _x ? 1 : 0);
|
|
|
|
startAnimation(0x272C1199, 0, -1);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::hmStartWalking);
|
|
|
|
SetSpriteUpdate(&Klayman::suWalkingTestExit);
|
|
|
|
FinalizeState(&Klayman::stStartWalkingDone);
|
|
|
|
NextState(&Klayman::sub4215E0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-10 18:21:48 +00:00
|
|
|
void Klayman::sub41CC40(int16 x1, int16 x2) {
|
|
|
|
if (_x > x1) {
|
|
|
|
if (_x == x1 + x2) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = x1 + x2;
|
2011-10-21 09:13:49 +00:00
|
|
|
gotoState(NULL);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-10 18:21:48 +00:00
|
|
|
} else if (_x < x1 + x2) {
|
|
|
|
sub41CAC0(x1 + x2);
|
|
|
|
} else {
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(x1 + x2, false);
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (_x == x1 - x2) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = x1 - x2;
|
2011-10-21 09:13:49 +00:00
|
|
|
gotoState(NULL);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-10 18:21:48 +00:00
|
|
|
} else if (_x > x1 - x2) {
|
|
|
|
sub41CAC0(x1 - x2);
|
|
|
|
} else {
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(x1 - x2, false);
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub41CAC0(int16 x) {
|
|
|
|
int16 xdiff = ABS(x - _x);
|
|
|
|
if (x == _x) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = x;
|
|
|
|
if (!_isWalking && !_isSneaking && !_isLargeStep) {
|
2011-10-21 09:13:49 +00:00
|
|
|
gotoState(NULL);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
2011-10-28 10:37:07 +00:00
|
|
|
} else if (xdiff <= 36 && !_isWalking && !_isSneaking && !_isLargeStep) {
|
|
|
|
_destX = x;
|
2011-10-21 09:13:49 +00:00
|
|
|
gotoState(NULL);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-10 18:21:48 +00:00
|
|
|
} else if (xdiff <= 42 && _status3 != 3) {
|
2011-10-28 10:37:07 +00:00
|
|
|
if (_isSneaking && ((!_doDeltaX && x - _x > 0) || (_doDeltaX && x - _x < 0)) && ABS(_destX - _x) > xdiff) {
|
|
|
|
_destX = x;
|
2011-07-10 18:21:48 +00:00
|
|
|
} else {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = x;
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stSneak);
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
2011-10-28 10:37:07 +00:00
|
|
|
} else if (_isLargeStep && ((!_doDeltaX && x - _x > 0) || (_doDeltaX && x - _x < 0))) {
|
|
|
|
_destX = x;
|
2011-07-10 18:21:48 +00:00
|
|
|
} else {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = x;
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stLargeStep);
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stLargeStep() {
|
2011-07-10 18:21:48 +00:00
|
|
|
_status2 = 2;
|
2011-10-28 10:37:07 +00:00
|
|
|
_isLargeStep = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
2011-10-28 10:37:07 +00:00
|
|
|
setDoDeltaX(_destX >= _x ? 1 : 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x08B28116, 0, -1);
|
2011-07-10 18:21:48 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&Klayman::hmLargeStep);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::suLargeStep);
|
2011-10-21 09:13:49 +00:00
|
|
|
FinalizeState(&Klayman::stLargeStepDone);
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stLargeStepDone() {
|
2011-10-28 10:37:07 +00:00
|
|
|
_isLargeStep = false;
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::suLargeStep() {
|
2011-10-28 10:37:07 +00:00
|
|
|
int16 xdiff = _destX - _x;
|
2011-07-10 18:21:48 +00:00
|
|
|
|
|
|
|
if (_doDeltaX) {
|
|
|
|
_deltaX = -_deltaX;
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_currFrameIndex == 7) {
|
2011-07-10 18:21:48 +00:00
|
|
|
_deltaX = xdiff;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((xdiff > 0 && xdiff > _deltaX) || (xdiff < 0 && xdiff < _deltaX))
|
|
|
|
xdiff = _deltaX;
|
|
|
|
|
|
|
|
_deltaX = 0;
|
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
if (_x != _destX) {
|
2011-07-10 18:21:48 +00:00
|
|
|
HitRect *hitRectPrev = _vm->_collisionMan->findHitRectAtPos(_x, _y);
|
|
|
|
_x += xdiff;
|
2012-08-17 15:03:38 +00:00
|
|
|
if (_pathPoints) {
|
|
|
|
walkAlongPathPoints();
|
2011-07-10 18:21:48 +00:00
|
|
|
} else {
|
|
|
|
HitRect *hitRectNext = _vm->_collisionMan->findHitRectAtPos(_x, _y);
|
|
|
|
if (hitRectNext->type == 0x5002) {
|
|
|
|
_y = MAX<int16>(hitRectNext->rect.y1, hitRectNext->rect.y2 - (hitRectNext->rect.x2 - _x) / 2);
|
|
|
|
} else if (hitRectNext->type == 0x5003) {
|
|
|
|
_y = MAX<int16>(hitRectNext->rect.y1, hitRectNext->rect.y2 - (_x - hitRectNext->rect.x1) / 2);
|
|
|
|
} else if (hitRectPrev->type == 0x5002) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_y = xdiff > 0 ? hitRectPrev->rect.y2 : hitRectPrev->rect.y1;
|
2011-07-10 18:21:48 +00:00
|
|
|
} else if (hitRectPrev->type == 0x5003) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_y = xdiff < 0 ? hitRectPrev->rect.y2 : hitRectPrev->rect.y1;
|
2011-07-10 18:21:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
processDelta();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
uint32 Klayman::hmLargeStep(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-10 18:21:48 +00:00
|
|
|
uint32 messageResult = handleMessage41D360(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x32180101) {
|
|
|
|
_soundResource1.play(0x4924AAC4);
|
|
|
|
} else if (param.asInteger() == 0x0A2A9098) {
|
|
|
|
_soundResource1.play(0x0A2AA8E0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x3002:
|
2011-10-28 10:37:07 +00:00
|
|
|
_x = _destX;
|
|
|
|
gotoNextStateExt();
|
2011-07-10 18:21:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stWonderAboutHalf() {
|
2011-07-11 09:37:00 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0xD820A114, 0, 10);
|
2011-07-11 09:37:00 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-11 09:37:00 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stWonderAboutAfter() {
|
2011-07-11 09:37:00 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0xD820A114, 30, -1);
|
2011-07-11 09:37:00 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-11 09:37:00 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stTurnToUseHalf() {
|
2011-07-11 09:37:00 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x9B250AD2, 0, 7);
|
2011-07-11 09:37:00 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmTurnToUse);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-11 09:37:00 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
uint32 Klayman::hmTurnToUse(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-11 09:37:00 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x32180101) {
|
|
|
|
_soundResource1.play(0x4924AAC4);
|
|
|
|
} else if (param.asInteger() == 0x0A2A9098) {
|
|
|
|
_soundResource1.play(0x0A2AA8E0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stTurnAwayFromUse() {
|
2011-07-11 09:37:00 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x98F88391, 4, -1);
|
2011-07-11 09:37:00 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmTurnToUse);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-11 09:37:00 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stWonderAbout() {
|
2011-07-11 09:37:00 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0xD820A114, 0, -1);
|
2011-07-11 09:37:00 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-11 09:37:00 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stPeekWall() {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0xAC20C012, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&Klayman::hmPeekWall);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
uint32 Klayman::hmPeekWall(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-09-16 20:37:24 +00:00
|
|
|
int16 speedUpFrameIndex;
|
2011-07-13 18:38:40 +00:00
|
|
|
switch (messageNum) {
|
|
|
|
case 0x1008:
|
2011-09-16 20:37:24 +00:00
|
|
|
speedUpFrameIndex = getFrameIndex(kKlaymanSpeedUpHash);
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_currFrameIndex < speedUpFrameIndex)
|
|
|
|
startAnimation(0xAC20C012, speedUpFrameIndex, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
return 0;
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x32180101) {
|
|
|
|
_soundResource1.play(0x405002D8);
|
|
|
|
} else if (param.asInteger() == 0x0A2A9098) {
|
|
|
|
_soundResource1.play(0x0460E2FA);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return handleMessage41D480(messageNum, param, sender);
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stJumpToRing1() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stJumpToRing1))) {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xD82890BA, 0, -1);
|
|
|
|
setupJumpToRing();
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::setupJumpToRing() {
|
|
|
|
_acceptInput = false;
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmJumpToRing);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::sub420340);
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482B, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
uint32 Klayman::hmJumpToRing(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-13 18:38:40 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x168050A0) {
|
|
|
|
if (_attachedSprite) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x4806, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 0x320AC306) {
|
|
|
|
_soundResource1.play(0x5860C640);
|
|
|
|
} else if (param.asInteger() == 0x4AB28209) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482A, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 0x88001184) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482B, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::spriteUpdate41F230() {
|
|
|
|
AnimatedSprite::updateDeltaXY();
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = _x;
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub420340() {
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x4829E0B8, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stJumpToRing2() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stJumpToRing2))) {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x900980B2, 0, -1);
|
|
|
|
setupJumpToRing();
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stJumpToRing3() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stJumpToRing3))) {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0xBA1910B2, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmJumpToRing3);
|
|
|
|
NextState(&Klayman::stHoldRing);
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482B, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
uint32 Klayman::hmJumpToRing3(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-13 18:38:40 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x168050A0) {
|
|
|
|
if (_attachedSprite) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x4806, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
} else if (param.asInteger() == 0x320AC306) {
|
|
|
|
_soundResource1.play(0x5860C640);
|
|
|
|
} else if (param.asInteger() == 0x4AB28209) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482A, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 0x88001184) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482B, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stHoldRing() {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x4A293FB0, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmHoldRing);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
uint32 Klayman::hmHoldRing(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-13 18:38:40 +00:00
|
|
|
if (messageNum == 0x1008) {
|
2011-10-27 11:33:12 +00:00
|
|
|
stReleaseRing();
|
2011-07-13 18:38:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return handleMessage41D360(messageNum, param, sender);
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stReleaseRing() {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-07-13 18:38:40 +00:00
|
|
|
if (_attachedSprite) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x4807, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
_attachedSprite = NULL;
|
|
|
|
}
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xB869A4B9, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stJumpToRing4() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stJumpToRing4))) {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xB8699832, 0, -1);
|
|
|
|
setupJumpToRing();
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub41CCE0(int16 x) {
|
2011-10-21 09:13:49 +00:00
|
|
|
sub41CC40(_attachedSprite->getX(), x);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stContinueClimbLadderUp() {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
2011-10-28 10:37:07 +00:00
|
|
|
_ladderStatus = 3;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimationByHash(0x3A292504, 0x01084280, 0);
|
|
|
|
_newStickFrameHash = 0x01084280;
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
void Klayman::stStartClimbLadderDown() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stStartClimbLadderDown))) {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 0;
|
2011-10-28 10:37:07 +00:00
|
|
|
if (_destY < _y) {
|
|
|
|
if (_ladderStatus == 1) {
|
|
|
|
_ladderStatus = 2;
|
|
|
|
stClimbLadderHalf();
|
2011-07-13 18:38:40 +00:00
|
|
|
} else {
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
2011-10-28 10:37:07 +00:00
|
|
|
} else if (_ladderStatus == 0) {
|
|
|
|
_ladderStatus = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x122D1505, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-28 10:37:07 +00:00
|
|
|
SetMessageHandler(&Klayman::hmClimbLadderUpDown);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-10-28 10:37:07 +00:00
|
|
|
} else if (_ladderStatus == 3) {
|
|
|
|
_ladderStatus = 2;
|
|
|
|
_acceptInput = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimationByHash(0x122D1505, 0x01084280, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-28 10:37:07 +00:00
|
|
|
SetMessageHandler(&Klayman::hmClimbLadderUpDown);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-10-28 10:37:07 +00:00
|
|
|
} else if (_ladderStatus == 1) {
|
|
|
|
_ladderStatus = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x122D1505, 29 - _currFrameIndex, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
void Klayman::stClimbLadderHalf() {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 2;
|
2011-10-28 10:37:07 +00:00
|
|
|
if (_ladderStatus == 1) {
|
|
|
|
_ladderStatus = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimationByHash(0x3A292504, 0x02421405, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41DFD0);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-10-28 10:37:07 +00:00
|
|
|
} else if (_ladderStatus == 2) {
|
|
|
|
_ladderStatus = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimationByHash(0x122D1505, 0x02421405, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41DFD0);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else {
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Klayman::handleMessage41DFD0(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x489B025C) {
|
|
|
|
_soundResource1.play(0x52C4C2D7);
|
|
|
|
} else if (param.asInteger() == 0x400A0E64) {
|
|
|
|
_soundResource1.play(0x50E081D9);
|
|
|
|
} else if (param.asInteger() == 0x32180101) {
|
|
|
|
_soundResource1.play(0x405002D8);
|
|
|
|
} else if (param.asInteger() == 0x0A2A9098) {
|
|
|
|
_soundResource1.play(0x0460E2FA);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
uint32 Klayman::hmClimbLadderUpDown(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-13 18:38:40 +00:00
|
|
|
uint32 messageResult = handleMessage41D360(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x01084280) {
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 0x489B025C) {
|
|
|
|
_soundResource1.play(0x52C4C2D7);
|
|
|
|
} else if (param.asInteger() == 0x400A0E64) {
|
|
|
|
_soundResource1.play(0x50E081D9);
|
|
|
|
} else if (param.asInteger() == 0x02421405) {
|
2011-10-28 10:37:07 +00:00
|
|
|
if (_ladderStatus == 1) {
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimationByHash(0x3A292504, 0x01084280, 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
if (_destY >= _y - 30)
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(this, 0x1019, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else {
|
2011-10-28 10:37:07 +00:00
|
|
|
startAnimationByHash(0x122D1505, 0x01084280, 0);
|
|
|
|
if (_destY <= _y)
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(this, 0x1019, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
void Klayman::stStartClimbLadderUp() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stStartClimbLadderUp))) {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 0;
|
2011-10-28 10:37:07 +00:00
|
|
|
if (_destY >= _y - 30) {
|
|
|
|
gotoNextStateExt();
|
|
|
|
} else if (_ladderStatus == 0) {
|
|
|
|
_ladderStatus = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x3A292504, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-28 10:37:07 +00:00
|
|
|
SetMessageHandler(&Klayman::hmClimbLadderUpDown);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-10-28 10:37:07 +00:00
|
|
|
} else if (_ladderStatus == 3) {
|
|
|
|
_ladderStatus = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimationByHash(0x3A292504, 0x01084280, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-28 10:37:07 +00:00
|
|
|
SetMessageHandler(&Klayman::hmClimbLadderUpDown);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-10-28 10:37:07 +00:00
|
|
|
} else if (_ladderStatus == 2) {
|
|
|
|
_ladderStatus = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x3A292504, 29 - _currFrameIndex, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stWalkToFrontNoStep() {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimationByHash(0xF229C003, 0x14884392, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmWalkToFront);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
uint32 Klayman::hmWalkToFront(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-13 18:38:40 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x80C110B5) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x482A, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 0x110010D1) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x482B, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 0x32180101) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_soundResource1.play(_soundFlag ? 0x48498E46 : 0x405002D8);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 0x0A2A9098) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_soundResource1.play(_soundFlag ? 0x50399F64 : 0x0460E2FA);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stWalkToFront() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stWalkToFront))) {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0xF229C003, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmWalkToFront);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stTurnToFront() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stTurnToFront))) {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimationByHash(0xCA221107, 0x8520108C, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmWalkToFront);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stTurnToBack() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stTurnToBack))) {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0xCA221107, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmWalkToFront);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stLandOnFeet() {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x18118554, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmLandOnFeet);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
uint32 Klayman::hmLandOnFeet(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-13 18:38:40 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x320AC306) {
|
|
|
|
_soundResource1.play(0x5860C640);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stTurnToBackToUse() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stTurnToBackToUse))) {
|
2011-07-16 17:27:21 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x91540140, 0, -1);
|
2011-07-16 17:27:21 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmTurnToBackToUse);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-07-16 17:27:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
uint32 Klayman::hmTurnToBackToUse(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-16 17:27:21 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0xC61A0119) {
|
|
|
|
_soundResource1.play(0x402338C2);
|
|
|
|
} else if (param.asInteger() == 0x32180101) {
|
|
|
|
_soundResource1.play(0x4924AAC4);
|
|
|
|
} else if (param.asInteger() == 0x0A2A9098) {
|
|
|
|
_soundResource1.play(0x0A2AA8E0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stClayDoorOpen() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stClayDoorOpen))) {
|
2011-08-31 13:15:55 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x5CCCB330, 0, -1);
|
2011-08-31 13:15:55 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmClayDoorOpen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Klayman::hmClayDoorOpen(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x040D4186) {
|
|
|
|
if (_attachedSprite) {
|
|
|
|
sendMessage(_attachedSprite, 0x4808, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2011-08-31 13:15:55 +00:00
|
|
|
}
|
2011-10-27 11:33:12 +00:00
|
|
|
return messageResult;
|
2011-08-31 13:15:55 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stTurnToUse() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stTurnToUse))) {
|
2011-07-18 18:54:43 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x9B250AD2, 0, -1);
|
2011-07-18 18:54:43 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmTurnToUse);
|
2011-07-18 18:54:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stReturnFromUse() {
|
2011-07-18 18:54:43 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x98F88391, 0, -1);
|
2011-07-18 18:54:43 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmTurnToUse);
|
2011-07-18 18:54:43 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stWalkingOpenDoor() {
|
2011-10-28 10:37:07 +00:00
|
|
|
_isWalkingOpenDoorNotified = false;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x11A8E012, 0, -1);
|
2011-07-18 20:20:23 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::suWalkingOpenDoor);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmStartWalking);
|
2011-07-18 20:20:23 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::suWalkingOpenDoor() {
|
2011-10-28 10:37:07 +00:00
|
|
|
if (!_isWalkingOpenDoorNotified && ABS(_destX - _x) < 80) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x4829, 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
_isWalkingOpenDoorNotified = true;
|
2011-07-18 20:20:23 +00:00
|
|
|
}
|
|
|
|
AnimatedSprite::updateDeltaXY();
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stMoveObjectSkipTurnFaceObject() {
|
|
|
|
setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
_isMoveObjectRequested = false;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimationByHash(0x0C1CA072, 0x01084280, 0);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmMoveObjectTurn);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Klayman::sub420660() {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x4807, 0);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
uint32 Klayman::hmMoveObjectTurn(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-26 08:38:19 +00:00
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x01084280) {
|
|
|
|
if (_attachedSprite)
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x480B, _doDeltaX ? 1 : 0);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else if (param.asInteger() == 0x02421405) {
|
2011-10-28 10:37:07 +00:00
|
|
|
if (_isMoveObjectRequested && sendMessage(_attachedSprite, 0x480C, _doDeltaX ? 1 : 0) != 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
stMoveObjectSkipTurn();
|
2011-07-26 08:38:19 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
FinalizeState(&Klayman::sub420660);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
|
|
|
}
|
|
|
|
} else if (param.asInteger() == 0x32180101) {
|
|
|
|
_soundResource1.play(0x405002D8);
|
|
|
|
} else if (param.asInteger() == 0x0A2A9098) {
|
|
|
|
_soundResource1.play(0x0460E2FA);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x480A:
|
2011-10-28 10:37:07 +00:00
|
|
|
_isMoveObjectRequested = true;
|
2011-07-26 08:38:19 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return handleMessage41D480(messageNum, param, sender);
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stMoveObjectSkipTurn() {
|
2011-10-28 10:37:07 +00:00
|
|
|
_isMoveObjectRequested = false;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimationByHash(0x0C1CA072, 0x01084280, 0);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmMoveObjectTurn);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stMoveObjectFaceObject() {
|
|
|
|
setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stMoveObjectFaceObject))) {
|
2011-07-26 08:38:19 +00:00
|
|
|
_status2 = 2;
|
2011-10-28 10:37:07 +00:00
|
|
|
_isMoveObjectRequested = false;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x0C1CA072, 0, -1);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmMoveObjectTurn);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stUseLever() {
|
|
|
|
if (!stStartAction(AnimationCallback(&Klayman::stUseLever))) {
|
2011-07-27 18:02:30 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isLeverDown) {
|
|
|
|
stUseLeverRelease();
|
2011-07-27 18:02:30 +00:00
|
|
|
} else {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482B, 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x0C303040, 0, -1);
|
2011-07-27 18:02:30 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-07-27 18:02:30 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41E210);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::stPullLeverDown);
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-07-27 18:02:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
// Exactly the same code as sub420DA0 which was removed
|
|
|
|
void Klayman::stPullLeverDown() {
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x0D318140, 0, -1);
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x480F, 0);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::stHoldLeverDown);
|
2011-07-27 18:02:30 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void Klayman::stHoldLeverDown() {
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x4464A440, 0, -1);
|
2011-07-27 18:02:30 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-07-27 18:02:30 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
2011-10-27 11:33:12 +00:00
|
|
|
_isLeverDown = true;
|
|
|
|
_acceptInput = true;
|
2011-07-27 18:02:30 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stUseLeverRelease() {
|
|
|
|
startAnimation(0x09018068, 0, -1);
|
2011-07-27 18:02:30 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-07-27 18:02:30 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41E210);
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x4807, 0);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::stPullLeverDown);
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-07-27 18:02:30 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stReleaseLever() {
|
|
|
|
if (_isLeverDown) {
|
2011-07-27 18:02:30 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x09018068, 0, -1);
|
2011-07-27 18:02:30 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-07-27 18:02:30 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41E210);
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x4807, 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
NextState(&Klayman::stLetGoOfLever);
|
|
|
|
_acceptInput = false;
|
|
|
|
_isLeverDown = false;
|
2011-07-27 18:02:30 +00:00
|
|
|
} else {
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-27 18:02:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stLetGoOfLever() {
|
|
|
|
startAnimation(0x0928C048, 0, -1);
|
|
|
|
FinalizeState(&Klayman::cbLeverReleasedEvent);
|
2011-07-27 18:02:30 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::cbLeverReleasedEvent() {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482A, 0);
|
2011-07-27 18:02:30 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void Klayman::stInsertDisk() {
|
|
|
|
if (!stStartActionFromIdle(AnimationCallback(&Klayman::stInsertDisk))) {
|
2011-07-27 18:02:30 +00:00
|
|
|
_status2 = 2;
|
|
|
|
_counter2 = 0;
|
|
|
|
for (uint32 i = 0; i < 20; i++) {
|
|
|
|
if (getSubVar(0x02038314, i)) {
|
|
|
|
setSubVar(0x02720344, i, 1);
|
|
|
|
setSubVar(0x02038314, i, 0);
|
|
|
|
_counter2++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (_counter2 == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
gotoState(NULL);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-27 18:02:30 +00:00
|
|
|
} else {
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xD8C8D100, 0, -1);
|
2011-07-27 18:02:30 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F250);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&Klayman::hmInsertDisk);
|
|
|
|
_acceptInput = false;
|
2011-07-27 18:02:30 +00:00
|
|
|
_counter2--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
uint32 Klayman::hmInsertDisk(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-27 18:02:30 +00:00
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x06040580) {
|
|
|
|
if (_counter2 == 0) {
|
|
|
|
// TODO: Calc calcHash value somewhere else
|
2011-10-27 11:33:12 +00:00
|
|
|
nextAnimationByHash(0xD8C8D100, calcHash("GoToStartLoop/Finish"), 0);
|
2011-07-27 18:02:30 +00:00
|
|
|
}
|
|
|
|
} else if (_counter2 != 0 && param.asInteger() == calcHash("GoToStartLoop/Finish")) {
|
|
|
|
_counter2--;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimationByHash(0xD8C8D100, 0x01084280, 0);
|
2011-07-27 18:02:30 +00:00
|
|
|
} else if (param.asInteger() == 0x062A1510) {
|
|
|
|
_soundResource1.play(0x41688704);
|
|
|
|
} else if (param.asInteger() == 0x02B20220) {
|
|
|
|
_soundResource1.play(0xC5408620);
|
|
|
|
} else if (param.asInteger() == 0x0A720138) {
|
|
|
|
_soundResource1.play(0xD4C08010);
|
|
|
|
} else if (param.asInteger() == 0xB613A180) {
|
|
|
|
_soundResource1.play(0x44051000);
|
|
|
|
} else if (param.asInteger() == 0x0E040501) {
|
|
|
|
_soundResource1.play(0xC6A129C1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return handleMessage41D480(messageNum, param, sender);
|
|
|
|
}
|
|
|
|
|
2012-08-17 15:03:38 +00:00
|
|
|
void Klayman::walkAlongPathPoints() {
|
|
|
|
if (_x <= (*_pathPoints)[0].x)
|
|
|
|
_y = (*_pathPoints)[0].y;
|
|
|
|
else if (_x >= (*_pathPoints)[_pathPoints->size() - 1].x)
|
|
|
|
_y = (*_pathPoints)[_pathPoints->size() - 1].y;
|
|
|
|
else {
|
|
|
|
int16 deltaX = _x - (*_pathPoints)[0].x, deltaXIncr = 0;
|
|
|
|
uint index = 0;
|
|
|
|
while (deltaX > 0) {
|
|
|
|
NPoint pt2 = (*_pathPoints)[index];
|
|
|
|
NPoint pt1 = index + 1 >= _pathPoints->size() ? (*_pathPoints)[0] : (*_pathPoints)[index + 1];
|
|
|
|
int16 xd = ABS(pt1.x - pt2.x);
|
|
|
|
int16 yd = ABS(pt1.y - pt2.y);
|
|
|
|
if (deltaX + deltaXIncr >= xd) {
|
|
|
|
deltaX -= xd;
|
|
|
|
deltaX += deltaXIncr;
|
|
|
|
++index;
|
|
|
|
if (index >= _pathPoints->size())
|
|
|
|
index = 0;
|
|
|
|
_y = (*_pathPoints)[index].y;
|
|
|
|
} else {
|
|
|
|
deltaXIncr += deltaX;
|
|
|
|
if (pt1.y >= pt2.y) {
|
|
|
|
_y = pt2.y + (yd * deltaXIncr) / xd;
|
|
|
|
} else {
|
|
|
|
_y = pt2.y - (yd * deltaXIncr) / xd;
|
|
|
|
}
|
|
|
|
deltaX = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-13 18:38:40 +00:00
|
|
|
//##############################################################################
|
|
|
|
|
2011-07-11 18:47:03 +00:00
|
|
|
// KmScene1001
|
|
|
|
|
|
|
|
KmScene1001::KmScene1001(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1001::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-07-11 18:47:03 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-07-11 18:47:03 +00:00
|
|
|
break;
|
|
|
|
case 0x4804:
|
2011-10-21 09:13:49 +00:00
|
|
|
if (param.asInteger() == 2)
|
|
|
|
GotoState(&Klayman::stSleeping);
|
2011-07-11 18:47:03 +00:00
|
|
|
break;
|
|
|
|
case 0x480D:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1001::sub44FA50);
|
2011-07-11 18:47:03 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-07-11 18:47:03 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PRESS_BUTTON:
|
2011-07-11 18:47:03 +00:00
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnPressButton);
|
2011-07-11 18:47:03 +00:00
|
|
|
} else if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStampFloorButton);
|
|
|
|
} else {
|
|
|
|
GotoState(&Klayman::stPressButtonSide);
|
2011-07-11 18:47:03 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-11 18:47:03 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
// TODO: It's not really a point but an x1/x2 pair
|
2011-07-18 18:54:43 +00:00
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
2011-07-11 18:47:03 +00:00
|
|
|
} else {
|
2011-07-18 18:54:43 +00:00
|
|
|
sub41CCE0(param.asPoint().x);
|
2011-07-11 18:47:03 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481F:
|
|
|
|
if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutHalf);
|
2011-07-11 18:47:03 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutAfter);
|
2011-07-11 18:47:03 +00:00
|
|
|
} else if (param.asInteger() == 3) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUseHalf);
|
2011-07-11 18:47:03 +00:00
|
|
|
} else if (param.asInteger() == 4) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnAwayFromUse);
|
2011-07-11 18:47:03 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAbout);
|
2011-07-11 18:47:03 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482D:
|
2011-07-26 08:38:19 +00:00
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-11 18:47:03 +00:00
|
|
|
break;
|
|
|
|
case 0x4836:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2002, 0);
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWakeUp);
|
2011-07-11 18:47:03 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-07-11 18:47:03 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-07-11 18:47:03 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1001::sub44FA50() {
|
2011-10-21 09:13:49 +00:00
|
|
|
if (!stStartAction(AnimationCallback(&KmScene1001::sub44FA50))) {
|
2011-07-11 18:47:03 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x00648953, 0, -1);
|
2011-07-11 18:47:03 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&KmScene1001::handleMessage44FA00);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
2011-07-11 18:47:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1001::handleMessage44FA00(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = Klayman::handleMessage41E210(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x4AB28209) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x480F, 0);
|
2011-07-11 18:47:03 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-07-13 18:38:40 +00:00
|
|
|
// KmScene1002
|
|
|
|
|
2011-09-20 09:39:24 +00:00
|
|
|
KmScene1002::KmScene1002(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, Sprite *class599, Sprite *ssLadderArch)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000), _otherSprite(NULL), _class599(class599), _ssLadderArch(ssLadderArch),
|
2011-07-13 18:38:40 +00:00
|
|
|
_status(0) {
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
setKlaymanIdleTable1();
|
2011-07-13 18:38:40 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1002::xUpdate() {
|
|
|
|
if (_x >= 250 && _x <= 435 && _y >= 420) {
|
|
|
|
if (_status == 0) {
|
2011-10-27 11:33:12 +00:00
|
|
|
// TODO setKlaymanIdleTable(stru_4B44C8);
|
2011-07-13 18:38:40 +00:00
|
|
|
_status = 1;
|
|
|
|
}
|
|
|
|
} else if (_status == 1) {
|
2011-10-27 11:33:12 +00:00
|
|
|
setKlaymanIdleTable1();
|
2011-07-13 18:38:40 +00:00
|
|
|
_status = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x2001:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1002::sub449E90);
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
case 0x2007:
|
|
|
|
_otherSprite = (Sprite*)param.asEntity();
|
|
|
|
break;
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
case 0x4803:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1002::stJumpAndFall);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1002::stDropFromRing);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4804:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPeekWall);
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
case 0x4805:
|
|
|
|
switch (param.asInteger()) {
|
|
|
|
case 1:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stJumpToRing1);
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stJumpToRing2);
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stJumpToRing3);
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stJumpToRing4);
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x480A:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1002::stMoveVenusFlyTrap);
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
case 0x480D:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1002::sub449E20);
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PRESS_BUTTON:
|
2011-07-13 18:38:40 +00:00
|
|
|
if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1002::stPressDoorButton);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
sub41CCE0(param.asInteger());
|
|
|
|
break;
|
|
|
|
case 0x4820:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2005, 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stContinueClimbLadderUp);
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
case 0x4821:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2005, 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
_destY = param.asInteger();
|
|
|
|
GotoState(&Klayman::stStartClimbLadderDown);
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
case 0x4822:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2005, 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
_destY = param.asInteger();
|
|
|
|
GotoState(&Klayman::stStartClimbLadderUp);
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
case 0x4823:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2006, 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
GotoState(&Klayman::stClimbLadderHalf);
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
case 0x482E:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stWalkToFrontNoStep);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stWalkToFront);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482F:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stTurnToFront);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stTurnToBack);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-07-13 18:38:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1002::update4497D0() {
|
|
|
|
Klayman::update();
|
|
|
|
if (_counter1 != 0 && (--_counter1 == 0)) {
|
|
|
|
_surface->setVisible(true);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1002::handleMessage449800(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x168050A0) {
|
|
|
|
if (_attachedSprite) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x480F, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
} else if (param.asInteger() == 0x586B0300) {
|
|
|
|
if (_otherSprite) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_otherSprite, 0x480E, 1);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
} else if (param.asInteger() == 0x4AB28209) {
|
|
|
|
if (_attachedSprite) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482A, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
} else if (param.asInteger() == 0x88001184) {
|
|
|
|
if (_attachedSprite) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482B, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1002::handleMessage4498E0(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4811:
|
|
|
|
_soundResource1.play(0x5252A0E4);
|
|
|
|
setDoDeltaX(((Sprite*)sender)->isDoDeltaX() ? 1 : 0);
|
|
|
|
if (_doDeltaX) {
|
|
|
|
_x = ((Sprite*)sender)->getX() - 75;
|
|
|
|
} else {
|
|
|
|
_x = ((Sprite*)sender)->getX() + 75;
|
|
|
|
}
|
|
|
|
_y = ((Sprite*)sender)->getY() - 200;
|
|
|
|
if (param.asInteger() == 0) {
|
|
|
|
sub449EF0();
|
|
|
|
} else if (param.asInteger() == 1) {
|
|
|
|
sub44A0D0();
|
|
|
|
} else if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
stSpitOutFall();
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
uint32 KmScene1002::hmPressDoorButton(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-13 18:38:40 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x942D2081) {
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x2003, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 0xDA600012) {
|
2011-10-21 09:13:49 +00:00
|
|
|
stHitByBoxingGlove();
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 0x0D01B294) {
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x480B, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
uint32 KmScene1002::hmMoveVenusFlyTrap(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-13 18:38:40 +00:00
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x01084280) {
|
2011-10-28 10:37:07 +00:00
|
|
|
sendMessage(_attachedSprite, 0x480B, (uint32)_doDeltaX);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 0x02421405) {
|
2011-10-28 10:37:07 +00:00
|
|
|
if (_isMoveObjectRequested) {
|
|
|
|
if (sendMessage(_attachedSprite, 0x480C, (uint32)_doDeltaX) != 0)
|
|
|
|
stContinueMovingVenusFlyTrap();
|
2011-07-13 18:38:40 +00:00
|
|
|
} else {
|
2011-10-28 10:37:07 +00:00
|
|
|
SetMessageHandler(&KmScene1002::hmFirstMoveVenusFlyTrap);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
} else if (param.asInteger() == 0x4AB28209) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482A, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 0x88001184) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482B, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 0x32180101) {
|
|
|
|
_soundResource1.play(0x405002D8);
|
|
|
|
} else if (param.asInteger() == 0x0A2A9098) {
|
|
|
|
_soundResource1.play(0x0460E2FA);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x480A:
|
2011-10-28 10:37:07 +00:00
|
|
|
_isMoveObjectRequested = true;
|
2011-07-13 18:38:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return handleMessage41D480(messageNum, param, sender);
|
|
|
|
}
|
|
|
|
|
2011-10-28 10:37:07 +00:00
|
|
|
uint32 KmScene1002::hmFirstMoveVenusFlyTrap(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-13 18:38:40 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x4AB28209) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482A, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 0x88001184) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482B, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
} else if (param.asInteger() == 0x32180101) {
|
|
|
|
_soundResource1.play(0x405002D8);
|
|
|
|
} else if (param.asInteger() == 0x0A2A9098) {
|
|
|
|
_soundResource1.play(0x0460E2FA);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1002::handleMessage449C90(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-09-16 20:37:24 +00:00
|
|
|
int16 speedUpFrameIndex;
|
2011-07-13 18:38:40 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x1008:
|
2011-09-16 20:37:24 +00:00
|
|
|
speedUpFrameIndex = getFrameIndex(kKlaymanSpeedUpHash);
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_currFrameIndex < speedUpFrameIndex) {
|
|
|
|
startAnimation(0x35AA8059, speedUpFrameIndex, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
_y = 435;
|
|
|
|
}
|
|
|
|
messageResult = 0;
|
|
|
|
break;
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x1A1A0785) {
|
|
|
|
_soundResource1.play(0x40F0A342);
|
|
|
|
} else if (param.asInteger() == 0x60428026) {
|
|
|
|
_soundResource1.play(0x40608A59);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1002::handleMessage449D60(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D360(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x1307050A) {
|
|
|
|
_soundResource1.play(0x40428A09);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1002::suFallDown() {
|
2011-07-13 18:38:40 +00:00
|
|
|
AnimatedSprite::updateDeltaXY();
|
|
|
|
HitRect *hitRect = _vm->_collisionMan->findHitRectAtPos(_x, _y + 10);
|
|
|
|
if (hitRect->type == 0x5001) {
|
|
|
|
_y = hitRect->rect.y1;
|
|
|
|
processDelta();
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(this, 0x1019, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
_vm->_collisionMan->checkCollision(this, 0xFFFF, 0x4810, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1002::sub449E20() {
|
2011-10-21 09:13:49 +00:00
|
|
|
if (!stStartAction(AnimationCallback(&KmScene1002::sub449E20))) {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x584984B4, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetMessageHandler(&KmScene1002::handleMessage449800);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::stLandOnFeet);
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482B, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1002::sub449E90() {
|
|
|
|
_soundResource1.play(0x56548280);
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-07-13 18:38:40 +00:00
|
|
|
_surface->setVisible(false);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x5420E254, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetMessageHandler(&KmScene1002::handleMessage4498E0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1002::sub449EF0() {
|
|
|
|
_counter1 = 1;
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x000BAB02, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&KmScene1002::update4497D0);
|
|
|
|
// Weird stuff happening
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
|
|
|
//SetMessageHandler(&Klayman::handleMessage41D480);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&KmScene1002::suFallDown);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&KmScene1002::sub449F70);
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_class599, 0x482A, 0);
|
|
|
|
sendMessage(_ssLadderArch, 0x482A, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1002::sub449F70() {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x1024, 1);
|
2011-07-13 18:38:40 +00:00
|
|
|
_soundResource1.play(0x41648271);
|
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-10-28 10:37:07 +00:00
|
|
|
_isWalking = false;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimationByHash(0x000BAB02, 0x88003000, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetMessageHandler(&KmScene1002::handleMessage41D480);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&KmScene1002::sub44A230);
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2002, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
// TODO _callbackList = NULL;
|
|
|
|
_attachedSprite = NULL;
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_class599, 0x482B, 0);
|
|
|
|
sendMessage(_ssLadderArch, 0x482B, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1002::stSpitOutFall() {
|
2011-07-13 18:38:40 +00:00
|
|
|
_counter1 = 1;
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x9308C132, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&KmScene1002::update4497D0);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&KmScene1002::suFallDown);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&KmScene1002::sub449F70);
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_class599, 0x482A, 0);
|
|
|
|
sendMessage(_ssLadderArch, 0x482A, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1002::sub44A0D0() {
|
|
|
|
_counter1 = 1;
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x0013A206, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&KmScene1002::update4497D0);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&KmScene1002::suFallDown);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&KmScene1002::sub44A150);
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_class599, 0x482A, 0);
|
|
|
|
sendMessage(_ssLadderArch, 0x482A, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1002::sub44A150() {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x1024, 1);
|
2011-07-13 18:38:40 +00:00
|
|
|
_soundResource1.play(0x41648271);
|
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-10-28 10:37:07 +00:00
|
|
|
_isWalking = false;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimationByHash(0x0013A206, 0x88003000, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&KmScene1002::handleMessage41D480);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&KmScene1002::sub44A230);
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2002, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
// TODO _callbackList = NULL;
|
|
|
|
_attachedSprite = NULL;
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_class599, 0x482B, 0);
|
|
|
|
sendMessage(_ssLadderArch, 0x482B, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1002::sub44A230() {
|
|
|
|
setDoDeltaX(2);
|
2011-10-21 09:13:49 +00:00
|
|
|
stTryStandIdle();
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1002::stJumpAndFall() {
|
|
|
|
if (!stStartAction(AnimationCallback(&KmScene1002::stJumpAndFall))) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x1024, 3);
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0xB93AB151, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&KmScene1002::handleMessage449D60);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&KmScene1002::suFallDown);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::stLandOnFeet);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1002::stDropFromRing() {
|
2011-07-13 18:38:40 +00:00
|
|
|
if (_attachedSprite) {
|
2011-10-21 09:13:49 +00:00
|
|
|
_x = _attachedSprite->getX();
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x4807, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
_attachedSprite = NULL;
|
|
|
|
}
|
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x586984B1, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&KmScene1002::handleMessage41D360);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&KmScene1002::suFallDown);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::stLandOnFeet);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1002::stPressDoorButton() {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
2011-07-13 18:38:40 +00:00
|
|
|
setDoDeltaX(0);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x1CD89029, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&KmScene1002::hmPressDoorButton);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F250);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1002::stHitByBoxingGlove() {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x35AA8059, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&KmScene1002::handleMessage449C90);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
2011-10-21 09:13:49 +00:00
|
|
|
FinalizeState(&KmScene1002::stHitByBoxingGloveDone);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1002::stHitByBoxingGloveDone() {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x1024, 1);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1002::stMoveVenusFlyTrap() {
|
|
|
|
if (!stStartAction(AnimationCallback(&KmScene1002::stMoveVenusFlyTrap))) {
|
2011-07-13 18:38:40 +00:00
|
|
|
_status2 = 2;
|
2011-10-28 10:37:07 +00:00
|
|
|
_isMoveObjectRequested = false;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
2011-10-21 09:13:49 +00:00
|
|
|
setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x5C01A870, 0, -1);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&KmScene1002::hmMoveVenusFlyTrap);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
2011-10-21 09:13:49 +00:00
|
|
|
FinalizeState(&KmScene1002::stMoveVenusFlyTrapDone);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1002::stContinueMovingVenusFlyTrap() {
|
2011-10-28 10:37:07 +00:00
|
|
|
_isMoveObjectRequested = false;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimationByHash(0x5C01A870, 0x01084280, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&KmScene1002::hmMoveVenusFlyTrap);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
2011-10-21 09:13:49 +00:00
|
|
|
FinalizeState(&KmScene1002::stMoveVenusFlyTrapDone);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1002::stMoveVenusFlyTrapDone() {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x482A, 0);
|
2011-07-13 18:38:40 +00:00
|
|
|
}
|
2011-07-11 18:47:03 +00:00
|
|
|
|
2011-07-16 17:27:21 +00:00
|
|
|
// KmScene1004
|
|
|
|
|
|
|
|
KmScene1004::KmScene1004(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
|
|
|
|
_dataResource.load(0x01900A04);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1004::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-07-16 17:27:21 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-07-16 17:27:21 +00:00
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-16 17:27:21 +00:00
|
|
|
break;
|
|
|
|
case 0x4818:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(_dataResource.getPoint(param.asInteger()).x, false);
|
2011-07-16 17:27:21 +00:00
|
|
|
break;
|
|
|
|
case 0x481E:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1004::stReadNote);
|
2011-07-16 17:27:21 +00:00
|
|
|
break;
|
|
|
|
case 0x4820:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2000, 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stContinueClimbLadderUp);
|
2011-07-16 17:27:21 +00:00
|
|
|
break;
|
|
|
|
case 0x4821:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2000, 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
_destY = param.asInteger();
|
|
|
|
GotoState(&Klayman::stStartClimbLadderDown);
|
2011-07-16 17:27:21 +00:00
|
|
|
break;
|
|
|
|
case 0x4822:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2000, 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
_destY = param.asInteger();
|
|
|
|
GotoState(&Klayman::stStartClimbLadderUp);
|
2011-07-16 17:27:21 +00:00
|
|
|
break;
|
|
|
|
case 0x4823:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2001, 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
GotoState(&Klayman::stClimbLadderHalf);
|
2011-07-16 17:27:21 +00:00
|
|
|
break;
|
|
|
|
case 0x4824:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2000, 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
_destY = _dataResource.getPoint(param.asInteger()).y;
|
|
|
|
GotoState(&Klayman::stStartClimbLadderDown);
|
2011-07-16 17:27:21 +00:00
|
|
|
break;
|
|
|
|
case 0x4825:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2000, 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
_destY = _dataResource.getPoint(param.asInteger()).y;
|
|
|
|
GotoState(&Klayman::stStartClimbLadderUp);
|
2011-07-16 17:27:21 +00:00
|
|
|
break;
|
|
|
|
case 0x4828:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stTurnToBackToUse);
|
2011-07-16 17:27:21 +00:00
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-07-16 17:27:21 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-07-16 17:27:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
uint32 KmScene1004::hmReadNote(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-16 17:27:21 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x04684052) {
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2002, 0);
|
2011-07-16 17:27:21 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1004::stReadNote() {
|
2011-07-16 17:27:21 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x123E9C9F, 0, -1);
|
2011-07-16 17:27:21 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&KmScene1004::hmReadNote);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
2011-07-16 17:27:21 +00:00
|
|
|
}
|
|
|
|
|
2011-09-21 08:45:32 +00:00
|
|
|
KmScene1109::KmScene1109(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
2011-10-27 11:33:12 +00:00
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000), _isSittingInTeleporter(false) {
|
2011-09-21 08:45:32 +00:00
|
|
|
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x2000:
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = param.asInteger() != 0;
|
2011-09-21 08:45:32 +00:00
|
|
|
break;
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-09-21 08:45:32 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter)
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub421350);
|
2011-09-21 08:45:32 +00:00
|
|
|
else
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-09-21 08:45:32 +00:00
|
|
|
break;
|
|
|
|
case 0x4804:
|
|
|
|
if (param.asInteger() != 0) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = param.asInteger();
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWalking);
|
2011-09-21 08:45:32 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPeekWall);
|
2011-09-21 08:45:32 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-21 08:45:32 +00:00
|
|
|
break;
|
|
|
|
case 0x481D:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter)
|
|
|
|
GotoState(&Klayman::stTurnToUseInTeleporter);
|
2011-09-21 08:45:32 +00:00
|
|
|
break;
|
|
|
|
case 0x481E:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter)//CHECKME
|
|
|
|
GotoState(&Klayman::stReturnFromUseInTeleporter);
|
2011-09-21 08:45:32 +00:00
|
|
|
break;
|
|
|
|
case 0x4834:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStepOver);
|
2011-09-21 08:45:32 +00:00
|
|
|
break;
|
|
|
|
case 0x4835:
|
|
|
|
sendMessage(_parentScene, 0x2000, 1);
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = true;
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stSitInTeleporter);
|
2011-09-21 08:45:32 +00:00
|
|
|
break;
|
|
|
|
case 0x4836:
|
|
|
|
sendMessage(_parentScene, 0x2000, 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = false;
|
|
|
|
GotoState(&Klayman::stGetUpFromTeleporter);
|
2011-09-21 08:45:32 +00:00
|
|
|
break;
|
|
|
|
case 0x483D:
|
|
|
|
sub461F30();
|
|
|
|
break;
|
|
|
|
case 0x483E:
|
|
|
|
sub461F70();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1109::handleMessage461EA0(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = Klayman::handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x4E0A2C24) {
|
|
|
|
_soundResource1.play(0x85B10BB8);
|
|
|
|
} else if (param.asInteger() == 0x4E6A0CA0) {
|
|
|
|
_soundResource1.play(0xC5B709B0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1109::sub461F30() {
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-09-21 08:45:32 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-09-21 08:45:32 +00:00
|
|
|
SetMessageHandler(&KmScene1109::handleMessage461EA0);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x2C2A4A1C, 0, -1);
|
2011-09-21 08:45:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1109::sub461F70() {
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-09-21 08:45:32 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-09-21 08:45:32 +00:00
|
|
|
SetMessageHandler(&KmScene1109::handleMessage461EA0);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x3C2E4245, 0, -1);
|
2011-09-21 08:45:32 +00:00
|
|
|
}
|
|
|
|
|
2011-07-18 18:54:43 +00:00
|
|
|
// KmScene1201
|
|
|
|
|
2011-09-20 09:39:24 +00:00
|
|
|
KmScene1201::KmScene1201(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, Entity *class464)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000), _class464(class464), _countdown(0) {
|
2011-07-18 18:54:43 +00:00
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
// TODO setKlaymanIdleTable(dword_4AEF10, 3);
|
2011-07-18 18:54:43 +00:00
|
|
|
_flagF6 = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1201::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-07-18 18:54:43 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-07-18 18:54:43 +00:00
|
|
|
break;
|
|
|
|
case 0x480A:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&KmScene1201::stMoveObject);
|
2011-07-18 18:54:43 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-07-18 18:54:43 +00:00
|
|
|
break;
|
|
|
|
case 0x4813:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1201::stFetchMatch);
|
2011-07-18 18:54:43 +00:00
|
|
|
break;
|
|
|
|
case 0x4814:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1201::stTumbleHeadless);
|
2011-07-18 18:54:43 +00:00
|
|
|
break;
|
|
|
|
case 0x4815:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1201::sub40E040);
|
2011-07-18 18:54:43 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PRESS_BUTTON:
|
2011-07-18 18:54:43 +00:00
|
|
|
if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPressButtonSide);
|
2011-07-18 18:54:43 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
2011-07-26 08:38:19 +00:00
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-18 18:54:43 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481D:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUse);
|
2011-07-18 18:54:43 +00:00
|
|
|
break;
|
|
|
|
case 0x481E:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stReturnFromUse);
|
2011-07-18 18:54:43 +00:00
|
|
|
break;
|
|
|
|
case 0x481F:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAbout);
|
2011-07-18 18:54:43 +00:00
|
|
|
break;
|
|
|
|
case 0x482D:
|
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-18 18:54:43 +00:00
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-07-18 18:54:43 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-07-18 18:54:43 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1201::update40DBE0() {
|
|
|
|
if (_x >= 380)
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-18 18:54:43 +00:00
|
|
|
Klayman::update();
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
uint32 KmScene1201::hmMatch(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-18 18:54:43 +00:00
|
|
|
uint32 messageResult = Klayman::handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x51281850) {
|
|
|
|
setGlobalVar(0x20A0C516, 1);
|
|
|
|
} else if (param.asInteger() == 0x43000538) {
|
|
|
|
_soundResource1.play(0x21043059);
|
|
|
|
} else if (param.asInteger() == 0x02B20220) {
|
|
|
|
_soundResource1.play(0xC5408620);
|
|
|
|
} else if (param.asInteger() == 0x0A720138) {
|
|
|
|
_soundResource1.play(0xD4C08010);
|
|
|
|
} else if (param.asInteger() == 0xB613A180) {
|
|
|
|
_soundResource1.play(0x44051000);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1201::stFetchMatch() {
|
|
|
|
if (!stStartAction(AnimationCallback(&KmScene1201::stFetchMatch))) {
|
2011-07-18 18:54:43 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-10-21 09:13:49 +00:00
|
|
|
setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x9CAA0218, 0, -1);
|
2011-07-18 18:54:43 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&KmScene1201::hmMatch);
|
|
|
|
NextState(&KmScene1201::stLightMatch);
|
2011-07-18 18:54:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1201::stLightMatch() {
|
2011-07-18 18:54:43 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-10-21 09:13:49 +00:00
|
|
|
setDoDeltaX(_attachedSprite->getX() < _x ? 1 : 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x1222A513, 0, -1);
|
2011-07-18 18:54:43 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&KmScene1201::hmMatch);
|
2011-07-18 18:54:43 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
uint32 KmScene1201::hmMoveObject(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-18 18:54:43 +00:00
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x01084280) {
|
|
|
|
_soundResource1.play(0x405002D8);
|
|
|
|
if (_attachedSprite) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x480B, 0);
|
2011-07-18 18:54:43 +00:00
|
|
|
}
|
|
|
|
} else if (param.asInteger() == 0x02421405) {
|
|
|
|
if (_countdown != 0) {
|
|
|
|
_countdown--;
|
2011-10-21 09:13:49 +00:00
|
|
|
stMoveObjectSkipTurn();
|
2011-07-18 18:54:43 +00:00
|
|
|
} else {
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return Klayman::handleMessage41D480(messageNum, param, sender);
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
uint32 KmScene1201::hmTumbleHeadless(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-07-18 18:54:43 +00:00
|
|
|
uint32 messageResult = Klayman::handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x000F0082) {
|
|
|
|
_soundResource1.play(0x74E2810F);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
void KmScene1201::stMoveObject() {
|
|
|
|
if (!stStartAction(AnimationCallback(&KmScene1201::stMoveObject))) {
|
2011-07-18 18:54:43 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-07-18 18:54:43 +00:00
|
|
|
_countdown = 8;
|
|
|
|
setDoDeltaX(0);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x0C1CA072, 0, -1);
|
2011-07-18 18:54:43 +00:00
|
|
|
SetUpdateHandler(&KmScene1201::update40DBE0);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&KmScene1201::hmMoveObject);
|
2011-07-18 18:54:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1201::stMoveObjectSkipTurn() {
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimationByHash(0x0C1CA072, 0x01084280, 0);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetUpdateHandler(&KmScene1201::update40DBE0);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
2011-10-27 11:33:12 +00:00
|
|
|
SetMessageHandler(&KmScene1201::hmMoveObject);
|
2011-07-18 18:54:43 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1201::stTumbleHeadless() {
|
|
|
|
if (!stStartActionFromIdle(AnimationCallback(&KmScene1201::stTumbleHeadless))) {
|
2011-07-18 18:54:43 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-07-18 18:54:43 +00:00
|
|
|
setDoDeltaX(0);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x2821C590, 0, -1);
|
2011-07-18 18:54:43 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&KmScene1201::hmTumbleHeadless);
|
|
|
|
NextState(&Klayman::stTryStandIdle);
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_class464, 0x2006, 0);
|
2011-07-18 18:54:43 +00:00
|
|
|
_soundResource1.play(0x62E0A356);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1201::sub40E040() {
|
2011-10-21 09:13:49 +00:00
|
|
|
if (!stStartActionFromIdle(AnimationCallback(&KmScene1201::sub40E040))) {
|
2011-07-18 18:54:43 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x5420E254, 0, -1);
|
2011-07-18 18:54:43 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-18 18:54:43 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-13 15:07:48 +00:00
|
|
|
KmScene1303::KmScene1303(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1303::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4804:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1303::stPeekWall1);
|
2011-09-13 15:07:48 +00:00
|
|
|
break;
|
|
|
|
case 0x483B:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1303::stPeekWallReturn);
|
2011-09-13 15:07:48 +00:00
|
|
|
break;
|
|
|
|
case 0x483C:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1303::stPeekWall2);
|
2011-09-13 15:07:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
uint32 KmScene1303::hmPeekWallReturn(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-09-13 15:07:48 +00:00
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == calcHash("PopBalloon")) {
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2000, 0);
|
2011-09-13 15:07:48 +00:00
|
|
|
} else if (param.asInteger() == 0x02B20220) {
|
|
|
|
_soundResource1.play(0xC5408620);
|
|
|
|
} else if (param.asInteger() == 0x0A720138) {
|
|
|
|
_soundResource1.play(0xD4C08010);
|
|
|
|
} else if (param.asInteger() == 0xB613A180) {
|
|
|
|
_soundResource1.play(0x44051000);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1303::update4161A0() {
|
|
|
|
Klayman::update();
|
|
|
|
_counter3++;
|
|
|
|
if (_counter3 >= _counter3Max)
|
2011-10-21 09:13:49 +00:00
|
|
|
stPeekWall3();
|
2011-09-13 15:07:48 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1303::stPeekWall1() {
|
2011-09-13 15:07:48 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0xAC20C012, 8, 37);
|
2011-09-13 15:07:48 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-09-13 15:07:48 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&KmScene1303::stPeekWall3);
|
2011-09-13 15:07:48 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1303::stPeekWall2() {
|
2011-09-13 15:07:48 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0xAC20C012, 43, 49);
|
2011-09-13 15:07:48 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-09-13 15:07:48 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1303::stPeekWall3() {
|
2011-09-13 15:07:48 +00:00
|
|
|
_counter3 = 0;
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
2011-09-13 15:07:48 +00:00
|
|
|
_counter3Max = _vm->_rnd->getRandomNumber(64) + 24;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xAC20C012, 38, 42);
|
2011-09-13 15:07:48 +00:00
|
|
|
SetUpdateHandler(&KmScene1303::update4161A0);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-09-13 15:07:48 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
2011-10-27 11:33:12 +00:00
|
|
|
_newStickFrameIndex = 42;
|
2011-09-13 15:07:48 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1303::stPeekWallReturn() {
|
2011-09-13 15:07:48 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x2426932E, 0, -1);
|
2011-09-13 15:07:48 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-10-21 09:13:49 +00:00
|
|
|
SetMessageHandler(&KmScene1303::hmPeekWallReturn);
|
2011-09-13 15:07:48 +00:00
|
|
|
}
|
|
|
|
|
2011-09-14 08:51:24 +00:00
|
|
|
KmScene1304::KmScene1304(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
|
2011-09-14 09:18:53 +00:00
|
|
|
// Empty
|
2011-09-14 08:51:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1304::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-09-14 08:51:24 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-09-14 08:51:24 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-09-14 08:51:24 +00:00
|
|
|
if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpNeedle);
|
2011-09-14 08:51:24 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub41FFF0);
|
2011-09-14 08:51:24 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-09-14 08:51:24 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-14 08:51:24 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481F:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnAwayFromUse);
|
2011-09-14 08:51:24 +00:00
|
|
|
} else if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUseHalf);
|
2011-09-14 08:51:24 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAbout);
|
2011-09-14 08:51:24 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-09-14 08:51:24 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-09-14 08:51:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-09-14 09:18:53 +00:00
|
|
|
KmScene1305::KmScene1305(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1305::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-09-14 09:18:53 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-09-14 09:18:53 +00:00
|
|
|
break;
|
|
|
|
case 0x4804:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1305::stCrashDown);
|
2011-09-14 09:18:53 +00:00
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-14 09:18:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1305::stCrashDown() {
|
2011-09-14 09:18:53 +00:00
|
|
|
_soundResource1.play(0x41648271);
|
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimationByHash(0x000BAB02, 0x88003000, 0);
|
2011-09-14 09:18:53 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-09-14 09:18:53 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41D480);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&KmScene1305::cbCrashDownEvent);
|
2011-09-14 09:18:53 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1305::cbCrashDownEvent() {
|
2011-09-14 09:18:53 +00:00
|
|
|
setDoDeltaX(2);
|
2011-10-21 09:13:49 +00:00
|
|
|
stTryStandIdle();
|
2011-09-14 09:18:53 +00:00
|
|
|
}
|
|
|
|
|
2011-09-14 13:16:51 +00:00
|
|
|
KmScene1306::KmScene1306(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = false;
|
2011-09-14 13:16:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
uint32 messageResult = 0;
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x2000:
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = param.asInteger() != 0;
|
2011-09-14 13:16:51 +00:00
|
|
|
break;
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-09-14 13:16:51 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter)
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub421350);
|
2011-09-14 13:16:51 +00:00
|
|
|
else
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-09-14 13:16:51 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-09-14 13:16:51 +00:00
|
|
|
if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpNeedle);
|
2011-09-14 13:16:51 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub41FFF0);
|
2011-09-14 13:16:51 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-09-14 13:16:51 +00:00
|
|
|
}
|
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PRESS_BUTTON:
|
2011-09-14 13:16:51 +00:00
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnPressButton);
|
2011-09-14 13:16:51 +00:00
|
|
|
} else if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStampFloorButton);
|
2011-09-14 13:16:51 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPressButtonSide);
|
2011-09-14 13:16:51 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-14 13:16:51 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_INSERT_DISK:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stInsertDisk);
|
2011-09-14 13:16:51 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481D:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter)
|
|
|
|
GotoState(&Klayman::stTurnToUseInTeleporter);
|
2011-09-14 13:16:51 +00:00
|
|
|
else
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUse);
|
2011-09-14 13:16:51 +00:00
|
|
|
break;
|
|
|
|
case 0x481E:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter)
|
|
|
|
GotoState(&Klayman::stReturnFromUseInTeleporter);
|
2011-09-14 13:16:51 +00:00
|
|
|
else
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stReturnFromUse);
|
2011-09-14 13:16:51 +00:00
|
|
|
break;
|
|
|
|
case 0x481F:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutAfter);
|
2011-09-14 13:16:51 +00:00
|
|
|
} else if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutHalf);
|
2011-09-14 13:16:51 +00:00
|
|
|
} else if (param.asInteger() == 4) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnAwayFromUse);
|
2011-09-14 13:16:51 +00:00
|
|
|
} else if (param.asInteger() == 3) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUseHalf);
|
2011-09-14 13:16:51 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAbout);
|
2011-09-14 13:16:51 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482D:
|
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-14 13:16:51 +00:00
|
|
|
break;
|
|
|
|
case 0x482E:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stWalkToFrontNoStep);
|
2011-09-14 13:16:51 +00:00
|
|
|
} else {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stWalkToFront);
|
2011-09-14 13:16:51 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482F:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stTurnToFront);
|
2011-09-14 13:16:51 +00:00
|
|
|
} else {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stTurnToBack);
|
2011-09-14 13:16:51 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4834:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStepOver);
|
2011-09-14 13:16:51 +00:00
|
|
|
break;
|
|
|
|
case 0x4835:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2000, 1);
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = true;
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stSitInTeleporter);
|
2011-09-14 13:16:51 +00:00
|
|
|
break;
|
|
|
|
case 0x4836:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2000, 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = false;
|
|
|
|
GotoState(&Klayman::stGetUpFromTeleporter);
|
2011-09-14 13:16:51 +00:00
|
|
|
break;
|
|
|
|
case 0x483D:
|
|
|
|
sub417D40();
|
|
|
|
break;
|
|
|
|
case 0x483E:
|
|
|
|
sub417D80();
|
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-09-14 13:16:51 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-09-14 13:16:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1306::sub417D40() {
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0xEE084A04, 0, -1);
|
2011-09-14 13:16:51 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-09-14 13:16:51 +00:00
|
|
|
SetMessageHandler(&KmScene1306::handleMessage417CB0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1306::sub417D80() {
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0xB86A4274, 0, -1);
|
2011-09-14 13:16:51 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-09-14 13:16:51 +00:00
|
|
|
SetMessageHandler(&KmScene1306::handleMessage417CB0);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1306::handleMessage417CB0(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x4E0A2C24) {
|
|
|
|
_soundResource1.play(0x85B10BB8);
|
|
|
|
} else if (param.asInteger() == 0x4E6A0CA0) {
|
|
|
|
_soundResource1.play(0xC5B709B0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2011-09-15 11:48:51 +00:00
|
|
|
KmScene1308::KmScene1308(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
2011-10-27 11:33:12 +00:00
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000), _flag1(false) {
|
|
|
|
|
|
|
|
// Empty
|
2011-09-15 11:48:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-09-15 11:48:51 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-09-15 11:48:51 +00:00
|
|
|
break;
|
|
|
|
case 0x480A:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stMoveObjectSkipTurnFaceObject);
|
2011-09-15 11:48:51 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stMoveObjectFaceObject);
|
2011-09-15 11:48:51 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x480D:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&KmScene1001::stUseLever);
|
2011-09-15 11:48:51 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-09-15 11:48:51 +00:00
|
|
|
if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpNeedle);
|
2011-09-15 11:48:51 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub41FFF0);
|
2011-09-15 11:48:51 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-09-15 11:48:51 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-15 11:48:51 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_INSERT_DISK:
|
2011-09-15 11:48:51 +00:00
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1308::sub456150);
|
2011-09-15 11:48:51 +00:00
|
|
|
} else {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stInsertDisk);
|
2011-09-15 11:48:51 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481D:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUse);
|
2011-09-15 11:48:51 +00:00
|
|
|
break;
|
|
|
|
case 0x481E:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stReturnFromUse);
|
2011-09-15 11:48:51 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_RELEASE_LEVER:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stReleaseLever);
|
2011-09-15 11:48:51 +00:00
|
|
|
break;
|
|
|
|
case 0x4834:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStepOver);
|
2011-09-15 11:48:51 +00:00
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-09-15 11:48:51 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-09-15 11:48:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1308::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = Klayman::handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (!_flag1 && param.asInteger() == 0x06040580) {
|
2011-10-27 11:33:12 +00:00
|
|
|
nextAnimationByHash(0xDC409440, 0x46431401, 0);
|
2011-09-15 11:48:51 +00:00
|
|
|
} else if (_flag1 && param.asInteger() == 0x46431401) {
|
|
|
|
_flag1 = false;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimationByHash(0xDC409440, 0x01084280, 0);
|
2011-09-15 11:48:51 +00:00
|
|
|
} else if (param.asInteger() == 0x062A1510) {
|
|
|
|
_soundResource1.play(0x41688704);
|
|
|
|
} else if (param.asInteger() == 0x02B20220) {
|
|
|
|
_soundResource1.play(0xC5408620);
|
|
|
|
} else if (param.asInteger() == 0x0A720138) {
|
|
|
|
_soundResource1.play(0xD4C08010);
|
|
|
|
} else if (param.asInteger() == 0xB613A180) {
|
|
|
|
_soundResource1.play(0x44051000);
|
|
|
|
} else if (param.asInteger() == 0x0E4C8141) {
|
|
|
|
_soundResource1.play(0xDC4A1280);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1308::sub456150() {
|
2011-10-21 09:13:49 +00:00
|
|
|
if (!stStartActionFromIdle(AnimationCallback(&KmScene1308::sub456150))) {
|
2011-09-15 11:48:51 +00:00
|
|
|
_status2 = 2;
|
|
|
|
_flag1 = false;
|
|
|
|
for (uint i = 0; i < 3; i++) {
|
|
|
|
if (getSubVar(0x0090EA95, i)) {
|
|
|
|
bool more;
|
|
|
|
setSubVar(0x08D0AB11, i, 1);
|
|
|
|
setSubVar(0x0090EA95, i, 0);
|
|
|
|
do {
|
|
|
|
more = false;
|
|
|
|
setSubVar(0xA010B810, i, _vm->_rnd->getRandomNumber(16 - 1));
|
|
|
|
for (uint j = 0; j < i && !more; j++) {
|
|
|
|
if (getSubVar(0x08D0AB11, j) && getSubVar(0xA010B810, j) == getSubVar(0xA010B810, i))
|
|
|
|
more = true;
|
|
|
|
}
|
|
|
|
if (getSubVar(0xA010B810, i) == getSubVar(0x0C10A000, i))
|
|
|
|
more = true;
|
|
|
|
} while (more);
|
|
|
|
_flag1 = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!_flag1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
gotoState(NULL);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-15 11:48:51 +00:00
|
|
|
} else {
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0xDC409440, 0, -1);
|
2011-09-15 11:48:51 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F250);
|
2011-09-15 11:48:51 +00:00
|
|
|
SetMessageHandler(&KmScene1308::handleMessage);
|
|
|
|
_flag1 = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-26 08:38:19 +00:00
|
|
|
// KmScene1401
|
|
|
|
|
|
|
|
KmScene1401::KmScene1401(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1401::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
|
|
|
case 0x480A:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stMoveObjectSkipTurnFaceObject);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stMoveObjectFaceObject);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PRESS_BUTTON:
|
2011-07-26 08:38:19 +00:00
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnPressButton);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStampFloorButton);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPressButtonSide);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481F:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnAwayFromUse);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUseHalf);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAbout);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482D:
|
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
|
|
|
case 0x482E:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stWalkToFrontNoStep);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stWalkToFront);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482F:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stTurnToFront);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stTurnToBack);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// KmScene1402
|
|
|
|
|
|
|
|
KmScene1402::KmScene1402(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
|
|
|
|
SetFilterY(&Sprite::defFilterY);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1402::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
|
|
|
case 0x480A:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stMoveObjectSkipTurnFaceObject);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stMoveObjectFaceObject);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481D:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUse);
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
|
|
|
case 0x481E:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stReturnFromUse);
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-07-27 18:02:30 +00:00
|
|
|
// KmScene1403
|
|
|
|
|
|
|
|
KmScene1403::KmScene1403(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
setKlaymanIdleTable(klaymanTable4, ARRAYSIZE(klaymanTable4));
|
2011-07-27 18:02:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1403::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
|
|
|
case 0x480A:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stMoveObjectSkipTurnFaceObject);
|
2011-07-27 18:02:30 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stMoveObjectFaceObject);
|
2011-07-27 18:02:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x480D:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&KmScene1001::stUseLever);
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-07-27 18:02:30 +00:00
|
|
|
if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpNeedle);
|
2011-07-27 18:02:30 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub41FFF0);
|
2011-07-27 18:02:30 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-07-27 18:02:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_RELEASE_LEVER:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stReleaseLever);
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// KmScene1404
|
|
|
|
|
|
|
|
KmScene1404::KmScene1404(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1404::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
|
|
|
case 0x480A:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stMoveObjectSkipTurnFaceObject);
|
2011-07-27 18:02:30 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stMoveObjectFaceObject);
|
2011-07-27 18:02:30 +00:00
|
|
|
}
|
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-07-27 18:02:30 +00:00
|
|
|
if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpNeedle);
|
2011-07-27 18:02:30 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub41FFF0);
|
2011-07-27 18:02:30 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-07-27 18:02:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_INSERT_DISK:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stInsertDisk);
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481D:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUse);
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
|
|
|
case 0x481E:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stReturnFromUse);
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
|
|
|
case 0x481F:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutAfter);
|
2011-07-27 18:02:30 +00:00
|
|
|
} else if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutHalf);
|
2011-07-27 18:02:30 +00:00
|
|
|
} else if (param.asInteger() == 4) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnAwayFromUse);
|
2011-07-27 18:02:30 +00:00
|
|
|
} else if (param.asInteger() == 3) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUseHalf);
|
2011-07-27 18:02:30 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAbout);
|
2011-07-27 18:02:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482D:
|
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-07-27 18:02:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-09-23 15:21:24 +00:00
|
|
|
KmScene1608::KmScene1608(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
2011-10-27 11:33:12 +00:00
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000), _isSittingInTeleporter(false) {
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x2032:
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = param.asInteger() != 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter)
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub421350);
|
2011-09-23 15:21:24 +00:00
|
|
|
else
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-09-23 15:21:24 +00:00
|
|
|
if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpNeedle);
|
2011-09-23 15:21:24 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub41FFF0);
|
2011-09-23 15:21:24 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481D:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter)
|
|
|
|
GotoState(&Klayman::stTurnToUseInTeleporter);
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x481E:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter)//CHECKME
|
|
|
|
GotoState(&Klayman::stReturnFromUseInTeleporter);
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x481F:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutAfter);
|
2011-09-23 15:21:24 +00:00
|
|
|
} else if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutHalf);
|
2011-09-23 15:21:24 +00:00
|
|
|
} else if (param.asInteger() == 4) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnAwayFromUse);
|
2011-09-23 15:21:24 +00:00
|
|
|
} else if (param.asInteger() == 3) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUseHalf);
|
2011-09-23 15:21:24 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAbout);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482D:
|
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x4834:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStepOver);
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x4835:
|
|
|
|
sendMessage(_parentScene, 0x2032, 1);
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = true;
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stSitInTeleporter);
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x4836:
|
|
|
|
sendMessage(_parentScene, 0x2032, 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = false;
|
|
|
|
GotoState(&Klayman::stGetUpFromTeleporter);
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-07-26 08:38:19 +00:00
|
|
|
// KmScene1705
|
|
|
|
|
|
|
|
KmScene1705::KmScene1705(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
2011-10-27 11:33:12 +00:00
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000), _isSittingInTeleporter(false) {
|
2011-07-26 08:38:19 +00:00
|
|
|
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
uint32 messageResult = 0;
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x2000:
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = param.asInteger() != 0;
|
2011-07-26 08:38:19 +00:00
|
|
|
messageResult = 1;
|
|
|
|
break;
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub421350);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4803:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene1705::stFallSkipJump);
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-07-26 08:38:19 +00:00
|
|
|
if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpNeedle);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub41FFF0);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481D:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter) {
|
|
|
|
GotoState(&Klayman::stTurnToUseInTeleporter);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481E:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter) {
|
|
|
|
GotoState(&Klayman::stReturnFromUseInTeleporter);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481F:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutAfter);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutHalf);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else if (param.asInteger() == 4) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnAwayFromUse);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else if (param.asInteger() == 3) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUseHalf);
|
2011-07-26 08:38:19 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAbout);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4834:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStepOver);
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
|
|
|
case 0x4835:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2000, 1);
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = true;
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stSitInTeleporter);
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
|
|
|
case 0x4836:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2000, 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = false;
|
|
|
|
GotoState(&Klayman::stGetUpFromTeleporter);
|
2011-07-26 08:38:19 +00:00
|
|
|
break;
|
|
|
|
case 0x483D:
|
|
|
|
sub468AD0();
|
|
|
|
break;
|
|
|
|
case 0x483E:
|
|
|
|
sub468B10();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1705::handleMessage4689A0(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x4E0A2C24) {
|
|
|
|
_soundResource1.play(0x85B10BB8);
|
|
|
|
} else if (param.asInteger() == 0x4E6A0CA0) {
|
|
|
|
_soundResource1.play(0xC5B709B0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1705::spriteUpdate468A30() {
|
|
|
|
updateDeltaXY();
|
|
|
|
HitRect *hitRect = _vm->_collisionMan->findHitRectAtPos(_x, _y + 10);
|
|
|
|
if (hitRect->type == 0x5001) {
|
|
|
|
_y = hitRect->rect.y1;
|
|
|
|
processDelta();
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(this, 0x1019, 0);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene1705::stFallSkipJump() {
|
2011-07-26 08:38:19 +00:00
|
|
|
_status2 = 2;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimationByHash(0xB93AB151, 0x40A100F8, 0);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&KmScene1705::spriteUpdate468A30);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&Klayman::stLandOnFeet);
|
2011-07-26 08:38:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1705::sub468AD0() {
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x5E0A4905, 0, -1);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetMessageHandler(&KmScene1705::handleMessage4689A0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene1705::sub468B10() {
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0xD86E4477, 0, -1);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-07-26 08:38:19 +00:00
|
|
|
SetMessageHandler(&KmScene1705::handleMessage4689A0);
|
|
|
|
}
|
|
|
|
|
2011-09-29 14:44:11 +00:00
|
|
|
KmScene1901::KmScene1901(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene1901::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-09-29 14:44:11 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-09-29 14:44:11 +00:00
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-29 14:44:11 +00:00
|
|
|
break;
|
|
|
|
case 0x481D:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUse);
|
2011-09-29 14:44:11 +00:00
|
|
|
break;
|
|
|
|
case 0x481E:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stReturnFromUse);
|
2011-09-29 14:44:11 +00:00
|
|
|
break;
|
|
|
|
case 0x482D:
|
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-29 14:44:11 +00:00
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-09-29 14:44:11 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-09-29 14:44:11 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-08-04 12:23:34 +00:00
|
|
|
KmScene2001::KmScene2001(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
2011-10-27 11:33:12 +00:00
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000), _isSittingInTeleporter(false) {
|
2011-08-04 12:23:34 +00:00
|
|
|
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x2000:
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = param.asInteger() != 0;
|
2011-08-04 12:23:34 +00:00
|
|
|
break;
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-08-04 12:23:34 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub421350);
|
2012-05-11 11:03:40 +00:00
|
|
|
} else
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-08-04 12:23:34 +00:00
|
|
|
break;
|
|
|
|
case 0x4804:
|
|
|
|
if (param.asInteger() != 0) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = param.asInteger();
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWalking);
|
2012-05-11 11:03:40 +00:00
|
|
|
} else
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPeekWall);
|
2011-08-04 12:23:34 +00:00
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-08-04 12:23:34 +00:00
|
|
|
break;
|
|
|
|
case 0x481D:
|
2012-05-11 11:03:40 +00:00
|
|
|
if (_isSittingInTeleporter)
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stTurnToUseInTeleporter);
|
2011-08-04 12:23:34 +00:00
|
|
|
break;
|
|
|
|
case 0x481E:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter) {
|
|
|
|
GotoState(&Klayman::stReturnFromUseInTeleporter);
|
2011-08-04 12:23:34 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4834:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStepOver);
|
2011-08-04 12:23:34 +00:00
|
|
|
break;
|
|
|
|
case 0x4835:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2000, 1);
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = true;
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stSitInTeleporter);
|
2011-08-04 12:23:34 +00:00
|
|
|
break;
|
|
|
|
case 0x4836:
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x2000, 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = false;
|
|
|
|
GotoState(&Klayman::stGetUpFromTeleporter);
|
2011-08-04 12:23:34 +00:00
|
|
|
break;
|
|
|
|
case 0x483D:
|
|
|
|
sub440230();
|
|
|
|
break;
|
|
|
|
case 0x483E:
|
2011-10-21 09:13:49 +00:00
|
|
|
stDoTeleport();
|
2011-08-04 12:23:34 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2001::handleMessage4401A0(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x4E0A2C24) {
|
|
|
|
_soundResource1.play(0x85B10BB8);
|
|
|
|
} if (param.asInteger() == 0x4E6A0CA0) {
|
|
|
|
_soundResource1.play(0xC5B709B0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2011-08-29 10:21:30 +00:00
|
|
|
return messageResult;
|
2011-08-04 12:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2001::sub440230() {
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0xBE68CC54, 0, -1);
|
2011-08-04 12:23:34 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-08-04 12:23:34 +00:00
|
|
|
SetMessageHandler(&KmScene2001::handleMessage4401A0);
|
|
|
|
}
|
|
|
|
|
2011-10-21 09:13:49 +00:00
|
|
|
void KmScene2001::stDoTeleport() {
|
2011-08-04 12:23:34 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x18AB4ED4, 0, -1);
|
2011-08-04 12:23:34 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-08-04 12:23:34 +00:00
|
|
|
SetMessageHandler(&KmScene2001::handleMessage4401A0);
|
|
|
|
}
|
|
|
|
|
2011-09-29 18:30:58 +00:00
|
|
|
KmScene2101::KmScene2101(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
2011-10-27 11:33:12 +00:00
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000), _isSittingInTeleporter(false) {
|
2011-09-29 18:30:58 +00:00
|
|
|
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2101::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
uint32 messageResult = 0;
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x2000:
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = param.asInteger() != 0;
|
2011-09-29 18:30:58 +00:00
|
|
|
messageResult = 1;
|
|
|
|
break;
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-09-29 18:30:58 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter)
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub421350);
|
2011-09-29 18:30:58 +00:00
|
|
|
else
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-09-29 18:30:58 +00:00
|
|
|
break;
|
|
|
|
case 0x4811:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene2101::sub4862C0);
|
2011-09-29 18:30:58 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-09-29 18:30:58 +00:00
|
|
|
if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpNeedle);
|
2011-09-29 18:30:58 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub41FFF0);
|
2011-09-29 18:30:58 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-09-29 18:30:58 +00:00
|
|
|
}
|
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PRESS_BUTTON:
|
2011-09-29 18:30:58 +00:00
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnPressButton);
|
2011-09-29 18:30:58 +00:00
|
|
|
} else if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStampFloorButton);
|
|
|
|
} else {
|
|
|
|
GotoState(&Klayman::stPressButtonSide);
|
2011-09-29 18:30:58 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-29 18:30:58 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481D:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter)
|
|
|
|
GotoState(&Klayman::stTurnToUseInTeleporter);
|
2011-09-29 18:30:58 +00:00
|
|
|
break;
|
|
|
|
case 0x481E:
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isSittingInTeleporter)//CHECKME
|
|
|
|
GotoState(&Klayman::stReturnFromUseInTeleporter);
|
2011-09-29 18:30:58 +00:00
|
|
|
break;
|
|
|
|
case 0x4834:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStepOver);
|
2011-09-29 18:30:58 +00:00
|
|
|
break;
|
|
|
|
case 0x4835:
|
|
|
|
sendMessage(_parentScene, 0x2000, 1);
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = true;
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stSitInTeleporter);
|
2011-09-29 18:30:58 +00:00
|
|
|
break;
|
|
|
|
case 0x4836:
|
|
|
|
sendMessage(_parentScene, 0x2000, 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
_isSittingInTeleporter = false;
|
|
|
|
GotoState(&Klayman::stGetUpFromTeleporter);
|
2011-09-29 18:30:58 +00:00
|
|
|
break;
|
|
|
|
case 0x483D:
|
|
|
|
sub486320();
|
|
|
|
break;
|
|
|
|
case 0x483E:
|
|
|
|
sub486360();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2101::handleMessage486160(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
int16 speedUpFrameIndex;
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x1008:
|
|
|
|
speedUpFrameIndex = getFrameIndex(kKlaymanSpeedUpHash);
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_currFrameIndex < speedUpFrameIndex) {
|
|
|
|
startAnimation(0x35AA8059, speedUpFrameIndex, -1);
|
2011-09-29 18:30:58 +00:00
|
|
|
_y = 438;
|
|
|
|
}
|
|
|
|
messageResult = 0;
|
|
|
|
break;
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x1A1A0785) {
|
|
|
|
_soundResource1.play(0x40F0A342);
|
|
|
|
} else if (param.asInteger() == 0x60428026) {
|
|
|
|
_soundResource1.play(0x40608A59);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2101::handleMessage486230(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x4E0A2C24) {
|
|
|
|
_soundResource1.play(0x85B10BB8);
|
|
|
|
} else if (param.asInteger() == 0x4E6A0CA0) {
|
|
|
|
_soundResource1.play(0xC5B709B0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2101::sub4862C0() {
|
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x35AA8059, 0, -1);
|
2011-09-29 18:30:58 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
2011-09-29 18:30:58 +00:00
|
|
|
SetMessageHandler(&KmScene2101::handleMessage486160);
|
|
|
|
_soundResource1.play(0x402E82D4);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2101::sub486320() {
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0xFF290E30, 0, -1);
|
2011-09-29 18:30:58 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-09-29 18:30:58 +00:00
|
|
|
SetMessageHandler(&KmScene2101::handleMessage486230);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2101::sub486360() {
|
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x9A28CA1C, 0, -1);
|
2011-09-29 18:30:58 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-09-29 18:30:58 +00:00
|
|
|
SetMessageHandler(&KmScene2101::handleMessage486230);
|
|
|
|
}
|
|
|
|
|
2011-09-20 09:39:24 +00:00
|
|
|
KmScene2201::KmScene2201(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount)
|
2011-08-29 10:21:30 +00:00
|
|
|
// TODO: NRect *rect1, int16 unk in Klayman ctor
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
|
|
|
|
_dataResource.load(0x04104242);
|
|
|
|
_flagF6 = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2201::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-08-29 10:21:30 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-08-29 10:21:30 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-08-29 10:21:30 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PRESS_BUTTON:
|
2011-08-29 10:21:30 +00:00
|
|
|
if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPressButtonSide);
|
2011-08-29 10:21:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-08-29 10:21:30 +00:00
|
|
|
break;
|
|
|
|
case 0x4818:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(_dataResource.getPoint(param.asInteger()).x, false);
|
2011-08-29 10:21:30 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481D:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUse);
|
2011-08-29 10:21:30 +00:00
|
|
|
break;
|
|
|
|
case 0x481E:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stReturnFromUse);
|
2011-08-29 10:21:30 +00:00
|
|
|
break;
|
|
|
|
case 0x482D:
|
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-08-29 10:21:30 +00:00
|
|
|
break;
|
|
|
|
case 0x482E:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stWalkToFrontNoStep);
|
2011-08-29 10:21:30 +00:00
|
|
|
} else {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stWalkToFront);
|
2011-08-29 10:21:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482F:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stTurnToFront);
|
2011-08-29 10:21:30 +00:00
|
|
|
} else {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stTurnToBack);
|
2011-08-29 10:21:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-08-29 10:21:30 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-08-29 10:21:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-08-31 13:15:55 +00:00
|
|
|
KmScene2203::KmScene2203(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2203::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-08-31 13:15:55 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-08-31 13:15:55 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-08-31 13:15:55 +00:00
|
|
|
if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpNeedle);
|
2011-08-31 13:15:55 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub41FFF0);
|
2011-08-31 13:15:55 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-08-31 13:15:55 +00:00
|
|
|
}
|
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PRESS_BUTTON:
|
2011-08-31 13:15:55 +00:00
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnPressButton);
|
2011-08-31 13:15:55 +00:00
|
|
|
} else if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStampFloorButton);
|
|
|
|
} else {
|
|
|
|
GotoState(&Klayman::stPressButtonSide);
|
2011-08-31 13:15:55 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-08-31 13:15:55 +00:00
|
|
|
break;
|
|
|
|
case 0x4818:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(_dataResource.getPoint(param.asInteger()).x, false);
|
2011-08-31 13:15:55 +00:00
|
|
|
break;
|
|
|
|
case 0x4819:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stClayDoorOpen);
|
2011-08-31 13:15:55 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_INSERT_DISK:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stInsertDisk);
|
2011-08-31 13:15:55 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481D:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUse);
|
2011-08-31 13:15:55 +00:00
|
|
|
break;
|
|
|
|
case 0x481E:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stReturnFromUse);
|
2011-08-31 13:15:55 +00:00
|
|
|
break;
|
|
|
|
case 0x482D:
|
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-08-31 13:15:55 +00:00
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-08-31 13:15:55 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-08-31 13:15:55 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-09-01 10:18:49 +00:00
|
|
|
KmScene2205::KmScene2205(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2205::xUpdate() {
|
2011-10-27 11:33:12 +00:00
|
|
|
setGlobalVar(0x18288913, _currFrameIndex);
|
2011-09-01 10:18:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2205::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-09-01 10:18:49 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-09-01 10:18:49 +00:00
|
|
|
break;
|
|
|
|
case 0x4804:
|
|
|
|
if (param.asInteger() != 0) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = param.asInteger();
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene2205::sub423980);
|
2011-09-01 10:18:49 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPeekWall);
|
2011-09-01 10:18:49 +00:00
|
|
|
}
|
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PRESS_BUTTON:
|
2011-09-01 10:18:49 +00:00
|
|
|
if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPressButtonSide);
|
2011-09-01 10:18:49 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-01 10:18:49 +00:00
|
|
|
break;
|
|
|
|
case 0x4818:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(_dataResource.getPoint(param.asInteger()).x, false);
|
2011-09-01 10:18:49 +00:00
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-09-01 10:18:49 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-09-01 10:18:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2205::sub423980() {
|
|
|
|
int16 frameIndex = getGlobalVar(0x18288913);
|
|
|
|
if (frameIndex < 0 || frameIndex > 13)
|
|
|
|
frameIndex = 0;
|
|
|
|
_status2 = 0;
|
2011-10-28 10:37:07 +00:00
|
|
|
_isWalking = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x1A249001, frameIndex, -1);
|
2011-09-01 10:18:49 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41EB70);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F300);
|
2011-10-27 11:33:12 +00:00
|
|
|
NextState(&Klayman::stUpdateWalking);
|
2011-10-21 09:13:49 +00:00
|
|
|
FinalizeState(&Klayman::stStartWalkingDone);
|
2011-09-01 10:18:49 +00:00
|
|
|
}
|
|
|
|
|
2011-09-01 19:10:14 +00:00
|
|
|
KmScene2206::KmScene2206(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
|
|
|
|
// TODO Sound1ChList_addSoundResource(0x80101800, 0xD3B02847);
|
|
|
|
}
|
|
|
|
|
|
|
|
KmScene2206::~KmScene2206() {
|
|
|
|
// TODO Sound1ChList_sub_407AF0(0x80101800);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2206::xUpdate() {
|
2011-10-27 11:33:12 +00:00
|
|
|
setGlobalVar(0x18288913, _currFrameIndex);
|
2011-09-01 19:10:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2206::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-09-01 19:10:14 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-09-01 19:10:14 +00:00
|
|
|
break;
|
|
|
|
case 0x4803:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene2206::sub482490);
|
2011-09-01 19:10:14 +00:00
|
|
|
break;
|
|
|
|
case 0x4804:
|
|
|
|
if (param.asInteger() != 0) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = param.asInteger();
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene2206::sub482530);
|
2011-09-01 19:10:14 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPeekWall);
|
2011-09-01 19:10:14 +00:00
|
|
|
}
|
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-09-01 19:10:14 +00:00
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub41FFF0);
|
2011-09-01 19:10:14 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-09-01 19:10:14 +00:00
|
|
|
}
|
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PRESS_BUTTON:
|
2011-09-01 19:10:14 +00:00
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnPressButton);
|
2011-09-01 19:10:14 +00:00
|
|
|
} else if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStampFloorButton);
|
|
|
|
} else {
|
|
|
|
GotoState(&Klayman::stPressButtonSide);
|
2011-09-01 19:10:14 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-01 19:10:14 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481F:
|
|
|
|
if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutHalf);
|
2011-09-01 19:10:14 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutAfter);
|
2011-09-01 19:10:14 +00:00
|
|
|
} else if (param.asInteger() == 3) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUseHalf);
|
2011-09-01 19:10:14 +00:00
|
|
|
} else if (param.asInteger() == 4) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnAwayFromUse);
|
2011-09-01 19:10:14 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAbout);
|
2011-09-01 19:10:14 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482D:
|
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-01 19:10:14 +00:00
|
|
|
break;
|
|
|
|
case 0x482E:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stWalkToFrontNoStep);
|
2011-09-01 19:10:14 +00:00
|
|
|
} else {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stWalkToFront);
|
2011-09-01 19:10:14 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482F:
|
|
|
|
if (param.asInteger() == 1) {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stTurnToFront);
|
2011-09-01 19:10:14 +00:00
|
|
|
} else {
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stTurnToBack);
|
2011-09-01 19:10:14 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4837:
|
2011-09-09 09:04:28 +00:00
|
|
|
sub41CE70();
|
2011-09-01 19:10:14 +00:00
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-09-01 19:10:14 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-09-01 19:10:14 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2206::spriteUpdate482450() {
|
|
|
|
_yDelta++;
|
|
|
|
_y += _yDelta;
|
2011-10-28 10:37:07 +00:00
|
|
|
if (_y > 600)
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(this, 0x1019, 0);
|
2011-09-01 19:10:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2206::sub482490() {
|
2011-10-21 09:13:49 +00:00
|
|
|
if (!stStartActionFromIdle(AnimationCallback(&KmScene2206::sub482490))) {
|
2011-09-01 19:10:14 +00:00
|
|
|
_status2 = 1;
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_parentScene, 0x4803, 0);
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
2011-09-01 19:10:14 +00:00
|
|
|
_yDelta = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x5420E254, 0, -1);
|
2011-09-01 19:10:14 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&KmScene2206::spriteUpdate482450);
|
2011-09-01 19:10:14 +00:00
|
|
|
// TODO Sound1ChList_playLooping(0xD3B02847);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2206::sub482530() {
|
|
|
|
int16 frameIndex = getGlobalVar(0x18288913) + 1;
|
|
|
|
if (frameIndex < 0 || frameIndex > 13)
|
|
|
|
frameIndex = 0;
|
|
|
|
_status2 = 0;
|
2011-10-28 10:37:07 +00:00
|
|
|
_isWalking = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x1A249001, frameIndex, -1);
|
2011-09-01 19:10:14 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41EB70);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F300);
|
2011-10-27 11:33:12 +00:00
|
|
|
NextState(&Klayman::stUpdateWalking);
|
2011-10-21 09:13:49 +00:00
|
|
|
FinalizeState(&Klayman::stStartWalkingDone);
|
2011-09-01 19:10:14 +00:00
|
|
|
}
|
|
|
|
|
2011-09-02 17:51:39 +00:00
|
|
|
KmScene2207::KmScene2207(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2207::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x2001:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene2207::sub442460);
|
2011-09-02 17:51:39 +00:00
|
|
|
break;
|
|
|
|
case 0x2005:
|
|
|
|
spriteUpdate442430();
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene2207::stTryStandIdle);
|
2011-09-02 17:51:39 +00:00
|
|
|
break;
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-09-02 17:51:39 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-09-02 17:51:39 +00:00
|
|
|
break;
|
|
|
|
case 0x480D:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene2207::sub4424B0);
|
2011-09-02 17:51:39 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-09-02 17:51:39 +00:00
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PRESS_BUTTON:
|
2011-09-02 17:51:39 +00:00
|
|
|
if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnPressButton);
|
2011-09-02 17:51:39 +00:00
|
|
|
} else if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stStampFloorButton);
|
|
|
|
} else {
|
|
|
|
GotoState(&Klayman::stPressButtonSide);
|
2011-09-02 17:51:39 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-02 17:51:39 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_RELEASE_LEVER:
|
2011-10-27 11:33:12 +00:00
|
|
|
GotoState(&Klayman::stReleaseLever);
|
2011-09-02 17:51:39 +00:00
|
|
|
break;
|
|
|
|
case 0x482D:
|
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-02 17:51:39 +00:00
|
|
|
break;
|
|
|
|
case 0x483F:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkRight(param.asInteger());
|
2011-09-02 17:51:39 +00:00
|
|
|
break;
|
|
|
|
case 0x4840:
|
2011-10-28 10:37:07 +00:00
|
|
|
startSpecialWalkLeft(param.asInteger());
|
2011-09-02 17:51:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2207::spriteUpdate442430() {
|
2011-10-21 09:13:49 +00:00
|
|
|
_x = _attachedSprite->getX() - 20;
|
|
|
|
_y = _attachedSprite->getY() + 46;
|
2011-09-02 17:51:39 +00:00
|
|
|
processDelta();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2207::sub442460() {
|
2011-10-21 09:13:49 +00:00
|
|
|
if (!stStartActionFromIdle(AnimationCallback(&KmScene2207::sub442460))) {
|
2011-09-02 17:51:39 +00:00
|
|
|
_status2 = 1;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x5420E254, 0, -1);
|
2011-09-02 17:51:39 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&KmScene2207::spriteUpdate442430);
|
2011-09-02 17:51:39 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2207::sub4424B0() {
|
2011-10-21 09:13:49 +00:00
|
|
|
if (!stStartAction(AnimationCallback(&KmScene2207::sub4424B0))) {
|
2011-09-02 17:51:39 +00:00
|
|
|
_status2 = 0;
|
2011-10-27 11:33:12 +00:00
|
|
|
if (_isLeverDown) {
|
|
|
|
stUseLeverRelease();
|
2011-09-02 17:51:39 +00:00
|
|
|
} else {
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x0C303040, 0, -1);
|
2011-09-02 17:51:39 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&KmScene2207::spriteUpdate41F230);
|
2011-09-02 17:51:39 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41E210);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&KmScene2207::sub442520);
|
2011-09-02 17:51:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2207::sub442520() {
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x0D318140, 0, -1);
|
2011-09-16 12:23:26 +00:00
|
|
|
sendMessage(_attachedSprite, 0x480F, 0);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&KmScene2207::sub442560);
|
2011-09-02 17:51:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2207::sub442560() {
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x1564A2C0, 0, -1);
|
2011-09-02 17:51:39 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-10-21 09:13:49 +00:00
|
|
|
NextState(&KmScene2207::sub4425A0);
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
_isLeverDown = true;
|
2011-09-02 17:51:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2207::sub4425A0() {
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x4464A440, 0, -1);
|
2011-09-02 17:51:39 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F230);
|
2011-09-02 17:51:39 +00:00
|
|
|
SetMessageHandler(&Klayman::handleMessage41D360);
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
_isLeverDown = true;
|
2011-09-02 17:51:39 +00:00
|
|
|
}
|
2011-09-01 19:10:14 +00:00
|
|
|
|
2011-09-09 09:04:28 +00:00
|
|
|
KmScene2242::KmScene2242(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2242::xUpdate() {
|
2011-10-27 11:33:12 +00:00
|
|
|
setGlobalVar(0x18288913, _currFrameIndex);
|
2011-09-09 09:04:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2242::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-09-09 09:04:28 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-09-09 09:04:28 +00:00
|
|
|
break;
|
|
|
|
case 0x4804:
|
|
|
|
if (param.asInteger() != 0) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = param.asInteger();
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene2242::sub444D20);
|
2011-09-09 09:04:28 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPeekWall);
|
2011-09-09 09:04:28 +00:00
|
|
|
}
|
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-09-09 09:04:28 +00:00
|
|
|
if (param.asInteger() == 2) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpNeedle);
|
2011-09-09 09:04:28 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::sub41FFF0);
|
2011-09-09 09:04:28 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
2011-09-09 09:04:28 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-09 09:04:28 +00:00
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481F:
|
|
|
|
if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutHalf);
|
2011-09-09 09:04:28 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutAfter);
|
2011-09-09 09:04:28 +00:00
|
|
|
} else if (param.asInteger() == 3) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUseHalf);
|
2011-09-09 09:04:28 +00:00
|
|
|
} else if (param.asInteger() == 4) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnAwayFromUse);
|
2011-09-09 09:04:28 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAbout);
|
2011-09-09 09:04:28 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482D:
|
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-09 09:04:28 +00:00
|
|
|
break;
|
|
|
|
case 0x4837:
|
|
|
|
sub41CE70();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2242::sub444D20() {
|
2011-09-12 19:09:01 +00:00
|
|
|
int16 frameIndex = (int16)getGlobalVar(0x18288913);
|
|
|
|
if (frameIndex < 0 || frameIndex > 13)
|
|
|
|
frameIndex = 0;
|
|
|
|
_status2 = 0;
|
2011-10-28 10:37:07 +00:00
|
|
|
_isWalking = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x1A249001, frameIndex, -1);
|
2011-09-12 19:09:01 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41EB70);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F300);
|
2011-10-27 11:33:12 +00:00
|
|
|
NextState(&Klayman::stUpdateWalking);
|
2011-10-21 09:13:49 +00:00
|
|
|
FinalizeState(&Klayman::stStartWalkingDone);
|
2011-09-12 19:09:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
KmHallOfRecords::KmHallOfRecords(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmHallOfRecords::xUpdate() {
|
2011-10-27 11:33:12 +00:00
|
|
|
setGlobalVar(0x18288913, _currFrameIndex);
|
2011-09-12 19:09:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmHallOfRecords::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-09-12 19:09:01 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-09-12 19:09:01 +00:00
|
|
|
break;
|
|
|
|
case 0x4804:
|
|
|
|
if (param.asInteger() != 0) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = param.asInteger();
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmHallOfRecords::sub43B130);
|
2011-09-12 19:09:01 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPeekWall);
|
2011-09-12 19:09:01 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-12 19:09:01 +00:00
|
|
|
break;
|
|
|
|
case 0x481F:
|
|
|
|
if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutHalf);
|
2011-09-12 19:09:01 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutAfter);
|
2011-09-12 19:09:01 +00:00
|
|
|
} else if (param.asInteger() == 3) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUseHalf);
|
2011-09-12 19:09:01 +00:00
|
|
|
} else if (param.asInteger() == 4) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnAwayFromUse);
|
2011-09-12 19:09:01 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAbout);
|
2011-09-12 19:09:01 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482D:
|
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-12 19:09:01 +00:00
|
|
|
break;
|
|
|
|
case 0x4837:
|
|
|
|
sub41CE70();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmHallOfRecords::sub43B130() {
|
|
|
|
int16 frameIndex = (int16)getGlobalVar(0x18288913);
|
|
|
|
if (frameIndex < 0 || frameIndex > 13)
|
|
|
|
frameIndex = 0;
|
|
|
|
_status2 = 0;
|
2011-10-28 10:37:07 +00:00
|
|
|
_isWalking = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x1A249001, frameIndex, -1);
|
2011-09-12 19:09:01 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41EB70);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F300);
|
2011-10-27 11:33:12 +00:00
|
|
|
NextState(&Klayman::stUpdateWalking);
|
2011-10-21 09:13:49 +00:00
|
|
|
FinalizeState(&Klayman::stStartWalkingDone);
|
2011-09-12 19:09:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
KmScene2247::KmScene2247(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2247::xUpdate() {
|
2011-10-27 11:33:12 +00:00
|
|
|
setGlobalVar(0x18288913, _currFrameIndex);
|
2011-09-12 19:09:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2247::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
2011-10-28 10:37:07 +00:00
|
|
|
startWalkToX(param.asPoint().x, false);
|
2011-09-12 19:09:01 +00:00
|
|
|
break;
|
|
|
|
case 0x4004:
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
2011-09-12 19:09:01 +00:00
|
|
|
break;
|
|
|
|
case 0x4804:
|
|
|
|
if (param.asInteger() != 0) {
|
2011-10-28 10:37:07 +00:00
|
|
|
_destX = param.asInteger();
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&KmScene2247::sub453520);
|
2011-09-12 19:09:01 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stPeekWall);
|
2011-09-12 19:09:01 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-12 19:09:01 +00:00
|
|
|
break;
|
|
|
|
case 0x481F:
|
|
|
|
if (param.asInteger() == 0) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutHalf);
|
2011-09-12 19:09:01 +00:00
|
|
|
} else if (param.asInteger() == 1) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAboutAfter);
|
2011-09-12 19:09:01 +00:00
|
|
|
} else if (param.asInteger() == 3) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnToUseHalf);
|
2011-09-12 19:09:01 +00:00
|
|
|
} else if (param.asInteger() == 4) {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stTurnAwayFromUse);
|
2011-09-12 19:09:01 +00:00
|
|
|
} else {
|
2011-10-21 09:13:49 +00:00
|
|
|
GotoState(&Klayman::stWonderAbout);
|
2011-09-12 19:09:01 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482D:
|
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
2011-10-28 10:37:07 +00:00
|
|
|
gotoNextStateExt();
|
2011-09-12 19:09:01 +00:00
|
|
|
break;
|
|
|
|
case 0x4837:
|
|
|
|
sub41CE70();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2247::sub453520() {
|
|
|
|
int16 frameIndex = (int16)getGlobalVar(0x18288913);
|
2011-09-09 09:04:28 +00:00
|
|
|
if (frameIndex < 0 || frameIndex > 13)
|
|
|
|
frameIndex = 0;
|
|
|
|
_status2 = 0;
|
2011-10-28 10:37:07 +00:00
|
|
|
_isWalking = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
_acceptInput = true;
|
|
|
|
startAnimation(0x1A249001, frameIndex, -1);
|
2011-09-09 09:04:28 +00:00
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&Klayman::handleMessage41EB70);
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(&Klayman::spriteUpdate41F300);
|
2011-10-27 11:33:12 +00:00
|
|
|
NextState(&Klayman::stUpdateWalking);
|
2011-10-21 09:13:49 +00:00
|
|
|
FinalizeState(&Klayman::stStartWalkingDone);
|
2011-09-09 09:04:28 +00:00
|
|
|
}
|
|
|
|
|
2011-10-31 13:56:03 +00:00
|
|
|
KmScene2801::KmScene2801(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000) {
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2801::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
|
|
|
startWalkToX(param.asPoint().x, false);
|
|
|
|
break;
|
|
|
|
case 0x4004:
|
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
|
|
|
break;
|
2012-05-11 11:03:40 +00:00
|
|
|
case NM_KLAYMAN_PICKUP:
|
2011-10-31 13:56:03 +00:00
|
|
|
GotoState(&Klayman::stPickUpGeneric);
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
|
|
|
gotoNextStateExt();
|
|
|
|
break;
|
|
|
|
case 0x481B:
|
|
|
|
if (param.asPoint().y != 0) {
|
|
|
|
sub41CC40(param.asPoint().y, param.asPoint().x);
|
|
|
|
} else {
|
|
|
|
sub41CCE0(param.asPoint().x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x481D:
|
|
|
|
GotoState(&Klayman::stTurnToUse);
|
|
|
|
break;
|
|
|
|
case 0x481E:
|
|
|
|
GotoState(&Klayman::stReturnFromUse);
|
|
|
|
break;
|
|
|
|
case 0x481F:
|
|
|
|
if (param.asInteger() == 1) {
|
|
|
|
GotoState(&Klayman::stWonderAboutAfter);
|
|
|
|
} else if (param.asInteger() == 0) {
|
|
|
|
GotoState(&Klayman::stWonderAboutHalf);
|
|
|
|
} else if (param.asInteger() == 4) {
|
|
|
|
GotoState(&Klayman::stTurnAwayFromUse);
|
|
|
|
} else if (param.asInteger() == 3) {
|
|
|
|
GotoState(&Klayman::stTurnToUseHalf);
|
|
|
|
} else {
|
|
|
|
GotoState(&Klayman::stWonderAbout);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482D:
|
|
|
|
setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
|
|
|
|
gotoNextStateExt();
|
|
|
|
break;
|
|
|
|
case 0x482E:
|
|
|
|
if (param.asInteger() == 1) {
|
|
|
|
GotoState(&Klayman::stWalkToFrontNoStep);
|
|
|
|
} else {
|
|
|
|
GotoState(&Klayman::stWalkToFront);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x482F:
|
|
|
|
if (param.asInteger() == 1) {
|
|
|
|
GotoState(&Klayman::stTurnToFront);
|
|
|
|
} else {
|
|
|
|
GotoState(&Klayman::stTurnToBack);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4837:
|
|
|
|
sub41CE70();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-08-17 15:03:38 +00:00
|
|
|
KmScene2803b::KmScene2803b(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000), _soundResource(vm) {
|
|
|
|
|
|
|
|
_dataResource.load(0x81120132);
|
|
|
|
_soundResource.load(0x10688664);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2803b::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
|
|
|
sub41CDE0(param.asPoint().x);
|
|
|
|
break;
|
|
|
|
case 0x4004:
|
|
|
|
GotoState(&Klayman::sub421640);
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
|
|
|
gotoNextStateExt();
|
|
|
|
break;
|
|
|
|
case 0x4818:
|
|
|
|
sub41CDE0(_dataResource.getPoint(param.asInteger()).x);
|
|
|
|
break;
|
|
|
|
case 0x481F:
|
|
|
|
if (param.asInteger() == 1)
|
|
|
|
GotoState(&Klayman::sub421740);
|
|
|
|
else if (param.asInteger() == 0)
|
|
|
|
GotoState(&Klayman::sub421780);
|
|
|
|
else
|
|
|
|
GotoState(&Klayman::sub421700);
|
|
|
|
break;
|
|
|
|
case 0x482E:
|
|
|
|
if (param.asInteger() == 1)
|
|
|
|
GotoState(&Klayman::sub421840);
|
|
|
|
else if (param.asInteger() == 2)
|
|
|
|
GotoState(&Klayman::sub421800);
|
|
|
|
else
|
|
|
|
GotoState(&Klayman::sub4217C0);
|
|
|
|
break;
|
|
|
|
case 0x482F:
|
|
|
|
if (param.asInteger() == 1)
|
|
|
|
GotoState(&Klayman::sub421900);
|
|
|
|
else if (param.asInteger() == 2)
|
|
|
|
GotoState(&Klayman::sub4218C0);
|
|
|
|
else
|
|
|
|
GotoState(&Klayman::sub421880);
|
|
|
|
break;
|
|
|
|
case 0x4830:
|
|
|
|
GotoState(&KmScene2803b::sub460670);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2803b::handleMessage460600(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x80C110B5)
|
|
|
|
sendMessage(_parentScene, 0x482A, 0);
|
|
|
|
else if (param.asInteger() == 0x33288344)
|
|
|
|
_soundResource.play();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2803b::sub460670() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x1AE88904, 0, -1);
|
|
|
|
_soundResource1.play(0x4C69EA53);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
|
|
|
SetMessageHandler(&KmScene2803b::handleMessage460600);
|
|
|
|
}
|
|
|
|
|
2012-08-16 17:40:22 +00:00
|
|
|
KmScene2805::KmScene2805(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000), _isSittingInTeleporter(false) {
|
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2805::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x2000:
|
|
|
|
_isSittingInTeleporter = param.asInteger() != 0;
|
|
|
|
break;
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
|
|
|
startWalkToX(param.asPoint().x, false);
|
|
|
|
break;
|
|
|
|
case 0x4004:
|
|
|
|
if (_isSittingInTeleporter)
|
|
|
|
GotoState(&Klayman::sub421350);
|
|
|
|
else
|
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
|
|
|
gotoNextStateExt();
|
|
|
|
break;
|
|
|
|
case 0x481D:
|
|
|
|
if (_isSittingInTeleporter)
|
|
|
|
GotoState(&Klayman::stTurnToUseInTeleporter);
|
|
|
|
break;
|
|
|
|
case 0x481E:
|
|
|
|
if (_isSittingInTeleporter)
|
|
|
|
GotoState(&Klayman::stReturnFromUseInTeleporter);
|
|
|
|
break;
|
|
|
|
case 0x4834:
|
|
|
|
GotoState(&Klayman::stStepOver);
|
|
|
|
break;
|
|
|
|
case 0x4835:
|
|
|
|
sendMessage(_parentScene, 0x2000, 1);
|
|
|
|
_isSittingInTeleporter = true;
|
|
|
|
GotoState(&Klayman::stSitInTeleporter);
|
|
|
|
break;
|
|
|
|
case 0x4836:
|
|
|
|
sendMessage(_parentScene, 0x2000, 0);
|
|
|
|
_isSittingInTeleporter = false;
|
|
|
|
GotoState(&Klayman::stGetUpFromTeleporter);
|
|
|
|
break;
|
|
|
|
case 0x483D:
|
|
|
|
sub404890();
|
|
|
|
break;
|
|
|
|
case 0x483E:
|
|
|
|
sub4048D0();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2805::handleMessage404800(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x4E0A2C24)
|
|
|
|
_soundResource1.play(0x85B10BB8);
|
|
|
|
else if (param.asInteger() == 0x4E6A0CA0)
|
|
|
|
_soundResource1.play(0xC5B709B0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2805::sub404890() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = false;
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetSpriteUpdate(NULL);
|
|
|
|
SetMessageHandler(&KmScene2805::handleMessage404800);
|
|
|
|
startAnimation(0xDE284B74, 0, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2805::sub4048D0() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = false;
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetSpriteUpdate(NULL);
|
|
|
|
SetMessageHandler(&KmScene2805::handleMessage404800);
|
|
|
|
startAnimation(0xD82A4094, 0, -1);
|
|
|
|
}
|
|
|
|
|
2012-08-29 17:54:46 +00:00
|
|
|
KmScene2806::KmScene2806(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y,
|
|
|
|
bool flag, NRect *clipRects, uint clipRectsCount)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000),
|
|
|
|
_soundRes1(vm), _soundRes2(vm), _soundRes3(vm), _soundRes4(vm), _soundRes5(vm) {
|
|
|
|
// Empty
|
|
|
|
|
|
|
|
if (flag) {
|
|
|
|
// TODO Maybe? Don't know. Set Klayman clip rects
|
|
|
|
_soundRes1.load(0x58E0C341);
|
|
|
|
_soundRes2.load(0x40A00342);
|
|
|
|
_soundRes3.load(0xD0A1C348);
|
|
|
|
_soundRes4.load(0x166FC6E0);
|
|
|
|
_soundRes5.load(0x00018040);
|
|
|
|
}
|
|
|
|
|
|
|
|
_dataResource.load(0x98182003);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2806::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
|
|
|
startWalkToX(param.asPoint().x, false);
|
|
|
|
break;
|
|
|
|
case 0x4004:
|
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
|
|
|
break;
|
|
|
|
case 0x4804:
|
|
|
|
startWalkToX(440, true);
|
|
|
|
break;
|
|
|
|
case 0x480D:
|
|
|
|
GotoState(&Klayman::sub420F60);
|
|
|
|
break;
|
|
|
|
case 0x4816:
|
|
|
|
if (param.asInteger() == 0) {
|
|
|
|
GotoState(&Klayman::stPressButtonSide);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
|
|
|
gotoNextStateExt();
|
|
|
|
break;
|
|
|
|
case 0x4818:
|
|
|
|
startWalkToX(_dataResource.getPoint(param.asInteger()).x, false);
|
|
|
|
break;
|
|
|
|
case 0x4831:
|
|
|
|
GotoState(&KmScene2806::sub40F780);
|
|
|
|
break;
|
|
|
|
case 0x4832:
|
|
|
|
if (param.asInteger() == 1) {
|
|
|
|
GotoState(&KmScene2806::sub40F7C0);
|
|
|
|
} else {
|
|
|
|
GotoState(&Klayman::sub421110);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2806::handleMessage40F1F0(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x1008:
|
|
|
|
if (_flag1) {
|
|
|
|
startAnimationByHash(0x1C388C04, 0x004A2148, 0);
|
|
|
|
messageResult = 0;
|
|
|
|
} else
|
|
|
|
_flag2 = true;
|
|
|
|
break;
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x0002418E)
|
|
|
|
sendMessage(_parentScene, 0x2000, 0);
|
|
|
|
else if (param.asInteger() == 0x924090C2) {
|
|
|
|
_flag1 = true;
|
|
|
|
if (_flag2) {
|
|
|
|
startAnimationByHash(0x1C388C04, 0x004A2148, 0);
|
|
|
|
messageResult = 0;
|
|
|
|
}
|
|
|
|
} else if (param.asInteger() == 0x004A2148)
|
|
|
|
_flag1 = false;
|
|
|
|
else if (param.asInteger() == 0x02B20220)
|
|
|
|
_soundResource1.play(0xC5408620);
|
|
|
|
else if (param.asInteger() == 0x0A720138)
|
|
|
|
_soundResource1.play(0xD4C08010);
|
|
|
|
else if (param.asInteger() == 0x03020231)
|
|
|
|
_soundResource1.play(0xD4C08010);
|
|
|
|
else if (param.asInteger() == 0xB613A180)
|
|
|
|
_soundResource1.play(0x44051000);
|
|
|
|
else if (param.asInteger() == 0x67221A03)
|
|
|
|
_soundResource1.play(0x44051000);
|
|
|
|
else if (param.asInteger() == 0x038A010B)
|
|
|
|
_soundResource1.play(0x00018040);
|
|
|
|
else if (param.asInteger() == 0x422B0280)
|
|
|
|
_soundResource1.play(0x166FC6E0);
|
|
|
|
else if (param.asInteger() == 0x925A0C1E)
|
|
|
|
_soundResource1.play(0x40E5884D);
|
|
|
|
else if (param.asInteger() == 0x00020814)
|
|
|
|
_soundResource1.play(0x786CC6D0);
|
|
|
|
else if (param.asInteger() == 0x06020500)
|
|
|
|
_soundResource1.play(0x1069C0E1);
|
|
|
|
else if (param.asInteger() == 0x02128C00)
|
|
|
|
_soundResource1.play(0x5068C4C3);
|
|
|
|
else if (param.asInteger() == 0x82022030)
|
|
|
|
_soundResource1.play(0x5C48C0E8);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2806::handleMessage40F570(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x32180101)
|
|
|
|
_soundResource1.play(0x405002D8);
|
|
|
|
else if (param.asInteger() == 0x0A2A9098)
|
|
|
|
_soundResource1.play(0x0460E2FA);
|
|
|
|
else if (param.asInteger() == 0xD00A0C0C)
|
|
|
|
_soundRes1.play();
|
|
|
|
else if (param.asInteger() == 0x04121920)
|
|
|
|
_soundRes2.play();
|
|
|
|
else if (param.asInteger() == 0x030B4480)
|
|
|
|
_soundRes3.play();
|
|
|
|
else if (param.asInteger() == 0x422B0280)
|
|
|
|
_soundRes4.play();
|
|
|
|
else if (param.asInteger() == 0x038A010B)
|
|
|
|
_soundRes5.play();
|
|
|
|
else if (param.asInteger() == 0x67221A03)
|
|
|
|
_soundResource1.play(0x44051000);
|
|
|
|
else if (param.asInteger() == 0x02B20220)
|
|
|
|
_soundResource1.play(0xC5408620);
|
|
|
|
else if (param.asInteger() == 0x925A0C1E)
|
|
|
|
_soundResource1.play(0x40E5884D);
|
|
|
|
else if (param.asInteger() == 0x03020231)
|
|
|
|
_soundResource1.play(0xD4C08010);
|
|
|
|
else if (param.asInteger() == 0x08040840)
|
|
|
|
setDoDeltaX(2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2806::sub40F780() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = false;
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
|
|
|
SetMessageHandler(&KmScene2806::handleMessage40F570);
|
|
|
|
startAnimation(0x2838C010, 0, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2806::sub40F7C0() {
|
|
|
|
_status2 = 1;
|
|
|
|
_acceptInput = false;
|
|
|
|
_flag1 = false;
|
|
|
|
_flag2 = false;
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
|
|
|
SetMessageHandler(&KmScene2806::handleMessage40F1F0);
|
|
|
|
startAnimation(0x1C388C04, 0, -1);
|
|
|
|
}
|
|
|
|
|
2012-09-04 16:25:47 +00:00
|
|
|
KmScene2809::KmScene2809(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y,
|
|
|
|
bool flag, NRect *clipRects, uint clipRectsCount)
|
|
|
|
: Klayman(vm, parentScene, x, y, 1000, 1000),
|
|
|
|
_soundRes1(vm), _soundRes2(vm), _soundRes3(vm), _soundRes4(vm), _soundRes5(vm) {
|
|
|
|
|
|
|
|
if (flag) {
|
|
|
|
// TODO Maybe? Don't know. Set Klayman clip rects
|
|
|
|
_soundRes1.load(0x58E0C341);
|
|
|
|
_soundRes2.load(0x40A00342);
|
|
|
|
_soundRes3.load(0xD0A1C348);
|
|
|
|
_soundRes4.load(0x166FC6E0);
|
|
|
|
_soundRes5.load(0x00018040);
|
|
|
|
}
|
|
|
|
|
|
|
|
_dataResource.load(0x1830009A);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2809::xHandleMessage(int messageNum, const MessageParam ¶m) {
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x4001:
|
|
|
|
case 0x4800:
|
|
|
|
startWalkToX(param.asPoint().x, false);
|
|
|
|
break;
|
|
|
|
case 0x4004:
|
|
|
|
GotoState(&Klayman::stTryStandIdle);
|
|
|
|
break;
|
|
|
|
case 0x4804:
|
|
|
|
startWalkToX(226, true);
|
|
|
|
break;
|
|
|
|
case 0x480D:
|
|
|
|
GotoState(&Klayman::sub420F60);
|
|
|
|
break;
|
|
|
|
case 0x4816:
|
|
|
|
if (param.asInteger() == 0) {
|
|
|
|
GotoState(&Klayman::stPressButtonSide);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x4817:
|
|
|
|
setDoDeltaX(param.asInteger());
|
|
|
|
gotoNextStateExt();
|
|
|
|
break;
|
|
|
|
case 0x4818:
|
|
|
|
startWalkToX(_dataResource.getPoint(param.asInteger()).x, false);
|
|
|
|
break;
|
|
|
|
case 0x4831:
|
|
|
|
GotoState(&KmScene2809::sub458550);
|
|
|
|
break;
|
|
|
|
case 0x4832:
|
|
|
|
if (param.asInteger() == 1) {
|
|
|
|
GotoState(&KmScene2809::sub458590);
|
|
|
|
} else {
|
|
|
|
GotoState(&Klayman::sub421110);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2809::handleMessage457FC0(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x1008:
|
|
|
|
if (_flag1) {
|
|
|
|
startAnimationByHash(0x1C388C04, 0x004A2148, 0);
|
|
|
|
messageResult = 0;
|
|
|
|
} else
|
|
|
|
_flag2 = true;
|
|
|
|
break;
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x0002418E)
|
|
|
|
sendMessage(_parentScene, 0x2000, 0);
|
|
|
|
else if (param.asInteger() == 0x924090C2) {
|
|
|
|
_flag1 = true;
|
|
|
|
if (_flag2) {
|
|
|
|
startAnimationByHash(0x1C388C04, 0x004A2148, 0);
|
|
|
|
messageResult = 0;
|
|
|
|
}
|
|
|
|
} else if (param.asInteger() == 0x004A2148)
|
|
|
|
_flag1 = false;
|
|
|
|
else if (param.asInteger() == 0x02B20220)
|
|
|
|
_soundResource1.play(0xC5408620);
|
|
|
|
else if (param.asInteger() == 0x0A720138)
|
|
|
|
_soundResource1.play(0xD4C08010);
|
|
|
|
else if (param.asInteger() == 0x03020231)
|
|
|
|
_soundResource1.play(0xD4C08010);
|
|
|
|
else if (param.asInteger() == 0xB613A180)
|
|
|
|
_soundResource1.play(0x44051000);
|
|
|
|
else if (param.asInteger() == 0x67221A03)
|
|
|
|
_soundResource1.play(0x44051000);
|
|
|
|
else if (param.asInteger() == 0x038A010B)
|
|
|
|
_soundResource1.play(0x00018040);
|
|
|
|
else if (param.asInteger() == 0x422B0280)
|
|
|
|
_soundResource1.play(0x166FC6E0);
|
|
|
|
else if (param.asInteger() == 0x925A0C1E)
|
|
|
|
_soundResource1.play(0x40E5884D);
|
|
|
|
else if (param.asInteger() == 0x000F0082)
|
|
|
|
_soundResource1.play(0x546CDCC1);
|
|
|
|
else if (param.asInteger() == 0x00020814)
|
|
|
|
_soundResource1.play(0x786CC6D0);
|
|
|
|
else if (param.asInteger() == 0x06020500)
|
|
|
|
_soundResource1.play(0x1069C0E1);
|
|
|
|
else if (param.asInteger() == 0x02128C00)
|
|
|
|
_soundResource1.play(0x5068C4C3);
|
|
|
|
else if (param.asInteger() == 0x82022030)
|
|
|
|
_soundResource1.play(0x5C48C0E8);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 KmScene2809::handleMessage458340(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = handleMessage41D480(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x32180101)
|
|
|
|
_soundResource1.play(0x405002D8);
|
|
|
|
else if (param.asInteger() == 0x0A2A9098)
|
|
|
|
_soundResource1.play(0x0460E2FA);
|
|
|
|
else if (param.asInteger() == 0xD00A0C0C)
|
|
|
|
_soundRes1.play();
|
|
|
|
else if (param.asInteger() == 0x04121920)
|
|
|
|
_soundRes2.play();
|
|
|
|
else if (param.asInteger() == 0x030B4480)
|
|
|
|
_soundRes3.play();
|
|
|
|
else if (param.asInteger() == 0x422B0280)
|
|
|
|
_soundRes4.play();
|
|
|
|
else if (param.asInteger() == 0x038A010B)
|
|
|
|
_soundRes5.play();
|
|
|
|
else if (param.asInteger() == 0x67221A03)
|
|
|
|
_soundResource1.play(0x44051000);
|
|
|
|
else if (param.asInteger() == 0x02B20220)
|
|
|
|
_soundResource1.play(0xC5408620);
|
|
|
|
else if (param.asInteger() == 0x925A0C1E)
|
|
|
|
_soundResource1.play(0x40E5884D);
|
|
|
|
else if (param.asInteger() == 0x03020231)
|
|
|
|
_soundResource1.play(0xD4C08010);
|
|
|
|
else if (param.asInteger() == 0x08040840)
|
|
|
|
setDoDeltaX(2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2809::sub458550() {
|
|
|
|
_status2 = 0;
|
|
|
|
_acceptInput = false;
|
|
|
|
startAnimation(0x2838C010, 0, -1);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&KmScene2809::handleMessage458340);
|
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KmScene2809::sub458590() {
|
|
|
|
_status2 = 1;
|
|
|
|
_acceptInput = false;
|
|
|
|
_flag1 = false;
|
|
|
|
_flag2 = false;
|
|
|
|
startAnimation(0x1C388C04, 0, -1);
|
|
|
|
SetUpdateHandler(&Klayman::update);
|
|
|
|
SetMessageHandler(&KmScene2809::handleMessage457FC0);
|
|
|
|
SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
|
|
|
|
}
|
|
|
|
|
2011-07-07 17:26:22 +00:00
|
|
|
} // End of namespace Neverhood
|