uint32 Scene2001::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { Scene::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x2000: if (param.asInteger()) { setRectList(0x004B3680); _klaymen->setKlaymenIdleTable3(); } else { setRectList(0x004B3670); _klaymen->setKlaymenIdleTable1(); } } return 0; }
uint32 Scene2101::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { Scene::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x100D: if (param.asInteger() == 0x02144CB1) sendEntityMessage(_klaymen, 0x1014, _ssFloorButton); else if (param.asInteger() == 0x21E64A00) { if (_doorStatus == 0) setMessageList(0x004B8E80); else setMessageList(0x004B8EC8); } else if (param.asInteger() == 0x41442820) cancelMessageList(); break; case 0x2000: if (param.asInteger() != 0) { setRectList(0x004B9008); _klaymen->setKlaymenIdleTable3(); } else { setRectList(0x004B8FF8); _klaymen->setKlaymenIdleTable1(); } break; case 0x480B: if (sender == _ssFloorButton && _doorStatus == 1) { sendMessage(_asDoor, 0x4808, 0); _doorStatus = 0; _countdown1 = 90; } break; case 0x4826: if (sender == _asTape1 || sender == _asTape2) { if (_klaymen->getX() >= 228 && _klaymen->getX() <= 500) { sendEntityMessage(_klaymen, 0x1014, sender); setMessageList(0x004B8F78); } else if (_klaymen->getX() < 228) setMessageList2(0x004B8F00); } break; } return 0; }
void Scene1608::upGettingOutOfCar() { Scene::update(); if (_carStatus == 2) { _klaymen = _kmScene1608; removeSurface(_asCar->getSurface()); removeEntity(_asCar); addSprite(_klaymen); _klaymenInCar = false; SetMessageHandler(&Scene1608::hmUpperFloor); SetUpdateHandler(&Scene1608::upUpperFloor); setRectList(0x004B4810); _asIdleCarLower->setVisible(true); _asIdleCarFull->setVisible(true); _asCar->setVisible(false); setMessageList(0x004B4748); processMessageList(); _klaymen->handleUpdate(); _carStatus = 0; } updateKlaymenCliprect(); }
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); }
void Scene::setRectList(uint32 id) { setRectList(_vm->_staticData->getRectList(id)); }
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); } }