2011-10-12 13:13: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/module2700.h"
|
|
|
|
#include "neverhood/gamemodule.h"
|
|
|
|
#include "neverhood/module1000.h"
|
|
|
|
|
|
|
|
namespace Neverhood {
|
|
|
|
|
|
|
|
static const NRect kScene2710ClipRect = NRect(0, 0, 626, 480);
|
|
|
|
|
|
|
|
static const uint32 kScene2710StaticSprites[] = {
|
|
|
|
0x0D2016C0,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static const NRect kScene2711ClipRect = NRect(0, 0, 521, 480);
|
|
|
|
|
|
|
|
static const uint32 kScene2711FileHashes1[] = {
|
|
|
|
0,
|
|
|
|
0x100801A1,
|
|
|
|
0x201081A0,
|
|
|
|
0x006800A4,
|
|
|
|
0x40390120,
|
|
|
|
0x000001B1,
|
|
|
|
0x001000A1,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static const uint32 kScene2711FileHashes2[] = {
|
|
|
|
0,
|
|
|
|
0x40403308,
|
|
|
|
0x71403168,
|
|
|
|
0x80423928,
|
|
|
|
0x224131A8,
|
|
|
|
0x50401328,
|
|
|
|
0x70423328,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static const uint32 kScene2711FileHashes3[] = {
|
|
|
|
0,
|
|
|
|
0x1088A021,
|
|
|
|
0x108120E5,
|
|
|
|
0x18A02321,
|
|
|
|
0x148221A9,
|
|
|
|
0x10082061,
|
|
|
|
0x188820E1,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static const NRect kScene2724ClipRect = NRect(0, 141, 640, 480);
|
|
|
|
|
|
|
|
static const uint32 kScene2724StaticSprites[] = {
|
|
|
|
0xC20D00A5,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static const NRect kScene2725ClipRect = NRect(0, 0, 640, 413);
|
|
|
|
|
|
|
|
static const uint32 kScene2725StaticSprites[] = {
|
|
|
|
0xC20E00A5,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
Module2700::Module2700(NeverhoodEngine *vm, Module *parentModule, int which)
|
2012-10-18 17:15:20 +00:00
|
|
|
: Module(vm, parentModule), _soundIndex(0), _raidoMusicInitialized(false) {
|
2011-10-12 13:13:24 +00:00
|
|
|
|
2012-09-23 12:12:37 +00:00
|
|
|
_vm->_soundMan->addMusic(0x42212411, 0x04020210);
|
|
|
|
_vm->_soundMan->startMusic(0x04020210, 24, 2);
|
2011-10-12 13:13:24 +00:00
|
|
|
SetMessageHandler(&Module2700::handleMessage);
|
|
|
|
|
|
|
|
if (which < 0) {
|
|
|
|
which = _vm->gameState().which;
|
2012-10-24 13:33:00 +00:00
|
|
|
// Scenes 0, 30 and 31 are "normal" scenes, whereas the other scenes are tracks.
|
|
|
|
// "gameState().which" indicates which track the car is at.
|
2011-10-12 13:13:24 +00:00
|
|
|
if (_vm->gameState().sceneNum == 0 || _vm->gameState().sceneNum == 30 || _vm->gameState().sceneNum == 31)
|
|
|
|
which = -1;
|
|
|
|
createScene(_vm->gameState().sceneNum, which);
|
2012-10-24 13:33:00 +00:00
|
|
|
} else
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene(0, 0);
|
|
|
|
|
2012-10-01 11:11:38 +00:00
|
|
|
loadSound(0, 0x00880CCC);
|
|
|
|
loadSound(1, 0x00880CC0);
|
|
|
|
loadSound(2, 0x00880CCC);
|
|
|
|
loadSound(3, 0x00880CC0);
|
2011-10-12 13:13:24 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Module2700::~Module2700() {
|
2012-09-23 12:12:37 +00:00
|
|
|
_vm->_soundMan->deleteGroup(0x42212411);
|
2011-10-12 13:13:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Module2700::createScene(int sceneNum, int which) {
|
|
|
|
debug("Module2700::createScene(%d, %d)", sceneNum, which);
|
2012-10-24 13:33:00 +00:00
|
|
|
_sceneNum = sceneNum;
|
|
|
|
switch (_sceneNum) {
|
2011-10-12 13:13:24 +00:00
|
|
|
case 0:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 0;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-14 12:25:31 +00:00
|
|
|
_childObject = new Scene2701(_vm, this, which);
|
2011-10-12 13:13:24 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 1;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-17 15:32:56 +00:00
|
|
|
_childObject = new Scene2702(_vm, this, which);
|
2011-10-12 13:13:24 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 2;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
if (which == 6 || which == 7)
|
|
|
|
createScene2703(which, 0x004B1710);
|
|
|
|
else if (which == 4 || which == 5)
|
|
|
|
createScene2703(which, 0x004B1738);
|
|
|
|
else if (which == 2 || which == 3)
|
|
|
|
createScene2703(which, 0x004B1760);
|
|
|
|
else
|
|
|
|
createScene2703(which, 0x004B1788);
|
|
|
|
break;
|
|
|
|
case 3:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 3;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B17B0, 150);
|
|
|
|
break;
|
|
|
|
case 4:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 4;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B17D8, 150);
|
|
|
|
break;
|
|
|
|
case 5:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 5;
|
|
|
|
_vm->gameState().which = which;
|
|
|
|
if (which >= 4)
|
2011-10-14 08:11:10 +00:00
|
|
|
_childObject = new Scene2706(_vm, this, which);
|
2012-10-24 13:33:00 +00:00
|
|
|
else if (which == 2 || which == 3)
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1828, 150);
|
2012-10-24 13:33:00 +00:00
|
|
|
else
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1800, 150);
|
|
|
|
break;
|
|
|
|
case 6:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 6;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1850, 150);
|
|
|
|
break;
|
|
|
|
case 7:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 7;
|
|
|
|
_vm->gameState().which = which;
|
|
|
|
if (which == 2 || which == 3)
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1878, 150);
|
2012-10-24 13:33:00 +00:00
|
|
|
else
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B18A0, 150);
|
|
|
|
break;
|
|
|
|
case 8:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 8;
|
|
|
|
_vm->gameState().which = which;
|
|
|
|
if (which == 2 || which == 3)
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B18C8, 150);
|
2012-10-24 13:33:00 +00:00
|
|
|
else
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B18F0, 150);
|
|
|
|
break;
|
|
|
|
case 9:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 9;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-13 10:43:58 +00:00
|
|
|
createScene2704(which, 0x004B1918, 150, kScene2710StaticSprites, &kScene2710ClipRect);
|
2011-10-12 13:13:24 +00:00
|
|
|
break;
|
|
|
|
case 10:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 10;
|
|
|
|
_vm->gameState().which = which;
|
2012-11-16 21:26:15 +00:00
|
|
|
_vm->gameModule()->initTestTubes2Puzzle();
|
2012-10-11 15:34:11 +00:00
|
|
|
_scene2711StaticSprites[0] = kScene2711FileHashes1[getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 2)];
|
|
|
|
_scene2711StaticSprites[1] = kScene2711FileHashes2[getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 1)];
|
|
|
|
_scene2711StaticSprites[2] = kScene2711FileHashes3[getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 0)];
|
2011-10-12 13:13:24 +00:00
|
|
|
_scene2711StaticSprites[3] = 0x0261282E;
|
|
|
|
_scene2711StaticSprites[4] = 0x9608E5A0;
|
|
|
|
_scene2711StaticSprites[5] = 0;
|
|
|
|
createScene2704(which, 0x004B1950, 150, _scene2711StaticSprites, &kScene2711ClipRect);
|
|
|
|
break;
|
|
|
|
case 11:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 11;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B19E0, 150);
|
|
|
|
break;
|
|
|
|
case 12:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 12;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1A08, 150);
|
|
|
|
break;
|
|
|
|
case 13:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 13;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1A30, 150);
|
|
|
|
break;
|
|
|
|
case 14:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 14;
|
|
|
|
_vm->gameState().which = which;
|
|
|
|
if (which == 4 || which == 5)
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1A58, 150);
|
2012-10-24 13:33:00 +00:00
|
|
|
else if (which == 2 || which == 3)
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1A80, 150);
|
2012-10-24 13:33:00 +00:00
|
|
|
else
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1AA8, 150);
|
|
|
|
break;
|
|
|
|
case 15:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 15;
|
|
|
|
_vm->gameState().which = which;
|
|
|
|
if (which == 4 || which == 5)
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1AD0, 150);
|
2012-10-24 13:33:00 +00:00
|
|
|
else if (which == 2 || which == 3)
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1AF8, 150);
|
2012-10-24 13:33:00 +00:00
|
|
|
else
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1B20, 150);
|
|
|
|
break;
|
|
|
|
case 16:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 16;
|
|
|
|
_vm->gameState().which = which;
|
|
|
|
if (which == 4 || which == 5)
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1B48, 150);
|
2012-10-24 13:33:00 +00:00
|
|
|
else if (which == 2 || which == 3)
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1B70, 150);
|
2012-10-24 13:33:00 +00:00
|
|
|
else
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1B98, 150);
|
|
|
|
break;
|
|
|
|
case 17:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 17;
|
|
|
|
_vm->gameState().which = which;
|
|
|
|
if (which == 4 || which == 5)
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1BC0, 150);
|
2012-10-24 13:33:00 +00:00
|
|
|
else if (which == 2 || which == 3)
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1BE8, 150);
|
2012-10-24 13:33:00 +00:00
|
|
|
else
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1C10, 150);
|
|
|
|
break;
|
|
|
|
case 18:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 18;
|
|
|
|
_vm->gameState().which = which;
|
|
|
|
if (which == 2 || which == 3)
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1C38, 150);
|
2012-10-24 13:33:00 +00:00
|
|
|
else
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1C60, 150);
|
|
|
|
break;
|
|
|
|
case 19:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 19;
|
|
|
|
_vm->gameState().which = which;
|
|
|
|
if (which == 2 || which == 3)
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1CB0, 150);
|
2012-10-24 13:33:00 +00:00
|
|
|
else
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1C88, 150);
|
|
|
|
break;
|
|
|
|
case 20:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 20;
|
|
|
|
_vm->gameState().which = which;
|
|
|
|
if (which == 2 || which == 3)
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1CD8, 150);
|
2012-10-24 13:33:00 +00:00
|
|
|
else
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1D00, 150);
|
|
|
|
break;
|
|
|
|
case 21:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 21;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1D28, 150);
|
|
|
|
break;
|
|
|
|
case 22:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 22;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1D50, 150);
|
|
|
|
break;
|
|
|
|
case 23:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 23;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1D78, 150, kScene2724StaticSprites, &kScene2724ClipRect);
|
|
|
|
break;
|
|
|
|
case 24:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 24;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1DB0, 150, kScene2725StaticSprites, &kScene2725ClipRect);
|
|
|
|
break;
|
|
|
|
case 25:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 25;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1DE8, 150);
|
|
|
|
break;
|
|
|
|
case 26:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 26;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1E10, 150);
|
|
|
|
break;
|
|
|
|
case 27:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 27;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1E38, 150);
|
|
|
|
break;
|
|
|
|
case 28:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 28;
|
|
|
|
_vm->gameState().which = which;
|
2011-10-12 13:13:24 +00:00
|
|
|
createScene2704(which, 0x004B1E60, 150);
|
|
|
|
break;
|
|
|
|
case 30:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 30;
|
2012-10-08 07:40:39 +00:00
|
|
|
createStaticScene(0x09507248, 0x0724C09D);
|
2011-10-12 13:13:24 +00:00
|
|
|
break;
|
|
|
|
case 31:
|
2012-10-24 13:33:00 +00:00
|
|
|
_vm->gameState().sceneNum = 31;
|
|
|
|
_childObject = new Scene2732(_vm, this);
|
2011-10-12 13:13:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
SetUpdateHandler(&Module2700::updateScene);
|
|
|
|
_childObject->handleUpdate();
|
|
|
|
}
|
|
|
|
|
2011-10-13 10:43:58 +00:00
|
|
|
#define SceneLinkIf(moduleResult, sceneNum, which) \
|
|
|
|
if (_moduleResult == moduleResult) { createScene(sceneNum, which); break; }
|
|
|
|
|
2011-10-12 13:13:24 +00:00
|
|
|
void Module2700::updateScene() {
|
|
|
|
if (!updateChild()) {
|
2012-10-24 13:33:00 +00:00
|
|
|
switch (_sceneNum) {
|
2011-10-12 13:13:24 +00:00
|
|
|
case 0:
|
2011-10-13 10:43:58 +00:00
|
|
|
SceneLinkIf(1, 1, 0);
|
|
|
|
leaveModule(0);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
SceneLinkIf(1, 14, 1);
|
|
|
|
SceneLinkIf(2, 2, 2);
|
|
|
|
SceneLinkIf(3, 14, 3);
|
|
|
|
SceneLinkIf(4, 2, 6);
|
|
|
|
SceneLinkIf(5, 2, 4);
|
|
|
|
createScene(0, 1);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
SceneLinkIf(1, 5, 0);
|
|
|
|
SceneLinkIf(2, 1, 2);
|
|
|
|
SceneLinkIf(3, 5, 2);
|
|
|
|
SceneLinkIf(4, 1, 5);
|
|
|
|
SceneLinkIf(5, 5, 4);
|
|
|
|
SceneLinkIf(6, 1, 4);
|
|
|
|
SceneLinkIf(7, 11, 0);
|
|
|
|
createScene(3, 0);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
createScene(2, 0);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
SceneLinkIf(1, 7, 2);
|
|
|
|
createScene(5, 5);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
SceneLinkIf(1, 6, 0);
|
|
|
|
SceneLinkIf(2, 2, 3);
|
|
|
|
SceneLinkIf(3, 8, 2);
|
|
|
|
SceneLinkIf(4, 2, 5);
|
|
|
|
SceneLinkIf(5, 4, 0);
|
|
|
|
SceneLinkIf(6, 7, 0);
|
|
|
|
createScene(2, 1);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
SceneLinkIf(1, 8, 0);
|
|
|
|
createScene(5, 1);
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
SceneLinkIf(1, 8, 3);
|
|
|
|
SceneLinkIf(2, 4, 1);
|
|
|
|
SceneLinkIf(3, 9, 0);
|
|
|
|
createScene(5, 6);
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
SceneLinkIf(1, 10, 0);
|
|
|
|
SceneLinkIf(2, 5, 3);
|
|
|
|
SceneLinkIf(3, 7, 1);
|
|
|
|
createScene(6, 1);
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
SceneLinkIf(1, 10, 1);
|
|
|
|
createScene(7, 3);
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
SceneLinkIf(1, 9, 1);
|
|
|
|
createScene(8, 1);
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
SceneLinkIf(1, 12, 0);
|
|
|
|
createScene(2, 7);
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
SceneLinkIf(1, 13, 0);
|
|
|
|
createScene(11, 1);
|
|
|
|
break;
|
|
|
|
case 13:
|
|
|
|
SceneLinkIf(1, 30, 0);
|
|
|
|
createScene(12, 1);
|
|
|
|
break;
|
|
|
|
case 14:
|
|
|
|
SceneLinkIf(1, 1, 1);
|
|
|
|
SceneLinkIf(2, 15, 3);
|
|
|
|
SceneLinkIf(3, 1, 3);
|
|
|
|
SceneLinkIf(4, 15, 5);
|
|
|
|
SceneLinkIf(5, 22, 0);
|
|
|
|
createScene(15, 1);
|
|
|
|
break;
|
|
|
|
case 15:
|
|
|
|
SceneLinkIf(1, 14, 0);
|
|
|
|
SceneLinkIf(2, 16, 3);
|
|
|
|
SceneLinkIf(3, 14, 2);
|
|
|
|
SceneLinkIf(4, 16, 5);
|
|
|
|
SceneLinkIf(5, 14, 4);
|
|
|
|
createScene(16, 1);
|
|
|
|
break;
|
|
|
|
case 16:
|
|
|
|
SceneLinkIf(1, 15, 0);
|
|
|
|
SceneLinkIf(2, 17, 3);
|
|
|
|
SceneLinkIf(3, 15, 2);
|
|
|
|
SceneLinkIf(4, 17, 5);
|
|
|
|
SceneLinkIf(5, 15, 4);
|
|
|
|
createScene(17, 1);
|
|
|
|
break;
|
|
|
|
case 17:
|
|
|
|
SceneLinkIf(1, 16, 0);
|
|
|
|
SceneLinkIf(2, 18, 3);
|
|
|
|
SceneLinkIf(3, 16, 2);
|
|
|
|
SceneLinkIf(4, 20, 1);
|
|
|
|
SceneLinkIf(5, 16, 4);
|
|
|
|
createScene(18, 1);
|
|
|
|
break;
|
|
|
|
case 18:
|
|
|
|
SceneLinkIf(1, 17, 0);
|
|
|
|
SceneLinkIf(2, 19, 2);
|
|
|
|
SceneLinkIf(3, 17, 2);
|
|
|
|
createScene(19, 0);
|
|
|
|
break;
|
|
|
|
case 19:
|
|
|
|
SceneLinkIf(1, 20, 2);
|
|
|
|
SceneLinkIf(2, 18, 2);
|
|
|
|
SceneLinkIf(3, 20, 0);
|
|
|
|
createScene(18, 0);
|
|
|
|
break;
|
|
|
|
case 20:
|
|
|
|
SceneLinkIf(1, 17, 4);
|
|
|
|
SceneLinkIf(2, 19, 1);
|
|
|
|
SceneLinkIf(3, 21, 0);
|
|
|
|
createScene(19, 3);
|
|
|
|
break;
|
|
|
|
case 21:
|
2012-09-23 12:12:37 +00:00
|
|
|
_vm->_soundMan->deleteMusic(_musicFileHash);
|
|
|
|
_vm->_soundMan->startMusic(0x04020210, 0, 2);
|
|
|
|
_vm->_soundMan->deleteSoundGroup(0x42212411);
|
2011-10-13 10:43:58 +00:00
|
|
|
createScene(20, 3);
|
|
|
|
break;
|
|
|
|
case 22:
|
|
|
|
SceneLinkIf(1, 23, 0);
|
|
|
|
createScene(14, 5);
|
|
|
|
break;
|
|
|
|
case 23:
|
|
|
|
SceneLinkIf(1, 24, 0);
|
|
|
|
createScene(22, 1);
|
|
|
|
break;
|
|
|
|
case 24:
|
|
|
|
SceneLinkIf(1, 25, 0);
|
|
|
|
createScene(23, 1);
|
|
|
|
break;
|
|
|
|
case 25:
|
|
|
|
SceneLinkIf(1, 26, 0);
|
|
|
|
createScene(24, 1);
|
|
|
|
break;
|
|
|
|
case 26:
|
|
|
|
SceneLinkIf(1, 27, 0);
|
|
|
|
createScene(25, 1);
|
|
|
|
break;
|
|
|
|
case 27:
|
|
|
|
SceneLinkIf(1, 28, 0);
|
|
|
|
createScene(26, 1);
|
|
|
|
break;
|
|
|
|
case 28:
|
|
|
|
SceneLinkIf(1, 31, 0);
|
|
|
|
createScene(27, 1);
|
|
|
|
break;
|
2012-10-24 13:33:00 +00:00
|
|
|
case 30:
|
2011-10-13 10:43:58 +00:00
|
|
|
createScene(13, 1);
|
|
|
|
break;
|
2012-10-24 13:33:00 +00:00
|
|
|
case 31:
|
2011-10-13 10:43:58 +00:00
|
|
|
createScene(28, 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
2012-10-24 13:33:00 +00:00
|
|
|
switch (_sceneNum) {
|
2011-10-13 10:43:58 +00:00
|
|
|
case 21:
|
2012-10-18 17:15:20 +00:00
|
|
|
if (!_raidoMusicInitialized) {
|
2012-09-23 12:12:37 +00:00
|
|
|
_vm->_soundMan->stopMusic(0x04020210, 0, 1);
|
2012-10-18 17:15:20 +00:00
|
|
|
_vm->gameModule()->initRadioPuzzle();
|
2012-10-15 21:32:54 +00:00
|
|
|
_musicFileHash = getGlobalVar(V_GOOD_RADIO_MUSIC_NAME);
|
2012-09-23 12:12:37 +00:00
|
|
|
_vm->_soundMan->addMusic(0x42212411, _musicFileHash);
|
2013-01-17 15:24:13 +00:00
|
|
|
_vm->_soundMan->startMusic(_musicFileHash, 0, 2);
|
2012-09-23 12:12:37 +00:00
|
|
|
_vm->_soundMan->addSound(0x42212411, 0x44014282);
|
|
|
|
_vm->_soundMan->setSoundParams(0x44014282, true, 120, 360, 72, 0);
|
2012-10-18 17:15:20 +00:00
|
|
|
_raidoMusicInitialized = true;
|
2011-10-12 13:13:24 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Module2700::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
uint32 messageResult = Module::handleMessage(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x200D:
|
2012-10-01 11:11:38 +00:00
|
|
|
playSound(_soundIndex);
|
2011-10-12 13:13:24 +00:00
|
|
|
_soundIndex++;
|
|
|
|
if (_soundIndex >= 4)
|
|
|
|
_soundIndex = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return messageResult;
|
|
|
|
}
|
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
void Module2700::createScene2703(int which, uint32 trackInfoId) {
|
|
|
|
_childObject = new Scene2703(_vm, this, which, trackInfoId);
|
2011-10-12 13:13:24 +00:00
|
|
|
}
|
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
void Module2700::createScene2704(int which, uint32 trackInfoId, int16 value, const uint32 *staticSprites, const NRect *clipRect) {
|
|
|
|
_childObject = new Scene2704(_vm, this, which, trackInfoId, value, staticSprites, clipRect);
|
2011-10-13 10:43:58 +00:00
|
|
|
}
|
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
static const NPoint kCarShadowOffsets[] = {
|
2012-10-24 13:33:00 +00:00
|
|
|
{-63, 3}, {-48, 40}, {-33, 58},
|
|
|
|
{ 0, 65}, { 40, 53}, { 56, 27},
|
|
|
|
{ 63, 0}, {-30, 26}, { 0, 30},
|
2012-09-14 22:38:31 +00:00
|
|
|
{ 26, 25}
|
|
|
|
};
|
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
SsCommonTrackShadowBackground::SsCommonTrackShadowBackground(NeverhoodEngine *vm, uint32 fileHash)
|
2011-10-17 17:58:51 +00:00
|
|
|
: StaticSprite(vm, 0) {
|
|
|
|
|
2012-10-22 18:09:27 +00:00
|
|
|
loadSprite(fileHash, kSLFDefDrawOffset | kSLFDefPosition, 0);
|
2011-10-17 17:58:51 +00:00
|
|
|
}
|
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
AsCommonCarShadow::AsCommonCarShadow(NeverhoodEngine *vm, AnimatedSprite *asCar, BaseSurface *shadowSurface, uint index)
|
2012-10-05 21:55:51 +00:00
|
|
|
: AnimatedSprite(vm, 1100), _asCar(asCar), _index(index), _animFileHash(0) {
|
2012-09-14 22:38:31 +00:00
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
SetUpdateHandler(&AsCommonCarShadow::update);
|
2012-10-18 11:14:36 +00:00
|
|
|
createShadowSurface(shadowSurface, 211, 147, 100);
|
2012-09-14 22:38:31 +00:00
|
|
|
updateShadow();
|
|
|
|
}
|
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
void AsCommonCarShadow::update() {
|
2012-09-14 22:38:31 +00:00
|
|
|
updateShadow();
|
|
|
|
AnimatedSprite::update();
|
|
|
|
}
|
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
void AsCommonCarShadow::updateShadow() {
|
2012-10-05 21:55:51 +00:00
|
|
|
if (_asCar->getFrameIndex() != _currFrameIndex || _asCar->getCurrAnimFileHash() != _animFileHash) {
|
|
|
|
uint32 fileHash = _asCar->getCurrAnimFileHash();
|
2012-09-14 22:38:31 +00:00
|
|
|
if (fileHash == 0x35698F78 || fileHash == 0x192ADD30 || fileHash == 0x9C220DA4 ||
|
|
|
|
fileHash == 0x9966B138 || fileHash == 0xB579A77C || fileHash == 0xA86A9538 ||
|
|
|
|
fileHash == 0xD4220027 || fileHash == 0xD00A1364 || fileHash == 0xD4AA03A4 ||
|
|
|
|
fileHash == 0xF46A0324) {
|
2012-10-05 21:55:51 +00:00
|
|
|
startAnimation(fileHash, _asCar->getFrameIndex(), -1);
|
|
|
|
_newStickFrameIndex = _asCar->getFrameIndex();
|
2012-09-14 22:38:31 +00:00
|
|
|
}
|
|
|
|
_animFileHash = fileHash;
|
|
|
|
}
|
2012-10-08 11:53:01 +00:00
|
|
|
_x = _asCar->getX() + kCarShadowOffsets[_index].x;
|
|
|
|
_y = _asCar->getY() + kCarShadowOffsets[_index].y;
|
2012-10-05 21:55:51 +00:00
|
|
|
if (!_asCar->getVisible()) {
|
2012-09-14 22:38:31 +00:00
|
|
|
startAnimation(0x1209E09F, 0, -1);
|
|
|
|
_newStickFrameIndex = 0;
|
|
|
|
}
|
2012-10-05 21:55:51 +00:00
|
|
|
setDoDeltaX(_asCar->isDoDeltaX() ? 1 : 0);
|
2012-09-14 22:38:31 +00:00
|
|
|
}
|
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
AsCommonCarConnectorShadow::AsCommonCarConnectorShadow(NeverhoodEngine *vm, Sprite *asCar, BaseSurface *shadowSurface, uint index)
|
2012-10-05 21:55:51 +00:00
|
|
|
: AnimatedSprite(vm, 1100), _asCar(asCar), _index(index) {
|
2012-09-14 22:38:31 +00:00
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
SetUpdateHandler(&AsCommonCarConnectorShadow::update);
|
2012-09-14 22:38:31 +00:00
|
|
|
createShadowSurface1(shadowSurface, 0x60281C10, 150);
|
|
|
|
startAnimation(0x60281C10, -1, -1);
|
2012-10-18 17:36:40 +00:00
|
|
|
_newStickFrameIndex = STICK_LAST_FRAME;
|
2012-09-14 22:38:31 +00:00
|
|
|
}
|
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
void AsCommonCarConnectorShadow::update() {
|
|
|
|
_x = _asCar->getX() + kCarShadowOffsets[_index].x;
|
|
|
|
_y = _asCar->getY() + kCarShadowOffsets[_index].y;
|
2012-09-14 22:38:31 +00:00
|
|
|
AnimatedSprite::update();
|
|
|
|
}
|
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
AsCommonCarTrackShadow::AsCommonCarTrackShadow(NeverhoodEngine *vm, Sprite *asCar, BaseSurface *shadowSurface, int16 frameIndex)
|
2012-10-05 21:55:51 +00:00
|
|
|
: AnimatedSprite(vm, 1100), _asCar(asCar) {
|
2012-09-14 22:38:31 +00:00
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
SetUpdateHandler(&AsCommonCarTrackShadow::update);
|
2012-09-14 22:38:31 +00:00
|
|
|
createShadowSurface1(shadowSurface, 0x0759129C, 100);
|
|
|
|
startAnimation(0x0759129C, frameIndex, -1);
|
|
|
|
_newStickFrameIndex = frameIndex;
|
|
|
|
}
|
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
void AsCommonCarTrackShadow::update() {
|
2012-10-05 21:55:51 +00:00
|
|
|
_x = _asCar->getX();
|
|
|
|
_y = _asCar->getY();
|
2012-09-14 22:38:31 +00:00
|
|
|
AnimatedSprite::update();
|
|
|
|
}
|
|
|
|
|
2011-10-14 12:25:31 +00:00
|
|
|
Scene2701::Scene2701(NeverhoodEngine *vm, Module *parentModule, int which)
|
2013-01-10 23:17:16 +00:00
|
|
|
: Scene(vm, parentModule) {
|
2011-10-14 12:25:31 +00:00
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
Sprite *tempSprite;
|
2012-10-08 17:39:15 +00:00
|
|
|
|
2011-10-14 12:25:31 +00:00
|
|
|
NRect clipRect;
|
2013-01-17 15:41:17 +00:00
|
|
|
TrackInfo *tracks = _vm->_staticData->getTrackInfo(0x004B2240);
|
2012-10-10 21:10:51 +00:00
|
|
|
setGlobalVar(V_CAR_DELTA_X, 1);
|
2011-10-14 12:25:31 +00:00
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
setBackground(tracks->bgFilename);
|
|
|
|
setPalette(tracks->bgFilename);
|
2011-10-14 12:25:31 +00:00
|
|
|
_palette->addPalette(calcHash("paPodFloor"), 65, 31, 65);
|
|
|
|
_palette->addPalette(calcHash("paKlayFloor"), 0, 65, 0);
|
2013-01-10 22:52:46 +00:00
|
|
|
insertScreenMouse(0x08B08180);
|
2011-10-14 12:25:31 +00:00
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
tempSprite = insertStaticSprite(0x1E086325, 1200);
|
2012-10-08 17:39:15 +00:00
|
|
|
clipRect.set(0, 0, 640, tempSprite->getDrawRect().y2());
|
2011-10-14 12:25:31 +00:00
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
if (tracks->bgShadowFilename) {
|
|
|
|
_ssTrackShadowBackground = createSprite<SsCommonTrackShadowBackground>(tracks->bgShadowFilename);
|
2012-10-08 11:53:01 +00:00
|
|
|
addEntity(_ssTrackShadowBackground);
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar = insertSprite<AsCommonCar>(this, 320, 240);
|
2012-10-08 11:53:01 +00:00
|
|
|
_asCarShadow = insertSprite<AsCommonCarShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
|
|
|
_asCarTrackShadow = insertSprite<AsCommonCarTrackShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
|
|
|
_asCarConnectorShadow = insertSprite<AsCommonCarConnectorShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
2011-10-14 12:25:31 +00:00
|
|
|
} else {
|
2012-10-08 11:53:01 +00:00
|
|
|
_ssTrackShadowBackground = NULL;
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar = insertSprite<AsCommonCar>(this, 320, 240);
|
2011-10-14 12:25:31 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCarConnector = insertSprite<AsCommonCarConnector>(_asCar);
|
2013-01-17 15:19:28 +00:00
|
|
|
_which1 = tracks->which1;
|
|
|
|
_which2 = tracks->which2;
|
|
|
|
_dataResource.load(tracks->dataResourceFilename);
|
|
|
|
_trackPoints = _dataResource.getPointArray(tracks->trackPointsName);
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar->setPathPoints(_trackPoints);
|
2011-10-14 12:25:31 +00:00
|
|
|
|
|
|
|
if (which == _which2) {
|
|
|
|
NPoint testPoint = (*_trackPoints)[_trackPoints->size() - 1];
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
|
2011-10-14 12:25:31 +00:00
|
|
|
if (testPoint.x < 0 || testPoint.x >= 640 || testPoint.y < 0 || testPoint.y >= 480)
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2007, 150);
|
2011-10-14 12:25:31 +00:00
|
|
|
} else {
|
|
|
|
NPoint testPoint = (*_trackPoints)[0];
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2002, 0);
|
2011-10-14 12:25:31 +00:00
|
|
|
if (testPoint.x < 0 || testPoint.x >= 640 || testPoint.y < 0 || testPoint.y >= 480)
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2008, 150);
|
2011-10-14 12:25:31 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar->setClipRect(clipRect);
|
|
|
|
_asCarConnector->setClipRect(clipRect);
|
2011-10-14 12:25:31 +00:00
|
|
|
|
|
|
|
if (which == 1) {
|
2012-10-08 17:39:15 +00:00
|
|
|
SetMessageHandler(&Scene2701::hmRidingCar);
|
2011-10-14 12:25:31 +00:00
|
|
|
} else {
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2009, 0);
|
2012-10-08 17:39:15 +00:00
|
|
|
SetMessageHandler(&Scene2701::hmCarAtHome);
|
2011-10-14 12:25:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-10-08 17:39:15 +00:00
|
|
|
uint32 Scene2701::hmRidingCar(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-10-14 12:25:31 +00:00
|
|
|
Scene::handleMessage(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x0001:
|
2012-10-05 21:55:51 +00:00
|
|
|
sendPointMessage(_asCar, 0x2004, param.asPoint());
|
2011-10-14 12:25:31 +00:00
|
|
|
break;
|
|
|
|
case 0x2005:
|
|
|
|
if (_which1 >= 0)
|
2012-10-08 17:39:15 +00:00
|
|
|
SetMessageHandler(&Scene2701::hmCarAtHome);
|
2011-10-14 12:25:31 +00:00
|
|
|
break;
|
|
|
|
case 0x2006:
|
|
|
|
if (_which2 >= 0)
|
|
|
|
leaveScene(_which2);
|
|
|
|
break;
|
|
|
|
case 0x200D:
|
|
|
|
sendMessage(_parentModule, 0x200D, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-08 17:39:15 +00:00
|
|
|
uint32 Scene2701::hmCarAtHome(int messageNum, const MessageParam ¶m, Entity *sender) {
|
2011-10-14 12:25:31 +00:00
|
|
|
Scene::handleMessage(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x0001:
|
2012-10-24 13:33:00 +00:00
|
|
|
if (param.asPoint().x >= 385)
|
2011-10-14 12:25:31 +00:00
|
|
|
leaveScene(0);
|
2012-10-24 13:33:00 +00:00
|
|
|
else {
|
2012-10-05 21:55:51 +00:00
|
|
|
sendPointMessage(_asCar, 0x2004, param.asPoint());
|
2012-10-08 17:39:15 +00:00
|
|
|
SetMessageHandler(&Scene2701::hmRidingCar);
|
2011-10-14 12:25:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x200D:
|
|
|
|
sendMessage(_parentModule, 0x200D, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-10-17 15:32:56 +00:00
|
|
|
Scene2702::Scene2702(NeverhoodEngine *vm, Module *parentModule, int which)
|
2013-01-17 15:19:28 +00:00
|
|
|
: Scene(vm, parentModule), _isInLight(true), _newTrackIndex(-1) {
|
2011-10-17 15:32:56 +00:00
|
|
|
|
|
|
|
SetMessageHandler(&Scene2702::handleMessage);
|
|
|
|
SetUpdateHandler(&Scene2702::update);
|
|
|
|
|
|
|
|
setBackground(0x18808B00);
|
|
|
|
setPalette(0x18808B00);
|
|
|
|
_palette->addPalette(calcHash("paPodFloor"), 65, 31, 65);
|
|
|
|
_palette->addPalette(calcHash("paKlayFloor"), 0, 65, 0);
|
|
|
|
addEntity(_palette);
|
2013-01-10 22:52:46 +00:00
|
|
|
insertScreenMouse(0x08B04180);
|
2011-10-17 15:32:56 +00:00
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
_ssTrackShadowBackground = createSprite<SsCommonTrackShadowBackground>(0x12002035);
|
|
|
|
addEntity(_ssTrackShadowBackground);
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar = insertSprite<AsCommonCar>(this, 320, 240);
|
2012-10-08 11:53:01 +00:00
|
|
|
_asCarShadow = insertSprite<AsCommonCarShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
2012-10-05 21:55:51 +00:00
|
|
|
insertSprite<AsCommonCarConnector>(_asCar);
|
2012-10-08 11:53:01 +00:00
|
|
|
_asCarTrackShadow = insertSprite<AsCommonCarTrackShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
|
|
|
_asCarConnectorShadow = insertSprite<AsCommonCarConnectorShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
2011-10-17 15:32:56 +00:00
|
|
|
_dataResource.load(0x04310014);
|
|
|
|
|
|
|
|
if (which == 1) {
|
2013-01-17 15:19:28 +00:00
|
|
|
_isUpperTrack = false;
|
2011-10-17 15:32:56 +00:00
|
|
|
_currTrackIndex = 1;
|
|
|
|
} else if (which == 2) {
|
2013-01-17 15:19:28 +00:00
|
|
|
_isUpperTrack = false;
|
2011-10-17 15:32:56 +00:00
|
|
|
_currTrackIndex = 2;
|
|
|
|
_palette->addPalette(calcHash("paPodShade"), 65, 31, 65);
|
|
|
|
_palette->addPalette(calcHash("paKlayShade"), 0, 65, 0);
|
2012-10-24 13:33:00 +00:00
|
|
|
_isInLight = false;
|
2011-10-17 15:32:56 +00:00
|
|
|
} else if (which == 3) {
|
2013-01-17 15:19:28 +00:00
|
|
|
_isUpperTrack = true;
|
2011-10-17 15:32:56 +00:00
|
|
|
_currTrackIndex = 0;
|
|
|
|
} else if (which == 4) {
|
2013-01-17 15:19:28 +00:00
|
|
|
_isUpperTrack = true;
|
2011-10-17 15:32:56 +00:00
|
|
|
_currTrackIndex = 2;
|
|
|
|
_palette->addPalette(calcHash("paPodShade"), 65, 31, 65);
|
|
|
|
_palette->addPalette(calcHash("paKlayShade"), 0, 65, 0);
|
2012-10-24 13:33:00 +00:00
|
|
|
_isInLight = false;
|
2011-10-17 15:32:56 +00:00
|
|
|
} else if (which == 5) {
|
2013-01-17 15:19:28 +00:00
|
|
|
_isUpperTrack = true;
|
2011-10-17 15:32:56 +00:00
|
|
|
_currTrackIndex = 1;
|
|
|
|
_palette->addPalette(calcHash("paPodShade"), 65, 31, 65);
|
|
|
|
_palette->addPalette(calcHash("paKlayShade"), 0, 65, 0);
|
2012-10-24 13:33:00 +00:00
|
|
|
_isInLight = false;
|
2011-10-17 15:32:56 +00:00
|
|
|
} else {
|
2013-01-17 15:19:28 +00:00
|
|
|
_isUpperTrack = false;
|
2011-10-17 15:32:56 +00:00
|
|
|
_currTrackIndex = 0;
|
|
|
|
}
|
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
if (_isUpperTrack) {
|
2013-01-17 15:41:17 +00:00
|
|
|
_tracks.push_back(_vm->_staticData->getTrackInfo(0x004B5F68));
|
|
|
|
_tracks.push_back(_vm->_staticData->getTrackInfo(0x004B5F8C));
|
|
|
|
_tracks.push_back(_vm->_staticData->getTrackInfo(0x004B5FB0));
|
2013-01-17 15:19:28 +00:00
|
|
|
} else {
|
2013-01-17 15:41:17 +00:00
|
|
|
_tracks.push_back(_vm->_staticData->getTrackInfo(0x004B5FD8));
|
|
|
|
_tracks.push_back(_vm->_staticData->getTrackInfo(0x004B5FFC));
|
|
|
|
_tracks.push_back(_vm->_staticData->getTrackInfo(0x004B6020));
|
2013-01-17 15:19:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_trackPoints = _dataResource.getPointArray(_tracks[_currTrackIndex]->trackPointsName);
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar->setPathPoints(_trackPoints);
|
2011-10-17 15:32:56 +00:00
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
if (which == _tracks[_currTrackIndex]->which2) {
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
|
|
|
|
sendMessage(_asCar, 0x2007, 150);
|
2011-10-17 15:32:56 +00:00
|
|
|
} else {
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2002, 0);
|
|
|
|
sendMessage(_asCar, 0x2008, 150);
|
2011-10-17 15:32:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_palette->copyBasePalette(0, 256, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene2702::update() {
|
|
|
|
Scene::update();
|
2012-10-24 13:33:00 +00:00
|
|
|
if (_isInLight && _asCar->getX() > 422) {
|
2011-10-17 15:32:56 +00:00
|
|
|
_palette->addBasePalette(calcHash("paPodShade"), 65, 31, 65);
|
|
|
|
_palette->addBasePalette(calcHash("paKlayShade"), 0, 65, 0);
|
|
|
|
_palette->startFadeToPalette(12);
|
2012-10-24 13:33:00 +00:00
|
|
|
_isInLight = false;
|
|
|
|
} else if (!_isInLight && _asCar->getX() <= 422) {
|
2011-10-17 15:32:56 +00:00
|
|
|
_palette->addBasePalette(calcHash("paPodFloor"), 65, 31, 65);
|
|
|
|
_palette->addBasePalette(calcHash("paKlayFloor"), 0, 65, 0);
|
|
|
|
_palette->startFadeToPalette(12);
|
2012-10-24 13:33:00 +00:00
|
|
|
_isInLight = true;
|
2011-10-17 15:32:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Scene2702::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
Scene::handleMessage(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x0001:
|
2013-01-17 15:19:28 +00:00
|
|
|
moveCarToPoint(param.asPoint());
|
2011-10-17 15:32:56 +00:00
|
|
|
break;
|
|
|
|
case 0x2005:
|
|
|
|
if (_newTrackIndex >= 0) {
|
2013-01-17 15:19:28 +00:00
|
|
|
if (_tracks[_currTrackIndex]->which1 < 0)
|
2011-10-17 15:32:56 +00:00
|
|
|
changeTrack();
|
2013-01-17 15:19:28 +00:00
|
|
|
} else if (_tracks[_currTrackIndex]->which1 >= 0)
|
|
|
|
leaveScene(_tracks[_currTrackIndex]->which1);
|
2011-10-17 15:32:56 +00:00
|
|
|
break;
|
|
|
|
case 0x2006:
|
|
|
|
if (_newTrackIndex >= 0) {
|
2013-01-17 15:19:28 +00:00
|
|
|
if (_tracks[_currTrackIndex]->which2 < 0)
|
2011-10-17 15:32:56 +00:00
|
|
|
changeTrack();
|
2013-01-17 15:19:28 +00:00
|
|
|
} else if (_tracks[_currTrackIndex]->which2 >= 0)
|
|
|
|
leaveScene(_tracks[_currTrackIndex]->which2);
|
2011-10-17 15:32:56 +00:00
|
|
|
break;
|
|
|
|
case 0x200D:
|
|
|
|
sendMessage(_parentModule, 0x200D, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
void Scene2702::moveCarToPoint(NPoint pt) {
|
|
|
|
int minMatchTrackIndex, minMatchDistance;
|
|
|
|
_tracks.findTrackPoint(pt, minMatchTrackIndex, minMatchDistance, _dataResource);
|
2011-10-17 15:32:56 +00:00
|
|
|
if (minMatchTrackIndex >= 0 && minMatchTrackIndex != _currTrackIndex) {
|
|
|
|
_newTrackIndex = minMatchTrackIndex;
|
|
|
|
_newTrackDestX = pt.x;
|
2013-01-17 15:19:28 +00:00
|
|
|
if (_isUpperTrack) {
|
2011-10-17 15:32:56 +00:00
|
|
|
if (_currTrackIndex == 0)
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2003, _trackPoints->size() - 1);
|
2011-10-17 15:32:56 +00:00
|
|
|
else
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2003, 0);
|
2012-10-24 13:33:00 +00:00
|
|
|
} else if (_currTrackIndex == 2)
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2003, 0);
|
2012-10-24 13:33:00 +00:00
|
|
|
else
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2003, _trackPoints->size() - 1);
|
2011-10-17 15:32:56 +00:00
|
|
|
} else {
|
|
|
|
_newTrackIndex = -1;
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2004, pt.x);
|
2011-10-17 15:32:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene2702::changeTrack() {
|
|
|
|
_currTrackIndex = _newTrackIndex;
|
2013-01-17 15:19:28 +00:00
|
|
|
_trackPoints = _dataResource.getPointArray(_tracks[_currTrackIndex]->trackPointsName);
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar->setPathPoints(_trackPoints);
|
2013-01-17 15:19:28 +00:00
|
|
|
if (_isUpperTrack) {
|
2011-10-17 15:32:56 +00:00
|
|
|
if (_currTrackIndex == 0)
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
|
2011-10-17 15:32:56 +00:00
|
|
|
else
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2002, 0);
|
2012-10-24 13:33:00 +00:00
|
|
|
} else if (_currTrackIndex == 2)
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2002, 0);
|
2012-10-24 13:33:00 +00:00
|
|
|
else
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
|
|
|
|
sendMessage(_asCar, 0x2004, _newTrackDestX);
|
2011-10-17 15:32:56 +00:00
|
|
|
_newTrackIndex = -1;
|
|
|
|
}
|
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
Scene2703::Scene2703(NeverhoodEngine *vm, Module *parentModule, int which, uint32 trackInfoId)
|
2013-01-10 23:17:16 +00:00
|
|
|
: Scene(vm, parentModule) {
|
2012-10-24 13:33:00 +00:00
|
|
|
|
2013-01-17 15:41:17 +00:00
|
|
|
TrackInfo *tracks = _vm->_staticData->getTrackInfo(trackInfoId);
|
2012-10-24 13:33:00 +00:00
|
|
|
|
|
|
|
SetMessageHandler(&Scene2703::handleMessage);
|
|
|
|
SetUpdateHandler(&Scene2703::update);
|
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
setBackground(tracks->bgFilename);
|
|
|
|
setPalette(tracks->bgFilename);
|
2012-10-24 13:33:00 +00:00
|
|
|
_palette->addPalette(calcHash("paPodShade"), 65, 31, 65);
|
|
|
|
_palette->addPalette(calcHash("paKlayShade"), 0, 65, 0);
|
|
|
|
addEntity(_palette);
|
2013-01-17 15:19:28 +00:00
|
|
|
insertScreenMouse(tracks->mouseCursorFilename);
|
2012-10-24 13:33:00 +00:00
|
|
|
|
|
|
|
_palStatus = 2;
|
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
if (tracks->bgShadowFilename) {
|
|
|
|
_ssTrackShadowBackground = createSprite<SsCommonTrackShadowBackground>(tracks->bgShadowFilename);
|
2012-10-24 13:33:00 +00:00
|
|
|
addEntity(_ssTrackShadowBackground);
|
|
|
|
_asCar = insertSprite<AsCommonCar>(this, 320, 240);
|
|
|
|
_asCarShadow = insertSprite<AsCommonCarShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
|
|
|
_asCarTrackShadow = insertSprite<AsCommonCarTrackShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
|
|
|
_asCarConnectorShadow = insertSprite<AsCommonCarConnectorShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
|
|
|
} else {
|
|
|
|
_ssTrackShadowBackground = NULL;
|
|
|
|
_asCarShadow = NULL;
|
|
|
|
_asCar = insertSprite<AsCommonCar>(this, 320, 240);
|
|
|
|
}
|
|
|
|
|
|
|
|
_asCarConnector = insertSprite<AsCommonCarConnector>(_asCar);
|
2013-01-17 15:19:28 +00:00
|
|
|
_which1 = tracks->which1;
|
|
|
|
_which2 = tracks->which2;
|
|
|
|
_dataResource.load(tracks->dataResourceFilename);
|
|
|
|
_trackPoints = _dataResource.getPointArray(tracks->trackPointsName);
|
2012-10-24 13:33:00 +00:00
|
|
|
_asCar->setPathPoints(_trackPoints);
|
|
|
|
|
|
|
|
if (which == _which2) {
|
|
|
|
NPoint testPoint = (*_trackPoints)[_trackPoints->size() - 1];
|
|
|
|
sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
|
|
|
|
if (testPoint.x > 0 && testPoint.x < 640 && testPoint.y > 0 && testPoint.y < 480)
|
|
|
|
sendMessage(_asCar, 0x2009, 0);
|
|
|
|
else
|
|
|
|
sendMessage(_asCar, 0x2007, 150);
|
|
|
|
} else {
|
|
|
|
NPoint testPoint = (*_trackPoints)[0];
|
|
|
|
sendMessage(_asCar, 0x2002, 0);
|
|
|
|
if (testPoint.x > 0 && testPoint.x < 640 && testPoint.y > 0 && testPoint.y < 480)
|
|
|
|
sendMessage(_asCar, 0x2009, 0);
|
|
|
|
else
|
|
|
|
sendMessage(_asCar, 0x2008, 150);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (which == 0) {
|
|
|
|
_palette->addPalette(calcHash("paPodShade"), 65, 31, 65);
|
|
|
|
_palette->addPalette(calcHash("paKlayShade"), 0, 65, 0);
|
|
|
|
_palStatus = 1;
|
|
|
|
} else if (which == 2 || which == 4 || which == 6) {
|
|
|
|
_palette->addPalette(calcHash("paPodBlack"), 65, 31, 65);
|
|
|
|
_palette->addPalette(calcHash("paKlayBlack"), 0, 65, 0);
|
|
|
|
_palStatus = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
_palette->copyBasePalette(0, 256, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene2703::update() {
|
|
|
|
Scene::update();
|
|
|
|
if (_mouseClicked) {
|
|
|
|
sendPointMessage(_asCar, 0x2004, _mouseClickPos);
|
|
|
|
_mouseClicked = false;
|
|
|
|
}
|
|
|
|
if (_asCar->getX() > 469) {
|
|
|
|
if (_palStatus != 2) {
|
|
|
|
_palette->addBasePalette(calcHash("paPodShade"), 65, 31, 65);
|
|
|
|
_palette->addBasePalette(calcHash("paKlayShade"), 0, 65, 0);
|
|
|
|
_palette->startFadeToPalette(12);
|
|
|
|
_palStatus = 2;
|
|
|
|
}
|
|
|
|
} else if (_asCar->getX() > 181) {
|
|
|
|
if (_palStatus != 1) {
|
|
|
|
_palette->addBasePalette(calcHash("paPodShade"), 65, 31, 65);
|
|
|
|
_palette->addBasePalette(calcHash("paKlayShade"), 0, 65, 0);
|
|
|
|
_palette->startFadeToPalette(12);
|
|
|
|
_palStatus = 1;
|
|
|
|
}
|
|
|
|
} else if (_palStatus != 0) {
|
|
|
|
_palette->addBasePalette(calcHash("paPodBlack"), 65, 31, 65);
|
|
|
|
_palette->addBasePalette(calcHash("paKlayBlack"), 0, 65, 0);
|
|
|
|
_palette->startFadeToPalette(12);
|
|
|
|
_palStatus = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Scene2703::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
Scene::handleMessage(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x2005:
|
|
|
|
if (_which1 >= 0)
|
|
|
|
leaveScene(_which1);
|
|
|
|
break;
|
|
|
|
case 0x2006:
|
|
|
|
if (_which2 >= 0)
|
|
|
|
leaveScene(_which2);
|
|
|
|
break;
|
|
|
|
case 0x200D:
|
|
|
|
sendMessage(_parentModule, 0x200D, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
Scene2704::Scene2704(NeverhoodEngine *vm, Module *parentModule, int which, uint32 trackInfoId, int16 value,
|
2011-10-13 10:43:58 +00:00
|
|
|
const uint32 *staticSprites, const NRect *clipRect)
|
2013-01-10 23:17:16 +00:00
|
|
|
: Scene(vm, parentModule) {
|
2011-10-13 10:43:58 +00:00
|
|
|
|
2013-01-17 15:41:17 +00:00
|
|
|
TrackInfo *tracks = _vm->_staticData->getTrackInfo(trackInfoId);
|
2011-10-13 10:43:58 +00:00
|
|
|
|
|
|
|
SetMessageHandler(&Scene2704::handleMessage);
|
|
|
|
SetUpdateHandler(&Scene2704::update);
|
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
setBackground(tracks->bgFilename);
|
|
|
|
setPalette(tracks->bgFilename);
|
2012-10-24 13:33:00 +00:00
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
if (tracks->exPaletteFilename1)
|
|
|
|
_palette->addPalette(tracks->exPaletteFilename1, 0, 65, 0);
|
2012-10-24 13:33:00 +00:00
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
if (tracks->exPaletteFilename2)
|
|
|
|
_palette->addPalette(tracks->exPaletteFilename2, 65, 31, 65);
|
2011-10-13 10:43:58 +00:00
|
|
|
|
|
|
|
while (staticSprites && *staticSprites)
|
|
|
|
insertStaticSprite(*staticSprites++, 1100);
|
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
insertScreenMouse(tracks->mouseCursorFilename);
|
2011-10-13 10:43:58 +00:00
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
if (tracks->bgShadowFilename) {
|
|
|
|
_ssTrackShadowBackground = createSprite<SsCommonTrackShadowBackground>(tracks->bgShadowFilename);
|
2012-10-08 11:53:01 +00:00
|
|
|
addEntity(_ssTrackShadowBackground);
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar = insertSprite<AsCommonCar>(this, 320, 240);
|
2012-10-08 11:53:01 +00:00
|
|
|
_asCarShadow = insertSprite<AsCommonCarShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
|
|
|
_asCarTrackShadow = insertSprite<AsCommonCarTrackShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
|
|
|
_asCarConnectorShadow = insertSprite<AsCommonCarConnectorShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
2011-10-13 10:43:58 +00:00
|
|
|
} else {
|
2012-10-08 11:53:01 +00:00
|
|
|
_ssTrackShadowBackground = NULL;
|
|
|
|
_asCarShadow = NULL;
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar = insertSprite<AsCommonCar>(this, 320, 240);
|
2011-10-13 10:43:58 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCarConnector = insertSprite<AsCommonCarConnector>(_asCar);
|
2013-01-17 15:19:28 +00:00
|
|
|
_which1 = tracks->which1;
|
|
|
|
_which2 = tracks->which2;
|
|
|
|
_dataResource.load(tracks->dataResourceFilename);
|
|
|
|
_trackPoints = _dataResource.getPointArray(tracks->trackPointsName);
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar->setPathPoints(_trackPoints);
|
2011-10-13 10:43:58 +00:00
|
|
|
|
|
|
|
if (which == _which2) {
|
2011-10-14 08:11:10 +00:00
|
|
|
NPoint testPoint = (*_trackPoints)[_trackPoints->size() - 1];
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
|
2011-10-13 10:43:58 +00:00
|
|
|
if (testPoint.x > 0 && testPoint.x < 640 && testPoint.y > 0 && testPoint.y < 480)
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2009, 0);
|
2011-10-13 10:43:58 +00:00
|
|
|
else
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2007, 0);
|
2011-10-13 10:43:58 +00:00
|
|
|
} else {
|
2011-10-14 08:11:10 +00:00
|
|
|
NPoint testPoint = (*_trackPoints)[0];
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2002, 0);
|
2011-10-13 10:43:58 +00:00
|
|
|
if (testPoint.x > 0 && testPoint.x < 640 && testPoint.y > 0 && testPoint.y < 480)
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2009, 0);
|
2011-10-13 10:43:58 +00:00
|
|
|
else
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2008, 0);
|
2011-10-13 10:43:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (clipRect) {
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar->getClipRect() = *clipRect;
|
2012-10-08 11:53:01 +00:00
|
|
|
if (_asCarShadow)
|
|
|
|
_asCarShadow->getClipRect() = *clipRect;
|
|
|
|
if (_asCarTrackShadow)
|
|
|
|
_asCarTrackShadow->getClipRect() = *clipRect;
|
|
|
|
if (_asCarConnectorShadow)
|
|
|
|
_asCarConnectorShadow->getClipRect() = *clipRect;
|
2012-10-05 21:55:51 +00:00
|
|
|
if (_asCarConnector)
|
|
|
|
_asCarConnector->getClipRect() = *clipRect;
|
2011-10-13 10:43:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene2704::update() {
|
|
|
|
Scene::update();
|
|
|
|
if (_mouseClicked) {
|
2012-10-05 21:55:51 +00:00
|
|
|
sendPointMessage(_asCar, 0x2004, _mouseClickPos);
|
2011-10-13 10:43:58 +00:00
|
|
|
_mouseClicked = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Scene2704::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
Scene::handleMessage(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x2005:
|
|
|
|
if (_which1 >= 0)
|
|
|
|
leaveScene(_which1);
|
|
|
|
break;
|
|
|
|
case 0x2006:
|
|
|
|
if (_which2 >= 0)
|
|
|
|
leaveScene(_which2);
|
|
|
|
break;
|
|
|
|
case 0x200D:
|
|
|
|
sendMessage(_parentModule, 0x200D, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
2011-10-12 13:13:24 +00:00
|
|
|
}
|
|
|
|
|
2011-10-14 08:11:10 +00:00
|
|
|
Scene2706::Scene2706(NeverhoodEngine *vm, Module *parentModule, int which)
|
2013-01-10 23:17:16 +00:00
|
|
|
: Scene(vm, parentModule), _newTrackIndex(-1) {
|
2011-10-14 08:11:10 +00:00
|
|
|
|
|
|
|
SetMessageHandler(&Scene2706::handleMessage);
|
2013-01-17 15:19:28 +00:00
|
|
|
|
2013-01-17 15:41:17 +00:00
|
|
|
_tracks.push_back(_vm->_staticData->getTrackInfo(0x004B22A0));
|
|
|
|
_tracks.push_back(_vm->_staticData->getTrackInfo(0x004B22C4));
|
|
|
|
_tracks.push_back(_vm->_staticData->getTrackInfo(0x004B22E8));
|
2011-10-14 08:11:10 +00:00
|
|
|
|
|
|
|
setBackground(0x18808B88);
|
|
|
|
setPalette(0x18808B88);
|
|
|
|
|
|
|
|
_palette->addPalette(calcHash("paPodShade"), 65, 31, 65);
|
|
|
|
_palette->addPalette(calcHash("paKlayShade"), 0, 65, 0);
|
|
|
|
|
2013-01-10 22:52:46 +00:00
|
|
|
insertScreenMouse(0x08B8C180);
|
2011-10-14 08:11:10 +00:00
|
|
|
|
2012-10-08 11:53:01 +00:00
|
|
|
_ssTrackShadowBackground = createSprite<SsCommonTrackShadowBackground>(0x18808B88);
|
|
|
|
addEntity(_ssTrackShadowBackground);
|
2012-09-14 22:38:31 +00:00
|
|
|
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar = insertSprite<AsCommonCar>(this, 320, 240);
|
2012-10-08 11:53:01 +00:00
|
|
|
_asCarShadow = insertSprite<AsCommonCarShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCarConnector = insertSprite<AsCommonCarConnector>(_asCar);
|
2012-10-08 11:53:01 +00:00
|
|
|
_asCarTrackShadow = insertSprite<AsCommonCarTrackShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
|
|
|
_asCarConnectorShadow = insertSprite<AsCommonCarConnectorShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4);
|
2011-10-14 08:11:10 +00:00
|
|
|
|
|
|
|
_dataResource.load(0x06000162);
|
|
|
|
|
|
|
|
if (which == 5)
|
|
|
|
_currTrackIndex = 2;
|
|
|
|
else if (which == 6)
|
|
|
|
_currTrackIndex = 1;
|
|
|
|
else
|
|
|
|
_currTrackIndex = 0;
|
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
_trackPoints = _dataResource.getPointArray(_tracks[_currTrackIndex]->trackPointsName);
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar->setPathPoints(_trackPoints);
|
2011-10-14 08:11:10 +00:00
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
if (which == _tracks[_currTrackIndex]->which2) {
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
|
2011-10-14 08:11:10 +00:00
|
|
|
if (which == 5)
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2007, 50);
|
2011-10-14 08:11:10 +00:00
|
|
|
else
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2007, 150);
|
2011-10-14 08:11:10 +00:00
|
|
|
} else {
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2002, 0);
|
2011-10-14 08:11:10 +00:00
|
|
|
if (which == 5)
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2008, 50);
|
2011-10-14 08:11:10 +00:00
|
|
|
else
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2008, 150);
|
2011-10-14 08:11:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Scene2706::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) {
|
|
|
|
Scene::handleMessage(messageNum, param, sender);
|
|
|
|
switch (messageNum) {
|
|
|
|
case 0x0001:
|
2013-01-17 15:19:28 +00:00
|
|
|
moveCarToPoint(param.asPoint());
|
2011-10-14 08:11:10 +00:00
|
|
|
break;
|
|
|
|
case 0x2005:
|
|
|
|
if (_newTrackIndex >= 0) {
|
2013-01-17 15:19:28 +00:00
|
|
|
if (_tracks[_currTrackIndex]->which1 < 0)
|
2011-10-14 08:11:10 +00:00
|
|
|
changeTrack();
|
2013-01-17 15:19:28 +00:00
|
|
|
} else if (_tracks[_currTrackIndex]->which1 >= 0)
|
|
|
|
leaveScene(_tracks[_currTrackIndex]->which1);
|
2011-10-14 08:11:10 +00:00
|
|
|
break;
|
|
|
|
case 0x2006:
|
|
|
|
if (_newTrackIndex >= 0) {
|
2013-01-17 15:19:28 +00:00
|
|
|
if (_tracks[_currTrackIndex]->which2 < 0)
|
2011-10-14 08:11:10 +00:00
|
|
|
changeTrack();
|
2013-01-17 15:19:28 +00:00
|
|
|
} else if (_tracks[_currTrackIndex]->which2 >= 0)
|
|
|
|
leaveScene(_tracks[_currTrackIndex]->which2);
|
2011-10-14 08:11:10 +00:00
|
|
|
break;
|
|
|
|
case 0x200D:
|
|
|
|
sendMessage(_parentModule, 0x200D, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-01-17 15:19:28 +00:00
|
|
|
void Scene2706::moveCarToPoint(NPoint pt) {
|
|
|
|
int minMatchTrackIndex, minMatchDistance;
|
|
|
|
_tracks.findTrackPoint(pt, minMatchTrackIndex, minMatchDistance, _dataResource);
|
2011-10-14 08:11:10 +00:00
|
|
|
if (minMatchTrackIndex >= 0 && minMatchTrackIndex != _currTrackIndex) {
|
|
|
|
_newTrackIndex = minMatchTrackIndex;
|
|
|
|
_newTrackDestX = pt.x;
|
|
|
|
if (_currTrackIndex == 0)
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2003, _trackPoints->size() - 1);
|
2011-10-14 08:11:10 +00:00
|
|
|
else
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2003, 0);
|
2011-10-14 08:11:10 +00:00
|
|
|
} else {
|
|
|
|
_newTrackIndex = -1;
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2004, pt.x);
|
2011-10-14 08:11:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene2706::changeTrack() {
|
|
|
|
_currTrackIndex = _newTrackIndex;
|
2013-01-17 15:19:28 +00:00
|
|
|
_trackPoints = _dataResource.getPointArray(_tracks[_currTrackIndex]->trackPointsName);
|
2012-10-05 21:55:51 +00:00
|
|
|
_asCar->setPathPoints(_trackPoints);
|
2011-10-14 08:11:10 +00:00
|
|
|
if (_currTrackIndex == 0)
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
|
2011-10-14 08:11:10 +00:00
|
|
|
else
|
2012-10-05 21:55:51 +00:00
|
|
|
sendMessage(_asCar, 0x2002, 0);
|
|
|
|
sendMessage(_asCar, 0x2004, _newTrackDestX);
|
2011-10-14 08:11:10 +00:00
|
|
|
_newTrackIndex = -1;
|
|
|
|
}
|
|
|
|
|
2012-10-24 13:33:00 +00:00
|
|
|
Scene2732::Scene2732(NeverhoodEngine *vm, Module *parentModule)
|
2013-01-10 23:17:16 +00:00
|
|
|
: Scene(vm, parentModule) {
|
2012-10-24 13:33:00 +00:00
|
|
|
|
|
|
|
Sprite *tempSprite;
|
|
|
|
|
|
|
|
setBackground(0x0220C041);
|
|
|
|
setPalette(0x0220C041);
|
2013-01-10 22:52:46 +00:00
|
|
|
insertScreenMouse(0x0C04502A);
|
2012-10-24 13:33:00 +00:00
|
|
|
setRectList(0x004AE360);
|
|
|
|
|
2013-01-21 11:34:50 +00:00
|
|
|
insertKlaymen<KmScene2732>(108, 331);
|
2012-10-24 13:33:00 +00:00
|
|
|
setMessageList(0x004AE328);
|
|
|
|
|
|
|
|
tempSprite = insertStaticSprite(0x50C22C48, 1100);
|
2013-01-21 11:34:50 +00:00
|
|
|
_klaymen->setClipRect(tempSprite->getDrawRect().x, 0, 640, 480);
|
2012-10-24 13:33:00 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-10-12 13:13:24 +00:00
|
|
|
} // End of namespace Neverhood
|