aboutsummaryrefslogtreecommitdiff
path: root/engines/neverhood/modules/module2700.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/neverhood/modules/module2700.cpp')
-rw-r--r--engines/neverhood/modules/module2700.cpp101
1 files changed, 51 insertions, 50 deletions
diff --git a/engines/neverhood/modules/module2700.cpp b/engines/neverhood/modules/module2700.cpp
index 1b78615fdb..a510c02558 100644
--- a/engines/neverhood/modules/module2700.cpp
+++ b/engines/neverhood/modules/module2700.cpp
@@ -8,12 +8,12 @@
* 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.
@@ -84,7 +84,7 @@ static const uint32 kScene2725StaticSprites[] = {
};
Module2700::Module2700(NeverhoodEngine *vm, Module *parentModule, int which)
- : Module(vm, parentModule), _soundIndex(0), _radioMusicInitialized(false) {
+ : Module(vm, parentModule), _soundIndex(0), _radioMusicInitialized(false), _musicFileHash(0) {
_vm->_soundMan->addMusic(0x42212411, 0x04020210);
_vm->_soundMan->startMusic(0x04020210, 24, 2);
@@ -461,6 +461,7 @@ void Module2700::updateScene() {
_vm->_soundMan->deleteMusic(_musicFileHash);
_vm->_soundMan->startMusic(0x04020210, 0, 2);
_vm->_soundMan->deleteSoundGroup(0x42212411);
+ _radioMusicInitialized = false;
createScene(20, 3);
break;
case 22:
@@ -576,14 +577,14 @@ Scene2701::Scene2701(NeverhoodEngine *vm, Module *parentModule, int which)
if (which == _which2) {
NPoint testPoint = (*_trackPoints)[_trackPoints->size() - 1];
- sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
+ sendMessage(_asCar, NM_POSITION_CHANGE, _trackPoints->size() - 1);
if (testPoint.x < 0 || testPoint.x >= 640 || testPoint.y < 0 || testPoint.y >= 480)
- sendMessage(_asCar, 0x2007, 150);
+ sendMessage(_asCar, NM_CAR_MOVE_TO_PREV_POINT, 150);
} else {
NPoint testPoint = (*_trackPoints)[0];
- sendMessage(_asCar, 0x2002, 0);
+ sendMessage(_asCar, NM_POSITION_CHANGE, 0);
if (testPoint.x < 0 || testPoint.x >= 640 || testPoint.y < 0 || testPoint.y >= 480)
- sendMessage(_asCar, 0x2008, 150);
+ sendMessage(_asCar, NM_CAR_MOVE_TO_NEXT_POINT, 150);
}
_asCar->setClipRect(clipRect);
@@ -592,7 +593,7 @@ Scene2701::Scene2701(NeverhoodEngine *vm, Module *parentModule, int which)
if (which == 1) {
SetMessageHandler(&Scene2701::hmRidingCar);
} else {
- sendMessage(_asCar, 0x2009, 0);
+ sendMessage(_asCar, NM_CAR_ENTER, 0);
SetMessageHandler(&Scene2701::hmCarAtHome);
}
@@ -601,14 +602,14 @@ Scene2701::Scene2701(NeverhoodEngine *vm, Module *parentModule, int which)
uint32 Scene2701::hmRidingCar(int messageNum, const MessageParam &param, Entity *sender) {
Scene::handleMessage(messageNum, param, sender);
switch (messageNum) {
- case 0x0001:
+ case NM_MOUSE_CLICK:
sendPointMessage(_asCar, 0x2004, param.asPoint());
break;
- case 0x2005:
+ case NM_KLAYMEN_CLIMB_LADDER:
if (_which1 >= 0)
SetMessageHandler(&Scene2701::hmCarAtHome);
break;
- case 0x2006:
+ case NM_KLAYMEN_STOP_CLIMBING:
if (_which2 >= 0)
leaveScene(_which2);
break;
@@ -622,7 +623,7 @@ uint32 Scene2701::hmRidingCar(int messageNum, const MessageParam &param, Entity
uint32 Scene2701::hmCarAtHome(int messageNum, const MessageParam &param, Entity *sender) {
Scene::handleMessage(messageNum, param, sender);
switch (messageNum) {
- case 0x0001:
+ case NM_MOUSE_CLICK:
if (param.asPoint().x >= 385)
leaveScene(0);
else {
@@ -702,11 +703,11 @@ Scene2702::Scene2702(NeverhoodEngine *vm, Module *parentModule, int which)
_asCar->setPathPoints(_trackPoints);
if (which == _tracks[_currTrackIndex]->which2) {
- sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
- sendMessage(_asCar, 0x2007, 150);
+ sendMessage(_asCar, NM_POSITION_CHANGE, _trackPoints->size() - 1);
+ sendMessage(_asCar, NM_CAR_MOVE_TO_PREV_POINT, 150);
} else {
- sendMessage(_asCar, 0x2002, 0);
- sendMessage(_asCar, 0x2008, 150);
+ sendMessage(_asCar, NM_POSITION_CHANGE, 0);
+ sendMessage(_asCar, NM_CAR_MOVE_TO_NEXT_POINT, 150);
}
_palette->copyBasePalette(0, 256, 0);
@@ -731,17 +732,17 @@ void Scene2702::update() {
uint32 Scene2702::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
Scene::handleMessage(messageNum, param, sender);
switch (messageNum) {
- case 0x0001:
+ case NM_MOUSE_CLICK:
moveCarToPoint(param.asPoint());
break;
- case 0x2005:
+ case NM_KLAYMEN_CLIMB_LADDER:
if (_newTrackIndex >= 0) {
if (_tracks[_currTrackIndex]->which1 < 0)
changeTrack();
} else if (_tracks[_currTrackIndex]->which1 >= 0)
leaveScene(_tracks[_currTrackIndex]->which1);
break;
- case 0x2006:
+ case NM_KLAYMEN_STOP_CLIMBING:
if (_newTrackIndex >= 0) {
if (_tracks[_currTrackIndex]->which2 < 0)
changeTrack();
@@ -782,13 +783,13 @@ void Scene2702::changeTrack() {
_asCar->setPathPoints(_trackPoints);
if (_isUpperTrack) {
if (_currTrackIndex == 0)
- sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
+ sendMessage(_asCar, NM_POSITION_CHANGE, _trackPoints->size() - 1);
else
- sendMessage(_asCar, 0x2002, 0);
+ sendMessage(_asCar, NM_POSITION_CHANGE, 0);
} else if (_currTrackIndex == 2)
- sendMessage(_asCar, 0x2002, 0);
+ sendMessage(_asCar, NM_POSITION_CHANGE, 0);
else
- sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
+ sendMessage(_asCar, NM_POSITION_CHANGE, _trackPoints->size() - 1);
sendMessage(_asCar, 0x2004, _newTrackDestX);
_newTrackIndex = -1;
}
@@ -832,18 +833,18 @@ Scene2703::Scene2703(NeverhoodEngine *vm, Module *parentModule, int which, uint3
if (which == _which2) {
NPoint testPoint = (*_trackPoints)[_trackPoints->size() - 1];
- sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
+ sendMessage(_asCar, NM_POSITION_CHANGE, _trackPoints->size() - 1);
if (testPoint.x > 0 && testPoint.x < 640 && testPoint.y > 0 && testPoint.y < 480)
- sendMessage(_asCar, 0x2009, 0);
+ sendMessage(_asCar, NM_CAR_ENTER, 0);
else
- sendMessage(_asCar, 0x2007, 150);
+ sendMessage(_asCar, NM_CAR_MOVE_TO_PREV_POINT, 150);
} else {
NPoint testPoint = (*_trackPoints)[0];
- sendMessage(_asCar, 0x2002, 0);
+ sendMessage(_asCar, NM_POSITION_CHANGE, 0);
if (testPoint.x > 0 && testPoint.x < 640 && testPoint.y > 0 && testPoint.y < 480)
- sendMessage(_asCar, 0x2009, 0);
+ sendMessage(_asCar, NM_CAR_ENTER, 0);
else
- sendMessage(_asCar, 0x2008, 150);
+ sendMessage(_asCar, NM_CAR_MOVE_TO_NEXT_POINT, 150);
}
if (which == 0) {
@@ -891,11 +892,11 @@ void Scene2703::update() {
uint32 Scene2703::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
Scene::handleMessage(messageNum, param, sender);
switch (messageNum) {
- case 0x2005:
+ case NM_KLAYMEN_CLIMB_LADDER:
if (_which1 >= 0)
leaveScene(_which1);
break;
- case 0x2006:
+ case NM_KLAYMEN_STOP_CLIMBING:
if (_which2 >= 0)
leaveScene(_which2);
break;
@@ -951,18 +952,18 @@ Scene2704::Scene2704(NeverhoodEngine *vm, Module *parentModule, int which, uint3
if (which == _which2) {
NPoint testPoint = (*_trackPoints)[_trackPoints->size() - 1];
- sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
+ sendMessage(_asCar, NM_POSITION_CHANGE, _trackPoints->size() - 1);
if (testPoint.x > 0 && testPoint.x < 640 && testPoint.y > 0 && testPoint.y < 480)
- sendMessage(_asCar, 0x2009, 0);
+ sendMessage(_asCar, NM_CAR_ENTER, 0);
else
- sendMessage(_asCar, 0x2007, 0);
+ sendMessage(_asCar, NM_CAR_MOVE_TO_PREV_POINT, 150);
} else {
NPoint testPoint = (*_trackPoints)[0];
- sendMessage(_asCar, 0x2002, 0);
+ sendMessage(_asCar, NM_POSITION_CHANGE, 0);
if (testPoint.x > 0 && testPoint.x < 640 && testPoint.y > 0 && testPoint.y < 480)
- sendMessage(_asCar, 0x2009, 0);
+ sendMessage(_asCar, NM_CAR_ENTER, 0);
else
- sendMessage(_asCar, 0x2008, 0);
+ sendMessage(_asCar, NM_CAR_MOVE_TO_NEXT_POINT, 150);
}
if (clipRect) {
@@ -990,11 +991,11 @@ void Scene2704::update() {
uint32 Scene2704::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
Scene::handleMessage(messageNum, param, sender);
switch (messageNum) {
- case 0x2005:
+ case NM_KLAYMEN_CLIMB_LADDER:
if (_which1 >= 0)
leaveScene(_which1);
break;
- case 0x2006:
+ case NM_KLAYMEN_STOP_CLIMBING:
if (_which2 >= 0)
leaveScene(_which2);
break;
@@ -1044,17 +1045,17 @@ Scene2706::Scene2706(NeverhoodEngine *vm, Module *parentModule, int which)
_asCar->setPathPoints(_trackPoints);
if (which == _tracks[_currTrackIndex]->which2) {
- sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
+ sendMessage(_asCar, NM_POSITION_CHANGE, _trackPoints->size() - 1);
if (which == 5)
- sendMessage(_asCar, 0x2007, 50);
+ sendMessage(_asCar, NM_CAR_MOVE_TO_PREV_POINT, 50);
else
- sendMessage(_asCar, 0x2007, 150);
+ sendMessage(_asCar, NM_CAR_MOVE_TO_PREV_POINT, 150);
} else {
- sendMessage(_asCar, 0x2002, 0);
+ sendMessage(_asCar, NM_POSITION_CHANGE, 0);
if (which == 5)
- sendMessage(_asCar, 0x2008, 50);
+ sendMessage(_asCar, NM_CAR_MOVE_TO_NEXT_POINT, 50);
else
- sendMessage(_asCar, 0x2008, 150);
+ sendMessage(_asCar, NM_CAR_MOVE_TO_NEXT_POINT, 150);
}
}
@@ -1062,17 +1063,17 @@ Scene2706::Scene2706(NeverhoodEngine *vm, Module *parentModule, int which)
uint32 Scene2706::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
Scene::handleMessage(messageNum, param, sender);
switch (messageNum) {
- case 0x0001:
+ case NM_MOUSE_CLICK:
moveCarToPoint(param.asPoint());
break;
- case 0x2005:
+ case NM_KLAYMEN_CLIMB_LADDER:
if (_newTrackIndex >= 0) {
if (_tracks[_currTrackIndex]->which1 < 0)
changeTrack();
} else if (_tracks[_currTrackIndex]->which1 >= 0)
leaveScene(_tracks[_currTrackIndex]->which1);
break;
- case 0x2006:
+ case NM_KLAYMEN_STOP_CLIMBING:
if (_newTrackIndex >= 0) {
if (_tracks[_currTrackIndex]->which2 < 0)
changeTrack();
@@ -1107,9 +1108,9 @@ void Scene2706::changeTrack() {
_trackPoints = _dataResource.getPointArray(_tracks[_currTrackIndex]->trackPointsName);
_asCar->setPathPoints(_trackPoints);
if (_currTrackIndex == 0)
- sendMessage(_asCar, 0x2002, _trackPoints->size() - 1);
+ sendMessage(_asCar, NM_POSITION_CHANGE, _trackPoints->size() - 1);
else
- sendMessage(_asCar, 0x2002, 0);
+ sendMessage(_asCar, NM_POSITION_CHANGE, 0);
sendMessage(_asCar, 0x2004, _newTrackDestX);
_newTrackIndex = -1;
}