diff options
author | johndoe123 | 2011-09-24 20:37:14 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:39:41 +0200 |
commit | 2275141d56a66b8a6262fb2c160cce34c46af119 (patch) | |
tree | e421e3d8b04521093e37f1e973080ea5f3acf7de /engines | |
parent | af2820fd23d152c7fddf77872198a07df680b46d (diff) | |
download | scummvm-rg350-2275141d56a66b8a6262fb2c160cce34c46af119.tar.gz scummvm-rg350-2275141d56a66b8a6262fb2c160cce34c46af119.tar.bz2 scummvm-rg350-2275141d56a66b8a6262fb2c160cce34c46af119.zip |
NEVERHOOD: Add Scene1609
- Use Scene::insertSprite<> in all scenes
Diffstat (limited to 'engines')
-rw-r--r-- | engines/neverhood/gamemodule.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module1200.cpp | 34 | ||||
-rw-r--r-- | engines/neverhood/module1200.h | 2 | ||||
-rw-r--r-- | engines/neverhood/module1300.cpp | 60 | ||||
-rw-r--r-- | engines/neverhood/module1400.cpp | 58 | ||||
-rw-r--r-- | engines/neverhood/module1400.h | 8 | ||||
-rw-r--r-- | engines/neverhood/module1600.cpp | 107 | ||||
-rw-r--r-- | engines/neverhood/module1600.h | 19 | ||||
-rw-r--r-- | engines/neverhood/module1700.cpp | 8 | ||||
-rw-r--r-- | engines/neverhood/module2200.cpp | 72 | ||||
-rw-r--r-- | engines/neverhood/module3000.cpp | 50 | ||||
-rw-r--r-- | engines/neverhood/module3000.h | 2 |
12 files changed, 260 insertions, 162 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 854a5cc1fe..960e732ded 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -276,7 +276,7 @@ void GameModule::startup() { createModule(1000, -1); #endif #if 1 - _vm->gameState().sceneNum = 7; + _vm->gameState().sceneNum = 8; _vm->gameState().which = 1; createModule(1600, -1); #endif diff --git a/engines/neverhood/module1200.cpp b/engines/neverhood/module1200.cpp index 83a9b5ccd9..ffb4f206ca 100644 --- a/engines/neverhood/module1200.cpp +++ b/engines/neverhood/module1200.cpp @@ -766,7 +766,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) insertMouse433(0x9A2C0409); - _asTape = addSprite(new AsScene1201Tape(_vm, this, 3, 1100, 243, 340, 0x9148A011)); + _asTape = insertSprite<AsScene1201Tape>(this, 3, 1100, 243, 340, 0x9148A011); _vm->_collisionMan->addSprite(_asTape); tempSprite = insertStaticSprite(0x03C82530, 100); @@ -781,7 +781,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) tempSprite = insertStaticSprite(0x04063110, 500); topY4 = tempSprite->getY() + 1; - _class466 = addSprite(new Class466(_vm, getGlobalVar(0x000CF819) && which != 1)); + _class466 = insertSprite<Class466>(getGlobalVar(0x000CF819) && which != 1); _class466->setClipRect(0, topY4, 640, 480); insertStaticSprite(0x400B04B0, 1200); @@ -792,7 +792,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) tempSprite = insertStaticSprite(0xA29223FA, 1200); x2 = tempSprite->getX() + tempSprite->getDrawRect().width; - class464 = addSprite(new Class464(_vm)); + class464 = insertSprite<Class464>(); debug("Scene1201: which = %d", which); @@ -833,20 +833,18 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) } else { setBackground(0x40206EC5); setPalette(0x40206EC5); - _asRightDoor = addSprite(new AsScene1201RightDoor(_vm, _klayman, which == 2)); + _asRightDoor = insertSprite<AsScene1201RightDoor>(_klayman, which == 2); } if (getGlobalVar(0x000CF819)) { insertStaticSprite(0x10002ED8, 500); if (!getGlobalVar(0x0A18CA33)) { - AsScene1201TntMan *asTntMan; - asTntMan = new AsScene1201TntMan(_vm, this, _class466, which == 1); - asTntMan->setClipRect(x1, 0, x2, 480); - _vm->_collisionMan->addSprite(asTntMan); - _asTntMan = addSprite(asTntMan); - tempSprite = addSprite(new Class465(_vm, _asTntMan)); + _asTntMan = insertSprite<AsScene1201TntMan>(this, _class466, which == 1); + _asTntMan->setClipRect(x1, 0, x2, 480); + _asTntMan->setRepl(64, 0); + _vm->_collisionMan->addSprite(_asTntMan); + tempSprite = insertSprite<Class465>(_asTntMan); tempSprite->setClipRect(x1, 0, x2, 480); - asTntMan->setRepl(64, 0); } uint32 tntIndex = 1; @@ -859,7 +857,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) clipY2 = topY2; else clipY2 = topY3; - addSprite(new SsScene1201Tnt(_vm, tntIndex, getSubVar(0x10055D14, tntIndex), clipY2)); + insertSprite<SsScene1201Tnt>(tntIndex, getSubVar(0x10055D14, tntIndex), clipY2); elemIndex = getSubVar(0x10055D14, tntIndex + 1); if (kScene1201PointArray[elemIndex].y < 175) clipY2 = topY1; @@ -867,7 +865,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) clipY2 = topY2; else clipY2 = topY3; - addSprite(new SsScene1201Tnt(_vm, tntIndex + 1, getSubVar(0x10055D14, tntIndex + 1), clipY2)); + insertSprite<SsScene1201Tnt>(tntIndex + 1, getSubVar(0x10055D14, tntIndex + 1), clipY2); tntIndex += 3; } @@ -895,7 +893,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) else clipY2 = topY3; } - addSprite(new SsScene1201Tnt(_vm, tntIndex, getSubVar(0x10055D14, tntIndex), clipY2)); + insertSprite<SsScene1201Tnt>(tntIndex, getSubVar(0x10055D14, tntIndex), clipY2); tntIndex++; } @@ -909,7 +907,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) tempSprite = insertStaticSprite(0x63D400BC, 900); - _asLeftDoor = addSprite(new AsScene1201LeftDoor(_vm, _klayman)); + _asLeftDoor = insertSprite<AsScene1201LeftDoor>(_klayman); _asLeftDoor->setClipRect(x1, tempSprite->getDrawRect().y, tempSprite->getDrawRect().x2(), 480); if (getGlobalVar(0x0A310817) && ! getGlobalVar(0x0112090A)) { @@ -919,12 +917,12 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) _asMatch = NULL; if (getGlobalVar(0x0112090A) < 3) { - _asMatch = addSprite(new AsScene1201Match(_vm, this)); + _asMatch = insertSprite<AsScene1201Match>(this); _vm->_collisionMan->addSprite(_asMatch); } if (getGlobalVar(0x0A310817) && !getGlobalVar(0x0A18CA33)) { - _asCreature = addSprite(new AsScene1201Creature(_vm, this, _klayman)); + _asCreature = insertSprite<AsScene1201Creature>(this, _klayman); _asCreature->setClipRect(x1, 0, x2, 480); } @@ -1131,7 +1129,7 @@ Scene1202::Scene1202(NeverhoodEngine *vm, Module *parentModule, int which) insertMouse435(0x10ED160A, 20, 620); for (int i = 0; i < 18; i++) { - _asTntItems[i] = addSprite(new AsScene1202TntItem(_vm, this, i)); + _asTntItems[i] = insertSprite<AsScene1202TntItem>(this, i); _vm->_collisionMan->addSprite(_asTntItems[i]); } diff --git a/engines/neverhood/module1200.h b/engines/neverhood/module1200.h index a34bd958e6..dc8e903472 100644 --- a/engines/neverhood/module1200.h +++ b/engines/neverhood/module1200.h @@ -179,7 +179,7 @@ protected: // TODO ResourceTable _resourceTable1; // TODO ResourceTable _resourceTable2; Sprite *_asMatch; - Sprite *_asTntMan; + AsScene1201TntMan *_asTntMan; Sprite *_asCreature; Sprite *_class466; Sprite *_asLeftDoor; diff --git a/engines/neverhood/module1300.cpp b/engines/neverhood/module1300.cpp index 75a185b96c..26b61f0e52 100644 --- a/engines/neverhood/module1300.cpp +++ b/engines/neverhood/module1300.cpp @@ -424,20 +424,20 @@ Scene1302::Scene1302(NeverhoodEngine *vm, Module *parentModule, int which) setPalette(0x420643C4); insertMouse433(0x643C0428); - _class595 = addSprite(new Class595(_vm, this)); + _class595 = insertSprite<Class595>(this); _sprite1 = insertStaticSprite(0x942FC224, 300); _sprite2 = insertStaticSprite(0x70430830, 1200); _sprite2->setVisible(false); _sprite3 = insertStaticSprite(0x16E01E20, 1100); - _asRing1 = addSprite(new AsScene1002Ring(_vm, this, false, 218, 122, _class595->getDrawRect().y, false)); - _asRing2 = addSprite(new AsScene1002Ring(_vm, this, true, 218 + 32, 132, _class595->getDrawRect().y, getGlobalVar(0x13206309))); - _asRing3 = addSprite(new AsScene1002Ring(_vm, this, false, 218 + 32 + 32, 122, _class595->getDrawRect().y, false)); - _asRing4 = addSprite(new AsScene1002Ring(_vm, this, true, 218 + 32 + 32 + 32, 132, _class595->getDrawRect().y, getGlobalVar(0x80101B1E))); - _asRing5 = addSprite(new AsScene1002Ring(_vm, this, false, 218 + 32 + 32 + 32 + 32, 115, _class595->getDrawRect().y, false)); + _asRing1 = insertSprite<AsScene1002Ring>(this, false, 218, 122, _class595->getDrawRect().y, false); + _asRing2 = insertSprite<AsScene1002Ring>(this, true, 218 + 32, 132, _class595->getDrawRect().y, getGlobalVar(0x13206309)); + _asRing3 = insertSprite<AsScene1002Ring>(this, false, 218 + 32 + 32, 122, _class595->getDrawRect().y, false); + _asRing4 = insertSprite<AsScene1002Ring>(this, true, 218 + 32 + 32 + 32, 132, _class595->getDrawRect().y, getGlobalVar(0x80101B1E)); + _asRing5 = insertSprite<AsScene1002Ring>(this, false, 218 + 32 + 32 + 32 + 32, 115, _class595->getDrawRect().y, false); - _asBridge = addSprite(new AsScene1302Bridge(_vm, this)); - _ssFence = addSprite(new SsScene1302Fence(_vm)); + _asBridge = insertSprite<AsScene1302Bridge>(this); + _ssFence = insertSprite<SsScene1302Fence>(); _ssFence->setClipRect(0, 0, 640, _sprite1->getDrawRect().y2()); if (which < 0) { @@ -450,7 +450,7 @@ Scene1302::Scene1302(NeverhoodEngine *vm, Module *parentModule, int which) _klayman->setClipRect(0, 0, _sprite3->getDrawRect().x2(), 480); - _asVenusFlyTrap = addSprite(new AsScene1002VenusFlyTrap(_vm, this, _klayman, true)); + _asVenusFlyTrap = insertSprite<AsScene1002VenusFlyTrap>(this, _klayman, true); _vm->_collisionMan->addSprite(_asVenusFlyTrap); sendEntityMessage(_klayman, 0x2007, _asVenusFlyTrap); @@ -643,7 +643,7 @@ Scene1303::Scene1303(NeverhoodEngine *vm, Module *parentModule, int which) insertMouse433(0x81A9801D); if (!getGlobalVar(0xAC00C0D0)) { - _asBalloon = addSprite(new AsScene1303Balloon(_vm, this)); + _asBalloon = insertSprite<AsScene1303Balloon>(this); _vm->_collisionMan->addSprite(_asBalloon); } @@ -711,15 +711,15 @@ Scene1304::Scene1304(NeverhoodEngine *vm, Module *parentModule, int which) insertMouse433(0xC021006A); if (getGlobalVar(0xAC00C0D0)) { - _class545 = addSprite(new Class545(_vm, this, 0, 1100, 278, 347)); + _class545 = insertSprite<Class545>(this, 0, 1100, 278, 347); _vm->_collisionMan->addSprite(_class545); } else { - _class545 = addSprite(new AnimatedSprite(_vm, 0x80106018, 100, 279, 48)); + _class545 = insertSprite<AnimatedSprite>(0x80106018, 100, 279, 48); // TODO _class545->setUpdateDeltaXY(); } if (!getGlobalVar(0x31C63C51)) { - _class544 = addSprite(new Class544(_vm, this, 1100, 278, 347)); + _class544 = insertSprite<Class544>(this, 1100, 278, 347); _vm->_collisionMan->addSprite(_class544); } else { _class544 = NULL; @@ -893,20 +893,19 @@ Scene1306::Scene1306(NeverhoodEngine *vm, Module *parentModule, int which) insertMouse433(0x0311005B); if (!getGlobalVar(0x13382860)) { - _class545 = addSprite(new Class545(_vm, this, 2, 1100, 435, 445)); + _class545 = insertSprite<Class545>(this, 2, 1100, 435, 445); _vm->_collisionMan->addSprite(_class545); } - _ssButton = addSprite(new SsCommonButtonSprite(_vm, this, 0x404A36A0, 100, 0x440C1000)); + _ssButton = insertSprite<SsCommonButtonSprite>(this, 0x404A36A0, 100, 0x440C1000); - _asTape = addSprite(new AsScene1201Tape(_vm, this, 19, 1100, 359, 445, 0x9148A011)); + _asTape = insertSprite<AsScene1201Tape>(this, 19, 1100, 359, 445, 0x9148A011); - _asElevatorDoor = new AnimatedSprite(_vm, 0x043B0270, 90, 320, 240); + _asElevatorDoor = insertSprite<AnimatedSprite>(0x043B0270, 90, 320, 240); _asElevatorDoor->setFileHash(0x043B0270, 6, -1); _asElevatorDoor->setNewHashListIndex(6); - addSprite(_asElevatorDoor); - _asElevator = addSprite(new AsScene1306Elevator(_vm, this, _asElevatorDoor)); + _asElevator = insertSprite<AsScene1306Elevator>(this, _asElevatorDoor); _sprite1 = insertStaticSprite(0x036A1EE0, 80); @@ -1309,7 +1308,7 @@ Scene1307::Scene1307(NeverhoodEngine *vm, Module *parentModule, int which) for (uint keyIndex = 0; keyIndex < 3; keyIndex++) { if (getSubVar(0x08D0AB11, keyIndex)) { - _asKeys[keyIndex] = addSprite(new AsScene1307Key(_vm, this, keyIndex, _clipRects)); + _asKeys[keyIndex] = insertSprite<AsScene1307Key>(this, keyIndex, _clipRects); _vm->_collisionMan->addSprite(_asKeys[keyIndex]); } else { _asKeys[keyIndex] = NULL; @@ -1600,21 +1599,21 @@ Scene1308::Scene1308(NeverhoodEngine *vm, Module *parentModule, int which) setPalette(0x41024202); insertMouse433(0x24206418); - _asTape = addSprite(new AsScene1201Tape(_vm, this, 17, 1100, 502, 445, 0x9148A011)); + _asTape = insertSprite<AsScene1201Tape>(this, 17, 1100, 502, 445, 0x9148A011); _vm->_collisionMan->addSprite(_asTape); if (getGlobalVar(0x01023818)) { - addSprite(new Class513(_vm)); - addSprite(new AnimatedSprite(_vm, 0x461A1490, 200, 235, 429)); + insertSprite<Class513>(); + insertSprite<AnimatedSprite>(0x461A1490, 200, 235, 429); } _sprite1 = insertStaticSprite(0x0A042060, 1100); - _class549 = addSprite(new Class549(_vm, this)); - _class593 = addSprite(new Class593(_vm, this)); + _class549 = insertSprite<Class549>(this); + _class593 = insertSprite<Class593>(this); - _class601_1 = addSprite(new Class601(_vm, kScene1308FileHashes[getSubVar(0x0C10A000, 1)], 0)); - _class601_2 = addSprite(new Class601(_vm, kScene1308FileHashes[getSubVar(0x0C10A000, 0)], 1)); - _class601_2 = addSprite(new Class601(_vm, kScene1308FileHashes[getSubVar(0x0C10A000, 2)], 2)); + _class601_1 = insertSprite<Class601>(kScene1308FileHashes[getSubVar(0x0C10A000, 1)], 0); + _class601_2 = insertSprite<Class601>(kScene1308FileHashes[getSubVar(0x0C10A000, 0)], 1); + _class601_2 = insertSprite<Class601>(kScene1308FileHashes[getSubVar(0x0C10A000, 2)], 2); _sprite2 = insertStaticSprite(0x40043120, 995); _sprite3 = insertStaticSprite(0x43003100, 995); @@ -1644,7 +1643,7 @@ Scene1308::Scene1308(NeverhoodEngine *vm, Module *parentModule, int which) insertKlayman<KmScene1308>(475, 440); setMessageList(0x004B58B0); if (getGlobalVar(0x80455A41)) { - _sprite5 = addSprite(new Class592(_vm, this)); + _sprite5 = insertSprite<Class592>(this); _sprite4 = insertStaticSprite(0x0101A624, 1100); _sprite4->setVisible(false); } else { @@ -1672,8 +1671,7 @@ Scene1308::Scene1308(NeverhoodEngine *vm, Module *parentModule, int which) } if (getGlobalVar(0x04A105B3) == 4) { - _class489 = new Class489(_vm, this, _klayman, 0); - addSprite(_class489); + _class489 = insertSprite<Class489>(this, _klayman, (Sprite*)NULL); _vm->_collisionMan->addSprite(_class489); _class489->setClipRect(0, 0, 640, _sprite2->getDrawRect().y2()); _class489->setRepl(64, 0); diff --git a/engines/neverhood/module1400.cpp b/engines/neverhood/module1400.cpp index 0045064314..37fb354b54 100644 --- a/engines/neverhood/module1400.cpp +++ b/engines/neverhood/module1400.cpp @@ -667,17 +667,17 @@ Scene1401::Scene1401(NeverhoodEngine *vm, Module *parentModule, int which) setPalette(0x08221FA5); insertMouse433(0x21FA108A); - // TODO _class427 = addSprite(new Class427(_vm, this, 0x980F3124, 0x12192892, 100, 0)); - _class525 = addSprite(new Class525(_vm)); + // TODO _class427 = insertSprite<Class427>(this, 0x980F3124, 0x12192892, 100, 0); + _class525 = insertSprite<Class525>(); if (!getGlobalVar(0x01023818)) { - _class526 = addSprite(new Class526(_vm, _class525)); - _class527 = addSprite(new Class527(_vm, _class525)); + _class526 = insertSprite<Class526>(_class525); + _class527 = insertSprite<Class527>(_class525); } _sprite3 = insertStaticSprite(0xA82BA811, 1100); insertStaticSprite(0x0A116C60, 1100); - _ssButton = addSprite(new SsCommonButtonSprite(_vm, this, 0xB84B1100, 100, 0)); + _ssButton = insertSprite<SsCommonButtonSprite>(this, 0xB84B1100, 100, 0); _sprite1 = insertStaticSprite(0x38EA100C, 1005); _sprite2 = insertStaticSprite(0x98D0223C, 1200); _sprite2->setVisible(false); @@ -701,7 +701,7 @@ Scene1401::Scene1401(NeverhoodEngine *vm, Module *parentModule, int which) } if (getGlobalVar(0x04A105B3) == 2) { - _class489 = addSprite(new Class489(_vm, this, _klayman, _class525)); + _class489 = insertSprite<Class489>(this, _klayman, _class525); _vm->_collisionMan->addSprite(_class489); if (getGlobalVar(0x04A10F33) == 6) { sendEntityMessage(_klayman, 0x1014, _class489); @@ -719,11 +719,11 @@ Scene1401::Scene1401(NeverhoodEngine *vm, Module *parentModule, int which) _klayman->setClipRect(_sprite3->getDrawRect().x, 0, 640, 480); - if (which == 0 && _class489 && _class489->hasMessageHandler()) { + if (which == 0 && _class489) { sendMessage(_class489, 0x482B, 0); } - _class528 = addSprite(new Class528(_vm, _klayman, which == 1)); + _class528 = insertSprite<Class528>(_klayman, which == 1); } @@ -746,7 +746,7 @@ uint32 Scene1401::handleMessage(int messageNum, const MessageParam ¶m, Entit } else if (param.asInteger() == 0x402064D8) { sendEntityMessage(_klayman, 0x1014, _ssButton); } else if (param.asInteger() == 0x01C66840) { - if (_class528->hasMessageHandler() && sendMessage(_class528, 0x2001, 0) != 0) { + if (sendMessage(_class528, 0x2001, 0) != 0) { setMessageList(0x004B6690); } else { setMessageList(0x004B66B0); @@ -882,9 +882,9 @@ Scene1402::Scene1402(NeverhoodEngine *vm, Module *parentModule, int which) _palette->addPalette(0x91D3A391, 0, 64, 0); insertMouse433(0x482F4239); - _class454_1 = addSprite(new Class454(_vm, 0x15402D64, 1100)); - _class454_2 = addSprite(new Class454(_vm, 0x10A02120, 1100)); - _class454_3 = addSprite(new Class454(_vm, 0x60882BE0, 1100)); + _class454_1 = insertSprite<Class454>(0x15402D64, 1100); + _class454_2 = insertSprite<Class454>(0x10A02120, 1100); + _class454_3 = insertSprite<Class454>(0x60882BE0, 1100); if (getGlobalVar(0x70A1189C)) setRectList(0x004B0C48); @@ -895,7 +895,7 @@ Scene1402::Scene1402(NeverhoodEngine *vm, Module *parentModule, int which) insertKlayman<KmScene1402>(377, 391); setMessageList(0x004B0B48); if (!getGlobalVar(0x70A1189C)) { - _class482 = addSprite(new Class482(_vm, this, 0)); + _class482 = insertSprite<Class482>(this, 0); } } else if (which == 1) { insertKlayman<KmScene1402>(42, 391); @@ -905,18 +905,18 @@ Scene1402::Scene1402(NeverhoodEngine *vm, Module *parentModule, int which) setMessageList(0x004B0B60); _klayman->setDoDeltaX(1); if (getGlobalVar(0x70A1189C)) { - _class482 = addSprite(new Class482(_vm, this, 1)); + _class482 = insertSprite<Class482>(this, 1); clearRectList(); showMouse(false); sub428220(); } else { - _class482 = addSprite(new Class482(_vm, this, 0)); + _class482 = insertSprite<Class482>(this, 0); } } else { insertKlayman<KmScene1402>(513, 391); setMessageList(0x004B0B58); if (!getGlobalVar(0x70A1189C)) { - _class482 = addSprite(new Class482(_vm, this, 2)); + _class482 = insertSprite<Class482>(this, 2); sub428220(); } } @@ -926,7 +926,7 @@ Scene1402::Scene1402(NeverhoodEngine *vm, Module *parentModule, int which) } if (getGlobalVar(0x4A105B3) == 1) { - _class489 = addSprite(new Class489(_vm, this, _klayman, 0)); + _class489 = insertSprite<Class489>(this, _klayman, (Sprite*)NULL); _vm->_collisionMan->addSprite(_class489); if (getGlobalVar(0x4A10F33) == 4) { sendEntityMessage(_klayman, 0x1014, _class489); @@ -1268,7 +1268,7 @@ Scene1407::Scene1407(NeverhoodEngine *vm, Module *parentModule, int which) setPalette(0x00442225); insertMouse435(0x4222100C, 20, 620); - _asMouse = addSprite(new AsScene1407Mouse(_vm, this)); + _asMouse = insertSprite<AsScene1407Mouse>(this); _ssResetButton = insertStaticSprite(0x12006600, 100); _ssResetButton->setVisible(false); @@ -1340,13 +1340,11 @@ Scene1403::Scene1403(NeverhoodEngine *vm, Module *parentModule, int which) _class401_3 = insertStaticSprite(0x08742271, 995); - _asTape1 = new AsScene1201Tape(_vm, this, 12, 1100, 201, 468, 0x9148A011); - addSprite(_asTape1); + _asTape1 = insertSprite<AsScene1201Tape>(this, 12, 1100, 201, 468, 0x9148A011); _vm->_collisionMan->addSprite(_asTape1); _asTape1->setRepl(64, 0); - _asTape2 = new AsScene1201Tape(_vm, this, 16, 1100, 498, 468, 0x9048A093); - addSprite(_asTape2); + _asTape2 = insertSprite<AsScene1201Tape>(this, 16, 1100, 498, 468, 0x9048A093); _vm->_collisionMan->addSprite(_asTape2); _asTape2->setRepl(64, 0); @@ -1360,10 +1358,7 @@ Scene1403::Scene1403(NeverhoodEngine *vm, Module *parentModule, int which) _klayman->setRepl(64, 0); if (getGlobalVar(0x04A105B3) == 4) { - Class489 *class489; - class489 = new Class489(_vm, this, _klayman, 0); - _class489 = class489; - addSprite(_class489); + _class489 = insertSprite<Class489>(this, _klayman, (Sprite*)NULL); _vm->_collisionMan->addSprite(_class489); if (getGlobalVar(0x04A10F33) == 4) { sendEntityMessage(_klayman, 0x1014, _class489); @@ -1372,7 +1367,7 @@ Scene1403::Scene1403(NeverhoodEngine *vm, Module *parentModule, int which) setMessageList(0x004B1F70); } _class489->setClipRect(0, 0, 640, _class401_2->getDrawRect().y2()); - class489->setRepl(64, 0); + _class489->setRepl(64, 0); } } @@ -1454,13 +1449,13 @@ Scene1404::Scene1404(NeverhoodEngine *vm, Module *parentModule, int which) insertMouse433(0xB006BAC8); if (getGlobalVar(0x13382860) == 5) { - _class545 = addSprite(new Class545(_vm, this, 2, 1100, 267, 411)); + _class545 = insertSprite<Class545>(this, 2, 1100, 267, 411); _vm->_collisionMan->addSprite(_class545); } _sprite1 = insertStaticSprite(0x1900A1F8, 1100); - _asTape = addSprite(new AsScene1201Tape(_vm, this, 14, 1100, 281, 411, 0x9148A011)); + _asTape = insertSprite<AsScene1201Tape>(this, 14, 1100, 281, 411, 0x9148A011); _vm->_collisionMan->addSprite(_asTape); if (which < 0) { @@ -1483,7 +1478,7 @@ Scene1404::Scene1404(NeverhoodEngine *vm, Module *parentModule, int which) } if (getGlobalVar(0x04A105B3) == 3) { - _class489 = addSprite(new Class489(_vm, this, _klayman, 0)); + _class489 = insertSprite<Class489>(this, _klayman, (Sprite*)NULL); _vm->_collisionMan->addSprite(_class489); if (getGlobalVar(0x04A10F33) == 0) { sendEntityMessage(_klayman, 0x1014, _class489); @@ -1673,8 +1668,7 @@ Scene1405::Scene1405(NeverhoodEngine *vm, Module *parentModule, int which) } for (uint32 index = 0; index < 48; index++) { - _tiles[index] = new AsScene1405Tile(_vm, this, index); - addSprite(_tiles[index]); + _tiles[index] = insertSprite<AsScene1405Tile>(this, index); _vm->_collisionMan->addSprite(_tiles[index]); if (getSubVar(0xCCE0280F, index)) _tilesLeft--; diff --git a/engines/neverhood/module1400.h b/engines/neverhood/module1400.h index 7b4d95761b..d256b82134 100644 --- a/engines/neverhood/module1400.h +++ b/engines/neverhood/module1400.h @@ -143,7 +143,7 @@ public: protected: bool _flag; Sprite *_class427; - Sprite *_class489; + Class489 *_class489; Sprite *_class525; Sprite *_class526; Sprite *_class527; @@ -184,7 +184,7 @@ protected: Sprite *_class454_2; Sprite *_class454_3; Sprite *_class482; - Sprite *_class489; + Class489 *_class489; bool _flag; void update(); uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); @@ -237,7 +237,7 @@ protected: Sprite *_class401_3; AsScene1201Tape *_asTape1; AsScene1201Tape *_asTape2; - Sprite *_class489; + Class489 *_class489; bool _flag; uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; @@ -251,7 +251,7 @@ public: protected: Sprite *_sprite1; Sprite *_asTape; - Sprite *_class489; + Class489 *_class489; Sprite *_class545; uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; diff --git a/engines/neverhood/module1600.cpp b/engines/neverhood/module1600.cpp index a23e7101b4..94b836a26f 100644 --- a/engines/neverhood/module1600.cpp +++ b/engines/neverhood/module1600.cpp @@ -83,7 +83,7 @@ void Module1600::createScene(int sceneNum, int which) { _childObject = new Scene1608(_vm, this, which); break; case 8: -//TODO _childObject = new Scene1609(_vm, this, which); + _childObject = new Scene1609(_vm, this, which); break; case 1001: if (getGlobalVar(0xA0808898) == 1) { @@ -1384,4 +1384,109 @@ uint32 Scene1608::handleMessage44D510(int messageNum, const MessageParam ¶m, return 0; } +Scene1609::Scene1609(NeverhoodEngine *vm, Module *parentModule, int which) + : Scene(vm, parentModule, true), _soundResource(vm), _countdown1(1), + _index1(0), _index3(0), _flag5(true), _flag6(false) { + + // TODO _vm->gameModule()->initScene3011Vars(); + _index2 = getGlobalVar(0x2414C2F2); + + _surfaceFlag = true; + SetMessageHandler(&Scene1609::handleMessage); + SetUpdateHandler(&Scene1609::update); + + setBackground(0x92124A14); + setPalette(0x92124A14); + + for (int i = 0; i < 12; i++) + _asSymbols[i] = insertSprite<AsScene3011Symbol>(i, false); + + _ssButton = insertSprite<SsScene3011Button>(this, true); + _vm->_collisionMan->addSprite(_ssButton); + + insertMouse435(0x24A10929, 20, 620); + + _soundResource.load(0x68E25540); + +} + +void Scene1609::update() { + if (!_flag6 && _countdown1 != 0 && (--_countdown1 == 0)) { + if (_flag5) { + _index1++; + if (_index1 >= 12) + _index1 = 0; + _asSymbols[_index3]->change(_index1 + 12, _index1 == (int)getSubVar(0x04909A50, _index2)); + _flag5 = false; + _countdown1 = 36; + } else { + _asSymbols[_index3]->hide(); + _flag5 = true; + _countdown1 = 12; + } + } + if (_flag6 && !_soundResource.isPlaying()) { + leaveScene(1); + } + Scene::update(); +} + +uint32 Scene1609::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + Scene::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x0001: + // TODO: Debug stuff + if (param.asPoint().x <= 20 || param.asPoint().x >= 620) + leaveScene(0); + break; + // TODO: Debug stuff + case 0x2000: + if (!_flag6) { + if (_flag5) + _asSymbols[_index3]->change(_index1 + 12, false); + _asSymbols[_index3]->stopSound(); + _index3++; + if (_index3 >= 12) { + if (testVars()) { + _soundResource.play(); + setGlobalVar(0x2C531AF8, 1); + _flag6 = true; + } else { + _index3 = 0; + for (int i = 0; i < 12; i++) + _asSymbols[i]->hide(); + } + } + _flag5 = true; + _countdown1 = 1; + } + break; + } + return 0; +} + +bool Scene1609::testVars() { + int index1 = 0; + do { + int cmpIndex = _asSymbols[0]->getIndex(); + if (!_asSymbols[0]->getFlag1()) + cmpIndex -= 12; + if ((int)getSubVar(0x04909A50, index1) == cmpIndex) + break; + index1++; + } while(1); + for (int index2 = 0; index2 < 12; index2++) { + int cmpIndex = _asSymbols[index2]->getIndex(); + if (!_asSymbols[index2]->getFlag1()) + cmpIndex -= 12; + if ((int)getSubVar(0x04909A50, index1) != cmpIndex) + return false; + _index1++; + if (_index1 >= 12) + _index1 = 0; + _index2++; + } + return true; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/module1600.h b/engines/neverhood/module1600.h index 9af1a19b39..1096377938 100644 --- a/engines/neverhood/module1600.h +++ b/engines/neverhood/module1600.h @@ -26,6 +26,7 @@ #include "neverhood/neverhood.h" #include "neverhood/module.h" #include "neverhood/scene.h" +#include "neverhood/module3000.h" namespace Neverhood { @@ -171,6 +172,24 @@ protected: uint32 handleMessage44D510(int messageNum, const MessageParam ¶m, Entity *sender); }; +class Scene1609 : public Scene { +public: + Scene1609(NeverhoodEngine *vm, Module *parentModule, int which); +protected: + SoundResource _soundResource; + Sprite *_ssButton; + AsScene3011Symbol *_asSymbols[12]; + int _index1; + int _index2; + int _index3; + int _countdown1; + bool _flag5; + bool _flag6; + void update(); + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); + bool testVars(); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULE1600_H */ diff --git a/engines/neverhood/module1700.cpp b/engines/neverhood/module1700.cpp index 4426a7eb76..ae7a7fdc7a 100644 --- a/engines/neverhood/module1700.cpp +++ b/engines/neverhood/module1700.cpp @@ -195,13 +195,13 @@ Scene1705::Scene1705(NeverhoodEngine *vm, Module *parentModule, int which) insertMouse433(0x18222039); - addSprite(new Class602(_vm, kScene1705FileHashes[getSubVar(0x0A4C0A9A, 0)], 0)); - addSprite(new Class602(_vm, kScene1705FileHashes[getSubVar(0x0A4C0A9A, 1)], 1)); - addSprite(new Class602(_vm, kScene1705FileHashes[getSubVar(0x0A4C0A9A, 2)], 2)); + insertSprite<Class602>(kScene1705FileHashes[getSubVar(0x0A4C0A9A, 0)], 0); + insertSprite<Class602>(kScene1705FileHashes[getSubVar(0x0A4C0A9A, 1)], 1); + insertSprite<Class602>(kScene1705FileHashes[getSubVar(0x0A4C0A9A, 2)], 2); _sprite = insertStaticSprite(0x31313A22, 1100); - _class606 = addSprite(new Class606(_vm, this, 15, 1100, 238, 439, 0x02363852)); + _class606 = insertSprite<Class606>(this, 15, 1100, 238, 439, 0x02363852); _vm->_collisionMan->addSprite(_class606); which = 4; diff --git a/engines/neverhood/module2200.cpp b/engines/neverhood/module2200.cpp index 3751a6fe8a..97729cbb00 100644 --- a/engines/neverhood/module2200.cpp +++ b/engines/neverhood/module2200.cpp @@ -514,14 +514,14 @@ Scene2201::Scene2201(NeverhoodEngine *vm, Module *parentModule, int which) setPalette(0x40008208); insertMouse433(0x0820C408); - _asTape = addSprite(new AsScene1201Tape(_vm, this, 7, 1100, 459, 432, 0x9148A011)); + _asTape = insertSprite<AsScene1201Tape>(this, 7, 1100, 459, 432, 0x9148A011); _vm->_collisionMan->addSprite(_asTape); - _ssDoorButton = addSprite(new Class426(_vm, this, 0xE4A43E29, 0xE4A43E29, 100, 0)); + _ssDoorButton = insertSprite<Class426>(this, 0xE4A43E29, 0xE4A43E29, 100, 0); for (uint32 i = 0; i < 9; i++) { if ((int16)getSubVar(0x484498D0, i) >= 0) { - addSprite(new Class444(_vm, i, (int16)getSubVar(0x484498D0, i))); + insertSprite<Class444>(i, (int16)getSubVar(0x484498D0, i)); } } @@ -551,11 +551,11 @@ Scene2201::Scene2201(NeverhoodEngine *vm, Module *parentModule, int which) if (which < 0) { insertKlayman<KmScene2201>(300, 427, &_rect1, 2); setMessageList(0x004B8118); - _asDoor = addSprite(new AsScene2201Door(_vm, _klayman, _doorLightSprite, false)); + _asDoor = insertSprite<AsScene2201Door>(_klayman, _doorLightSprite, false); } else if (which == 1) { insertKlayman<KmScene2201>(412, 393, &_rect1, 2); setMessageList(0x004B8130); - _asDoor = addSprite(new AsScene2201Door(_vm, _klayman, _doorLightSprite, false)); + _asDoor = insertSprite<AsScene2201Door>(_klayman, _doorLightSprite, false); } else if (which == 2) { if (getGlobalVar(0xC0418A02)) { insertKlayman<KmScene2201>(379, 427, &_rect1, 2); @@ -564,15 +564,15 @@ Scene2201::Scene2201(NeverhoodEngine *vm, Module *parentModule, int which) insertKlayman<KmScene2201>(261, 427, &_rect1, 2); } setMessageList(0x004B8178); - _asDoor = addSprite(new AsScene2201Door(_vm, _klayman, _doorLightSprite, false)); + _asDoor = insertSprite<AsScene2201Door>(_klayman, _doorLightSprite, false); } else { NPoint pt = _dataResource.getPoint(0x0304D8DC); insertKlayman<KmScene2201>(pt.x, pt.y, &_rect1, 2); setMessageList(0x004B8120); - _asDoor = addSprite(new AsScene2201Door(_vm, _klayman, _doorLightSprite, true)); + _asDoor = insertSprite<AsScene2201Door>(_klayman, _doorLightSprite, true); } - addSprite(new AsScene2201CeilingFan(_vm)); + insertSprite<AsScene2201CeilingFan>(); // TODO Sound1ChList_addSoundResource(0x04106220, 0x81212040, true); @@ -598,7 +598,7 @@ uint32 Scene2201::handleMessage(int messageNum, const MessageParam ¶m, Entit if (param.asInteger() == 0x402064D8) { sendEntityMessage(_klayman, 0x1014, _ssDoorButton); } else if (param.asInteger() == 0x35803198) { - if (_asDoor->hasMessageHandler() && sendMessage(_asDoor, 0x2000, 0)) { + if (sendMessage(_asDoor, 0x2000, 0)) { setMessageList(0x004B81A0); } else { setMessageList(0x004B81B8); @@ -904,7 +904,7 @@ Scene2202::Scene2202(NeverhoodEngine *vm, Module *parentModule, int which) for (uint32 index = 0; index < 9; index++) { int16 value = (int16)getSubVar(0x484498D0, index); if (value >= 0) { - Sprite *puzzleTileSprite = addSprite(new SsScene2202PuzzleTile(_vm, this, index, value)); + Sprite *puzzleTileSprite = insertSprite<SsScene2202PuzzleTile>(this, index, value); _vm->_collisionMan->addSprite(puzzleTileSprite); } } @@ -1128,15 +1128,15 @@ Scene2203::Scene2203(NeverhoodEngine *vm, Module *parentModule, int which) setHitRects(0x004B8320); if (getGlobalVar(0x13382860) == 1) { - _class545 = addSprite(new Class545(_vm, this, 2, 1100, 282, 432)); + _class545 = insertSprite<Class545>(this, 2, 1100, 282, 432); _vm->_collisionMan->addSprite(_class545); } - _asTape = addSprite(new AsScene1201Tape(_vm, this, 1, 1100, 435, 432, 0x9148A011)); + _asTape = insertSprite<AsScene1201Tape>(this, 1, 1100, 435, 432, 0x9148A011); _vm->_collisionMan->addSprite(_asTape); - _asLeftDoor = addSprite(new AsScene2203Door(_vm, this, 0)); - _asRightDoor = addSprite(new AsScene2203Door(_vm, this, 1)); + _asLeftDoor = insertSprite<AsScene2203Door>(this, 0); + _asRightDoor = insertSprite<AsScene2203Door>(this, 1); _ssSmallLeftDoor = insertStaticSprite(0x542CC072, 1100); _ssSmallRightDoor = insertStaticSprite(0x0A2C0432, 1100); @@ -1280,21 +1280,19 @@ Scene2205::Scene2205(NeverhoodEngine *vm, Module *parentModule, int which) setPalette(0x0008028D); addEntity(_palette); insertMouse433(0x80289008); - _ssLightSwitch = new Class426(_vm, this, 0x2D339030, 0x2D309030, 100, 0); - addSprite(_ssLightSwitch); + _ssLightSwitch = insertSprite<Class426>(this, 0x2D339030, 0x2D309030, 100, 0); } else { _isLightOn = false; setBackground(0xD00A028D); setPalette(0xD00A028D); addEntity(_palette); insertMouse433(0xA0289D08); - _ssLightSwitch = new Class426(_vm, this, 0x2D339030, 0xDAC86E84, 100, 0); - addSprite(_ssLightSwitch); + _ssLightSwitch = insertSprite<Class426>(this, 0x2D339030, 0xDAC86E84, 100, 0); } _palette->addBasePalette(0xD00A028D, 0, 256, 0); - _ssDoorFrame = addSprite(new SsScene2205DoorFrame(_vm)); + _ssDoorFrame = insertSprite<SsScene2205DoorFrame>(); if (which < 0) { insertKlayman<KmScene2205>(320, 417); @@ -1533,25 +1531,25 @@ Scene2206::Scene2206(NeverhoodEngine *vm, Module *parentModule, int which) _sprite1 = insertStaticSprite(0x2201266A, 100); _sprite2 = insertStaticSprite(0x3406A333, 300); _sprite3 = insertStaticSprite(0x24A223A2, 100); - _sprite4 = addSprite(new Class603(_vm, 0x26133023)); + _sprite4 = insertSprite<Class603>(0x26133023); _sprite4->setClipRect(_sprite2->getDrawRect().x, 0, 640, 480); setRectList(0x004B8AF8); - _sprite5 = addSprite(new SsCommonButtonSprite(_vm, this, 0x0E038022, 100, 0)); + _sprite5 = insertSprite<SsCommonButtonSprite>(this, 0x0E038022, 100, 0); insertMouse433(0x83212411); - _class607 = addSprite(new Class607(_vm, this, 1100, /*464, 433, */0x5E00E262)); - _class604 = addSprite(new Class604(_vm, 0x085E25E0)); + _class607 = insertSprite<Class607>(this, 1100, /*464, 433, */0x5E00E262); + _class604 = insertSprite<Class604>(0x085E25E0); } else { fileHash = 0xE0102A45; _sprite1 = insertStaticSprite(0x1C1106B8, 100); _sprite2 = insertStaticSprite(0x020462E0, 300); _sprite3 = insertStaticSprite(0x900626A2, 100); - _sprite4 = addSprite(new Class603(_vm, 0x544822A8)); + _sprite4 = insertSprite<Class603>(0x544822A8); _sprite4->setClipRect(_sprite2->getDrawRect().x, 0, 640, 480); setRectList(0x004B8B58); - _sprite5 = addSprite(new SsCommonButtonSprite(_vm, this, 0x16882608, 100, 0)); + _sprite5 = insertSprite<SsCommonButtonSprite>(this, 0x16882608, 100, 0); insertMouse433(0x02A41E09); - _class607 = addSprite(new Class607(_vm, this, 1100, /*464, 433, */0x52032563)); - _class604 = addSprite(new Class604(_vm, 0x317831A0)); + _class607 = insertSprite<Class607>(this, 1100, /*464, 433, */0x52032563); + _class604 = insertSprite<Class604>(0x317831A0); } _class604->setClipRect(_sprite2->getDrawRect().x, 0, _sprite3->getDrawRect().x2(), _sprite1->getDrawRect().y2()); @@ -2031,7 +2029,7 @@ Scene2207::Scene2207(NeverhoodEngine *vm, Module *parentModule, int which) setMessageList(0x004B38E8); - _asElevator = addSprite(new AsScene2207Elevator(_vm, this)); + _asElevator = insertSprite<AsScene2207Elevator>(this); if (getGlobalVar(0x4D080E54)) { @@ -2043,19 +2041,19 @@ Scene2207::Scene2207(NeverhoodEngine *vm, Module *parentModule, int which) _ssMaskPart2 = insertStaticSprite(0x688F62A5, 1100); _ssMaskPart3 = insertStaticSprite(0x0043B038, 1100); - _asTape = addSprite(new AsScene1201Tape(_vm, this, 4, 1100, 277, 428, 0x9148A011)); + _asTape = insertSprite<AsScene1201Tape>(this, 4, 1100, 277, 428, 0x9148A011); _vm->_collisionMan->addSprite(_asTape); - _asLever = addSprite(new AsScene2207Lever(_vm, this, 527, 333, 0)); + _asLever = insertSprite<AsScene2207Lever>(this, 527, 333, 0); _vm->_collisionMan->addSprite(_asLever); - _asWallRobotAnimation = addSprite(new AsScene2207WallRobotAnimation(_vm, this)); - _asWallCannonAnimation = addSprite(new AsScene2207WallCannonAnimation(_vm)); + _asWallRobotAnimation = insertSprite<AsScene2207WallRobotAnimation>(this); + _asWallCannonAnimation = insertSprite<AsScene2207WallCannonAnimation>(); _asWallRobotAnimation->setVisible(false); _asWallCannonAnimation->setVisible(false); - _ssButton = addSprite(new SsCommonButtonSprite(_vm, this, 0x2C4061C4, 100, 0)); + _ssButton = insertSprite<SsCommonButtonSprite>(this, 0x2C4061C4, 100, 0); _asLever->setClipRect(0, 0, _ssMaskPart3->getDrawRect().x2(), 480); _klayman->setClipRect(0, _ssMaskPart1->getDrawRect().y, 640, _ssMaskPart2->getDrawRect().y2()); @@ -2071,9 +2069,9 @@ Scene2207::Scene2207(NeverhoodEngine *vm, Module *parentModule, int which) _ssMaskPart1 = insertStaticSprite(0x980E46A4, 1200); - addSprite(new SsScene2207Symbol(_vm, kScene2207FileHashes[getSubVar(0x00504B86, 0)], 0)); - addSprite(new SsScene2207Symbol(_vm, kScene2207FileHashes[getSubVar(0x00504B86, 1)], 1)); - addSprite(new SsScene2207Symbol(_vm, kScene2207FileHashes[getSubVar(0x00504B86, 2)], 2)); + insertSprite<SsScene2207Symbol>(kScene2207FileHashes[getSubVar(0x00504B86, 0)], 0); + insertSprite<SsScene2207Symbol>(kScene2207FileHashes[getSubVar(0x00504B86, 1)], 1); + insertSprite<SsScene2207Symbol>(kScene2207FileHashes[getSubVar(0x00504B86, 2)], 2); _asTape = NULL; _asLever = NULL; @@ -2444,7 +2442,7 @@ Scene2242::Scene2242(NeverhoodEngine *vm, Module *parentModule, int which) setRectList(0x004B3E18); } - _asTape = addSprite(new AsScene1201Tape(_vm, this, 10, 1100, 464, 435, 0x9148A011)); + _asTape = insertSprite<AsScene1201Tape>(this, 10, 1100, 464, 435, 0x9148A011); _vm->_collisionMan->addSprite(_asTape); if (which < 0) { diff --git a/engines/neverhood/module3000.cpp b/engines/neverhood/module3000.cpp index f645fb475b..d979bbb7a8 100644 --- a/engines/neverhood/module3000.cpp +++ b/engines/neverhood/module3000.cpp @@ -735,15 +735,10 @@ AsScene3009Symbol::AsScene3009Symbol(NeverhoodEngine *vm, Scene3009 *parentScene updatePosition(); SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene3009Symbol::handleMessage); - - _ssArrowPrev = new SsScene3009SymbolArrow(_vm, this, _index * 2 + 0); - _parentScene->addSprite(_ssArrowPrev); + _ssArrowPrev = _parentScene->insertSprite<SsScene3009SymbolArrow>(this, _index * 2 + 0); _vm->_collisionMan->addSprite(_ssArrowPrev); - - _ssArrowNext = new SsScene3009SymbolArrow(_vm, this, _index * 2 + 1); - _parentScene->addSprite(_ssArrowNext); + _ssArrowNext = _parentScene->insertSprite<SsScene3009SymbolArrow>(this, _index * 2 + 1); _vm->_collisionMan->addSprite(_ssArrowNext); - } uint32 AsScene3009Symbol::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -798,15 +793,13 @@ Scene3009::Scene3009(NeverhoodEngine *vm, Module *parentModule, int which) setPalette(0xD000420C); insertMouse435(0x04208D08, 20, 620); - _ssFireCannonButton = addSprite(new SsScene3009FireCannonButton(_vm, this)); + _ssFireCannonButton = insertSprite<SsScene3009FireCannonButton>(this); _vm->_collisionMan->addSprite(_ssFireCannonButton); - _asVerticalIndicator = new AsScene3009VerticalIndicator(_vm, this, _cannonLocation); - addSprite(_asVerticalIndicator); + _asVerticalIndicator = insertSprite<AsScene3009VerticalIndicator>(this, _cannonLocation); _vm->_collisionMan->addSprite(_asVerticalIndicator); - _asHorizontalIndicator = new AsScene3009HorizontalIndicator(_vm, this, _cannonLocation); - addSprite(_asHorizontalIndicator); + _asHorizontalIndicator = insertSprite<AsScene3009HorizontalIndicator>(this, _cannonLocation); _vm->_collisionMan->addSprite(_asHorizontalIndicator); if (_cannonLocation != 0 && _cannonLocation != 8 && _cannonLocation != 9 && _cannonLocation != 10) { @@ -826,16 +819,12 @@ Scene3009::Scene3009(NeverhoodEngine *vm, Module *parentModule, int which) insertStaticSprite(0x8540252C, 400); for (int i = 0; i < 2; i++) { - _ssSymbolEdges[i] = new SsScene3009SymbolEdges(_vm, i); - addSprite(_ssSymbolEdges[i]); - _ssTargetLines[i] = new SsScene3009TargetLine(_vm, i); - addSprite(_ssTargetLines[i]); + _ssSymbolEdges[i] = insertSprite<SsScene3009SymbolEdges>(i); + _ssTargetLines[i] = insertSprite<SsScene3009TargetLine>(i); } - for (int i = 0; i < 6; i++) { - _asSymbols[i] = new AsScene3009Symbol(_vm, this, i); - addSprite(_asSymbols[i]); + _asSymbols[i] = insertSprite<AsScene3009Symbol>(this, i); if (i < 3) _correctSymbols[i] = getSubVar(0x00504B86, i); else @@ -1294,10 +1283,8 @@ Scene3010::Scene3010(NeverhoodEngine *vm, Module *parentModule, int which) setPalette(0x80802626); for (int i = 0; i < 3; i++) { - _asDeadBolts[i] = new AsScene3010DeadBolt(_vm, this, i, which == 1);//CHECKME - addSprite(_asDeadBolts[i]); - _ssDeadBoltButtons[i] = new SsScene3010DeadBoltButton(_vm, this, i, initCountdown, which == 1);//CHECKME - addSprite(_ssDeadBoltButtons[i]); + _asDeadBolts[i] = insertSprite<AsScene3010DeadBolt>(this, i, which == 1);//CHECKME + _ssDeadBoltButtons[i] = insertSprite<SsScene3010DeadBoltButton>(this, i, initCountdown, which == 1);//CHECKME _vm->_collisionMan->addSprite(_ssDeadBoltButtons[i]); if (getSubVar(0x14800353, kScene3010ButtonNameHashes[i])) initCountdown++; @@ -1533,28 +1520,25 @@ void AsScene3011Symbol::change(int index, bool flag) { Scene3011::Scene3011(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true), _updateStatus(0), _buttonClicked(false), _index2(0) { - _surfaceFlag = true; - // TODO _vm->gameModule()->initScene3011Vars(); _index1 = getGlobalVar(0x2414C2F2); + _surfaceFlag = true; + SetMessageHandler(&Scene3011::handleMessage); + SetUpdateHandler(&Scene3011::update); + setBackground(0x92124A04); setPalette(0xA4070114); addEntity(_palette); insertMouse435(0x24A00929, 20, 620); - for (int i = 0; i < 12; i++) { - _asSymbols[i] = new AsScene3011Symbol(_vm, i, true); - addSprite(_asSymbols[i]); - } + for (int i = 0; i < 12; i++) + _asSymbols[i] = insertSprite<AsScene3011Symbol>(i, true); - _ssButton = addSprite(new SsScene3011Button(_vm, this, true)); + _ssButton = insertSprite<SsScene3011Button>(this, true); _vm->_collisionMan->addSprite(_ssButton); - SetUpdateHandler(&Scene3011::update); - SetMessageHandler(&Scene3011::handleMessage); - } void Scene3011::update() { diff --git a/engines/neverhood/module3000.h b/engines/neverhood/module3000.h index 2764c83490..2e25a0dec1 100644 --- a/engines/neverhood/module3000.h +++ b/engines/neverhood/module3000.h @@ -236,6 +236,8 @@ public: void hide(); void stopSound(); void change(int index, bool flag); + bool getFlag1() { return _flag1; } + int getIndex() { return _index; } protected: SoundResource _soundResource1; SoundResource _soundResource2; |