diff options
author | johndoe123 | 2011-09-16 12:23:26 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:39:38 +0200 |
commit | b757e22f881797f51fa1fb951dd78a88d3ae15d9 (patch) | |
tree | 3548fac69f6087e6cd1af1d5a8415de272e0c81a | |
parent | a21f9ef891d32487b0f6a57651aee2d8f7106a40 (diff) | |
download | scummvm-rg350-b757e22f881797f51fa1fb951dd78a88d3ae15d9.tar.gz scummvm-rg350-b757e22f881797f51fa1fb951dd78a88d3ae15d9.tar.bz2 scummvm-rg350-b757e22f881797f51fa1fb951dd78a88d3ae15d9.zip |
NEVERHOOD: Multiple changes to make the game logic code cleaner (hopefully :)
- Introduce Scene::insertStaticSprite to create static sprites instead of the old "addSprite(new StaticSprite" (not used everywhere yet)
- Introduce macro InsertKlayman to create the Klayman object
- Change sendMessage semantics from "receiver->sendMessage(num,arg,sender)" to "sendMessage(receiver,num,arg)", the sender is always the sending object ("this")
- Similar changes using macros will follow
- And fixed a bug in the elevator
24 files changed, 587 insertions, 636 deletions
diff --git a/engines/neverhood/collisionman.cpp b/engines/neverhood/collisionman.cpp index 4296b91a10..a1314bfe0f 100644 --- a/engines/neverhood/collisionman.cpp +++ b/engines/neverhood/collisionman.cpp @@ -98,7 +98,7 @@ void CollisionMan::checkCollision(Sprite *sprite, uint16 flags, int messageNum, for (Common::Array<Sprite*>::iterator iter = _sprites.begin(); iter != _sprites.end(); iter++) { Sprite *collSprite = *iter; if ((sprite->getFlags() & flags) && collSprite->checkCollision(sprite->getRect())) { - collSprite->sendMessage(messageNum, messageParam, sprite); + sprite->sendMessage(collSprite, messageNum, messageParam); } } } diff --git a/engines/neverhood/diskplayerscene.cpp b/engines/neverhood/diskplayerscene.cpp index dd2c837dbd..3eeef9204d 100644 --- a/engines/neverhood/diskplayerscene.cpp +++ b/engines/neverhood/diskplayerscene.cpp @@ -225,10 +225,10 @@ uint32 DiskplayerPlayButton::handleMessage(int messageNum, const MessageParam &p case 0x1011: if (!_diskplayerScene->getFlag3()) { if (_isPlaying) { - _diskplayerScene->sendMessage(0x2001, 0, this); + sendMessage(_diskplayerScene, 0x2001, 0); release(); } else { - _diskplayerScene->sendMessage(0x2000, 0, this); + sendMessage(_diskplayerScene, 0x2000, 0); press(); } } @@ -500,7 +500,7 @@ uint32 DiskplayerScene::handleMessage(int messageNum, const MessageParam ¶m, case 0x0001: // TODO: Debug/Cheat if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } else if (!_flag3 && param.asPoint().x > 38 && param.asPoint().x < 598 && param.asPoint().y > 400 && param.asPoint().y < 460) { diff --git a/engines/neverhood/entity.h b/engines/neverhood/entity.h index e49aa94e08..582e93f77f 100644 --- a/engines/neverhood/entity.h +++ b/engines/neverhood/entity.h @@ -96,20 +96,23 @@ public: (this->*_updateHandlerCb)(); } bool hasMessageHandler() const { return _messageHandlerCb != NULL; } - uint32 sendMessage(int messageNum, const MessageParam ¶m, Entity *sender) { - debug(2, "sendMessage(%04X) -> [%s]", messageNum, _messageHandlerCbName.c_str()); + uint32 receiveMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + debug(2, "receiveMessage(%04X) -> [%s]", messageNum, _messageHandlerCbName.c_str()); return _messageHandlerCb ? (this->*_messageHandlerCb)(messageNum, param, sender) : 0; } // NOTE: These were overloaded before for the various message parameter types // it caused some problems so each type gets its own sendMessage variant now - uint32 sendMessage(int messageNum, uint32 param, Entity *sender) { - return sendMessage(messageNum, MessageParam(param), sender); + uint32 sendMessage(Entity *receiver, int messageNum, const MessageParam ¶m) { + return receiver->receiveMessage(messageNum, param, this); } - uint32 sendPointMessage(int messageNum, const NPoint ¶m, Entity *sender) { - return sendMessage(messageNum, MessageParam(param), sender); + uint32 sendMessage(Entity *receiver, int messageNum, uint32 param) { + return receiver->receiveMessage(messageNum, MessageParam(param), this); } - uint32 sendEntityMessage(int messageNum, Entity *param, Entity *sender) { - return sendMessage(messageNum, MessageParam((Entity*)param), sender); + uint32 sendPointMessage(Entity *receiver, int messageNum, const NPoint ¶m) { + return receiver->receiveMessage(messageNum, MessageParam(param), this); + } + uint32 sendEntityMessage(Entity *receiver, int messageNum, Entity *param) { + return receiver->receiveMessage(messageNum, MessageParam((Entity*)param), this); } int getPriority() const { return _priority; } // Shortcuts for game variable access diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index fc2ca8ed03..650287b473 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -71,7 +71,7 @@ void GameModule::handleMouseMove(int16 x, int16 y) { mousePos.x = x; mousePos.y = y; debug(2, "GameModule::handleMouseMove(%d, %d)", x, y); - _childObject->sendPointMessage(0, mousePos, this); + sendPointMessage(_childObject, 0, mousePos); } } @@ -81,7 +81,7 @@ void GameModule::handleMouseDown(int16 x, int16 y) { mousePos.x = x; mousePos.y = y; debug(2, "GameModule::handleMouseDown(%d, %d)", x, y); - _childObject->sendPointMessage(1, mousePos, this); + sendPointMessage(_childObject, 1, mousePos); } } @@ -267,9 +267,9 @@ void GameModule::startup() { //createModule1700(-1); //createModule1700(1); //createModule1400(-1); -#if 0 - _vm->gameState().sceneNum = 10; - createModule3000(-1); +#if 1 + _vm->gameState().sceneNum = 1; + createModule1000(-1); #endif #if 0 _vm->gameState().sceneNum = 0; @@ -280,11 +280,11 @@ void GameModule::startup() { createModule2000(-1); #endif #if 0 - _vm->gameState().sceneNum = 46; + _vm->gameState().sceneNum = 0; createModule2200(-1); #endif -#if 1 - _vm->gameState().sceneNum = 16; +#if 0 + _vm->gameState().sceneNum = 5; createModule1300(-1); #endif } diff --git a/engines/neverhood/klayman.cpp b/engines/neverhood/klayman.cpp index 26f9d1afae..e0ca57ceca 100644 --- a/engines/neverhood/klayman.cpp +++ b/engines/neverhood/klayman.cpp @@ -57,7 +57,7 @@ static const KlaymanTableItem klaymanTable4[] = { // Klayman -Klayman::Klayman(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, int surfacePriority, int objectPriority) +Klayman::Klayman(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, int surfacePriority, int objectPriority, NRectArray *clipRects) : AnimatedSprite(vm, objectPriority), _soundResource1(vm), _soundResource2(vm), _counterMax(0), _counter(0), _flagE4(false), _counter3Max(0), _flagF8(false), _counter1(0), _counter2(0), /*_field118(0), */_status2(0), _flagE5(true), _attachedSprite(NULL), _flagE1(false), @@ -360,7 +360,7 @@ uint32 Klayman::handleMessage41D640(int messageNum, const MessageParam ¶m, E case 0x100D: if (param.asInteger() == 0xC1380080) { if (_attachedSprite) { - _attachedSprite->sendMessage(0x4806, 0, this); + sendMessage(_attachedSprite, 0x4806, 0); _soundResource1.play(0xC8004340); } } else if (param.asInteger() == 0x02B20220) { @@ -499,7 +499,7 @@ void Klayman::sub41C7B0() { removeCallbackList(); #endif } else { - _parentScene->sendMessage(0x1006, 0, this); + sendMessage(_parentScene, 0x1006, 0); } } @@ -975,15 +975,15 @@ void Klayman::spriteUpdate41F320() { _deltaX = 0; if (xdiff == 0) { - sendMessage(0x1019, 0, this); + sendMessage(this, 0x1019, 0); } else if (_status3 != 2 && _status3 != 3 && xdiff <= 42 && _frameIndex >= 5 && _frameIndex <= 11) { - sendMessage(0x1019, 0, this); + sendMessage(this, 0x1019, 0); } else if (_status3 != 2 && _status3 != 3 && xdiff <= 10 && (_frameIndex >= 12 || _frameIndex <= 4)) { - sendMessage(0x1019, 0, this); + sendMessage(this, 0x1019, 0); } else if (_status3 == 3 && xdiff < 30) { - sendMessage(0x1019, 0, this); + sendMessage(this, 0x1019, 0); } else if (_status3 == 3 && xdiff < 150 && _frameIndex >= 6) { - sendMessage(0x1019, 0, this); + sendMessage(this, 0x1019, 0); } else { HitRect *hitRectPrev = _vm->_collisionMan->findHitRectAtPos(_x, _y); _x += xdelta; @@ -1026,9 +1026,9 @@ uint32 Klayman::handleMessage41E210(int messageNum, const MessageParam ¶m, E switch (messageNum) { case 0x100D: if (param.asInteger() == 0x4AB28209) { - _attachedSprite->sendMessage(0x482A, 0, this); + sendMessage(_attachedSprite, 0x482A, 0); } else if (param.asInteger() == 0x88001184) { - _attachedSprite->sendMessage(0x482B, 0, this); + sendMessage(_attachedSprite, 0x482B, 0); } break; } @@ -1053,7 +1053,7 @@ uint32 Klayman::handleMessage41D4C0(int messageNum, const MessageParam ¶m, E case 0x100D: if (param.asInteger() == 0xC1380080) { if (_attachedSprite) { - _attachedSprite->sendMessage(0x4806, 0, this); + sendMessage(_attachedSprite, 0x4806, 0); } _soundResource1.play(0x40208200); } else if (param.asInteger() == 0x02B20220) { @@ -1090,7 +1090,7 @@ uint32 Klayman::handleMessage41DAD0(int messageNum, const MessageParam ¶m, E case 0x100D: if (param.asInteger() == 0x0D01B294) { if (_attachedSprite) { - _attachedSprite->sendMessage(0x480B, 0, this); + sendMessage(_attachedSprite, 0x480B, 0); } } else if (param.asInteger() == 0x32180101) { _soundResource1.play(0x4924AAC4); @@ -1375,7 +1375,7 @@ void Klayman::sub4201C0() { SetMessageHandler(&Klayman::handleMessage41D790); SetSpriteCallback(&Klayman::spriteUpdate41F230); SetAnimationCallback3(&Klayman::sub420340); - _attachedSprite->sendMessage(0x482B, 0, this); + sendMessage(_attachedSprite, 0x482B, 0); } uint32 Klayman::handleMessage41D790(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -1384,15 +1384,15 @@ uint32 Klayman::handleMessage41D790(int messageNum, const MessageParam ¶m, E case 0x100D: if (param.asInteger() == 0x168050A0) { if (_attachedSprite) { - _attachedSprite->sendMessage(0x4806, 0, this); + sendMessage(_attachedSprite, 0x4806, 0); } _flagE5 = true; } else if (param.asInteger() == 0x320AC306) { _soundResource1.play(0x5860C640); } else if (param.asInteger() == 0x4AB28209) { - _attachedSprite->sendMessage(0x482A, 0, this); + sendMessage(_attachedSprite, 0x482A, 0); } else if (param.asInteger() == 0x88001184) { - _attachedSprite->sendMessage(0x482B, 0, this); + sendMessage(_attachedSprite, 0x482B, 0); } break; } @@ -1430,7 +1430,7 @@ void Klayman::sub420290() { SetSpriteCallback(&Klayman::spriteUpdate41F230); SetMessageHandler(&Klayman::handleMessage41D880); SetAnimationCallback3(&Klayman::sub420380); - _attachedSprite->sendMessage(0x482B, 0, this); + sendMessage(_attachedSprite, 0x482B, 0); } } @@ -1440,14 +1440,14 @@ uint32 Klayman::handleMessage41D880(int messageNum, const MessageParam ¶m, E case 0x100D: if (param.asInteger() == 0x168050A0) { if (_attachedSprite) { - _attachedSprite->sendMessage(0x4806, 0, this); + sendMessage(_attachedSprite, 0x4806, 0); } } else if (param.asInteger() == 0x320AC306) { _soundResource1.play(0x5860C640); } else if (param.asInteger() == 0x4AB28209) { - _attachedSprite->sendMessage(0x482A, 0, this); + sendMessage(_attachedSprite, 0x482A, 0); } else if (param.asInteger() == 0x88001184) { - _attachedSprite->sendMessage(0x482B, 0, this); + sendMessage(_attachedSprite, 0x482B, 0); } break; } @@ -1475,7 +1475,7 @@ void Klayman::sub4203C0() { _status2 = 1; _flagE5 = false; if (_attachedSprite) { - _attachedSprite->sendMessage(0x4807, 0, this); + sendMessage(_attachedSprite, 0x4807, 0); _attachedSprite = NULL; } setFileHash(0xB869A4B9, 0, -1); @@ -1597,11 +1597,11 @@ uint32 Klayman::handleMessage41E0D0(int messageNum, const MessageParam ¶m, E } if (_statusE0 == 1) { if (_y4 >= _y - 30) { - sendMessage(0x1019, 0, this); + sendMessage(this, 0x1019, 0); } } else { if (_y4 <= _y) { - sendMessage(0x1019, 0, this); + sendMessage(this, 0x1019, 0); } } } @@ -1651,9 +1651,9 @@ uint32 Klayman::handleMessage41E490(int messageNum, const MessageParam ¶m, E switch (messageNum) { case 0x100D: if (param.asInteger() == 0x80C110B5) { - _parentScene->sendMessage(0x482A, 0, this); + sendMessage(_parentScene, 0x482A, 0); } else if (param.asInteger() == 0x110010D1) { - _parentScene->sendMessage(0x482B, 0, this); + sendMessage(_parentScene, 0x482B, 0); } else if (param.asInteger() == 0x32180101) { if (_soundFlag) { _soundResource1.play(0x48498E46); @@ -1795,7 +1795,7 @@ void Klayman::sub420F20() { void Klayman::spriteUpdate41F5A0() { if (!_flagF8 && ABS(_x4 - _x) < 80) { - _parentScene->sendMessage(0x4829, 0, this); + sendMessage(_parentScene, 0x4829, 0); _flagF8 = true; } AnimatedSprite::updateDeltaXY(); @@ -1812,7 +1812,7 @@ void Klayman::sub420600() { } void Klayman::sub420660() { - _attachedSprite->sendMessage(0x4807, 0, this); + sendMessage(_attachedSprite, 0x4807, 0); } uint32 Klayman::handleMessage41D970(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -1820,9 +1820,9 @@ uint32 Klayman::handleMessage41D970(int messageNum, const MessageParam ¶m, E case 0x100D: if (param.asInteger() == 0x01084280) { if (_attachedSprite) - _attachedSprite->sendMessage(0x480B, _doDeltaX ? 1 : 0, this); + sendMessage(_attachedSprite, 0x480B, _doDeltaX ? 1 : 0); } else if (param.asInteger() == 0x02421405) { - if (_flagE4 && _attachedSprite->hasMessageHandler() && _attachedSprite->sendMessage(0x480C, _doDeltaX ? 1 : 0, this) != 0) { + if (_flagE4 && _attachedSprite->hasMessageHandler() && sendMessage(_attachedSprite, 0x480C, _doDeltaX ? 1 : 0) != 0) { sub4205C0(); } else { setCallback1(AnimationCallback(&Klayman::sub420660)); @@ -1869,7 +1869,7 @@ void Klayman::sub420C50() { if (_flagF7) { sub420D50(); } else { - _attachedSprite->sendMessage(0x482B, 0, this); + sendMessage(_attachedSprite, 0x482B, 0); setFileHash(0x0C303040, 0, -1); SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); @@ -1882,7 +1882,7 @@ void Klayman::sub420C50() { void Klayman::sub420CD0() { setFileHash(0x0D318140, 0, -1); - _attachedSprite->sendMessage(0x480F, 0, this); + sendMessage(_attachedSprite, 0x480F, 0); SetAnimationCallback3(&Klayman::sub420D10); } @@ -1900,14 +1900,14 @@ void Klayman::sub420D50() { SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); SetMessageHandler(&Klayman::handleMessage41E210); - _attachedSprite->sendMessage(0x4807, 0, this); + sendMessage(_attachedSprite, 0x4807, 0); SetAnimationCallback3(&Klayman::sub420DA0); _flagE5 = false; } void Klayman::sub420DA0() { setFileHash(0x0D318140, 0, -1); - _attachedSprite->sendMessage(0x480F, 0, this); + sendMessage(_attachedSprite, 0x480F, 0); SetAnimationCallback3(&Klayman::sub420DE0); } @@ -1927,7 +1927,7 @@ void Klayman::sub420E20() { SetUpdateHandler(&Klayman::update); SetSpriteCallback(&Klayman::spriteUpdate41F230); SetMessageHandler(&Klayman::handleMessage41E210); - _attachedSprite->sendMessage(0x4807, 0, this); + sendMessage(_attachedSprite, 0x4807, 0); SetAnimationCallback3(&Klayman::sub420E90); _flagE5 = false; _flagF7 = false; @@ -1942,7 +1942,7 @@ void Klayman::sub420E90() { } void Klayman::sub420EB0() { - _attachedSprite->sendMessage(0x482A, 0, this); + sendMessage(_attachedSprite, 0x482A, 0); } void Klayman::sub420680() { @@ -2002,7 +2002,7 @@ uint32 Klayman::handleMessage41DD20(int messageNum, const MessageParam ¶m, E case 0x100D: if (param.asInteger() == 0x040D4186) { if (_attachedSprite) { - _attachedSprite->sendMessage(0x4808, 0, this); + sendMessage(_attachedSprite, 0x4808, 0); } } break; @@ -2078,7 +2078,7 @@ uint32 KmScene1001::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4836: if (param.asInteger() == 1) { - _parentScene->sendMessage(0x2002, 0, this); + sendMessage(_parentScene, 0x2002, 0); setCallback2(AnimationCallback(&Klayman::sub4211F0)); } break; @@ -2108,7 +2108,7 @@ uint32 KmScene1001::handleMessage44FA00(int messageNum, const MessageParam ¶ switch (messageNum) { case 0x100D: if (param.asInteger() == 0x4AB28209) { - _attachedSprite->sendMessage(0x480F, 0, this); + sendMessage(_attachedSprite, 0x480F, 0); } break; } @@ -2117,8 +2117,8 @@ uint32 KmScene1001::handleMessage44FA00(int messageNum, const MessageParam ¶ // KmScene1002 -KmScene1002::KmScene1002(NeverhoodEngine *vm, Entity *parentScene, Sprite *class599, Sprite *ssLadderArch, int16 x, int16 y) - : Klayman(vm, parentScene, x, y, 1000, 1000), _class599(class599), _ssLadderArch(ssLadderArch), _otherSprite(NULL), +KmScene1002::KmScene1002(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) + : Klayman(vm, parentScene, x, y, 1000, 1000), _otherSprite(NULL), _status(0) { setKlaymanTable1(); @@ -2197,21 +2197,21 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) { sub41CCE0(param.asInteger()); break; case 0x4820: - _parentScene->sendMessage(0x2005, 0, this); + sendMessage(_parentScene, 0x2005, 0); setCallback2(AnimationCallback(&Klayman::sub420970)); break; case 0x4821: - _parentScene->sendMessage(0x2005, 0, this); + sendMessage(_parentScene, 0x2005, 0); _y4 = param.asInteger(); setCallback2(AnimationCallback(&Klayman::sub4209D0)); break; case 0x4822: - _parentScene->sendMessage(0x2005, 0, this); + sendMessage(_parentScene, 0x2005, 0); _y4 = param.asInteger(); setCallback2(AnimationCallback(&Klayman::sub420AD0)); break; case 0x4823: - _parentScene->sendMessage(0x2006, 0, this); + sendMessage(_parentScene, 0x2006, 0); setCallback2(AnimationCallback(&Klayman::sub420BC0)); break; case 0x482E: @@ -2252,19 +2252,19 @@ uint32 KmScene1002::handleMessage449800(int messageNum, const MessageParam ¶ case 0x100D: if (param.asInteger() == 0x168050A0) { if (_attachedSprite) { - _attachedSprite->sendMessage(0x480F, 0, this); + sendMessage(_attachedSprite, 0x480F, 0); } } else if (param.asInteger() == 0x586B0300) { if (_otherSprite) { - _otherSprite->sendMessage(0x480E, 1, this); + sendMessage(_otherSprite, 0x480E, 1); } } else if (param.asInteger() == 0x4AB28209) { if (_attachedSprite) { - _attachedSprite->sendMessage(0x482A, 0, this); + sendMessage(_attachedSprite, 0x482A, 0); } } else if (param.asInteger() == 0x88001184) { if (_attachedSprite) { - _attachedSprite->sendMessage(0x482B, 0, this); + sendMessage(_attachedSprite, 0x482B, 0); } } break; @@ -2301,12 +2301,12 @@ uint32 KmScene1002::handleMessage449990(int messageNum, const MessageParam ¶ case 0x100D: if (param.asInteger() == 0x942D2081) { _flagE5 = false; - _attachedSprite->sendMessage(0x2003, 0, this); + sendMessage(_attachedSprite, 0x2003, 0); } else if (param.asInteger() == 0xDA600012) { sub44A370(); } else if (param.asInteger() == 0x0D01B294) { _flagE5 = false; - _attachedSprite->sendMessage(0x480B, 0, this); + sendMessage(_attachedSprite, 0x480B, 0); } break; } @@ -2318,12 +2318,12 @@ uint32 KmScene1002::handleMessage449A30(int messageNum, const MessageParam ¶ case 0x100D: if (param.asInteger() == 0x01084280) { if (_attachedSprite) { - _attachedSprite->sendMessage(0x480B, (uint32)_doDeltaX, this); + sendMessage(_attachedSprite, 0x480B, (uint32)_doDeltaX); } } else if (param.asInteger() == 0x02421405) { if (_flagE4) { if (_attachedSprite) { - if (_attachedSprite->sendMessage(0x480C, (uint32)_doDeltaX, this) != 0) { + if (sendMessage(_attachedSprite, 0x480C, (uint32)_doDeltaX) != 0) { sub44A460(); } } @@ -2331,9 +2331,9 @@ uint32 KmScene1002::handleMessage449A30(int messageNum, const MessageParam ¶ SetMessageHandler(&KmScene1002::handleMessage449BA0); } } else if (param.asInteger() == 0x4AB28209) { - _attachedSprite->sendMessage(0x482A, 0, this); + sendMessage(_attachedSprite, 0x482A, 0); } else if (param.asInteger() == 0x88001184) { - _attachedSprite->sendMessage(0x482B, 0, this); + sendMessage(_attachedSprite, 0x482B, 0); } else if (param.asInteger() == 0x32180101) { _soundResource1.play(0x405002D8); } else if (param.asInteger() == 0x0A2A9098) { @@ -2352,9 +2352,9 @@ uint32 KmScene1002::handleMessage449BA0(int messageNum, const MessageParam ¶ switch (messageNum) { case 0x100D: if (param.asInteger() == 0x4AB28209) { - _attachedSprite->sendMessage(0x482A, 0, this); + sendMessage(_attachedSprite, 0x482A, 0); } else if (param.asInteger() == 0x88001184) { - _attachedSprite->sendMessage(0x482B, 0, this); + sendMessage(_attachedSprite, 0x482B, 0); } else if (param.asInteger() == 0x32180101) { _soundResource1.play(0x405002D8); } else if (param.asInteger() == 0x0A2A9098) { @@ -2407,7 +2407,7 @@ void KmScene1002::spriteUpdate449DC0() { if (hitRect->type == 0x5001) { _y = hitRect->rect.y1; processDelta(); - sendMessage(0x1019, 0, this); + sendMessage(this, 0x1019, 0); } _vm->_collisionMan->checkCollision(this, 0xFFFF, 0x4810, 0); } @@ -2421,7 +2421,7 @@ void KmScene1002::sub449E20() { SetSpriteCallback(&AnimatedSprite::updateDeltaXY); SetMessageHandler(&KmScene1002::handleMessage449800); SetAnimationCallback3(&Klayman::sub420420); - _attachedSprite->sendMessage(0x482B, 0, this); + sendMessage(_attachedSprite, 0x482B, 0); } } @@ -2449,12 +2449,12 @@ void KmScene1002::sub449EF0() { SetSpriteCallback(&KmScene1002::spriteUpdate449DC0); SetAnimationCallback3(&KmScene1002::sub449F70); - _class599->sendMessage(0x482A, 0, this); - _ssLadderArch->sendMessage(0x482A, 0, this); + sendMessage(_class599, 0x482A, 0); + sendMessage(_ssLadderArch, 0x482A, 0); } void KmScene1002::sub449F70() { - _parentScene->sendMessage(0x1024, 1, this); + sendMessage(_parentScene, 0x1024, 1); _soundResource1.play(0x41648271); _status2 = 1; _flagE5 = false; @@ -2464,11 +2464,11 @@ void KmScene1002::sub449F70() { SetSpriteCallback(NULL); SetMessageHandler(&KmScene1002::handleMessage41D480); SetAnimationCallback3(&KmScene1002::sub44A230); - _parentScene->sendMessage(0x2002, 0, this); + sendMessage(_parentScene, 0x2002, 0); // TODO _callbackList = NULL; _attachedSprite = NULL; - _class599->sendMessage(0x482B, 0, this); - _ssLadderArch->sendMessage(0x482B, 0, this); + sendMessage(_class599, 0x482B, 0); + sendMessage(_ssLadderArch, 0x482B, 0); } void KmScene1002::sub44A050() { @@ -2480,8 +2480,8 @@ void KmScene1002::sub44A050() { SetSpriteCallback(&KmScene1002::spriteUpdate449DC0); SetMessageHandler(&Klayman::handleMessage41D480); SetAnimationCallback3(&KmScene1002::sub449F70); - _class599->sendMessage(0x482A, 0, this); - _ssLadderArch->sendMessage(0x482A, 0, this); + sendMessage(_class599, 0x482A, 0); + sendMessage(_ssLadderArch, 0x482A, 0); } void KmScene1002::sub44A0D0() { @@ -2493,12 +2493,12 @@ void KmScene1002::sub44A0D0() { SetMessageHandler(&Klayman::handleMessage41D360); SetSpriteCallback(&KmScene1002::spriteUpdate449DC0); SetAnimationCallback3(&KmScene1002::sub44A150); - _class599->sendMessage(0x482A, 0, this); - _ssLadderArch->sendMessage(0x482A, 0, this); + sendMessage(_class599, 0x482A, 0); + sendMessage(_ssLadderArch, 0x482A, 0); } void KmScene1002::sub44A150() { - _parentScene->sendMessage(0x1024, 1, this); + sendMessage(_parentScene, 0x1024, 1); _soundResource1.play(0x41648271); _status2 = 1; _flagE5 = false; @@ -2508,11 +2508,11 @@ void KmScene1002::sub44A150() { SetMessageHandler(&KmScene1002::handleMessage41D480); SetSpriteCallback(NULL); SetAnimationCallback3(&KmScene1002::sub44A230); - _parentScene->sendMessage(0x2002, 0, this); + sendMessage(_parentScene, 0x2002, 0); // TODO _callbackList = NULL; _attachedSprite = NULL; - _class599->sendMessage(0x482B, 0, this); - _ssLadderArch->sendMessage(0x482B, 0, this); + sendMessage(_class599, 0x482B, 0); + sendMessage(_ssLadderArch, 0x482B, 0); } void KmScene1002::sub44A230() { @@ -2522,7 +2522,7 @@ void KmScene1002::sub44A230() { void KmScene1002::sub44A250() { if (!sub41CEB0(AnimationCallback(&KmScene1002::sub44A250))) { - _parentScene->sendMessage(0x1024, 3, this); + sendMessage(_parentScene, 0x1024, 3); _status2 = 2; _flagE5 = false; setFileHash(0xB93AB151, 0, -1); @@ -2536,7 +2536,7 @@ void KmScene1002::sub44A250() { void KmScene1002::sub44A2C0() { if (_attachedSprite) { _x = ((Sprite*)_attachedSprite)->getX(); - _attachedSprite->sendMessage(0x4807, 0, this); + sendMessage(_attachedSprite, 0x4807, 0); _attachedSprite = NULL; } _status2 = 2; @@ -2569,7 +2569,7 @@ void KmScene1002::sub44A370() { } void KmScene1002::sub44A3C0() { - _parentScene->sendMessage(0x1024, 1, this); + sendMessage(_parentScene, 0x1024, 1); } void KmScene1002::sub44A3E0() { @@ -2597,7 +2597,7 @@ void KmScene1002::sub44A460() { } void KmScene1002::sub44A4B0() { - _attachedSprite->sendMessage(0x482A, 0, this); + sendMessage(_attachedSprite, 0x482A, 0); } // KmScene1004 @@ -2628,30 +2628,30 @@ uint32 KmScene1004::xHandleMessage(int messageNum, const MessageParam ¶m) { setCallback2(AnimationCallback(&KmScene1004::sub478170)); break; case 0x4820: - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); setCallback2(AnimationCallback(&Klayman::sub420970)); break; case 0x4821: - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); _y4 = param.asInteger(); setCallback2(AnimationCallback(&Klayman::sub4209D0)); break; case 0x4822: - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); _y4 = param.asInteger(); setCallback2(AnimationCallback(&Klayman::sub420AD0)); break; case 0x4823: - _parentScene->sendMessage(0x2001, 0, this); + sendMessage(_parentScene, 0x2001, 0); setCallback2(AnimationCallback(&Klayman::sub420BC0)); break; case 0x4824: - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); _y4 = _dataResource.getPoint(param.asInteger()).y; setCallback2(AnimationCallback(&Klayman::sub4209D0)); break; case 0x4825: - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); _y4 = _dataResource.getPoint(param.asInteger()).y; setCallback2(AnimationCallback(&Klayman::sub420AD0)); break; @@ -2674,7 +2674,7 @@ uint32 KmScene1004::handleMessage478110(int messageNum, const MessageParam ¶ case 0x100D: if (param.asInteger() == 0x04684052) { _flagE5 = true; - _parentScene->sendMessage(0x2002, 0, this); + sendMessage(_parentScene, 0x2002, 0); } break; } @@ -2818,7 +2818,7 @@ uint32 KmScene1201::handleMessage40DDF0(int messageNum, const MessageParam ¶ if (param.asInteger() == 0x01084280) { _soundResource1.play(0x405002D8); if (_attachedSprite) { - _attachedSprite->sendMessage(0x480B, 0, this); + sendMessage(_attachedSprite, 0x480B, 0); } } else if (param.asInteger() == 0x02421405) { if (_countdown != 0) { @@ -2876,7 +2876,7 @@ void KmScene1201::sub40DFA0() { SetSpriteCallback(&AnimatedSprite::updateDeltaXY); SetMessageHandler(&KmScene1201::handleMessage40DEA0); SetAnimationCallback3(&Klayman::sub41FC80); - _class464->sendMessage(0x2006, 0, this); + sendMessage(_class464, 0x2006, 0); _soundResource1.play(0x62E0A356); } } @@ -2918,7 +2918,7 @@ uint32 KmScene1303::handleMessage4160A0(int messageNum, const MessageParam ¶ switch (messageNum) { case 0x100D: if (param.asInteger() == calcHash("PopBalloon")) { - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); } else if (param.asInteger() == 0x02B20220) { _soundResource1.play(0xC5408620); } else if (param.asInteger() == 0x0A720138) { @@ -3175,12 +3175,12 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) { setCallback2(AnimationCallback(&Klayman::sub421160)); break; case 0x4835: - _parentScene->sendMessage(0x2000, 1, this); + sendMessage(_parentScene, 0x2000, 1); _flag1 = true; setCallback2(AnimationCallback(&Klayman::sub4212C0)); break; case 0x4836: - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); _flag1 = false; setCallback2(AnimationCallback(&Klayman::sub421310)); break; @@ -3702,12 +3702,12 @@ uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam ¶m) { setCallback2(AnimationCallback(&Klayman::sub421160)); break; case 0x4835: - _parentScene->sendMessage(0x2000, 1, this); + sendMessage(_parentScene, 0x2000, 1); _flag = true; setCallback2(AnimationCallback(&Klayman::sub4212C0)); break; case 0x4836: - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); _flag = false; setCallback2(AnimationCallback(&Klayman::sub421310)); break; @@ -3741,7 +3741,7 @@ void KmScene1705::spriteUpdate468A30() { if (hitRect->type == 0x5001) { _y = hitRect->rect.y1; processDelta(); - sendMessage(0x1019, 0, this); + sendMessage(this, 0x1019, 0); } } @@ -3821,12 +3821,12 @@ uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam ¶m) { setCallback2(AnimationCallback(&Klayman::sub421160)); break; case 0x4835: - _parentScene->sendMessage(0x2000, 1, this); + sendMessage(_parentScene, 0x2000, 1); _flag = true; setCallback2(AnimationCallback(&Klayman::sub4212C0)); break; case 0x4836: - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); _flag = false; setCallback2(AnimationCallback(&Klayman::sub421310)); break; @@ -4189,14 +4189,14 @@ void KmScene2206::spriteUpdate482450() { _yDelta++; _y += _yDelta; if (_y > 600) { - sendMessage(0x1019, 0, this); + sendMessage(this, 0x1019, 0); } } void KmScene2206::sub482490() { if (!sub41CF10(AnimationCallback(&KmScene2206::sub482490))) { _status2 = 1; - _parentScene->sendMessage(0x4803, 0, this); + sendMessage(_parentScene, 0x4803, 0); _flagE5 = false; _yDelta = 0; setFileHash(0x5420E254, 0, -1); @@ -4322,7 +4322,7 @@ void KmScene2207::sub4424B0() { void KmScene2207::sub442520() { setFileHash(0x0D318140, 0, -1); SetAnimationCallback3(&KmScene2207::sub442560); - _attachedSprite->sendMessage(0x480F, 0, this); + sendMessage(_attachedSprite, 0x480F, 0); } void KmScene2207::sub442560() { diff --git a/engines/neverhood/klayman.h b/engines/neverhood/klayman.h index a5381c8dd1..23bd110568 100644 --- a/engines/neverhood/klayman.h +++ b/engines/neverhood/klayman.h @@ -41,7 +41,8 @@ struct KlaymanTableItem { class Klayman : public AnimatedSprite { public: - Klayman(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, int surfacePriority = 1000, int objectPriority = 1000); + Klayman(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, int surfacePriority = 1000, int objectPriority = 1000, NRectArray *clipRects = NULL); + void init() { } void update(); @@ -259,7 +260,11 @@ protected: class KmScene1002 : public Klayman { public: - KmScene1002(NeverhoodEngine *vm, Entity *parentScene, Sprite *class599, Sprite *ssLadderArch, int16 x, int16 y); + KmScene1002(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + void init(Sprite *class599, Sprite *ssLadderArch) { + _class599 = class599; + _ssLadderArch = ssLadderArch; + } protected: Sprite *_class599; Sprite *_ssLadderArch; diff --git a/engines/neverhood/module.cpp b/engines/neverhood/module.cpp index edf67c7ea3..c38b96e199 100644 --- a/engines/neverhood/module.cpp +++ b/engines/neverhood/module.cpp @@ -47,7 +47,7 @@ uint32 Module::handleMessage(int messageNum, const MessageParam ¶m, Entity * switch (messageNum) { case 0x0008: if (_parentModule) - _parentModule->sendMessage(8, 0, this); + sendMessage(_parentModule, 8, 0); return 0; case 0x1009: _field24 = -1; @@ -67,7 +67,7 @@ uint32 Module::handleMessage(int messageNum, const MessageParam ¶m, Entity * return 0; default: if (_childObject && sender == _parentModule) - return _childObject->sendMessage(messageNum, param, sender); + return sender->sendMessage(_childObject, messageNum, param); } return 0; } diff --git a/engines/neverhood/module1000.cpp b/engines/neverhood/module1000.cpp index 5e1ae6fde3..011ea9e1de 100644 --- a/engines/neverhood/module1000.cpp +++ b/engines/neverhood/module1000.cpp @@ -67,7 +67,6 @@ Module1000::~Module1000() { void Module1000::createScene1001(int which) { _vm->gameState().sceneNum = 0; _childObject = new Scene1001(_vm, this, which); - // TODO ResourceTable_multiLoad(&_resourceTable1, &_resourceTable2, &_resourceTable3); // TODO Music18hList_play(0x061880C6, 0, 0, 1); SetUpdateHandler(&Module1000::updateScene1001); } @@ -75,7 +74,6 @@ void Module1000::createScene1001(int which) { void Module1000::createScene1002(int which) { _vm->gameState().sceneNum = 1; _childObject = new Scene1002(_vm, this, which); - // TODO ResourceTable_multiLoad(&_resourceTable3, &_resourceTable4, &_resourceTable1); // TODO Music18hList_play(0x061880C6, 0, 0, 1); SetUpdateHandler(&Module1000::updateScene1002); } @@ -91,7 +89,6 @@ void Module1000::createScene1004(int which) { _vm->gameState().sceneNum = 3; _childObject = new Scene1004(_vm, this, which); SetUpdateHandler(&Module1000::updateScene1004); - // TODO ResourceTable_multiLoad(&_resourceTable4, &_resourceTable3, &_resourceTable1); // TODO Music18hList_stop(0x061880C6, 0, 2); } @@ -106,7 +103,6 @@ void Module1000::createScene1005(int which) { void Module1000::updateScene1001() { _childObject->handleUpdate(); if (_done) { - debug("SCENE 1001 DONE; _field20 = %d", _field20); _done = false; delete _childObject; _childObject = NULL; @@ -118,30 +114,16 @@ void Module1000::updateScene1001() { _childObject->handleUpdate(); } } - if (_field24 >= 0) { - if (_field24 == 2) { - // TODO ResourceTable_multiLoad(&_resourceTable2, &_resourceTable1, &_resourceTable3); - _field24 = -1; - } else { - // TODO ResourceTable_multiLoad(&_resourceTable3, &_resourceTable1); - _field24 = -1; - } - } - if (_field26 >= 0) { - // TODO ResourceTable_multiLoad(&_resourceTable1, &_resourceTable2, &_resourceTable3); - _field26 = -1; - } } void Module1000::updateScene1002() { _childObject->handleUpdate(); if (_done) { - debug("SCENE 1002 DONE; _field20 = %d", _field20); _done = false; delete _childObject; _childObject = NULL; if (_field20 == 1) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } else if (_field20 == 2) { createScene1004(0); _childObject->handleUpdate(); @@ -150,27 +132,6 @@ void Module1000::updateScene1002() { _childObject->handleUpdate(); } } - if (_field24 >= 0) { - if (_field24 == 1) { - _parentModule->sendMessage(0x100A, 0, this); - } else if (_field24 == 2) { - // TODO ResourceTable_multiLoad(&_resourceTable4, &_resourceTable3, &_resourceTable1); - } else { - // TODO ResourceTable_multiLoad(&_resourceTable1, &_resourceTable3); - } - _field24 = -1; - } - if (_field26 >= 0) { - if (_field26 == 1) { - _parentModule->sendMessage(0x1023, 0, this); - } else { - // TODO ResourceTable_multiLoad(&_resourceTable3, &_resourceTable4, &_resourceTable1); - } - _field26 = -1; - } - if (_field28 >= 0) { - _field28 = -1; - } } void Module1000::updateScene1003() { @@ -187,7 +148,6 @@ void Module1000::updateScene1003() { void Module1000::updateScene1004() { _childObject->handleUpdate(); if (_done) { - debug("SCENE 1004 DONE; _field20 = %d", _field20); _done = false; delete _childObject; _childObject = NULL; @@ -199,22 +159,11 @@ void Module1000::updateScene1004() { _childObject->handleUpdate(); } } - if (_field24 >= 0) { - if (_field24 == 0) { - // TODO ResourceTable_multiLoad(&_resourceTable3, &_resourceTable4, &_resourceTable1); - } - _field24 = -1; - } - if (_field26 >= 0) { - // TODO ResourceTable_multiLoad(&_resourceTable4, &_resourceTable3, &_resourceTable1); - _field26 = -1; - } } void Module1000::updateScene1005() { _childObject->handleUpdate(); if (_done) { - debug("SCENE 1005 DONE"); // TODO Music18hList_stop(_musicFileHash, 0, 1); _done = false; delete _childObject; @@ -323,7 +272,7 @@ uint32 AsScene1001Hammer::handleMessage(int messageNum, const MessageParam ¶ case 0x100D: if (param.asInteger() == 0x00352100) { if (_asDoor) { - _asDoor->sendMessage(0x2000, 0, this); + sendMessage(_asDoor, 0x2000, 0); } } else if (param.asInteger() == 0x0A1A0109) { _soundResource.play(0x66410886); @@ -388,13 +337,13 @@ uint32 AsScene1001Lever::handleMessage(int messageNum, const MessageParam ¶m switch (messageNum) { case 0x100D: if (param.asInteger() == 0x00C0C444) { - _parentScene->sendMessage(0x480F, 0, this); + sendMessage(_parentScene, 0x480F, 0); } else if (param.asInteger() == 0xC41A02C0) { _soundResource.play(0x40581882); } break; case 0x1011: - _parentScene->sendMessage(0x4826, 0, this); + sendMessage(_parentScene, 0x4826, 0); messageResult = 1; break; case 0x3002: @@ -405,10 +354,10 @@ uint32 AsScene1001Lever::handleMessage(int messageNum, const MessageParam ¶m setFileHash(0x04A98C36, 0, -1); break; case 0x482A: - _parentScene->sendMessage(0x1022, 990, this); + sendMessage(_parentScene, 0x1022, 990); break; case 0x482B: - _parentScene->sendMessage(0x1022, 1010, this); + sendMessage(_parentScene, 0x1022, 1010); break; } return messageResult; @@ -434,7 +383,7 @@ uint32 SsCommonButtonSprite::handleMessage(int messageNum, const MessageParam &p uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x480B: - _parentScene->sendMessage(0x480B, 0, this); + sendMessage(_parentScene, 0x480B, 0); _surface->setVisible(true); _countdown = 8; _soundResource.play(_soundFileHash); @@ -483,7 +432,7 @@ Scene1001::Scene1001(NeverhoodEngine *vm, Module *parentModule, int which) } addSprite(_klayman); - tempSprite = addSprite(new StaticSprite(_vm, 0x2080A3A8, 1300)); + tempSprite = insertStaticSprite(0x2080A3A8, 1300); // TODO: This sucks somehow, find a better way _klayman->getSurface()->getClipRect().x1 = 0; @@ -503,13 +452,13 @@ Scene1001::Scene1001(NeverhoodEngine *vm, Module *parentModule, int which) _asLever = addSprite(new AsScene1001Lever(_vm, this, 150, 433, 1)); - addSprite(new StaticSprite(_vm, 0x809861A6, 950)); - addSprite(new StaticSprite(_vm, 0x89C03848, 1100)); + insertStaticSprite(0x809861A6, 950); + insertStaticSprite(0x89C03848, 1100); _ssButton = addSprite(new SsCommonButtonSprite(_vm, this, 0x15288120, 100, 0)); if (getGlobalVar(0x03C698DA) == 0) { - tempSprite = addSprite(new StaticSprite(_vm, 0x8C066150, 200)); + tempSprite = insertStaticSprite(0x8C066150, 200); _asWindow = addSprite(new AsScene1001Window(_vm)); _asWindow->getSurface()->getClipRect().x1 = tempSprite->getSurface()->getDrawRect().x; _asWindow->getSurface()->getClipRect().y1 = tempSprite->getSurface()->getDrawRect().y; @@ -534,18 +483,18 @@ uint32 Scene1001::handleMessage(int messageNum, const MessageParam ¶m, Entit switch (messageNum) { case 0x0001: if (param.asPoint().x == 0 && getGlobalVar(0xA4014072)) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } break; case 0x000D: if (param.asInteger() == 0x188B2105) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); messageResult = 1; } break; case 0x100D: if (param.asInteger() == 0x00342624) { - _klayman->sendMessage(0x1014, _asLever, this); + sendEntityMessage(_klayman, 0x1014, _asLever); setMessageList2(0x004B4910); messageResult = 1; } else if (param.asInteger() == 0x21E64A00) { @@ -556,7 +505,7 @@ uint32 Scene1001::handleMessage(int messageNum, const MessageParam ¶m, Entit } messageResult = 1; } else if (param.asInteger() == 0x040424D0) { - _klayman->sendMessage(0x1014, _ssButton, this); + sendEntityMessage(_klayman, 0x1014, _ssButton); } else if (param.asInteger() == 0x80006358) { if (getGlobalVar(0x03C698DA)) { setMessageList(0x004B4938); @@ -570,12 +519,12 @@ uint32 Scene1001::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x480B: if (_asWindow) { - _asWindow->sendMessage(0x2001, 0, this); + sendMessage(_asWindow, 0x2001, 0); } break; case 0x480F: if (_asHammer) { - _asHammer->sendMessage(0x2000, 0, this); + sendMessage(_asHammer, 0x2000, 0); } break; } @@ -594,10 +543,10 @@ uint32 SsScene1002LadderArch::handleMessage(int messageNum, const MessageParam & uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x482A: - _parentScene->sendMessage(0x1022, 995, this); + sendMessage(_parentScene, 0x1022, 995); break; case 0x482B: - _parentScene->sendMessage(0x1022, 1015, this); + sendMessage(_parentScene, 0x1022, 1015); break; } return messageResult; @@ -613,10 +562,10 @@ uint32 Class599::handleMessage(int messageNum, const MessageParam ¶m, Entity uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x482A: - _parentScene->sendMessage(0x1022, 995, this); + sendMessage(_parentScene, 0x1022, 995); break; case 0x482B: - _parentScene->sendMessage(0x1022, 1015, this); + sendMessage(_parentScene, 0x1022, 1015); break; } return messageResult; @@ -666,7 +615,7 @@ uint32 AsScene1002Ring::handleMessage4475E0(int messageNum, const MessageParam & switch (messageNum) { case 0x4806: setDoDeltaX(((Sprite*)sender)->isDoDeltaX() ? 1 : 0); - _parentScene->sendMessage(0x4806, 0, this); + sendMessage(_parentScene, 0x4806, 0); SetMessageHandler(&AsScene1002Ring::handleMessage447760); if (_flag1) { setFileHash(0x87502558, 0, -1); @@ -676,15 +625,15 @@ uint32 AsScene1002Ring::handleMessage4475E0(int messageNum, const MessageParam & break; case 0x480F: setDoDeltaX(((Sprite*)sender)->isDoDeltaX() ? 1 : 0); - _parentScene->sendMessage(0x480F, 0, this); + sendMessage(_parentScene, 0x480F, 0); SetMessageHandler(&AsScene1002Ring::handleMessage447890); setFileHash(0x861A2020, 0, -1); break; case 0x482A: - _parentScene->sendMessage(0x1022, 990, this); + sendMessage(_parentScene, 0x1022, 990); break; case 0x482B: - _parentScene->sendMessage(0x1022, 1010, this); + sendMessage(_parentScene, 0x1022, 1010); break; } return messageResult; @@ -703,16 +652,16 @@ uint32 AsScene1002Ring::handleMessage447760(int messageNum, const MessageParam & } break; case 0x4807: - _parentScene->sendMessage(0x4807, 0, this); + sendMessage(_parentScene, 0x4807, 0); setDoDeltaX(_vm->_rnd->getRandomNumber(1)); setFileHash(0x8258A030, 0, -1); SetMessageHandler(&AsScene1002Ring::handleMessage447A00); break; case 0x482A: - _parentScene->sendMessage(0x1022, 990, this); + sendMessage(_parentScene, 0x1022, 990); break; case 0x482B: - _parentScene->sendMessage(0x1022, 1010, this); + sendMessage(_parentScene, 0x1022, 1010); break; } return messageResult; @@ -726,10 +675,10 @@ uint32 AsScene1002Ring::handleMessage447890(int messageNum, const MessageParam & SetMessageHandler(&AsScene1002Ring::handleMessage447930); break; case 0x482A: - _parentScene->sendMessage(0x1022, 990, this); + sendMessage(_parentScene, 0x1022, 990); break; case 0x482B: - _parentScene->sendMessage(0x1022, 1010, this); + sendMessage(_parentScene, 0x1022, 1010); break; } return messageResult; @@ -739,16 +688,16 @@ uint32 AsScene1002Ring::handleMessage447930(int messageNum, const MessageParam & uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x4807: - _parentScene->sendMessage(0x4807, 0, this); + sendMessage(_parentScene, 0x4807, 0); setDoDeltaX(_vm->_rnd->getRandomNumber(1)); setFileHash(0x8258A030, 0, -1); SetMessageHandler(&AsScene1002Ring::handleMessage447A00); break; case 0x482A: - _parentScene->sendMessage(0x1022, 990, this); + sendMessage(_parentScene, 0x1022, 990); break; case 0x482B: - _parentScene->sendMessage(0x1022, 1010, this); + sendMessage(_parentScene, 0x1022, 1010); break; } return messageResult; @@ -766,10 +715,10 @@ uint32 AsScene1002Ring::handleMessage447A00(int messageNum, const MessageParam & setFileHash(0xA85C4011, 0, -1); break; case 0x482A: - _parentScene->sendMessage(0x1022, 990, this); + sendMessage(_parentScene, 0x1022, 990); break; case 0x482B: - _parentScene->sendMessage(0x1022, 1010, this); + sendMessage(_parentScene, 0x1022, 1010); break; } return messageResult; @@ -891,7 +840,7 @@ uint32 AsScene1002DoorSpy::handleMessage4489D0(int messageNum, const MessagePara switch (messageNum) { case 0x100D: if (param.asInteger() == 0xA61CA1C2) { - _class505->sendMessage(0x2004, 0, this); + sendMessage(_class505, 0x2004, 0); } else if (param.asInteger() == 0x14CE0620) { _soundResource.play(); } @@ -1025,7 +974,7 @@ uint32 Class426::handleMessage(int messageNum, const MessageParam ¶m, Entity uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x480B: - _parentScene->sendMessage(0x480B, 0, this); + sendMessage(_parentScene, 0x480B, 0); _status = 1; _countdown = 4; _surface->setVisible(true); @@ -1098,12 +1047,12 @@ uint32 AsScene1002VenusFlyTrap::handleMessage448000(int messageNum, const Messag case 0x1011: if (_flag) { if (_x >= 154 && _x <= 346) { - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); messageResult = 1; } } else { if (_x >= 174 && _x <= 430) { - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); messageResult = 1; } } @@ -1146,10 +1095,10 @@ uint32 AsScene1002VenusFlyTrap::handleMessage448000(int messageNum, const Messag sub448780(); break; case 0x482A: - _parentScene->sendMessage(0x1022, 995, this); + sendMessage(_parentScene, 0x1022, 995); break; case 0x482B: - _parentScene->sendMessage(0x1022, 1015, this); + sendMessage(_parentScene, 0x1022, 1015); break; } return messageResult; @@ -1174,14 +1123,14 @@ uint32 AsScene1002VenusFlyTrap::handleMessage448320(int messageNum, const Messag } else if (param.asInteger() == 0x41881801) { if (_flag) { if (_x > 330) { - _klayman->sendMessage(0x4811, 2, this); + sendMessage(_klayman, 0x4811, 2); } else if (_x > 265) { - _klayman->sendMessage(0x4811, 0, this); + sendMessage(_klayman, 0x4811, 0); } else { - _klayman->sendMessage(0x4811, 0, this); + sendMessage(_klayman, 0x4811, 0); } } else { - _klayman->sendMessage(0x4811, 0, this); + sendMessage(_klayman, 0x4811, 0); } } else if (param.asInteger() == 0x522200A0) { _soundResource.play(0x931080C8); @@ -1191,10 +1140,10 @@ uint32 AsScene1002VenusFlyTrap::handleMessage448320(int messageNum, const Messag removeCallbacks(); break; case 0x482A: - _parentScene->sendMessage(0x1022, 995, this); + sendMessage(_parentScene, 0x1022, 995); break; case 0x482B: - _parentScene->sendMessage(0x1022, 1015, this); + sendMessage(_parentScene, 0x1022, 1015); break; } return messageResult; @@ -1216,7 +1165,7 @@ void AsScene1002VenusFlyTrap::sub448530() { } void AsScene1002VenusFlyTrap::sub448560() { - _parentScene->sendMessage(0x4807, 0, this); + sendMessage(_parentScene, 0x4807, 0); setFileHash(0x82292851, 0, -1); SetUpdateHandler(&AsScene1002VenusFlyTrap::update); SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage4482E0); @@ -1287,7 +1236,7 @@ void AsScene1002VenusFlyTrap::sub448780() { } else { setDoDeltaX(_x > 320 ? 1 : 0); } - _klayman->sendMessage(0x2001, 0, this); + sendMessage(_klayman, 0x2001, 0); setFileHash(0x8C2C80D4, 0, -1); SetUpdateHandler(&AsScene1002VenusFlyTrap::update); SetMessageHandler(&AsScene1002VenusFlyTrap::handleMessage448320); @@ -1426,7 +1375,7 @@ uint32 Class479::handleMessage(int messageNum, const MessageParam ¶m, Entity switch (messageNum) { case 0x100D: if (param.asInteger() == 0x4AB28209) { - _parentScene->sendMessage(0x1022, 1200, this); + sendMessage(_parentScene, 0x1022, 1200); _flag1 = true; _savedClipRect = _surface->getClipRect(); _surface->getClipRect().x1 = 0; @@ -1434,7 +1383,7 @@ uint32 Class479::handleMessage(int messageNum, const MessageParam ¶m, Entity _surface->getClipRect().x2 = 640; _surface->getClipRect().y2 = 480; } else if (param.asInteger() == 0x88001184) { - _parentScene->sendMessage(0x1022, 1000, this); + sendMessage(_parentScene, 0x1022, 1000); if (_flag1) { _surface->getClipRect() = _savedClipRect; } @@ -1464,19 +1413,19 @@ Scene1002::Scene1002(NeverhoodEngine *vm, Module *parentModule, int which) _flag = false; - addSprite(new StaticSprite(_vm, 0x06149428, 1100)); - addSprite(new StaticSprite(_vm, 0x312C8774, 1100)); + insertStaticSprite(0x06149428, 1100); + insertStaticSprite(0x312C8774, 1100); _ssLadderArch = addSprite(new SsScene1002LadderArch(_vm, this)); - _ssLadderArchPart1 = addSprite(new StaticSprite(_vm, 0x060000A0, 1200)); - _ssLadderArchPart2 = addSprite(new StaticSprite(_vm, 0xB2A423B0, 1100)); - _ssLadderArchPart3 = addSprite(new StaticSprite(_vm, 0x316E0772, 1100)); + _ssLadderArchPart1 = insertStaticSprite(0x060000A0, 1200); + _ssLadderArchPart2 = insertStaticSprite(0xB2A423B0, 1100); + _ssLadderArchPart3 = insertStaticSprite(0x316E0772, 1100); _class599 = addSprite(new Class599(_vm, this)); if (which < 0) { if (_vm->_gameState.field2 == 0) { - _klayman = new KmScene1002(_vm, this, _class599, _ssLadderArch, 90, 226); + InsertKlayman(KmScene1002, 90, 226, (_class599, _ssLadderArch)); _class478 = addSprite(new Class478(_vm, _klayman)); setMessageList(0x004B4270); _klayman->getSurface()->getClipRect().x1 = 31; @@ -1486,7 +1435,7 @@ Scene1002::Scene1002(NeverhoodEngine *vm, Module *parentModule, int which) _class478->getSurface()->getClipRect() = _klayman->getSurface()->getClipRect(); _klayman->setRepl(64, 0); } else { - _klayman = new KmScene1002(_vm, this, _class599, _ssLadderArch, 379, 435); + InsertKlayman(KmScene1002, 379, 435, (_class599, _ssLadderArch)); _class478 = addSprite(new Class478(_vm, _klayman)); setMessageList(0x004B4270); _klayman->getSurface()->getClipRect().x1 = _ssLadderArch->getSurface()->getDrawRect().x; @@ -1496,7 +1445,7 @@ Scene1002::Scene1002(NeverhoodEngine *vm, Module *parentModule, int which) _class478->getSurface()->getClipRect() = _klayman->getSurface()->getClipRect(); } } else if (which == 1) { - _klayman = new KmScene1002(_vm, this, _class599, _ssLadderArch, 650, 435); + InsertKlayman(KmScene1002, 650, 435, (_class599, _ssLadderArch)); _class478 = addSprite(new Class478(_vm, _klayman)); setMessageList(0x004B4478); _klayman->getSurface()->getClipRect().x1 = _ssLadderArch->getSurface()->getDrawRect().x; @@ -1506,7 +1455,7 @@ Scene1002::Scene1002(NeverhoodEngine *vm, Module *parentModule, int which) _class478->getSurface()->getClipRect() = _klayman->getSurface()->getClipRect(); _vm->_gameState.field2 = 1; } else if (which == 2) { - _klayman = new KmScene1002(_vm, this, _class599, _ssLadderArch, 68, 645); + InsertKlayman(KmScene1002, 68, 645, (_class599, _ssLadderArch)); _class478 = addSprite(new Class478(_vm, _klayman)); setMessageList(0x004B4298); _klayman->getSurface()->getClipRect().x1 = _ssLadderArch->getSurface()->getDrawRect().x; @@ -1515,9 +1464,9 @@ Scene1002::Scene1002(NeverhoodEngine *vm, Module *parentModule, int which) _klayman->getSurface()->getClipRect().y2 = _ssLadderArchPart1->getSurface()->getDrawRect().y + _ssLadderArchPart1->getSurface()->getDrawRect().height; _class478->getSurface()->getClipRect() = _klayman->getSurface()->getClipRect(); _vm->_gameState.field2 = 1; - _klayman->sendMessage(0x4820, 0, this); + sendMessage(_klayman, 0x4820, 0); } else { - _klayman = new KmScene1002(_vm, this, _class599, _ssLadderArch, 90, 226); + InsertKlayman(KmScene1002, 90, 226, (_class599, _ssLadderArch)); _class478 = addSprite(new Class478(_vm, _klayman)); setMessageList(0x004B4470); _klayman->getSurface()->getClipRect().x1 = 31; @@ -1531,11 +1480,9 @@ Scene1002::Scene1002(NeverhoodEngine *vm, Module *parentModule, int which) _vm->_gameState.field2 = 0; } - addSprite(_klayman); - _mouseCursor = addSprite(new Mouse433(_vm, 0x23303124, NULL)); - tempSprite = addSprite(new StaticSprite(_vm, 0xB3242310, 825)); + tempSprite = insertStaticSprite(0xB3242310, 825); tempClipRect.x1 = tempSprite->getSurface()->getDrawRect().x; tempClipRect.y1 = tempSprite->getSurface()->getDrawRect().y; tempClipRect.x2 = _ssLadderArchPart2->getSurface()->getDrawRect().x + _ssLadderArchPart2->getSurface()->getDrawRect().width; @@ -1558,7 +1505,7 @@ Scene1002::Scene1002(NeverhoodEngine *vm, Module *parentModule, int which) _vm->_collisionMan->addSprite(_asVenusFlyTrap); - _klayman->sendEntityMessage(0x2007, _asVenusFlyTrap, this); + sendEntityMessage(_klayman, 0x2007, _asVenusFlyTrap); _class506 = addSprite(new Class506(_vm)); @@ -1587,7 +1534,7 @@ void Scene1002::update() { } if (_flag1BE && _klayman->getY() > 422) { - _parentModule->sendMessage(0x1024, 1, this); + sendMessage(_parentModule, 0x1024, 1); _flag1BE = false; } @@ -1602,14 +1549,14 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit if (param.asPoint().x == 0 && getGlobalVar(0xA4014072)) { setGlobalVar(0x8306F218, 1); setGlobalVar(0x1B144052, 3); - _parentModule->sendMessage(0x1009, 1, this); + sendMessage(_parentModule, 0x1009, 1); } break; case 0x000D: if (param.asInteger() == 0x48848178) { setGlobalVar(0x8306F218, 1); setGlobalVar(0x1B144052, 3); - _parentModule->sendMessage(0x1009, 1, this); + sendMessage(_parentModule, 0x1009, 1); } messageResult = 1; break; @@ -1624,15 +1571,15 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit messageResult = 1; } else if (param.asInteger() == 0x4A845A00) { // TODO _resourceTable4.load(); - _klayman->sendEntityMessage(0x1014, _asRing1, this); + sendEntityMessage(_klayman, 0x1014, _asRing1); } else if (param.asInteger() == 0x43807801) { // TODO _resourceTable4.load(); - _klayman->sendEntityMessage(0x1014, _asRing2, this); + sendEntityMessage(_klayman, 0x1014, _asRing2); } else if (param.asInteger() == 0x46C26A01) { if (getGlobalVar(0x8306F218)) { setMessageList(0x004B44B8); } else { - _klayman->sendEntityMessage(0x1014, _asRing3, this); + sendEntityMessage(_klayman, 0x1014, _asRing3); if (_asVenusFlyTrap->getX() - 10 < 366 && _asVenusFlyTrap->getX() + 10 > 366) { setGlobalVar(0x2B514304, 1); setMessageList(0x004B44A8); @@ -1644,12 +1591,12 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit messageResult = 1; } else if (param.asInteger() == 0x468C7B11) { // TODO _resourceTable4.load(); - _klayman->sendEntityMessage(0x1014, _asRing4, this); + sendEntityMessage(_klayman, 0x1014, _asRing4); } else if (param.asInteger() == 0x42845B19) { // TODO _resourceTable4.load(); - _klayman->sendEntityMessage(0x1014, _asRing5, this); + sendEntityMessage(_klayman, 0x1014, _asRing5); } else if (param.asInteger() == 0xC0A07458) { - _klayman->sendEntityMessage(0x1014, _class426, this); + sendEntityMessage(_klayman, 0x1014, _class426); } break; case 0x1024: @@ -1658,14 +1605,14 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit } else if (param.asInteger() == 3) { // TODO _resourceTable2.load(); } - _parentModule->sendMessage(0x1024, param, this); + sendMessage(_parentModule, 0x1024, param.asInteger()); break; case 0x2000: if (_flag) { setMessageList2(0x004B43D0); } else { if (_klayman->getY() > 420) { - _klayman->sendEntityMessage(0x1014, _asVenusFlyTrap, this); + sendEntityMessage(_klayman, 0x1014, _asVenusFlyTrap); setMessageList2(0x004B4480); } else if (_klayman->getY() > 227) { setMessageList2(0x004B41E0); @@ -1686,7 +1633,7 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit setRectList(0x004B43A0); break; case 0x4806: - _parentModule->sendMessage(0x1024, 2, this); + sendMessage(_parentModule, 0x1024, 2); _flag1BE = true; if (sender == _asRing1) { setGlobalVar(0x4DE80AC0, 0); @@ -1697,8 +1644,8 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit } else if (sender == _asRing3) { setGlobalVar(0x4DE80AC0, 0); _soundResource2.play(); - _asDoor->sendMessage(0x4808, 0, this); - _class506->sendMessage(0x4808, 0, this); + sendMessage(_asDoor, 0x4808, 0); + sendMessage(_class506, 0x4808, 0); } else if (sender == _asRing4) { setGlobalVar(0x4DE80AC0, 0); _soundResource1.play(0xE0558848); @@ -1710,22 +1657,22 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x4807: if (sender == _asRing3) { _soundResource3.play(); - _asDoor->sendMessage(0x4809, 0, this); - _class506->sendMessage(0x4809, 0, this); + sendMessage(_asDoor, 0x4809, 0); + sendMessage(_class506, 0x4809, 0); } else if (sender == _asVenusFlyTrap) { if (getGlobalVar(0x8306F218)) { - _asRing3->sendMessage(0x4807, 0, this); + sendMessage(_asRing3, 0x4807, 0); } } break; case 0x480B: - _klayman->sendEntityMessage(0x1014, _asDoorSpy, this); + sendEntityMessage(_klayman, 0x1014, _asDoorSpy); break; case 0x480F: setGlobalVar(0x4DE80AC0, 0); _soundResource2.play(); - _asDoor->sendMessage(0x4808, 0, this); - _class506->sendMessage(0x4808, 0, this); + sendMessage(_asDoor, 0x4808, 0); + sendMessage(_class506, 0x4808, 0); break; } return messageResult; @@ -1751,7 +1698,7 @@ uint32 Class152::handleMessage(int messageNum, const MessageParam ¶m, Entity switch (messageNum) { case 0x0001: if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } break; } @@ -1837,10 +1784,10 @@ Scene1004::Scene1004(NeverhoodEngine *vm, Module *parentModule, int which) _class478 = addSprite(new Class478(_vm, _klayman)); - addSprite(new StaticSprite(_vm, 0x800034A0, 1100)); - addSprite(new StaticSprite(_vm, 0x64402020, 1100)); - addSprite(new StaticSprite(_vm, 0x3060222E, 1300)); - tempSprite = addSprite(new StaticSprite(_vm, 0x0E002004, 1300)); + insertStaticSprite(0x800034A0, 1100); + insertStaticSprite(0x64402020, 1100); + insertStaticSprite(0x3060222E, 1300); + tempSprite = insertStaticSprite(0x0E002004, 1300); _klayman->getSurface()->getClipRect().x1 = 0; _klayman->getSurface()->getClipRect().y1 = tempSprite->getSurface()->getDrawRect().y; @@ -1874,7 +1821,7 @@ uint32 Scene1004::handleMessage(int messageNum, const MessageParam ¶m, Entit setRectList(0x004B7C70); break; case 0x2002: - _asTrashCan->sendMessage(0x2002, 0, this); + sendMessage(_asTrashCan, 0x2002, 0); break; } return messageResult; @@ -1909,14 +1856,14 @@ Scene1005::Scene1005(NeverhoodEngine *vm, Module *parentModule, int which) _background = addBackground(new DirtyBackground(_vm, 0x2800E011, 0, 0)); _palette = new Palette(_vm, 0x2800E011); _palette->usePalette(); - addSprite(new StaticSprite(_vm, 0x492D5AD7, 100)); + insertStaticSprite(0x492D5AD7, 100); _mouseCursor = addSprite(new Mouse435(_vm, 0x0E015288, 20, 620)); } else { _background = addBackground(new DirtyBackground(_vm, 0x8870A546, 0, 0)); _palette = new Palette(_vm, 0x8870A546); _palette->usePalette(); - addSprite(new StaticSprite(_vm, 0x40D1E0A9, 100)); - addSprite(new StaticSprite(_vm, 0x149C00A6, 100)); + insertStaticSprite(0x40D1E0A9, 100); + insertStaticSprite(0x149C00A6, 100); _mouseCursor = addSprite(new Mouse435(_vm, 0x0A54288F, 20, 620)); } @@ -1929,7 +1876,7 @@ uint32 Scene1005::handleMessage(int messageNum, const MessageParam ¶m, Entit switch (messageNum) { case 0x0001: if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } break; } diff --git a/engines/neverhood/module1200.cpp b/engines/neverhood/module1200.cpp index ff494e7ed5..163fc63a15 100644 --- a/engines/neverhood/module1200.cpp +++ b/engines/neverhood/module1200.cpp @@ -97,11 +97,11 @@ void Module1200::updateScene1201() { createScene1202(0); _childObject->handleUpdate(); } else if (_moduleDoneStatus == 2) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } else if (getGlobalVar(0x0A18CA33) && !getGlobalVar(0x2A02C07B)) { createScene1203(-1); } else { - _parentModule->sendMessage(0x1009, 1, this); + sendMessage(_parentModule, 0x1009, 1); } } } @@ -245,7 +245,7 @@ uint32 AsScene1201Tape::handleMessage(int messageNum, const MessageParam ¶m, uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x1011: - _parentScene->sendMessage(0x4826, 0, this); + sendMessage(_parentScene, 0x4826, 0); messageResult = 1; break; case 0x4806: @@ -417,13 +417,13 @@ uint32 AsScene1201TntMan::handleMessage(int messageNum, const MessageParam ¶ switch (messageNum) { case 0x100D: if (param.asInteger() == 0x092870C0) { - _class466->sendMessage(0x2006, 0, this); + sendMessage(_class466, 0x2006, 0); } else if (param.asInteger() == 0x11CA0144) { _soundResource.play(0x51800A04); } break; case 0x1011: - _parentScene->sendMessage(0x2002, 0, this); + sendMessage(_parentScene, 0x2002, 0); messageResult = 1; case 0x480B: if (!_flag) { @@ -570,7 +570,7 @@ uint32 AsScene1201Match::handleMessage40C360(int messageNum, const MessageParam uint32 messageResult = handleMessage40C2D0(messageNum, param, sender); switch (messageNum) { case 0x1011: - _parentScene->sendMessage(0x2001, 0, this); + sendMessage(_parentScene, 0x2001, 0); messageResult = 1; break; case 0x4806: @@ -693,8 +693,8 @@ uint32 AsScene1201Creature::handleMessage40C830(int messageNum, const MessagePar case 0x100D: if (param.asInteger() == 0x02060018) { _soundResource.play(0xCD298116); - _parentScene->sendMessage(0x4814, 0, this); - _klayman->sendMessage(0x4814, 0, this); + sendMessage(_parentScene, 0x4814, 0); + sendMessage(_klayman, 0x4814, 0); } break; case 0x3002: @@ -1014,12 +1014,12 @@ uint32 Scene1201::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x100D: if (param.asInteger() == 0x07053000) { _flag = true; - _asCreature->sendMessage(0x2004, 0, this); + sendMessage(_asCreature, 0x2004, 0); } else if (param.asInteger() == 0x140E5744) { - _asCreature->sendMessage(0x2005, 0, this); + sendMessage(_asCreature, 0x2005, 0); } else if (param.asInteger() == 0x40253C40) { _messageListFlag = false; - _asCreature->sendMessage(0x2006, 0, this); + sendMessage(_asCreature, 0x2006, 0); } else if (param.asInteger() == 0x090EB048) { if (_klayman->getX() < 572) { setMessageList2(0x004AEC90); @@ -1032,16 +1032,16 @@ uint32 Scene1201::handleMessage(int messageNum, const MessageParam ¶m, Entit if (!getGlobalVar(0x0112090A)) { setMessageList2(0x004AECB0); } else { - _klayman->sendEntityMessage(0x1014, _asMatch, this); + sendEntityMessage(_klayman, 0x1014, _asMatch); setMessageList2(0x004AECC0); } break; case 0x2002: if (getGlobalVar(0x20A0C516)) { - _klayman->sendEntityMessage(0x1014, _asTntMan, this); + sendEntityMessage(_klayman, 0x1014, _asTntMan); setMessageList2(0x004AECF0); } else if (getGlobalVar(0x0112090A) == 3) { - _klayman->sendEntityMessage(0x1014, _asTntMan, this); + sendEntityMessage(_klayman, 0x1014, _asTntMan); if (_klayman->getX() > _asTntMan->getX()) { setMessageList(0x004AECD0); } else { @@ -1054,12 +1054,12 @@ uint32 Scene1201::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x4826: if (sender == _asTape) { - _klayman->sendEntityMessage(0x1014, _asTape, this); + sendEntityMessage(_klayman, 0x1014, _asTape); setMessageList(0x004AED38); } break; case 0x4829: - _asRightDoor->sendMessage(0x4829, 0, this); + sendMessage(_asRightDoor, 0x4829, 0); break; } return messageResult; @@ -1131,7 +1131,7 @@ uint32 AsScene1202TntItem::handleMessage453FE0(int messageNum, const MessagePara uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x1011: - _parentScene->sendMessage(0x2000, _index, this); + sendMessage(_parentScene, 0x2000, _index); messageResult = 1; break; case 0x2001: @@ -1174,7 +1174,7 @@ void AsScene1202TntItem::sub454100() { } void AsScene1202TntItem::sub454160() { - _parentScene->sendMessage(0x2002, _index, this); + sendMessage(_parentScene, 0x2002, _index); sub4540A0(); } @@ -1230,7 +1230,7 @@ void Scene1202::update() { Scene::update(); if (_soundFlag) { if (!_soundResource4.isPlaying()) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } } else if (_counter == 0 && isSolved()) { SetMessageHandler(&Scene1202::handleMessage453D90); @@ -1240,8 +1240,8 @@ void Scene1202::update() { _soundFlag = true; } else if (_index >= 0 && _counter == 0) { int index2 = kScene1202Table[_index]; - _asTntItems[_index]->sendMessage(0x2001, getSubVar(0x10055D14, index2), this); - _asTntItems[index2]->sendMessage(0x2001, getSubVar(0x10055D14, _index), this); + sendMessage(_asTntItems[_index], 0x2001, getSubVar(0x10055D14, index2)); + sendMessage(_asTntItems[index2], 0x2001, getSubVar(0x10055D14, _index)); int temp = getSubVar(0x10055D14, index2); setSubVar(0x10055D14, index2, getSubVar(0x10055D14, _index)); setSubVar(0x10055D14, _index, temp); @@ -1263,7 +1263,7 @@ uint32 Scene1202::handleMessage453C10(int messageNum, const MessageParam ¶m, case 0x0001: // TODO: Debug/Cheat stuff if ((param.asPoint().x <= 20 || param.asPoint().x >= 620) && !_soundFlag) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } break; case 0x000D: @@ -1287,7 +1287,7 @@ uint32 Scene1202::handleMessage453D90(int messageNum, const MessageParam ¶m, switch (messageNum) { case 0x0001: if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } break; } diff --git a/engines/neverhood/module1300.cpp b/engines/neverhood/module1300.cpp index 04f4a2e8ed..b8b7b8b54f 100644 --- a/engines/neverhood/module1300.cpp +++ b/engines/neverhood/module1300.cpp @@ -336,6 +336,7 @@ void Module1300::updateScene1306() { _done = false; delete _childObject; _childObject = NULL; + debug("_field20 = %d", _field20); if (_field20 == 2) { createScene1309(0); _childObject->handleUpdate(); @@ -343,7 +344,7 @@ void Module1300::updateScene1306() { createScene1303(0); _childObject->handleUpdate(); } else if (_field20 == 0) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } else if (_field20 == 1) { createScene1311(-1); _childObject->handleUpdate(); @@ -397,9 +398,9 @@ void Module1300::updateScene1310() { delete _childObject; _childObject = NULL; if (_vm->gameState().sceneNum == 9) - createScene1315(0); - else createScene1306(0); + else + createScene1315(0); _childObject->handleUpdate(); } } @@ -554,7 +555,7 @@ void AsScene1302Bridge::stRaiseBridge() { } void AsScene1302Bridge::cbLowerBridgeEvent() { - _parentScene->sendMessage(0x2032, 0, this); + sendMessage(_parentScene, 0x2032, 0); setFileHash(0x88148150, -1, -1); _newHashListIndex = -2; } @@ -622,10 +623,10 @@ uint32 Class595::handleMessage(int messageNum, const MessageParam ¶m, Entity uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x482A: - _parentScene->sendMessage(0x1022, 995, this); + sendMessage(_parentScene, 0x1022, 995); break; case 0x482B: - _parentScene->sendMessage(0x1022, 1015, this); + sendMessage(_parentScene, 0x1022, 1015); break; } return messageResult; @@ -663,10 +664,10 @@ Scene1302::Scene1302(NeverhoodEngine *vm, Module *parentModule, int which) _ssFence->getSurface()->getClipRect().y2 = _sprite1->getSurface()->getDrawRect().y + _sprite1->getSurface()->getDrawRect().height; if (which < 0) { - _klayman = new KmScene1002(_vm, this, _class595, NULL, 380, 364); +// _klayman = new KmScene1002(_vm, this, _class595, NULL, 380, 364); setMessageList(0x004B0868); } else { - _klayman = new KmScene1002(_vm, this, _class595, NULL, 293, 330); +// _klayman = new KmScene1002(_vm, this, _class595, NULL, 293, 330); setMessageList(0x004B0870); } addSprite(_klayman); @@ -679,7 +680,7 @@ Scene1302::Scene1302(NeverhoodEngine *vm, Module *parentModule, int which) _asVenusFlyTrap = addSprite(new AsScene1002VenusFlyTrap(_vm, this, _klayman, true)); _vm->_collisionMan->addSprite(_asVenusFlyTrap); - _klayman->sendEntityMessage(0x2007, _asVenusFlyTrap, this); + sendEntityMessage(_klayman, 0x2007, _asVenusFlyTrap); } @@ -689,10 +690,10 @@ uint32 Scene1302::handleMessage(int messageNum, const MessageParam ¶m, Entit switch (messageNum) { case 0x100D: if (param.asInteger() == 0x4A845A00) { - _klayman->sendEntityMessage(0x1014, _asRing1, this); + sendEntityMessage(_klayman, 0x1014, _asRing1); } else if (param.asInteger() == 0x43807801) { if (!getGlobalVar(0x13206309)) { - _klayman->sendEntityMessage(0x1014, _asRing2, this); + sendEntityMessage(_klayman, 0x1014, _asRing2); if (_asVenusFlyTrap->getX() - 10 < 218 + 32 && _asVenusFlyTrap->getX() + 10 > 218 + 32) { setMessageList(0x004B0940); } else { @@ -703,10 +704,10 @@ uint32 Scene1302::handleMessage(int messageNum, const MessageParam ¶m, Entit } messageResult = 1; } else if (param.asInteger() == 0x46C26A01) { - _klayman->sendEntityMessage(0x1014, _asRing3, this); + sendEntityMessage(_klayman, 0x1014, _asRing3); } else if (param.asInteger() == 0x468C7B11) { if (!getGlobalVar(0x80101B1E)) { - _klayman->sendEntityMessage(0x1014, _asRing4, this); + sendEntityMessage(_klayman, 0x1014, _asRing4); if (_asVenusFlyTrap->getX() - 10 < 218 + 32 + 32 + 32 && _asVenusFlyTrap->getX() + 10 > 218 + 32 + 32 + 32) { setMessageList(0x004B0940); } else { @@ -717,7 +718,7 @@ uint32 Scene1302::handleMessage(int messageNum, const MessageParam ¶m, Entit } messageResult = 1; } else if (param.asInteger() == 0x42845B19) { - _klayman->sendEntityMessage(0x1014, _asRing5, this); + sendEntityMessage(_klayman, 0x1014, _asRing5); } else if (param.asInteger() == 0x430A6060) { if (getGlobalVar(0x13206309)) { setMessageList2(0x004B0910); @@ -740,7 +741,7 @@ uint32 Scene1302::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x2000: if (_klayman->getY() > 360) { - _klayman->sendEntityMessage(0x1014, _asVenusFlyTrap, this); + sendEntityMessage(_klayman, 0x1014, _asVenusFlyTrap); setMessageList2(0x004B08F0); } else { setMessageList2(0x004B0920); @@ -748,23 +749,23 @@ uint32 Scene1302::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x2002: if (_klayman->getX() > 545) { - _parentModule->sendMessage(0x1009, 1, this); + sendMessage(_parentModule, 0x1009, 1); } break; case 0x2032: _sprite2->getSurface()->setVisible(true); break; case 0x4806: - _parentModule->sendMessage(0x1024, 2, this); + sendMessage(_parentModule, 0x1024, 2); if (sender == _asRing1) { _soundResource.play(0x665198C0); } else if (sender == _asRing2) { - _asBridge->sendMessage(0x4808, 0, this); + sendMessage(_asBridge, 0x4808, 0); setGlobalVar(0x13206309, 1); } else if (sender == _asRing3) { _soundResource.play(0xE2D389C0); } else if (sender == _asRing4) { - _ssFence->sendMessage(0x4808, 0, this); + sendMessage(_ssFence, 0x4808, 0); setGlobalVar(0x80101B1E, 1); } else if (sender == _asRing5) { _soundResource.play(0x40428A09); @@ -772,36 +773,36 @@ uint32 Scene1302::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x4807: if (sender == _asRing2) { - _asBridge->sendMessage(0x4809, 0, this); + sendMessage(_asBridge, 0x4809, 0); setGlobalVar(0x13206309, 0); _sprite2->getSurface()->setVisible(false); } else if (sender == _asRing4) { - _ssFence->sendMessage(0x4809, 0, this); + sendMessage(_ssFence, 0x4809, 0); setGlobalVar(0x80101B1E, 0); } else if (sender == _asVenusFlyTrap) { if (getGlobalVar(0x13206309)) { - _asRing2->sendMessage(0x4807, 0, this); + sendMessage(_asRing2, 0x4807, 0); } else { - _asRing4->sendMessage(0x4807, 0, this); + sendMessage(_asRing4, 0x4807, 0); } } break; case 0x480F: if (sender == _asRing2) { _soundResource.play(0x60755842); - _asBridge->sendMessage(0x4808, 0, this); + sendMessage(_asBridge, 0x4808, 0); setGlobalVar(0x13206309, 1); } else if (sender == _asRing4) { _soundResource.play(0x60755842); - _ssFence->sendMessage(0x4808, 0, this); + sendMessage(_ssFence, 0x4808, 0); setGlobalVar(0x80101B1E, 1); } break; case 0x482A: - _asVenusFlyTrap->sendMessage(0x482B, 0, this); + sendMessage(_asVenusFlyTrap, 0x482B, 0); break; case 0x482B: - _asVenusFlyTrap->sendMessage(0x482A, 0, this); + sendMessage(_asVenusFlyTrap, 0x482A, 0); break; } return messageResult; @@ -824,7 +825,7 @@ uint32 AsScene1303Balloon::handleMessage(int messageNum, const MessageParam &par uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x1011: - _parentScene->sendMessage(0x4826, 0, this); + sendMessage(_parentScene, 0x4826, 0); messageResult = 1; break; case 0x2000: @@ -864,7 +865,7 @@ Scene1303::Scene1303(NeverhoodEngine *vm, Module *parentModule, int which) SetMessageHandler(&Scene1303::handleMessage); setRectList(0x004AF9E8); - _background = addBackground(new DirtyBackground(_vm, 0x01581A9C, 0, 0)); + setBackground(0x01581A9C); _palette = new Palette(_vm, 0x01581A9C); _palette->usePalette(); _mouseCursor = addSprite(new Mouse433(_vm, 0x81A9801D, NULL)); @@ -892,7 +893,7 @@ uint32 Scene1303::handleMessage(int messageNum, const MessageParam ¶m, Entit switch (messageNum) { case 0x2000: setGlobalVar(0xAC00C0D0, 1); - _asBalloon->sendMessage(0x2000, 0, this); + sendMessage(_asBalloon, 0x2000, 0); break; case 0x4826: if (sender == _asBalloon && getGlobalVar(0x31C63C51)) { @@ -918,7 +919,7 @@ uint32 Class544::handleMessage(int messageNum, const MessageParam ¶m, Entity uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x1011: - _parentScene->sendMessage(0x4826, 0, this); + sendMessage(_parentScene, 0x4826, 0); messageResult = 1; break; case 0x4806: @@ -937,7 +938,7 @@ Scene1304::Scene1304(NeverhoodEngine *vm, Module *parentModule, int which) SetMessageHandler(&Scene1304::handleMessage); setRectList(0x004B91A8); - _background = addBackground(new DirtyBackground(_vm, 0x062C0214, 0, 0)); + setBackground(0x062C0214); _palette = new Palette(_vm, 0x062C0214); _palette->usePalette(); _mouseCursor = addSprite(new Mouse433(_vm, 0xC021006A, NULL)); @@ -991,10 +992,10 @@ uint32 Scene1304::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x4826: if (sender == _class544) { - _klayman->sendEntityMessage(0x1014, _class544, this); + sendEntityMessage(_klayman, 0x1014, _class544); setMessageList(0x004B9130); } else if (sender == _class545) { - _klayman->sendEntityMessage(0x1014, _class545, this); + sendEntityMessage(_klayman, 0x1014, _class545); setMessageList(0x004B9140); } break; @@ -1093,7 +1094,7 @@ void AsScene1306Elevator::stGoingUp() { void AsScene1306Elevator::cbGoingUpEvent() { SetUpdateHandler(&AsScene1306Elevator::update); - _parentScene->sendMessage(0x4808, 0, this); + sendMessage(_parentScene, 0x4808, 0); _isUp = true; _countdown = 144; setFileHash1(); @@ -1112,7 +1113,7 @@ void AsScene1306Elevator::stGoingDown() { void AsScene1306Elevator::cbGoingDownEvent() { _isDown = true; - _parentScene->sendMessage(0x4809, 0, this); + sendMessage(_parentScene, 0x4809, 0); SetUpdateHandler(&AsScene1306Elevator::update); setFileHash1(); } @@ -1154,13 +1155,13 @@ Scene1306::Scene1306(NeverhoodEngine *vm, Module *parentModule, int which) if (which < 0) { _klayman = new KmScene1306(_vm, this, 380, 440); setMessageList(0x004AFAD0); - sendMessage(0x2000, 0, this); + sendMessage(this, 0x2000, 0); _vm->_collisionMan->addSprite(_asTape); } else if (which == 1) { _klayman = new KmScene1306(_vm, this, 136, 440); - _klayman->sendMessage(0x2000, 1, this); + sendMessage(_klayman, 0x2000, 1); setMessageList(0x004AFAF0); - sendMessage(0x2000, 1, this); + sendMessage(this, 0x2000, 1); _vm->_collisionMan->addSprite(_asTape); } else if (which == 2) { if (getGlobalVar(0xC0418A02)) { @@ -1170,34 +1171,34 @@ Scene1306::Scene1306(NeverhoodEngine *vm, Module *parentModule, int which) _klayman = new KmScene1306(_vm, this, 355, 440); } setMessageList(0x004AFBC8); - sendMessage(0x2000, 0, this); + sendMessage(this, 0x2000, 0); _vm->_collisionMan->addSprite(_asTape); } else if (which == 3) { _klayman = new KmScene1306(_vm, this, 534, 440); setMessageList(0x004AFC30); - sendMessage(0x2000, 0, this); + sendMessage(this, 0x2000, 0); _vm->_collisionMan->addSprite(_asTape); } else if (which == 4) { _klayman = new KmScene1306(_vm, this, 136, 440); - _klayman->sendMessage(0x2000, 1, this); + sendMessage(_klayman, 0x2000, 1); setMessageList(0x004AFC38); - sendMessage(0x2000, 1, this); + sendMessage(this, 0x2000, 1); _vm->_collisionMan->addSprite(_asTape); } else if (which == 5) { _klayman = new KmScene1306(_vm, this, 136, 440); - _klayman->sendMessage(0x2000, 1, this); + sendMessage(_klayman, 0x2000, 1); setMessageList(0x004AFB00); - sendMessage(0x2000, 1, this); + sendMessage(this, 0x2000, 1); _vm->_collisionMan->addSprite(_asTape); } else { _klayman = new KmScene1306(_vm, this, 286, 408); setSurfacePriority(_asElevator->getSurface(), 1100); setSurfacePriority(_asElevatorDoor->getSurface(), 1090); setSurfacePriority(_sprite1->getSurface(), 1080); - sendMessage(0x2000, 0, this); + sendMessage(this, 0x2000, 0); SetMessageHandler(&Scene1306::handleMessage416EB0); clearRectList(); - _asElevator->sendMessage(0x4808, 0, this); + sendMessage(_asElevator, 0x4808, 0); } addSprite(_klayman); @@ -1212,9 +1213,9 @@ uint32 Scene1306::handleMessage(int messageNum, const MessageParam ¶m, Entit switch (messageNum) { case 0x100D: if (param.asInteger() == 0x402064D8) { - _klayman->sendEntityMessage(0x1014, _ssButton, this); + sendEntityMessage(_klayman, 0x1014, _ssButton); } else if (param.asInteger() == 0x01C66840) { - if (_asElevator->sendMessage(0x2001, 0, this) != 0) { + if (sendMessage(_asElevator, 0x2001, 0) != 0) { setMessageList(0x004AFBD8); } else { setMessageList(0x004AFAE0); @@ -1236,18 +1237,18 @@ uint32 Scene1306::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x480B: if (sender == _ssButton) { - _asElevator->sendMessage(0x4808, 0, this); + sendMessage(_asElevator, 0x4808, 0); } break; case 0x4826: if (sender == _class545) { if (_klayman->getX() >= 249) { - _klayman->sendEntityMessage(0x1014, _class545, this); + sendEntityMessage(_klayman, 0x1014, _class545); setMessageList(0x004AFC58); } } else if (sender == _asTape) { if (_klayman->getX() >= 249) { - _klayman->sendEntityMessage(0x1014, _class545, this); + sendEntityMessage(_klayman, 0x1014, _class545); setMessageList(0x004AFC68); } } @@ -1261,7 +1262,7 @@ uint32 Scene1306::handleMessage(int messageNum, const MessageParam ¶m, Entit setSurfacePriority(_asElevator->getSurface(), 100); setSurfacePriority(_asElevatorDoor->getSurface(), 90); setSurfacePriority(_sprite1->getSurface(), 80); - sendMessage(0x2000, 0, this); + sendMessage(this, 0x2000, 0); _vm->_collisionMan->addSprite(_asTape); break; } @@ -1276,7 +1277,7 @@ uint32 Scene1306::handleMessage416EB0(int messageNum, const MessageParam ¶m, SetMessageHandler(&Scene1306::handleMessage); break; case 0x4809: - _parentModule->sendMessage(0x1009, 1, this); + sendMessage(_parentModule, 0x1009, 1); break; case 0x482A: setSurfacePriority(_asElevator->getSurface(), 1100); @@ -1287,7 +1288,7 @@ uint32 Scene1306::handleMessage416EB0(int messageNum, const MessageParam ¶m, setSurfacePriority(_asElevator->getSurface(), 100); setSurfacePriority(_asElevatorDoor->getSurface(), 90); setSurfacePriority(_sprite1->getSurface(), 80); - sendMessage(0x2000, 0, this); + sendMessage(this, 0x2000, 0); _vm->_collisionMan->addSprite(_asTape); break; } @@ -1389,7 +1390,7 @@ uint32 AsScene1307Key::handleMessage(int messageNum, const MessageParam ¶m, switch (messageNum) { case 0x1011: if (_isClickable) { - _parentScene->sendMessage(0x4826, 0, this); + sendMessage(_parentScene, 0x4826, 0); stRemoveKey(); messageResult = 1; } @@ -1434,7 +1435,7 @@ void AsScene1307Key::suInsertKey() { _soundResource1.play(); } else { SetSpriteCallback(NULL); - _parentScene->sendMessage(0x2002, 0, this); + sendMessage(_parentScene, 0x2002, 0); } } @@ -1463,7 +1464,7 @@ void AsScene1307Key::stRemoveKey() { void AsScene1307Key::stInsertKey() { _pointIndex = 0; - _parentScene->sendMessage(0x1022, kAsScene1307KeySurfacePriorities[getSubVar(0xA010B810, _index) % 4], this); + sendMessage(_parentScene, 0x1022, kAsScene1307KeySurfacePriorities[getSubVar(0xA010B810, _index) % 4]); _surface->getClipRect() = _clipRects[getSubVar(0xA010B810, _index) % 4]; SetSpriteCallback(&AsScene1307Key::suInsertKey); _newHashListIndex = -2; @@ -1473,7 +1474,7 @@ void AsScene1307Key::stMoveKey() { NPoint pt = (*_pointList)[getSubVar(0xA010B810, _index)]; int16 newX = pt.x + kAsScene1307KeyXDelta; int16 newY = pt.y + kAsScene1307KeyYDelta; - _parentScene->sendMessage(0x1022, 1000, this); + sendMessage(_parentScene, 0x1022, 1000); _surface->getClipRect().x1 = 0; _surface->getClipRect().y1 = 0; _surface->getClipRect().x2 = 640; @@ -1584,7 +1585,7 @@ void Scene1307::update() { _palette->startFadeToWhite(40); } if (_doLeaveScene && !_soundResource.isPlaying()) { - _parentModule->sendMessage(0x1009, 1, this); + sendMessage(_parentModule, 0x1009, 1); setGlobalVar(0x80455A41, 1); } } @@ -1617,14 +1618,14 @@ uint32 Scene1307::handleMessage(int messageNum, const MessageParam ¶m, Entit } if (!occupied) { // If the keyhole is free, insert the current key - _asCurrKey->sendMessage(0x2001, clickedKeyHoleIndex, this); + sendMessage(_asCurrKey, 0x2001, clickedKeyHoleIndex); _isInsertingKey = true; _mouseClicked = false; } } } } else if (_countdown == 0 && !_asCurrKey && !_isInsertingKey) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } } break; @@ -1637,7 +1638,7 @@ uint32 Scene1307::handleMessage(int messageNum, const MessageParam ¶m, Entit // Play unlock animations for all keys for (uint keyIndex = 0; keyIndex < 3; keyIndex++) { if (_asKeys[keyIndex]) - _asKeys[keyIndex]->sendMessage(0x2003, 1, this); + sendMessage(_asKeys[keyIndex], 0x2003, 1); } _soundResource.play(); _isPuzzleSolved = true; @@ -1645,10 +1646,10 @@ uint32 Scene1307::handleMessage(int messageNum, const MessageParam ¶m, Entit } else { for (uint keyIndex = 0; keyIndex < 3; keyIndex++) { if (getSubVar(0x08D0AB11, keyIndex) && _asKeys[keyIndex]) { - _asKeys[keyIndex]->sendMessage(0x2000, 1, this); + sendMessage(_asKeys[keyIndex], 0x2000, 1); } } - _asCurrKey->sendMessage(0x2004, 1, this); + sendMessage(_asCurrKey, 0x2004, 1); } _asCurrKey = NULL; _isInsertingKey = false; @@ -1657,7 +1658,7 @@ uint32 Scene1307::handleMessage(int messageNum, const MessageParam ¶m, Entit _asCurrKey = (Sprite*)sender; for (uint keyIndex = 0; keyIndex < 3; keyIndex++) { if (getSubVar(0x08D0AB11, keyIndex) && _asKeys[keyIndex]) { - _asKeys[keyIndex]->sendMessage(0x2000, 0, this); + sendMessage(_asKeys[keyIndex], 0x2000, 0); } } break; @@ -1717,7 +1718,7 @@ void Class549::sub455470() { } void Class549::hide() { - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); setFileHash1(); _surface->setVisible(false); } @@ -1731,7 +1732,7 @@ void Class549::sub4554F0() { } void Class549::sub455550() { - _parentScene->sendMessage(0x2001, 0, this); + sendMessage(_parentScene, 0x2001, 0); setFileHash1(); } @@ -1762,7 +1763,7 @@ void Class592::sub455710() { } void Class592::sub455740() { - _parentScene->sendMessage(0x2004, 0, this); + sendMessage(_parentScene, 0x2004, 0); setFileHash1(); _surface->setVisible(false); } @@ -1804,7 +1805,7 @@ void Class593::sub455920() { } void Class593::sub455950() { - _parentScene->sendMessage(0x2003, 0, this); + sendMessage(_parentScene, 0x2003, 0); setFileHash1(); _surface->setVisible(false); } @@ -1911,7 +1912,7 @@ Scene1308::Scene1308(NeverhoodEngine *vm, Module *parentModule, int which) } else { _klayman = new KmScene1308(_vm, this, 41, 440); setMessageList(0x004B57D0); - _class549->sendMessage(0x4808, 0, this); + sendMessage(_class549, 0x4808, 0); _sprite1->getSurface()->setVisible(false); if (getGlobalVar(0x80455A41)) { _sprite4 = addSprite(new StaticSprite(_vm, 0x0101A624, 1100)); @@ -1958,7 +1959,7 @@ uint32 Scene1308::handleMessage(int messageNum, const MessageParam ¶m, Entit setRectList(0x004B59A0); _flag1 = true; } else if (param.asInteger() == 0x08821382) { - _klayman->sendEntityMessage(0x1014, _class489, this); + sendEntityMessage(_klayman, 0x1014, _class489); if (getGlobalVar(0x80455A41)) { setRectList(0x004B5990); } else { @@ -1967,7 +1968,7 @@ uint32 Scene1308::handleMessage(int messageNum, const MessageParam ¶m, Entit _flag1 = false; } else if (param.asInteger() == 0x4AC68808) { clearRectList(); - _class549->sendMessage(0x4809, 0, this); + sendMessage(_class549, 0x4809, 0); _sprite1->getSurface()->setVisible(false); _klayman->getSurface()->setVisible(false); } @@ -1991,7 +1992,7 @@ uint32 Scene1308::handleMessage(int messageNum, const MessageParam ¶m, Entit _klayman->getSurface()->setVisible(true); break; case 0x2001: - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); break; case 0x2003: _class601_1->getSurface()->setVisible(false); @@ -2003,10 +2004,10 @@ uint32 Scene1308::handleMessage(int messageNum, const MessageParam ¶m, Entit setRectList(0x004B5990); break; case 0x4807: - _class593->sendMessage(0x2003, 0, this); + sendMessage(_class593, 0x2003, 0); break; case 0x480F: - _class593->sendMessage(0x2002, 0, this); + sendMessage(_class593, 0x2002, 0); _class601_1->getSurface()->setVisible(true); _class601_2->getSurface()->setVisible(true); _class601_3->getSurface()->setVisible(true); @@ -2017,10 +2018,10 @@ uint32 Scene1308::handleMessage(int messageNum, const MessageParam ¶m, Entit setMessageList2(0x004B5868); } else { if (param.asInteger() == 1) { - _klayman->sendMessage(0x1014, _class489, this); + sendEntityMessage(_klayman, 0x1014, _class489); setMessageList2(0x004B5848); - } else if (_class489->sendMessage(0x480C, _klayman->getX() <= _class489->getX() ? 0 : 1, this) != 0) { - _klayman->sendEntityMessage(0x1014, _class489, this); + } else if (sendMessage(_class489, 0x480C, _klayman->getX() <= _class489->getX() ? 0 : 1) != 0) { + sendEntityMessage(_klayman, 0x1014, _class489); setMessageList2(0x004B5830); } else { setMessageList2(0x004B5800); @@ -2030,7 +2031,7 @@ uint32 Scene1308::handleMessage(int messageNum, const MessageParam ¶m, Entit if (_flag1) { setMessageList2(0x004B5868); } else if (_messageListStatus != 2) { - _klayman->sendMessage(0x1014, _asTape, this); + sendEntityMessage(_klayman, 0x1014, _asTape); setMessageList2(0x004B58E0); } } @@ -2135,7 +2136,7 @@ uint32 Scene1317::hmKlaymanAsKing(int messageNum, const MessageParam ¶m, Ent uint32 messageResult = Scene::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); break; } return messageResult; @@ -2145,7 +2146,7 @@ uint32 Scene1317::hmEndMovie(int messageNum, const MessageParam ¶m, Entity * uint32 messageResult = Scene::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); break; } return messageResult; diff --git a/engines/neverhood/module1400.cpp b/engines/neverhood/module1400.cpp index 7835520273..60e52794f7 100644 --- a/engines/neverhood/module1400.cpp +++ b/engines/neverhood/module1400.cpp @@ -133,7 +133,7 @@ void Module1400::updateScene1401() { createScene1404(0); _childObject->handleUpdate(); } else { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } } } @@ -505,7 +505,7 @@ uint32 Class489::handleMessage(int messageNum, const MessageParam ¶m, Entity uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x1011: - _parentScene->sendMessage(0x4826, 0, this); + sendMessage(_parentScene, 0x4826, 0); messageResult = 1; break; case 0x4807: @@ -534,10 +534,10 @@ uint32 Class489::handleMessage(int messageNum, const MessageParam ¶m, Entity } break; case 0x482A: - _parentScene->sendMessage(0x1022, 990, this); + sendMessage(_parentScene, 0x1022, 990); break; case 0x482B: - _parentScene->sendMessage(0x1022, 1010, this); + sendMessage(_parentScene, 0x1022, 1010); break; case 0x4828: sub435040(); @@ -552,14 +552,14 @@ uint32 Class489::handleMessage4348E0(int messageNum, const MessageParam ¶m, case 0x1011: if (param.asPoint().x - _x >= 17 && param.asPoint().x - _x <= 56 && param.asPoint().y - _y >= -120 && param.asPoint().y - _y <= -82) { - _parentScene->sendMessage(0x4826, 1, this); + sendMessage(_parentScene, 0x4826, 1); } else { - _parentScene->sendMessage(0x4826, 0, this); + sendMessage(_parentScene, 0x4826, 0); } messageResult = 1; break; case 0x4807: - _parentScene->sendMessage(0x4807, 0, this); + sendMessage(_parentScene, 0x4807, 0); sub434F80(); break; case 0x480B: @@ -583,10 +583,10 @@ uint32 Class489::handleMessage4348E0(int messageNum, const MessageParam ¶m, sub434EC0(); break; case 0x482A: - _parentScene->sendMessage(0x1022, 990, this); + sendMessage(_parentScene, 0x1022, 990); break; case 0x482B: - _parentScene->sendMessage(0x1022, 1010, this); + sendMessage(_parentScene, 0x1022, 1010); break; } return messageResult; @@ -610,11 +610,11 @@ void Class489::spriteUpdate434B60() { sub434C80(); if (_remX == _x) { if (getGlobalVar(0x04A10F33) == 0 && _class489Item->flag4 != 0) { - _parentScene->sendMessage(0x1019, 0, this); + sendMessage(_parentScene, 0x1019, 0); incGlobalVar(0x04A105B3, -1); setGlobalVar(0x04A10F33, kClass489Items[getGlobalVar(0x04A105B3)].varIndex1); } else if ((int8)getGlobalVar(0x04A10F33) == _class489Item->varIndex1 && _class489Item->flag != 0) { - _parentScene->sendMessage(0x1019, 1, this); + sendMessage(_parentScene, 0x1019, 1); incGlobalVar(0x04A105B3, +1); setGlobalVar(0x04A10F33, 0); } @@ -666,7 +666,7 @@ void Class489::sub434C80() { void Class489::sub434D80() { AnimatedSprite::updateDeltaXY(); if (_rect.y1 <= 150) { - _class525->sendMessage(0x483A, 0, this); + sendMessage(_class525, 0x483A, 0); setFileHash1(); SetMessageHandler(&Sprite::handleMessage); SetSpriteCallback(NULL); @@ -713,7 +713,7 @@ void Class489::sub434EC0() { } void Class489::sub434F40() { - _parentScene->sendMessage(0x480F, 0, this); + sendMessage(_parentScene, 0x480F, 0); setFileHash(0xD833207F, 0, -1); SetSpriteCallback(NULL); SetMessageHandler(&Class489::handleMessage4348E0); @@ -799,12 +799,12 @@ Scene1401::Scene1401(NeverhoodEngine *vm, Module *parentModule, int which) _class489 = addSprite(new Class489(_vm, this, _klayman, _class525)); _vm->_collisionMan->addSprite(_class489); if (getGlobalVar(0x04A10F33) == 6) { - _klayman->sendEntityMessage(0x1014, _class489, this); + sendEntityMessage(_klayman, 0x1014, _class489); _klayman->setX(_class489->getX() + 100); _klayman->processDelta(); setMessageList(0x004B6670); } else if (getGlobalVar(0x04A10F33) == 0) { - _klayman->sendEntityMessage(0x1014, _class489, this); + sendEntityMessage(_klayman, 0x1014, _class489); _klayman->setX(_class489->getX() - 100); _klayman->processDelta(); setMessageList(0x004B6670); @@ -821,7 +821,7 @@ Scene1401::Scene1401(NeverhoodEngine *vm, Module *parentModule, int which) _klayman->getSurface()->getClipRect().y2 = 480; if (which == 0 && _class489 && _class489->hasMessageHandler()) { - _class489->sendMessage(0x482B, 0, this); + sendMessage(_class489, 0x482B, 0); } _class528 = addSprite(new Class528(_vm, _klayman, which == 1)); @@ -843,11 +843,11 @@ uint32 Scene1401::handleMessage(int messageNum, const MessageParam ¶m, Entit switch (messageNum) { case 0x100D: if (param.asInteger() == 0x02144CB1) { - _klayman->sendEntityMessage(0x1014, _class427, this); + sendEntityMessage(_klayman, 0x1014, _class427); } else if (param.asInteger() == 0x402064D8) { - _klayman->sendEntityMessage(0x1014, _ssButton, this); + sendEntityMessage(_klayman, 0x1014, _ssButton); } else if (param.asInteger() == 0x01C66840) { - if (_class528->hasMessageHandler() && _class528->sendMessage(0x2001, 0, this) != 0) { + if (_class528->hasMessageHandler() && sendMessage(_class528, 0x2001, 0) != 0) { setMessageList(0x004B6690); } else { setMessageList(0x004B66B0); @@ -856,30 +856,30 @@ uint32 Scene1401::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x1019: if (param.asInteger() != 0) { - _parentModule->sendMessage(0x1009, 2, this); + sendMessage(_parentModule, 0x1009, 2); } else { - _parentModule->sendMessage(0x1009, 1, this); + sendMessage(_parentModule, 0x1009, 1); } break; case 0x480B: if (sender == _class427) { - _class525->sendMessage(0x2000, 0, this); + sendMessage(_class525, 0x2000, 0); if (!getGlobalVar(0x01023818)) { - _class526->sendMessage(0x4839, 0, this); - _class527->sendMessage(0x4839, 0, this); + sendMessage(_class526, 0x4839, 0); + sendMessage(_class527, 0x4839, 0); setGlobalVar(0x01023818, 1); } if (_class489 && _class489->getX() > 404 && _class489->getX() < 504) { - _class489 ->sendMessage(0x4839, 0, this); + sendMessage(_class489 , 0x4839, 0); } } else if (sender == _ssButton) { - _ssButton->sendMessage(0x4808, 0, this); + sendMessage(_ssButton, 0x4808, 0); } break; case 0x4826: if (sender == _class489) { - if (_class489->sendMessage(0x480C, _klayman->getX() > _class489->getX() ? 1 : 0, this) != 0) { - _klayman->sendEntityMessage(0x1014, _class489, this); + if (sendMessage(_class489, 0x480C, _klayman->getX() > _class489->getX() ? 1 : 0) != 0) { + sendEntityMessage(_klayman, 0x1014, _class489); setMessageList2(0x004B6658); } else { setMessageList2(0x004B65F0); @@ -889,13 +889,13 @@ uint32 Scene1401::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x482A: _sprite1->getSurface()->setVisible(true); if (_class489) { - _class489->sendMessage(0x482B, 0, this); + sendMessage(_class489, 0x482B, 0); } break; case 0x482B: _sprite1->getSurface()->setVisible(false); if (_class489) { - _class489->sendMessage(0x482A, 0, this); + sendMessage(_class489, 0x482A, 0); } break; } @@ -955,19 +955,19 @@ uint32 Class482::handleMessage(int messageNum, const MessageParam ¶m, Entity } void Class482::sub428500() { - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); setFileHash1(); _surface->setVisible(false); } void Class482::sub428530() { - _parentScene->sendMessage(0x2001, 0, this); + sendMessage(_parentScene, 0x2001, 0); setFileHash1(); _surface->setVisible(false); } void Class482::sub428560() { - _parentScene->sendMessage(0x2003, 0, this); + sendMessage(_parentScene, 0x2003, 0); setFileHash1(); } @@ -1035,12 +1035,12 @@ Scene1402::Scene1402(NeverhoodEngine *vm, Module *parentModule, int which) _class489 = addSprite(new Class489(_vm, this, _klayman, 0)); _vm->_collisionMan->addSprite(_class489); if (getGlobalVar(0x4A10F33) == 4) { - _klayman->sendEntityMessage(0x1014, _class489, this); + sendEntityMessage(_klayman, 0x1014, _class489); _klayman->setX(_class489->getX() + 100); _klayman->processDelta(); setMessageList(0x004B0BD0); } else if (getGlobalVar(0x4A10F33) == 0) { - _klayman->sendEntityMessage(0x1014, _class489, this); + sendEntityMessage(_klayman, 0x1014, _class489); _klayman->setX(_class489->getX() - 100); _klayman->processDelta(); setMessageList(0x004B0BD0); @@ -1086,21 +1086,21 @@ uint32 Scene1402::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x100D: if (param.asInteger() == 0x00F43389) { if (getGlobalVar(0x70A1189C)) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } else { clearRectList(); _klayman->getSurface()->setVisible(false); _mouseCursor->getSurface()->setVisible(false); - _class482->sendMessage(0x2002, 0, this); + sendMessage(_class482, 0x2002, 0); sub428220(); } } break; case 0x1019: if (param.asInteger()) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } else { - _parentModule->sendMessage(0x1009, 1, this); + sendMessage(_parentModule, 0x1009, 1); } break; case 0x2000: @@ -1110,15 +1110,15 @@ uint32 Scene1402::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x2001: sub428230(); - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); break; case 0x2003: sub428230(); break; case 0x4826: if (sender == _class489) { - if (_class489->sendMessage(0x408C, _klayman->getX() > _class489->getX() ? 1 : 0, this) != 0) { - _klayman->sendEntityMessage(0x1014, _class489, this); + if (sendMessage(_class489, 0x408C, _klayman->getX() > _class489->getX() ? 1 : 0) != 0) { + sendEntityMessage(_klayman, 0x1014, _class489); setMessageList2(0x004B0BB8); } else { setMessageList2(0x004B0B68); @@ -1249,7 +1249,7 @@ void AsScene1407Mouse::suWalkTo() { xdelta = -_deltaX; _deltaX = 0; if (_walkDestX == _x) { - sendMessage(0x1019, 0, this); + sendMessage(this, 0x1019, 0); } else { _x += xdelta; processDelta(); @@ -1362,7 +1362,7 @@ void AsScene1407Mouse::stArriveAtHole() { _x = kScene1407MouseHoles[_nextHoleIndex].x; _y = kScene1407MouseFloorY[kScene1407MouseHoles[_nextHoleIndex].floorIndex]; if (_nextHoleIndex == 1) { - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); _walkDestX = 512; stWalkToDest(); _surface->setVisible(true); @@ -1396,7 +1396,7 @@ Scene1407::Scene1407(NeverhoodEngine *vm, Module *parentModule, int which) void Scene1407::update() { Scene::update(); if (_puzzleSolvedCountdown != 0 && (--_puzzleSolvedCountdown == 0)) { - _parentModule->sendMessage(0x1009, 1, this); + sendMessage(_parentModule, 0x1009, 1); } else if (_resetButtonCountdown != 0 && (--_resetButtonCountdown == 0)) { _ssResetButton->getSurface()->setVisible(false); } @@ -1410,17 +1410,17 @@ uint32 Scene1407::handleMessage(int messageNum, const MessageParam ¶m, Entit // TODO: Debug/Cheat stuff if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { // Exit scene - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } else if (param.asPoint().x >= 75 && param.asPoint().x <= 104 && param.asPoint().y >= 62 && param.asPoint().y <= 90) { // The reset button was clicked - _asMouse->sendMessage(0x2001, 0, this); + sendMessage(_asMouse, 0x2001, 0); _ssResetButton->getSurface()->setVisible(true); _soundResource.play(0x44045000); _resetButtonCountdown = 12; } else { // Handle the mouse - _asMouse->sendMessage(messageNum, param, this); + sendMessage(_asMouse, messageNum, param); } } break; @@ -1487,7 +1487,7 @@ Scene1403::Scene1403(NeverhoodEngine *vm, Module *parentModule, int which) addSprite(_class489); _vm->_collisionMan->addSprite(_class489); if (getGlobalVar(0x04A10F33) == 4) { - _klayman->sendEntityMessage(0x1014, _class489, this); + sendEntityMessage(_klayman, 0x1014, _class489); _klayman->setX(_class489->getX() + 100); _klayman->processDelta(); setMessageList(0x004B1F70); @@ -1509,13 +1509,13 @@ uint32 Scene1403::handleMessage(int messageNum, const MessageParam ¶m, Entit setRectList(0x004B2008); _flag = true; } else if (param.asInteger() == 0x08821382) { - _klayman->sendEntityMessage(0x1014, _class489, this); + sendEntityMessage(_klayman, 0x1014, _class489); setRectList(0x004B1FF8); _flag = false; } break; case 0x1019: - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); break; case 0x1022: if (sender == _class489) { @@ -1537,10 +1537,10 @@ uint32 Scene1403::handleMessage(int messageNum, const MessageParam ¶m, Entit if (_flag) { setMessageList2(0x004B1FA8); } else if (param.asInteger() == 1) { - _klayman->sendEntityMessage(0x1014, _class489, this); + sendEntityMessage(_klayman, 0x1014, _class489); setMessageList2(0x004B1F88); - } else if (_class489->sendMessage(0x480C, _klayman->getX() > _class489->getX() ? 1 : 0, this) != 0) { - _klayman->sendEntityMessage(0x1014, _class489, this); + } else if (sendMessage(_class489, 0x480C, _klayman->getX() > _class489->getX() ? 1 : 0) != 0) { + sendEntityMessage(_klayman, 0x1014, _class489); setMessageList2(0x004B1F58); } else { setMessageList2(0x004B1F28); @@ -1549,7 +1549,7 @@ uint32 Scene1403::handleMessage(int messageNum, const MessageParam ¶m, Entit if (_flag) { setMessageList2(0x004B1FA8); } else if (_messageListStatus != 2) { - _klayman->sendEntityMessage(0x1014, sender, this); + sendEntityMessage(_klayman, 0x1014, sender); setMessageList2(0x004B1FB8); } } @@ -1612,7 +1612,7 @@ Scene1404::Scene1404(NeverhoodEngine *vm, Module *parentModule, int which) _class489 = addSprite(new Class489(_vm, this, _klayman, 0)); _vm->_collisionMan->addSprite(_class489); if (getGlobalVar(0x04A10F33) == 0) { - _klayman->sendEntityMessage(0x1014, _class489, this); + sendEntityMessage(_klayman, 0x1014, _class489); _klayman->setX(_class489->getX() - 100); _klayman->processDelta(); setMessageList(0x004B8CB8); @@ -1647,21 +1647,21 @@ uint32 Scene1404::handleMessage(int messageNum, const MessageParam ¶m, Entit } break; case 0x1019: - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); break; case 0x4826: if (sender == _class489) { - if (_class489->sendMessage(0x480C, _klayman->getX() > _class489->getX() ? 1 : 0, this) != 0) { - _klayman->sendEntityMessage(0x1014, _class489, this); + if (sendMessage(_class489, 0x480C, _klayman->getX() > _class489->getX() ? 1 : 0) != 0) { + sendEntityMessage(_klayman, 0x1014, _class489); setMessageList2(0x004B8CA0); } else { setMessageList2(0x004B8C40); } } else if (sender == _asTape && _messageListStatus != 2) { - _klayman->sendEntityMessage(0x1014, _asTape, this); + sendEntityMessage(_klayman, 0x1014, _asTape); setMessageList(0x004B8CD0); } else if (sender == _class545 && _messageListStatus != 2) { - _klayman->sendEntityMessage(0x1014, _class545, this); + sendEntityMessage(_klayman, 0x1014, _class545); setMessageList(0x004B8D18); } break; @@ -1757,7 +1757,7 @@ uint32 AsScene1405Tile::handleMessage(int messageNum, const MessageParam ¶m, case 0x1011: if (getSubVar(0xCCE0280F, _index) == 0 && _parentScene->getCountdown() == 0) { show(); - _parentScene->sendMessage(0x2000, _index, this); + sendMessage(_parentScene, 0x2000, _index); } messageResult = 1; break; @@ -1841,7 +1841,7 @@ uint32 Scene1405::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x0001: // TODO: Debug/Cheat stuff if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } break; case 0x000D: diff --git a/engines/neverhood/module1500.cpp b/engines/neverhood/module1500.cpp index 9506f8032e..40b15b3622 100644 --- a/engines/neverhood/module1500.cpp +++ b/engines/neverhood/module1500.cpp @@ -63,14 +63,14 @@ void Module1500::update() { if (_flag) { createScene1503(); } else { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } break; case 3: createScene1501(); break; default: - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); break; } } @@ -91,7 +91,7 @@ void Module1500::createScene1502() { } void Module1500::createScene1503() { - _parentModule->sendMessage(0x0800, 0, this); + sendMessage(_parentModule, 0x0800, 0); _vm->gameState().sceneNum = 2; createSmackerScene(0x001A0005, true, true, true); SetUpdateHandler(&Module1500::update); @@ -148,7 +148,7 @@ void Scene1501::update() { _countdown1--; if (_countdown1 == 0) { _vm->_screen->clear(); - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } } else if ((_countdown2 != 0 && (--_countdown2 == 0)) /*|| !_soundResource.isPlaying()*/) { _countdown1 = 12; diff --git a/engines/neverhood/module1700.cpp b/engines/neverhood/module1700.cpp index e6cbe62b10..b281b38464 100644 --- a/engines/neverhood/module1700.cpp +++ b/engines/neverhood/module1700.cpp @@ -161,7 +161,7 @@ void Module1700::updateScene1705() { _done = false; delete _childObject; _childObject = NULL; - _parentModule->sendMessage(0x1009, 1, this); + sendMessage(_parentModule, 0x1009, 1); } } @@ -211,7 +211,7 @@ uint32 Class606::handleMessage(int messageNum, const MessageParam ¶m, Entity uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x1011: - _parentScene->sendMessage(0x4826, 0, this); + sendMessage(_parentScene, 0x4826, 0); messageResult = 1; break; case 0x4806: @@ -264,43 +264,43 @@ Scene1705::Scene1705(NeverhoodEngine *vm, Module *parentModule, int which) if (which < 0) { _klayman = new KmScene1705(_vm, this, 231, 434); setMessageList(0x004B69E8); - sendMessage(0x2000, 0, this); + sendMessage(this, 0x2000, 0); _klayman->getSurface()->getClipRect().x1 = 0; _klayman->getSurface()->getClipRect().y1 = 0; _klayman->getSurface()->getClipRect().x2 = _sprite->getSurface()->getDrawRect().x + _sprite->getSurface()->getDrawRect().width; _klayman->getSurface()->getClipRect().y2 = 480; } else if (which == 1) { _klayman = new KmScene1705(_vm, this, 431, 434); - _klayman->sendMessage(0x2000, 1, this); + sendMessage(_klayman, 0x2000, 1); setMessageList(0x004B6A08); - sendMessage(0x2000, 1, this); + sendMessage(this, 0x2000, 1); _klayman->getSurface()->getClipRect().x1 = 0; _klayman->getSurface()->getClipRect().y1 = 0; _klayman->getSurface()->getClipRect().x2 = _sprite->getSurface()->getDrawRect().x + _sprite->getSurface()->getDrawRect().width; _klayman->getSurface()->getClipRect().y2 = 480; } else if (which == 2) { _klayman = new KmScene1705(_vm, this, 431, 434); - _klayman->sendMessage(0x2000, 1, this); + sendMessage(_klayman, 0x2000, 1); setMessageList(0x004B6AA0); - sendMessage(0x2000, 1, this); + sendMessage(this, 0x2000, 1); _klayman->getSurface()->getClipRect().x1 = 0; _klayman->getSurface()->getClipRect().y1 = 0; _klayman->getSurface()->getClipRect().x2 = _sprite->getSurface()->getDrawRect().x + _sprite->getSurface()->getDrawRect().width; _klayman->getSurface()->getClipRect().y2 = 480; } else if (which == 3) { _klayman = new KmScene1705(_vm, this, 431, 434); - _klayman->sendMessage(0x2000, 1, this); + sendMessage(_klayman, 0x2000, 1); setMessageList(0x004B6A18); - sendMessage(0x2000, 1, this); + sendMessage(this, 0x2000, 1); _klayman->getSurface()->getClipRect().x1 = 0; _klayman->getSurface()->getClipRect().y1 = 0; _klayman->getSurface()->getClipRect().x2 = _sprite->getSurface()->getDrawRect().x + _sprite->getSurface()->getDrawRect().width; _klayman->getSurface()->getClipRect().y2 = 480; } else { _klayman = new KmScene1705(_vm, this, 231, 74); - _klayman->sendMessage(0x2000, 0, this); + sendMessage(_klayman, 0x2000, 0); setMessageList(0x004B69F0); - sendMessage(0x2000, 0, this); + sendMessage(this, 0x2000, 0); tempSprite = addSprite(new StaticSprite(_vm, 0x30303822, 1100)); _klayman->getSurface()->getClipRect().x1 = 0; _klayman->getSurface()->getClipRect().y1 = tempSprite->getSurface()->getDrawRect().y; @@ -339,7 +339,7 @@ uint32 Scene1705::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x4826: if (sender == _class606 && _klayman->getX() <= 318) { - _klayman->sendEntityMessage(0x1014, sender, this); + sendEntityMessage(_klayman, 0x1014, sender); setMessageList(0x004B6AC0); } break; diff --git a/engines/neverhood/module1800.cpp b/engines/neverhood/module1800.cpp index e2c88dc2b6..f503848661 100644 --- a/engines/neverhood/module1800.cpp +++ b/engines/neverhood/module1800.cpp @@ -196,12 +196,12 @@ void Module1800::updateScene1803() { createScene1801(2); _childObject->handleUpdate(); } else if (_field20 == 3) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } else if (_field20 == 6) { createScene1809(-1); _childObject->handleUpdate(); } else if (_field20 == 7) { - _parentModule->sendMessage(0x1009, 3, this); + sendMessage(_parentModule, 0x1009, 3); } } } @@ -251,7 +251,7 @@ void Module1800::updateScene1806() { delete _childObject; _childObject = NULL; if (_field20 == 0) { - _parentModule->sendMessage(0x1009, 2, this); + sendMessage(_parentModule, 0x1009, 2); } else if (_field20 == 1) { createScene1805(3); _childObject->handleUpdate(); @@ -271,7 +271,7 @@ void Module1800::updateScene1809() { _done = false; delete _childObject; _childObject = NULL; - _parentModule->sendMessage(0x1009, 1, this); + sendMessage(_parentModule, 0x1009, 1); // TODO GameState stuff } } diff --git a/engines/neverhood/module2000.cpp b/engines/neverhood/module2000.cpp index 9f45db218c..1af7799196 100644 --- a/engines/neverhood/module2000.cpp +++ b/engines/neverhood/module2000.cpp @@ -89,7 +89,7 @@ void Module2000::updateScene2001() { delete _childObject; _childObject = NULL; if (_field20 == 1) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } else { createScene2002(0); } @@ -144,26 +144,26 @@ Scene2001::Scene2001(NeverhoodEngine *vm, Module *parentModule, int which) if (which < 0) { _klayman = new KmScene2001(_vm, this, 300, 345); setMessageList(0x004B3538); - sendMessage(0x2000, 0, this); + sendMessage(this, 0x2000, 0); } else if (which == 1) { _klayman = new KmScene2001(_vm, this, 116, 345); - _klayman->sendMessage(0x2000, 1, this); + sendMessage(_klayman, 0x2000, 1); setMessageList(0x004B3540); - sendMessage(0x2000, 1, this); + sendMessage(this, 0x2000, 1); } else if (which == 2) { _klayman = new KmScene2001(_vm, this, 116, 345); - _klayman->sendMessage(0x2000, 1, this); + sendMessage(_klayman, 0x2000, 1); setMessageList(0x004B35F0); - sendMessage(0x2000, 1, this); + sendMessage(this, 0x2000, 1); } else if (which == 3) { _klayman = new KmScene2001(_vm, this, 116, 345); - _klayman->sendMessage(0x2000, 1, this); + sendMessage(_klayman, 0x2000, 1); setMessageList(0x004B3550); - sendMessage(0x2000, 1, this); + sendMessage(this, 0x2000, 1); } else { _klayman = new KmScene2001(_vm, this, 390, 345); setMessageList(0x004B3530); - sendMessage(0x2000, 0, this); + sendMessage(this, 0x2000, 0); _klayman->setDoDeltaX(1); } addSprite(_klayman); diff --git a/engines/neverhood/module2200.cpp b/engines/neverhood/module2200.cpp index fe6f36cc45..3faad252bc 100644 --- a/engines/neverhood/module2200.cpp +++ b/engines/neverhood/module2200.cpp @@ -508,7 +508,7 @@ void Module2200::updateScene2201() { } else if (_field20 == 2) { createScene2202(0); } else { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } } } @@ -1529,22 +1529,22 @@ Scene2201::Scene2201(NeverhoodEngine *vm, Module *parentModule, int which) _rect2.y2 = 480; if (!getGlobalVar(0x404290D5)) { - addSprite(new StaticSprite(_vm, 0x00026027, 900)); + insertStaticSprite(0x00026027, 900); } - tempSprite = addSprite(new StaticSprite(_vm, 0x030326A0, 1100)); + tempSprite = insertStaticSprite(0x030326A0, 1100); _rect1.x1 = tempSprite->getSurface()->getDrawRect().x; - addSprite(new StaticSprite(_vm, 0x811DA061, 1100)); + insertStaticSprite(0x811DA061, 1100); - tempSprite = addSprite(new StaticSprite(_vm, 0x11180022, 1100)); + tempSprite = insertStaticSprite(0x11180022, 1100); _rect2.x1 = tempSprite->getSurface()->getDrawRect().x; - tempSprite = addSprite(new StaticSprite(_vm, 0x0D411130, 1100)); + tempSprite = insertStaticSprite(0x0D411130, 1100); _rect1.y2 = tempSprite->getSurface()->getDrawRect().y + tempSprite->getSurface()->getDrawRect().height; _rect2.y1 = tempSprite->getSurface()->getDrawRect().y + tempSprite->getSurface()->getDrawRect().height; - _doorLightSprite = addSprite(new StaticSprite(_vm, 0xA4062212, 900)); + _doorLightSprite = insertStaticSprite(0xA4062212, 900); if (which < 0) { _klayman = new KmScene2201(_vm, this, 300, 427, &_rect1, 2); @@ -1595,9 +1595,9 @@ uint32 Scene2201::handleMessage(int messageNum, const MessageParam ¶m, Entit switch (messageNum) { case 0x100D: if (param.asInteger() == 0x402064D8) { - _klayman->sendEntityMessage(0x1014, _ssDoorButton, this); + sendEntityMessage(_klayman, 0x1014, _ssDoorButton); } else if (param.asInteger() == 0x35803198) { - if (_asDoor->hasMessageHandler() && _asDoor->sendMessage(0x2000, 0, this)) { + if (_asDoor->hasMessageHandler() && sendMessage(_asDoor, 0x2000, 0)) { setMessageList(0x004B81A0); } else { setMessageList(0x004B81B8); @@ -1620,12 +1620,12 @@ uint32 Scene2201::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x480B: if (sender == _ssDoorButton) { - _asDoor->sendMessage(0x4808, 0, this); + sendMessage(_asDoor, 0x4808, 0); } break; case 0x4826: if (sender == _asTape) { - _klayman->sendEntityMessage(0x1014, _asTape, this); + sendEntityMessage(_klayman, 0x1014, _asTape); setMessageList(0x004B81C8); } break; @@ -1705,7 +1705,7 @@ uint32 SsScene2202PuzzleTile::handleMessage(int messageNum, const MessageParam & switch (messageNum) { case 0x1011: if (!_isMoving && !getGlobalVar(0x404290D5)) { - _parentScene->sendMessage(0x2000, _tileIndex, this); + sendMessage(_parentScene, 0x2000, _tileIndex); } messageResult = 1; break; @@ -1878,7 +1878,7 @@ void SsScene2202PuzzleTile::stopMoving() { _needRefresh = true; SetSpriteCallback(NULL); _isMoving = false; - _parentScene->sendMessage(0x2002, _tileIndex, this); + sendMessage(_parentScene, 0x2002, _tileIndex); } Scene2202::Scene2202(NeverhoodEngine *vm, Module *parentModule, int which) @@ -1912,9 +1912,9 @@ Scene2202::Scene2202(NeverhoodEngine *vm, Module *parentModule, int which) } } - addSprite(new StaticSprite(_vm, 0x55C043B8, 200)); - addSprite(new StaticSprite(_vm, 0x85500158, 400)); - addSprite(new StaticSprite(_vm, 0x25547028, 600)); + insertStaticSprite(0x55C043B8, 200); + insertStaticSprite(0x85500158, 400); + insertStaticSprite(0x25547028, 600); _soundResource1.load(0x68E25540); _soundResource2.load(0x40400457); @@ -1932,7 +1932,7 @@ void Scene2202::update() { Scene::update(); if (_leaveScene && !_soundResource2.isPlaying()) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } if (_isSolved && !_soundResource1.isPlaying()) { @@ -1945,7 +1945,7 @@ void Scene2202::update() { int16 value = getFreeTileIndex(_movingTileIndex); if (value != -1) { setSurfacePriority(_movingTileSprite->getSurface(), 700); - _movingTileSprite->sendMessage(0x2001, value, this); + sendMessage(_movingTileSprite, 0x2001, value); _movingTileSprite = NULL; _isTileMoving = true; } @@ -1969,7 +1969,7 @@ uint32 Scene2202::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x0001: // TODO Debug stuff if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } break; case 0x000D: @@ -2039,7 +2039,7 @@ uint32 Class545::handleMessage(int messageNum, const MessageParam ¶m, Entity uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x1011: - _parentScene->sendMessage(0x4826, 0, this); + sendMessage(_parentScene, 0x4826, 0); messageResult = 1; break; case 0x4806: @@ -2078,9 +2078,9 @@ uint32 AsScene2203Door::handleMessage(int messageNum, const MessageParam ¶m, switch (messageNum) { case 0x1011: if (_index == getGlobalVar(0x9A500914)) - _parentScene->sendMessage(0x2002, 0, this); + sendMessage(_parentScene, 0x2002, 0); else - _parentScene->sendMessage(0x2001, 0, this); + sendMessage(_parentScene, 0x2001, 0); messageResult = 1; break; case 0x2000: @@ -2088,17 +2088,17 @@ uint32 AsScene2203Door::handleMessage(int messageNum, const MessageParam ¶m, break; case 0x3002: if (_index == getGlobalVar(0x9A500914)) - _parentScene->sendMessage(0x4808, 0, this); + sendMessage(_parentScene, 0x4808, 0); setFileHash1(); break; case 0x4808: setGlobalVar(0x9A500914, _index); - _otherDoor->sendMessage(0x4809, 0, this); + sendMessage(_otherDoor, 0x4809, 0); openDoor(); break; case 0x4809: closeDoor(); - _parentScene->sendMessage(0x2003, 0, this); + sendMessage(_parentScene, 0x2003, 0); break; } return messageResult; @@ -2142,8 +2142,8 @@ Scene2203::Scene2203(NeverhoodEngine *vm, Module *parentModule, int which) _asLeftDoor = addSprite(new AsScene2203Door(_vm, this, 0)); _asRightDoor = addSprite(new AsScene2203Door(_vm, this, 1)); - _ssSmallLeftDoor = addSprite(new StaticSprite(_vm, 0x542CC072, 1100)); - _ssSmallRightDoor = addSprite(new StaticSprite(_vm, 0x0A2C0432, 1100)); + _ssSmallLeftDoor = insertStaticSprite(0x542CC072, 1100); + _ssSmallRightDoor = insertStaticSprite(0x0A2C0432, 1100); _leftDoorClipRect.x1 = _ssSmallLeftDoor->getSurface()->getDrawRect().x; _leftDoorClipRect.y1 = 0; @@ -2155,8 +2155,8 @@ Scene2203::Scene2203(NeverhoodEngine *vm, Module *parentModule, int which) _rightDoorClipRect.x2 = _ssSmallRightDoor->getSurface()->getDrawRect().x + _ssSmallRightDoor->getSurface()->getDrawRect().width; _rightDoorClipRect.y2 = 480; - _asLeftDoor->sendEntityMessage(0x2000, _asRightDoor, this); - _asRightDoor->sendEntityMessage(0x2000, _asLeftDoor, this); + sendEntityMessage(_asLeftDoor, 0x2000, _asRightDoor); + sendEntityMessage(_asRightDoor, 0x2000, _asLeftDoor); _vm->_collisionMan->addSprite(_asLeftDoor); _vm->_collisionMan->addSprite(_asRightDoor); @@ -2201,7 +2201,7 @@ uint32 Scene2203::handleMessage(int messageNum, const MessageParam ¶m, Entit uint32 messageResult = Scene::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x2001: - _klayman->sendEntityMessage(0x1014, sender, this); + sendEntityMessage(_klayman, 0x1014, sender); if (sender == _asLeftDoor) { setMessageList2(0x004B83B0); } else { @@ -2233,10 +2233,10 @@ uint32 Scene2203::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x4826: if (sender == _asTape) { - _klayman->sendEntityMessage(0x1014, _asTape, this); + sendEntityMessage(_klayman, 0x1014, _asTape); setMessageList(0x004B83E0); } else if (sender == _class545) { - _klayman->sendEntityMessage(0x1014, _class545, this); + sendEntityMessage(_klayman, 0x1014, _class545); setMessageList(0x004B83F0); } break; @@ -2352,7 +2352,7 @@ void Scene2205::update() { _palette->addPalette(0x0008028D, 0, 256, 0); _background->load(0x0008028D); _ssLightSwitch->setFileHashes(0x2D339030, 0x2D309030); - _ssDoorFrame->sendMessage(0x2000, 0, this); + sendMessage(_ssDoorFrame, 0x2000, 0); ((Mouse433*)_mouseCursor)->load(0x80289008); ((Mouse433*)_mouseCursor)->updateCursor(); _isLightOn = true; @@ -2360,7 +2360,7 @@ void Scene2205::update() { _palette->addPalette(0xD00A028D, 0, 256, 0); _background->load(0xD00A028D); _ssLightSwitch->setFileHashes(0x2D339030, 0xDAC86E84); - _ssDoorFrame->sendMessage(0x2000, 0, this); + sendMessage(_ssDoorFrame, 0x2000, 0); ((Mouse433*)_mouseCursor)->load(0xA0289D08); ((Mouse433*)_mouseCursor)->updateCursor(); _isKlaymanInLight = true; @@ -2394,7 +2394,7 @@ uint32 Scene2205::handleMessage(int messageNum, const MessageParam ¶m, Entit } else if (param.asInteger() == 0x2841369C) { setMessageList(0x004B0630); } else if (param.asInteger() == 0x402064D8) { - _klayman->sendEntityMessage(0x1014, _ssLightSwitch, this); + sendEntityMessage(_klayman, 0x1014, _ssLightSwitch); } break; case 0x480B: @@ -2531,7 +2531,7 @@ uint32 Class607::handleMessage(int messageNum, const MessageParam ¶m, Entity uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x1011: - _parentScene->sendMessage(0x4826, 0, this); + sendMessage(_parentScene, 0x4826, 0); messageResult = 1; break; case 0x4806: @@ -2555,9 +2555,9 @@ Scene2206::Scene2206(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(0x4D080E54)) { fileHash = 0x41983216; - _sprite1 = addSprite(new StaticSprite(_vm, 0x2201266A, 100)); - _sprite2 = addSprite(new StaticSprite(_vm, 0x3406A333, 300)); - _sprite3 = addSprite(new StaticSprite(_vm, 0x24A223A2, 100)); + _sprite1 = insertStaticSprite(0x2201266A, 100); + _sprite2 = insertStaticSprite(0x3406A333, 300); + _sprite3 = insertStaticSprite(0x24A223A2, 100); _sprite4 = addSprite(new Class603(_vm, 0x26133023)); _sprite4->getSurface()->getClipRect().x1 = _sprite2->getSurface()->getDrawRect().x; _sprite4->getSurface()->getClipRect().y1 = 0; @@ -2570,9 +2570,9 @@ Scene2206::Scene2206(NeverhoodEngine *vm, Module *parentModule, int which) _class604 = addSprite(new Class604(_vm, 0x085E25E0)); } else { fileHash = 0xE0102A45; - _sprite1 = addSprite(new StaticSprite(_vm, 0x1C1106B8, 100)); - _sprite2 = addSprite(new StaticSprite(_vm, 0x020462E0, 300)); - _sprite3 = addSprite(new StaticSprite(_vm, 0x900626A2, 100)); + _sprite1 = insertStaticSprite(0x1C1106B8, 100); + _sprite2 = insertStaticSprite(0x020462E0, 300); + _sprite3 = insertStaticSprite(0x900626A2, 100); _sprite4 = addSprite(new Class603(_vm, 0x544822A8)); _sprite4->getSurface()->getClipRect().x1 = _sprite2->getSurface()->getDrawRect().x; _sprite4->getSurface()->getClipRect().y1 = 0; @@ -2644,7 +2644,7 @@ uint32 Scene2206::handleMessage(int messageNum, const MessageParam ¶m, Entit if (param.asInteger() == 0x800C6694) { sub481B00(); } else if (param.asInteger() == 0x402064D8) { - _klayman->sendEntityMessage(0x1014, _sprite5, this); + sendEntityMessage(_klayman, 0x1014, _sprite5); } else if (param.asInteger() == 0x11C40840) { if (getGlobalVar(0x18890C91)) setMessageList(0x004B8948); @@ -2653,19 +2653,19 @@ uint32 Scene2206::handleMessage(int messageNum, const MessageParam ¶m, Entit } break; case 0x4803: - _class604->sendMessage(0x4803, 0, this); + sendMessage(_class604, 0x4803, 0); break; case 0x480B: if (sender == _sprite5) { setGlobalVar(0x18890C91, getGlobalVar(0x18890C91) ? 0 : 1); if (getGlobalVar(0x18890C91)) - _sprite4->sendMessage(0x4808, 0, this); + sendMessage(_sprite4, 0x4808, 0); else - _sprite4->sendMessage(0x4809, 0, this); + sendMessage(_sprite4, 0x4809, 0); } break; case 0x4826: - _klayman->sendEntityMessage(0x1014, _class607, this); + sendEntityMessage(_klayman, 0x1014, _class607); setMessageList(0x004B8988); break; case 0x482A: @@ -2779,7 +2779,7 @@ void AsScene2207Elevator::update() { if (_destPointIndex + _destPointIndexDelta < _pointIndex) { _pointIndex--; if (_pointIndex == 0) - _parentScene->sendMessage(0x2003, 0, this); + sendMessage(_parentScene, 0x2003, 0); setFileHash(getGlobalVar(0x4D080E54) ? 0xC858CC19 : 0x294B3377, _pointIndex, _pointIndex); _newHashListIndex = _pointIndex; if (_destPointIndex + _destPointIndexDelta == _pointIndex) { @@ -2793,15 +2793,15 @@ void AsScene2207Elevator::update() { } if (_pointIndex > 20 && _surface->getPriority() != 900) { - _parentScene->sendMessage(0x2002, 900, this); + sendMessage(_parentScene, 0x2002, 900); } else if (_pointIndex < 20 && _surface->getPriority() != 1100) { - _parentScene->sendMessage(0x2002, 1100, this); + sendMessage(_parentScene, 0x2002, 1100); } AnimatedSprite::update(); if (_destPointIndex + _destPointIndexDelta == _pointIndex && _isMoving) { - _parentScene->sendMessage(0x2004, 0, this); + sendMessage(_parentScene, 0x2004, 0); _isMoving = false; } @@ -2870,7 +2870,7 @@ uint32 AsScene2207Lever::handleMessage(int messageNum, const MessageParam ¶m uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x1011: - _parentScene->sendMessage(0x4826, 0, this); + sendMessage(_parentScene, 0x4826, 0); messageResult = 1; break; case 0x3002: @@ -2884,10 +2884,10 @@ uint32 AsScene2207Lever::handleMessage(int messageNum, const MessageParam ¶m stLeverDown(); break; case 0x482A: - _parentScene->sendMessage(0x1022, 990, this); + sendMessage(_parentScene, 0x1022, 990); break; case 0x482B: - _parentScene->sendMessage(0x1022, 1010, this); + sendMessage(_parentScene, 0x1022, 1010); break; } return messageResult; @@ -2900,7 +2900,7 @@ void AsScene2207Lever::stLeverDown() { } void AsScene2207Lever::stLeverDownEvent() { - _parentScene->sendMessage(0x480F, 0, this); + sendMessage(_parentScene, 0x480F, 0); } void AsScene2207Lever::stLeverUp() { @@ -2911,7 +2911,7 @@ void AsScene2207Lever::stLeverUp() { } void AsScene2207Lever::stLeverUpEvent() { - _parentScene->sendMessage(0x4807, 0, this); + sendMessage(_parentScene, 0x4807, 0); } AsScene2207WallRobotAnimation::AsScene2207WallRobotAnimation(NeverhoodEngine *vm, Scene *parentScene) @@ -3084,9 +3084,9 @@ Scene2207::Scene2207(NeverhoodEngine *vm, Module *parentModule, int which) _palette->usePalette(); _mouseCursor = addSprite(new Mouse433(_vm, 0x00245884, NULL)); - _ssMaskPart1 = addSprite(new StaticSprite(_vm, 0xE20A28A0, 1200)); - _ssMaskPart2 = addSprite(new StaticSprite(_vm, 0x688F62A5, 1100)); - _ssMaskPart3 = addSprite(new StaticSprite(_vm, 0x0043B038, 1100)); + _ssMaskPart1 = insertStaticSprite(0xE20A28A0, 1200); + _ssMaskPart2 = insertStaticSprite(0x688F62A5, 1100); + _ssMaskPart3 = insertStaticSprite(0x0043B038, 1100); _asTape = addSprite(new AsScene1201Tape(_vm, this, 4, 1100, 277, 428, 0x9148A011)); _vm->_collisionMan->addSprite(_asTape); @@ -3126,7 +3126,7 @@ Scene2207::Scene2207(NeverhoodEngine *vm, Module *parentModule, int which) _palette->usePalette(); _mouseCursor = addSprite(new Mouse433(_vm, 0x02A51054, NULL)); - _ssMaskPart1 = addSprite(new StaticSprite(_vm, 0x980E46A4, 1200)); + _ssMaskPart1 = insertStaticSprite(0x980E46A4, 1200); addSprite(new SsScene2207Symbol(_vm, kScene2207FileHashes[getSubVar(0x00504B86, 0)], 0)); addSprite(new SsScene2207Symbol(_vm, kScene2207FileHashes[getSubVar(0x00504B86, 1)], 1)); @@ -3154,9 +3154,9 @@ Scene2207::Scene2207(NeverhoodEngine *vm, Module *parentModule, int which) setRectList(0x004B38B8); - _klayman->sendEntityMessage(0x1014, _asElevator, this); - _klayman->sendMessage(0x2001, 0, this); - _asElevator->sendMessage(0x2000, 480, this); + sendEntityMessage(_klayman, 0x1014, _asElevator); + sendMessage(_klayman, 0x2001, 0); + sendMessage(_asElevator, 0x2000, 480); _soundResource2.load(calcHash("fxFogHornSoft")); @@ -3179,35 +3179,35 @@ uint32 Scene2207::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x100D: if (param.asInteger() == 0x0014F275) { if (_klaymanAtElevator) { - _asElevator->sendMessage(0x2000, _mouseClickPos.y, this); - _klayman->sendEntityMessage(0x1014, _asElevator, this); - _klayman->sendMessage(0x2001, 0, this); + sendMessage(_asElevator, 0x2000, _mouseClickPos.y); + sendEntityMessage(_klayman, 0x1014, _asElevator); + sendMessage(_klayman, 0x2001, 0); } else { messageList402220(); } } else if (param.asInteger() == 0x34569073) { if (_klaymanAtElevator) { _messageListFlag1 = true; - _asElevator->sendMessage(0x2000, 0, this); - _klayman->sendEntityMessage(0x1014, _asElevator, this); - _klayman->sendMessage(0x2001, 0, this); + sendMessage(_asElevator, 0x2000, 0); + sendEntityMessage(_klayman, 0x1014, _asElevator); + sendMessage(_klayman, 0x2001, 0); } else { messageList402220(); } } else if (param.asInteger() == 0x4054C877) { if (_klaymanAtElevator) { - _asElevator->sendMessage(0x2000, 480, this); - _klayman->sendEntityMessage(0x1014, _asElevator, this); - _klayman->sendMessage(0x2001, 0, this); + sendMessage(_asElevator, 0x2000, 480); + sendEntityMessage(_klayman, 0x1014, _asElevator); + sendMessage(_klayman, 0x2001, 0); } else { messageList402220(); } } else if (param.asInteger() == 0x0CBC6211) { - _klayman->sendEntityMessage(0x1014, _asElevator, this); - _klayman->sendMessage(0x2001, 0, this); + sendEntityMessage(_klayman, 0x1014, _asElevator); + sendMessage(_klayman, 0x2001, 0); setRectList(0x004B38B8); } else if (param.asInteger() == 0x402064D8) { - _klayman->sendEntityMessage(0x1014, _ssButton, this); + sendEntityMessage(_klayman, 0x1014, _ssButton); } else if (param.asInteger() == 0x231DA241) { if (_ssButton) { setMessageList(0x004B38F0); @@ -3223,8 +3223,8 @@ uint32 Scene2207::handleMessage(int messageNum, const MessageParam ¶m, Entit _messageListFlag1 = false; break; case 0x4807: - _asWallRobotAnimation->sendMessage(0x2007, 0, this); - _asWallCannonAnimation->sendMessage(0x2007, 0, this); + sendMessage(_asWallRobotAnimation, 0x2007, 0); + sendMessage(_asWallCannonAnimation, 0x2007, 0); break; case 0x480B: if (sender == _ssButton) { @@ -3238,22 +3238,22 @@ uint32 Scene2207::handleMessage(int messageNum, const MessageParam ¶m, Entit } break; case 0x480F: - _asWallRobotAnimation->sendMessage(0x2006, 0, this); - _asWallCannonAnimation->sendMessage(0x2006, 0, this); + sendMessage(_asWallRobotAnimation, 0x2006, 0); + sendMessage(_asWallCannonAnimation, 0x2006, 0); _asWallRobotAnimation->getSurface()->setVisible(true); _asWallCannonAnimation->getSurface()->setVisible(true); break; case 0x4826: if (sender == _asTape) { if (_klayman->getY() == 423) { - _klayman->sendEntityMessage(0x1014, _asTape, this); + sendEntityMessage(_klayman, 0x1014, _asTape); setMessageList(0x004B3958); } } else if (_klaymanAtElevator) { SetMessageHandler(&Scene2207::handleMessage2); - _asElevator->sendMessage(0x2000, 347, this); - _klayman->sendEntityMessage(0x1014, _asElevator, this); - _klayman->sendMessage(0x2001, 0, this); + sendMessage(_asElevator, 0x2000, 347); + sendEntityMessage(_klayman, 0x1014, _asElevator); + sendMessage(_klayman, 0x2001, 0); } break; } @@ -3268,8 +3268,8 @@ uint32 Scene2207::handleMessage2(int messageNum, const MessageParam ¶m, Enti break; case 0x2004: SetMessageHandler(&Scene2207::handleMessage); - _klayman->sendMessage(0x2005, 0, this); - _klayman->sendEntityMessage(0x1014, _asLever, this); + sendMessage(_klayman, 0x2005, 0); + sendEntityMessage(_klayman, 0x1014, _asLever); setMessageList(0x004B3920); setRectList(0x004B3948); break; @@ -3421,7 +3421,7 @@ uint32 Scene2208::handleMessage(int messageNum, const MessageParam ¶m, Entit switch (messageNum) { case 0x0001: if (param.asPoint().x <= 40 || param.asPoint().x >= 600) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } break; } @@ -3567,7 +3567,7 @@ uint32 Scene2242::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x4826: if (sender == _asTape) { - _klayman->sendEntityMessage(0x1014, _asTape, this); + sendEntityMessage(_klayman, 0x1014, _asTape); setMessageList(0x004B3D50); } break; diff --git a/engines/neverhood/module2300.cpp b/engines/neverhood/module2300.cpp index 6bd10bbf12..19861ac7ca 100644 --- a/engines/neverhood/module2300.cpp +++ b/engines/neverhood/module2300.cpp @@ -134,19 +134,9 @@ void Module2300::updateScene2301() { createScene2302(4); _childObject->handleUpdate(); } else { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } } - if (_field24 >= 0) { - if (_field24 == 0) { - _parentModule->sendMessage(0x100A, 0, this); - } - _field24 = -1; - } - if (_field26 >= 0) { - _parentModule->sendMessage(0x1023, 0, this); - _field26 = -1; - } } void Module2300::updateScene2302() { @@ -185,9 +175,9 @@ void Module2300::updateScene2302() { createScene2304(1); _childObject->handleUpdate(); } else if (_field20 == 5) { - _parentModule->sendMessage(0x1009, 3, this); + sendMessage(_parentModule, 0x1009, 3); } else { - _parentModule->sendMessage(0x1009, 4, this); + sendMessage(_parentModule, 0x1009, 4); } } } @@ -199,7 +189,7 @@ void Module2300::updateScene2303() { delete _childObject; _childObject = NULL; if (_field20 == 1) { - _parentModule->sendMessage(0x1009, 3, this); + sendMessage(_parentModule, 0x1009, 3); } else { createScene2302(5); _childObject->handleUpdate(); @@ -229,24 +219,12 @@ void Module2300::updateScene2304() { delete _childObject; _childObject = NULL; if (_field20 == 1) { - _parentModule->sendMessage(0x1009, 2, this); + sendMessage(_parentModule, 0x1009, 2); } else { createScene2302(1); _childObject->handleUpdate(); } } - if (_field24 >= 0) { - if (_field24 == 0) { - _parentModule->sendMessage(0x100A, 2, this); - } - _field24 = -1; - } - if (_field26 >= 0) { - if (_field26 == 1) { - _parentModule->sendMessage(0x1023, 2, this); - } - _field26 = -1; - } } void Module2300::updateScene2305() { diff --git a/engines/neverhood/module3000.cpp b/engines/neverhood/module3000.cpp index 51940bacd0..2c819a459e 100644 --- a/engines/neverhood/module3000.cpp +++ b/engines/neverhood/module3000.cpp @@ -286,7 +286,7 @@ void Module3000::updateScene3002() { createScene3010(-1); _childObject->handleUpdate(); } else if (_moduleDoneStatus == 1) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } } else { if (_moduleDoneStatus == 0) { @@ -298,7 +298,7 @@ void Module3000::updateScene3002() { _childObject->handleUpdate(); } } else if (_moduleDoneStatus == 1) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } } } @@ -325,7 +325,7 @@ void Module3000::updateScene3002b() { createScene3009(-1); break; case 11: - _parentModule->sendMessage(0x1009, 3, this); + sendMessage(_parentModule, 0x1009, 3); break; case 12: createScene3002(0); @@ -431,7 +431,7 @@ void Module3000::updateScene3005() { delete _childObject; _childObject = NULL; if (_moduleDoneStatus == 0) { - _parentModule->sendMessage(0x1009, 1, this); + sendMessage(_parentModule, 0x1009, 1); } else if (_moduleDoneStatus == 1) { createScene3008(-1); _childObject->handleUpdate(); @@ -650,7 +650,7 @@ SsScene3009FireCannonButton::SsScene3009FireCannonButton(NeverhoodEngine *vm, Sc void SsScene3009FireCannonButton::update() { StaticSprite::update(); if (_flag1 && !_soundResource.isPlaying()) { - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); _surface->setVisible(false); } } @@ -794,7 +794,7 @@ uint32 SsScene3009SymbolArrow::handleMessage(int messageNum, const MessageParam _drawRect.width = _spriteResource.getDimensions().width; _drawRect.height = _spriteResource.getDimensions().height; _soundResource.play(); - _asSymbol->sendMessage(0x2005, _incrDecr, this); + sendMessage(_asSymbol, 0x2005, _incrDecr); } messageResult = 1; break; @@ -827,7 +827,7 @@ uint32 AsScene3009VerticalIndicator::handleMessage(int messageNum, const Message switch (messageNum) { case 0x1011: if (_enabled) { - _parentScene->sendMessage(0x2002, 0, this); + sendMessage(_parentScene, 0x2002, 0); } messageResult = 1; break; @@ -857,7 +857,7 @@ uint32 AsScene3009HorizontalIndicator::handleMessage(int messageNum, const Messa switch (messageNum) { case 0x1011: if (_enabled) { - _parentScene->sendMessage(0x2004, 0, this); + sendMessage(_parentScene, 0x2004, 0); } messageResult = 1; break; @@ -942,9 +942,9 @@ uint32 AsScene3009Symbol::handleMessage(int messageNum, const MessageParam ¶ _newHashListIndex = _symbolIndex; setSubVar(0x00000914, _index, _symbolIndex); if (_index / 3 == 0) { - _parentScene->sendMessage(0x2001, 0, this); + sendMessage(_parentScene, 0x2001, 0); } else { - _parentScene->sendMessage(0x2003, 0, this); + sendMessage(_parentScene, 0x2003, 0); } messageResult = 1; break; @@ -1025,7 +1025,7 @@ Scene3009::Scene3009(NeverhoodEngine *vm, Module *parentModule, int which) // DEBUG: Set the correct code for (int i = 0; i < 6; i++) setSubVar(0x00000914, i, _correctSymbols[i]); - sendMessage(0x2003, 0, this); + sendMessage(this, 0x2003, 0); //setGlobalVar(0x610210B7, 1); } @@ -1108,7 +1108,7 @@ uint32 Scene3009::handleMessage(int messageNum, const MessageParam ¶m, Entit // TODO: Debug stuff if ((param.asPoint().x <= 20 || param.asPoint().x >= 620) && !getGlobalVar(0x000809C2)) { setGlobalVar(0x20580A86, 0); - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } break; case 0x000D: @@ -1191,7 +1191,7 @@ uint32 Scene3009::handleMessage(int messageNum, const MessageParam ¶m, Entit void Scene3009::playExtVideo() { setGlobalVar(0x20580A86, _cannonLocation); setGlobalVar(0xF0402B0A, kScene3009CannonLocationFileHashes[_cannonLocation]); - _parentModule->sendMessage(0x1009, 1, this); + sendMessage(_parentModule, 0x1009, 1); } bool Scene3009::isSymbolsPart1Solved() { @@ -1303,9 +1303,9 @@ uint32 SsScene3010DeadBoltButton::handleMessage(int messageNum, const MessagePar _soundResource3.play(); _surface->setVisible(true); _buttonLocked = true; - _parentScene->sendMessage(0x2000, _buttonIndex, this); + sendMessage(_parentScene, 0x2000, _buttonIndex); } else { - _parentScene->sendMessage(0x2002, _buttonIndex, this); + sendMessage(_parentScene, 0x2002, _buttonIndex); } _needRefresh = true; StaticSprite::update(); @@ -1418,7 +1418,7 @@ void AsScene3010DeadBolt::unlock(bool skipAnim) { void AsScene3010DeadBolt::stIdleMessage() { setFileHash1(); SetMessageHandler(&Sprite::handleMessage); - _parentScene->sendMessage(0x2001, _boltIndex, this); + sendMessage(_parentScene, 0x2001, _boltIndex); } void AsScene3010DeadBolt::lock() { @@ -1454,7 +1454,7 @@ void AsScene3010DeadBolt::stDisabled() { void AsScene3010DeadBolt::stDisabledMessage() { _surface->setVisible(false); - _parentScene->sendMessage(0x2003, _boltIndex, this); + sendMessage(_parentScene, 0x2003, _boltIndex); } Scene3010::Scene3010(NeverhoodEngine *vm, Module *parentModule, int which) @@ -1513,7 +1513,7 @@ void Scene3010::update() { _checkUnlocked = false; } if (_countdown != 0 && (--_countdown == 0)) { - _parentModule->sendMessage(0x1009, _doorUnlocked ? 1 : 0, this); + sendMessage(_parentModule, 0x1009, _doorUnlocked ? 1 : 0); } } @@ -1646,7 +1646,7 @@ uint32 SsScene3011Button::handleMessage(int messageNum, const MessageParam ¶ if (_countdown == 0) { _surface->setVisible(true); _countdown = 4; - _parentScene->sendMessage(0x2000, 0, this); + sendMessage(_parentScene, 0x2000, 0); _soundResource.play(); } messageResult = 1; @@ -1797,7 +1797,7 @@ uint32 Scene3011::handleMessage(int messageNum, const MessageParam ¶m, Entit switch (messageNum) { case 0x0001: if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } break; case 0x2000: diff --git a/engines/neverhood/navigationscene.cpp b/engines/neverhood/navigationscene.cpp index 7bc1551250..6b36571252 100644 --- a/engines/neverhood/navigationscene.cpp +++ b/engines/neverhood/navigationscene.cpp @@ -55,7 +55,7 @@ NavigationScene::NavigationScene(NeverhoodEngine *vm, Module *parentModule, uint _vm->_screen->clear(); - _parentModule->sendMessage(0x100A, _navigationIndex, this); + sendMessage(_parentModule, 0x100A, _navigationIndex); } @@ -68,7 +68,7 @@ int NavigationScene::getNavigationAreaType() { NPoint mousePos; mousePos.x = _mouseCursor->getX(); mousePos.y = _mouseCursor->getY(); - return _mouseCursor->sendPointMessage(0x2064, mousePos, this); + return sendPointMessage(_mouseCursor, 0x2064, mousePos); } void NavigationScene::update() { @@ -80,7 +80,7 @@ void NavigationScene::update() { _smackerFileHash = 0; } else if (_smackerDone) { if (_done) { - _parentModule->sendMessage(0x1009, _navigationIndex, this); + sendMessage(_parentModule, 0x1009, _navigationIndex); } else { const NavigationItem &navigationItem = (*_navigationList)[_navigationIndex]; createMouseCursor(); @@ -93,7 +93,7 @@ void NavigationScene::update() { _smackerDone = false; _smackerPlayer->open(navigationItem.fileHash, true); _vm->_screen->clear(); - _parentModule->sendMessage(0x100A, _navigationIndex, this); + sendMessage(_parentModule, 0x100A, _navigationIndex); } } Scene::update(); @@ -103,7 +103,7 @@ uint32 NavigationScene::handleMessage(int messageNum, const MessageParam ¶m, switch (messageNum) { case 0x0000: if (_interactive) - _mouseCursor->sendMessage(0x4002, param, this); + sendMessage(_mouseCursor, 0x4002, param); break; case 0x0001: if (_interactive) @@ -144,7 +144,7 @@ void NavigationScene::createMouseCursor() { } _mouseCursor = addSprite(new NavigationMouse(_vm, mouseCursorFileHash, areaType)); - _mouseCursor->sendPointMessage(0x4002, _vm->getMousePos(), this); + sendPointMessage(_mouseCursor, 0x4002, _vm->getMousePos()); } @@ -153,7 +153,7 @@ void NavigationScene::handleNavigation(const NPoint &mousePos) { const NavigationItem &navigationItem = (*_navigationList)[_navigationIndex]; bool oldSoundFlag1 = _soundFlag1; bool oldSoundFlag2 = _soundFlag2; - uint32 direction = _mouseCursor->sendPointMessage(0x2064, mousePos, this); + uint32 direction = sendPointMessage(_mouseCursor, 0x2064, mousePos); switch (direction) { // TODO: Merge cases 0 and 1? @@ -170,7 +170,7 @@ void NavigationScene::handleNavigation(const NPoint &mousePos) { } while (!(*_navigationList)[_navigationIndex].interactive); setGlobalVar(0x4200189E, _navigationIndex); } else { - _parentModule->sendMessage(0x1009, _navigationIndex, this); + sendMessage(_parentModule, 0x1009, _navigationIndex); } break; case 1: @@ -186,14 +186,14 @@ void NavigationScene::handleNavigation(const NPoint &mousePos) { } while (!(*_navigationList)[_navigationIndex].interactive); setGlobalVar(0x4200189E, _navigationIndex); } else { - _parentModule->sendMessage(0x1009, _navigationIndex, this); + sendMessage(_parentModule, 0x1009, _navigationIndex); } break; case 2: case 3: case 4: if (navigationItem.middleFlag) { - _parentModule->sendMessage(0x1009, _navigationIndex, this); + sendMessage(_parentModule, 0x1009, _navigationIndex); } else if (navigationItem.middleSmackerFileHash != 0) { _smackerFileHash = navigationItem.middleSmackerFileHash; _interactive = false; diff --git a/engines/neverhood/scene.cpp b/engines/neverhood/scene.cpp index 8192216432..c6f9f127fb 100644 --- a/engines/neverhood/scene.cpp +++ b/engines/neverhood/scene.cpp @@ -178,6 +178,18 @@ Background *Scene::addBackground(Background *background) { return background; } +void Scene::setBackground(uint32 fileHash, bool dirtyBackground) { + _background = addBackground(new DirtyBackground(_vm, fileHash, 0, 0)); +} + +void Scene::changeBackground(uint32 fileHash) { + _background->load(fileHash); +} + +Sprite *Scene::insertStaticSprite(uint32 fileHash, int surfacePriority) { + return addSprite(new StaticSprite(_vm, fileHash, surfacePriority)); +} + SmackerPlayer *Scene::addSmackerPlayer(SmackerPlayer *smackerPlayer) { addEntity(smackerPlayer); addSurface(smackerPlayer->getSurface()); @@ -202,12 +214,12 @@ void Scene::update() { if (_klayman) { // TODO: Merge later if (_klayman->hasMessageHandler() && - _klayman->sendMessage(0x1008, 0, this) != 0 && + sendMessage(_klayman, 0x1008, 0) != 0 && _messageListFlag && queryPositionSprite(_mouseClickPos.x, _mouseClickPos.y)) { _mouseClicked = false; } else if (_klayman->hasMessageHandler() && - _klayman->sendMessage(0x1008, 0, this) != 0 && + sendMessage(_klayman, 0x1008, 0) != 0 && _messageListFlag) { _mouseClicked = !queryPositionRectList(_mouseClickPos.x, _mouseClickPos.y); } @@ -230,7 +242,7 @@ uint32 Scene::handleMessage(int messageNum, const MessageParam ¶m, Entity *s switch (messageNum) { case 0: // mouse moved if (_mouseCursor && _mouseCursor->hasMessageHandler()) - _mouseCursor->sendMessage(0x4002, param, this); + sendMessage(_mouseCursor, 0x4002, param); // TODO queryPositionSomeRects(param.asPoint().x, param.asPoint().y); break; case 1: // mouse clicked @@ -253,13 +265,13 @@ uint32 Scene::handleMessage(int messageNum, const MessageParam ¶m, Entity *s #endif break; case 6: - _parentModule->sendMessage(0x1009, param, this); + sendMessage(_parentModule, 0x1009, param); break; case 0x1006: if (_messageListFlag1) { _messageListFlag1 = false; if (_messageListIndex == _messageListCount) - _klayman->sendMessage(0x4004, 0, this); + sendMessage(_klayman, 0x4004, 0); else { runMessageList(); } @@ -269,7 +281,7 @@ uint32 Scene::handleMessage(int messageNum, const MessageParam ¶m, Entity *s if (_messageListFlag1) { _messageListFlag1 = false; _messageList = NULL; - _klayman->sendMessage(0x4004, 0, this); + sendMessage(_klayman, 0x4004, 0); } break; case 0x101D: @@ -281,7 +293,7 @@ uint32 Scene::handleMessage(int messageNum, const MessageParam ¶m, Entity *s case 0x101E: if (_prevVisible && _mouseCursor) { _mouseCursor->getSurface()->setVisible(false); - // TODO _mouseCursor->sendMessage(0x4002, g_Screen->_mousePos, this); + // TODO sendMessage(_mouseCursor, 0x4002, g_Screen->_mousePos); } break; case 0x1022: @@ -322,7 +334,7 @@ bool Scene::queryPositionSprite(int16 mouseX, int16 mouseY) { for (uint i = 0; i < _vm->_collisionMan->getSpriteCount(); i++) { Sprite *sprite = _vm->_collisionMan->getSprite(i); if (sprite->hasMessageHandler() && sprite->isPointInside(mouseX, mouseY) && - sprite->sendPointMessage(0x1011, _mouseClickPos, this) != 0) { + sendPointMessage(sprite, 0x1011, _mouseClickPos) != 0) { return true; } } @@ -369,7 +381,7 @@ void Scene::setMessageList(MessageList *messageList, bool messageListFlag, bool _messageListFlag = messageListFlag; _systemCallbackFlag = systemCallbackFlag; _messageListStatus = 1; - _klayman->sendMessage(0x101C, 0, this); + sendMessage(_klayman, 0x101C, 0); // DEBUG: Show message list for (uint i = 0; i < messageList->size(); i++) { @@ -397,7 +409,7 @@ bool Scene::setMessageList2(MessageList *messageList, bool messageListFlag, bool if (_messageListStatus == 1) { if (messageList != _messageList2) { if (_messageValue >= 0) { - _parentModule->sendMessage(0x1023, _messageValue, this); + sendMessage(_parentModule, 0x1023, _messageValue); _messageValue = -1; } _messageList2 = messageList; @@ -407,7 +419,7 @@ bool Scene::setMessageList2(MessageList *messageList, bool messageListFlag, bool } else if (_messageListStatus == 2) { if (messageList == _messageList2) { if (_messageValue >= 0) { - _parentModule->sendMessage(0x1023, _messageValue, this); + sendMessage(_parentModule, 0x1023, _messageValue); _messageValue = -1; } _messageList2 = messageList; @@ -416,7 +428,7 @@ bool Scene::setMessageList2(MessageList *messageList, bool messageListFlag, bool } } else { if (_messageValue >= 0) { - _parentModule->sendMessage(0x1023, _messageValue, this); + sendMessage(_parentModule, 0x1023, _messageValue); _messageValue = -1; } _messageList2 = messageList; @@ -449,22 +461,22 @@ void Scene::runMessageList() { _messageListIndex++; if (_messageListIndex == _messageListCount) { - _klayman->sendMessage(0x1021, 0, this); + sendMessage(_klayman, 0x1021, 0); } if (_systemCallbackFlag) { messageNum = convertMessageNum(messageNum); } if (messageNum != 0x4003) { if (messageNum == 0x1009 || messageNum == 0x1024) { - _parentModule->sendMessage(messageNum, messageParam, this); + sendMessage(_parentModule, messageNum, messageParam); } else if (messageNum == 0x100A) { _messageValue = messageParam; - _parentModule->sendMessage(messageNum, messageParam, this); + sendMessage(_parentModule, messageNum, messageParam); } else if (messageNum == 0x4001) { _messageListFlag1 = true; - _klayman->sendPointMessage(0x4001, _mouseClickPos, this); + sendPointMessage(_klayman, 0x4001, _mouseClickPos); } else if (messageNum == 0x100D) { - if (this->hasMessageHandler() && this->sendMessage(0x100D, messageParam, this) != 0) + if (this->hasMessageHandler() && sendMessage(this, 0x100D, messageParam) != 0) continue; } else if (messageNum == 0x101A) { _messageListStatus = 0; @@ -473,13 +485,13 @@ void Scene::runMessageList() { } else if (messageNum == 0x1020) { _messageListFlag = false; } else if (messageNum >= 0x2000 && messageNum <= 0x2FFF) { - if (this->hasMessageHandler() && this->sendMessage(messageNum, messageParam, this) != 0) { + if (this->hasMessageHandler() && sendMessage(this, messageNum, messageParam) != 0) { _messageListFlag2 = false; return; } } else { _messageListFlag1 = true; - if (_klayman->hasMessageHandler() && _klayman->sendMessage(messageNum, messageParam, this) != 0) { + if (_klayman->hasMessageHandler() && sendMessage(_klayman, messageNum, messageParam) != 0) { _messageListFlag1 = false; } } @@ -499,7 +511,7 @@ void Scene::messageList402220() { _messageListFlag1 = false; _messageList = NULL; _messageListFlag = true; - _klayman->sendMessage(0x4004, 0, this); + sendMessage(_klayman, 0x4004, 0); } void Scene::setRectList(uint32 id) { diff --git a/engines/neverhood/scene.h b/engines/neverhood/scene.h index e3ed273d42..067e86f5fc 100644 --- a/engines/neverhood/scene.h +++ b/engines/neverhood/scene.h @@ -37,6 +37,8 @@ namespace Neverhood { +#define InsertKlayman(KlaymanClass, X, Y, InitArgs) _klayman = new KlaymanClass(_vm, this, X, Y); ((KlaymanClass*)_klayman)->init InitArgs; addSprite(_klayman) + class Scene : public Entity { public: Scene(NeverhoodEngine *vm, Module *parentModule, bool clearHitRects); @@ -50,6 +52,9 @@ public: void setSurfacePriority(BaseSurface *surface, int priority); void deleteSprite(Sprite **sprite); Background *addBackground(Background *background); + void setBackground(uint32 fileHash, bool dirtyBackground = true); + void changeBackground(uint32 fileHash); + Sprite *insertStaticSprite(uint32 fileHash, int surfacePriority); SmackerPlayer *addSmackerPlayer(SmackerPlayer *smackerPlayer); void update(); protected: diff --git a/engines/neverhood/smackerplayer.cpp b/engines/neverhood/smackerplayer.cpp index 0ebec5ee9f..9ae7e14eed 100644 --- a/engines/neverhood/smackerplayer.cpp +++ b/engines/neverhood/smackerplayer.cpp @@ -176,7 +176,7 @@ void SmackerPlayer::update() { if (_smackerDecoder->endOfVideo() && !_keepLastFrame) { // Inform the scene about the end of the video playback if (_scene) { - _scene->sendMessage(0x3002, 0, this); + sendMessage(_scene, 0x3002, 0); } _flag2 = true; } else { @@ -194,7 +194,7 @@ void SmackerPlayer::update() { } else if (!_keepLastFrame) { // Inform the scene about the end of the video playback if (_scene) { - _scene->sendMessage(0x3002, 0, this); + sendMessage(_scene, 0x3002, 0); } _flag2 = true; } else { diff --git a/engines/neverhood/smackerscene.cpp b/engines/neverhood/smackerscene.cpp index ace77f9284..ae290631a9 100644 --- a/engines/neverhood/smackerscene.cpp +++ b/engines/neverhood/smackerscene.cpp @@ -73,7 +73,7 @@ void SmackerScene::nextVideo() { uint32 smackerFileHash = _fileHashList[_fileHashListIndex]; if (_vm->_res->getResourceTypeByHash(smackerFileHash) != 10) { // Not a Smacker file - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); return; } _fieldDF = getSubVar(0x00800410, smackerFileHash); @@ -89,7 +89,7 @@ void SmackerScene::nextVideo() { _smackerPlayer->open(smackerFileHash, false); } } else { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } } @@ -111,7 +111,7 @@ uint32 SmackerScene::handleMessage(int messageNum, const MessageParam ¶m, En break; case 0x000C: if (_canAbort) { - _parentModule->sendMessage(0x1009, 0, this); + sendMessage(_parentModule, 0x1009, 0); } break; case 0x3002: diff --git a/engines/neverhood/sprite.cpp b/engines/neverhood/sprite.cpp index deb54af8e1..828c0dd08e 100644 --- a/engines/neverhood/sprite.cpp +++ b/engines/neverhood/sprite.cpp @@ -392,7 +392,7 @@ void AnimatedSprite::updateFrameIndex() { } else { // Inform self about end of current animation // The caller can then e.g. set a new animation fileHash - sendMessage(0x3002, 0, this); + sendMessage(this, 0x3002, 0); if (_fileHash1 == 0) _frameIndex = 0; } @@ -400,7 +400,7 @@ void AnimatedSprite::updateFrameIndex() { if (_frameIndex > 0) { _frameIndex--; } else { - sendMessage(0x3002, 0, this); + sendMessage(this, 0x3002, 0); if (_fileHash1 == 0) _frameIndex = _frameIndex2; } @@ -424,7 +424,7 @@ void AnimatedSprite::updateFrameInfo() { _needRefresh = true; if (frameInfo.frameHash != 0) { - sendMessage(0x100D, frameInfo.frameHash, this); + sendMessage(this, 0x100D, frameInfo.frameHash); } } |