AsScene2402TV::AsScene2402TV(NeverhoodEngine *vm, Klaymen *klaymen) : AnimatedSprite(vm, 1100), _klaymen(klaymen), _countdown1(0), _countdown2(0) { _x = 260; _y = 210; createSurface(100, 127, 90); setDoDeltaX(1); SetMessageHandler(&Sprite::handleMessage); if (!getGlobalVar(V_TV_JOKE_TOLD)) { loadSound(0, 0x58208810); _countdown1 = 48; startAnimation(0x4919397A, 0, -1); _newStickFrameIndex = 0; SetUpdateHandler(&AsScene2402TV::upWait); } else { int16 frameIndex; if (_klaymen->getX() > 320) _currFrameIndex = 29; frameIndex = CLIP<int16>((_klaymen->getX() - _x + 150) / 10, 0, 29); startAnimation(0x050A0103, frameIndex, -1); _newStickFrameIndex = frameIndex; _countdown1 = 0; SetUpdateHandler(&AsScene2402TV::upFocusKlaymen); } }
void Scene1608::upCarAtHome() { Scene::update(); if (_mouseClicked) { if (_mouseClickPos.x <= 329 && _asCar->getX() == 375 && _asCar->getY() == 227) { sendMessage(_asCar, 0x200A, 0); SetUpdateHandler(&Scene1608::upGettingOutOfCar); } else { sendPointMessage(_asCar, 0x2004, _mouseClickPos); SetMessageHandler(&Scene1608::hmRidingCar); SetUpdateHandler(&Scene1608::upRidingCar); } _mouseClicked = false; } updateKlaymenCliprect(); }
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); }
Scene::Scene(NeverhoodEngine *vm, Module *parentModule) : Entity(vm, 0), _parentModule(parentModule), _dataResource(vm), _hitRects(NULL), _mouseCursorWasVisible(true) { _isKlaymenBusy = false; _doConvertMessages = false; _messageList = NULL; _rectType = 0; _mouseClickPos.x = 0; _mouseClickPos.y = 0; _mouseClicked = false; _rectList = NULL; _klaymen = NULL; _mouseCursor = NULL; _palette = NULL; _background = NULL; clearHitRects(); clearCollisionSprites(); _vm->_screen->setFps(24); _vm->_screen->setSmackerDecoder(NULL); _canAcceptInput = true; _messageList2 = NULL; _smackerPlayer = NULL; _isMessageListBusy = false; _messageValue = -1; SetUpdateHandler(&Scene::update); SetMessageHandler(&Scene::handleMessage); _vm->_screen->clearRenderQueue(); }
void AsDiskplayerSceneKey::stDropKey() { startAnimation(0x100B90B4, 0, -1); SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsDiskplayerSceneKey::handleMessage); NextState(&AsDiskplayerSceneKey::stDropKeyDone); setVisible(true); }
Palette::Palette(NeverhoodEngine *vm, uint32 fileHash) : Entity(vm, 0) { PaletteResource paletteResource(_vm); init(); paletteResource.load(fileHash); paletteResource.copyPalette(_palette); SetUpdateHandler(&Palette::update); }
Scene1907::Scene1907(NeverhoodEngine *vm, Module *parentModule) : Scene(vm, parentModule), _currMovingSymbolIndex(0), _pluggedInCount(0), _moveDownCountdown(0), _moveUpCountdown(0), _countdown3(0), _hasPlugInFailed(false) { setBackground(0x20628E05); setPalette(0x20628E05); for (int i = 0; i < 9; i++) _positionFree[i] = true; for (int i = 0; i < 9; i++) { _asSymbols[i] = insertSprite<AsScene1907Symbol>(this, i, getRandomPositionIndex()); addCollisionSprite(_asSymbols[i]); } _ssUpDownButton = insertSprite<SsScene1907UpDownButton>(this, _asSymbols[8]); addCollisionSprite(_ssUpDownButton); _asWaterHint = insertSprite<AsScene1907WaterHint>(); insertPuzzleMouse(0x28E0120E, 20, 620); SetMessageHandler(&Scene1907::handleMessage); SetUpdateHandler(&Scene1907::update); if (getGlobalVar(V_STAIRS_PUZZLE_SOLVED)) _pluggedInCount = 9; loadSound(0, 0x72004A10); loadSound(1, 0x22082A12); loadSound(2, 0x21100A10); loadSound(3, 0x68E25540); }
void Module1500::createScene(int sceneNum, int which) { debug(1, "Module1500::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: _vm->gameState().sceneNum = 0; _childObject = new Scene1501(_vm, this, 0x8420221D, 0xA61024C4, 150, 48); break; case 1: _vm->gameState().sceneNum = 1; _childObject = new Scene1501(_vm, this, 0x30050A0A, 0x58B45E58, 110, 48); break; case 2: _vm->gameState().sceneNum = 2; sendMessage(_parentModule, 0x0800, 0); createSmackerScene(0x001A0005, true, true, true); break; case 3: _vm->gameState().sceneNum = 3; _childObject = new Scene1501(_vm, this, 0x0CA04202, 0, 110, 48); break; } SetUpdateHandler(&Module1500::updateScene); _childObject->handleUpdate(); }
void Scene1105::upClosePanel() { Scene::update(); if (_backgroundIndex != 0) { _backgroundIndex--; if (_backgroundIndex == 14) { showMouse(false); _ssSymbols[0]->hide(); _ssSymbols[1]->hide(); _ssSymbols[2]->hide(); _ssSymbolDice[0]->hide(); _ssSymbolDice[1]->hide(); _ssSymbolDice[2]->hide(); } if (_backgroundIndex < 6 && _backgroundIndex % 2 == 0) { uint32 backgroundFileHash = kScene1105BackgroundFileHashes[3 - _backgroundIndex / 2]; // CHECKME if (_backgroundIndex == 4) { playSound(1); _asTeddyBear->hide(); } changeBackground(backgroundFileHash); _palette->addPalette(backgroundFileHash, 0, 256, 0); } if (_backgroundIndex == 0) { SetUpdateHandler(&Scene1105::update); _isClosePanelDone = true; } } }
NavigationScene::NavigationScene(NeverhoodEngine *vm, Module *parentModule, uint32 navigationListId, int navigationIndex, const byte *itemsTypes) : Scene(vm, parentModule), _itemsTypes(itemsTypes), _navigationIndex(navigationIndex), _smackerDone(false), _isWalkingForward(false), _isTurning(false), _smackerFileHash(0), _interactive(true), _leaveSceneAfter(false) { _navigationList = _vm->_staticData->getNavigationList(navigationListId); _navigationListId = navigationListId; if (_navigationIndex < 0) { _navigationIndex = (int)getGlobalVar(V_NAVIGATION_INDEX); if (_navigationIndex >= (int)_navigationList->size()) _navigationIndex = 0; } setGlobalVar(V_NAVIGATION_INDEX, _navigationIndex); SetUpdateHandler(&NavigationScene::update); SetMessageHandler(&NavigationScene::handleMessage); _smackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, (*_navigationList)[_navigationIndex].fileHash, true, true)); createMouseCursor(); _vm->_screen->clear(); _vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder()); sendMessage(_parentModule, 0x100A, _navigationIndex); }
Palette::Palette(NeverhoodEngine *vm, const char *filename) : Entity(vm, 0) { PaletteResource paletteResource(_vm); init(); paletteResource.load(calcHash(filename)); paletteResource.copyPalette(_palette); SetUpdateHandler(&Palette::update); }
AsCommonCarShadow::AsCommonCarShadow(NeverhoodEngine *vm, AnimatedSprite *asCar, BaseSurface *shadowSurface, uint index) : AnimatedSprite(vm, 1100), _asCar(asCar), _index(index), _animFileHash(0) { SetUpdateHandler(&AsCommonCarShadow::update); createShadowSurface(shadowSurface, 211, 147, 100); updateShadow(); }
void AsScene1306Elevator::stGoingUp() { setVisible(true); _isDown = false; startAnimation(0x043B0270, 0, -1); playSound(0); SetUpdateHandler(&AsScene1306Elevator::update); NextState(&AsScene1306Elevator::cbGoingUpEvent); }
void KmScene2401::stContSpitIntoPipe() { _canSpitPipe = true; _acceptInput = true; startAnimationByHash(0x1808B150, 0x16401CA6, 0); SetUpdateHandler(&Klaymen::update); SetMessageHandler(&KmScene2401::hmSpit); SetSpriteUpdate(NULL); }
SsScene1105Button::SsScene1105Button(NeverhoodEngine *vm, Scene *parentScene, uint32 fileHash, NRect &collisionBounds) : StaticSprite(vm, fileHash, 200), _parentScene(parentScene), _countdown(0) { _collisionBounds = collisionBounds; SetMessageHandler(&SsScene1105Button::handleMessage); SetUpdateHandler(&SsScene1105Button::update); setVisible(false); }
void AsScene1306Elevator::cbGoingUpEvent() { sendMessage(_parentScene, 0x4808, 0); _isUp = true; _countdown = 144; stopAnimation(); setVisible(false); SetUpdateHandler(&AsScene1306Elevator::update); }
AsScene2101HitByDoorEffect::AsScene2101HitByDoorEffect(NeverhoodEngine *vm, Sprite *klaymen) : AnimatedSprite(vm, 1400), _klaymen(klaymen) { SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene2101HitByDoorEffect::handleMessage); createSurface(1200, 88, 165); setVisible(false); }
AsCommonCarConnectorShadow::AsCommonCarConnectorShadow(NeverhoodEngine *vm, Sprite *asCar, BaseSurface *shadowSurface, uint index) : AnimatedSprite(vm, 1100), _asCar(asCar), _index(index) { SetUpdateHandler(&AsCommonCarConnectorShadow::update); createShadowSurface1(shadowSurface, 0x60281C10, 150); startAnimation(0x60281C10, -1, -1); _newStickFrameIndex = STICK_LAST_FRAME; }
AsCommonCarTrackShadow::AsCommonCarTrackShadow(NeverhoodEngine *vm, Sprite *asCar, BaseSurface *shadowSurface, int16 frameIndex) : AnimatedSprite(vm, 1100), _asCar(asCar) { SetUpdateHandler(&AsCommonCarTrackShadow::update); createShadowSurface1(shadowSurface, 0x0759129C, 100); startAnimation(0x0759129C, frameIndex, -1); _newStickFrameIndex = frameIndex; }
void KmScene2101::stHitByDoor() { _busyStatus = 1; _acceptInput = false; startAnimation(0x35AA8059, 0, -1); SetUpdateHandler(&Klaymen::update); SetMessageHandler(&KmScene2101::hmHitByDoor); SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); playSound(0, 0x402E82D4); }
void Module1600::createScene(int sceneNum, int which) { debug(1, "Module1600::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: _vm->gameState().sceneNum = 0; createNavigationScene(0x004B39D0, which); break; case 1: _vm->gameState().sceneNum = 1; createNavigationScene(0x004B3A30, which); break; case 2: _vm->gameState().sceneNum = 2; createNavigationScene(0x004B3A60, which); break; case 3: _vm->gameState().sceneNum = 3; createNavigationScene(0x004B3A90, which); break; case 4: _vm->gameState().sceneNum = 4; createNavigationScene(0x004B3B20, which); break; case 5: _vm->gameState().sceneNum = 5; createNavigationScene(0x004B3B50, which); break; case 6: _vm->gameState().sceneNum = 6; createNavigationScene(0x004B3B80, which); break; case 7: _vm->gameState().sceneNum = 7; _childObject = new Scene1608(_vm, this, which); break; case 8: _vm->gameState().sceneNum = 8; _childObject = new Scene1609(_vm, this); break; case 1001: _vm->gameState().sceneNum = 1; if (getGlobalVar(V_TALK_COUNTING_INDEX) == 1) createSmackerScene(0x80050200, true, true, false); else if (getGlobalVar(V_TALK_COUNTING_INDEX) == 2) createSmackerScene(0x80090200, true, true, false); else createSmackerScene(0x80000200, true, true, false); if (getGlobalVar(V_TALK_COUNTING_INDEX) >= 2) setGlobalVar(V_TALK_COUNTING_INDEX, 0); else incGlobalVar(V_TALK_COUNTING_INDEX, +1); break; } SetUpdateHandler(&Module1600::updateScene); _childObject->handleUpdate(); }
SsScene1105OpenButton::SsScene1105OpenButton(NeverhoodEngine *vm, Scene *parentScene) : StaticSprite(vm, 900), _parentScene(parentScene), _countdown(0), _isClicked(false) { loadSprite(0x8228A46C, kSLFDefDrawOffset | kSLFDefPosition | kSLFDefCollisionBoundsOffset, 400); setVisible(false); loadSound(0, 0x44045140); SetUpdateHandler(&SsScene1105OpenButton::update); SetMessageHandler(&SsScene1105OpenButton::handleMessage); }
SsScene3011Button::SsScene3011Button(NeverhoodEngine *vm, Scene *parentScene, bool flag) : StaticSprite(vm, 1400), _parentScene(parentScene), _countdown(0) { loadSprite(flag ? 0x11282020 : 0x994D0433, kSLFDefDrawOffset | kSLFDefPosition | kSLFDefCollisionBoundsOffset, 400); setVisible(false); loadSound(0, 0x44061000); SetUpdateHandler(&SsScene3011Button::update); SetMessageHandler(&SsScene3011Button::handleMessage); }
SsScene3009FireCannonButton::SsScene3009FireCannonButton(NeverhoodEngine *vm, Scene3009 *parentScene) : StaticSprite(vm, 1400), _parentScene(parentScene), _isClicked(false) { loadSprite(0x120B24B0, kSLFDefDrawOffset | kSLFDefPosition | kSLFDefCollisionBoundsOffset, 400); setVisible(false); SetUpdateHandler(&SsScene3009FireCannonButton::update); SetMessageHandler(&SsScene3009FireCannonButton::handleMessage); loadSound(0, 0x3901B44F); }
void AsScene1306Elevator::stGoingDown() { _isUp = false; setVisible(true); startAnimation(0x043B0270, -1, -1); _playBackwards = true; playSound(1); SetUpdateHandler(&AsScene1306Elevator::upGoingDown); NextState(&AsScene1306Elevator::cbGoingDownEvent); }
AsScene1308Mouse::AsScene1308Mouse(NeverhoodEngine *vm) : AnimatedSprite(vm, 1100) { _x = 286; _y = 429; createSurface1(0xA282C472, 100); startAnimation(0xA282C472, 0, -1); SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene1308Mouse::handleMessage); }
ZONE_CONTEXT_MENU() { SetIcon( add_zone_xpm ); SetUpdateHandler( boost::bind( &ZONE_CONTEXT_MENU::update, this ) ); Add( COMMON_ACTIONS::zoneFill ); Add( COMMON_ACTIONS::zoneFillAll ); Add( COMMON_ACTIONS::zoneUnfill ); Add( COMMON_ACTIONS::zoneUnfillAll ); Add( COMMON_ACTIONS::zoneMerge ); }
AnimatedSprite::AnimatedSprite(NeverhoodEngine *vm, uint32 fileHash, int surfacePriority, int16 x, int16 y) : Sprite(vm, 1100), _animResource(vm) { init(); SetUpdateHandler(&AnimatedSprite::update); createSurface1(fileHash, surfacePriority); _x = x; _y = y; startAnimation(fileHash, 0, -1); }
SsScene3009SymbolEdges::SsScene3009SymbolEdges(NeverhoodEngine *vm, int index) : StaticSprite(vm, 1400), _blinkCountdown(0) { loadSprite(kSsScene3009SymbolEdgesFileHashes[index], kSLFDefDrawOffset | kSLFDefPosition, 600); if (getGlobalVar(V_ROBOT_HIT)) hide(); else startBlinking(); SetUpdateHandler(&SsScene3009SymbolEdges::update); }
void KmScene1305::stCrashDown() { playSound(0, 0x41648271); _busyStatus = 1; _acceptInput = false; startAnimationByHash(0x000BAB02, 0x88003000, 0); SetUpdateHandler(&Klaymen::update); SetSpriteUpdate(NULL); SetMessageHandler(&Klaymen::hmLowLevelAnimation); NextState(&KmScene1305::stCrashDownFinished); }