Scene2609::Scene2609(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _isBusy(false) { SetUpdateHandler(&Scene::update); SetMessageHandler(&Scene2609::handleMessage); setBackground(0x51409A16); setPalette(0x51409A16); _asWater = insertSprite<AsScene2609Water>(); _ssButton = insertSprite<SsScene2609Button>(this); addCollisionSprite(_ssButton); insertPuzzleMouse(0x09A1251C, 20, 620); insertStaticSprite(0x02138002, 1200); insertStaticSprite(0x825E2827, 1200); }
Scene1202::Scene1202(NeverhoodEngine *vm, Module *parentModule) : Scene(vm, parentModule), _paletteResource(vm), _soundToggle(true), _isPuzzleSolved(false), _counter(0), _clickedIndex(-1) { SetMessageHandler(&Scene1202::handleMessage); SetUpdateHandler(&Scene1202::update); setBackground(0x60210ED5); setPalette(0x60210ED5); addEntity(_palette); _paletteResource.load(0x60250EB5); _paletteResource.copyPalette(_paletteData); insertPuzzleMouse(0x10ED160A, 20, 620); for (int tntIndex = 0; tntIndex < 18; tntIndex++) { _asTntItems[tntIndex] = insertSprite<AsScene1202TntItem>(this, tntIndex); addCollisionSprite(_asTntItems[tntIndex]); } insertStaticSprite(0x8E8419C1, 1100); if (getGlobalVar(V_TNT_DUMMY_BUILT)) SetMessageHandler(&Scene1202::hmSolved); playSound(0, 0x40106542); loadSound(1, 0x40005446); loadSound(2, 0x40005446); // Same sound as slot 1 loadSound(3, 0x68E25540); }
Scene1901::Scene1901(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { Sprite *tempSprite; setRectList(0x004B34C8); setBackground(0x01303227); setPalette(0x01303227); insertScreenMouse(0x0322301B); insertStaticSprite(0x42213133, 1100); if (!getGlobalVar(V_STAIRS_PUZZLE_SOLVED)) insertStaticSprite(0x40A40168, 100); else if (getGlobalVar(V_STAIRS_DOWN)) { insertStaticSprite(0x124404C4, 100); setGlobalVar(V_STAIRS_DOWN_ONCE, 1); } else insertStaticSprite(0x02840064, 100); if (which < 0) { // Restoring game insertKlaymen<KmScene1901>(120, 380); setMessageList(0x004B3408); } else if (which == 1) { // Klaymen returning from the puzzle insertKlaymen<KmScene1901>(372, 380); setMessageList(0x004B3410); } else { // Klaymen entering from the left insertKlaymen<KmScene1901>(0, 380); setMessageList(0x004B3400); } tempSprite = insertStaticSprite(0x4830A402, 1100); _klaymen->setClipRect(tempSprite->getDrawRect().x, 0, 640, 480); }
Scene2001::Scene2001(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { Sprite *tempSprite; SetMessageHandler(&Scene2001::handleMessage); setBackground(0xA6417244); setPalette(0xA6417244); insertScreenMouse(0x17240A6C); tempSprite = insertStaticSprite(0x0D641724, 1100); if (which < 0) { // Restoring game insertKlaymen<KmScene2001>(300, 345); setMessageList(0x004B3538); sendMessage(this, 0x2000, 0); } else if (which == 1) { // Klaymen teleporting in insertKlaymen<KmScene2001>(116, 345); sendMessage(_klaymen, 0x2000, 1); setMessageList(0x004B3540, false); sendMessage(this, 0x2000, 1); } else if (which == 2) { // Klaymen teleporting out insertKlaymen<KmScene2001>(116, 345); sendMessage(_klaymen, 0x2000, 1); setMessageList(0x004B35F0, false); sendMessage(this, 0x2000, 1); } else if (which == 3) { // Klaymen returning from teleporter console insertKlaymen<KmScene2001>(116, 345); sendMessage(_klaymen, 0x2000, 1); setMessageList(0x004B3550, false); sendMessage(this, 0x2000, 1); } else { // Klaymen standing around insertKlaymen<KmScene2001>(390, 345); setMessageList(0x004B3530); sendMessage(this, 0x2000, 0); _klaymen->setDoDeltaX(1); } _klaymen->setClipRect(tempSprite->getDrawRect().x, 0, 640, 480); }
Scene1109::Scene1109(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { SetMessageHandler(&Scene1109::handleMessage); setBackground(0x8449E02F); setPalette(0x8449E02F); insertScreenMouse(0x9E02B84C); _sprite1 = insertStaticSprite(0x600CEF01, 1100); if (which < 0) { // Restoring game insertKlaymen<KmScene1109>(140, 436); setMessageList(0x004B6260); sendMessage(this, 0x2000, 0); } else if (which == 1) { // Klaymen teleporting in insertKlaymen<KmScene1109>(450, 436); sendMessage(_klaymen, 0x2000, 1); setMessageList(0x004B6268, false); sendMessage(this, 0x2000, 1); } else if (which == 2) { // Klaymen teleporting out insertKlaymen<KmScene1109>(450, 436); sendMessage(_klaymen, 0x2000, 1); setMessageList(0x004B6318, false); sendMessage(this, 0x2000, 1); } else if (which == 3) { // Klaymen returning from teleporter console insertKlaymen<KmScene1109>(450, 436); sendMessage(_klaymen, 0x2000, 1); setMessageList(0x004B6278, false); sendMessage(this, 0x2000, 1); } else { // Klaymen entering from the left insertKlaymen<KmScene1109>(0, 436); setMessageList(0x004B6258); sendMessage(this, 0x2000, 0); } _klaymen->setClipRect(0, 0, _sprite1->getDrawRect().x2(), 480); }
Scene2101::Scene2101(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { Sprite *tempSprite; SetMessageHandler(&Scene2101::handleMessage); SetUpdateHandler(&Scene2101::update); setBackground(0x44242305); setPalette(0x44242305); insertScreenMouse(0x4230144A); insertStaticSprite(0x00502330, 1100); tempSprite = insertStaticSprite(0x78492010, 1100); _ssFloorButton = insertSprite<SsCommonFloorButton>(this, 0x72427010, 0x32423010, 200, 0); _asTape1 = insertSprite<AsScene1201Tape>(this, 18, 1100, 412, 443, 0x9148A011); addCollisionSprite(_asTape1); _asTape2 = insertSprite<AsScene1201Tape>(this, 11, 1100, 441, 443, 0x9048A093); addCollisionSprite(_asTape2); if (which < 0) { insertKlaymen<KmScene2101>(380, 438); setMessageList(0x004B8E48); sendMessage(this, 0x2000, 0); _asDoor = insertSprite<AsScene2101Door>(false); _doorStatus = 1; _countdown1 = 0; } else if (which == 1) { // Klaymen entering from the right insertKlaymen<KmScene2101>(640, 438); setMessageList(0x004B8E50); sendMessage(this, 0x2000, 0); _asDoor = insertSprite<AsScene2101Door>(true); _doorStatus = 2; _countdown1 = 48; } else if (which == 2) { // Klaymen teleporting out insertKlaymen<KmScene2101>(115, 438); sendMessage(_klaymen, 0x2000, 1); setMessageList(0x004B8F58); sendMessage(this, 0x2000, 1); _asDoor = insertSprite<AsScene2101Door>(false); _doorStatus = 1; _countdown1 = 0; } else if (which == 3) { // Klaymen returning from the teleporter console insertKlaymen<KmScene2101>(115, 438); sendMessage(_klaymen, 0x2000, 1); setMessageList(0x004B8EB0); sendMessage(this, 0x2000, 1); _asDoor = insertSprite<AsScene2101Door>(false); _doorStatus = 1; _countdown1 = 0; } else { // Klaymen teleporting in insertKlaymen<KmScene2101>(115, 438); sendMessage(_klaymen, 0x2000, 1); setMessageList(0x004B8EA0); sendMessage(this, 0x2000, 1); _asDoor = insertSprite<AsScene2101Door>(false); _doorStatus = 1; _countdown1 = 0; } _asHitByDoorEffect = insertSprite<AsScene2101HitByDoorEffect>(_klaymen); _klaymen->setClipRect(0, 0, tempSprite->getDrawRect().x2(), 480); }
Scene1608::Scene1608(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _asCar(NULL), _countdown1(0) { setGlobalVar(V_CAR_DELTA_X, 1); SetMessageHandler(&Scene1608::hmLowerFloor); _asKey = insertSprite<AsCommonKey>(this, 1, 1100, 198, 220); addCollisionSprite(_asKey); if (which < 0) { // Restoring game if (_vm->gameState().which == 1) // Klaymen is in the car which = 1; else { // Klaymen is standing around setRectList(0x004B47D0); insertKlaymen<KmScene1608>(380, 438); _kmScene1608 = _klaymen; _klaymenInCar = false; _sprite1 = insertStaticSprite(0x7D0404E8, 1100); setMessageList(0x004B46A8); setBackground(0x10080E01); setPalette(0x10080E01); _asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011); addCollisionSprite(_asTape); _klaymen->setClipRect(_sprite1->getDrawRect().x, 0, 640, 480); SetUpdateHandler(&Scene1608::upLowerFloor); insertScreenMouse(0x80E05108); insertStaticSprite(0x4B18F868, 1200); } } else if (which == 0) { // Klaymen entering from the left _vm->gameState().which = 0; setRectList(0x004B47D0); insertKlaymen<KmScene1608>(0, 438); _kmScene1608 = _klaymen; _klaymenInCar = false; setMessageList(0x004B46B0); setBackground(0x10080E01); setPalette(0x10080E01); _asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011); addCollisionSprite(_asTape); insertScreenMouse(0x80E05108); _sprite1 = insertStaticSprite(0x7D0404E8, 1100); _klaymen->setClipRect(_sprite1->getDrawRect().x, 0, 640, 480); SetUpdateHandler(&Scene1608::upLowerFloor); insertStaticSprite(0x4B18F868, 1200); } else if (which == 2) { // Klaymen returning from looking through the upper window _vm->gameState().which = 1; _dataResource.load(0x003C0492); _roomPathPoints = _dataResource.getPointArray(calcHash("meArchroArchRoomPath")); setBackground(0x98001604); setPalette(0x98001604); _palette->addPalette("paPodRed", 65, 31, 65); insertScreenMouse(0x01600988); _sprite2 = insertStaticSprite(0x491F38A8, 1100); _asCar = createSprite<AsCommonCar>(this, 375, 227); // Create but don't add to the sprite list yet _asIdleCarLower = insertSprite<AsCommonIdleCarLower>(375, 227); _asIdleCarFull = insertSprite<AsCommonIdleCarFull>(375, 227); _asCar->setVisible(false); if (getGlobalVar(V_KLAYMEN_IS_DELTA_X)) { insertKlaymen<KmScene1608>(373, 220); _klaymen->setDoDeltaX(1); } else insertKlaymen<KmScene1608>(283, 220); _kmScene1608 = _klaymen; setMessageList(0x004B47A8); SetMessageHandler(&Scene1608::hmUpperFloor); SetUpdateHandler(&Scene1608::upUpperFloor); _asCar->setPathPoints(_roomPathPoints); sendMessage(_asCar, 0x2002, _roomPathPoints->size() - 1); _sprite3 = insertStaticSprite(0xB47026B0, 1100); _clipRect1.set(_sprite3->getDrawRect().x, _sprite3->getDrawRect().y, 640, _sprite2->getDrawRect().y2()); _clipRect3.set(_sprite2->getDrawRect().x, _sprite3->getDrawRect().y, 640, _sprite2->getDrawRect().y2()); _clipRect2 = _clipRect1; _clipRect2.y2 = 215; _klaymen->setClipRect(_clipRect1); _asCar->setClipRect(_clipRect1); _asIdleCarLower->setClipRect(_clipRect1); _asIdleCarFull->setClipRect(_clipRect1); _asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011); addCollisionSprite(_asTape); insertSprite<AsCommonCarConnector>(_asCar)->setClipRect(_clipRect1); _klaymenInCar = false; _carClipFlag = false; _carStatus = 0; setRectList(0x004B4810); } // NOTE: Not in the else because 'which' is set to 1 in the true branch if (which == 1) { // Klaymen riding the car _vm->gameState().which = 1; _dataResource.load(0x003C0492); _roomPathPoints = _dataResource.getPointArray(calcHash("meArchroArchRoomPath")); setBackground(0x98001604); setPalette(0x98001604); _palette->addPalette("paPodRed", 65, 31, 65); insertScreenMouse(0x01600988); _asCar = insertSprite<AsCommonCar>(this, 375, 227); _asIdleCarLower = insertSprite<AsCommonIdleCarLower>(375, 227); _asIdleCarFull = insertSprite<AsCommonIdleCarFull>(375, 227); _sprite2 = insertStaticSprite(0x491F38A8, 1100); _kmScene1608 = createSprite<KmScene1608>(this, 439, 220); sendMessage(_kmScene1608, 0x2032, 1); _kmScene1608->setDoDeltaX(1); SetMessageHandler(&Scene1608::hmRidingCar); SetUpdateHandler(&Scene1608::upRidingCar); _asIdleCarLower->setVisible(false); _asIdleCarFull->setVisible(false); _asCar->setPathPoints(_roomPathPoints); sendMessage(_asCar, 0x2002, 0); sendMessage(_asCar, 0x2008, 90); _sprite3 = insertStaticSprite(0xB47026B0, 1100); _clipRect1.set(_sprite3->getDrawRect().x, _sprite3->getDrawRect().y, 640, _sprite2->getDrawRect().y2()); _clipRect3.set(_sprite2->getDrawRect().x, _sprite3->getDrawRect().y, 640, _sprite2->getDrawRect().y2()); _clipRect2 = _clipRect1; _clipRect2.y2 = 215; _kmScene1608->setClipRect(_clipRect1); _asCar->setClipRect(_clipRect1); _asIdleCarLower->setClipRect(_clipRect1); _asIdleCarFull->setClipRect(_clipRect1); _asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011); // ... addCollisionSprite(_asTape); insertSprite<AsCommonCarConnector>(_asCar)->setClipRect(_clipRect1); _klaymenInCar = true; _carClipFlag = true; _carStatus = 0; } _palette->addPalette("paKlayRed", 0, 64, 0); }
Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _creatureExploded(false), _asMatch(NULL), _asTntMan(NULL), _asCreature(NULL), _asTntManRope(NULL), _asLeftDoor(NULL), _asRightDoor(NULL), _asTape(NULL) { int16 topY1, topY2, topY3, topY4; int16 x1, x2; Sprite *tempSprite; SetUpdateHandler(&Scene1201::update); SetMessageHandler(&Scene1201::handleMessage); setHitRects(0x004AEBD0); if (!getSubVar(VA_IS_PUZZLE_INIT, 0xE8058B52)) { setSubVar(VA_IS_PUZZLE_INIT, 0xE8058B52, 1); for (uint32 index = 0; index < 18; index++) setSubVar(VA_TNT_POSITIONS, index, kScene1201InitArray[index]); } insertScreenMouse(0x9A2C0409); _asTape = insertSprite<AsScene1201Tape>(this, 3, 1100, 243, 340, 0x9148A011); addCollisionSprite(_asTape); tempSprite = insertStaticSprite(0x03C82530, 100); topY1 = tempSprite->getY() + tempSprite->getDrawRect().height; tempSprite = insertStaticSprite(0x88182069, 200); topY2 = tempSprite->getY() + tempSprite->getDrawRect().height; tempSprite = insertStaticSprite(0x476014E0, 300); topY3 = tempSprite->getY() + tempSprite->getDrawRect().height; tempSprite = insertStaticSprite(0x04063110, 500); topY4 = tempSprite->getY() + 1; _asTntManRope = insertSprite<AsScene1201TntManRope>(getGlobalVar(V_TNT_DUMMY_BUILT) && which != 1); _asTntManRope->setClipRect(0, topY4, 640, 480); insertStaticSprite(0x400B04B0, 1200); tempSprite = insertStaticSprite(0x40295462, 1200); x1 = tempSprite->getX(); tempSprite = insertStaticSprite(0xA29223FA, 1200); x2 = tempSprite->getX() + tempSprite->getDrawRect().width; _asKlaymenHead = insertSprite<AsScene1201KlaymenHead>(); if (which < 0) { // Restoring game insertKlaymen<KmScene1201>(364, 333); setMessageList(0x004AEC08); } else if (which == 3) { // Klaymen standing after the weasel exploded insertKlaymen<KmScene1201>(400, 329); setMessageList(0x004AEC08); } else if (which == 2) { // Klaymen entering from the right if (getGlobalVar(V_CREATURE_ANGRY) && !getGlobalVar(V_CREATURE_EXPLODED)) { insertKlaymen<KmScene1201>(374, 333); setMessageList(0x004AEC08); } else { insertKlaymen<KmScene1201>(640, 329); setMessageList(0x004AEC20); } } else if (which == 1) { // Klaymen returning from the TNT console if (getGlobalVar(V_KLAYMEN_IS_DELTA_X)) { insertKlaymen<KmScene1201>(364, 333); _klaymen->setDoDeltaX(1); } else { insertKlaymen<KmScene1201>(246, 333); } setMessageList(0x004AEC30); } else { // Klaymen entering from the left insertKlaymen<KmScene1201>(0, 336); setMessageList(0x004AEC10); } _klaymen->setClipRect(x1, 0, x2, 480); _klaymen->setRepl(64, 0); if (getGlobalVar(V_CREATURE_ANGRY) && !getGlobalVar(V_CREATURE_EXPLODED)) { setBackground(0x4019A2C4); setPalette(0x4019A2C4); _asRightDoor = NULL; } else { setBackground(0x40206EC5); setPalette(0x40206EC5); _asRightDoor = insertSprite<AsScene1201RightDoor>(_klaymen, which == 2); } if (getGlobalVar(V_TNT_DUMMY_BUILT)) { insertStaticSprite(0x10002ED8, 500); if (!getGlobalVar(V_CREATURE_EXPLODED)) { _asTntMan = insertSprite<AsScene1201TntMan>(this, _asTntManRope, which == 1); _asTntMan->setClipRect(x1, 0, x2, 480); _asTntMan->setRepl(64, 0); addCollisionSprite(_asTntMan); tempSprite = insertSprite<AsScene1201TntManFlame>(_asTntMan); tempSprite->setClipRect(x1, 0, x2, 480); } uint32 tntIndex = 1; while (tntIndex < 18) { uint32 elemIndex = getSubVar(VA_TNT_POSITIONS, tntIndex); int16 clipY2; if (kScene1201PointArray[elemIndex].y < 175) clipY2 = topY1; else if (kScene1201PointArray[elemIndex].y < 230) clipY2 = topY2; else clipY2 = topY3; insertSprite<SsScene1201Tnt>(tntIndex, getSubVar(VA_TNT_POSITIONS, tntIndex), clipY2); elemIndex = getSubVar(VA_TNT_POSITIONS, tntIndex + 1); if (kScene1201PointArray[elemIndex].y < 175) clipY2 = topY1; else if (kScene1201PointArray[elemIndex].y < 230) clipY2 = topY2; else clipY2 = topY3; insertSprite<SsScene1201Tnt>(tntIndex + 1, getSubVar(VA_TNT_POSITIONS, tntIndex + 1), clipY2); tntIndex += 3; } if (getGlobalVar(V_CREATURE_ANGRY) && !getGlobalVar(V_CREATURE_EXPLODED)) { setRectList(0x004AEE58); } else { setRectList(0x004AEDC8); } } else { insertStaticSprite(0x8E8A1981, 900); uint32 tntIndex = 0; while (tntIndex < 18) { uint32 elemIndex = getSubVar(VA_TNT_POSITIONS, tntIndex); int16 clipY2; if (kScene1201PointArray[elemIndex].x < 300) { clipY2 = 480; } else { if (kScene1201PointArray[elemIndex].y < 175) clipY2 = topY1; else if (kScene1201PointArray[elemIndex].y < 230) clipY2 = topY2; else clipY2 = topY3; } insertSprite<SsScene1201Tnt>(tntIndex, getSubVar(VA_TNT_POSITIONS, tntIndex), clipY2); tntIndex++; } if (getGlobalVar(V_CREATURE_ANGRY) && !getGlobalVar(V_CREATURE_EXPLODED)) setRectList(0x004AEE18); else setRectList(0x004AED88); } tempSprite = insertStaticSprite(0x63D400BC, 900); _asLeftDoor = insertSprite<AsScene1201LeftDoor>(_klaymen); _asLeftDoor->setClipRect(x1, tempSprite->getDrawRect().y, tempSprite->getDrawRect().x2(), 480); if (getGlobalVar(V_CREATURE_ANGRY) && getGlobalVar(V_MATCH_STATUS) == 0) setGlobalVar(V_MATCH_STATUS, 1); _asMatch = NULL; if (getGlobalVar(V_MATCH_STATUS) < 3) { _asMatch = insertSprite<AsScene1201Match>(this); addCollisionSprite(_asMatch); } if (getGlobalVar(V_CREATURE_ANGRY) && getGlobalVar(V_CREATURE_EXPLODED) == 0) { _asCreature = insertSprite<AsScene1201Creature>(this, _klaymen); _asCreature->setClipRect(x1, 0, x2, 480); } }