2011-09-23 15:21:24 +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/module1600.h"
|
|
|
|
#include "neverhood/gamemodule.h"
|
|
|
|
#include "neverhood/module1200.h"
|
|
|
|
#include "neverhood/module2200.h"
|
|
|
|
|
|
|
|
namespace Neverhood {
|
|
|
|
|
2012-09-24 11:08:24 +00:00
|
|
|
static const uint32 kModule1600SoundList[] = {
|
|
|
|
0x90805C50,
|
|
|
|
0x90804450,
|
|
|
|
0xB4005E60,
|
|
|
|
0x91835066,
|
|
|
|
0x90E14440,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2011-09-23 15:21:24 +00:00
|
|
|
Module1600::Module1600(NeverhoodEngine *vm, Module *parentModule, int which)
|
|
|
|
: Module(vm, parentModule) {
|
|
|
|
|
2012-10-23 12:46:41 +00:00
|
|
|
if (which < 0)
|
2011-09-23 15:21:24 +00:00
|
|
|
createScene(_vm->gameState().sceneNum, -1);
|
2012-10-23 12:46:41 +00:00
|
|
|
else if (which == 1)
|
2011-09-23 15:21:24 +00:00
|
|
|
createScene(4, 1);
|
2012-10-23 12:46:41 +00:00
|
|
|
else if (which == 2)
|
2011-09-23 15:21:24 +00:00
|
|
|
createScene(5, 0);
|
2012-10-23 12:46:41 +00:00
|
|
|
else if (which == 3)
|
2011-09-23 15:21:24 +00:00
|
|
|
createScene(6, 1);
|
2012-10-23 12:46:41 +00:00
|
|
|
else if (which == 4)
|
2011-09-23 15:21:24 +00:00
|
|
|
createScene(1, 0);
|
2012-10-23 12:46:41 +00:00
|
|
|
else
|
2011-09-23 15:21:24 +00:00
|
|
|
createScene(0, 0);
|
|
|
|
|
2012-09-24 11:08:24 +00:00
|
|
|
_vm->_soundMan->addSoundList(0x1A008D8, kModule1600SoundList);
|
|
|
|
_vm->_soundMan->setSoundListParams(kModule1600SoundList, true, 50, 600, 5, 150);
|
2012-09-23 12:12:37 +00:00
|
|
|
_vm->_soundMan->playTwoSounds(0x1A008D8, 0x41861371, 0x43A2507F, 0);
|
2011-09-23 15:21:24 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Module1600::~Module1600() {
|
2012-09-23 12:12:37 +00:00
|
|
|
_vm->_soundMan->deleteGroup(0x1A008D8);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Module1600::createScene(int sceneNum, int which) {
|
|
|
|
debug("Module1600::createScene(%d, %d)", sceneNum, which);
|
2012-10-23 12:46:41 +00:00
|
|
|
_sceneNum = sceneNum;
|
|
|
|
switch (_sceneNum) {
|
2011-09-23 15:21:24 +00:00
|
|
|
case 0:
|
2012-10-23 12:46:41 +00:00
|
|
|
_vm->gameState().sceneNum = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
createNavigationScene(0x004B39D0, which);
|
|
|
|
break;
|
|
|
|
case 1:
|
2012-10-23 12:46:41 +00:00
|
|
|
_vm->gameState().sceneNum = 1;
|
2011-09-23 15:21:24 +00:00
|
|
|
createNavigationScene(0x004B3A30, which);
|
|
|
|
break;
|
|
|
|
case 2:
|
2012-10-23 12:46:41 +00:00
|
|
|
_vm->gameState().sceneNum = 2;
|
2011-09-23 15:21:24 +00:00
|
|
|
createNavigationScene(0x004B3A60, which);
|
|
|
|
break;
|
|
|
|
case 3:
|
2012-10-23 12:46:41 +00:00
|
|
|
_vm->gameState().sceneNum = 3;
|
2011-09-23 15:21:24 +00:00
|
|
|
createNavigationScene(0x004B3A90, which);
|
|
|
|
break;
|
|
|
|
case 4:
|
2012-10-23 12:46:41 +00:00
|
|
|
_vm->gameState().sceneNum = 4;
|
2011-09-23 15:21:24 +00:00
|
|
|
createNavigationScene(0x004B3B20, which);
|
|
|
|
break;
|
|
|
|
case 5:
|
2012-10-23 12:46:41 +00:00
|
|
|
_vm->gameState().sceneNum = 5;
|
2011-09-23 15:21:24 +00:00
|
|
|
createNavigationScene(0x004B3B50, which);
|
|
|
|
break;
|
|
|
|
case 6:
|
2012-10-23 12:46:41 +00:00
|
|
|
_vm->gameState().sceneNum = 6;
|
2011-09-23 15:21:24 +00:00
|
|
|
createNavigationScene(0x004B3B80, which);
|
|
|
|
break;
|
|
|
|
case 7:
|
2012-10-23 12:46:41 +00:00
|
|
|
_vm->gameState().sceneNum = 7;
|
2011-09-23 15:21:24 +00:00
|
|
|
_childObject = new Scene1608(_vm, this, which);
|
|
|
|
break;
|
|
|
|
case 8:
|
2012-10-23 12:46:41 +00:00
|
|
|
_vm->gameState().sceneNum = 8;
|
|
|
|
_childObject = new Scene1609(_vm, this);
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 1001:
|
2012-10-23 12:46:41 +00:00
|
|
|
_vm->gameState().sceneNum = 1;
|
|
|
|
if (getGlobalVar(V_TALK_COUNTING_INDEX) == 1)
|
2011-09-23 15:21:24 +00:00
|
|
|
createSmackerScene(0x80050200, true, true, false);
|
2012-10-23 12:46:41 +00:00
|
|
|
else if (getGlobalVar(V_TALK_COUNTING_INDEX) == 2)
|
2011-09-23 15:21:24 +00:00
|
|
|
createSmackerScene(0x80090200, true, true, false);
|
2012-10-23 12:46:41 +00:00
|
|
|
else
|
2011-09-23 15:21:24 +00:00
|
|
|
createSmackerScene(0x80000200, true, true, false);
|
2012-10-10 21:10:51 +00:00
|
|
|
if (getGlobalVar(V_TALK_COUNTING_INDEX) >= 2)
|
|
|
|
setGlobalVar(V_TALK_COUNTING_INDEX, 0);
|
2011-09-23 15:21:24 +00:00
|
|
|
else
|
2012-10-10 21:10:51 +00:00
|
|
|
incGlobalVar(V_TALK_COUNTING_INDEX, +1);
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
SetUpdateHandler(&Module1600::updateScene);
|
|
|
|
_childObject->handleUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Module1600::updateScene() {
|
|
|
|
if (!updateChild()) {
|
2012-10-23 12:46:41 +00:00
|
|
|
switch (_sceneNum) {
|
2011-09-23 15:21:24 +00:00
|
|
|
case 0:
|
|
|
|
if (_moduleResult == 0)
|
|
|
|
createScene(2, 0);
|
|
|
|
else if (_moduleResult == 1)
|
|
|
|
createScene(1, 0);
|
|
|
|
else if (_moduleResult == 2)
|
|
|
|
leaveModule(4);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (_moduleResult == 0)
|
|
|
|
createScene(1001, -1);
|
|
|
|
else if (_moduleResult == 1)
|
|
|
|
createScene(0, 3);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (_moduleResult == 0)
|
|
|
|
createScene(3, 0);
|
|
|
|
else if (_moduleResult == 1)
|
|
|
|
createScene(0, 2);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (_moduleResult == 0)
|
|
|
|
createScene(5, 0);
|
|
|
|
else if (_moduleResult == 2)
|
|
|
|
createScene(6, 0);
|
|
|
|
else if (_moduleResult == 3)
|
|
|
|
createScene(2, 1);
|
|
|
|
else if (_moduleResult == 4)
|
|
|
|
createScene(4, 0);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
if (_moduleResult == 0)
|
|
|
|
leaveModule(1);
|
|
|
|
else if (_moduleResult == 1)
|
|
|
|
createScene(3, 1);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
if (_moduleResult == 0)
|
|
|
|
leaveModule(2);
|
|
|
|
else if (_moduleResult == 1)
|
|
|
|
createScene(3, 3);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
if (_moduleResult == 0)
|
|
|
|
createScene(8, -1);
|
|
|
|
else if (_moduleResult == 1)
|
|
|
|
createScene(3, 5);
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
createScene(6, 1);
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
if (_moduleResult == 0)
|
|
|
|
createScene(6, 0);
|
|
|
|
else
|
|
|
|
createScene(7, 0);
|
|
|
|
break;
|
|
|
|
case 1001:
|
|
|
|
createScene(1, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
AsCommonCar::AsCommonCar(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y)
|
2011-09-23 15:21:24 +00:00
|
|
|
: AnimatedSprite(vm, 1000), _parentScene(parentScene) {
|
|
|
|
|
2012-10-18 11:14:36 +00:00
|
|
|
createSurface(200, 556, 328);
|
2011-09-23 15:21:24 +00:00
|
|
|
_x = x;
|
|
|
|
_y = y;
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
_inMainArea = false;
|
2011-09-23 15:21:24 +00:00
|
|
|
_exitDirection = 0;
|
|
|
|
_currPointIndex = 0;
|
2012-10-17 13:07:52 +00:00
|
|
|
_hasAgainDestPoint = false;
|
2011-09-23 15:21:24 +00:00
|
|
|
_stepError = 0;
|
2012-10-17 13:07:52 +00:00
|
|
|
_hasAgainDestPointIndex = false;
|
2011-09-23 15:21:24 +00:00
|
|
|
_steps = 0;
|
2012-10-17 13:07:52 +00:00
|
|
|
_isBraking = false;
|
|
|
|
_yMoveTotalSteps = 0;
|
|
|
|
_isBusy = false;
|
|
|
|
_isIdle = false;
|
|
|
|
_isMoving = true;
|
|
|
|
_rectFlag = false;
|
2011-09-23 15:21:24 +00:00
|
|
|
_newDeltaXType = -1;
|
2012-10-17 13:07:52 +00:00
|
|
|
_soundCounter = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
_pathPoints = NULL;
|
2012-11-19 23:37:20 +00:00
|
|
|
_currMoveDirection = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xD4220027, 0, -1);
|
2012-10-10 21:10:51 +00:00
|
|
|
setDoDeltaX(getGlobalVar(V_CAR_DELTA_X));
|
2011-09-23 15:21:24 +00:00
|
|
|
|
2012-10-23 12:46:41 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::update);
|
|
|
|
SetMessageHandler(&AsCommonCar::handleMessage);
|
|
|
|
SetSpriteUpdate(NULL);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
AsCommonCar::~AsCommonCar() {
|
2012-10-23 12:46:41 +00:00
|
|
|
if (_finalizeStateCb == AnimationCallback(&AsCommonCar::evTurnCarDone))
|
2012-10-10 21:10:51 +00:00
|
|
|
setGlobalVar(V_CAR_DELTA_X, !getGlobalVar(V_CAR_DELTA_X));
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
void AsCommonCar::setPathPoints(NPointArray *pathPoints) {
|
2011-09-23 15:21:24 +00:00
|
|
|
_pathPoints = pathPoints;
|
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
void AsCommonCar::update() {
|
2011-09-23 15:21:24 +00:00
|
|
|
if (_newDeltaXType >= 0) {
|
|
|
|
setDoDeltaX(_newDeltaXType);
|
|
|
|
_newDeltaXType = -1;
|
|
|
|
}
|
|
|
|
AnimatedSprite::update();
|
2012-10-17 13:07:52 +00:00
|
|
|
if (_hasAgainDestPoint && _yMoveTotalSteps == 0 && !_isBusy) {
|
|
|
|
_hasAgainDestPoint = false;
|
|
|
|
_hasAgainDestPointIndex = false;
|
|
|
|
sendPointMessage(this, 0x2004, _againDestPoint);
|
|
|
|
} else if (_hasAgainDestPointIndex && _yMoveTotalSteps == 0 && !_isBusy) {
|
|
|
|
_hasAgainDestPointIndex = false;
|
2011-09-23 15:21:24 +00:00
|
|
|
sendMessage(this, 0x2003, _againDestPointIndex);
|
|
|
|
}
|
2012-10-17 13:07:52 +00:00
|
|
|
updateMovement();
|
|
|
|
updateSound();
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::upIdle() {
|
|
|
|
update();
|
2011-09-23 15:21:24 +00:00
|
|
|
if (++_idleCounter >= _idleCounterMax)
|
2012-10-17 13:07:52 +00:00
|
|
|
stIdleBlink();
|
|
|
|
updateSound();
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
uint32 AsCommonCar::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-09-23 15:21:24 +00:00
|
|
|
uint32 messageResult = Sprite::handleMessage(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x1019:
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x2002:
|
|
|
|
// Set the current position without moving
|
|
|
|
_currPointIndex = param.asInteger();
|
|
|
|
_stepError = 0;
|
|
|
|
_x = pathPoint(_currPointIndex).x;
|
|
|
|
_y = pathPoint(_currPointIndex).y;
|
|
|
|
break;
|
|
|
|
case 0x2003:
|
|
|
|
// Move to a point by its index
|
|
|
|
{
|
|
|
|
int newPointIndex = param.asInteger();
|
2012-10-17 13:07:52 +00:00
|
|
|
if (_yMoveTotalSteps <= 0 && !_isBusy) {
|
|
|
|
_destX = pathPoint(newPointIndex).x;
|
|
|
|
_destY = pathPoint(newPointIndex).y;
|
2011-09-23 15:21:24 +00:00
|
|
|
if (_currPointIndex < newPointIndex) {
|
|
|
|
moveToNextPoint();
|
|
|
|
} else if (_currPointIndex == newPointIndex && _stepError == 0) {
|
|
|
|
if (_currPointIndex == 0) {
|
2012-10-17 13:07:52 +00:00
|
|
|
_yMoveTotalSteps = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
sendMessage(_parentScene, 0x2005, 0);
|
|
|
|
} else if (_currPointIndex == (int)_pathPoints->size()) {
|
2012-10-17 13:07:52 +00:00
|
|
|
_yMoveTotalSteps = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
sendMessage(_parentScene, 0x2006, 0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
moveToPrevPoint();
|
|
|
|
}
|
|
|
|
} else {
|
2012-10-17 13:07:52 +00:00
|
|
|
_hasAgainDestPointIndex = true;
|
2011-09-23 15:21:24 +00:00
|
|
|
_againDestPointIndex = newPointIndex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x2004:
|
|
|
|
// Move to the point closest to the parameter point
|
|
|
|
{
|
|
|
|
int minMatchIndex = -1;
|
|
|
|
int minMatchDistance, distance;
|
|
|
|
NPoint pt = param.asPoint();
|
2012-10-17 13:07:52 +00:00
|
|
|
if (_yMoveTotalSteps <= 0 && !_isBusy) {
|
2011-09-23 15:21:24 +00:00
|
|
|
// Check if we're already exiting (or something)
|
|
|
|
if ((pt.x <= 20 && _exitDirection == 1) ||
|
|
|
|
(pt.x >= 620 && _exitDirection == 3) ||
|
|
|
|
(pt.y <= 20 && _exitDirection == 2) ||
|
|
|
|
(pt.y >= 460 && _exitDirection == 4))
|
|
|
|
break;
|
2012-10-17 13:07:52 +00:00
|
|
|
_destX = pt.x;
|
|
|
|
_destY = pt.y;
|
|
|
|
minMatchDistance = calcDistance(_destX, _destY, _x, _y) + 1;
|
2011-09-23 15:21:24 +00:00
|
|
|
for (int i = _currPointIndex + 1; i < (int)_pathPoints->size(); i++) {
|
2012-10-17 13:07:52 +00:00
|
|
|
distance = calcDistance(_destX, _destY, pathPoint(i).x, pathPoint(i).y);
|
2011-09-23 15:21:24 +00:00
|
|
|
if (distance >= minMatchDistance)
|
|
|
|
break;
|
|
|
|
minMatchDistance = distance;
|
|
|
|
minMatchIndex = i;
|
|
|
|
}
|
|
|
|
for (int i = _currPointIndex; i >= 0; i--) {
|
2012-10-17 13:07:52 +00:00
|
|
|
distance = calcDistance(_destX, _destY, pathPoint(i).x, pathPoint(i).y);
|
2011-09-23 15:21:24 +00:00
|
|
|
if (distance >= minMatchDistance)
|
|
|
|
break;
|
|
|
|
minMatchDistance = distance;
|
|
|
|
minMatchIndex = i;
|
|
|
|
}
|
|
|
|
if (minMatchIndex == -1) {
|
2012-10-23 12:46:41 +00:00
|
|
|
if (_currPointIndex == 0)
|
2011-09-23 15:21:24 +00:00
|
|
|
moveToPrevPoint();
|
2012-10-23 12:46:41 +00:00
|
|
|
else
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2011-09-23 15:21:24 +00:00
|
|
|
} else {
|
2012-10-23 12:46:41 +00:00
|
|
|
if (minMatchIndex > _currPointIndex)
|
2011-09-23 15:21:24 +00:00
|
|
|
moveToNextPoint();
|
2012-10-23 12:46:41 +00:00
|
|
|
else
|
2011-09-23 15:21:24 +00:00
|
|
|
moveToPrevPoint();
|
|
|
|
}
|
|
|
|
} else {
|
2012-10-17 13:07:52 +00:00
|
|
|
_hasAgainDestPoint = true;
|
|
|
|
_againDestPoint = pt;
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x2007:
|
2012-10-17 13:07:52 +00:00
|
|
|
_yMoveTotalSteps = param.asInteger();
|
2011-09-23 15:21:24 +00:00
|
|
|
_steps = 0;
|
2012-10-17 13:07:52 +00:00
|
|
|
_isBraking = false;
|
2011-09-23 15:21:24 +00:00
|
|
|
_lastDistance = 640;
|
2012-10-23 12:46:41 +00:00
|
|
|
SetSpriteUpdate(&AsCommonCar::suMoveToPrevPoint);
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x2008:
|
2012-10-17 13:07:52 +00:00
|
|
|
_yMoveTotalSteps = param.asInteger();
|
2011-09-23 15:21:24 +00:00
|
|
|
_steps = 0;
|
2012-10-17 13:07:52 +00:00
|
|
|
_isBraking = false;
|
2011-09-23 15:21:24 +00:00
|
|
|
_lastDistance = 640;
|
2012-10-23 12:46:41 +00:00
|
|
|
SetSpriteUpdate(&AsCommonCar::suMoveToNextPoint);
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x2009:
|
2012-10-17 13:07:52 +00:00
|
|
|
stEnterCar();
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x200A:
|
2012-10-17 13:07:52 +00:00
|
|
|
stLeaveCar();
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x200E:
|
2012-10-17 13:07:52 +00:00
|
|
|
stTurnCar();
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x200F:
|
2012-10-17 13:07:52 +00:00
|
|
|
stCarAtHome();
|
2011-09-23 15:21:24 +00:00
|
|
|
_newDeltaXType = param.asInteger();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
uint32 AsCommonCar::hmAnimation(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2012-10-05 21:55:51 +00:00
|
|
|
uint32 messageResult = AsCommonCar::handleMessage(messageNum, param, sender);
|
2011-09-23 15:21:24 +00:00
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
2012-10-17 13:07:52 +00:00
|
|
|
if (_isBusy && param.asInteger() == 0x025424A2)
|
2011-10-27 11:33:12 +00:00
|
|
|
gotoNextState();
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x3002:
|
2011-10-27 11:33:12 +00:00
|
|
|
gotoNextState();
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
uint32 AsCommonCar::hmLeaveCar(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-09-23 15:21:24 +00:00
|
|
|
switch (messageNum) {
|
|
|
|
case 0x2009:
|
2012-10-17 13:07:52 +00:00
|
|
|
stEnterCar();
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x3002:
|
|
|
|
sendMessage(_parentScene, 0x200A, 0);
|
2012-10-05 21:55:51 +00:00
|
|
|
SetMessageHandler(&AsCommonCar::handleMessage);
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::stCarAtHome() {
|
2011-09-23 15:21:24 +00:00
|
|
|
bool doDeltaX = _doDeltaX;
|
2012-05-11 11:03:40 +00:00
|
|
|
SetSpriteUpdate(NULL);
|
2012-10-17 13:07:52 +00:00
|
|
|
_hasAgainDestPoint = false;
|
|
|
|
_hasAgainDestPointIndex = false;
|
|
|
|
_isBraking = false;
|
|
|
|
_isBusy = false;
|
|
|
|
_isIdle = false;
|
|
|
|
_isMoving = false;
|
|
|
|
_rectFlag = false;
|
|
|
|
NextState(&AsCommonCar::stLeanForwardIdle);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x35698F78, 0, -1);
|
2011-09-23 15:21:24 +00:00
|
|
|
setDoDeltaX(doDeltaX ? 1 : 0);
|
|
|
|
_currMoveDirection = 0;
|
|
|
|
_newMoveDirection = 0;
|
|
|
|
_steps = 0;
|
|
|
|
_idleCounter = 0;
|
|
|
|
_idleCounterMax = _vm->_rnd->getRandomNumber(64 - 1) + 24;
|
2012-10-23 12:46:41 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::upIdle);
|
|
|
|
SetMessageHandler(&AsCommonCar::handleMessage);
|
|
|
|
FinalizeState(&AsCommonCar::evIdleDone);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::updateTurnMovement() {
|
|
|
|
if (_turnMoveStatus == 1) {
|
2011-09-23 15:21:24 +00:00
|
|
|
_lastDistance = 640;
|
2012-10-17 13:07:52 +00:00
|
|
|
_isIdle = false;
|
|
|
|
_isBraking = false;
|
2012-10-05 21:55:51 +00:00
|
|
|
SetSpriteUpdate(&AsCommonCar::suMoveToNextPoint);
|
2012-10-17 13:07:52 +00:00
|
|
|
} else if (_turnMoveStatus == 2) {
|
2011-09-23 15:21:24 +00:00
|
|
|
_lastDistance = 640;
|
2012-10-17 13:07:52 +00:00
|
|
|
_isIdle = false;
|
|
|
|
_isBraking = false;
|
2012-10-05 21:55:51 +00:00
|
|
|
SetSpriteUpdate(&AsCommonCar::suMoveToPrevPoint);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::updateMovement() {
|
|
|
|
if (_isBraking && !_isIdle && !_isBusy) {
|
2011-10-27 11:33:12 +00:00
|
|
|
gotoNextState();
|
2012-10-17 13:07:52 +00:00
|
|
|
_isMoving = false;
|
|
|
|
_isIdle = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x192ADD30, 0, -1);
|
2012-10-05 21:55:51 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::update);
|
2012-10-23 12:46:41 +00:00
|
|
|
SetMessageHandler(&AsCommonCar::hmAnimation);
|
2012-10-17 13:07:52 +00:00
|
|
|
NextState(&AsCommonCar::stLeanForwardIdle);
|
|
|
|
} else if (!_isBraking && _steps && _isIdle) {
|
2011-10-27 11:33:12 +00:00
|
|
|
gotoNextState();
|
2012-10-17 13:07:52 +00:00
|
|
|
_isIdle = false;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x9966B138, 0, -1);
|
2012-10-05 21:55:51 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::update);
|
2012-10-23 12:46:41 +00:00
|
|
|
SetMessageHandler(&AsCommonCar::hmAnimation);
|
2012-10-17 13:07:52 +00:00
|
|
|
NextState(&AsCommonCar::stUpdateMoveDirection);
|
2012-10-24 16:48:08 +00:00
|
|
|
} else if (_newMoveDirection != _currMoveDirection && _isMoving && !_isBusy) {
|
|
|
|
gotoNextState();
|
|
|
|
_currMoveDirection = _newMoveDirection;
|
|
|
|
stUpdateMoveDirection();
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::stEnterCar() {
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xA86A9538, 0, -1);
|
2012-10-05 21:55:51 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::update);
|
2012-10-23 12:46:41 +00:00
|
|
|
SetMessageHandler(&AsCommonCar::hmAnimation);
|
2012-10-17 13:07:52 +00:00
|
|
|
NextState(&AsCommonCar::stLeanForwardIdle);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::stLeaveCar() {
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xA86A9538, -1, -1);
|
2011-09-23 15:21:24 +00:00
|
|
|
_playBackwards = true;
|
2012-10-05 21:55:51 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::update);
|
2012-10-23 12:46:41 +00:00
|
|
|
SetMessageHandler(&AsCommonCar::hmLeaveCar);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::stLeanForwardIdle() {
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x35698F78, 0, -1);
|
2011-09-23 15:21:24 +00:00
|
|
|
_currMoveDirection = 0;
|
|
|
|
_newMoveDirection = 0;
|
|
|
|
_steps = 0;
|
2012-10-17 13:07:52 +00:00
|
|
|
_idleCounter = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
_idleCounterMax = _vm->_rnd->getRandomNumber(64 - 1) + 24;
|
2012-10-23 12:46:41 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::upIdle);
|
|
|
|
SetMessageHandler(&AsCommonCar::handleMessage);
|
|
|
|
FinalizeState(&AsCommonCar::evIdleDone);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::evIdleDone() {
|
2012-10-05 21:55:51 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::update);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::stIdleBlink() {
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xB579A77C, 0, -1);
|
2011-09-23 15:21:24 +00:00
|
|
|
_idleCounter = 0;
|
|
|
|
_idleCounterMax = _vm->_rnd->getRandomNumber(64 - 1) + 24;
|
2012-10-23 12:46:41 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::update);
|
|
|
|
SetMessageHandler(&AsCommonCar::hmAnimation);
|
|
|
|
NextState(&AsCommonCar::stLeanForwardIdle);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::stUpdateMoveDirection() {
|
|
|
|
_isMoving = true;
|
2012-10-23 12:46:41 +00:00
|
|
|
if (_currMoveDirection == 1)
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xD4AA03A4, 0, -1);
|
2012-10-23 12:46:41 +00:00
|
|
|
else if (_currMoveDirection == 3)
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xD00A1364, 0, -1);
|
2012-10-23 12:46:41 +00:00
|
|
|
else if ((_currMoveDirection == 2 && _doDeltaX) || (_currMoveDirection == 4 && !_doDeltaX))
|
2012-10-17 13:07:52 +00:00
|
|
|
stTurnCar();
|
2012-10-23 12:46:41 +00:00
|
|
|
else
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xD4220027, 0, -1);
|
2012-10-10 21:10:51 +00:00
|
|
|
setGlobalVar(V_CAR_DELTA_X, _doDeltaX ? 1 : 0);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
void AsCommonCar::moveToNextPoint() {
|
2011-09-23 15:21:24 +00:00
|
|
|
if (_currPointIndex >= (int)_pathPoints->size() - 1) {
|
2012-10-17 13:07:52 +00:00
|
|
|
_yMoveTotalSteps = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
sendMessage(this, 0x1019, 0);
|
|
|
|
sendMessage(_parentScene, 0x2006, 0);
|
|
|
|
} else {
|
|
|
|
NPoint nextPt = pathPoint(_currPointIndex + 1);
|
|
|
|
NPoint currPt = pathPoint(_currPointIndex);
|
2012-11-19 23:37:20 +00:00
|
|
|
if (ABS(nextPt.y - currPt.y) <= ABS(nextPt.x - currPt.x) &&
|
|
|
|
((_currMoveDirection == 2 && nextPt.x < currPt.x) ||
|
|
|
|
(_currMoveDirection == 4 && nextPt.x >= currPt.x))) {
|
|
|
|
if (_currMoveDirection == 2)
|
2011-09-23 15:21:24 +00:00
|
|
|
_currMoveDirection = 4;
|
2012-11-19 23:37:20 +00:00
|
|
|
else if (_currMoveDirection == 4)
|
|
|
|
_currMoveDirection = 2;
|
2012-10-17 13:07:52 +00:00
|
|
|
if (_isIdle)
|
|
|
|
stTurnCarMoveToNextPoint();
|
2011-09-23 15:21:24 +00:00
|
|
|
else
|
2012-10-17 13:07:52 +00:00
|
|
|
stBrakeMoveToNextPoint();
|
2011-09-23 15:21:24 +00:00
|
|
|
} else {
|
|
|
|
if (_steps == 0) {
|
2011-10-27 11:33:12 +00:00
|
|
|
gotoNextState();
|
2012-10-17 13:07:52 +00:00
|
|
|
_isIdle = false;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x9966B138, 0, -1);
|
2012-10-17 13:07:52 +00:00
|
|
|
SetMessageHandler(&AsCommonCar::hmAnimation);
|
2012-10-05 21:55:51 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::update);
|
2012-10-17 13:07:52 +00:00
|
|
|
NextState(&AsCommonCar::stUpdateMoveDirection);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
2012-10-17 13:07:52 +00:00
|
|
|
_isBraking = false;
|
2012-10-05 21:55:51 +00:00
|
|
|
SetSpriteUpdate(&AsCommonCar::suMoveToNextPoint);
|
2011-09-23 15:21:24 +00:00
|
|
|
_lastDistance = 640;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::stBrakeMoveToNextPoint() {
|
2011-10-27 11:33:12 +00:00
|
|
|
gotoNextState();
|
2012-10-17 13:07:52 +00:00
|
|
|
_isBusy = true;
|
|
|
|
_isBraking = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x192ADD30, 0, -1);
|
2012-10-17 13:07:52 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::update);
|
2012-10-23 12:46:41 +00:00
|
|
|
SetMessageHandler(&AsCommonCar::hmAnimation);
|
2012-10-17 13:07:52 +00:00
|
|
|
NextState(&AsCommonCar::stTurnCarMoveToNextPoint);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AsCommonCar::stTurnCar() {
|
|
|
|
// Turn to left/right #1
|
|
|
|
gotoNextState();
|
|
|
|
_isBusy = true;
|
|
|
|
startAnimation(0xF46A0324, 0, -1);
|
2012-10-05 21:55:51 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::update);
|
2012-10-23 12:46:41 +00:00
|
|
|
SetMessageHandler(&AsCommonCar::hmAnimation);
|
2012-10-17 13:07:52 +00:00
|
|
|
FinalizeState(&AsCommonCar::evTurnCarDone);
|
|
|
|
_turnMoveStatus = 0;
|
|
|
|
updateTurnMovement();
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::stTurnCarMoveToNextPoint() {
|
|
|
|
// Turn to left/right #2
|
2011-10-27 11:33:12 +00:00
|
|
|
gotoNextState();
|
2012-10-17 13:07:52 +00:00
|
|
|
_isBusy = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0xF46A0324, 0, -1);
|
2012-10-05 21:55:51 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::update);
|
2012-10-23 12:46:41 +00:00
|
|
|
SetMessageHandler(&AsCommonCar::hmAnimation);
|
2012-10-17 13:07:52 +00:00
|
|
|
FinalizeState(&AsCommonCar::evTurnCarDone);
|
|
|
|
_turnMoveStatus = 1;
|
|
|
|
updateTurnMovement();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AsCommonCar::stTurnCarMoveToPrevPoint() {
|
|
|
|
// Turn to left/right #3
|
|
|
|
FinalizeState(NULL);
|
|
|
|
_isBusy = true;
|
|
|
|
startAnimation(0xF46A0324, 0, -1);
|
|
|
|
SetUpdateHandler(&AsCommonCar::update);
|
2012-10-23 12:46:41 +00:00
|
|
|
SetMessageHandler(&AsCommonCar::hmAnimation);
|
2012-10-17 13:07:52 +00:00
|
|
|
FinalizeState(&AsCommonCar::evTurnCarDone);
|
|
|
|
_turnMoveStatus = 2;
|
|
|
|
updateTurnMovement();
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
void AsCommonCar::moveToPrevPoint() {
|
2011-09-23 15:21:24 +00:00
|
|
|
if (_currPointIndex == 0 && _stepError == 0) {
|
2012-10-17 13:07:52 +00:00
|
|
|
_yMoveTotalSteps = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
sendMessage(this, 0x1019, 0);
|
|
|
|
sendMessage(_parentScene, 0x2005, 0);
|
|
|
|
} else {
|
|
|
|
NPoint prevPt;
|
|
|
|
NPoint currPt;
|
|
|
|
if (_stepError == 0) {
|
|
|
|
prevPt = pathPoint(_currPointIndex - 1);
|
|
|
|
currPt = pathPoint(_currPointIndex);
|
|
|
|
} else {
|
|
|
|
prevPt = pathPoint(_currPointIndex);
|
|
|
|
currPt = pathPoint(_currPointIndex + 1);
|
|
|
|
}
|
2012-11-19 23:37:20 +00:00
|
|
|
if (ABS(prevPt.y - currPt.y) <= ABS(prevPt.x - currPt.x) &&
|
|
|
|
((_currMoveDirection == 2 && prevPt.x < currPt.x) ||
|
|
|
|
(_currMoveDirection == 4 && prevPt.x >= currPt.x))) {
|
2011-09-23 15:21:24 +00:00
|
|
|
if (_currMoveDirection == 2)
|
|
|
|
_currMoveDirection = 4;
|
|
|
|
else if (_currMoveDirection == 4)
|
|
|
|
_currMoveDirection = 2;
|
2012-10-17 13:07:52 +00:00
|
|
|
if (_isIdle)
|
|
|
|
stTurnCarMoveToPrevPoint();
|
2011-09-23 15:21:24 +00:00
|
|
|
else
|
2012-10-17 13:07:52 +00:00
|
|
|
stBrakeMoveToPrevPoint();
|
2011-09-23 15:21:24 +00:00
|
|
|
} else {
|
|
|
|
if (_steps == 0) {
|
2011-10-27 11:33:12 +00:00
|
|
|
gotoNextState();
|
2012-10-17 13:07:52 +00:00
|
|
|
_isIdle = false;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x9966B138, 0, -1);
|
2012-10-17 13:07:52 +00:00
|
|
|
SetMessageHandler(&AsCommonCar::hmAnimation);
|
2012-10-05 21:55:51 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::update);
|
2012-10-17 13:07:52 +00:00
|
|
|
NextState(&AsCommonCar::stUpdateMoveDirection);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
2012-10-17 13:07:52 +00:00
|
|
|
_isBraking = false;
|
2012-10-05 21:55:51 +00:00
|
|
|
SetSpriteUpdate(&AsCommonCar::suMoveToPrevPoint);
|
2011-09-23 15:21:24 +00:00
|
|
|
_lastDistance = 640;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::stBrakeMoveToPrevPoint() {
|
2011-10-21 09:13:49 +00:00
|
|
|
FinalizeState(NULL);
|
2012-10-17 13:07:52 +00:00
|
|
|
_isBusy = true;
|
|
|
|
_isBraking = true;
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x192ADD30, 0, -1);
|
2012-10-05 21:55:51 +00:00
|
|
|
SetUpdateHandler(&AsCommonCar::update);
|
2012-10-23 12:46:41 +00:00
|
|
|
SetMessageHandler(&AsCommonCar::hmAnimation);
|
2012-10-17 13:07:52 +00:00
|
|
|
NextState(&AsCommonCar::stTurnCarMoveToPrevPoint);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::evTurnCarDone() {
|
|
|
|
_isBusy = false;
|
2011-09-23 15:21:24 +00:00
|
|
|
setDoDeltaX(2);
|
2012-11-19 23:37:20 +00:00
|
|
|
_newMoveDirection = 0;
|
2012-10-17 13:07:52 +00:00
|
|
|
stUpdateMoveDirection();
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
void AsCommonCar::suMoveToNextPoint() {
|
2011-09-23 15:21:24 +00:00
|
|
|
int16 newX = _x, newY = _y;
|
|
|
|
|
|
|
|
if (_currPointIndex >= (int)_pathPoints->size()) {
|
2012-10-17 13:07:52 +00:00
|
|
|
_yMoveTotalSteps = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
sendMessage(this, 0x1019, 0);
|
|
|
|
sendMessage(_parentScene, 0x2006, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
if (_isBraking) {
|
2011-09-23 15:21:24 +00:00
|
|
|
if (_steps <= 0) {
|
|
|
|
sendMessage(this, 0x1019, 0);
|
|
|
|
return;
|
2012-10-23 12:46:41 +00:00
|
|
|
} else
|
2011-09-23 15:21:24 +00:00
|
|
|
_steps--;
|
2012-10-23 12:46:41 +00:00
|
|
|
} else if (_steps < 11)
|
2011-09-23 15:21:24 +00:00
|
|
|
_steps++;
|
|
|
|
|
|
|
|
bool firstTime = true;
|
2012-10-17 13:07:52 +00:00
|
|
|
_ySteps = _steps;
|
2011-09-23 15:21:24 +00:00
|
|
|
int stepsCtr = _steps;
|
|
|
|
|
|
|
|
while (stepsCtr > 0) {
|
|
|
|
NPoint pt1;
|
|
|
|
NPoint pt2 = pathPoint(_currPointIndex);
|
|
|
|
if (_currPointIndex + 1 >= (int)_pathPoints->size())
|
|
|
|
pt1 = pathPoint(0);
|
|
|
|
else
|
|
|
|
pt1 = pathPoint(_currPointIndex + 1);
|
|
|
|
int16 deltaX = ABS(pt1.x - pt2.x);
|
|
|
|
int16 deltaY = ABS(pt1.y - pt2.y);
|
|
|
|
if (deltaX >= deltaY) {
|
|
|
|
_newMoveDirection = 2;
|
|
|
|
if (pt1.x < pt2.x)
|
|
|
|
_newMoveDirection = 4;
|
|
|
|
if (stepsCtr + _stepError >= deltaX) {
|
|
|
|
stepsCtr -= deltaX;
|
|
|
|
stepsCtr += _stepError;
|
|
|
|
_stepError = 0;
|
|
|
|
_currPointIndex++;
|
|
|
|
if (_currPointIndex == (int)_pathPoints->size() - 1)
|
|
|
|
stepsCtr = 0;
|
|
|
|
newX = pathPoint(_currPointIndex).x;
|
|
|
|
newY = pathPoint(_currPointIndex).y;
|
|
|
|
} else {
|
|
|
|
_stepError += stepsCtr;
|
|
|
|
if (pt1.x >= pt2.x)
|
|
|
|
newX += stepsCtr;
|
|
|
|
else
|
|
|
|
newX -= stepsCtr;
|
|
|
|
if (pt1.y >= pt2.y)
|
|
|
|
newY = pt2.y + (deltaY * _stepError) / deltaX;
|
|
|
|
else
|
|
|
|
newY = pt2.y - (deltaY * _stepError) / deltaX;
|
|
|
|
stepsCtr = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_newMoveDirection = 3;
|
|
|
|
if (pt1.y < pt2.y)
|
|
|
|
_newMoveDirection = 1;
|
|
|
|
if (firstTime) {
|
2012-10-23 12:46:41 +00:00
|
|
|
if (pt1.y >= pt2.y)
|
2011-09-23 15:21:24 +00:00
|
|
|
stepsCtr += 7;
|
2012-10-23 12:46:41 +00:00
|
|
|
else {
|
2011-09-23 15:21:24 +00:00
|
|
|
stepsCtr -= 4;
|
|
|
|
if (stepsCtr < 0)
|
|
|
|
stepsCtr = 0;
|
|
|
|
}
|
2012-10-17 13:07:52 +00:00
|
|
|
_ySteps = stepsCtr;
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
if (stepsCtr + _stepError >= deltaY) {
|
|
|
|
stepsCtr -= deltaY;
|
|
|
|
stepsCtr += _stepError;
|
|
|
|
_stepError = 0;
|
|
|
|
_currPointIndex++;
|
|
|
|
if (_currPointIndex == (int)_pathPoints->size() - 1)
|
|
|
|
stepsCtr = 0;
|
|
|
|
newX = pathPoint(_currPointIndex).x;
|
|
|
|
newY = pathPoint(_currPointIndex).y;
|
|
|
|
} else {
|
|
|
|
_stepError += stepsCtr;
|
|
|
|
if (pt1.x >= pt2.x)
|
|
|
|
newX = pt2.x + (deltaX * _stepError) / deltaY;
|
|
|
|
else
|
|
|
|
newX = pt2.x - (deltaX * _stepError) / deltaY;
|
|
|
|
if (pt1.y >= pt2.y)
|
|
|
|
newY += stepsCtr;
|
|
|
|
else
|
|
|
|
newY -= stepsCtr;
|
|
|
|
stepsCtr = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
firstTime = false;
|
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
if (_yMoveTotalSteps != 0) {
|
2011-09-23 15:21:24 +00:00
|
|
|
_x = newX;
|
|
|
|
_y = newY;
|
2012-10-17 13:07:52 +00:00
|
|
|
_yMoveTotalSteps -= _ySteps;
|
|
|
|
if (_yMoveTotalSteps <= 0) {
|
|
|
|
_isBraking = true;
|
|
|
|
_yMoveTotalSteps = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
} else {
|
2012-10-17 13:07:52 +00:00
|
|
|
int distance = calcDistance(_destX, _destY, _x, _y);
|
2011-09-23 15:21:24 +00:00
|
|
|
_x = newX;
|
|
|
|
_y = newY;
|
|
|
|
if (newX > 20 && newX < 620 && newY > 20 && newY < 460) {
|
|
|
|
_exitDirection = 0;
|
2012-10-17 13:07:52 +00:00
|
|
|
_inMainArea = true;
|
|
|
|
} else if (_inMainArea) {
|
|
|
|
_destX = pathPoint(_pathPoints->size() - 1).x;
|
|
|
|
_destY = pathPoint(_pathPoints->size() - 1).y;
|
|
|
|
_inMainArea = false;
|
2011-09-23 15:21:24 +00:00
|
|
|
if (_x <= 20)
|
|
|
|
_exitDirection = 1;
|
|
|
|
else if (_x >= 620)
|
|
|
|
_exitDirection = 3;
|
|
|
|
else if (_y <= 20)
|
|
|
|
_exitDirection = 2;
|
|
|
|
else if (_y >= 460)
|
|
|
|
_exitDirection = 4;
|
2012-10-17 13:07:52 +00:00
|
|
|
if (_exitDirection != 0 && _isBraking) {
|
|
|
|
_isBraking = false;
|
2011-09-23 15:21:24 +00:00
|
|
|
_steps = 11;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((distance < 20 && _exitDirection == 0 && _lastDistance < distance) ||
|
|
|
|
(_exitDirection == 0 && _lastDistance + 20 < distance))
|
2012-10-17 13:07:52 +00:00
|
|
|
_isBraking = true;
|
2011-09-23 15:21:24 +00:00
|
|
|
if (distance < _lastDistance)
|
|
|
|
_lastDistance = distance;
|
|
|
|
if (_currPointIndex == (int)_pathPoints->size() - 1) {
|
2012-10-17 13:07:52 +00:00
|
|
|
_isBraking = true;
|
|
|
|
_yMoveTotalSteps = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
sendMessage(this, 0x1019, 0);
|
|
|
|
sendMessage(_parentScene, 0x2006, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
void AsCommonCar::suMoveToPrevPoint() {
|
2011-09-23 15:21:24 +00:00
|
|
|
int16 newX = _x, newY = _y;
|
|
|
|
|
|
|
|
if (_currPointIndex == 0 && _stepError == 0) {
|
2012-10-17 13:07:52 +00:00
|
|
|
_yMoveTotalSteps = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
sendMessage(this, 0x1019, 0);
|
|
|
|
sendMessage(_parentScene, 0x2005, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
if (_isBraking) {
|
2011-09-23 15:21:24 +00:00
|
|
|
if (_steps <= 0) {
|
|
|
|
sendMessage(this, 0x1019, 0);
|
|
|
|
return;
|
2012-10-23 12:46:41 +00:00
|
|
|
} else
|
2011-09-23 15:21:24 +00:00
|
|
|
_steps--;
|
2012-10-23 12:46:41 +00:00
|
|
|
} else if (_steps < 11)
|
2011-09-23 15:21:24 +00:00
|
|
|
_steps++;
|
|
|
|
|
|
|
|
bool firstTime = true;
|
2012-10-17 13:07:52 +00:00
|
|
|
_ySteps = _steps;
|
2011-09-23 15:21:24 +00:00
|
|
|
int stepsCtr = _steps;
|
|
|
|
|
|
|
|
while (stepsCtr > 0) {
|
|
|
|
if (_stepError == 0)
|
|
|
|
_currPointIndex--;
|
|
|
|
NPoint pt1;
|
|
|
|
NPoint pt2 = pathPoint(_currPointIndex);
|
|
|
|
if (_currPointIndex + 1 >= (int)_pathPoints->size())
|
|
|
|
pt1 = pathPoint(0);
|
|
|
|
else
|
|
|
|
pt1 = pathPoint(_currPointIndex + 1);
|
|
|
|
int16 deltaX = ABS(pt1.x - pt2.x);
|
|
|
|
int16 deltaY = ABS(pt1.y - pt2.y);
|
|
|
|
if (deltaX >= deltaY) {
|
|
|
|
_newMoveDirection = 4;
|
|
|
|
if (pt1.x < pt2.x)
|
|
|
|
_newMoveDirection = 2;
|
|
|
|
if (_stepError == 0)
|
|
|
|
_stepError = deltaX;
|
|
|
|
if (stepsCtr > _stepError) {
|
|
|
|
stepsCtr -= _stepError;
|
|
|
|
_stepError = 0;
|
|
|
|
if (_currPointIndex == 0)
|
|
|
|
stepsCtr = 0;
|
|
|
|
newX = pathPoint(_currPointIndex).x;
|
|
|
|
newY = pathPoint(_currPointIndex).y;
|
|
|
|
} else {
|
|
|
|
_stepError -= stepsCtr;
|
|
|
|
if (pt1.x >= pt2.x)
|
|
|
|
newX -= stepsCtr;
|
|
|
|
else
|
|
|
|
newX += stepsCtr;
|
|
|
|
if (pt1.y >= pt2.y)
|
|
|
|
newY = pt2.y + (deltaY * _stepError) / deltaX;
|
|
|
|
else
|
|
|
|
newY = pt2.y - (deltaY * _stepError) / deltaX;
|
|
|
|
stepsCtr = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_newMoveDirection = 1;
|
|
|
|
if (pt1.y < pt2.y)
|
|
|
|
_newMoveDirection = 3;
|
|
|
|
if (firstTime) {
|
|
|
|
if (pt1.y >= pt2.y) {
|
|
|
|
stepsCtr -= 4;
|
|
|
|
if (stepsCtr < 0)
|
|
|
|
stepsCtr = 0;
|
|
|
|
} else {
|
|
|
|
stepsCtr += 7;
|
|
|
|
}
|
2012-10-17 13:07:52 +00:00
|
|
|
_ySteps = stepsCtr;
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
if (_stepError == 0)
|
|
|
|
_stepError = deltaY;
|
|
|
|
if (stepsCtr > _stepError) {
|
|
|
|
stepsCtr -= _stepError;
|
|
|
|
_stepError = 0;
|
|
|
|
if (_currPointIndex == 0)
|
|
|
|
stepsCtr = 0;
|
|
|
|
newX = pathPoint(_currPointIndex).x;
|
|
|
|
newY = pathPoint(_currPointIndex).y;
|
|
|
|
} else {
|
|
|
|
_stepError -= stepsCtr;
|
|
|
|
if (pt1.x >= pt2.x)
|
|
|
|
newX = pt2.x + (deltaX * _stepError) / deltaY;
|
|
|
|
else
|
|
|
|
newX = pt2.x - (deltaX * _stepError) / deltaY;
|
|
|
|
if (pt1.y >= pt2.y)
|
|
|
|
newY -= stepsCtr;
|
|
|
|
else
|
|
|
|
newY += stepsCtr;
|
|
|
|
stepsCtr = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
firstTime = false;
|
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
if (_yMoveTotalSteps != 0) {
|
2011-09-23 15:21:24 +00:00
|
|
|
_x = newX;
|
|
|
|
_y = newY;
|
2012-10-17 13:07:52 +00:00
|
|
|
_yMoveTotalSteps -= _ySteps;
|
|
|
|
if (_yMoveTotalSteps <= 0) {
|
|
|
|
_isBraking = true;
|
|
|
|
_yMoveTotalSteps = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
} else {
|
2012-10-17 13:07:52 +00:00
|
|
|
int distance = calcDistance(_destX, _destY, _x, _y);
|
2011-09-23 15:21:24 +00:00
|
|
|
_x = newX;
|
|
|
|
_y = newY;
|
|
|
|
if (newX > 20 && newX < 620 && newY > 20 && newY < 460) {
|
|
|
|
_exitDirection = 0;
|
2012-10-17 13:07:52 +00:00
|
|
|
_inMainArea = true;
|
|
|
|
} else if (_inMainArea) {
|
|
|
|
_destX = pathPoint(0).x;
|
|
|
|
_destY = pathPoint(0).y;
|
|
|
|
_inMainArea = false;
|
2011-09-23 15:21:24 +00:00
|
|
|
if (_x <= 20)
|
|
|
|
_exitDirection = 1;
|
|
|
|
else if (_x >= 620)
|
|
|
|
_exitDirection = 3;
|
|
|
|
else if (_y <= 20)
|
|
|
|
_exitDirection = 2;
|
|
|
|
else if (_y >= 460)
|
|
|
|
_exitDirection = 4;
|
2012-10-17 13:07:52 +00:00
|
|
|
if (_exitDirection != 0 && _isBraking) {
|
|
|
|
_isBraking = false;
|
2011-09-23 15:21:24 +00:00
|
|
|
_steps = 11;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((distance < 20 && _exitDirection == 0 && _lastDistance < distance) ||
|
|
|
|
(_exitDirection == 0 && _lastDistance + 20 < distance))
|
2012-10-17 13:07:52 +00:00
|
|
|
_isBraking = true;
|
2011-09-23 15:21:24 +00:00
|
|
|
if (distance < _lastDistance)
|
|
|
|
_lastDistance = distance;
|
|
|
|
if (_currPointIndex == 0 && _stepError == 0) {
|
2012-10-17 13:07:52 +00:00
|
|
|
_isBraking = true;
|
|
|
|
_yMoveTotalSteps = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
sendMessage(this, 0x1019, 0);
|
|
|
|
sendMessage(_parentScene, 0x2005, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-10-17 13:07:52 +00:00
|
|
|
void AsCommonCar::updateSound() {
|
|
|
|
int maxSoundCounter = 0;
|
|
|
|
_soundCounter++;
|
|
|
|
if (_steps != 0 && !_isIdle) {
|
|
|
|
if (_currMoveDirection == 1)
|
|
|
|
maxSoundCounter = 18 - _steps;
|
|
|
|
else if (_currMoveDirection == 3) {
|
|
|
|
maxSoundCounter = 5 - _steps;
|
|
|
|
if (maxSoundCounter < 1)
|
|
|
|
maxSoundCounter = 1;
|
2012-10-23 12:46:41 +00:00
|
|
|
} else
|
2012-10-17 13:07:52 +00:00
|
|
|
maxSoundCounter = 14 - _steps;
|
2012-10-23 12:46:41 +00:00
|
|
|
} else
|
2012-10-17 13:07:52 +00:00
|
|
|
maxSoundCounter = 21;
|
|
|
|
if (_soundCounter >= maxSoundCounter) {
|
|
|
|
sendMessage(_parentScene, 0x200D, 0);
|
|
|
|
_soundCounter = 0;
|
|
|
|
}
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-08 11:11:23 +00:00
|
|
|
AsCommonIdleCarLower::AsCommonIdleCarLower(NeverhoodEngine *vm, int16 x, int16 y)
|
2011-09-23 15:21:24 +00:00
|
|
|
: AnimatedSprite(vm, 0x1209E09F, 1100, x, y) {
|
|
|
|
|
|
|
|
setDoDeltaX(1);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x1209E09F, 1, -1);
|
|
|
|
_newStickFrameIndex = 1;
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-08 11:11:23 +00:00
|
|
|
AsCommonIdleCarFull::AsCommonIdleCarFull(NeverhoodEngine *vm, int16 x, int16 y)
|
2011-09-23 15:21:24 +00:00
|
|
|
: AnimatedSprite(vm, 0x1209E09F, 100, x, y) {
|
|
|
|
|
|
|
|
setDoDeltaX(1);
|
2011-10-27 11:33:12 +00:00
|
|
|
_newStickFrameIndex = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
AsCommonCarConnector::AsCommonCarConnector(NeverhoodEngine *vm, AsCommonCar *asCar)
|
|
|
|
: AnimatedSprite(vm, 1100), _asCar(asCar) {
|
2011-09-23 15:21:24 +00:00
|
|
|
|
|
|
|
createSurface1(0x60281C10, 150);
|
2011-10-27 11:33:12 +00:00
|
|
|
startAnimation(0x60281C10, -1, -1);
|
2012-10-18 17:36:40 +00:00
|
|
|
_newStickFrameIndex = STICK_LAST_FRAME;
|
2012-10-23 12:46:41 +00:00
|
|
|
SetUpdateHandler(&AsCommonCarConnector::update);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
void AsCommonCarConnector::update() {
|
|
|
|
_x = _asCar->getX();
|
|
|
|
_y = _asCar->getY();
|
2011-09-23 15:21:24 +00:00
|
|
|
AnimatedSprite::update();
|
|
|
|
}
|
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
void Tracks::findTrackPoint(NPoint pt, int &minMatchTrackIndex, int &minMatchDistance,
|
|
|
|
DataResource &dataResource) {
|
|
|
|
const uint trackCount = size();
|
|
|
|
minMatchTrackIndex = -1;
|
|
|
|
minMatchDistance = 640;
|
|
|
|
for (uint trackIndex = 0; trackIndex < trackCount; trackIndex++) {
|
|
|
|
NPointArray *pointList = dataResource.getPointArray((*this)[trackIndex]->trackPointsName);
|
|
|
|
for (uint pointIndex = 0; pointIndex < pointList->size(); pointIndex++) {
|
|
|
|
NPoint testPt = (*pointList)[pointIndex];
|
|
|
|
int distance = calcDistance(testPt.x, testPt.y, pt.x, pt.y);
|
|
|
|
if (distance < minMatchDistance) {
|
|
|
|
minMatchTrackIndex = trackIndex;
|
|
|
|
minMatchDistance = distance;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-23 15:21:24 +00:00
|
|
|
Scene1608::Scene1608(NeverhoodEngine *vm, Module *parentModule, int which)
|
2013-01-10 23:17:16 +00:00
|
|
|
: Scene(vm, parentModule), _asCar(NULL), _countdown1(0) {
|
2012-10-05 21:55:51 +00:00
|
|
|
|
2012-10-10 21:10:51 +00:00
|
|
|
setGlobalVar(V_CAR_DELTA_X, 1);
|
2011-09-23 15:21:24 +00:00
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
SetMessageHandler(&Scene1608::hmLowerFloor);
|
2011-09-23 15:21:24 +00:00
|
|
|
|
2012-10-08 07:40:39 +00:00
|
|
|
_asKey = insertSprite<AsCommonKey>(this, 1, 1100, 198, 220);
|
2013-01-10 23:17:16 +00:00
|
|
|
addCollisionSprite(_asKey);
|
2011-09-23 15:21:24 +00:00
|
|
|
|
|
|
|
if (which < 0) {
|
2012-10-23 12:46:41 +00:00
|
|
|
// Restoring game
|
2011-09-23 15:21:24 +00:00
|
|
|
if (_vm->gameState().which == 1)
|
2012-10-23 12:46:41 +00:00
|
|
|
// Klaymen is in the car
|
2011-09-23 15:21:24 +00:00
|
|
|
which = 1;
|
|
|
|
else {
|
2012-10-23 12:46:41 +00:00
|
|
|
// Klaymen is standing around
|
2011-09-23 15:21:24 +00:00
|
|
|
setRectList(0x004B47D0);
|
2013-01-21 11:34:50 +00:00
|
|
|
insertKlaymen<KmScene1608>(380, 438);
|
|
|
|
_kmScene1608 = _klaymen;
|
|
|
|
_klaymenInCar = false;
|
2011-09-23 15:21:24 +00:00
|
|
|
_sprite1 = insertStaticSprite(0x7D0404E8, 1100);
|
|
|
|
setMessageList(0x004B46A8);
|
|
|
|
setBackground(0x10080E01);
|
|
|
|
setPalette(0x10080E01);
|
|
|
|
_asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011);
|
2013-01-10 23:17:16 +00:00
|
|
|
addCollisionSprite(_asTape);
|
2013-01-21 11:34:50 +00:00
|
|
|
_klaymen->setClipRect(_sprite1->getDrawRect().x, 0, 640, 480);
|
2012-10-05 21:55:51 +00:00
|
|
|
SetUpdateHandler(&Scene1608::upLowerFloor);
|
2013-01-10 22:52:46 +00:00
|
|
|
insertScreenMouse(0x80E05108);
|
2011-09-23 15:21:24 +00:00
|
|
|
insertStaticSprite(0x4B18F868, 1200);
|
|
|
|
}
|
|
|
|
} else if (which == 0) {
|
2012-10-23 12:46:41 +00:00
|
|
|
// Klaymen entering from the left
|
2011-09-23 15:21:24 +00:00
|
|
|
_vm->gameState().which = 0;
|
|
|
|
setRectList(0x004B47D0);
|
2013-01-21 11:34:50 +00:00
|
|
|
insertKlaymen<KmScene1608>(0, 438);
|
|
|
|
_kmScene1608 = _klaymen;
|
|
|
|
_klaymenInCar = false;
|
2011-09-23 15:21:24 +00:00
|
|
|
setMessageList(0x004B46B0);
|
|
|
|
setBackground(0x10080E01);
|
|
|
|
setPalette(0x10080E01);
|
|
|
|
_asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011);
|
2013-01-10 23:17:16 +00:00
|
|
|
addCollisionSprite(_asTape);
|
2013-01-10 22:52:46 +00:00
|
|
|
insertScreenMouse(0x80E05108);
|
2011-09-23 15:21:24 +00:00
|
|
|
_sprite1 = insertStaticSprite(0x7D0404E8, 1100);
|
2013-01-21 11:34:50 +00:00
|
|
|
_klaymen->setClipRect(_sprite1->getDrawRect().x, 0, 640, 480);
|
2012-10-05 21:55:51 +00:00
|
|
|
SetUpdateHandler(&Scene1608::upLowerFloor);
|
2011-09-23 15:21:24 +00:00
|
|
|
insertStaticSprite(0x4B18F868, 1200);
|
|
|
|
} else if (which == 2) {
|
2012-10-23 12:46:41 +00:00
|
|
|
// Klaymen returning from looking through the upper window
|
2011-09-23 15:21:24 +00:00
|
|
|
_vm->gameState().which = 1;
|
|
|
|
_dataResource.load(0x003C0492);
|
|
|
|
_roomPathPoints = _dataResource.getPointArray(calcHash("meArchroArchRoomPath"));
|
|
|
|
setBackground(0x98001604);
|
|
|
|
setPalette(0x98001604);
|
|
|
|
_palette->addPalette("paPodRed", 65, 31, 65);
|
2013-01-10 22:52:46 +00:00
|
|
|
insertScreenMouse(0x01600988);
|
2011-09-23 15:21:24 +00:00
|
|
|
_sprite2 = insertStaticSprite(0x491F38A8, 1100);
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar = createSprite<AsCommonCar>(this, 375, 227); // Create but don't add to the sprite list yet
|
2012-10-08 11:11:23 +00:00
|
|
|
_asIdleCarLower = insertSprite<AsCommonIdleCarLower>(375, 227);
|
|
|
|
_asIdleCarFull = insertSprite<AsCommonIdleCarFull>(375, 227);
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar->setVisible(false);
|
2013-01-21 11:34:50 +00:00
|
|
|
if (getGlobalVar(V_KLAYMEN_IS_DELTA_X)) {
|
|
|
|
insertKlaymen<KmScene1608>(373, 220);
|
|
|
|
_klaymen->setDoDeltaX(1);
|
2012-10-23 12:46:41 +00:00
|
|
|
} else
|
2013-01-21 11:34:50 +00:00
|
|
|
insertKlaymen<KmScene1608>(283, 220);
|
|
|
|
_kmScene1608 = _klaymen;
|
2011-09-23 15:21:24 +00:00
|
|
|
setMessageList(0x004B47A8);
|
2012-10-05 21:55:51 +00:00
|
|
|
SetMessageHandler(&Scene1608::hmUpperFloor);
|
|
|
|
SetUpdateHandler(&Scene1608::upUpperFloor);
|
|
|
|
_asCar->setPathPoints(_roomPathPoints);
|
|
|
|
sendMessage(_asCar, 0x2002, _roomPathPoints->size() - 1);
|
2011-09-23 15:21:24 +00:00
|
|
|
_sprite3 = insertStaticSprite(0xB47026B0, 1100);
|
2012-10-23 12:46:41 +00:00
|
|
|
_clipRect1.set(_sprite3->getDrawRect().x, _sprite3->getDrawRect().y, 640, _sprite2->getDrawRect().y2());
|
|
|
|
_clipRect3.set(_sprite2->getDrawRect().x, _sprite3->getDrawRect().y, 640, _sprite2->getDrawRect().y2());
|
|
|
|
_clipRect2 = _clipRect1;
|
|
|
|
_clipRect2.y2 = 215;
|
2013-01-21 11:34:50 +00:00
|
|
|
_klaymen->setClipRect(_clipRect1);
|
2012-10-23 12:46:41 +00:00
|
|
|
_asCar->setClipRect(_clipRect1);
|
|
|
|
_asIdleCarLower->setClipRect(_clipRect1);
|
|
|
|
_asIdleCarFull->setClipRect(_clipRect1);
|
2011-09-23 15:21:24 +00:00
|
|
|
_asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011);
|
2013-01-10 23:17:16 +00:00
|
|
|
addCollisionSprite(_asTape);
|
2012-10-23 12:46:41 +00:00
|
|
|
insertSprite<AsCommonCarConnector>(_asCar)->setClipRect(_clipRect1);
|
2013-01-21 11:34:50 +00:00
|
|
|
_klaymenInCar = false;
|
2012-10-05 21:55:51 +00:00
|
|
|
_carClipFlag = false;
|
|
|
|
_carStatus = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
setRectList(0x004B4810);
|
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE: Not in the else because 'which' is set to 1 in the true branch
|
|
|
|
if (which == 1) {
|
2013-01-17 15:19:28 +00:00
|
|
|
// Klaymen riding the car
|
2011-09-23 15:21:24 +00:00
|
|
|
_vm->gameState().which = 1;
|
|
|
|
_dataResource.load(0x003C0492);
|
|
|
|
_roomPathPoints = _dataResource.getPointArray(calcHash("meArchroArchRoomPath"));
|
|
|
|
setBackground(0x98001604);
|
|
|
|
setPalette(0x98001604);
|
|
|
|
_palette->addPalette("paPodRed", 65, 31, 65);
|
2013-01-10 22:52:46 +00:00
|
|
|
insertScreenMouse(0x01600988);
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar = insertSprite<AsCommonCar>(this, 375, 227);
|
2012-10-08 11:11:23 +00:00
|
|
|
_asIdleCarLower = insertSprite<AsCommonIdleCarLower>(375, 227);
|
|
|
|
_asIdleCarFull = insertSprite<AsCommonIdleCarFull>(375, 227);
|
2011-09-23 15:21:24 +00:00
|
|
|
_sprite2 = insertStaticSprite(0x491F38A8, 1100);
|
2012-10-23 12:46:41 +00:00
|
|
|
_kmScene1608 = createSprite<KmScene1608>(this, 439, 220);
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_kmScene1608, 0x2032, 1);
|
|
|
|
_kmScene1608->setDoDeltaX(1);
|
|
|
|
SetMessageHandler(&Scene1608::hmRidingCar);
|
|
|
|
SetUpdateHandler(&Scene1608::upRidingCar);
|
|
|
|
_asIdleCarLower->setVisible(false);
|
|
|
|
_asIdleCarFull->setVisible(false);
|
|
|
|
_asCar->setPathPoints(_roomPathPoints);
|
|
|
|
sendMessage(_asCar, 0x2002, 0);
|
|
|
|
sendMessage(_asCar, 0x2008, 90);
|
2011-09-23 15:21:24 +00:00
|
|
|
_sprite3 = insertStaticSprite(0xB47026B0, 1100);
|
2012-10-23 12:46:41 +00:00
|
|
|
_clipRect1.set(_sprite3->getDrawRect().x, _sprite3->getDrawRect().y, 640, _sprite2->getDrawRect().y2());
|
|
|
|
_clipRect3.set(_sprite2->getDrawRect().x, _sprite3->getDrawRect().y, 640, _sprite2->getDrawRect().y2());
|
|
|
|
_clipRect2 = _clipRect1;
|
|
|
|
_clipRect2.y2 = 215;
|
|
|
|
_kmScene1608->setClipRect(_clipRect1);
|
|
|
|
_asCar->setClipRect(_clipRect1);
|
|
|
|
_asIdleCarLower->setClipRect(_clipRect1);
|
|
|
|
_asIdleCarFull->setClipRect(_clipRect1);
|
2011-09-23 15:21:24 +00:00
|
|
|
_asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011);
|
2013-01-10 23:17:16 +00:00
|
|
|
// ... addCollisionSprite(_asTape);
|
2012-10-23 12:46:41 +00:00
|
|
|
insertSprite<AsCommonCarConnector>(_asCar)->setClipRect(_clipRect1);
|
2013-01-21 11:34:50 +00:00
|
|
|
_klaymenInCar = true;
|
2012-10-05 21:55:51 +00:00
|
|
|
_carClipFlag = true;
|
|
|
|
_carStatus = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_palette->addPalette("paKlayRed", 0, 64, 0);
|
2012-10-23 12:46:41 +00:00
|
|
|
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Scene1608::~Scene1608() {
|
2013-01-21 11:34:50 +00:00
|
|
|
setGlobalVar(V_KLAYMEN_IS_DELTA_X, _kmScene1608->isDoDeltaX() ? 1 : 0);
|
|
|
|
if (_klaymenInCar)
|
2012-10-05 21:55:51 +00:00
|
|
|
delete _kmScene1608;
|
2012-10-23 12:46:41 +00:00
|
|
|
else
|
2012-10-05 21:55:51 +00:00
|
|
|
delete _asCar;
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
void Scene1608::upLowerFloor() {
|
2011-09-23 15:21:24 +00:00
|
|
|
Scene::update();
|
2012-10-23 12:46:41 +00:00
|
|
|
if (_countdown1 != 0 && (--_countdown1 == 0))
|
2011-09-23 15:21:24 +00:00
|
|
|
leaveScene(0);
|
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
void Scene1608::upUpperFloor() {
|
2011-09-23 15:21:24 +00:00
|
|
|
Scene::update();
|
2012-10-05 21:55:51 +00:00
|
|
|
if (_carStatus == 1) {
|
2013-01-21 11:34:50 +00:00
|
|
|
removeSurface(_klaymen->getSurface());
|
|
|
|
removeEntity(_klaymen);
|
2012-10-05 21:55:51 +00:00
|
|
|
addSprite(_asCar);
|
2013-01-21 11:34:50 +00:00
|
|
|
_klaymenInCar = true;
|
2011-09-23 15:21:24 +00:00
|
|
|
clearRectList();
|
2012-10-05 21:55:51 +00:00
|
|
|
SetUpdateHandler(&Scene1608::upCarAtHome);
|
|
|
|
SetMessageHandler(&Scene1608::hmCarAtHome);
|
|
|
|
_asIdleCarLower->setVisible(false);
|
|
|
|
_asIdleCarFull->setVisible(false);
|
|
|
|
_asCar->setVisible(true);
|
|
|
|
sendMessage(_asCar, 0x2009, 0);
|
|
|
|
_asCar->handleUpdate();
|
2013-01-21 11:34:50 +00:00
|
|
|
_klaymen = NULL;
|
2012-10-05 21:55:51 +00:00
|
|
|
_carStatus = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
2013-01-21 11:34:50 +00:00
|
|
|
updateKlaymenCliprect();
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
void Scene1608::upCarAtHome() {
|
2011-09-23 15:21:24 +00:00
|
|
|
Scene::update();
|
|
|
|
if (_mouseClicked) {
|
2012-10-05 21:55:51 +00:00
|
|
|
if (_mouseClickPos.x <= 329 && _asCar->getX() == 375 && _asCar->getY() == 227) {
|
|
|
|
sendMessage(_asCar, 0x200A, 0);
|
|
|
|
SetUpdateHandler(&Scene1608::upGettingOutOfCar);
|
2011-09-23 15:21:24 +00:00
|
|
|
} else {
|
2012-10-05 21:55:51 +00:00
|
|
|
sendPointMessage(_asCar, 0x2004, _mouseClickPos);
|
|
|
|
SetMessageHandler(&Scene1608::hmRidingCar);
|
|
|
|
SetUpdateHandler(&Scene1608::upRidingCar);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
_mouseClicked = false;
|
|
|
|
}
|
2013-01-21 11:34:50 +00:00
|
|
|
updateKlaymenCliprect();
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
void Scene1608::upGettingOutOfCar() {
|
2011-09-23 15:21:24 +00:00
|
|
|
Scene::update();
|
2012-10-05 21:55:51 +00:00
|
|
|
if (_carStatus == 2) {
|
2013-01-21 11:34:50 +00:00
|
|
|
_klaymen = _kmScene1608;
|
2012-10-05 21:55:51 +00:00
|
|
|
removeSurface(_asCar->getSurface());
|
|
|
|
removeEntity(_asCar);
|
2013-01-21 11:34:50 +00:00
|
|
|
addSprite(_klaymen);
|
|
|
|
_klaymenInCar = false;
|
2012-10-05 21:55:51 +00:00
|
|
|
SetMessageHandler(&Scene1608::hmUpperFloor);
|
2012-10-17 13:07:52 +00:00
|
|
|
SetUpdateHandler(&Scene1608::upUpperFloor);
|
2011-09-23 15:21:24 +00:00
|
|
|
setRectList(0x004B4810);
|
2012-10-05 21:55:51 +00:00
|
|
|
_asIdleCarLower->setVisible(true);
|
|
|
|
_asIdleCarFull->setVisible(true);
|
|
|
|
_asCar->setVisible(false);
|
2011-09-23 15:21:24 +00:00
|
|
|
setMessageList(0x004B4748);
|
2012-10-09 18:30:39 +00:00
|
|
|
processMessageList();
|
2013-01-21 11:34:50 +00:00
|
|
|
_klaymen->handleUpdate();
|
2012-10-05 21:55:51 +00:00
|
|
|
_carStatus = 0;
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
2013-01-21 11:34:50 +00:00
|
|
|
updateKlaymenCliprect();
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
void Scene1608::upRidingCar() {
|
2011-09-23 15:21:24 +00:00
|
|
|
Scene::update();
|
|
|
|
if (_mouseClicked) {
|
2012-10-05 21:55:51 +00:00
|
|
|
sendPointMessage(_asCar, 0x2004, _mouseClickPos);
|
2011-09-23 15:21:24 +00:00
|
|
|
_mouseClicked = false;
|
|
|
|
}
|
2012-10-05 21:55:51 +00:00
|
|
|
if (_asCar->getX() < 300) {
|
|
|
|
if (_carClipFlag) {
|
|
|
|
_carClipFlag = false;
|
2012-10-23 12:46:41 +00:00
|
|
|
_asCar->setClipRect(_clipRect1);
|
2012-10-05 21:55:51 +00:00
|
|
|
if (!_asCar->isDoDeltaX())
|
|
|
|
sendMessage(_asCar, 0x200E, 0);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
2012-10-05 21:55:51 +00:00
|
|
|
} else if (!_carClipFlag) {
|
|
|
|
_carClipFlag = true;
|
2012-10-23 12:46:41 +00:00
|
|
|
_asCar->setClipRect(_clipRect3);
|
2011-09-23 15:21:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
uint32 Scene1608::hmLowerFloor(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-09-23 15:21:24 +00:00
|
|
|
Scene::handleMessage(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
|
|
|
if (param.asInteger() == 0x20250B1A) {
|
|
|
|
clearRectList();
|
2013-01-21 11:34:50 +00:00
|
|
|
_klaymen->setVisible(false);
|
2011-09-23 15:21:24 +00:00
|
|
|
showMouse(false);
|
|
|
|
_sprite1->setVisible(false);
|
2012-10-23 12:46:41 +00:00
|
|
|
//sendMessage(_asDoor, 0x4809, 0); // Play sound?
|
2011-09-23 15:21:24 +00:00
|
|
|
_countdown1 = 28;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x200D:
|
|
|
|
sendMessage(_parentModule, 0x200D, 0);
|
|
|
|
break;
|
|
|
|
case 0x4826:
|
|
|
|
if (sender == _asTape) {
|
2012-10-05 21:55:51 +00:00
|
|
|
sendEntityMessage(_kmScene1608, 0x1014, _asTape);
|
2011-09-23 15:21:24 +00:00
|
|
|
setMessageList(0x004B4770);
|
2012-10-23 12:46:41 +00:00
|
|
|
} else if (sender == _asKey)
|
2011-09-23 15:21:24 +00:00
|
|
|
setMessageList(0x004B46C8);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
uint32 Scene1608::hmUpperFloor(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-09-23 15:21:24 +00:00
|
|
|
Scene::handleMessage(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x100D:
|
2012-10-23 12:46:41 +00:00
|
|
|
if (param.asInteger() == 0x60842040)
|
2012-10-05 21:55:51 +00:00
|
|
|
_carStatus = 1;
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x200D:
|
|
|
|
sendMessage(_parentModule, 0x200D, 0);
|
|
|
|
break;
|
|
|
|
case 0x4826:
|
2012-10-08 07:40:39 +00:00
|
|
|
if (sender == _asKey) {
|
|
|
|
sendEntityMessage(_kmScene1608, 0x1014, _asKey);
|
2011-09-23 15:21:24 +00:00
|
|
|
setMessageList(0x004B4760);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
uint32 Scene1608::hmRidingCar(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-09-23 15:21:24 +00:00
|
|
|
Scene::handleMessage(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x2005:
|
|
|
|
leaveScene(1);
|
|
|
|
break;
|
|
|
|
case 0x2006:
|
2012-10-05 21:55:51 +00:00
|
|
|
SetMessageHandler(&Scene1608::hmCarAtHome);
|
|
|
|
SetUpdateHandler(&Scene1608::upCarAtHome);
|
|
|
|
sendMessage(_asCar, 0x200F, 1);
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x200D:
|
|
|
|
sendMessage(_parentModule, 0x200D, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
uint32 Scene1608::hmCarAtHome(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-09-23 15:21:24 +00:00
|
|
|
Scene::handleMessage(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x200A:
|
2012-10-05 21:55:51 +00:00
|
|
|
_carStatus = 2;
|
2011-09-23 15:21:24 +00:00
|
|
|
break;
|
|
|
|
case 0x200D:
|
|
|
|
sendMessage(_parentModule, 0x200D, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-01-21 11:34:50 +00:00
|
|
|
void Scene1608::updateKlaymenCliprect() {
|
2012-10-05 21:55:51 +00:00
|
|
|
if (_kmScene1608->getX() <= 375)
|
2012-10-23 12:46:41 +00:00
|
|
|
_kmScene1608->setClipRect(_clipRect1);
|
2012-10-05 21:55:51 +00:00
|
|
|
else
|
2012-10-23 12:46:41 +00:00
|
|
|
_kmScene1608->setClipRect(_clipRect2);
|
2012-10-05 21:55:51 +00:00
|
|
|
}
|
|
|
|
|
2012-10-23 12:46:41 +00:00
|
|
|
Scene1609::Scene1609(NeverhoodEngine *vm, Module *parentModule)
|
2013-01-10 23:17:16 +00:00
|
|
|
: Scene(vm, parentModule), _countdown1(1), _currentSymbolIndex(0), _symbolPosition(0), _changeCurrentSymbol(true), _isSolved(false) {
|
2011-09-24 20:37:14 +00:00
|
|
|
|
2012-11-13 13:19:49 +00:00
|
|
|
_vm->gameModule()->initCodeSymbolsPuzzle();
|
2012-10-10 21:10:51 +00:00
|
|
|
_noisySymbolIndex = getGlobalVar(V_NOISY_SYMBOL_INDEX);
|
2011-09-24 20:37:14 +00:00
|
|
|
|
|
|
|
SetMessageHandler(&Scene1609::handleMessage);
|
|
|
|
SetUpdateHandler(&Scene1609::update);
|
|
|
|
|
|
|
|
setBackground(0x92124A14);
|
|
|
|
setPalette(0x92124A14);
|
2013-01-10 22:52:46 +00:00
|
|
|
insertPuzzleMouse(0x24A10929, 20, 620);
|
2011-09-24 20:37:14 +00:00
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
for (int symbolPosition = 0; symbolPosition < 12; symbolPosition++)
|
|
|
|
_asSymbols[symbolPosition] = insertSprite<AsScene3011Symbol>(symbolPosition, false);
|
2011-09-24 20:37:14 +00:00
|
|
|
|
|
|
|
_ssButton = insertSprite<SsScene3011Button>(this, true);
|
2013-01-10 23:17:16 +00:00
|
|
|
addCollisionSprite(_ssButton);
|
2012-10-01 08:08:18 +00:00
|
|
|
loadSound(0, 0x68E25540);
|
2011-09-24 20:37:14 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene1609::update() {
|
2012-10-05 21:55:51 +00:00
|
|
|
if (!_isSolved && _countdown1 != 0 && (--_countdown1 == 0)) {
|
|
|
|
if (_changeCurrentSymbol) {
|
|
|
|
_currentSymbolIndex++;
|
|
|
|
if (_currentSymbolIndex >= 12)
|
|
|
|
_currentSymbolIndex = 0;
|
2012-10-11 15:34:11 +00:00
|
|
|
_asSymbols[_symbolPosition]->change(_currentSymbolIndex + 12, _currentSymbolIndex == (int)getSubVar(VA_CODE_SYMBOLS, _noisySymbolIndex));
|
2012-10-05 21:55:51 +00:00
|
|
|
_changeCurrentSymbol = false;
|
2011-09-24 20:37:14 +00:00
|
|
|
_countdown1 = 36;
|
|
|
|
} else {
|
2012-10-05 21:55:51 +00:00
|
|
|
_asSymbols[_symbolPosition]->hide();
|
|
|
|
_changeCurrentSymbol = true;
|
2011-09-24 20:37:14 +00:00
|
|
|
_countdown1 = 12;
|
|
|
|
}
|
|
|
|
}
|
2012-10-23 12:46:41 +00:00
|
|
|
if (_isSolved && !isSoundPlaying(0))
|
2011-09-24 20:37:14 +00:00
|
|
|
leaveScene(1);
|
|
|
|
Scene::update();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Scene1609::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
Scene::handleMessage(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x0001:
|
|
|
|
if (param.asPoint().x <= 20 || param.asPoint().x >= 620)
|
|
|
|
leaveScene(0);
|
|
|
|
break;
|
|
|
|
case 0x2000:
|
2012-10-05 21:55:51 +00:00
|
|
|
if (!_isSolved) {
|
|
|
|
if (_changeCurrentSymbol)
|
|
|
|
_asSymbols[_symbolPosition]->change(_currentSymbolIndex + 12, false);
|
|
|
|
_asSymbols[_symbolPosition]->stopSymbolSound();
|
|
|
|
_symbolPosition++;
|
|
|
|
if (_symbolPosition >= 12) {
|
2011-09-24 20:37:14 +00:00
|
|
|
if (testVars()) {
|
2012-10-01 08:08:18 +00:00
|
|
|
playSound(0);
|
2012-10-15 21:32:54 +00:00
|
|
|
setGlobalVar(V_CODE_SYMBOLS_SOLVED, 1);
|
2012-10-05 21:55:51 +00:00
|
|
|
_isSolved = true;
|
2011-09-24 20:37:14 +00:00
|
|
|
} else {
|
2012-10-05 21:55:51 +00:00
|
|
|
_symbolPosition = 0;
|
2011-09-24 20:37:14 +00:00
|
|
|
for (int i = 0; i < 12; i++)
|
|
|
|
_asSymbols[i]->hide();
|
|
|
|
}
|
|
|
|
}
|
2012-10-05 21:55:51 +00:00
|
|
|
_changeCurrentSymbol = true;
|
2011-09-24 20:37:14 +00:00
|
|
|
_countdown1 = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Scene1609::testVars() {
|
2012-10-09 11:36:44 +00:00
|
|
|
int cmpSymbolIndex = 0;
|
2012-10-05 21:55:51 +00:00
|
|
|
|
|
|
|
// Find the position of the first symbol
|
2012-10-11 15:34:11 +00:00
|
|
|
while ((int)getSubVar(VA_CODE_SYMBOLS, cmpSymbolIndex) != _asSymbols[0]->getSymbolIndex())
|
2012-10-09 11:36:44 +00:00
|
|
|
cmpSymbolIndex++;
|
2012-10-05 21:55:51 +00:00
|
|
|
|
|
|
|
// Check if the entered symbols match
|
2012-10-09 11:36:44 +00:00
|
|
|
for (int enteredSymbolIndex = 0; enteredSymbolIndex < 12; enteredSymbolIndex++) {
|
2012-10-11 15:34:11 +00:00
|
|
|
if ((int)getSubVar(VA_CODE_SYMBOLS, cmpSymbolIndex) != _asSymbols[enteredSymbolIndex]->getSymbolIndex())
|
2011-09-24 20:37:14 +00:00
|
|
|
return false;
|
2012-10-09 11:36:44 +00:00
|
|
|
cmpSymbolIndex++;
|
|
|
|
if (cmpSymbolIndex >= 12)
|
|
|
|
cmpSymbolIndex = 0;
|
2011-09-24 20:37:14 +00:00
|
|
|
}
|
2012-10-05 21:55:51 +00:00
|
|
|
|
2011-09-24 20:37:14 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-09-23 15:21:24 +00:00
|
|
|
} // End of namespace Neverhood
|