From 962e2fd550bad06bf3328a0964d29f79b7da242d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 25 Dec 2013 17:10:14 +0200 Subject: NEVERHOOD: Change more message values to enums --- engines/neverhood/modules/module2700.cpp | 62 ++++++++++++++++---------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'engines/neverhood/modules/module2700.cpp') diff --git a/engines/neverhood/modules/module2700.cpp b/engines/neverhood/modules/module2700.cpp index 1b78615fdb..1f680fe5a1 100644 --- a/engines/neverhood/modules/module2700.cpp +++ b/engines/neverhood/modules/module2700.cpp @@ -578,12 +578,12 @@ Scene2701::Scene2701(NeverhoodEngine *vm, Module *parentModule, int which) 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, 0x2007, 150); + sendMessage(_asCar, NM_CAR_MOVE_TO_PREV_POINT, 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, 0x2008, 150); + sendMessage(_asCar, NM_CAR_MOVE_TO_NEXT_POINT, 150); } _asCar->setClipRect(clipRect); @@ -592,7 +592,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 +601,14 @@ Scene2701::Scene2701(NeverhoodEngine *vm, Module *parentModule, int which) uint32 Scene2701::hmRidingCar(int messageNum, const MessageParam ¶m, 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 +622,7 @@ uint32 Scene2701::hmRidingCar(int messageNum, const MessageParam ¶m, Entity uint32 Scene2701::hmCarAtHome(int messageNum, const MessageParam ¶m, Entity *sender) { Scene::handleMessage(messageNum, param, sender); switch (messageNum) { - case 0x0001: + case NM_MOUSE_CLICK: if (param.asPoint().x >= 385) leaveScene(0); else { @@ -703,10 +703,10 @@ Scene2702::Scene2702(NeverhoodEngine *vm, Module *parentModule, int which) if (which == _tracks[_currTrackIndex]->which2) { sendMessage(_asCar, 0x2002, _trackPoints->size() - 1); - sendMessage(_asCar, 0x2007, 150); + sendMessage(_asCar, NM_CAR_MOVE_TO_PREV_POINT, 150); } else { sendMessage(_asCar, 0x2002, 0); - sendMessage(_asCar, 0x2008, 150); + sendMessage(_asCar, NM_CAR_MOVE_TO_NEXT_POINT, 150); } _palette->copyBasePalette(0, 256, 0); @@ -731,17 +731,17 @@ void Scene2702::update() { uint32 Scene2702::handleMessage(int messageNum, const MessageParam ¶m, 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(); @@ -834,16 +834,16 @@ Scene2703::Scene2703(NeverhoodEngine *vm, Module *parentModule, int which, uint3 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); + 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); 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 +891,11 @@ void Scene2703::update() { uint32 Scene2703::handleMessage(int messageNum, const MessageParam ¶m, 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; @@ -953,16 +953,16 @@ Scene2704::Scene2704(NeverhoodEngine *vm, Module *parentModule, int which, uint3 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); + sendMessage(_asCar, NM_CAR_ENTER, 0); else - sendMessage(_asCar, 0x2007, 0); + sendMessage(_asCar, NM_CAR_MOVE_TO_PREV_POINT, 0); } 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); + sendMessage(_asCar, NM_CAR_ENTER, 0); else - sendMessage(_asCar, 0x2008, 0); + sendMessage(_asCar, NM_CAR_MOVE_TO_NEXT_POINT, 0); } if (clipRect) { @@ -990,11 +990,11 @@ void Scene2704::update() { uint32 Scene2704::handleMessage(int messageNum, const MessageParam ¶m, 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; @@ -1046,15 +1046,15 @@ Scene2706::Scene2706(NeverhoodEngine *vm, Module *parentModule, int which) if (which == _tracks[_currTrackIndex]->which2) { sendMessage(_asCar, 0x2002, _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); 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 +1062,17 @@ Scene2706::Scene2706(NeverhoodEngine *vm, Module *parentModule, int which) uint32 Scene2706::handleMessage(int messageNum, const MessageParam ¶m, 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(); -- cgit v1.2.3 From 43c226436c5cb466fa066cbb8fad46477d73e31e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 25 Dec 2013 19:12:00 +0200 Subject: NEVERHOOD: Change more message values to enums --- engines/neverhood/modules/module2700.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'engines/neverhood/modules/module2700.cpp') diff --git a/engines/neverhood/modules/module2700.cpp b/engines/neverhood/modules/module2700.cpp index 1f680fe5a1..5880c31c14 100644 --- a/engines/neverhood/modules/module2700.cpp +++ b/engines/neverhood/modules/module2700.cpp @@ -576,12 +576,12 @@ 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, 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, NM_CAR_MOVE_TO_NEXT_POINT, 150); } @@ -702,10 +702,10 @@ Scene2702::Scene2702(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); sendMessage(_asCar, NM_CAR_MOVE_TO_PREV_POINT, 150); } else { - sendMessage(_asCar, 0x2002, 0); + sendMessage(_asCar, NM_POSITION_CHANGE, 0); sendMessage(_asCar, NM_CAR_MOVE_TO_NEXT_POINT, 150); } @@ -782,13 +782,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,14 +832,14 @@ 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, NM_CAR_ENTER, 0); else 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, NM_CAR_ENTER, 0); else @@ -951,14 +951,14 @@ 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, NM_CAR_ENTER, 0); else sendMessage(_asCar, NM_CAR_MOVE_TO_PREV_POINT, 0); } 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, NM_CAR_ENTER, 0); else @@ -1044,13 +1044,13 @@ 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, NM_CAR_MOVE_TO_PREV_POINT, 50); else 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, NM_CAR_MOVE_TO_NEXT_POINT, 50); else @@ -1107,9 +1107,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; } -- cgit v1.2.3 From da5cdd1c030ec6f7f9b41c3496700e47b8dadff1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 25 Dec 2013 19:13:04 +0200 Subject: NEVERHOOD: Move car to the correct position when entering a new scene --- engines/neverhood/modules/module2700.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/neverhood/modules/module2700.cpp') diff --git a/engines/neverhood/modules/module2700.cpp b/engines/neverhood/modules/module2700.cpp index 5880c31c14..13c30048a4 100644 --- a/engines/neverhood/modules/module2700.cpp +++ b/engines/neverhood/modules/module2700.cpp @@ -955,14 +955,14 @@ Scene2704::Scene2704(NeverhoodEngine *vm, Module *parentModule, int which, uint3 if (testPoint.x > 0 && testPoint.x < 640 && testPoint.y > 0 && testPoint.y < 480) sendMessage(_asCar, NM_CAR_ENTER, 0); else - sendMessage(_asCar, NM_CAR_MOVE_TO_PREV_POINT, 0); + sendMessage(_asCar, NM_CAR_MOVE_TO_PREV_POINT, 150); } else { NPoint testPoint = (*_trackPoints)[0]; sendMessage(_asCar, NM_POSITION_CHANGE, 0); if (testPoint.x > 0 && testPoint.x < 640 && testPoint.y > 0 && testPoint.y < 480) sendMessage(_asCar, NM_CAR_ENTER, 0); else - sendMessage(_asCar, NM_CAR_MOVE_TO_NEXT_POINT, 0); + sendMessage(_asCar, NM_CAR_MOVE_TO_NEXT_POINT, 150); } if (clipRect) { -- cgit v1.2.3 From 6563171e7b7f373dde50b64da318c14c8207df32 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 18 Feb 2014 02:34:22 +0100 Subject: NEVERHOOD: Make GPL headers consisten in themselves. --- engines/neverhood/modules/module2700.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/neverhood/modules/module2700.cpp') diff --git a/engines/neverhood/modules/module2700.cpp b/engines/neverhood/modules/module2700.cpp index 13c30048a4..9399981cfd 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. -- cgit v1.2.3 From 1a18d1a50e379070e70585336b61ed7a26aa652c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 19 Mar 2014 19:45:51 +0100 Subject: NEVERHOOD: Fix some uninitialized variables --- engines/neverhood/modules/module2700.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/neverhood/modules/module2700.cpp') diff --git a/engines/neverhood/modules/module2700.cpp b/engines/neverhood/modules/module2700.cpp index 9399981cfd..2a112435fc 100644 --- a/engines/neverhood/modules/module2700.cpp +++ b/engines/neverhood/modules/module2700.cpp @@ -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); -- cgit v1.2.3 From 639a2dfd2e704871d7262afb8c249c36d4027e41 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Thu, 5 Jun 2014 19:51:28 +0200 Subject: NEVERHOOD: Fix radio part of bug #6513 ("Some nasty bugs") This clears the radio music variable when leaving the room. I've discussed with johndoe123 and he says this is what the original does. (You could also get the same effect by clearing it when entering the room.) --- engines/neverhood/modules/module2700.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/neverhood/modules/module2700.cpp') diff --git a/engines/neverhood/modules/module2700.cpp b/engines/neverhood/modules/module2700.cpp index 2a112435fc..a510c02558 100644 --- a/engines/neverhood/modules/module2700.cpp +++ b/engines/neverhood/modules/module2700.cpp @@ -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: -- cgit v1.2.3