diff options
Diffstat (limited to 'engines/tsage/ringworld2')
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_dialogs.cpp | 4 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.cpp | 1325 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.h | 176 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes0.cpp | 5384 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes0.h | 636 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes1.cpp | 14622 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes1.h | 1242 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes2.cpp | 2298 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes2.h | 293 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes3.cpp | 5603 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes3.h | 868 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_speakers.cpp | 2546 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_speakers.h | 532 |
13 files changed, 34894 insertions, 635 deletions
diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp index ddb4eae9c4..30ae6be7b1 100644 --- a/engines/tsage/ringworld2/ringworld2_dialogs.cpp +++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp @@ -153,7 +153,7 @@ void RightClickDialog::execute() { } g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); } // Execute the specified action @@ -389,7 +389,7 @@ HelpDialog::HelpDialog() { _msgTitle._bounds.moveTo(5, 0); _msgVersion.set(GAME_VERSION, 172, ALIGN_CENTER); _msgVersion._bounds.moveTo(5, _msgTitle._bounds.bottom + 3); - addElements(&_msgTitle, &_msgVersion, NULL); + addElements(&_msgTitle, &_msgVersion, NULL); // Set buttons _btnList[0].setText(F2); diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index dca3dcead5..a06899fe5a 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -27,142 +27,255 @@ #include "tsage/ringworld2/ringworld2_logic.h" #include "tsage/ringworld2/ringworld2_dialogs.h" #include "tsage/ringworld2/ringworld2_scenes0.h" +#include "tsage/ringworld2/ringworld2_scenes1.h" #include "tsage/ringworld2/ringworld2_scenes2.h" +#include "tsage/ringworld2/ringworld2_scenes3.h" namespace TsAGE { namespace Ringworld2 { Scene *Ringworld2Game::createScene(int sceneNumber) { + warning("Switching to scene %d", sceneNumber); + switch (sceneNumber) { /* Scene group #0 */ - // - case 50: return new Scene50(); - // Quinn's room - case 100: return new Scene100(); - // Computer console - case 125: return new Scene125(); - // + case 50: + // Waking up cutscene + return new Scene50(); + case 100: + // Quinn's room + return new Scene100(); + case 125: + // Computer console + return new Scene125(); case 150: + // Empty Bedroom #1 + return new Scene150(); case 160: + // Credits + return new Scene160(); case 175: + // Empty Bedroom #2 + return new Scene175(); case 180: - error("Missing scene %d from group 0", sceneNumber); + // Title Screen + return new Scene180(); case 200: - // Ship Corridor + // Deck #2 - By Lift return new Scene200(); case 205: + // Star-field Credits + return new Scene205(); case 250: - error("Missing scene %d from group 0", sceneNumber); + // Lift + return new Scene250(); case 300: + // Bridge return new Scene300(); case 325: + // Bridge Console + return new Scene325(); case 400: + // Science Lab + return new Scene400(); case 500: + // Lander Bay 2 Storage + return new Scene500(); case 525: + // Cutscene - Walking in hall + return new Scene525(); case 600: + return new Scene600(); case 700: + return new Scene700(); case 800: + // Sick bay + return new Scene800(); case 825: + // Autodoc + return new Scene825(); case 850: + // Deck #5 - By Lift + return new Scene850(); case 900: - error("Missing scene %d from group 0", sceneNumber); + return new Scene900(); /* Scene group #1 */ // case 1000: + error("Missing scene %d from group 1", sceneNumber); case 1010: + // Cutscene - trip in space + return new Scene1010(); case 1020: + return new Scene1020(); case 1100: + return new Scene1100(); case 1200: + return new Scene1200(); + case 1337: case 1330: + // Card Game + return new Scene1337(); case 1500: + // Cutscene: Ship landing + return new Scene1500(); case 1525: + // Cutscene - Ship + return new Scene1525(); case 1530: + // Cutscene - Elevator + return new Scene1530(); case 1550: + return new Scene1550(); case 1575: + return new Scene1575(); case 1580: + // Inside wreck + return new Scene1580(); case 1625: + // Miranda being questioned + return new Scene1625(); case 1700: + return new Scene1700(); case 1750: + return new Scene1750(); case 1800: + return new Scene1800(); case 1850: + return new Scene1850(); case 1875: + return new Scene1875(); case 1900: + return new Scene1900(); case 1925: + return new Scene1925(); case 1945: + return new Scene1945(); case 1950: - error("Missing scene %d from group 1", sceneNumber); + return new Scene1950(); /* Scene group #2 */ // case 2000: - // Maze + // Ice Maze return new Scene2000(); case 2350: - // Maze: Balloon Launch Platform + // Ice Maze: Balloon Launch Platform return new Scene2350(); case 2400: - // Maze: Large empty room + // Ice Maze: Large empty room return new Scene2400(); case 2425: - // Maze: + // Ice Maze: return new Scene2425(); case 2430: - // Maze: Bedroom + // Ice Maze: Bedroom return new Scene2430(); case 2435: - // Maze: Throne room + // Ice Maze: Throne room return new Scene2435(); case 2440: - // Maze: Another bedroom + // Ice Maze: Another bedroom return new Scene2440(); case 2445: - // Maze: + // Ice Maze: return new Scene2445(); case 2450: - // Maze: Another bedroom + // Ice Maze: Another bedroom return new Scene2450(); case 2455: - // Maze: Inside crevasse + // Ice Maze: Inside crevasse return new Scene2455(); case 2500: - // Maze: Large Cave + // Ice Maze: Large Cave return new Scene2500(); case 2525: + // Ice Maze: Furnace room + return new Scene2525(); case 2530: + // Ice Maze: Well + return new Scene2530(); case 2535: + // Ice Maze: Tannery + return new Scene2535(); case 2600: + // Ice Maze: Exit + return new Scene2600(); case 2700: + // Forest Maze + return new Scene2700(); case 2750: + // Forest Maze + return new Scene2750(); case 2800: + // Exiting Forest + return new Scene2800(); case 2900: error("Missing scene %d from group 2", sceneNumber); /* Scene group #3 */ // case 3100: + return new Scene3100(); case 3125: + // Ghouls dormitory + return new Scene3125(); case 3150: + // Jail + return new Scene3150(); case 3175: + // Autopsy room + return new Scene3175(); case 3200: + // Cutscene : Guards - Discussion + return new Scene3200(); case 3210: + // Cutscene : Captain and Private - Discussion + return new Scene3210(); case 3220: + // Cutscene : Guards in cargo zone + return new Scene3220(); case 3230: + // Cutscene : Guards on duty + return new Scene3230(); case 3240: + // Cutscene : Teal monolog + return new Scene3240(); case 3245: + // Cutscene : Discussions with Dr. Tomko + return new Scene3245(); case 3250: + // Room with large stasis field negator + return new Scene3250(); case 3255: + return new Scene3255(); case 3260: + // Computer room + return new Scene3260(); case 3275: + // Hall + return new Scene3275(); case 3350: + // Cutscene - Ship landing + return new Scene3350(); case 3375: + return new Scene3375(); case 3385: + return new Scene3385(); case 3395: + return new Scene3395(); case 3400: + return new Scene3400(); case 3500: + return new Scene3500(); case 3600: + return new Scene3600(); case 3700: + // Cutscene - Teleport outside + return new Scene3700(); case 3800: + return new Scene3800(); case 3900: - error("Missing scene %d from group 3", sceneNumber); + return new Scene3900(); default: error("Unknown scene number - %d", sceneNumber); break; @@ -173,14 +286,16 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { * Returns true if it is currently okay to restore a game */ bool Ringworld2Game::canLoadGameStateCurrently() { - return true; + // Don't allow a game to be loaded if a dialog is active + return g_globals->_gfxManagers.size() == 1; } /** * Returns true if it is currently okay to save the game */ bool Ringworld2Game::canSaveGameStateCurrently() { - return true; + // Don't allow a game to be saved if a dialog is active + return g_globals->_gfxManagers.size() == 1; } /*--------------------------------------------------------------------------*/ @@ -189,6 +304,8 @@ SceneExt::SceneExt(): Scene() { _stripManager._onBegin = SceneExt::startStrip; _stripManager._onEnd = SceneExt::endStrip; + for (int i = 0; i < 256; i++) + _field312[i] = 0; _field372 = _field37A = 0; _savedPlayerEnabled = false; _savedUiEnabled = false; @@ -206,6 +323,19 @@ void SceneExt::postInit(SceneObjectList *OwnerList) { _action = NULL; _field12 = 0; _sceneMode = 0; + + int prevScene = R2_GLOBALS._sceneManager._previousScene; + int sceneNumber = R2_GLOBALS._sceneManager._sceneNumber; + if (((prevScene == -1) && (sceneNumber != 180) && (sceneNumber != 205) && (sceneNumber != 50)) + || (sceneNumber == 50) + || ((prevScene == 205) && (sceneNumber == 100)) + || ((prevScene == 180) && (sceneNumber == 100))) { + static_cast<SceneHandlerExt *>(R2_GLOBALS._sceneHandler)->setupPaletteMaps(); + R2_GLOBALS._uiElements._active = true; + R2_GLOBALS._uiElements.show(); + } else { + R2_GLOBALS._uiElements.updateInventory(); + } } void SceneExt::remove() { @@ -248,7 +378,7 @@ void SceneExt::loadScene(int sceneNum) { (sceneNumber == 50) || ((prevScene == 205) && (sceneNumber == 100)) || ((prevScene == 180) && (sceneNumber == 100))) { // TODO: sub_17875 - R2_GLOBALS._v58CE2 = 1; + R2_GLOBALS._uiElements._active = true; R2_GLOBALS._uiElements.show(); } else { // Update the user interface @@ -256,9 +386,10 @@ void SceneExt::loadScene(int sceneNum) { } } -bool SceneExt::display(CursorType action) { +bool SceneExt::display(CursorType action, Event &event) { switch (action) { case CURSOR_CROSSHAIRS: + case CURSOR_WALK: return false; case CURSOR_LOOK: SceneItem::display2(1, R2_GLOBALS._randomSource.getRandomNumber(4)); @@ -269,10 +400,41 @@ bool SceneExt::display(CursorType action) { case CURSOR_TALK: SceneItem::display2(1, R2_GLOBALS._randomSource.getRandomNumber(4) + 10); break; + case R2_NEGATOR_GUN: + if (R2_GLOBALS.getFlag(1)) + SceneItem::display2(2, action); + else + SceneItem::display2(5, 0); + break; + case R2_SONIC_STUNNER: + if ((R2_GLOBALS._v565F1[1] == 2) || ((R2_GLOBALS._v565F1[1] == 1) && + (R2_GLOBALS._v565F1[2] == 2) && (R2_GLOBALS._sceneManager._previousScene == 300))) { + R2_GLOBALS._sound4.stop(); + R2_GLOBALS._sound3.play(46); + SceneItem::display2(5, 15); + } else { + R2_GLOBALS._sound3.play(43, 0); + SceneItem::display2(2, 0); + } + + R2_GLOBALS._sound4.play(45); + break; + case R2_COM_SCANNER: + case R2_COM_SCANNER_2: + R2_GLOBALS._sound3.play(44); + SceneItem::display2(2, action); + R2_GLOBALS._sound3.stop(); + break; + case R2_PHOTON_STUNNER: + R2_GLOBALS._sound3.play(99); + SceneItem::display2(2, action); + break; default: - return false; + SceneItem::display2(2, action); + break; } + event.handled = true; return true; } @@ -364,6 +526,37 @@ void SceneExt::saveCharacter(int characterIndex) { R2_GLOBALS._player._characterFrame[characterIndex] = R2_GLOBALS._player._frame; } +void SceneExt::scalePalette(int RFactor, int GFactor, int BFactor) { + byte *tmpPal = R2_GLOBALS._scenePalette._palette; + byte newR, newG, newB; + int tmp, varC, varD = 0; + + for (int i = 0; i < 256; i++) { + newR = (RFactor * tmpPal[(3 * i)]) / 100; + newG = (GFactor * tmpPal[(3 * i) + 1]) / 100; + newB = (BFactor * tmpPal[(3 * i) + 2]) / 100; + + varC = 769; + for (int j = 255; j >= 0; j--) { + tmp = abs(tmpPal[(3 * j)] - newR); + if (tmp >= varC) + continue; + + tmp += abs(tmpPal[(3 * j) + 1] - newG); + if (tmp >= varC) + continue; + + tmp += abs(tmpPal[(3 * j) + 2] - newB); + if (tmp >= varC) + continue; + + varC = tmp; + varD = j; + } + this->_field312[i] = varD; + } +} + /*--------------------------------------------------------------------------*/ void SceneHandlerExt::postInit(SceneObjectList *OwnerList) { @@ -371,7 +564,7 @@ void SceneHandlerExt::postInit(SceneObjectList *OwnerList) { } void SceneHandlerExt::process(Event &event) { - if (T2_GLOBALS._uiElements._active) { + if (T2_GLOBALS._uiElements._active && R2_GLOBALS._player._uiEnabled) { T2_GLOBALS._uiElements.process(event); if (event.handled) return; @@ -390,6 +583,96 @@ void SceneHandlerExt::process(Event &event) { SceneHandler::process(event); } +void SceneHandlerExt::setupPaletteMaps() { + byte *palP = &R2_GLOBALS._scenePalette._palette[0]; + + if (!R2_GLOBALS._v1000Flag) { + R2_GLOBALS._v1000Flag = true; + + for (int idx = 0; idx < 10; ++idx) { + for (int palIndex = 0; palIndex < 224; ++palIndex) { + int r, g, b; + + // Get adjusted RGB values + switch (idx) { + case 7: + r = palP[palIndex * 3] * 85 / 100; + g = palP[palIndex * 3 + 1] * 7 / 10; + b = palP[palIndex * 3 + 2] * 7 / 10; + break; + case 8: + r = palP[palIndex * 3] * 7 / 10; + g = palP[palIndex * 3 + 1] * 85 / 100; + b = palP[palIndex * 3 + 2] * 7 / 10; + break; + case 9: + r = palP[palIndex * 3] * 8 / 10; + g = palP[palIndex * 3 + 1] * 5 / 10; + b = palP[palIndex * 3 + 2] * 9 / 10; + break; + default: + r = palP[palIndex * 3] * (10 - idx) / 10; + g = palP[palIndex * 3 + 1] * (10 - idx) / 12; + b = palP[palIndex * 3 + 2] * (10 - idx) / 10; + break; + } + + // Scan for the palette index with the closest matching colour + int threshold = 769; + int foundIndex = -1; + for (int pIndex2 = 223; pIndex2 >= 0; --pIndex2) { + int diffSum = ABS(palP[pIndex2 * 3] - r); + if (diffSum >= threshold) + continue; + + diffSum += ABS(palP[pIndex2 * 3 + 1] - g); + if (diffSum >= threshold) + continue; + + diffSum += ABS(palP[pIndex2 * 3 + 2] - b); + if (diffSum >= threshold) + continue; + + threshold = diffSum; + foundIndex = pIndex2; + } + + R2_GLOBALS._palIndexList[idx][palIndex] = foundIndex; + } + } + } + + for (int palIndex = 0; palIndex < 224; ++palIndex) { + int r = palP[palIndex * 3] >> 2; + int g = palP[palIndex * 3 + 1] >> 2; + int b = palP[palIndex * 3 + 2] >> 2; + + int idx = (((r << 4) | g) << 4) | b; + R2_GLOBALS._v1000[idx] = palIndex; + } + + int vdx = 0; + int idx = 0; + int palIndex = 224; + + for (int vIndex = 0; vIndex < 4096; ++vIndex) { + int v = R2_GLOBALS._v1000[vIndex]; + if (!v) { + R2_GLOBALS._v1000[vIndex] = idx; + } else { + idx = v; + } + + if (!palIndex) { + vdx = palIndex; + } else { + int idxTemp = palIndex; + palIndex = (palIndex + vdx) / 2; + vdx = idxTemp; + } + } +} + /*--------------------------------------------------------------------------*/ DisplayHotspot::DisplayHotspot(int regionId, ...) { @@ -570,57 +853,57 @@ void Ringworld2InvObjectList::reset() { // Set up default inventory setObjectScene(R2_OPTO_DISK, 800); - setObjectScene(R2_2, 400); + setObjectScene(R2_READER, 400); setObjectScene(R2_NEGATOR_GUN, 100); setObjectScene(R2_STEPPING_DISKS, 100); - setObjectScene(R2_5, 400); - setObjectScene(R2_6, 400); - setObjectScene(R2_7, 500); - setObjectScene(R2_8, 700); - setObjectScene(R2_9, 800); - setObjectScene(R2_10, 100); - setObjectScene(R2_11, 400); - setObjectScene(R2_12, 500); - setObjectScene(R2_13, 1550); - setObjectScene(R2_14, 850); - setObjectScene(R2_15, 850); - setObjectScene(R2_16, 0); - setObjectScene(R2_17, 1550); - setObjectScene(R2_18, 1550); - setObjectScene(R2_19, 1550); - setObjectScene(R2_20, 500); - setObjectScene(R2_21, 500); - setObjectScene(R2_22, 1550); - setObjectScene(R2_23, 1580); - setObjectScene(R2_24, 9999); - setObjectScene(R2_25, 1550); - setObjectScene(R2_26, 1550); - setObjectScene(R2_27, 1580); - setObjectScene(R2_28, 1550); - setObjectScene(R2_29, 2525); - setObjectScene(R2_30, 2440); - setObjectScene(R2_31, 2455); - setObjectScene(R2_32, 2535); - setObjectScene(R2_33, 2530); - setObjectScene(R2_34, 1950); - setObjectScene(R2_35, 1950); - setObjectScene(R2_36, 9999); - setObjectScene(R2_37, 2430); - setObjectScene(R2_38, 9999); - setObjectScene(R2_39, 2); - setObjectScene(R2_40, 9999); - setObjectScene(R2_41, 3150); - setObjectScene(R2_42, 0); - setObjectScene(R2_43, 3260); - setObjectScene(R2_44, 2); - setObjectScene(R2_45, 1550); - setObjectScene(R2_46, 0); - setObjectScene(R2_47, 3150); - setObjectScene(R2_48, 2435); - setObjectScene(R2_49, 2440); - setObjectScene(R2_50, 2435); - setObjectScene(R2_51, 1580); - setObjectScene(R2_52, 3260); + setObjectScene(R2_ATTRACTOR_UNIT, 400); + setObjectScene(R2_SENSOR_PROBE, 400); + setObjectScene(R2_SONIC_STUNNER, 500); + setObjectScene(R2_CABLE_HARNESS, 700); + setObjectScene(R2_COM_SCANNER, 800); + setObjectScene(R2_SPENT_POWER_CAPSULE, 100); + setObjectScene(R2_CHARGED_POWER_CAPSULE, 400); + setObjectScene(R2_AEROSOL, 500); + setObjectScene(R2_REMOTE_CONTROL, 1550); + setObjectScene(R2_OPTICAL_FIBRE, 850); + setObjectScene(R2_CLAMP, 850); + setObjectScene(R2_ATTRACTOR_CABLE_HARNESS, 0); + setObjectScene(R2_FUEL_CELL, 1550); + setObjectScene(R2_GYROSCOPE, 1550); + setObjectScene(R2_AIRBAG, 1550); + setObjectScene(R2_REBREATHER_TANK, 500); + setObjectScene(R2_RESERVE_REBREATHER_TANK, 500); + setObjectScene(R2_GUIDANCE_MODULE, 1550); + setObjectScene(R2_THRUSTER_VALVE, 1580); + setObjectScene(R2_BALLOON_BACKPACK, 9999); + setObjectScene(R2_RADAR_MECHANISM, 1550); + setObjectScene(R2_JOYSTICK, 1550); + setObjectScene(R2_IGNITOR, 1580); + setObjectScene(R2_DIAGNOSTICS_DISPLAY, 1550); + setObjectScene(R2_GLASS_DOME, 2525); + setObjectScene(R2_WICK_LAMP, 2440); + setObjectScene(R2_SCRITH_KEY, 2455); + setObjectScene(R2_TANNER_MASK, 2535); + setObjectScene(R2_PURE_GRAIN_ALCOHOL, 2530); + setObjectScene(R2_SAPPHIRE_BLUE, 1950); + setObjectScene(R2_ANCIENT_SCROLLS, 1950); + setObjectScene(R2_FLUTE, 9999); + setObjectScene(R2_GUNPOWDER, 2430); + setObjectScene(R2_NONAME, 9999); + setObjectScene(R2_COM_SCANNER_2, 2); + setObjectScene(R2_SUPERCONDUCTOR_WIRE, 9999); + setObjectScene(R2_PILLOW, 3150); + setObjectScene(R2_FOOD_TRAY, 0); + setObjectScene(R2_LASER_HACKSAW, 3260); + setObjectScene(R2_PHOTON_STUNNER, 2); + setObjectScene(R2_BATTERY, 1550); + setObjectScene(R2_SOAKED_FACEMASK, 0); + setObjectScene(R2_LIGHT_BULB, 3150); + setObjectScene(R2_ALCOHOL_LAMP, 2435); + setObjectScene(R2_ALCOHOL_LAMP_2, 2440); + setObjectScene(R2_ALCOHOL_LAMP_3, 2435); + setObjectScene(R2_BROKEN_DISPLAY, 1580); + setObjectScene(R2_TOOLBOX, 3260); } void Ringworld2InvObjectList::setObjectScene(int objectNum, int sceneNumber) { @@ -793,81 +1076,13 @@ bool NamedHotspot::startAction(CursorType action, Event &event) { } } -void NamedHotspot::setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum) { - setBounds(ys, xe, ye, xs); - _resNum = resnum; - _lookLineNum = lookLineNum; - _useLineNum = useLineNum; - _talkLineNum = -1; - g_globals->_sceneItems.addItems(this, NULL); -} - -void NamedHotspot::setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) { - setBounds(bounds); - _resNum = resNum; - _lookLineNum = lookLineNum; - _talkLineNum = talkLineNum; - _useLineNum = useLineNum; - - switch (mode) { - case 2: - g_globals->_sceneItems.push_front(this); - break; - case 4: - g_globals->_sceneItems.addBefore(item, this); - break; - case 5: - g_globals->_sceneItems.addAfter(item, this); - break; - default: - g_globals->_sceneItems.push_back(this); - break; - } -} - -void NamedHotspot::setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode) { - _sceneRegionId = sceneRegionId; - _resNum = resNum; - _lookLineNum = lookLineNum; - _talkLineNum = talkLineNum; - _useLineNum = useLineNum; - - // Handle adding hotspot to scene items list as necessary - switch (mode) { - case 2: - GLOBALS._sceneItems.push_front(this); - break; - case 3: - break; - default: - GLOBALS._sceneItems.push_back(this); - break; - } -} - -void NamedHotspot::synchronize(Serializer &s) { - SceneHotspot::synchronize(s); - s.syncAsSint16LE(_resNum); - s.syncAsSint16LE(_lookLineNum); - s.syncAsSint16LE(_useLineNum); - - if (g_vm->getGameID() == GType_BlueForce) - s.syncAsSint16LE(_talkLineNum); -} +/*--------------------------------------------------------------------------*/ void SceneActor::postInit(SceneObjectList *OwnerList) { _lookLineNum = _talkLineNum = _useLineNum = -1; SceneObject::postInit(); } -void SceneActor::synchronize(Serializer &s) { - SceneObject::synchronize(s); - s.syncAsSint16LE(_resNum); - s.syncAsSint16LE(_lookLineNum); - s.syncAsSint16LE(_talkLineNum); - s.syncAsSint16LE(_useLineNum); -} - bool SceneActor::startAction(CursorType action, Event &event) { bool handled = true; @@ -896,39 +1111,10 @@ bool SceneActor::startAction(CursorType action, Event &event) { } if (!handled) - handled = ((SceneExt *)R2_GLOBALS._sceneManager._scene)->display(action); + handled = ((SceneExt *)R2_GLOBALS._sceneManager._scene)->display(action, event); return handled; } -void SceneActor::setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) { - _resNum = resNum; - _lookLineNum = lookLineNum; - _talkLineNum = talkLineNum; - _useLineNum = useLineNum; - - switch (mode) { - case 2: - g_globals->_sceneItems.push_front(this); - break; - case 4: - g_globals->_sceneItems.addBefore(item, this); - break; - case 5: - g_globals->_sceneItems.addAfter(item, this); - break; - default: - g_globals->_sceneItems.push_back(this); - break; - } -} - -void SceneActor::setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { - _resNum = resNum; - _lookLineNum = lookLineNum; - _talkLineNum = talkLineNum; - _useLineNum = useLineNum; -} - /*--------------------------------------------------------------------------*/ SceneArea::SceneArea(): EventHandler() { @@ -1032,6 +1218,789 @@ void SceneExit::process(Event &event) { } } +/*--------------------------------------------------------------------------*/ + +void SceneAreaObject::remove() { + _object1.remove(); + SceneArea::remove(); + --R2_GLOBALS._insetUp; +} + +void SceneAreaObject::process(Event &event) { + if (_insetCount == R2_GLOBALS._insetUp) { + CursorType cursor = R2_GLOBALS._events.getCursor(); + + if (_bounds.contains(event.mousePos)) { + // Cursor moving in bounded area + if (cursor == _cursorNum) { + R2_GLOBALS._events.setCursor(_savedCursorNum); + } + } else if (event.mousePos.y < 168) { + if (_cursorNum != cursor) + // Cursor moved outside bounded area + R2_GLOBALS._events.setCursor(_savedCursorNum); + + if (event.eventType == EVENT_BUTTON_DOWN) { + R2_GLOBALS._events.setCursor(_savedCursorNum); + event.handled = true; + } + } + } +} + +void SceneAreaObject::setDetails(int visage, int strip, int frameNumber, const Common::Point &pt) { + _object1.postInit(); + _object1.setup(visage, strip, frameNumber); + _object1.setPosition(pt); + _object1.fixPriority(250); + + _cursorNum = CURSOR_INVALID; + Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; + scene->_sceneAreas.push_front(this); + + _insetCount = ++R2_GLOBALS._insetUp; +} + +void SceneAreaObject::setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { + ((SceneHotspot *)(this))->setDetails(resNum, lookLineNum, talkLineNum, useLineNum, + 2, (SceneItem *)NULL); +} + +/*****************************************************************************/ + +UnkObject1200::UnkObject1200() { + _field16 = _field3A = NULL; + _field12 = _field14 = 0; + _field26 = _field28 = _field2A = _field2C = _field2E = _field30 = 0; + _field32 = _field34 = _field36 = _field38 = _field3E = _field40 = 0; +} + +void UnkObject1200::synchronize(Serializer &s) { + SavedObject::synchronize(s); + + _rect1.synchronize(s); + _rect2.synchronize(s); + + // FIXME: syncrhonize _field16 and _field3A + + s.syncAsSint16LE(_field12); + s.syncAsSint16LE(_field14); + s.syncAsSint16LE(_field26); + s.syncAsSint16LE(_field28); + s.syncAsSint16LE(_field2A); + s.syncAsSint16LE(_field2C); + s.syncAsSint16LE(_field2E); + s.syncAsSint16LE(_field30); + s.syncAsSint16LE(_field32); + s.syncAsSint16LE(_field34); + s.syncAsSint16LE(_field36); + s.syncAsSint16LE(_field38); + s.syncAsSint16LE(_field3E); + s.syncAsSint16LE(_field40); +} + +void UnkObject1200::sub51AE9(int arg1) { + warning("STUB: UnkObject1200::sub51AE9()"); +} + +int UnkObject1200::sub51AF8(Common::Point pt) { + if (!_rect1.contains(pt)) + return -1; + + int tmp1 = (pt.x - _rect1.left + _field2E) / _field2A; + int tmp2 = (pt.y - _rect1.top + _field30) / _field2C; + + if ((tmp1 >= 0) && (tmp2 >= 0) && (_field26 > tmp1) && (_field28 > tmp2)) + return _field16[(((_field26 * tmp2) + tmp1)* 2)]; + + return -1; +} + +bool UnkObject1200::sub51AFD(Common::Point pt) { + int retval = false; + + _field2E = pt.x; + _field30 = pt.y; + + if (_field2E < _rect2.top) { + _field2E = _rect2.top; + retval = true; + } + + if (_field30 < _rect2.left) { + _field30 = _rect2.left; + retval = true; + } + + if (_field2E + _rect1.width() > _rect2.right) { + _field2E = _rect2.right - _rect1.width(); + retval = true; + } + + if (_field30 + _rect1.height() > _rect2.bottom) { + _field30 = _rect2.bottom - _rect1.height(); + retval = true; + } + + return retval; +} + +void UnkObject1200::sub51B02() { + warning("STUB: UnkObject1200::sub51B02()"); +} + +void UnkObject1200::sub9EDE8(Rect rect) { + _rect1 = rect; + warning("FIXME: UnkObject1200::sub9EDE8()"); +// _rect1.clip(g_globals->gfxManager()._bounds); +} + +int UnkObject1200::sub9EE22(int &arg1, int &arg2) { + arg1 /= _field2A; + arg2 /= _field2C; + + if ((arg1 >= 0) && (arg2 >= 0) && (_field26 > arg1) && (_field28 > arg2)) { + return _field16[(((_field26 * arg2) + arg1) * 2)]; + } + + return -1; +} + +void Scene1200::sub9DAD6(int indx) { + _object1.sub9EE22(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); + + switch (indx) { + case 0: + if ( ((_object1.sub51AF8(Common::Point(200, 50)) > 36) || (_object1.sub51AF8(Common::Point(200, 88)) > 36)) + && ( ((R2_GLOBALS._v56AA2 == 3) && (R2_GLOBALS._v56AA4 == 33) && (_field418 != 4)) + || ((R2_GLOBALS._v56AA2 == 13) && (R2_GLOBALS._v56AA4 == 21) && (_field418 != 2)) + || ((R2_GLOBALS._v56AA2 == 29) && (R2_GLOBALS._v56AA4 == 17) && (_field418 != 1)) + || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 41)) ) + ) { + R2_GLOBALS._player.disableControl(); + _sceneMode = 1200; + setAction(&_sequenceManager, this, 1200, &_actor1, NULL); + } else if (_object1.sub51AF8(Common::Point(200, 69)) == 36) { + switch (_field412 - 1) { + case 0: + if (R2_GLOBALS._player._visage == 3155) + _sceneMode = 15; + else + _sceneMode = 10; + break; + case 1: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 76; + else + _sceneMode = 75; + break; + case 2: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 101; + else + _sceneMode = 100; + break; + case 3: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 111; + else + _sceneMode = 110; + break; + default: + break; + } + R2_GLOBALS._player.disableControl(); + _field412 = 1; + signal(); + } + break; + case 1: + if ( ((_object1.sub51AF8(Common::Point(120, 50)) > 36) || (_object1.sub51AF8(Common::Point(120, 88)) > 36)) + && ( ((R2_GLOBALS._v56AA2 == 7) && (R2_GLOBALS._v56AA4 == 33) && (_field418 != 4)) + || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 21) && (_field418 != 2)) + || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 17) && (_field418 != 1)) + || ((R2_GLOBALS._v56AA2 == 5) && (R2_GLOBALS._v56AA4 == 5)) ) + ) { + R2_GLOBALS._player.disableControl(); + _sceneMode = 1201; + setAction(&_sequenceManager, this, 1201, &_actor1, NULL); + } else if (_object1.sub51AF8(Common::Point(120, 69)) == 36) { + switch (_field412 - 1) { + case 0: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 56; + else + _sceneMode = 55; + break; + case 1: + if (R2_GLOBALS._player._visage == 3155) + _sceneMode = 25; + else + _sceneMode = 20; + break; + case 2: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 91; + else + _sceneMode = 90; + break; + case 3: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 121; + else + _sceneMode = 120; + break; + default: + break; + } + R2_GLOBALS._player.disableControl(); + _field412 = 2; + signal(); + } + break; + case 2: + if ( ((_object1.sub51AF8(Common::Point(140, 110)) > 36) || (_object1.sub51AF8(Common::Point(178, 110)) > 36)) + && ( ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 5) && (_field418 != 3)) + || ((R2_GLOBALS._v56AA2 == 41) && (R2_GLOBALS._v56AA4 == 21)) ) + ) { + R2_GLOBALS._player.disableControl(); + _sceneMode = 1203; + setAction(&_sequenceManager, this, 1203, &_actor1, NULL); + } else if (_object1.sub51AF8(Common::Point(160, 110)) == 36) { + switch (_field412 - 1) { + case 0: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 51; + else + _sceneMode = 50; + break; + case 1: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 81; + else + _sceneMode = 80; + break; + case 2: + if (R2_GLOBALS._player._visage == 3155) + _sceneMode = 35; + else + _sceneMode = 30; + break; + case 3: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 116; + else + _sceneMode = 115; + break; + default: + break; + } + R2_GLOBALS._player.disableControl(); + _field412 = 3; + signal(); + } + break; + case 3: + if ( ((_object1.sub51AF8(Common::Point(140, 30)) > 36) || (_object1.sub51AF8(Common::Point(178, 30)) > 36)) + && ( ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 9) && (_field418 != 3)) + || ((R2_GLOBALS._v56AA2 == 35) && (R2_GLOBALS._v56AA4 == 17)) ) + ) { + R2_GLOBALS._player.disableControl(); + _sceneMode = 1202; + setAction(&_sequenceManager, this, 1202, &_actor1, NULL); + } else if (_object1.sub51AF8(Common::Point(160, 30)) == 36) { + switch (_field412 - 1) { + case 0: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 61; + else + _sceneMode = 60; + break; + case 1: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 71; + else + _sceneMode = 70; + break; + case 2: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 96; + else + _sceneMode = 95; + break; + case 3: + if (R2_GLOBALS._player._visage == 3155) + _sceneMode = 45; + else + _sceneMode = 40; + break; + default: + _sceneMode = 1; + R2_GLOBALS._player.setup(3156, 4, 6); + break; + } + R2_GLOBALS._player.disableControl(); + _field412 = 4; + signal(); + } + break; + default: + break; + } +} + +/*--------------------------------------------------------------------------*/ + +void AnimationSlice::load(Common::File &f) { + f.skip(2); + _sliceOffset = f.readUint16LE(); + f.skip(6); + _drawMode = f.readByte(); + _secondaryIndex = f.readByte(); +} + +/*--------------------------------------------------------------------------*/ + +AnimationSlices::AnimationSlices() { + _pixelData = NULL; +} + +AnimationSlices::~AnimationSlices() { + delete[] _pixelData; +} + +void AnimationSlices::load(Common::File &f) { + f.skip(4); + _dataSize = f.readUint32LE(); + f.skip(8); + _dataSize2 = f.readUint32LE(); + f.skip(28); + + // Load the four slice indexes + for (int idx = 0; idx < 4; ++idx) + _slices[idx].load(f); +} + +int AnimationSlices::loadPixels(Common::File &f, int slicesSize) { + delete[] _pixelData; + _pixelData = new byte[slicesSize]; + return f.read(_pixelData, slicesSize); +} + +/*--------------------------------------------------------------------------*/ + +void AnimationPlayerSubData::load(Common::File &f) { + uint32 posStart = f.pos(); + + f.skip(6); + _duration = f.readUint32LE(); + _frameRate = f.readUint16LE(); + _framesPerSlices = f.readUint16LE(); + _drawType = f.readUint16LE(); + f.skip(2); + _sliceSize = f.readUint16LE(); + _ySlices = f.readUint16LE(); + _field16 = f.readUint32LE(); + f.skip(2); + _palStart = f.readUint16LE(); + _palSize = f.readUint16LE(); + f.read(_palData, 768); + _totalSize = f.readSint32LE(); + f.skip(12); + _slices.load(f); + + uint32 posEnd = f.pos(); + assert((posEnd - posStart) == 0x390); +} + +/*--------------------------------------------------------------------------*/ + +AnimationPlayer::AnimationPlayer(): EventHandler() { + _endAction = NULL; + + _animData1 = NULL; + _animData2 = NULL; + + _screenBounds = R2_GLOBALS._gfxManagerInstance._bounds; + _rect1 = R2_GLOBALS._gfxManagerInstance._bounds; + _paletteMode = ANIMPALMODE_REPLACE_PALETTE; + _field3A = 1; + _sliceHeight = 1; + _field58 = 1; + _endAction = NULL; +} + +AnimationPlayer::~AnimationPlayer() { + if (!isCompleted()) + close(); +} + +void AnimationPlayer::synchronize(Serializer &s) { + EventHandler::synchronize(s); + warning("TODO AnimationPlayer::load"); +} + +void AnimationPlayer::remove() { + if (_endAction) + _endAction->signal(); + + _endAction = NULL; +} + +void AnimationPlayer::process(Event &event) { + if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE) && + (_field3A)) { + // Move the current position to the end + _position = _subData._duration; + } +} + +void AnimationPlayer::dispatch() { + uint32 gameFrame = R2_GLOBALS._events.getFrameNumber(); + uint32 gameDiff = gameFrame - _gameFrame; + + if (gameDiff >= _frameDelay) { + drawFrame(_playbackTick % _subData._framesPerSlices); + ++_playbackTick; + _position = _playbackTick / _subData._framesPerSlices; + + if (_position == _nextSlicesPosition) + nextSlices(); + + _playbackTickPrior = _playbackTick; + _gameFrame = gameFrame; + } +} + +bool AnimationPlayer::load(int animId, Action *endAction) { + // Open up the main resource file for access + TLib &libFile = g_resourceManager->first(); + if (!_resourceFile.open(libFile.getFilename())) + error("Could not open resource"); + + // Get the offset of the given resource and seek to it in the player's file reference + ResourceEntry entry; + uint32 fileOffset = libFile.getResourceStart(RES_IMAGE, animId, 0, entry); + _resourceFile.seek(fileOffset); + + // At this point, the file is pointing to the start of the resource data + + // Set the end action + _endAction = endAction; + + // Load the sub data block + _subData.load(_resourceFile); + + // Set other properties + _playbackTickPrior = -1; + _playbackTick = 0; + + // The final multiplication is used to deliberately slow down playback, since the original + // was slowed down by the amount of time spent to decode and display the frames + _frameDelay = (60 / _subData._frameRate) * 8; + _gameFrame = R2_GLOBALS._events.getFrameNumber(); + + if (_subData._totalSize) { + _dataNeeded = _subData._totalSize; + } else { + int v = (_subData._sliceSize + 2) * _subData._ySlices * _subData._framesPerSlices; + _dataNeeded = (_subData._field16 / _subData._framesPerSlices) + v + 96; + } + + debugC(1, ktSageDebugGraphics, "Data needed %d", _dataNeeded); + + // Set up animation data objects + _animData1 = new AnimationData(); + _sliceCurrent = _animData1; + + if (_subData._framesPerSlices <= 1) { + _animData2 = NULL; + _sliceNext = _sliceCurrent; + } else { + _animData2 = new AnimationData(); + _sliceNext = _animData2; + } + + _position = 0; + _nextSlicesPosition = 1; + + // Load up the first slices set + _sliceCurrent->_dataSize = _subData._slices._dataSize; + _sliceCurrent->_slices = _subData._slices; + int slicesSize = _sliceCurrent->_dataSize - 96; + int readSize = _sliceCurrent->_slices.loadPixels(_resourceFile, slicesSize); + _sliceCurrent->_animSlicesSize = readSize + 96; + + if (_sliceNext != _sliceCurrent) { + getSlices(); + } + + // Handle starting palette + switch (_paletteMode) { + case ANIMPALMODE_REPLACE_PALETTE: + // Use the palette provided with the animation directly + _palette.getPalette(); + for (int idx = _subData._palStart; idx < (_subData._palStart + _subData._palSize); ++idx) { + byte r = _subData._palData[idx * 3]; + byte g = _subData._palData[idx * 3 + 1]; + byte b = _subData._palData[idx * 3 + 2]; + + R2_GLOBALS._scenePalette.setEntry(idx, r, g, b); + } + + R2_GLOBALS._sceneManager._hasPalette = true; + break; + case ANIMPALMODE_NONE: + break; + + default: + // ANIMPALMODE_CURR_PALETTE + // Use the closest matching colours in the currently active palette to those specified in the animation + for (int idx = _subData._palStart; idx < (_subData._palStart + _subData._palSize); ++idx) { + byte r = _subData._palData[idx * 3]; + byte g = _subData._palData[idx * 3 + 1]; + byte b = _subData._palData[idx * 3 + 2]; + + int palIndex = R2_GLOBALS._scenePalette.indexOf(r, g, b); + _palIndexes[idx] = palIndex; + } + break; + } + + ++R2_GLOBALS._animationCtr; + _field38 = 1; + return true; +} + +void AnimationPlayer::drawFrame(int sliceIndex) { + assert(sliceIndex < 4); + AnimationSlices &slices = _sliceCurrent->_slices; + AnimationSlice &slice = _sliceCurrent->_slices._slices[sliceIndex]; + + byte *sliceDataStart = &slices._pixelData[slice._sliceOffset - 96]; + byte *sliceData1 = sliceDataStart; + + Rect playerBounds = _screenBounds; + int y = _screenBounds.top; + R2_GLOBALS._screenSurface.addDirtyRect(playerBounds); + + Graphics::Surface surface = R2_GLOBALS._screenSurface.lockSurface(); + + // Handle different drawing modes + switch (slice._drawMode) { + case 0: + // Draw from uncompressed source + for (int sliceNum = 0; sliceNum < _subData._ySlices; ++sliceNum) { + for (int yIndex = 0; yIndex < _sliceHeight; ++yIndex) { + // TODO: Check of _subData._drawType was done for two different kinds of + // line slice drawing in original + const byte *pSrc = (const byte *)sliceDataStart + READ_LE_UINT16(sliceData1 + sliceNum * 2); + byte *pDest = (byte *)surface.getBasePtr(playerBounds.left, y++); + + Common::copy(pSrc, pSrc + _subData._sliceSize, pDest); + } + } + break; + + case 1: + switch (slice._secondaryIndex) { + case 0xfe: + // Draw from uncompressed source with optional skipped rows + for (int sliceNum = 0; sliceNum < _subData._ySlices; ++sliceNum) { + for (int yIndex = 0; yIndex < _sliceHeight; ++yIndex, playerBounds.top++) { + int offset = READ_LE_UINT16(sliceData1 + sliceNum * 2); + + if (offset) { + const byte *pSrc = (const byte *)sliceDataStart + offset; + byte *pDest = (byte *)surface.getBasePtr(playerBounds.left, playerBounds.top); + + //Common::copy(pSrc, pSrc + playerBounds.width(), pDest); + rleDecode(pSrc, pDest, playerBounds.width()); + } + } + } + break; + case 0xff: + // Draw from RLE compressed source + for (int sliceNum = 0; sliceNum < _subData._ySlices; ++sliceNum) { + for (int yIndex = 0; yIndex < _sliceHeight; ++yIndex, playerBounds.top++) { + // TODO: Check of _subData._drawType was done for two different kinds of + // line slice drawing in original + const byte *pSrc = (const byte *)sliceDataStart + READ_LE_UINT16(sliceData1 + sliceNum * 2); + byte *pDest = (byte *)surface.getBasePtr(playerBounds.left, playerBounds.top); + + rleDecode(pSrc, pDest, _subData._sliceSize); + } + } + break; + default: { + // Draw from two slice sets simultaneously + AnimationSlice &slice2 = _sliceCurrent->_slices._slices[slice._secondaryIndex]; + byte *sliceData2 = &slices._pixelData[slice2._sliceOffset - 96]; + + for (int sliceNum = 0; sliceNum < _subData._ySlices; ++sliceNum) { + for (int yIndex = 0; yIndex < _sliceHeight; ++yIndex) { + const byte *pSrc1 = (const byte *)sliceDataStart + READ_LE_UINT16(sliceData2 + sliceNum * 2); + const byte *pSrc2 = (const byte *)sliceDataStart + READ_LE_UINT16(sliceData1 + sliceNum * 2); + byte *pDest = (byte *)surface.getBasePtr(playerBounds.left, y++); + + if (slice2._drawMode == 0) { + // Uncompressed background, foreground compressed + Common::copy(pSrc1, pSrc1 + _subData._sliceSize, pDest); + rleDecode(pSrc2, pDest, _subData._sliceSize); + } else { + // Both background and foreground is compressed + rleDecode(pSrc1, pDest, _subData._sliceSize); + rleDecode(pSrc2, pDest, _subData._sliceSize); + } + } + } + break; + } + } + default: + break; + } + + // Unlock the screen surface + R2_GLOBALS._screenSurface.unlockSurface(); + + if (_objectMode == 42) { + _screenBounds.expandPanes(); + + // Copy the drawn frame to the back surface + Rect srcRect = R2_GLOBALS._screenSurface.getBounds(); + Rect destRect = srcRect; + destRect.translate(-g_globals->_sceneOffset.x, -g_globals->_sceneOffset.y); + R2_GLOBALS._sceneManager._scene->_backSurface.copyFrom(R2_GLOBALS._screenSurface, + srcRect, destRect); + + // Draw any objects into the scene + R2_GLOBALS._sceneObjects->draw(); + } else { + if (R2_GLOBALS._sceneManager._hasPalette) { + R2_GLOBALS._sceneManager._hasPalette = false; + R2_GLOBALS._scenePalette.refresh(); + } + } +} + +/** + * Read the next frame's slice set + */ +void AnimationPlayer::nextSlices() { + _position = _nextSlicesPosition++; + _playbackTick = _position * _subData._framesPerSlices; + _playbackTickPrior = _playbackTick - 1; + + if (_sliceNext == _sliceCurrent) { + int dataSize = _sliceCurrent->_slices._dataSize2; + _sliceCurrent->_dataSize = dataSize; + debugC(1, ktSageDebugGraphics, "Next frame size = %xh", dataSize); + if (dataSize == 0) + return; + + dataSize -= 96; + assert(dataSize >= 0); + _sliceCurrent->_slices.load(_resourceFile); + _sliceCurrent->_animSlicesSize = _sliceCurrent->_slices.loadPixels(_resourceFile, dataSize); + } else { + SWAP(_sliceCurrent, _sliceNext); + getSlices(); + } +} + +bool AnimationPlayer::isCompleted() { + return (_position >= _subData._duration); +} + +void AnimationPlayer::close() { + if (_field38) { + switch (_paletteMode) { + case 0: + R2_GLOBALS._scenePalette.replace(&_palette); + changePane(); + R2_GLOBALS._sceneManager._hasPalette = true; + break; + case 2: + closing(); + break; + default: + changePane(); + break; + } + } + + // Close the resource file + _resourceFile.close(); + + if (_objectMode != 42) { + // flip screen in original + } + + // Free animation objects + delete _animData1; + delete _animData2; + _animData1 = NULL; + _animData2 = NULL; + + _field38 = 0; + if (g_globals != NULL) + R2_GLOBALS._animationCtr = MAX(R2_GLOBALS._animationCtr, 0); +} + +void AnimationPlayer::rleDecode(const byte *pSrc, byte *pDest, int size) { + while (size > 0) { + byte v = *pSrc++; + if (!(v & 0x80)) { + // Following uncompressed set of bytes + Common::copy(pSrc, pSrc + v, pDest); + pSrc += v; + pDest += v; + size -= v; + } else { + int count = v & 0x3F; + size -= count; + + if (!(v & 0x40)) { + // Skip over a number of bytes + pDest += count; + } else { + // Replicate a number of bytes + Common::fill(pDest, pDest + count, *pSrc++); + pDest += count; + } + } + } +} + +void AnimationPlayer::getSlices() { + assert((_sliceNext == _animData1) || (_sliceNext == _animData2)); + assert((_sliceCurrent == _animData1) || (_sliceCurrent == _animData2)); + + _sliceNext->_dataSize = _sliceCurrent->_slices._dataSize2; + if (_sliceNext->_dataSize) { + if (_sliceNext->_dataSize >= _dataNeeded) + error("Bogus dataNeeded == %d / %d", _sliceNext->_dataSize, _dataNeeded); + } + + int dataSize = _sliceNext->_dataSize - 96; + _sliceNext->_slices.load(_resourceFile); + _sliceNext->_animSlicesSize = _sliceNext->_slices.loadPixels(_resourceFile, dataSize); +} + +/*--------------------------------------------------------------------------*/ + +AnimationPlayerExt::AnimationPlayerExt(): AnimationPlayer() { + _v = 0; + _field3A = 0; +} + +void AnimationPlayerExt::synchronize(Serializer &s) { + AnimationPlayer::synchronize(s); + s.syncAsSint16LE(_v); +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 9eaa1b0cd1..0b573bf7f0 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -79,6 +79,7 @@ private: static void startStrip(); static void endStrip(); public: + byte _field312[256]; int _field372; bool _savedPlayerEnabled; bool _savedUiEnabled; @@ -101,16 +102,20 @@ public: virtual void loadScene(int sceneNum); virtual void refreshBackground(int xAmount, int yAmount); virtual void saveCharacter(int characterIndex); + virtual void restore() {} - bool display(CursorType action); + bool display(CursorType action, Event &event); void fadeOut(); void clearScreen(); + void scalePalette(int RFactor, int GFactor, int BFactor); }; class SceneHandlerExt: public SceneHandler { public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void process(Event &event); + + void setupPaletteMaps(); }; @@ -233,15 +238,10 @@ public: class NamedHotspot : public SceneHotspot { public: - int _resNum, _lookLineNum, _useLineNum, _talkLineNum; NamedHotspot(); virtual bool startAction(CursorType action, Event &event); virtual Common::String getClassName() { return "NamedHotspot"; } - virtual void synchronize(Serializer &s); - virtual void setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum); - virtual void setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item); - virtual void setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode = 0); }; class NamedHotspotExt : public NamedHotspot { @@ -258,16 +258,9 @@ public: class SceneActor: public SceneObject { public: - int _resNum; - int _lookLineNum, _talkLineNum, _useLineNum; - virtual Common::String getClassName() { return "SceneActor"; } - virtual void synchronize(Serializer &s); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual bool startAction(CursorType action, Event &event); - - void setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item); - void setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum); }; class SceneActorExt: public SceneActor { @@ -275,6 +268,7 @@ public: int _state; SceneActorExt() { _state = 0; } + virtual Common::String getClassName() { return "SceneActorExt"; } virtual void synchronize(Serializer &s) { SceneActor::synchronize(s); @@ -282,6 +276,162 @@ public: } }; +class SceneAreaObject: public SceneArea { + class Object1: public SceneActor { + public: + }; +public: + Object1 _object1; + int _insetCount; + + virtual void remove(); + virtual void process(Event &event); + void setDetails(int visage, int strip, int frameNumber, const Common::Point &pt); + void setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum); +}; + +class UnkObject1200 : public SavedObject { +public: + Rect _rect1; + Rect _rect2; + + int *_field16; + int *_field3A; + + int _field12; + int _field14; + int _field26; + int _field28; + int _field2A; + int _field2C; + int _field2E; + int _field30; + int _field32; + int _field34; + int _field36; + int _field38; + int _field3E; + int _field40; + + UnkObject1200(); + void synchronize(Serializer &s); + + void sub51AE9(int arg1); + int sub51AF8(Common::Point pt); + bool sub51AFD(Common::Point pt); + void sub51B02(); + void sub9EDE8(Rect rect); + int sub9EE22(int &arg1, int &arg2); + virtual Common::String getClassName() { return "UnkObject1200"; } +}; + +/*--------------------------------------------------------------------------*/ + +class AnimationSlice { +public: + int _sliceOffset; + int _drawMode; + int _secondaryIndex; +public: + void load(Common::File &f); +}; + +class AnimationSlices { +public: + int _dataSize; + int _dataSize2; + AnimationSlice _slices[4]; + byte *_pixelData; +public: + AnimationSlices(); + ~AnimationSlices(); + + void load(Common::File &f); + int loadPixels(Common::File &f, int slicesSize); +}; + +class AnimationPlayerSubData { +public: + int _duration; + int _frameRate; + int _framesPerSlices; + int _drawType; + int _sliceSize; + int _ySlices; + int _field16; + int _palStart; + int _palSize; + byte _palData[256 * 3]; + int32 _totalSize; + AnimationSlices _slices; +public: + void load(Common::File &f); +}; + +class AnimationData { +public: + AnimationSlices _slices; + int _dataSize; + int _animSlicesSize; +}; + +enum AnimationPaletteMode { ANIMPALMODE_REPLACE_PALETTE = 0, ANIMPALMODE_CURR_PALETTE = 1, + ANIMPALMODE_NONE = 2 }; + +class AnimationPlayer: public EventHandler { +private: + void rleDecode(const byte *pSrc, byte *pDest, int size); + + void drawFrame(int sliceIndex); + void nextSlices(); + void getSlices(); +public: + AnimationData *_animData1, *_animData2; + AnimationData *_sliceCurrent; + AnimationData *_sliceNext; + Common::File _resourceFile; + Rect _rect1, _screenBounds; + int _field38; + int _field3A, _paletteMode; + int _objectMode; + int _field58, _sliceHeight; + byte _palIndexes[256]; + ScenePalette _palette; + AnimationPlayerSubData _subData; + Action *_endAction; + int _dataNeeded; + int _playbackTick; + int _playbackTickPrior; + int _position; + int _nextSlicesPosition; + uint _frameDelay; + uint32 _gameFrame; +public: + AnimationPlayer(); + ~AnimationPlayer(); + + virtual void synchronize(Serializer &s); + virtual void remove(); + virtual void process(Event &event); + virtual void dispatch(); + virtual void flipPane() {} + virtual void changePane() {} + virtual void closing() {} + + bool load(int animId, Action *endAction = NULL); + bool isCompleted(); + void close(); +}; + +class AnimationPlayerExt: public AnimationPlayer { +public: + int _v; +public: + AnimationPlayerExt(); + + virtual void synchronize(Serializer &s); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 214853ce86..4c98fcf00a 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -23,6 +23,7 @@ #include "tsage/scenes.h" #include "tsage/tsage.h" #include "tsage/staticres.h" +#include "tsage/ringworld2/ringworld2_dialogs.h" #include "tsage/ringworld2/ringworld2_scenes0.h" #include "tsage/ringworld2/ringworld2_speakers.h" @@ -50,7 +51,7 @@ void Scene50::postInit(SceneObjectList *OwnerList) { SceneExt::postInit(OwnerList); loadScene(110); - R2_GLOBALS._v58CE2 = 0; + R2_GLOBALS._uiElements._active = false; R2_GLOBALS._scenePalette.loadPalette(0); R2_GLOBALS._sound2.play(10); @@ -64,7 +65,7 @@ void Scene50::process(Event &event) { event.handled = true; warning("TODO: incomplete Scene50::process()"); // CursorType _oldCursorId = _cursorId; - g_globals->_events.setCursor(R2_2); + g_globals->_events.setCursor(CURSOR_ARROW); // _cursorManager.sub_1D474(2, 0); // sub_5566A(1); // _cursorManager._fieldE = _oldCursorId; @@ -94,11 +95,11 @@ bool Scene100::Door::startAction(CursorType action, Event &event) { if (_state) { SceneItem::display2(100, 26); _state = 0; - scene->_object10.setFrame(1); + scene->_doorDisplay.setFrame(1); } else { SceneItem::display2(100, 27); _state = 1; - scene->_object10.setFrame(2); + scene->_doorDisplay.setFrame(2); } return true; default: @@ -121,20 +122,20 @@ bool Scene100::Table::startAction(CursorType action, Event &event) { scene->_stasisNegator.setup(100, 7, 2); } else { scene->_stasisNegator.setup(100, 7, 1); - scene->_stasisNegator.setDetails(100, 21, 22, 23, 2, NULL); + scene->_stasisNegator.setDetails(100, 21, 22, 23, 2, (SceneItem *)NULL); } - scene->setAction(&scene->_sequenceManager2, scene, 108, this, &scene->_object3, + scene->setAction(&scene->_sequenceManager2, scene, 108, this, &scene->_object3, &scene->_stasisNegator, &R2_GLOBALS._player, NULL); } else { scene->_sceneMode = 109; - scene->setAction(&scene->_sequenceManager2, scene, 109, this, &scene->_object3, + scene->setAction(&scene->_sequenceManager2, scene, 109, this, &scene->_object3, &scene->_stasisNegator, &R2_GLOBALS._player, NULL); } return true; case CURSOR_TALK: R2_GLOBALS._player.disableControl(); - + if (_strip == 2) { SceneItem::display2(100, 18); scene->_sceneMode = 102; @@ -145,15 +146,15 @@ bool Scene100::Table::startAction(CursorType action, Event &event) { scene->_stasisNegator.setup(100, 7, 2); } else { scene->_stasisNegator.setup(100, 7, 1); - scene->_stasisNegator.setDetails(100, 21, 22, 23, 2, NULL); + scene->_stasisNegator.setDetails(100, 21, 22, 23, 2, (SceneItem *)NULL); } - scene->setAction(&scene->_sequenceManager2, scene, 102, this, &scene->_object3, + scene->setAction(&scene->_sequenceManager2, scene, 102, this, &scene->_object3, &scene->_stasisNegator, NULL); } else { SceneItem::display2(100, 19); scene->_sceneMode = 103; - scene->setAction(&scene->_sequenceManager2, scene, 103, this, &scene->_object3, + scene->setAction(&scene->_sequenceManager2, scene, 103, this, &scene->_object3, &scene->_stasisNegator, NULL); } return true; @@ -176,7 +177,7 @@ bool Scene100::StasisNegator::startAction(CursorType action, Event &event) { } } -bool Scene100::Object10::startAction(CursorType action, Event &event) { +bool Scene100::DoorDisplay::startAction(CursorType action, Event &event) { Scene100 *scene = (Scene100 *)R2_GLOBALS._sceneManager._scene; switch (action) { @@ -240,42 +241,43 @@ void Scene100::postInit(SceneObjectList *OwnerList) { _door._state = 0; _door.setVisage(100); _door.setPosition(Common::Point(160, 84)); - _door.setDetails(100, 3, 4, 5, 1, NULL); + _door.setDetails(100, 3, 4, 5, 1, (SceneItem *)NULL); - _object10.postInit(); - _object10.setup(100, 2, 1); - _object10.setDetails(100, -1, -1, -1, 1, NULL); + _doorDisplay.postInit(); + _doorDisplay.setup(100, 2, 1); + _doorDisplay.setPosition(Common::Point(202, 53)); + _doorDisplay.setDetails(100, -1, -1, -1, 1, (SceneItem *)NULL); _table.postInit(); _table.setup(100, 2, 3); _table.setPosition(Common::Point(175, 157)); - _table.setDetails(100, 17, 18, 20, 1, NULL); - - _object1.postInit(); - _object1.setup(100, 3, 1); - _object1.setPosition(Common::Point(89, 79)); - _object1.fixPriority(250); - _object1.animate(ANIM_MODE_2, NULL); - _object1._numFrames = 3; - - _object2.postInit(); - _object2.setup(100, 3, 1); - _object2.setPosition(Common::Point(89, 147)); - _object2.fixPriority(250); - _object2.animate(ANIM_MODE_7, 0, NULL); - _object2._numFrames = 3; - - _object6.postInit(); - _object6.setVisage(101); - _object6.setPosition(Common::Point(231, 126)); - _object6.fixPriority(10); - _object6.setDetails(100, 37, -1, 39, 1, NULL); + _table.setDetails(100, 17, 18, 20, 1, (SceneItem *)NULL); + + _bedLights1.postInit(); + _bedLights1.setup(100, 3, 1); + _bedLights1.setPosition(Common::Point(89, 79)); + _bedLights1.fixPriority(250); + _bedLights1.animate(ANIM_MODE_2, NULL); + _bedLights1._numFrames = 3; + + _bedLights2.postInit(); + _bedLights2.setup(100, 3, 1); + _bedLights2.setPosition(Common::Point(89, 147)); + _bedLights2.fixPriority(250); + _bedLights2.animate(ANIM_MODE_7, 0, NULL); + _bedLights2._numFrames = 3; + + _wardrobe.postInit(); + _wardrobe.setVisage(101); + _wardrobe.setPosition(Common::Point(231, 126)); + _wardrobe.fixPriority(10); + _wardrobe.setDetails(100, 37, -1, 39, 1, (SceneItem *)NULL); if (R2_INVENTORY.getObjectScene(R2_STEPPING_DISKS) == 100) { _steppingDisks.postInit(); _steppingDisks.setup(100, 8, 1); _steppingDisks.setPosition(Common::Point(274, 130)); - _steppingDisks.setDetails(100, 40, -1, 42, 1, NULL); + _steppingDisks.setDetails(100, 40, -1, 42, 1, (SceneItem *)NULL); } _terminal.setDetails(11, 100, 14, 15, 16); @@ -287,7 +289,7 @@ void Scene100::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.setVisage(10); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); R2_GLOBALS._player.disableControl(); - + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 100, 0, 1, -1, 1, NULL); switch (R2_GLOBALS._sceneManager._previousScene) { @@ -296,7 +298,7 @@ void Scene100::postInit(SceneObjectList *OwnerList) { _object5.postInit(); _object4.postInit(); _sceneMode = 104; - setAction(&_sequenceManager1, this, 104, &R2_GLOBALS._player, &_object6, &_object4, &_object5, NULL); + setAction(&_sequenceManager1, this, 104, &R2_GLOBALS._player, &_wardrobe, &_object4, &_object5, NULL); break; case 125: _sceneMode = 100; @@ -328,7 +330,7 @@ void Scene100::signal() { case 109: _table.setStrip(2); _table.setFrame(3); - + _object3.remove(); _stasisNegator.remove(); R2_GLOBALS._player.enableControl(); @@ -356,10 +358,10 @@ void Scene100::signal() { case 110: if (_door._state) { _door._state = 0; - _object10.setFrame(1); + _doorDisplay.setFrame(1); } else { _door._state = 1; - _object10.setFrame(2); + _doorDisplay.setFrame(2); } R2_GLOBALS._player.enableControl(); break; @@ -411,7 +413,7 @@ Scene125::Icon::Icon(): SceneActor() { void Scene125::Icon::postInit(SceneObjectList *OwnerList) { SceneObject::postInit(); - + _object1.postInit(); _object1.fixPriority(255); _object1.hide(); @@ -422,7 +424,7 @@ void Scene125::Icon::postInit(SceneObjectList *OwnerList) { _sceneText2._color1 = 0; _sceneText2._color2 = 0; _sceneText2._width = 200; - setDetails(125, -1, -1, -1, 2, NULL); + setDetails(125, -1, -1, -1, 2, (SceneItem *)NULL); } void Scene125::Icon::synchronize(Serializer &s) { @@ -520,15 +522,15 @@ void Scene125::Icon::setIcon(int id) { _object1.setPosition(_position); _sceneText1._fontNumber = scene->_iconFontNumber; - _sceneText1.setup(CONSOLE_MESSAGES[id]); + _sceneText1.setup(CONSOLE125_MESSAGES[id]); _sceneText1.fixPriority(20); _sceneText2._fontNumber = scene->_iconFontNumber; - _sceneText2.setup(CONSOLE_MESSAGES[id]); + _sceneText2.setup(CONSOLE125_MESSAGES[id]); _sceneText2.fixPriority(20); _sceneText2._fontNumber = scene->_iconFontNumber; - _sceneText2.setup(CONSOLE_MESSAGES[id]); + _sceneText2.setup(CONSOLE125_MESSAGES[id]); _sceneText2.fixPriority(10); switch (_lookLineNum) { @@ -619,7 +621,7 @@ void Scene125::postInit(SceneObjectList *OwnerList) { loadScene(160); _palette.loadPalette(0); - if (R2_GLOBALS._sceneManager._previousScene != 125) + if (R2_GLOBALS._sceneManager._previousScene != 125) // Save the prior scene to return to when the console is turned off R2_GLOBALS._player._oldCharacterScene[1] = R2_GLOBALS._sceneManager._previousScene; @@ -636,7 +638,7 @@ void Scene125::postInit(SceneObjectList *OwnerList) { _object6.postInit(); _object6.setup(162, 1, 1); _object6.setPosition(Common::Point(214, 168)); - + _item4.setDetails(Rect(27, 145, 81, 159), 126, 9, -1, -1, 1, NULL); _item3.setDetails(Rect(144, 119, 286, 167), 126, 6, 7, 8, 1, NULL); _item2.setDetails(1, 126, 3, 4, 5); @@ -667,7 +669,7 @@ void Scene125::signal() { _icon1._object2.postInit(); _icon1._object2.setup(160, 7, 1); _icon1._object2.setPosition(Common::Point(106, 41)); - + _icon2.setup(160, 1, 1); _icon2.setPosition(Common::Point(80, 32)); _icon2._object2.postInit(); @@ -764,7 +766,7 @@ void Scene125::signal() { case 11: R2_GLOBALS._player.enableControl(); R2_GLOBALS._player._canWalk = false; - + if ((_consoleMode >= 27) && (_consoleMode <= 30)) { consoleAction(11); } @@ -913,7 +915,7 @@ void Scene125::consoleAction(int id) { _icon2.hideIcon(); _icon3.hideIcon(); _icon5.setIcon(24); - + _icon4.setPosition(Common::Point(52, 107)); _icon4._sceneRegionId = 9; _icon4.setIcon(25); @@ -921,7 +923,7 @@ void Scene125::consoleAction(int id) { _icon6.setIcon(26); _sceneMode = 10; - + _palette.loadPalette(161); R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this); break; @@ -956,7 +958,7 @@ void Scene125::consoleAction(int id) { _icon2.hideIcon(); _icon3.hideIcon(); _icon5.setIcon(24); - + _icon4.setPosition(Common::Point(52, 107)); _icon4._sceneRegionId = 9; _icon4.setIcon(25); @@ -964,7 +966,7 @@ void Scene125::consoleAction(int id) { _icon6.setIcon(26); _sceneMode = 10; - + _palette.loadPalette(161); R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this); } @@ -1031,6 +1033,7 @@ void Scene125::consoleAction(int id) { _sceneMode = 10; _palette.loadPalette(161); + R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this); break; case 24: _icon4.setIcon(25); @@ -1086,7 +1089,7 @@ void Scene125::consoleAction(int id) { _icon3.hideIcon(); _icon4.hideIcon(); _icon5.setIcon(24); - + _icon4.setPosition(Common::Point(52, 107)); _icon4._sceneRegionId = 9; _icon4.setIcon(25); @@ -1094,7 +1097,7 @@ void Scene125::consoleAction(int id) { _icon6.setIcon(26); _sceneMode = 10; - + _palette.loadPalette(161); R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this); break; @@ -1131,7 +1134,7 @@ void Scene125::consoleAction(int id) { */ void Scene125::setDetails(int resNum, int lineNum) { stop(); - + Common::String msg = g_resourceManager->getMessage(resNum, lineNum, true); if (!msg.empty()) { @@ -1199,6 +1202,784 @@ Common::String Scene125::parseMessage(const Common::String &msg) { } /*-------------------------------------------------------------------------- + * Scene 150 - Empty Bedroom + * + *--------------------------------------------------------------------------*/ + +void Scene150::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(100); + + _door.postInit(); + _door._state = 0; + _door.setVisage(100); + _door.setPosition(Common::Point(160, 84)); + _door.setDetails(100, 3, -1, -1, 1, (SceneItem *)NULL); + + _doorDisplay.postInit(); + _doorDisplay.setup(100, 2, 1); + _doorDisplay.setPosition(Common::Point(202, 53)); + _doorDisplay.setDetails(100, -1, -1, -1, 1, (SceneItem *)NULL); + + _emptyRoomTable.postInit(); + _emptyRoomTable.setVisage(100); + _emptyRoomTable.setStrip(4); + _emptyRoomTable.setFrame(1); + _emptyRoomTable.setPosition(Common::Point(175, 157)); + _emptyRoomTable.setDetails(150, 3, 4, 5, 1, (SceneItem *)NULL); + + _wardrobe.postInit(); + _wardrobe.setVisage(101); + _wardrobe.setPosition(Common::Point(231, 126)); + _wardrobe.fixPriority(10); + _wardrobe.setDetails(100, 37, -1, 39, 1, (SceneItem *)NULL); + + _terminal.setDetails(11, 100, 14, 15, 16); + _desk.setDetails(12, 100, 11, -1, 13); + _bed.setDetails(13, 100, 8, 9, 10); + _duct.setDetails(14, 100, 34, -1, 36); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 150, 0, 1, -1, 1, NULL); + _sceneMode = 100; + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 100: + setAction(&_sequenceManager1, this, 106, &R2_GLOBALS._player, NULL); + break; + case 200: + setAction(&_sequenceManager1, this, 100, &R2_GLOBALS._player, &_door, NULL); + break; + default: + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.setPosition(Common::Point(180, 100)); + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene150::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene150::signal() { + switch (_sceneMode) { + case 101: + R2_GLOBALS._sceneManager.changeScene(200); + break; + case 105: + R2_GLOBALS._sceneManager.changeScene(125); + break; + case 110: + if (_door._state) { + _door._state = 0; + _doorDisplay.setFrame(1); + } else { + _door._state = 1; + _doorDisplay.setFrame(2); + } + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 160 - Credits + * + *--------------------------------------------------------------------------*/ + +void Scene160::Action1::signal() { + Scene160 *scene = (Scene160 *)R2_GLOBALS._sceneManager._scene; + bool breakFlag; + SynchronizedList<SceneText *>::iterator i; + SceneText *topItem; + + switch (_actionIndex) { + case 0: + scene->_yChange = 1; + scene->_lineNum = 0; + ++_actionIndex; + // Deliberate fall-through + + case 1: + setDelay(5); + breakFlag = true; + do { + if (!scene->_lineNum || ((scene->_lineNum != -1) && + (((*scene->_creditsList.reverse_begin())->_position.y < 164) || !breakFlag))) { + breakFlag = true; + Common::String msg = g_resourceManager->getMessage(160, scene->_lineNum++); + + if (*msg.c_str() == '^') { + scene->_lineNum = -1; + } else { + if (msg.size() == 0) + msg = " "; + + SceneText *sceneText = new SceneText(); + sceneText->_fontNumber = 50; + + switch (*msg.c_str()) { + case '$': { + // Centered text + msg.deleteChar(0); + int width = R2_GLOBALS.gfxManager()._font.getStringWidth(msg.c_str()); + + sceneText->_textMode = ALIGN_CENTER; + sceneText->setPosition(Common::Point(160 - (width / 2), 175)); + sceneText->_width = 320; + break; + } + + case '%': { + // Text for position name + msg.deleteChar(0); + int width = R2_GLOBALS.gfxManager()._font.getStringWidth(msg.c_str()); + + sceneText->_textMode = ALIGN_RIGHT; + sceneText->setPosition(Common::Point(151 - width, 175)); + sceneText->_width = 320; + breakFlag = false; + break; + } + + case '@': + // Text for who was in the position + msg.deleteChar(0); + sceneText->_textMode = ALIGN_LEFT; + sceneText->_position = Common::Point(167, 175); + sceneText->_width = 153; + break; + + default: + sceneText->_width = 151; + sceneText->setPosition(Common::Point(151, 175)); + sceneText->_textMode = ALIGN_RIGHT; + break; + } + + sceneText->_color1 = 191; + sceneText->_color2 = 191; + sceneText->_color3 = 191; + sceneText->setup(msg); + sceneText->_flags |= OBJFLAG_CLONED; + sceneText->fixPriority(5); + + scene->_creditsList.push_back(sceneText); + } + } + + } while (!breakFlag); + + // Move all the active credits + for (i = scene->_creditsList.begin(); i != scene->_creditsList.end(); ++i) { + SceneObject *item = *i; + item->setPosition(Common::Point(item->_position.x, item->_position.y - scene->_yChange)); + } + + topItem = *scene->_creditsList.begin(); + if (topItem->_position.y < 25) { + // Credit has reached the top, so remove it + topItem->remove(); + scene->_creditsList.remove(topItem); + + if (scene->_creditsList.size() == 0) { + // No more items left + setDelay(10); + ++_actionIndex; + } + } + break; + + case 2: + HelpDialog::show(); + setDelay(4); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +Scene160::Scene160(): SceneExt() { + _frameNumber = _yChange = 0; + _lineNum = 0; +} + +void Scene160::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(4001); + + R2_GLOBALS._player._uiEnabled = false; + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + + R2_GLOBALS._uiElements.hide(); + R2_GLOBALS._interfaceY = SCREEN_HEIGHT; + + _lineNum = 0; + _frameNumber = R2_GLOBALS._events.getFrameNumber(); + + _sound1.play(337); + setAction(&_action1); +} + +void Scene160::synchronize(Serializer &s) { + SceneExt::synchronize(s); + s.syncAsSint16LE(_frameNumber); + s.syncAsSint16LE(_yChange); + s.syncAsSint16LE(_lineNum); +} + +void Scene160::remove() { + // Clear the credit list + SynchronizedList<SceneText *>::iterator i; + for (i = _creditsList.begin(); i != _creditsList.end(); ++i) { + SceneText *item = *i; + + item->remove(); + } + _creditsList.clear(); + + _sound1.fadeOut(NULL); + SceneExt::remove(); +} + +void Scene160::process(Event &event) { + if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) { + event.handled = true; + HelpDialog::show(); + } + + if (!event.handled) + SceneExt::process(event); +} + +/*-------------------------------------------------------------------------- + * Scene 180 - Title Screen + * + *--------------------------------------------------------------------------*/ + +void Scene180::Action1::signal() { + Scene180 *scene = (Scene180 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + case 1: + case 2: + scene->_object5.setStrip((_actionIndex == 1) ? 1 : 2); + scene->_object5.setFrame(1); + scene->_object5.animate(ANIM_MODE_5, this); + break; + case 4: + scene->_object5.setStrip(3); + scene->_object5.setFrame(1); + scene->_object5.animate(ANIM_MODE_5, this); + _actionIndex = 0; + break; + } +} + +/*--------------------------------------------------------------------------*/ + +Scene180::Scene180(): SceneExt(), _webbsterSpeaker(27) { + _field412 = 0; + _frameInc = 0; + _frameNumber = R2_GLOBALS._events.getFrameNumber(); + _field480 = 1; + _field482 = -1; + _fontNumber = R2_GLOBALS.gfxManager()._font._fontNumber; + + GfxFont font; + font.setFontNumber(7); + _fontHeight = font.getHeight() + 1; + + _sceneMode = (R2_GLOBALS._sceneManager._previousScene == 205) ? 10 : 0; + _gameTextSpeaker._displayMode = 9; +} + +void Scene180::postInit(SceneObjectList *OwnerList) { + loadScene(9999); + SceneExt::postInit(); + + R2_GLOBALS._uiElements._active = true; + R2_GLOBALS._player.disableControl(); + + _stripManager.addSpeaker(&_gameTextSpeaker); + _stripManager.addSpeaker(&_webbsterSpeaker); + _stripManager.addSpeaker(&_tealSpeaker); + _stripManager.addSpeaker(&_dutyOfficerSpeaker); + + signal(); +} + +void Scene180::remove() { + _stripManager._field2E8 = -1; +// _stripManager._field2EA = -1; + SceneExt::remove(); + + R2_GLOBALS._events.setCursor(CURSOR_WALK); + // word_575F7 = 0; + R2_GLOBALS._playStream.stop(); + R2_GLOBALS._sound2.fadeOut2(NULL); + R2_GLOBALS._sound1.fadeOut2(NULL); +} + +void Scene180::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_frameNumber); + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_field480); + s.syncAsSint16LE(_field482); + s.syncAsSint16LE(_frameInc); + s.syncAsSint16LE(_fontNumber); + s.syncAsSint16LE(_fontHeight); +} + +void Scene180::signal() { + R2_GLOBALS._playStream.stop(); + + switch (_sceneMode++) { + case 0: + setSceneDelay(6); + break; + + case 1: + _field412 = 1; + R2_GLOBALS._sceneManager._hasPalette = true; + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._v = 1; + _animationPlayer._objectMode = 1; + R2_GLOBALS._scene180Mode = 1; + + _animationPlayer.load(1); + R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); + + R2_GLOBALS._sound1.play(1); + break; + + case 2: + R2_GLOBALS._scene180Mode = 1; + R2_GLOBALS._paneRefreshFlag[0] = 3; + + if (R2_GLOBALS._sound1.isPlaying()) { + setSceneDelay(1); + } else { + setSceneDelay(180); + } + break; + + case 3: + R2_GLOBALS._scene180Mode = 1; + + if (R2_GLOBALS._sound1.isPlaying()) + _sceneMode = 3; + + setSceneDelay(1); + break; + + case 4: + case 8: + case 30: + case 43: + case 47: + _field412 = 0; + _palette.loadPalette(0); + _palette.loadPalette(9998); + R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 8, this); + break; + + case 5: + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._v = 1; + _animationPlayer._objectMode = 1; + R2_GLOBALS._scene180Mode = 2; + _animationPlayer.load(2); + + _field412 = 1; + R2_GLOBALS._scenePalette.addFader(_animationPlayer._subData._palData, 256, 6, NULL); + R2_GLOBALS._sound1.play(2); + break; + + case 6: + R2_GLOBALS._scene180Mode = 2; + R2_GLOBALS._paneRefreshFlag[0] = 3; + + if (R2_GLOBALS._sound1.isPlaying()) { + setSceneDelay(1); + } else { + setSceneDelay(180); + } + break; + + case 7: + // Title screen. Wait until title music finishes playing + R2_GLOBALS._scene180Mode = 2; + if (R2_GLOBALS._sound1.isPlaying()) + _sceneMode = 7; + setSceneDelay(1); + break; + + case 9: + R2_GLOBALS._sound1.play(3); + clearScreen(); + setSceneDelay(2); + break; + + case 10: + loadScene(4002); + R2_GLOBALS._scenePalette.loadPalette(0); + setSceneDelay(6); + break; + + case 11: + _field412 = 1; + _object4.postInit(); + _object5.postInit(); + setAction(&_sequenceManager, this, 4000, &_object4, &_object5, NULL); + break; + + case 12: + case 14: + case 16: + case 18: + case 20: + case 22: + case 24: + case 26: + case 46: + setSceneDelay((R2_GLOBALS._speechSubtitles & 1) ? 1 : 18); + break; + + case 13: + setAction(&_sequenceManager, this, 4001, &_object4, &_object5, NULL); + break; + + case 15: + setAction(&_sequenceManager, this, 4002, &_object4, &_object5, NULL); + break; + + case 17: + setAction(&_sequenceManager, this, 4003, &_object4, &_object5, NULL); + break; + + case 19: + setAction(&_sequenceManager, this, 4004, &_object4, &_object5, NULL); + break; + + case 21: + setAction(&_sequenceManager, this, 4005, &_object4, &_object5, NULL); + break; + + case 23: + setAction(&_sequenceManager, this, 4006, &_object4, &_object5, NULL); + break; + + case 25: + setAction(&_sequenceManager, this, 4007, &_object4, &_object5, NULL); + break; + + case 27: + _field412 = 0; + _object4.remove(); + _object5.remove(); + setSceneDelay(2); + break; + + case 28: + _field412 = 0; + _palette.loadPalette(0); + _palette.loadPalette(9998); + R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 100, this); + break; + + case 29: + _field412 = 1; + _animationPlayer._paletteMode = ANIMPALMODE_REPLACE_PALETTE; + _animationPlayer._v = 1; + _animationPlayer._objectMode = 42; + R2_GLOBALS._scene180Mode = 3; + _animationPlayer.load(3); + break; + + case 31: + R2_GLOBALS._sound2.play(7); + + _object4.postInit(); + _object4.setVisage(76); + _object4.setStrip(1); + _object4.setFrame(1); + _object4.setPosition(Common::Point(288, 143)); + _object4.fixPriority(210); + + loadScene(75); + + R2_GLOBALS._scenePalette.loadPalette(0); + R2_GLOBALS._scenePalette.loadPalette(75); + + if (R2_GLOBALS._sceneManager._hasPalette) + R2_GLOBALS._scenePalette.refresh(); + setSceneDelay(6); + break; + + case 32: + _field412 = 1; + + _object2.postInit(); + _object2.setPosition(Common::Point(161, 97)); + _object2.hide(); + + _object3.postInit(); + _object3.setPosition(Common::Point(60, 96)); + _object3.hide(); + R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 11, this); + break; + + case 33: + _object2.hide(); + + _object3.setup(76, 4, 1); + _object3.setFrame(_object3.getFrameCount()); + + _object5.postInit(); + _object5.setup(75, 1, 1); + _object5.setPosition(Common::Point(221, 125)); + _object5.fixPriority(210); + _object5.setAction(&_action1); + R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 12, this); + break; + + case 34: + _object2.hide(); + _object3.hide(); + + _object1.postInit(); + _object1.setup(76, 2, 1); + _object1.setPosition(Common::Point(287, 135)); + _object1.fixPriority(200); + + _sound1.play(19); + R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this); + break; + + case 35: + R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 13, this); + break; + + case 36: + _object2.remove(); + _sound1.play(19); + + R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 6, this); + break; + + case 37: + _field412 = 0; + _object1.remove(); + _palette.loadPalette(9998); + R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 8, this); + break; + + case 38: + _object4.remove(); + _object5.setAction(NULL); + _object5.remove(); + + R2_GLOBALS._sound2.fadeOut2(NULL); + R2_GLOBALS._sound1.fadeOut2(NULL); + break; + + case 39: + R2_GLOBALS._sound1.changeSound(8); + setSceneDelay(1); + break; + + case 40: + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._objectMode = 1; + R2_GLOBALS._scene180Mode = 4; + if (_animationPlayer.load(4)) { + _animationPlayer.dispatch(); + R2_GLOBALS._scenePalette.addFader(_animationPlayer._subData._palData, 256, 8, this); + } else { + _sceneMode = 43; + setSceneDelay(1); + } + break; + + case 41: + _field412 = 1; + _animationPlayer._v = 1; + break; + + case 42: + R2_GLOBALS._scene180Mode = 4; + R2_GLOBALS._paneRefreshFlag[0] = 3; + setSceneDelay(1); + break; + + case 44: + loadScene(9997); + R2_GLOBALS._scenePalette.loadPalette(9997); + if (R2_GLOBALS._sceneManager._hasPalette) + R2_GLOBALS._scenePalette.refresh(); + + setSceneDelay(6); + break; + + case 45: + R2_GLOBALS._scenePalette.addFader(_animationPlayer._subData._palData, 256, 28, this); + break; + + case 48: + _field412 = 1; + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._v = 1; + _animationPlayer._objectMode = 1; + R2_GLOBALS._scene180Mode = 15; + _animationPlayer.load(15, NULL); + + R2_GLOBALS._sound1.play(9); + R2_GLOBALS._scenePalette.addFader(_animationPlayer._subData._palData, 256, 6, NULL); + break; + + case 49: + R2_GLOBALS._scene180Mode = 15; + R2_GLOBALS._paneRefreshFlag[0] = 3; + setSceneDelay(1); + break; + + case 50: + R2_GLOBALS._scene180Mode = 0; + _field412 = 0; + R2_GLOBALS._sceneManager.changeScene(100); + break; + } +} + +void Scene180::setSceneDelay(int v) { + _frameInc = v; + _frameNumber = R2_GLOBALS._events.getFrameNumber(); +} + +void Scene180::process(Event &event) { + if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) { + event.handled = 1; + if (!_field412) { + if (R2_GLOBALS._scenePalette._listeners.size() == 0) { + HelpDialog::show(); + } + } + } + + if (!event.handled) + SceneExt::process(event); +} + +void Scene180::dispatch() { + if (_frameInc) { + uint32 gameFrame = R2_GLOBALS._events.getFrameNumber(); + + if (gameFrame >= (uint32)_frameNumber) { + _frameInc -= gameFrame - _frameNumber; + _frameNumber = gameFrame; + + if (_frameInc <= 0) { + _frameInc = 0; + signal(); + } + } + } + + if (_animationPlayer._v) { + if (_animationPlayer.isCompleted()) { + _animationPlayer._v = 0; + _animationPlayer.close(); + _animationPlayer.remove(); + + signal(); + } else { + _animationPlayer.dispatch(); + } + } + + Scene::dispatch(); +} + +void Scene180::restore() { + R2_GLOBALS._gfxColors.background = 0; + R2_GLOBALS._gfxColors.foreground = 0xff; + R2_GLOBALS._fontColors.background = 0; + R2_GLOBALS._fontColors.foreground = 0xff; + + switch (R2_GLOBALS._scene180Mode) { + case 0: + R2_GLOBALS._events.setCursor(SHADECURSOR_HAND); + + R2_GLOBALS._gfxColors.foreground = 4; + R2_GLOBALS._gfxColors.background = 3; + R2_GLOBALS._fontColors.background = 3; + R2_GLOBALS._frameEdgeColour = 3; + break; + + case 1: + R2_GLOBALS._events.setCursor(R2_CURSOR_20); + + R2_GLOBALS._gfxColors.foreground = 25; + R2_GLOBALS._gfxColors.background = 43; + R2_GLOBALS._fontColors.background = 48; + R2_GLOBALS._frameEdgeColour = 48; + break; + + case 2: + R2_GLOBALS._events.setCursor(R2_CURSOR_21); + + R2_GLOBALS._gfxColors.foreground = 106; + R2_GLOBALS._gfxColors.background = 136; + R2_GLOBALS._fontColors.background = 48; + R2_GLOBALS._fontColors.foreground = 253; + R2_GLOBALS._frameEdgeColour = 48; + break; + + case 3: + R2_GLOBALS._events.setCursor(R2_CURSOR_22); + + R2_GLOBALS._gfxColors.foreground = 84; + R2_GLOBALS._gfxColors.background = 118; + R2_GLOBALS._fontColors.background = 47; + R2_GLOBALS._frameEdgeColour = 48; + break; + + case 14: + R2_GLOBALS._events.setCursor(R2_CURSOR_23); + + R2_GLOBALS._fontColors.background = 38; + R2_GLOBALS._fontColors.foreground = 38; + R2_GLOBALS._gfxColors.foreground = 192; + R2_GLOBALS._gfxColors.background = 30; + R2_GLOBALS._frameEdgeColour = 48; + break; + + default: + R2_GLOBALS._gfxColors.background = 0; + R2_GLOBALS._gfxColors.foreground = 59; + R2_GLOBALS._fontColors.background = 4; + R2_GLOBALS._fontColors.foreground = 15; + + R2_GLOBALS._events.setCursor(CURSOR_ARROW); + break; + } +} + +/*-------------------------------------------------------------------------- * Scene 200 - Ship Corridor * *--------------------------------------------------------------------------*/ @@ -1276,19 +2057,19 @@ void Scene200::postInit(SceneObjectList *OwnerList) { _northDoor.postInit(); _northDoor.setVisage(200); _northDoor.setPosition(Common::Point(188, 79)); - _northDoor.setDetails(200, 3, -1, -1, 1, NULL); + _northDoor.setDetails(200, 3, -1, -1, 1, (SceneItem *)NULL); _eastDoor.postInit(); _eastDoor.setVisage(200); _eastDoor.setStrip(2); _eastDoor.setPosition(Common::Point(305, 124)); - _eastDoor.setDetails(200, 6, -1, -1, 1, NULL); + _eastDoor.setDetails(200, 6, -1, -1, 1, (SceneItem *)NULL); _westDoor.postInit(); _westDoor.setVisage(200); _westDoor.setStrip(3); _westDoor.setPosition(Common::Point(62, 84)); - _westDoor.setDetails(200, 9, -1, -1, 1, NULL); + _westDoor.setDetails(200, 9, -1, -1, 1, (SceneItem *)NULL); R2_GLOBALS._player.postInit(); R2_GLOBALS._player.setVisage(10); @@ -1353,6 +2134,669 @@ void Scene200::signal() { } /*-------------------------------------------------------------------------- + * Scene 205 - Star-field Credits + * + *--------------------------------------------------------------------------*/ + +void Scene205::Action1::signal() { + Scene205 *scene = (Scene205 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + setDelay(2); + break; + + case 1: + scene->_yp = 100 - (scene->_fontHeight * 3 / 2); + scene->handleText(); + + for (int idx = 1; idx <= 2; ++idx) { + ++scene->_textIndex; + scene->_yp += scene->_fontHeight; + scene->handleText(); + } + setDelay(240); + break; + + case 2: + case 4: + case 6: + case 8: + case 10: + case 12: + case 14: + case 16: + case 18: + case 20: + textLoop(); + setDelay(120); + break; + + case 3: + scene->_textIndex = 1; + scene->_yp = 100 - ((scene->_fontHeight * 2) / 2); + scene->handleText(); + + ++scene->_textIndex; + scene->_yp += scene->_fontHeight; + scene->handleText(); + setDelay(240); + break; + + case 5: + scene->_textIndex = 1; + scene->_yp = 100 - ((scene->_fontHeight * 7) / 2); + scene->handleText(); + + for (int idx = 1; idx <= 6; ++idx) { + ++scene->_textIndex; + scene->_yp += scene->_fontHeight; + scene->handleText(); + } + + setDelay(480); + break; + + case 7: + scene->_textIndex = 1; + scene->_yp = 100 - ((scene->_fontHeight * 6) / 2); + scene->handleText(); + + for (int idx = 1; idx <= 5; ++idx) { + ++scene->_textIndex; + scene->_yp += scene->_fontHeight; + scene->handleText(); + } + + setDelay(300); + break; + + case 9: + scene->_textIndex = 1; + scene->_yp = 100 - ((scene->_fontHeight * 8) / 2); + scene->handleText(); + + for (int idx = 1; idx <= 7; ++idx) { + ++scene->_textIndex; + scene->_yp += scene->_fontHeight; + scene->handleText(); + } + + setDelay(480); + break; + + case 11: + scene->_textIndex = 1; + scene->_yp = 100 - ((scene->_fontHeight * 3) / 2); + scene->handleText(); + + for (int idx = 1; idx <= 2; ++idx) { + ++scene->_textIndex; + scene->_yp += scene->_fontHeight; + scene->handleText(); + } + + setDelay(240); + break; + + case 13: + scene->_textIndex = 1; + scene->_yp = 100 - ((scene->_fontHeight * 3) / 2); + scene->handleText(); + + for (int idx = 1; idx <= 2; ++idx) { + ++scene->_textIndex; + scene->_yp += scene->_fontHeight; + scene->handleText(); + } + + setDelay(240); + break; + + case 15: + scene->_textIndex = 1; + scene->_yp = 100 - ((scene->_fontHeight * 5) / 2); + scene->handleText(); + + for (int idx = 1; idx <= 4; ++idx) { + ++scene->_textIndex; + scene->_yp += scene->_fontHeight; + scene->handleText(); + } + + setDelay(240); + break; + + case 17: + scene->_textIndex = 1; + scene->_yp = 100 - ((scene->_fontHeight * 5) / 2); + scene->handleText(); + + for (int idx = 1; idx <= 4; ++idx) { + ++scene->_textIndex; + scene->_yp += scene->_fontHeight; + scene->handleText(); + } + + setDelay(360); + break; + + case 19: + scene->_textIndex = 1; + scene->_yp = 100 - ((scene->_fontHeight * 3) / 2); + scene->handleText(); + + for (int idx = 1; idx <= 2; ++idx) { + ++scene->_textIndex; + scene->_yp += scene->_fontHeight; + scene->handleText(); + } + + setDelay(480); + break; + + case 21: + R2_GLOBALS._sceneManager.changeScene(R2_GLOBALS._sceneManager._previousScene); + + default: + break; + } +} + +void Scene205::Action1::textLoop() { + Scene205 *scene = (Scene205 *)R2_GLOBALS._sceneManager._scene; + + for (int idx = 1; idx <= 14; ++idx) { + if (R2_GLOBALS._sceneObjects->contains(&scene->_textList[idx])) { + scene->_textList[idx].remove(); + } + } +} + +/*--------------------------------------------------------------------------*/ + +Scene205::Object::Object(): SceneObject() { + _x100 = _y100 = 0; +} + +void Scene205::Object::synchronize(Serializer &s) { + EventHandler::synchronize(s); + + s.syncAsSint32LE(_x100); + s.syncAsSint32LE(_y100); +} + +/*--------------------------------------------------------------------------*/ + +Scene205::Scene205(): SceneExt() { + _yp = 0; + _textIndex = 1; + _lineNum = -1; + + GfxFont font; + font.setFontNumber(4); + _fontHeight = font.getHeight(); +} + +void Scene205::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(4000); + R2_GLOBALS._player._uiEnabled = false; + + R2_GLOBALS._sound1.play(337); + R2_GLOBALS._scenePalette.loadPalette(0); + R2_GLOBALS._player.disableControl(); + + setup(); + setAction(&_action1); +} + +void Scene205::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + for (int idx = 0; idx < 3; ++idx) + SYNC_POINTER(_objList1[idx]); + for (int idx = 0; idx < 3; ++idx) + SYNC_POINTER(_objList2[idx]); + for (int idx = 0; idx < 4; ++idx) + SYNC_POINTER(_objList3[idx]); + + s.syncAsSint16LE(_textIndex); + s.syncAsSint16LE(_lineNum); + s.syncAsSint16BE(_yp); +} + +void Scene205::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene205::process(Event &event) { + if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) { + event.handled = true; + R2_GLOBALS._sceneManager.changeScene(R2_GLOBALS._sceneManager._previousScene); + } else { + Scene::process(event); + } +} + +void Scene205::dispatch() { + processList(_objList3, 4, Common::Rect(0, 0, 319, 200), 1, 1, 160, 100); + processList(_objList2, 3, Common::Rect(0, 0, 319, 200), 2, 2, 160, 100); + processList(_objList1, 3, Common::Rect(0, 0, 319, 200), 4, 3, 160, 100); + + Scene::dispatch(); +} + +void Scene205::setup() { + const Common::Point pointList1[3] = { Common::Point(2, 50), Common::Point(100, 28), Common::Point(53, 15) }; + const Common::Point pointList2[3] = { Common::Point(289, 192), Common::Point(125, 60), Common::Point(130, 40) }; + const Common::Point pointList3[4] = { + Common::Point(140, 149), Common::Point(91, 166), Common::Point(299, 46), Common::Point(314, 10) + }; + + // Set up the first object list + for (int idx = 0; idx < 3; ++idx) { + Object *obj = new Object(); + _objList1[idx] = obj; + + obj->postInit(); + obj->_flags |= OBJFLAG_CLONED; + obj->setVisage(205); + obj->_strip = 1; + obj->_frame = 1; + obj->setPosition(pointList1[idx]); + obj->_x100 = obj->_position.x * 100; + obj->_y100 = obj->_position.y * 100; + obj->fixPriority(12); + } + + // Setup the second object list + for (int idx = 0; idx < 3; ++idx) { + Object *obj = new Object(); + _objList2[idx] = obj; + + obj->postInit(); + obj->_flags |= OBJFLAG_CLONED; + obj->setVisage(205); + obj->_strip = 1; + obj->_frame = 2; + obj->setPosition(pointList2[idx]); + obj->_x100 = obj->_position.x * 100; + obj->_y100 = obj->_position.y * 100; + obj->fixPriority(11); + } + + // Setup the third object list + for (int idx = 0; idx < 4; ++idx) { + Object *obj = new Object(); + _objList3[idx] = obj; + + obj->postInit(); + obj->_flags |= OBJFLAG_CLONED; + obj->setVisage(205); + obj->_strip = 1; + obj->_frame = 3; + obj->setPosition(pointList3[idx]); + obj->_x100 = obj->_position.x * 100; + obj->_y100 = obj->_position.y * 100; + obj->fixPriority(10); + } +} + +/** + * Handles moving a group of stars in the scene background + */ +void Scene205::processList(Object **ObjList, int count, const Common::Rect &bounds, + int xMultiply, int yMultiply, int xCenter, int yCenter) { + for (int idx = 0; idx < count; ++idx) { + Object *obj = ObjList[idx]; + Common::Point pt(obj->_position.x - xCenter, obj->_position.y - yCenter); + + if ((obj->_position.x <= 319) && (obj->_position.x >= 0) && + (obj->_position.y <= 199) && (obj->_position.y >= 0)) { + if (!pt.x && !pt.y) { + pt.x = pt.y = 1; + } + + pt.x *= xMultiply; + pt.y *= yMultiply; + obj->_x100 += pt.x; + obj->_y100 += pt.y; + } else { + obj->_x100 = (bounds.left + R2_GLOBALS._randomSource.getRandomNumber(bounds.right)) * 100; + obj->_y100 = (bounds.top + R2_GLOBALS._randomSource.getRandomNumber(bounds.bottom)) * 100; + } + + obj->setPosition(Common::Point(obj->_x100 / 100, obj->_y100 / 100)); + } +} + +void Scene205::handleText() { + _message = g_resourceManager->getMessage(205, ++_lineNum); + + _textList[_textIndex]._fontNumber = 4; + _textList[_textIndex]._color1 = 0; + _textList[_textIndex]._color2 = 10; + _textList[_textIndex]._color3 = 7; + _textList[_textIndex]._width = 400; + _textList[_textIndex].setup(_message); + _textList[_textIndex].fixPriority(199); + + GfxFont font; + font.setFontNumber(4); + int width = font.getStringWidth(_message.c_str()); + + _textList[_textIndex].setPosition(Common::Point(160 - (width / 2), _yp)); +} + +/*-------------------------------------------------------------------------- + * Scene 250 - Lift + * + *--------------------------------------------------------------------------*/ + +Scene250::Button::Button(): SceneActor() { + _floorNumber = _v2 = 0; +} + +void Scene250::Button::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_floorNumber); + s.syncAsSint16LE(_v2); +} + +bool Scene250::Button::startAction(CursorType action, Event &event) { + Scene250 *scene = (Scene250 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (scene->_field414) { + SceneItem::display2(250, 15); + } else { + switch (_floorNumber) { + case 1: + case 2: + case 5: + case 9: + scene->_sound1.play(14); + scene->changeFloor(_floorNumber); + break; + case 10: + // Current Floor + scene->_sound1.play(14); + R2_GLOBALS._sceneManager.changeScene(R2_GLOBALS._sceneManager._previousScene); + break; + default: + SceneItem::display2(250, 16); + break; + } + } + return true; + + case CURSOR_LOOK: + switch (_floorNumber) { + case 1: + case 2: + case 5: + case 9: + SceneItem::display2(250, 12); + break; + case 10: + SceneItem::display2(250, 13); + break; + case 11: + SceneItem::display2(250, 14); + break; + default: + SceneItem::display2(250, 16); + break; + } + return true; + + default: + return SceneActor::startAction(action, event); + } +} + +void Scene250::Button::setFloor(int floorNumber) { + SceneActor::postInit(); + _floorNumber = floorNumber; + _v2 = 0; + + if (_floorNumber <= 9) { + SceneObject::setup(250, 1, 4); + + switch (_floorNumber) { + case 1: + case 2: + case 5: + case 9: + setFrame(6); + break; + default: + break; + } + + setPosition(Common::Point(111, (_floorNumber - 1) * 12 + 43)); + fixPriority(10); + setDetails(250, -1, -1, -1, 1, (SceneItem *)NULL); + } +} + +/*--------------------------------------------------------------------------*/ + +Scene250::Scene250(): SceneExt() { + _field412 = _field414 = _field416 = _field418 = _field41A = 0; +} + +void Scene250::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_field414); + s.syncAsSint16LE(_field416); + s.syncAsSint16LE(_field418); + s.syncAsSint16LE(_field41A); +} + +void Scene250::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(250); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + + _currentFloor.setFloor(10); + _currentFloor.setup(250, 1, 5); + _currentFloor.setDetails(250, 13, -1, -1, 1, (SceneItem *)NULL); + + _button1.setFloor(11); + _button1.setup(250, 1, 3); + _button1.setPosition(Common::Point(400, 100)); + _button1.setDetails(250, 14, -1, -1, 1, (SceneItem *)NULL); + _button1.fixPriority(190); + _button1.hide(); + + _floor1.setFloor(1); + _floor2.setFloor(2); + _floor3.setFloor(3); + _floor4.setFloor(4); + _floor5.setFloor(5); + _floor6.setFloor(6); + _floor7.setFloor(7); + _floor8.setFloor(8); + _floor9.setFloor(9); + + _item2.setDetails(Rect(0, 0, 73, SCREEN_HEIGHT), 250, 9, -1, 9, 1, NULL); + _item4.setDetails(Rect(239, 16, 283, 164), 250, 6, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 250, 0, 1, -1, 1, NULL); + + R2_GLOBALS._events.setCursor(CURSOR_USE); + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 200: + _field412 = 55; + break; + case 300: + _field412 = 43; + break; + case 700: + _field412 = 139; + break; + case 850: + _field412 = 91; + break; + default: + R2_GLOBALS._sceneManager._previousScene = 200; + _field412 = 55; + break; + } + + _currentFloor.setPosition(Common::Point(111, _field412)); +} + +void Scene250::signal() { + if (_field41A) + _sceneMode = 20; + + switch (_sceneMode) { + case 1: + _sound1.play(22); + R2_GLOBALS._player.show(); + R2_GLOBALS._player.setup(250, 1, 2); + R2_GLOBALS._player.setPosition(Common::Point(261, 185)); + ADD_MOVER(R2_GLOBALS._player, 261, 15); + + _field416 = 0; + _sceneMode = 2; + break; + case 2: + _sceneMode = ((_field414 - 12) == _field412) ? 4 : 3; + signal(); + break; + case 3: + _currentFloor.setPosition(Common::Point(111, _currentFloor._position.y + 12)); + _field412 += 12; + R2_GLOBALS._player.setPosition(Common::Point(261, 185)); + ADD_MOVER(R2_GLOBALS._player, 261, 15); + + if ((_field414 - 12) == _field412) + _sceneMode = 4; + break; + case 4: + _sound1.play(21); + + _currentFloor.setPosition(Common::Point(111, _currentFloor._position.y + 12)); + R2_GLOBALS._player.setPosition(Common::Point(261, 185)); + ADD_MOVER(R2_GLOBALS._player, 261, 15); + _sceneMode = 5; + break; + case 5: + R2_GLOBALS._player.disableControl(); + _sceneMode = 20; + signal(); + break; + case 6: + _sound1.play(22); + R2_GLOBALS._player.show(); + R2_GLOBALS._player.setup(250, 1, 2); + R2_GLOBALS._player.setPosition(Common::Point(261, 15)); + ADD_MOVER(R2_GLOBALS._player, 261, 185); + _field416 = 0; + _sceneMode = 7; + break; + case 7: + _field418 = 1; + if ((_field414 + 12) == _field412) + _sceneMode = 8; + signal(); + break; + case 8: + _currentFloor.setPosition(Common::Point(111, _currentFloor._position.y - 12)); + _field412 -= 12; + R2_GLOBALS._player.setPosition(Common::Point(261, 15)); + ADD_MOVER(R2_GLOBALS._player, 261, 185); + + if ((_field414 + 12) == _field412) + _sceneMode = 9; + break; + case 9: + _sound1.play(21); + _currentFloor.setPosition(Common::Point(111, _currentFloor._position.y - 12)); + R2_GLOBALS._player.setPosition(Common::Point(261, 15)); + ADD_MOVER(R2_GLOBALS._player, 261, 185); + _sceneMode = 10; + break; + case 10: + _sceneMode = 20; + signal(); + break; + case 20: + // Handle changing scene + switch (_field414) { + case 55: + R2_GLOBALS._sceneManager.changeScene(200); + break; + case 43: + R2_GLOBALS._sceneManager.changeScene(300); + break; + case 139: + R2_GLOBALS._sceneManager.changeScene(139); + break; + case 91: + R2_GLOBALS._sceneManager.changeScene(850); + break; + default: + break; + } + break; + default: + break; + } +} + +void Scene250::changeFloor(int floorNumber) { + _field414 = (floorNumber - 1) * 12 + 43; + _button1.setPosition(Common::Point(111, _field414)); + _button1.show(); + + _sceneMode = (_field412 >= _field414) ? 6 : 1; + if (_field414 == _field412) + _sceneMode = 20; + + signal(); +} + +void Scene250::process(Event &event) { + if (!event.handled) { + if (((event.eventType == EVENT_KEYPRESS) || (event.btnState != 0)) && _field418) { + _field41A = 1; + event.handled = true; + } + + SceneExt::process(event); + } +} + +void Scene250::dispatch() { + SceneExt::dispatch(); + + if (((_sceneMode == 2) || (_sceneMode == 7)) && (_field416 < 100)) { + ++_field416; + R2_GLOBALS._player._moveDiff.y = _field416 / 5; + } + + if (((_sceneMode == 5) || (_sceneMode == 10)) && (R2_GLOBALS._player._moveDiff.y > 4)) { + --_field416; + R2_GLOBALS._player._moveDiff.y = _field416 / 7 + 3; + } +} + +/*-------------------------------------------------------------------------- * Scene 300 - Bridge * *--------------------------------------------------------------------------*/ @@ -1395,7 +2839,7 @@ void Scene300::Action2::signal() { case 2: if (!R2_GLOBALS._playStream.isPlaying()) _actionIndex = R2_GLOBALS._randomSource.getRandomNumber(1); - + setDelay(60 + R2_GLOBALS._randomSource.getRandomNumber(119)); break; default: @@ -1418,7 +2862,7 @@ void Scene300::Action3::signal() { case 2: if (!R2_GLOBALS._playStream.isPlaying()) _actionIndex = R2_GLOBALS._randomSource.getRandomNumber(1); - + setDelay(60 + R2_GLOBALS._randomSource.getRandomNumber(119)); break; default: @@ -1480,7 +2924,7 @@ bool Scene300::MirandaWorkstation::startAction(CursorType action, Event &event) if (R2_GLOBALS._player._characterIndex != 3) SceneItem::display2(300, 49); else - R2_GLOBALS._sceneManager.changeScene(325); + R2_GLOBALS._sceneManager.changeScene(325); return true; case CURSOR_LOOK: @@ -1510,7 +2954,7 @@ bool Scene300::SeekerWorkstation::startAction(CursorType action, Event &event) { if (R2_GLOBALS._player._characterIndex != 2) SceneItem::display2(300, 48); else - R2_GLOBALS._sceneManager.changeScene(325); + R2_GLOBALS._sceneManager.changeScene(325); return true; default: @@ -1582,7 +3026,7 @@ bool Scene300::Miranda::startAction(CursorType action, Event &event) { SceneItem::display2(300, 54); return true; - case R2_2: + case R2_READER: if (!R2_GLOBALS.getFlag(2) || !R2_GLOBALS.getFlag(3) || (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == 1)) SceneItem::display2(300, 55); else { @@ -1656,7 +3100,7 @@ bool Scene300::Seeker::startAction(CursorType action, Event &event) { scene->setAction(&scene->_sequenceManager1, scene, 310, &R2_GLOBALS._player, NULL); return true; - case R2_2: + case R2_READER: if (!R2_GLOBALS.getFlag(2) || !R2_GLOBALS.getFlag(3) || (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == 1)) break; @@ -1665,7 +3109,7 @@ bool Scene300::Seeker::startAction(CursorType action, Event &event) { scene->_sceneMode = 310; scene->setAction(&scene->_sequenceManager1, scene, 310, &R2_GLOBALS._player, NULL); return true; - + default: break; } @@ -1707,6 +3151,25 @@ bool Scene300::Quinn::startAction(CursorType action, Event &event) { } } +bool Scene300::Doorway::startAction(CursorType action, Event &event) { + Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + if ((R2_GLOBALS._player._characterIndex == R2_QUINN) && + (!R2_GLOBALS.getFlag(44) || R2_GLOBALS._player._characterScene[R2_MIRANDA] == 500)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 301; + scene->setAction(&scene->_sequenceManager1, scene, 301, &R2_GLOBALS._player, this, NULL); + } else { + SceneItem::display2(300, 45); + } + + return true; + } else { + return SceneActor::startAction(action, event); + } +} + /*--------------------------------------------------------------------------*/ Scene300::Scene300(): SceneExt() { @@ -1769,7 +3232,6 @@ void Scene300::postInit(SceneObjectList *OwnerList) { _object4.postInit(); _object4.setup(300, 5, 1); _object4.setPosition(Common::Point(236, 48)); - _object4.animate(ANIM_MODE_2, NULL); _protocolDisplay.postInit(); @@ -1814,7 +3276,7 @@ void Scene300::postInit(SceneObjectList *OwnerList) { _miranda.setup(302, 2, 1); _miranda.setPosition(Common::Point(47, 128)); _miranda.setAction(&_action3); - _miranda.setDetails(300, 39, 40, 41, 1, NULL); + _miranda.setDetails(300, 39, 40, 41, 1, (SceneItem *)NULL); if ((R2_GLOBALS._player._characterScene[2] == 300) || (R2_GLOBALS._player._characterScene[2] == 325)) { _seeker.postInit(); @@ -1822,7 +3284,7 @@ void Scene300::postInit(SceneObjectList *OwnerList) { _seeker.setPosition(Common::Point(158, 108)); _seeker.fixPriority(130); _seeker.setAction(&_action2); - _seeker.setDetails(300, 42, 43, 44, 1, NULL); + _seeker.setDetails(300, 42, 43, 44, 1, (SceneItem *)NULL); } R2_GLOBALS._player.postInit(); @@ -1836,14 +3298,14 @@ void Scene300::postInit(SceneObjectList *OwnerList) { _miranda.setup(302, 2, 1); _miranda.setPosition(Common::Point(47, 128)); _miranda.setAction(&_action3); - _miranda.setDetails(300, 39, 40, 41, 1, NULL); + _miranda.setDetails(300, 39, 40, 41, 1, (SceneItem *)NULL); if ((R2_GLOBALS._player._characterScene[1] == 300) || (R2_GLOBALS._player._characterScene[1] == 325)) { _quinn.postInit(); _quinn.setup(302, 3, 1); _quinn.setPosition(Common::Point(271, 150)); _quinn.setAction(&_action1); - _quinn.setDetails(300, 50, 51, 52, 1, NULL); + _quinn.setDetails(300, 50, 51, 52, 1, (SceneItem *)NULL); } R2_GLOBALS._player.postInit(); @@ -1860,7 +3322,7 @@ void Scene300::postInit(SceneObjectList *OwnerList) { _seeker.setPosition(Common::Point(158, 108)); _seeker.fixPriority(130); _seeker.setAction(&_action2); - _seeker.setDetails(300, 42, 43, 44, 1, NULL); + _seeker.setDetails(300, 42, 43, 44, 1, (SceneItem *)NULL); } if ((R2_GLOBALS._player._characterScene[1] == 300) || (R2_GLOBALS._player._characterScene[1] == 325)) { @@ -1868,7 +3330,7 @@ void Scene300::postInit(SceneObjectList *OwnerList) { _quinn.setup(302, 3, 1); _quinn.setPosition(Common::Point(271, 150)); _quinn.setAction(&_action1); - _quinn.setDetails(300, 50, 51, 52, 1, NULL); + _quinn.setDetails(300, 50, 51, 52, 1, (SceneItem *)NULL); } R2_GLOBALS._player.postInit(); @@ -1890,11 +3352,11 @@ void Scene300::postInit(SceneObjectList *OwnerList) { _manualOverrides.setDetails(14, 300, 15, -1, 17); _scanners1.setDetails(Rect(126, 15, 183, 25), 300, 18, -1, 20, 1, NULL); _scanners2.setDetails(Rect(126, 80, 183, 90), 300, 18, -1, 20, 1, NULL); - _protocolDisplay.setDetails(300, 27, -1, 29, 1, NULL); + _protocolDisplay.setDetails(300, 27, -1, 29, 1, (SceneItem *)NULL); _indirectLighting1.setDetails(Rect(74, 71, 122, 89), 300, 21, -1, -1, 1, NULL); _indirectLighting2.setDetails(Rect(197, 71, 245, 89), 300, 21, -1, -1, 1, NULL); _lighting.setDetails(Rect(129, 3, 190, 14), 300, 24, -1, -1, 1, NULL); - _doorway.setDetails(300, 3, -1, 5, 1, NULL); + _doorway.setDetails(300, 3, -1, 5, 1, (SceneItem *)NULL); _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 300, 0, -1, -1, 1, NULL); switch (R2_GLOBALS._player._characterIndex) { @@ -1913,7 +3375,7 @@ void Scene300::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.setup(302, 3, 1); R2_GLOBALS._player.setPosition(Common::Point(271, 150)); R2_GLOBALS._player.setAction(&_action1); - + if (R2_GLOBALS.getFlag(55)) { if (R2_GLOBALS.getFlag(57)) { R2_GLOBALS.clearFlag(60); @@ -2214,7 +3676,7 @@ void Scene300::signal() { void Scene300::signal309() { if (R2_GLOBALS.getFlag(2)) - R2_GLOBALS._stripManager_lookupList[0] = (R2_INVENTORY.getObjectScene(R2_2) == 1) ? 3 : 2; + R2_GLOBALS._stripManager_lookupList[0] = (R2_INVENTORY.getObjectScene(R2_READER) == 1) ? 3 : 2; if (R2_GLOBALS.getFlag(4)) R2_GLOBALS._stripManager_lookupList[0] = 4; @@ -2229,7 +3691,7 @@ void Scene300::signal309() { if (R2_GLOBALS.getFlag(39)) R2_GLOBALS._stripManager_lookupList[1] = 2; - + if (R2_GLOBALS.getFlag(5)) R2_GLOBALS._stripManager_lookupList[1] = 3; @@ -2251,6 +3713,3766 @@ void Scene300::signal309() { R2_GLOBALS._stripManager_lookupList[4] = 3; } +/*-------------------------------------------------------------------------- + * Scene 325 - Bridge Console + * + *--------------------------------------------------------------------------*/ + +const double ADJUST_FACTOR = 0.06419999999999999; + +/*--------------------------------------------------------------------------*/ + +Scene325::Icon::Icon(): SceneActor() { + _lookLineNum = 0; + _field98 = 0; + _pressed = false; +} + +void Scene325::Icon::postInit(SceneObjectList *OwnerList) { + SceneObject::postInit(); + + _object1.postInit(); + _object1.fixPriority(21); + _object1.hide(); + + _sceneText1._color1 = 92; + _sceneText1._color2 = 0; + _sceneText1._width = 200; + _sceneText2._color1 = 0; + _sceneText2._color2 = 0; + _sceneText2._width = 200; + fixPriority(20); +} + +void Scene325::Icon::synchronize(Serializer &s) { + SceneActor::synchronize(s); + s.syncAsSint16LE(_lookLineNum); + s.syncAsSint16LE(_field98); + s.syncAsSint16LE(_pressed); +} + +void Scene325::Icon::process(Event &event) { + Scene325 *scene = (Scene325 *)R2_GLOBALS._sceneManager._scene; + + if (!event.handled && !(_flags & OBJFLAG_HIDING) && R2_GLOBALS._player._uiEnabled) { + + if (event.eventType == EVENT_BUTTON_DOWN) { + int regionIndex = R2_GLOBALS._sceneRegions.indexOf(event.mousePos); + + switch (R2_GLOBALS._events.getCursor()) { + case CURSOR_LOOK: + if (regionIndex == _sceneRegionId) { + event.handled = true; + SceneItem::display2(326, _lookLineNum); + } + break; + + case CURSOR_USE: + if ((regionIndex == _sceneRegionId) && !_pressed) { + scene->_sound1.play(14); + setFrame(2); + + switch (_object1._strip) { + case 1: + _object1.setStrip(2); + break; + case 3: + _object1.setStrip(4); + break; + case 5: + _object1.setStrip(6); + break; + case 7: + _object1.setStrip(8); + break; + default: + break; + } + + _pressed = true; + event.handled = true; + } + break; + + default: + break; + } + } + + if ((event.eventType == EVENT_BUTTON_UP) && _pressed) { + setFrame(1); + + switch (_object1._strip) { + case 2: + _object1.setStrip(1); + break; + case 4: + _object1.setStrip(3); + break; + case 6: + _object1.setStrip(5); + break; + default: + break; + } + + _pressed = false; + event.handled = true; + scene->consoleAction(_lookLineNum); + } + } +} + +void Scene325::Icon::setIcon(int id) { + Scene325 *scene = (Scene325 *)R2_GLOBALS._sceneManager._scene; + + _lookLineNum = _field98 = id; + SceneActor::_lookLineNum = id; + + _sceneText1.remove(); + _sceneText2.remove(); + + if (_lookLineNum) { + showIcon(); + _object1.setup(325, ((id - 1) / 10) * 2 + 1, ((id - 1) % 10) + 1); + _object1.setPosition(_position); + + _sceneText1._fontNumber = scene->_iconFontNumber; + _sceneText1.setup(CONSOLE325_MESSAGES[id]); + _sceneText1.fixPriority(20); + + _sceneText2._fontNumber = scene->_iconFontNumber; + _sceneText2.setup(CONSOLE325_MESSAGES[id]); + _sceneText2.fixPriority(20); + + _sceneText2._fontNumber = scene->_iconFontNumber; + _sceneText2.setup(CONSOLE325_MESSAGES[id]); + _sceneText2.fixPriority(10); + + switch (_lookLineNum) { + case 7: + _sceneText1.setPosition(Common::Point(62, _position.y + 8)); + _sceneText2.setPosition(Common::Point(64, _position.y + 10)); + break; + case 8: + case 9: + _sceneText1.setPosition(Common::Point(65, _position.y + 8)); + _sceneText2.setPosition(Common::Point(67, _position.y + 10)); + break; + case 12: + _sceneText1.setPosition(Common::Point(83, _position.y + 8)); + _sceneText2.setPosition(Common::Point(85, _position.y + 10)); + break; + default: + _sceneText1.setPosition(Common::Point(121, _position.y + 8)); + _sceneText2.setPosition(Common::Point(123, _position.y + 10)); + break; + } + } else { + hideIcon(); + } +} + +void Scene325::Icon::showIcon() { + _sceneText1.show(); + _sceneText2.show(); + _object1.show(); + _object2.show(); + show(); +} + +void Scene325::Icon::hideIcon() { + _sceneText1.hide(); + _sceneText2.hide(); + _object1.hide(); + _object2.hide(); + hide(); +} + +/*--------------------------------------------------------------------------*/ + +Scene325::Scene325(): SceneExt() { + _field412 = 7; + _iconFontNumber = 50; + _field416 = _field418 = 0; + _field41A = _field41C = _field41E = _field420 = 0; + _soundCount = _soundIndex = 0; + + for (int idx = 0; idx < 10; ++idx) + _soundQueue[idx] = 0; +} + +void Scene325::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(325); + + R2_GLOBALS.clearFlag(50); + _stripManager.addSpeaker(&_quinnSpeaker); + _palette.loadPalette(0); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _item2.setDetails(1, 325, 3, 4, 5); + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 325, 0, 1, 2, 1, (SceneItem *)NULL); + _sceneMode = 1; + signal(); +} + +void Scene325::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_iconFontNumber); + s.syncAsSint16LE(_field416); + s.syncAsSint16LE(_field418); + s.syncAsSint16LE(_field41A); + s.syncAsSint16LE(_field41C); + s.syncAsSint16LE(_field41E); + s.syncAsSint16LE(_field420); + s.syncAsSint16LE(_soundCount); + s.syncAsSint16LE(_soundIndex); + + for (int idx = 0; idx < 10; ++idx) + s.syncAsSint16LE(_soundQueue[idx]); +} + +void Scene325::remove() { + removeText(); + SceneExt::remove(); +} + +void Scene325::signal() { + switch (_sceneMode - 1) { + case 0: + _icon1.postInit(); + _icon1._sceneRegionId = 2; + _icon2.postInit(); + _icon2._sceneRegionId = 3; + _icon3.postInit(); + _icon3._sceneRegionId = 4; + _icon4.postInit(); + _icon4._sceneRegionId = 5; + + setAction(&_sequenceManager1, this, 127, &_icon1, &_icon2, &_icon3, &_icon4, + &R2_GLOBALS._player, NULL); + _sceneMode = 2; + break; + case 1: + _icon1.setup(160, 1, 1); + _icon1.setPosition(Common::Point(65, 17)); + _icon1._object2.postInit(); + _icon1._object2.setup(160, 7, 1); + _icon1._object2.setPosition(Common::Point(106, 41)); + + _icon2.setup(160, 1, 1); + _icon2.setPosition(Common::Point(80, 32)); + _icon2._object2.postInit(); + _icon2._object2.setup(160, 7, 2); + _icon2._object2.setPosition(Common::Point(106, 56)); + + _icon3.setup(160, 1, 1); + _icon3.setPosition(Common::Point(65, 47)); + _icon3._object2.postInit(); + _icon3._object2.setup(160, 7, 1); + _icon3._object2.setPosition(Common::Point(106, 71)); + + _icon4.setup(160, 1, 1); + _icon4.setPosition(Common::Point(80, 62)); + _icon4._sceneRegionId = 5; + _icon4._object2.postInit(); + _icon4._object2.setup(160, 7, 2); + _icon4._object2.setPosition(Common::Point(106, 86)); + + _icon5.postInit(); + _icon5.setup(160, 1, 1); + _icon5._sceneRegionId = 7; + _icon5.setPosition(Common::Point(37, 92)); + _icon5.setIcon(8); + + _icon6.postInit(); + _icon6.setup(160, 1, 1); + _icon6.setPosition(Common::Point(106, 110)); + _icon6.setIcon(7); + _icon6._sceneRegionId = 8; + + consoleAction(7); + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + break; + case 9: + switch (_field412) { + case 3: + _sceneMode = 129; + _object1.postInit(); + _object2.postInit(); + _object3.postInit(); + if (R2_GLOBALS.getFlag(13)) { + _object4.postInit(); + setAction(&_sequenceManager1, this, 130, &R2_GLOBALS._player, &_object1, + &_object2, &_object3, &_object4, NULL); + } else { + setAction(&_sequenceManager1, this, 129, &R2_GLOBALS._player, &_object1, + &_object2, &_object3, NULL); + } + break; + case 17: + case 18: + case 19: + case 20: { + int v = 10 - ((21 - _field412) * 2); + if (R2_GLOBALS.getFlag(50)) + --v; + if (_field418 == 5) + v += 8; + if (R2_GLOBALS.getFlag(51) && (v == 2)) + R2_GLOBALS.setFlag(57); + + if (R2_GLOBALS.getFlag(44) && !R2_GLOBALS.getFlag(51)) { + if (v != 13) { + setMessage(328, 0); + } else { + _field420 = 864; + + _object12.postInit(); + _object2.setup(326, 4, 1); + _object12.setPosition(Common::Point(149, 128)); + _object12.fixPriority(20); + + _object13.postInit(); + _object13.setup(326, 4, 2); + _object13.setPosition(Common::Point(149, (int)(_field420 * ADJUST_FACTOR))); + _object13.fixPriority(21); + + _object10.postInit(); + _object10.setup(326, 1, 1); + _object10.setPosition(Common::Point(210, 20)); + _object10.fixPriority(10); + + _object1.postInit(); + _object1.setup(326, 1, 1); + _object1.setPosition(Common::Point(210, 32)); + _object10.fixPriority(10); + + _object2.postInit(); + _object2.setup(326, 1, 1); + _object2.setPosition(Common::Point(210, 44)); + _object2.fixPriority(10); + + _object3.postInit(); + _object3.setup(326, 1, 1); + _object3.setPosition(Common::Point(210, 56)); + _object3.fixPriority(10); + + _object4.postInit(); + _object4.setup(326, 1, 1); + _object4.setPosition(Common::Point(210, 68)); + _object4.fixPriority(10); + + _object5.postInit(); + _object5.setup(326, 1, 1); + _object5.setPosition(Common::Point(210, 80)); + _object5.fixPriority(10); + + _object6.postInit(); + _object6.setup(326, 1, 1); + _object6.setPosition(Common::Point(210, 92)); + _object6.fixPriority(10); + + _object7.postInit(); + _object7.setup(326, 1, 1); + _object7.setPosition(Common::Point(210, 104)); + _object7.fixPriority(10); + + _object8.postInit(); + _object8.setup(326, 1, 1); + _object8.setPosition(Common::Point(210, 116)); + _object8.fixPriority(10); + + _object9.postInit(); + _object9.setup(326, 1, 1); + _object9.setPosition(Common::Point(210, 128)); + _object9.fixPriority(10); + + _object11.postInit(); + _object11.setup(326, 1, 1); + _object11.setPosition(Common::Point(210, 150)); + _object11.fixPriority(10); + } + } else if (R2_GLOBALS.getFlag(51)) { + setMessage(329, (v == 12) ? 10 : v); + } else { + setMessage(327, (v < 15) ? 1 : v); + } + break; + } + case 21: + _sceneMode = 129; + + _object1.postInit(); + _object1.setup(327, 1, 1); + _object1.setPosition(Common::Point(170, 80)); + _object1.fixPriority(10); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 22: + _sceneMode = 129; + + _object1.postInit(); + _object1.setup(327, 2, 1); + _object1.setPosition(Common::Point(160, 80)); + _object1.fixPriority(10); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 24: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + _field416 = 37; + setMessage(128, _field416); + break; + case 25: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + _field416 = 68; + setMessage(128, _field416); + break; + case 26: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + _field416 = 105; + setMessage(128, _field416); + break; + default: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + _field416 = 105; + setMessage(128, _field416); + break; + } + break; + case 10: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + + if ((_field412 >= 17) && (_field412 <= 20)) { + _icon5.setIcon(8); + consoleAction(4); + } else { + consoleAction(7); + } + + _icon6.setIcon(7); + break; + case 11: + R2_GLOBALS.setFlag(45); + R2_GLOBALS._sceneManager.changeScene(300); + break; + case 12: + R2_GLOBALS.setFlag(57); + R2_GLOBALS._sceneManager.changeScene(300); + break; + case 14: + if (_soundCount) + --_soundCount; + + if (!_soundCount || (R2_GLOBALS._speechSubtitles == 2)) { + _soundIndex = 0; + R2_GLOBALS._playStream.stop(); + } else { + _sceneMode = 15; + R2_GLOBALS._playStream.play(_soundQueue[_soundIndex], this); + } + break; + default: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + break; + } +} + +void Scene325::removeText() { + _text1.remove(); + _soundCount = 0; + _soundIndex = 0; + R2_GLOBALS._playStream.stop(); +} + +void Scene325::consoleAction(int id) { + _icon1.setIcon(0); + _icon2.setIcon(0); + _icon3.setIcon(0); + _icon4.setIcon(0); + + if (id == 7) + _icon5.setIcon(9); + else if ((_field412 != 3) && ((_field412 < 17) || (_field412 > 26))) + _icon5.setIcon(8); + + switch (id - 1) { + case 0: + _icon1.setIcon(10); + _icon2.setIcon(11); + break; + case 1: + _icon1.setIcon(23); + _icon2.setIcon(24); + _icon3.setIcon(25); + _icon4.setIcon(26); + case 2: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + R2_GLOBALS._player.disableControl(); + consoleAction(7); + _icon1.hideIcon(); + _icon2.hideIcon(); + _icon3.hideIcon(); + // TODO: Finish + break; + case 3: + _icon1.setIcon(5); + _icon2.setIcon(6); + _icon3.setIcon(R2_GLOBALS.getFlag(50) ? 16 : 15); + break; + case 4: + case 5: + _field418 = id; + _icon1.setIcon(17); + _icon2.setIcon(18); + _icon3.setIcon(19); + break; + case 7: + consoleAction(((_field412 == 5) || (_field412 == 6) || (_field412 == 15)) ? 4 : 7); + break; + case 8: + R2_GLOBALS._sceneManager.changeScene(300); + case 9: + case 10: + _iconFontNumber = (id - 1) == 9 ? 50 : 52; + _text1.remove(); + _icon6.setIcon(7); + break; + case 11: + if (R2_GLOBALS.getFlag(57) && (R2_GLOBALS._player._characterIndex == 1) && !R2_GLOBALS.getFlag(25)) { + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_ARROW); + _sceneMode = 13; + _stripManager.start(403, this); + } else { + R2_GLOBALS._player.disableControl(); + _text1.remove(); + + _icon4.setPosition(Common::Point(80, 62)); + _icon4._sceneRegionId = 5; + _icon4.hideIcon(); + + _object12.remove(); + _object13.remove(); + _object10.remove(); + _object1.remove(); + _object2.remove(); + _object3.remove(); + _object4.remove(); + _object5.remove(); + _object6.remove(); + _object7.remove(); + _object8.remove(); + _object9.remove(); + _object11.remove(); + + _palette.loadPalette(160); + _sceneMode = 11; + + BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this); + } + break; + case 12: + _icon4.setIcon(14); + _icon4._object2.hide(); + + switch (_field412) { + case 17: + case 18: + case 19: + case 20: + if (_field420) { + R2_GLOBALS._player.disableControl(); + _field41A = 1296; + _field41E = 1; + } + break; + default: + setMessage(128, --_field416); + break; + } + return; + case 13: + _icon4.setIcon(14); + _icon4._object2.hide(); + + switch (_field412) { + case 17: + case 18: + case 19: + case 20: + if (_field420 < 1620) { + R2_GLOBALS._player.disableControl(); + _field41A = 1296; + _field41E = -1; + } + break; + } + return; + case 14: + if (R2_GLOBALS.getFlag(55)) { + SceneItem::display2(329, 17); + } else { + R2_GLOBALS.setFlag(50); + consoleAction(4); + } + id = 4; + break; + case 15: + R2_GLOBALS.clearFlag(50); + consoleAction(4); + id = 4; + break; + case 22: + case 23: + case 24: + case 25: + R2_GLOBALS._player.disableControl(); + consoleAction(2); + _field412 = id; + + _icon1.hideIcon(); + _icon2.hideIcon(); + _icon3.hideIcon(); + _icon4.hideIcon(); + + _icon5.setIcon(13); + _icon4.setPosition(Common::Point(52, 107)); + _icon4._sceneRegionId = 9; + _icon4.setIcon(14); + _icon4._object2.hide(); + + _icon6.setIcon(12); + _sceneMode = 10; + _palette.loadPalette(161); + + BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this); + break; + case 6: + default: + _icon1.setIcon(1); + _icon2.setIcon(2); + _icon3.setIcon(3); + int idList[3] = { 4, 22, 21 }; + _icon4.setIcon(idList[R2_GLOBALS._player._characterIndex - 1]); + break; + } + + if (id != 8) + _field412 = id; +} + +void Scene325::process(Event &event) { + SceneExt::process(event); + + if (R2_GLOBALS._player._uiEnabled) { + _icon1.process(event); + _icon2.process(event); + _icon3.process(event); + _icon4.process(event); + _icon5.process(event); + _icon6.process(event); + } +} + +void Scene325::dispatch() { + if (_field41A) { + switch (_field41A) { + case 13: + _field41C = 1; + break; + case 1296: + R2_GLOBALS._sound3.play(87); + _field41C = 1; + break; + case 33: + case 1283: + _field41C = 2; + break; + case 63: + case 1263: + _field41C = 3; + break; + case 103: + case 1233: + _field41C = 4; + break; + case 153: + case 1193: + _field41C = 5; + break; + case 213: + case 1143: + _field41C = 6; + break; + case 283: + case 1083: + _field41C = 7; + break; + case 1013: + _field41C = 8; + break; + default: + break; + } + + _field41A -= _field41C; + int yp = _field41E * _field41C + _object10._position.y; + bool flag = false; + + if (yp >= 30) { + yp -= 12; + --_field420; + flag = true; + } + if (yp <= 10) { + yp += 12; + ++_field420; + flag = true; + } + _object3.setPosition(Common::Point(149, (int)(_field420 * ADJUST_FACTOR) + 22)); + + for (int idx = 0; idx < 4; ++idx) + _objList[idx].remove(); + + if (flag) { + int v = _field420 - 758; + _object10.setFrame((v++ <= 0) ? 1 : v); + _object1.setFrame((v++ <= 0) ? 1 : v); + _object2.setFrame((v++ <= 0) ? 1 : v); + _object3.setFrame((v++ <= 0) ? 1 : v); + _object4.setFrame((v++ <= 0) ? 1 : v); + _object5.setFrame((v++ <= 0) ? 1 : v); + _object6.setFrame((v++ <= 0) ? 1 : v); + _object7.setFrame((v++ <= 0) ? 1 : v); + _object8.setFrame((v++ <= 0) ? 1 : v); + _object9.setFrame((v++ <= 0) ? 1 : v); + _object11.setFrame((v++ <= 0) ? 1 : v); + } + + _object10.setPosition(Common::Point(210, yp)); + yp += 12; + _object1.setPosition(Common::Point(210, yp)); + yp += 12; + _object2.setPosition(Common::Point(210, yp)); + yp += 12; + _object3.setPosition(Common::Point(210, yp)); + yp += 12; + _object4.setPosition(Common::Point(210, yp)); + yp += 12; + _object5.setPosition(Common::Point(210, yp)); + yp += 12; + _object6.setPosition(Common::Point(210, yp)); + yp += 12; + _object7.setPosition(Common::Point(210, yp)); + yp += 12; + _object8.setPosition(Common::Point(210, yp)); + yp += 12; + _object9.setPosition(Common::Point(210, yp)); + yp += 12; + _object11.setPosition(Common::Point(210, yp)); + + if (!_field41A) { + R2_GLOBALS._sound3.stop(); + _field41C = 0; + + if (_field420 == 756) { + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_USE); + _sceneMode = 12; + _stripManager.start(212, this); + } else { + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + } + } + } + + SceneExt::dispatch(); +} + +void Scene325::setMessage(int resNum, int lineNum) { + Common::String msg = g_resourceManager->getMessage(resNum, lineNum); + + if (!msg.empty()) { + Common::String msgText = parseMessage(msg); + + _text1._fontNumber = _iconFontNumber; + _text1._color1 = 92; + _text1._color2 = 0; + _text1._width = 221; + _text1.fixPriority(20); + _text1.setup(msgText); + _text1.setPosition(Common::Point(49, 19)); + + R2_GLOBALS._sceneObjects->draw(); + + if ((_soundCount != 0) && (R2_GLOBALS._speechSubtitles != 2)) { + _sceneMode = 15; + R2_GLOBALS._playStream.play(_soundQueue[_soundIndex++], this); + } + } else { + _field412 = 13; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.hide(); + + _icon4.setPosition(Common::Point(80, 62)); + _icon4._sceneRegionId = 5; + _icon4.hideIcon(); + + _palette.loadPalette(160); + _sceneMode = 11; + BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this); + } +} + +/** + * Parses a message to be displayed on the console to see whether there are any sounds to be played. + */ +Common::String Scene325::parseMessage(const Common::String &msg) { + _soundIndex = 0; + _soundCount = 0; + + const char *msgP = msg.c_str(); + while (*msgP == '!') { + // Get the sound number + _soundQueue[_soundCount++] = atoi(++msgP); + + while (!((*msgP == '\0') || (*msgP < '0') || (*msgP > '9'))) + ++msgP; + } + + return Common::String(msgP); +} +/*-------------------------------------------------------------------------- + * Scene 400 - Science Lab + * + *--------------------------------------------------------------------------*/ + +bool Scene400::Terminal::startAction(CursorType action, Event &event) { + Scene400 *scene = (Scene400 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 402; + scene->setAction(&scene->_sequenceManager1, scene, 402, &R2_GLOBALS._player, this, NULL); + + return true; + } else { + return NamedHotspot::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene400::Door::startAction(CursorType action, Event &event) { + Scene400 *scene = (Scene400 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 401; + scene->setAction(&scene->_sequenceManager1, scene, 401, &R2_GLOBALS._player, this, NULL); + + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene400::Reader::startAction(CursorType action, Event &event) { + Scene400 *scene = (Scene400 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 405; + scene->setAction(&scene->_sequenceManager1, scene, 405, &R2_GLOBALS._player, this, NULL); + + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene400::SensorProbe::startAction(CursorType action, Event &event) { + Scene400 *scene = (Scene400 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 404; + scene->setAction(&scene->_sequenceManager1, scene, 404, &R2_GLOBALS._player, this, NULL); + + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene400::AttractorUnit::startAction(CursorType action, Event &event) { + Scene400 *scene = (Scene400 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 406; + scene->setAction(&scene->_sequenceManager1, scene, 406, &R2_GLOBALS._player, this, NULL); + + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene400::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(400); + _sound1.play(20); + + _door.postInit(); + _door.setVisage(100); + _door.setPosition(Common::Point(123, 84)); + _door.setDetails(400, 24, -1, 26, 1, (SceneItem *)NULL); + + _consoleDisplay.postInit(); + _consoleDisplay.setup(400, 4, 1); + _consoleDisplay.setPosition(Common::Point(236, 92)); + _consoleDisplay.fixPriority(120); + _consoleDisplay.animate(ANIM_MODE_2, NULL); + _consoleDisplay._numFrames = 5; + + _testerDisplay.postInit(); + _testerDisplay.setup(400, 2, 1); + _testerDisplay.setPosition(Common::Point(198, 83)); + _testerDisplay.animate(ANIM_MODE_2, NULL); + _testerDisplay._numFrames = 20; + + if (R2_INVENTORY.getObjectScene(R2_READER) == 400) { + _reader.postInit(); + _reader.setup(400, 5, 2); + _reader.setPosition(Common::Point(301, 95)); + _reader.setDetails(400, 54, -1, 56, 1, (SceneItem *)NULL); + } + + if (R2_INVENTORY.getObjectScene(R2_SENSOR_PROBE) == 400) { + _sensorProbe.postInit(); + _sensorProbe.setup(400, 5, 1); + _sensorProbe.setPosition(Common::Point(251, 104)); + _sensorProbe.fixPriority(121); + _sensorProbe.setDetails(400, 57, -1, 59, 1, (SceneItem *)NULL); + } + + if (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_UNIT) == 400) { + _attractorUnit.postInit(); + _attractorUnit.setup(400, 5, 3); + _attractorUnit.setPosition(Common::Point(265, 129)); + _attractorUnit.setDetails(400, 60, -1, 62, 1, (SceneItem *)NULL); + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _equipment1.setDetails(11, 400, 3, -1, -1); + _equipment2.setDetails(24, 400, 3, -1, -1); + _equipment3.setDetails(25, 400, 3, -1, -1); + _equipment4.setDetails(26, 400, 3, -1, -1); + _equipment5.setDetails(28, 400, 3, -1, -1); + _equipment6.setDetails(29, 400, 3, -1, -1); + _desk.setDetails(12, 400, 6, -1, -1); + _desk2.setDetails(27, 400, 6, -1, -1); + _terminal.setDetails(13, 400, 6, -1, 11); + _duct.setDetails(14, 400, 12, -1, -1); + _console.setDetails(15, 400, 15, -1, 17); + _equalizer.setDetails(Rect(284, 99, 308, 108), 400, 36, -1, 38, 1, NULL); + _transducer.setDetails(Rect(295, 67, 314, 79), 400, 39, -1, 41, 1, NULL); + _optimizer.setDetails(Rect(308, 106, 315, 113), 400, 42, -1, 44, 1, NULL); + _soundModule.setDetails(Rect(291, 118, 315, 131), 400, 45, -1, 47, 1, NULL); + _tester.setDetails(Rect(179, 62, 217, 92), 400, 30, -1, 32, 1, NULL); + _helmet.setDetails(Rect(181, 53, 197, 65), 400, 48, -1, 50, 1, NULL); + _nullifier.setDetails(Rect(201, 56, 212, 65), 400, 51, -1, 50, 1, NULL); + _shelves.setDetails(16, 400, 18, -1, 20); + _cabinet.setDetails(17, 400, 21, -1, -1); + _doorDisplay.setDetails(Rect(161, 43, 166, 52), 400, 27, -1, -1, 1, NULL); + _lights.setDetails(Rect(113, 3, 168, 14), 400, 33, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 400, 0, 1, -1, 1, NULL); + + _sceneMode = 400; + switch (R2_GLOBALS._sceneManager._previousScene) { + case 125: + setAction(&_sequenceManager1, this, 403, &R2_GLOBALS._player, NULL); + break; + case 200: + setAction(&_sequenceManager1, this, 400, &R2_GLOBALS._player, &_door, NULL); + break; + default: + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.setPosition(Common::Point(180, 100)); + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene400::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene400::signal() { + switch (_sceneMode) { + case 400: + case 403: + R2_GLOBALS._player.enableControl(); + break; + case 401: + R2_GLOBALS._sceneManager.changeScene(200); + break; + case 402: + R2_GLOBALS._sceneManager.changeScene(125); + break; + case 404: + // Getting the sensor probe + R2_INVENTORY.setObjectScene(R2_SENSOR_PROBE, 1); + _sensorProbe.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 405: + // Getting the reader + R2_INVENTORY.setObjectScene(R2_READER, 1); + _reader.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 406: + R2_INVENTORY.setObjectScene(R2_ATTRACTOR_UNIT, 1); + _attractorUnit.remove(); + R2_GLOBALS._player.enableControl(); + break; + default: + break; + } +} + +void Scene400::dispatch() { + SceneExt::dispatch(); + + switch (R2_GLOBALS._player.getRegionIndex() - 15) { + case 0: + case 11: + case 12: + R2_GLOBALS._player._shade = 2; + break; + case 9: + R2_GLOBALS._player._shade = 0; + break; + case 10: + R2_GLOBALS._player._shade = 1; + break; + case 13: + R2_GLOBALS._player._shade = 3; + break; + case 14: + R2_GLOBALS._player._shade = 4; + break; + default: + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 500 - Lander Bay 2 Storage + * + *--------------------------------------------------------------------------*/ + +bool Scene500::ControlPanel::startAction(CursorType action, Event &event) { + Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; + + if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == R2_QUINN)) { + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS.getFlag(26)) { + scene->_stripNumber = 1104; + scene->_sceneMode = 524; + scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, NULL); + } else { + scene->_sceneMode = 510; + scene->setAction(&scene->_sequenceManager1, scene, 510, &R2_GLOBALS._player, NULL); + } + return true; + } else { + return SceneHotspot::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene500::Object2::startAction(CursorType action, Event &event) { + Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_TALK) { + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._characterIndex == 1) { + scene->_stripNumber = R2_GLOBALS.getFlag(26) ? 1101 : 1103; + } else { + scene->_stripNumber = R2_GLOBALS.getFlag(26) ? 1102 : 1105; + } + + scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, NULL); + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene500::Object3::startAction(CursorType action, Event &event) { + Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(500, R2_GLOBALS.getFlag(28) ? 28 : _strip + 25); + return true; + + case CURSOR_USE: + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + if ((_strip != 3) && (_strip != 7)) + SceneItem::display2(500, _strip); + else if (R2_GLOBALS.getFlag(26)) { + R2_GLOBALS._player.disableControl(); + scene->_stripNumber = 1103; + scene->_sceneMode = 524; + scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, NULL); + } else if (!R2_GLOBALS.getFlag(28)) + SceneItem::display2(500, 41); + else if (!R2_GLOBALS.getFlag(40)) + SceneItem::display2(500, 40); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 512; + scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, &scene->_object3, NULL); + R2_GLOBALS.setFlag(26); + } + } else { + SceneItem::display2(500, 42); + } + return true; + + case R2_REBREATHER_TANK: + if (!R2_GLOBALS.getFlag(25)) + SceneItem::display2(500, 10); + else if (_strip != 3) + SceneItem::display2(500, _strip + 25); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 515; + scene->setAction(&scene->_sequenceManager1, scene, 515, &R2_GLOBALS._player, &scene->_object3, NULL); + R2_GLOBALS.setFlag(28); + } + return true; + + case R2_RESERVE_REBREATHER_TANK: + SceneItem::display2(500, 53); + return true; + + default: + if (action < R2_LAST_INVENT) { + SceneItem::display2(500, action); + return true; + } else { + return SceneActor::startAction(action, event); + } + } +} + +bool Scene500::Doorway::startAction(CursorType action, Event &event) { + Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; + + if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == R2_QUINN)) { + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS.getFlag(26)) { + scene->_stripNumber = 1104; + scene->_sceneMode = 524; + scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, NULL); + } else { + scene->_sceneMode = 500; + scene->setAction(&scene->_sequenceManager1, scene, 500, &R2_GLOBALS._player, NULL); + } + + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene500::OxygenTanks::startAction(CursorType action, Event &event) { + Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(500, R2_INVENTORY.getObjectScene(R2_REBREATHER_TANK) ? 50 : 49); + return true; + + case CURSOR_USE: + if (R2_GLOBALS._player._characterIndex != R2_QUINN) { + SceneItem::display2(500, 52); + return true; + } else if ((R2_INVENTORY.getObjectScene(R2_REBREATHER_TANK) != 1) && + (R2_GLOBALS._player._characterIndex != R2_SEEKER) && !R2_GLOBALS.getFlag(28)) { + R2_GLOBALS._player.disableControl(); + + if (_position.y == 120) { + scene->_sceneMode = 513; + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, + &scene->_tanks1, NULL); + } else { + scene->_sceneMode = 514; + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, + &scene->_tanks2, NULL); + } + return true; + } + break; + + default: + break; + } + + return SceneActor::startAction(action, event); +} + +bool Scene500::AirLock::startAction(CursorType action, Event &event) { + Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; + + if ((action == CURSOR_USE) && R2_GLOBALS.getFlag(26)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = (R2_GLOBALS._player._characterIndex == R2_QUINN) ? 521 : 522; + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, + &scene->_object2, &scene->_airLock, NULL); + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene500::Aerosol::startAction(CursorType action, Event &event) { + Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 503; + scene->setAction(&scene->_sequenceManager1, scene, 503, &R2_GLOBALS._player, this, NULL); + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene500::SonicStunner::startAction(CursorType action, Event &event) { + Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; + + if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == R2_QUINN)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = R2_GLOBALS.getFlag(26) ? 520 : 502; + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene500::Locker1::startAction(CursorType action, Event &event) { + Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; + + if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == R2_QUINN)) { + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS.getFlag(11)) + scene->_sceneMode = R2_GLOBALS.getFlag(26) ? 517 : 505; + else + scene->_sceneMode = R2_GLOBALS.getFlag(26) ? 516 : 504; + + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, this, NULL); + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene500::Locker2::startAction(CursorType action, Event &event) { + Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; + + if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == R2_QUINN)) { + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS.getFlag(12)) + scene->_sceneMode = R2_GLOBALS.getFlag(26) ? 519 : 507; + else + scene->_sceneMode = R2_GLOBALS.getFlag(26) ? 518 : 506; + + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, this, NULL); + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene500::Object::startAction(CursorType action, Event &event) { + if (action == CURSOR_USE) { + return false; + } else { + return SceneActor::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene500::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(500); + + Common::fill(&_buffer[0], &_buffer[2710], 0); + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(50); + _stripManager.addSpeaker(&_seekerSpeaker); + _stripManager.addSpeaker(&_quinnSpeaker); + + if (R2_GLOBALS.getFlag(25)) { + R2_GLOBALS._player._characterScene[R2_SEEKER] = 500; + + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + R2_GLOBALS._walkRegions.disableRegion(1); + + _object2.postInit(); + _object2._effect = 1; + _object2.setup(1505, 1, 1); + _object2._moveDiff.x = 5; + _object2.setPosition(Common::Point(42, 151)); + _object2.setDetails(500, 34, 35, 36, 1, (SceneItem *)NULL); + } else if (R2_GLOBALS._player._characterScene[R2_QUINN] == 500) { + _object2.postInit(); + _object2._effect = 1; + _object2.setup(R2_GLOBALS.getFlag(26) ? 1500 : 10, 1, 1); + _object2.setPosition(Common::Point(42, 151)); + + R2_GLOBALS._walkRegions.disableRegion(1); + R2_GLOBALS._walkRegions.disableRegion(2); + R2_GLOBALS._walkRegions.disableRegion(3); + + _object2.setDetails(500, 37, 38, -1, 1, (SceneItem *)NULL); + } + } + + if ((R2_INVENTORY.getObjectScene(R2_REBREATHER_TANK) != 500) && R2_GLOBALS.getFlag(27)) { + _tanks1.postInit(); + _tanks1.setup(502, 7, 1); + _tanks1.setPosition(Common::Point(281, 120)); + _tanks1.setDetails(500, -1, -1, -1, 1, (SceneItem *)NULL); + } else { + if (R2_INVENTORY.getObjectScene(R2_REBREATHER_TANK) == 500) { + _tanks1.postInit(); + _tanks1.setup(502, 7, 1); + _tanks1.setPosition(Common::Point(281, 120)); + _tanks1.setDetails(500, -1, -1, -1, 1, (SceneItem *)NULL); + } + + _tanks2.postInit(); + _tanks2.setup(502, 7, 1); + _tanks2.setPosition(Common::Point(286, 121)); + _tanks2.setDetails(500, -1, -1, -1, 1, (SceneItem *)NULL); + } + + _doorway.postInit(); + _doorway.setup(501, 1, 1); + _doorway.setPosition(Common::Point(132, 85)); + _doorway.setDetails(500, 15, -1, 17, 1, (SceneItem *)NULL); + + _airLock.postInit(); + _airLock.setup(501, 2, 1); + _airLock.setPosition(Common::Point(41, 121)); + + if (!R2_GLOBALS.getFlag(25)) + _airLock.setDetails(500, 6, -1, 10, 1, (SceneItem *)NULL); + else if ((R2_GLOBALS._player._characterScene[R2_QUINN] != 500) || + (R2_GLOBALS._player._characterScene[R2_SEEKER] != 500)) + _airLock.setDetails(500, 6, -1, 40, 1, (SceneItem *)NULL); + else + _airLock.setDetails(500, 6, -1, 9, 1, (SceneItem *)NULL); + + _locker1.postInit(); + _locker1.setup(500, 3, R2_GLOBALS.getFlag(11) ? 6 : 1); + _locker1.setPosition(Common::Point(220, 82)); + _locker1.setDetails(500, 27, -1, -1, 1, (SceneItem *)NULL); + + _locker2.postInit(); + _locker2.setup(500, 4, R2_GLOBALS.getFlag(12) ? 6 : 1); + _locker2.setPosition(Common::Point(291, 98)); + _locker2.fixPriority(121); + _locker2.setDetails(500, 27, -1, -1, 1, (SceneItem *)NULL); + + if (R2_INVENTORY.getObjectScene(R2_AEROSOL) == 500) { + _aerosol.postInit(); + _aerosol.setup(500, 5, 2); + _aerosol.setPosition(Common::Point(286, 91)); + _aerosol.fixPriority(120); + _aerosol.setDetails(500, 24, 25, 26, 1, (SceneItem *)NULL); + } + + if (R2_INVENTORY.getObjectScene(R2_SONIC_STUNNER) == 500) { + _sonicStunner.postInit(); + _sonicStunner.setup(500, 5, 1); + _sonicStunner.setPosition(Common::Point(214, 76)); + _sonicStunner.setDetails(500, 21, 22, 23, 1, (SceneItem *)NULL); + } + + _object1.postInit(); + _object1._effect = 1; + _object1.setup(502, 1, 1); + _object1.setPosition(Common::Point(258, 99)); + _object1.fixPriority(50); + + _object8.postInit(); + _object8.setPosition(Common::Point(250, 111)); + + if (!R2_GLOBALS.getFlag(35)) { + _object8.setup(501, 3, 1); + } else { + _object8.setup(500, 8, 7); + + _object3.postInit(); + _object3._effect = 1; + _object3.setPosition(Common::Point(247, 52)); + _object3.setDetails(500, -1, -1, -1, 2, (SceneItem *)NULL); + + if (!R2_GLOBALS.getFlag(26)) { + if (R2_GLOBALS.getFlag(28)) + _object3.setup(502, 7, 2); + else + _object3.setup(502, R2_GLOBALS._v566A3 + 2, 7); + } + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) + R2_GLOBALS._player._moveDiff.x = 5; + + _controlPanel.setDetails(Rect(175, 62, 191, 80), 500, 31, 32, 33, 1, (SceneItem *)NULL); + _item2.setDetails(Rect(13, 58, 70, 118), 500, 12, -1, -1, 1, (SceneItem *)NULL); + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 500, 0, -1, -1, 1, (SceneItem *)NULL); + + if ((R2_GLOBALS._player._characterIndex == R2_QUINN) && (R2_GLOBALS._sceneManager._previousScene == 700)) { + R2_GLOBALS._player.disableControl(); + _sceneMode = 501; + setAction(&_sequenceManager1, this, 501, &R2_GLOBALS._player, &_doorway, NULL); + } else { + if (R2_GLOBALS._player._characterIndex != R2_QUINN) { + R2_GLOBALS._player.setup(1505, 6, 1); + } else { + R2_GLOBALS._player.setup(R2_GLOBALS.getFlag(26) ? 1500 : 10, 6, 1); + } + + R2_GLOBALS._player.setPosition(Common::Point(123, 135)); + R2_GLOBALS._player.enableControl(); + } +} + +void Scene500::synchronize(Serializer &s) { + SceneExt::synchronize(s); + s.syncAsSint16LE(_stripNumber); +} + +void Scene500::signal() { + switch (_sceneMode) { + case 3: + R2_GLOBALS._player.enableControl(); + break; + case 5: + _sceneMode = 12; + _sound1.play(127); + _object1.animate(ANIM_MODE_6, this); + + R2_GLOBALS.clearFlag(35); + _object3.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 6: + _sceneMode = 11; + _sound1.play(127); + _object1.animate(ANIM_MODE_5, this); + + R2_GLOBALS.clearFlag(35); + _object3.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 7: + _sound1.play(126); + _object8.animate(ANIM_MODE_6, this); + + R2_GLOBALS.clearFlag(35); + _object3.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 500: + R2_GLOBALS._sceneManager.changeScene(700); + break; + case 501: + if (R2_GLOBALS._player._characterScene[R2_QUINN] == 500) { + _stripNumber = 1100; + _sceneMode = 523; + setAction(&_sequenceManager1, this, 523, &R2_GLOBALS._player, NULL); + } else { + R2_GLOBALS._player.enableControl(); + } + break; + case 502: + case 520: + R2_INVENTORY.setObjectScene(R2_SONIC_STUNNER, 1); + _sonicStunner.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 503: + R2_INVENTORY.setObjectScene(R2_AEROSOL, 1); + _aerosol.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 504: + case 516: + R2_GLOBALS.setFlag(11); + R2_GLOBALS._player.enableControl(); + break; + case 505: + case 517: + R2_GLOBALS.clearFlag(11); + R2_GLOBALS._player.enableControl(); + break; + case 506: + case 518: + R2_GLOBALS.setFlag(11); + R2_GLOBALS._player.enableControl(); + break; + case 507: + case 519: + R2_GLOBALS.clearFlag(12); + R2_GLOBALS._player.enableControl(); + break; + case 509: + R2_GLOBALS.clearFlag(35); + _object3.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 510: + R2_GLOBALS._player.enableControl(); + _area1.setDetails(500, 6, 1, Common::Point(160, 120)); + R2_GLOBALS._player.enableControl(); + break; + case 513: + R2_INVENTORY.setObjectScene(R2_REBREATHER_TANK, 1); + _tanks1.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 514: + R2_INVENTORY.setObjectScene(R2_REBREATHER_TANK, 1); + R2_GLOBALS.setFlag(27); + _tanks2.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 515: + R2_INVENTORY.setObjectScene(R2_REBREATHER_TANK, 0); + R2_GLOBALS.setFlag(28); + R2_GLOBALS._player.enableControl(); + break; + case 521: + case 522: + R2_GLOBALS._sceneManager.changeScene(525); + break; + case 523: + case 524: + R2_GLOBALS._events.setCursor(CURSOR_ARROW); + _sceneMode = 8; + _stripManager.start(_stripNumber, this); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + + +/*-------------------------------------------------------------------------- + * Scene 525 - Cutscene - Walking in hall + * + *--------------------------------------------------------------------------*/ +void Scene525::postInit(SceneObjectList *OwnerList) { + loadScene(525); + R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); + + R2_GLOBALS._sound1.play(105); + + _actor1.postInit(); + _actor1._effect = 1; + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + setAction(&_sequenceManager, this, 525, &R2_GLOBALS._player, &_actor1, NULL); +} + +void Scene525::signal() { + R2_GLOBALS._sceneManager.changeScene(1525); +} + +/*-------------------------------------------------------------------------- + * Scene 600 - + * + *--------------------------------------------------------------------------*/ +Scene600::Scene600() { + _field412 = 0; + for (int i = 0; i < 256; i++) + _fieldAD2[i] = 0; +} + +void Scene600::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + for (int i = 0; i < 256; i++) + s.syncAsByte(_fieldAD2[i]); +} + +bool Scene600::Item1::startAction(CursorType action, Event &event) { + if ((action != R2_NEGATOR_GUN) || (!R2_GLOBALS.getFlag(5)) || (R2_GLOBALS.getFlag(8))) + return SceneHotspot::startAction(action, event); + + SceneItem::display(600, 32, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; +} + +bool Scene600::Item4::startAction(CursorType action, Event &event) { + if ((action != R2_NEGATOR_GUN) || (!R2_GLOBALS.getFlag(1))) + return SceneHotspot::startAction(action, event); + + if ((R2_GLOBALS.getFlag(5)) && (!R2_GLOBALS.getFlag(8))) { + SceneItem::display(600, 32, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + } + + if (R2_GLOBALS.getFlag(5)) { + SceneItem::display(600, 30, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + } + + if ((!R2_GLOBALS.getFlag(8)) || (R2_GLOBALS.getFlag(9))) + return SceneHotspot::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + + Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene; + + scene->_object1.setup2(603, 3, 1, 239, 54, 10, 0); + scene->_actor3.postInit(); + scene->_actor2.postInit(); + + scene->_sceneMode = 612; + setAction(&scene->_sequenceManager1, this, 612, &scene->_actor3, &scene->_actor2, &R2_GLOBALS._player, NULL); + return true; +} + +void Scene600::Actor4::signal() { + Common::Point pt(36, 177 + R2_GLOBALS._randomSource.getRandomNumber(5)); + NpcMover *mover = new NpcMover(); + addMover(mover, &pt, this); +} + +bool Scene600::Actor4::startAction(CursorType action, Event &event) { + if ((action >= CURSOR_WALK) && (action < R2CURSORS_START)) + // Only action cursors + return SceneActor::startAction(action, event); + + return false; +} + +void Scene600::Actor4::draw() { + warning("TODO: Actor4::draw()"); + SceneActor::draw(); +} + +bool Scene600::Actor5::startAction(CursorType action, Event &event) { + if ((action < CURSOR_WALK) && (action >= R2CURSORS_START)) + return false; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene; + + if ((R2_INVENTORY.getObjectScene(R2_CLAMP) == 600) && (!R2_GLOBALS.getFlag(6))) { + R2_GLOBALS._player.disableControl(); + scene->_actor6.setDetails(600, 11, -1, -1, 3, (SceneItem *) NULL); + R2_GLOBALS.setFlag(6); + scene->_sceneMode = 609; + scene->setAction(&scene->_sequenceManager1, scene, 609, &R2_GLOBALS._player, &scene->_actor5, &scene->_actor6, &scene->_actor1, NULL); + return true; + } + + if (_frame != 1) + return false; + + if (!R2_GLOBALS.getFlag(6)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 616; + scene->setAction(&scene->_sequenceManager1, scene, 616, &R2_GLOBALS._player, &scene->_actor5, &scene->_actor6, NULL); + return true; + } + + if ((R2_GLOBALS.getFlag(9)) && (R2_INVENTORY.getObjectScene(R2_COM_SCANNER) == 600)) + SceneItem::display(600, 31, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 601; + scene->setAction(&scene->_sequenceManager1, scene, 601, &R2_GLOBALS._player, &scene->_actor5, NULL); + } + return true; +} + +bool Scene600::Actor6::startAction(CursorType action, Event &event) { + Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene; + + if ((action < CURSOR_WALK) && (action >= R2CURSORS_START)) { + switch (action) { + case R2_COM_SCANNER: + if (R2_GLOBALS.getFlag(6)) { + if (R2_GLOBALS.getFlag(8)) { + SceneItem::display(600, 29, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + } else { + R2_GLOBALS._player.disableControl(); + scene->_actor8.postInit(); + scene->_actor8.setDetails(600, 20, -1, -1, 4, &scene->_actor6); + scene->_sceneMode = 607; + scene->setAction(&scene->_sequenceManager1, scene, 607, &R2_GLOBALS._player, &scene->_actor8, NULL); + return true; + } + } else { + return SceneActor::startAction(action, event); + } + break; + case R2_AEROSOL: + if (R2_GLOBALS.getFlag(5)) { + SceneItem::display(600, 28, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + } else { + R2_GLOBALS._player.disableControl(); + scene->_actor7.postInit(); + scene->_actor7.setDetails(600, 27, -1, -1, 5, &scene->_actor6); + + scene->_actor4.postInit(); + scene->_actor4.setup(601, 3, 1); + scene->_actor4._effect = 3; + scene->_actor4._moveDiff = Common::Point(1, 1); + scene->_actor4._moveRate = 2; + scene->_actor4._numFrames = 3; + scene->_actor4.setDetails(600, 24, 25, 26, 5, &scene->_actor7); + + scene->_sceneMode = 605; + + scene->setAction(&scene->_sequenceManager1, scene, 605, &R2_GLOBALS._player, &scene->_actor7, &scene->_actor4, &scene->_actor5, NULL); + return true; + } + break; + case R2_CLAMP: + if (R2_GLOBALS.getFlag(5)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 606; + scene->setAction(&scene->_sequenceManager1, scene, 606, &R2_GLOBALS._player, &scene->_actor6, NULL); + return true; + } else { + return SceneActor::startAction(action, event); + } + break; + default: + return false; + break; + } + } else if (action != CURSOR_USE) { + if (R2_GLOBALS.getFlag(5)) { + return SceneActor::startAction(action, event); + } else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 610; + scene->setAction(&scene->_sequenceManager1, scene, 610, &scene->_actor1, &R2_GLOBALS._player, NULL); + return true; + } + } else + return SceneActor::startAction(action, event); +} + +bool Scene600::Actor7::startAction(CursorType action, Event &event) { + Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene; + + if ((action < CURSOR_WALK) && (action >= R2CURSORS_START)) { + return false; + } else if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 614; + scene->setAction(&scene->_sequenceManager1, scene, 614, &R2_GLOBALS._player, &scene->_actor7, NULL); + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene600::Actor8::startAction(CursorType action, Event &event) { + Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene; + + if ((action == CURSOR_USE) && (R2_INVENTORY.getObjectScene(9) == 600)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 615; + scene->setAction(&scene->_sequenceManager1, scene, 615, &R2_GLOBALS._player, &scene->_actor8, NULL); + } else if ((action == R2_SONIC_STUNNER) && (R2_INVENTORY.getObjectScene(9) == 600) && (R2_GLOBALS._v565F1[1] == 2) && (!R2_GLOBALS.getFlag(8))){ + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 608; + scene->setAction(&scene->_sequenceManager1, scene, 608, &R2_GLOBALS._player, &scene->_actor4, NULL); + } else { + return SceneActor::startAction(action, event); + } + + return true; +} + +void Scene600::postInit(SceneObjectList *OwnerList) { + loadScene(600); + SceneExt::postInit(); + R2_GLOBALS.setFlag(39); + R2_GLOBALS._walkRegions.enableRegion(3); + _field412 = 0; + + warning("FIXME: loop to initialize _fieldAD2[]"); + + _actor5.postInit(); + _actor5.setVisage(600); + _actor5.setPosition(Common::Point(29, 147)); + _actor5.fixPriority(10); + _actor5.setDetails(300, 3, -1, -1, 1, (SceneItem *) NULL); + + _actor6.postInit(); + _actor6.setPosition(Common::Point(246, 41)); + + if (R2_INVENTORY.getObjectScene(9) == 600) { + _actor8.postInit(); + _actor8.setup(602, 5, 1); + _actor8.setPosition(Common::Point(246, 41)); + _actor8.setDetails(600, 20, -1, -1, 1, (SceneItem *) NULL); + switch (R2_GLOBALS._v565F1[1] - 2) { + case 0: + R2_GLOBALS._sound4.play(45); + break; + case 1: + R2_GLOBALS._sound4.play(4); + break; + case 2: + R2_GLOBALS._sound4.play(5); + break; + case 3: + R2_GLOBALS._sound4.play(6); + break; + default: + break; + } + } + + if (R2_GLOBALS.getFlag(6)) { + _actor6.setup(602, 7, 1); + _actor6.setDetails(600, 11, -1, -1, 1, (SceneItem *) NULL); + } else { + _actor6.setup(600, 2, 1); + _actor6.setDetails(600, 10, -1, -1, 1, (SceneItem *) NULL); + + _actor1.postInit(); + _actor1.setup(600, 3, 5); + _actor1.setPosition(Common::Point(223, 51)); + _actor1.fixPriority(200); + } + + if (! R2_GLOBALS.getFlag(9)) + _object1.setup2(603, 1, 1, 244, 50, 10, 0); + + if (R2_GLOBALS.getFlag(5)) { + if (R2_INVENTORY.getObjectScene(12) == 600) { + _actor7.postInit(); + _actor7.setup(602, 2, 2); + _actor7.setPosition(Common::Point(189, 95)); + _actor7.setDetails(600, 27, -1, -1, 1, (SceneItem *) NULL); + } + + if (R2_GLOBALS.getFlag(8)) { + if (R2_GLOBALS.getFlag(9)) { + _actor2.postInit(); + _actor2.setup(603, 2, 1); + _actor2.setPosition(Common::Point(233, 45)); + _actor2.animate(ANIM_MODE_2, NULL);_actor2.fixPriority(11); + } + } else { + _actor4.postInit(); + _actor4.setup(601, 1, 1); + _actor4.setPosition(Common::Point(180, 110)); + _actor4._moveDiff = Common::Point(1, 1); + _actor4._moveRate = 2; + _actor4._numFrames = 3; + _actor4.animate(ANIM_MODE_2, NULL); + _actor4.fixPriority(130); + _actor4._effect = 3; + _actor4.setDetails(600, 24, 25, 26, 1, (SceneItem *) NULL); + _actor4.signal(); + } + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _item2.setDetails(12, 600, 17, -1, 19); + _item3.setDetails(11, 600, 14, -1, -1); + + if (R2_GLOBALS.getFlag(9)) { + _item1.setDetails(Rect(159, 3, 315, 95), 600, 7, -1, -1, 1, NULL); + } else { + _item4.setDetails(Rect(173, 15, 315, 45), 600, 21, -1, 23, 1, NULL); + _item1.setDetails(Rect(159, 3, 315, 95), 600, 6, -1, -1, 1, NULL); + } + _item5.setDetails(Rect(0, 0, 320, 200), 600, 0, -1, -1, 1, NULL); + + _sceneMode = 600; + if (R2_GLOBALS._sceneManager._previousScene == 700) { + if (R2_GLOBALS.getFlag(6)) { + setAction(&_sequenceManager1, this, 600, &R2_GLOBALS._player, &_actor5, NULL); + } else if (R2_GLOBALS.getFlag(5)) { + setAction(&_sequenceManager1, this, 603, &R2_GLOBALS._player, &_actor5, &_actor6, &_actor1, NULL); + } else { + setAction(&_sequenceManager1, this, 602, &R2_GLOBALS._player, &_actor5, &_actor6, &_actor1, NULL); + } + } else if (R2_GLOBALS.getFlag(5)) { + R2_GLOBALS._player.setPosition(Common::Point(50, 140)); + R2_GLOBALS._player.setStrip(3); + _actor6.setFrame(_actor6.getFrameCount()); + signal(); + } else { + _actor5.setFrame(7); + _actor6.setFrame(7); + R2_GLOBALS._player.setPosition(Common::Point(28, 140)); + R2_GLOBALS._player.setStrip(5); + signal(); + } +} + +void Scene600::remove() { + if (R2_INVENTORY.getObjectScene(9) == 600) + R2_GLOBALS._sound4.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene600::signal() { + switch (_sceneMode) { + case 601: + // No break on purpose + case 613: + // No break on purpose + case 616: + R2_GLOBALS._sceneManager.changeScene(700); + break; + case 605: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._walkRegions.enableRegion(6); + R2_GLOBALS._walkRegions.enableRegion(7); + R2_GLOBALS._walkRegions.enableRegion(9); + R2_GLOBALS._walkRegions.enableRegion(10); + + R2_INVENTORY.setObjectScene(12, 600); + R2_GLOBALS.setFlag(5); + + _actor4._effect = 3; + _actor4.signal(); + break; + case 606: + R2_INVENTORY.setObjectScene(15, 600); + R2_GLOBALS._player.enableControl(); + break; + case 607: + R2_INVENTORY.setObjectScene(9, 600); + R2_GLOBALS._player.enableControl(); + break; + case 608: + R2_GLOBALS.setFlag(8); + _actor4.remove(); + R2_GLOBALS._walkRegions.disableRegion(6); + R2_GLOBALS._walkRegions.disableRegion(9); + R2_GLOBALS._walkRegions.disableRegion(10); + R2_GLOBALS._player.enableControl(); + break; + case 612: + R2_GLOBALS.setFlag(9); + _actor3.remove(); + R2_GLOBALS._sceneItems.remove(&_item4); + _actor2.setDetails(600, 21, -1, 23, 4, &_item4); + _item1.setDetails(600, 7, -1, -1, 3, (SceneItem *) NULL); + R2_GLOBALS._player.enableControl(CURSOR_USE); + break; + case 614: + R2_GLOBALS._player.enableControl(); + _actor7.remove(); + R2_INVENTORY.setObjectScene(12, 1); + R2_GLOBALS._walkRegions.disableRegion(7); + break; + case 615: + _actor8.remove(); + R2_INVENTORY.setObjectScene(9, 1); + R2_GLOBALS._player.enableControl(); + break; + default: + _field412 = 0; + _sceneMode = 0; + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene600::process(Event &event) { + if ((!R2_GLOBALS._player._canWalk) && (!R2_GLOBALS.getFlag(6)) && (event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN)) { + if (!_actor5.contains(event.mousePos) || (_actor5._frame <= 1)) { + if (R2_GLOBALS.getFlag(5)) { + _field412 += 10; + } else { + R2_GLOBALS._player.disableControl(); + _sceneMode = 604; + setAction(&_sequenceManager1, this, 604, &_actor1, &R2_GLOBALS._player, NULL); + event.handled = true; + } + } else { + R2_GLOBALS._player.disableControl(); + _sceneMode = 613; + setAction(&_sequenceManager1, this, 613, &R2_GLOBALS._player, &_actor6, NULL); + event.handled = true; + } + } else if ((!R2_GLOBALS.getFlag(6)) && (R2_GLOBALS._player._mover) && (_field412 < 10)){ + _field412 += 10; + } + + Scene::process(event); +} + +void Scene600::dispatch() { + if ((_field412 != 0) && (_sceneMode != 600) && (_sceneMode != 603) && (_sceneMode != 602)) { + if ( ((_actor6._strip == 4) && (_actor6._frame > 1)) + || (_sceneMode == 601) + || ((_sceneMode == 616) && (_actor5._frame > 1)) ) + _field412 = 0; + else { + _field412--; + if (_field412 % 10 == 0) { + _actor1.setAction(&_sequenceManager2, NULL, 611, &_actor1, NULL); + } + if ((_field412 == 0) && (R2_GLOBALS._player._mover)) + _field412 = 10; + } + } + + if (_actor1._frame == 2) + _aSound1.play(40); + + Scene::dispatch(); + if ((_actor4._strip == 3) && (_actor4._frame == 3)) { + _actor1.setStrip(4); + _actor1.setFrame(1); + } +} + +/*-------------------------------------------------------------------------- + * Scene 700 - + * + *--------------------------------------------------------------------------*/ +Scene700::Scene700() { + _rotation = NULL; +} + +void Scene700::synchronize(Serializer &s) { + SceneExt::synchronize(s); + SYNC_POINTER(_rotation); +} + +bool Scene700::Item11::startAction(CursorType action, Event &event) { + if ((action == CURSOR_USE) && (R2_GLOBALS._player._position.x < 100)) + return false; + + return NamedHotspot::startAction(action, event); +} + +bool Scene700::Item12::startAction(CursorType action, Event &event) { + Scene700 *scene = (Scene700 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case R2_CABLE_HARNESS: + R2_GLOBALS._player.disableControl(); + scene->_actor5.postInit(); + scene->_actor5.setup(701, 3, 2); + scene->_actor5.setPosition(Common::Point(243, 98)); + scene->_actor5.setDetails(700, 37, -1, -1, 2, (SceneItem *) NULL); + scene->_actor5.hide(); + scene->_sceneMode = 20; + break; + case R2_ATTRACTOR_CABLE_HARNESS: + R2_GLOBALS._player.disableControl(); + scene->_actor5.postInit(); + scene->_actor5.setup(701, 2, 8); + scene->_actor5.setPosition(Common::Point(243, 98)); + scene->_actor5.setDetails(700, 38, -1, -1, 2, (SceneItem *) NULL); + scene->_actor5.hide(); + scene->_sceneMode = 21; + break; + default: + return NamedHotspot::startAction(action, event); + break; + } + + scene->setAction(&scene->_sequenceManager, this, 707, &R2_GLOBALS._player, &scene->_actor5, NULL); + return true; +} + +bool Scene700::Actor2::startAction(CursorType action, Event &event) { + Scene700 *scene = (Scene700 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS._player._position.y <= 100) + return false; + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 701; + scene->setAction(&scene->_sequenceManager, scene, 701, &R2_GLOBALS._player, this, NULL); + + return true; +} + +bool Scene700::Actor3::startAction(CursorType action, Event &event) { + Scene700 *scene = (Scene700 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS._player._position.y <= 100) + return false; + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 702; + scene->setAction(&scene->_sequenceManager, scene, 702, &R2_GLOBALS._player, this, NULL); + + return true; +} + +bool Scene700::Actor4::startAction(CursorType action, Event &event) { + Scene700 *scene = (Scene700 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS._player._position.y <= 100) + return false; + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 704; + scene->setAction(&scene->_sequenceManager, scene, 704, &R2_GLOBALS._player, this, NULL); + + return true; +} + +bool Scene700::Actor5::startAction(CursorType action, Event &event) { + Scene700 *scene = (Scene700 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + switch (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS)) { + case 0: + if ((_strip == 2) && (_frame == 1)) { + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._position.x <= 100) { + scene->_sceneMode = 710; + scene->setAction(&scene->_sequenceManager, scene, 710, &R2_GLOBALS._player, this, NULL); + } else { + scene->_sceneMode = 709; + scene->setAction(&scene->_sequenceManager, scene, 709, &R2_GLOBALS._player, this, NULL); + } + } else { + return SceneActor::startAction(action, event); + } + break; + case 700: { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + Common::Point pt(_position.x - 12, _position.y + 1); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + } + break; + default: + break; + } + break; + case R2_ATTRACTOR_UNIT: + R2_GLOBALS._player.disableControl(); + if (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 700) { + scene->_sceneMode = 706; + scene->setAction(&scene->_sequenceManager, scene, 706, &R2_GLOBALS._player, &scene->_actor5, NULL); + } else { + scene->_sceneMode = 15; + Common::Point pt(_position.x - 12, _position.y + 1); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + } + break; + default: + return SceneActor::startAction(action, event); + break; + } + + return true; +} + +bool Scene700::Actor6::startAction(CursorType action, Event &event) { + Scene700 *scene = (Scene700 *)R2_GLOBALS._sceneManager._scene; + + if ((action != CURSOR_USE) || (R2_GLOBALS._player._position.y >= 100)) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1; + Common::Point pt(_position.x, 69); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + + return true; +} + +void Scene700::postInit(SceneObjectList *OwnerList) { + if (R2_GLOBALS._sceneManager._previousScene == 900) + g_globals->gfxManager()._bounds.moveTo(Common::Point(160, 0)); + + loadScene(700); + R2_GLOBALS._v558B6.set(60, 0, 260, 200); + SceneExt::postInit(); + + _rotation = R2_GLOBALS._scenePalette.addRotation(237, 246, -1); + _rotation->setDelay(5); + _rotation->_countdown = 1; + + _actor2.postInit(); + _actor2.setVisage(700); + _actor2.setPosition(Common::Point(21, 128)); + _actor2.fixPriority(10); + _actor2.setDetails(700, 3, -1, -1, 1, (SceneItem *) NULL); + + _actor3.postInit(); + _actor3.setup(700, 2, 1); + _actor3.setPosition(Common::Point(217, 120)); + _actor3.fixPriority(10); + _actor3.setDetails(700, 15, -1, -1, 1, (SceneItem *) NULL); + + _actor1.postInit(); + _actor1.setup(700, 4, 1); + _actor1.setPosition(Common::Point(355 - ((R2_GLOBALS._v565E3 * 8) / 5), ((R2_GLOBALS._v565E1 + 20 ) / 5) - 12)); + _actor1.fixPriority(10); + _actor1.setDetails(700, 12, -1, 14, 1, (SceneItem *) NULL); + + _actor6.postInit(); + _actor6.setup(700, 8, 1); + _actor6.setPosition(Common::Point(85, 53)); + _actor6.setDetails(700, 33, -1, 35, 1, (SceneItem *) NULL); + + _actor7.postInit(); + _actor7.setup(700, 8, 1); + _actor7.setPosition(Common::Point(164, 53)); + _actor7.setDetails(700, 33, -1, 35, 1, (SceneItem *) NULL); + + _actor8.postInit(); + _actor8.setup(700, 8, 1); + _actor8.setPosition(Common::Point(243, 53)); + _actor8.setDetails(700, 33, -1, 35, 1, (SceneItem *) NULL); + + _actor9.postInit(); + _actor9.setup(700, 8, 1); + _actor9.setPosition(Common::Point(324, 53)); + _actor9.setDetails(700, 33, -1, 35, 1, (SceneItem *) NULL); + + if ((R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) != 1) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) != 1)) { + _actor5.postInit(); + _actor5.fixPriority(10); + switch (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS)) { + case 0: + switch (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS)) { + case 0: + _actor5.setup(701, 3, 2); + _actor5.setPosition(Common::Point(243, 98)); + _actor5.setDetails(700, 37, -1, -1, 1, (SceneItem *) NULL); + break; + case 700: + _actor5.setup(701, 3, 1); + _actor5.setPosition(Common::Point(356 - (R2_GLOBALS._v565EB * 8), 148 - (((R2_GLOBALS._v565E9 + 10) / 5) * 4))); + _actor5.setDetails(700, 37, -1, -1, 1, (SceneItem *) NULL); + break; + default: + break; + } + break; + case 700: + switch (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS)) { + case 0: + if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70)) + _actor5.setup(701, 2, 1); + else + _actor5.setup(701, 2, 8); + _actor5.setPosition(Common::Point(243, 98)); + _actor5.fixPriority(77); + _actor5.setDetails(700, 38, -1, -1, 1, (SceneItem *) NULL); + break; + case 700: + _actor5.setup(701, 1, 8); + if (R2_GLOBALS._v565E7 == 0) { + _actor5.setPosition(Common::Point(356 - (R2_GLOBALS._v565EB * 8), 148 - (((R2_GLOBALS._v565E9 + 10) / 5) * 4))); + } else { + _actor5.setup(701, 1, 1); + _actor5.setPosition(Common::Point(_actor1._position.x + 1, _actor1._position.y + 120)); + } + _actor5.setDetails(700, 38, -1, -1, 1, (SceneItem *) NULL); + break; + default: + break; + } + default: + break; + } + } + + _actor4.postInit(); + _actor4.setup(700, 3, 1); + _actor4.setPosition(Common::Point(454, 117)); + _actor4.setDetails(700, 27, -1, -1, 1, (SceneItem *) NULL); + + _item12.setDetails(Rect(234, 90, 252, 110), 700, 39, -1, -1, 1, NULL); + _item6.setDetails(Rect(91, 158, 385, 167), 700, 6, -1, 8, 1, NULL); + _item2.setDetails(Rect(47, 115, 149, 124), 700, 40, -1, 41, 1, NULL); + _item3.setDetails(Rect(151, 108, 187, 124), 700, 40, -1, 41, 1, NULL); + _item4.setDetails(Rect(247, 108, 275, 124), 700, 40, -1, 41, 1, NULL); + _item5.setDetails(Rect(300, 105, 321, 124), 700, 40, -1, 41, 1, NULL); + _item7.setDetails(Rect(255, 74, 368, 115), 700, 9, -1, 11, 1, NULL); + _item8.setDetails(Rect(69, 74, 182, 115), 700, 9, -1, 11, 1, NULL); + _item9.setDetails(Rect(370, 58, 475, 103), 700, 18, -1, -1, 1, NULL); + _item10.setDetails(Rect(17, 11, 393, 31), 700, 24, -1, -1, 1, NULL); + _item11.setDetails(Rect(42, 32, 368, 66), 700, 30, -1, 32, 1, NULL); + _item1.setDetails(Rect(0, 0, 480, 200), 700, 0, -1, -1, 1, NULL); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(11); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player._moveDiff.x = 2; + R2_GLOBALS._player.disableControl(); + + R2_GLOBALS._sound1.play(34); + + _sceneMode = 700; + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 250: + setAction(&_sequenceManager, this, 700, &R2_GLOBALS._player, &_actor2, NULL); + break; + case 500: + setAction(&_sequenceManager, this, 703, &R2_GLOBALS._player, &_actor3, NULL); + break; + case 600: { + _sceneMode = 4; + _actor7.setFrame(5); + R2_GLOBALS._player.setPosition(Common::Point(164, 74)); + R2_GLOBALS._player.setStrip2(3); + Common::Point pt(164, 69); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 900: + setAction(&_sequenceManager, this, 705, &R2_GLOBALS._player, &_actor4, NULL); + break; + default: + if (R2_GLOBALS.getFlag(41)) + R2_GLOBALS._player.setPosition(Common::Point(107, 67)); + else + R2_GLOBALS._player.setPosition(Common::Point(60, 140)); + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + } +} + +void Scene700::remove() { + R2_GLOBALS._sound1.play(10); +// CHECKME: Present in the original... But it crashes badly. +// The instruction was removed as it's not used in other scene coded the same way +// and reversed by dreammaster. A double check is required in order to verify it doesn't hide +// a memory leak +// _rotation->remove(); + SceneExt::remove(); +} + +void Scene700::signal() { + switch (_sceneMode) { + case 1: + _sceneMode = 2; + R2_GLOBALS._player.setStrip(4); + if (R2_GLOBALS._player._position.x != 164) { + SceneItem::display(700, 36, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + R2_GLOBALS._player.enableControl(); + } else { + R2_GLOBALS._sound2.play(19); + _actor7.animate(ANIM_MODE_5, this); + } + break; + case 2: { + _sceneMode = 3; + R2_GLOBALS._player.setStrip2(4); + Common::Point pt(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y + 5); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: + R2_INVENTORY.setObjectScene(5, 600); + R2_INVENTORY.setObjectScene(16, 700); + R2_GLOBALS._player.enableControl(); + break; + case 4: + _sceneMode = 5; + R2_GLOBALS._player.setStrip2(-1); + R2_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + R2_GLOBALS._sound2.play(19); + _actor7.animate(ANIM_MODE_6, this); + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS.setFlag(41); + break; + case 10: + _sceneMode = 11; + R2_GLOBALS._player.setup(16, 7, 1); + R2_GLOBALS._player.changeZoom(50); + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 11: + _sceneMode = 12; + _actor5.remove(); + R2_GLOBALS._player.animate(ANIM_MODE_6, this); + break; + case 12: + R2_GLOBALS._player.setVisage(11); + R2_GLOBALS._player.changeZoom(100); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + R2_GLOBALS._player._strip = 7; + if (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_UNIT) == 0) { + R2_INVENTORY.setObjectScene(R2_ATTRACTOR_CABLE_HARNESS, 1); + R2_INVENTORY.setObjectScene(R2_CABLE_HARNESS, 0); + } else { + R2_INVENTORY.setObjectScene(R2_CABLE_HARNESS, 1); + } + R2_GLOBALS._player.enableControl(); + break; + case 15: + _sceneMode = 16; + R2_GLOBALS._player.setup(16, 7, 1); + R2_GLOBALS._player.changeZoom(50); + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 16: + _sceneMode = 17; + _actor5.setup(701, 1, 8); + _actor5.setDetails(700, 38, -1, -1, 3, (SceneItem *) NULL); + if ((R2_GLOBALS._v565E5 != 0) && (_actor5._position.x == _actor1._position.x + 1) && (_actor5._position.x == 148 - (((R2_GLOBALS._v565E1 + 10) / 5) * 4))) { + _actor5.animate(ANIM_MODE_6, NULL); + Common::Point pt(_actor5._position.x, _actor1._position.y + 120); + NpcMover *mover = new NpcMover(); + _actor5.addMover(mover, &pt, NULL); + R2_GLOBALS._v565E7 = 1; + } + R2_GLOBALS._player.animate(ANIM_MODE_6, this); + break; + case 17: + R2_INVENTORY.setObjectScene(R2_ATTRACTOR_UNIT, 0); + R2_INVENTORY.setObjectScene(R2_ATTRACTOR_CABLE_HARNESS, 700); + R2_GLOBALS._player.setVisage(11); + R2_GLOBALS._player.changeZoom(100); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + R2_GLOBALS._player._strip = 7; + R2_GLOBALS._player.enableControl(); + break; + case 20: + R2_INVENTORY.setObjectScene(R2_CABLE_HARNESS, 0); + R2_GLOBALS._player.enableControl(); + break; + case 21: + _actor5.fixPriority(77); + if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70)) + _actor5.animate(ANIM_MODE_6, NULL); + + R2_INVENTORY.setObjectScene(R2_ATTRACTOR_CABLE_HARNESS, 700); + R2_GLOBALS._player.enableControl(); + break; + case 701: + R2_GLOBALS._sceneManager.changeScene(250); + break; + case 702: + R2_GLOBALS._sceneManager.changeScene(500); + break; + case 704: + R2_GLOBALS._sceneManager.changeScene(900); + break; + case 706: + _actor5.setDetails(700, 38, -1, -1, 3, (SceneItem *) NULL); + _actor5.fixPriority(77); + if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70)) + _actor5.animate(ANIM_MODE_6, NULL); + R2_INVENTORY.setObjectScene(R2_ATTRACTOR_UNIT, 0); + R2_INVENTORY.setObjectScene(R2_ATTRACTOR_CABLE_HARNESS, 700); + R2_GLOBALS._player.enableControl(); + break; + case 709: + R2_GLOBALS.setFlag(41); + R2_GLOBALS._player.enableControl(); + break; + case 710: + R2_GLOBALS.clearFlag(41); + R2_GLOBALS._player.enableControl(); + break; + case 5: + // No break on purpose + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 800 - Sick Bay + * + *--------------------------------------------------------------------------*/ + +bool Scene800::Button::startAction(CursorType action, Event &event) { + Scene800 *scene = (Scene800 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) { + return NamedHotspot::startAction(action, event); + } else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 802; + scene->setAction(&scene->_sequenceManager1, scene, 802, &R2_GLOBALS._player, &scene->_autodocCover, NULL); + return true; + } +} + +bool Scene800::CableJunction::startAction(CursorType action, Event &event) { + Scene800 *scene = (Scene800 *)R2_GLOBALS._sceneManager._scene; + + if (action != R2_OPTICAL_FIBRE) { + return NamedHotspot::startAction(action, event); + } else { + R2_GLOBALS._player.disableControl(); + scene->_opticalFibre.postInit(); + scene->_sceneMode = 803; + + if (R2_INVENTORY.getObjectScene(R2_READER) == 800) + scene->setAction(&scene->_sequenceManager1, scene, 813, &R2_GLOBALS._player, &scene->_opticalFibre, &scene->_reader, NULL); + else + scene->setAction(&scene->_sequenceManager1, scene, 803, &R2_GLOBALS._player, &scene->_opticalFibre, NULL); + + return true; + } +} + +bool Scene800::DeviceSlot::startAction(CursorType action, Event &event) { + Scene800 *scene = (Scene800 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (R2_INVENTORY.getObjectScene(R2_READER) != 800) + break; + + R2_GLOBALS._player.disableControl(); + scene->_reader.postInit(); + + if (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) == 800) + scene->setAction(&scene->_sequenceManager1, scene, 814, &R2_GLOBALS._player, &scene->_reader, &scene->_opticalFibre, NULL); + else + scene->setAction(&scene->_sequenceManager1, scene, 804, &R2_GLOBALS._player, &scene->_reader, NULL); + return true; + default: + break; + } + + return NamedHotspot::startAction(action, event); +} + +/*--------------------------------------------------------------------------*/ + +bool Scene800::Door::startAction(CursorType action, Event &event) { + Scene800 *scene = (Scene800 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 801; + scene->setAction(&scene->_sequenceManager1, scene, 801, &R2_GLOBALS._player, &scene->_door, NULL); + return true; + default: + return SceneActor::startAction(action, event); + } +} + +bool Scene800::Tray::startAction(CursorType action, Event &event) { + Scene800 *scene = (Scene800 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (!R2_GLOBALS.getFlag(10)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 806; + scene->setAction(&scene->_sequenceManager1, scene, 806, &R2_GLOBALS._player, &scene->_tray, NULL); + } else if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == 825) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 808; + scene->setAction(&scene->_sequenceManager1, scene, 808, &R2_GLOBALS._player, &scene->_tray, NULL); + } else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 807; + scene->setAction(&scene->_sequenceManager1, scene, 807, &R2_GLOBALS._player, &scene->_tray, NULL); + } + return true; + default: + return SceneActor::startAction(action, event); + } +} + +bool Scene800::ComScanner::startAction(CursorType action, Event &event) { + Scene800 *scene = (Scene800 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (scene->_cabinet._frame == 1) + return false; + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 811; + scene->setAction(&scene->_sequenceManager1, scene, 811, &R2_GLOBALS._player, &scene->_comScanner, NULL); + return true; + case CURSOR_TALK: + SceneItem::display2(800, 35); + return true; + default: + return SceneActor::startAction(action, event); + } +} + +bool Scene800::Cabinet::startAction(CursorType action, Event &event) { + Scene800 *scene = (Scene800 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + R2_GLOBALS._player.disableControl(); + + if (scene->_cabinet._frame == 1) { + scene->_sceneMode = 810; + scene->setAction(&scene->_sequenceManager1, scene, 810, &R2_GLOBALS._player, &scene->_cabinet, NULL); + R2_GLOBALS.setFlag(56); + } else { + scene->_sceneMode = 812; + scene->setAction(&scene->_sequenceManager1, scene, 812, &R2_GLOBALS._player, &scene->_cabinet, NULL); + R2_GLOBALS.clearFlag(56); + } + return true; + default: + return SceneActor::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene800::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(800); + + _door.postInit(); + _door.setVisage(800); + _door.setPosition(Common::Point(286, 108)); + _door.fixPriority(50); + _door.setDetails(800, 3, -1, -1, 1, (SceneItem *)NULL); + + _autodocCover.postInit(); + _autodocCover.setup(800, 2, 1); + _autodocCover.setPosition(Common::Point(119, 161)); + _autodocCover.setDetails(800, 6, 7, -1, 1, (SceneItem *)NULL); + + if (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) == 800) { + _opticalFibre.postInit(); + if (R2_INVENTORY.getObjectScene(R2_READER) == 800) + _opticalFibre.setup(800, 4, 1); + else + _opticalFibre.setup(800, 7, 2); + + _opticalFibre.setPosition(Common::Point(220, 124)); + _opticalFibre.fixPriority(140); + } + + if (R2_INVENTORY.getObjectScene(R2_READER) == 800) { + _reader.postInit(); + + if (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) == 800) { + _opticalFibre.setup(800, 4, 1); + _reader.hide(); + } else { + _reader.setup(800, 7, 1); + } + + _reader.setPosition(Common::Point(230, 120)); + _reader.fixPriority(140); + } + + _cabinet.postInit(); + _cabinet.setup(801, 1, R2_GLOBALS.getFlag(56) ? 6 : 1); + _cabinet.setPosition(Common::Point(169, 79)); + _cabinet.setDetails(800, 41, -1, -1, 1, (SceneItem *)NULL); + + if (R2_INVENTORY.getObjectScene(R2_COM_SCANNER) == 800) { + _comScanner.postInit(); + _comScanner.setup(801, 2, 1); + _comScanner.setPosition(Common::Point(174, 73)); + _comScanner.setDetails(800, 34, 35, -1, 1, (SceneItem *)NULL); + } + + _tray.postInit(); + _tray.setup(800, R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == 825 ? 6 : 5, 1); + if (R2_GLOBALS.getFlag(10)) + _tray.setFrame(5); + _tray.setPosition(Common::Point(203, 144)); + _tray.setDetails(800, 12, -1, 14, 1, (SceneItem *)NULL); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _dataConduits.setDetails(13, 800, 21, -1, -1); + _cableJunction.setDetails(Rect(206, 111, 223, 125), 800, 24, -1, -1, 1, NULL); + _deviceSlot.setDetails(Rect(220, 108, 239, 122), 800, 27, -1, -1, 1, NULL); + _diskSlot.setDetails(Rect(209, 124, 226, 133), 800, 9, -1, 11, 1, NULL); + + if (R2_INVENTORY.getObjectScene(R2_READER) == 800) + _deviceSlot._lookLineNum = 33; + + _button.setDetails(Rect(189, 112, 204, 124), 800, 30, -1, -1, 1, NULL); + _couch.setDetails(11, 800, 15, -1, 17); + _autoDoc.setDetails(Rect(152, 92, 247, 151), 800, 6, 7, -1, 1, NULL); + _medicalDatabase.setDetails(12, 800, 18, -1, -1); + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 800, 0, -1, -1, 1, NULL); + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 825: + _sceneMode = 800; + setAction(&_sequenceManager1, this, 805, &R2_GLOBALS._player, &_autodocCover, NULL); + break; + case 850: + _sceneMode = 800; + setAction(&_sequenceManager1, this, 800, &R2_GLOBALS._player, &_door, NULL); + break; + default: + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.setPosition(Common::Point(277, 132)); + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene800::signal() { + switch (_sceneMode) { + case 801: + R2_GLOBALS._sceneManager.changeScene(850); + break; + case 802: + R2_GLOBALS._sceneManager.changeScene(825); + break; + case 803: + R2_GLOBALS._player.enableControl(); + R2_INVENTORY.setObjectScene(R2_OPTICAL_FIBRE, 800); + break; + case 804: + R2_GLOBALS._player.enableControl(); + _deviceSlot._lookLineNum = 33; + R2_INVENTORY.setObjectScene(R2_READER, 800); + break; + case 806: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS.setFlag(10); + break; + case 807: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS.clearFlag(10); + break; + case 808: + R2_GLOBALS._player.enableControl(); + R2_INVENTORY.setObjectScene(R2_OPTO_DISK, 1); + break; + case 809: + R2_GLOBALS._player.enableControl(); + R2_INVENTORY.setObjectScene(R2_READER, 1); + break; + case 811: + R2_GLOBALS._player.enableControl(); + _comScanner.remove(); + R2_INVENTORY.setObjectScene(R2_COM_SCANNER, 1); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 825 - Autodoc + * + *--------------------------------------------------------------------------*/ + +Scene825::Button::Button(): SceneObject() { + _buttonId = 0; + _v2 = 0; + _buttonDown = false; +} + +void Scene825::Button::synchronize(Serializer &s) { + SceneObject::synchronize(s); + s.syncAsSint16LE(_buttonId); + s.syncAsSint16LE(_v2); + s.syncAsSint16LE(_buttonDown); +} + +void Scene825::Button::process(Event &event) { + Scene825 *scene = (Scene825 *)R2_GLOBALS._sceneManager._scene; + + if (!event.handled) { + if ((event.eventType == EVENT_BUTTON_DOWN) && _bounds.contains(event.mousePos) && !_buttonDown) { + scene->_sound1.play(14); + setFrame(2); + _buttonDown = true; + event.handled = true; + } + + if ((event.eventType == EVENT_BUTTON_UP) && _buttonDown) { + setFrame(1); + _buttonDown = false; + event.handled = true; + + scene->doButtonPress(_buttonId); + } + } +} + +bool Scene825::Button::startAction(CursorType action, Event &event) { + if (action == CURSOR_USE) + return false; + else + return SceneObject::startAction(action, event); +} + +void Scene825::Button::setButton(int buttonId) { + SceneObject::postInit(); + _v2 = buttonId; + _buttonDown = 0; + _sceneText._color1 = 92; + _sceneText._color2 = 0; + _sceneText._width = 200; + _sceneText.fixPriority(20); + _sceneText._fontNumber = 50; + + switch (buttonId) { + case 1: + _sceneText.setPosition(Common::Point(95, 58)); + break; + case 2: + _sceneText.setPosition(Common::Point(98, 75)); + break; + case 3: + _sceneText.setPosition(Common::Point(102, 95)); + break; + case 4: + _sceneText.setPosition(Common::Point(180, 58)); + _sceneText._textMode = ALIGN_RIGHT; + break; + case 5: + _sceneText.setPosition(Common::Point(177, 75)); + _sceneText._textMode = ALIGN_RIGHT; + break; + case 6: + _sceneText.setPosition(Common::Point(175, 95)); + _sceneText._textMode = ALIGN_RIGHT; + break; + default: + break; + } + + setDetails(825, 6, 7, -1, 2, (SceneItem *)NULL); +} + +void Scene825::Button::setText(int textId) { + Scene825 *scene = (Scene825 *)R2_GLOBALS._sceneManager._scene; + + _buttonId = textId; + _lookLineNum = textId; + + _sceneText.remove(); + if (_buttonId != 0) + _sceneText.setup(scene->_autodocItems[textId - 1]); +} + +/*--------------------------------------------------------------------------*/ + +Scene825::Scene825(): SceneExt() { + _menuId = _frame1 = _frame2 = 0; + + // Setup Autodoc items list + _autodocItems[0] = MAIN_MENU; + _autodocItems[1] = DIAGNOSIS; + _autodocItems[2] = ADVANCED_PROCEDURES; + _autodocItems[3] = VITAL_SIGNS; + _autodocItems[4] = OPEN_DOOR; + _autodocItems[5] = TREATMENTS; + _autodocItems[6] = NO_MALADY_DETECTED; + _autodocItems[7] = NO_TREATMENT_REQUIRED; + _autodocItems[8] = ACCESS_CODE_REQUIRED; + _autodocItems[9] = INVALID_ACCESS_CODE; + _autodocItems[10] = FOREIGN_OBJECT_EXTRACTED; +} + +void Scene825::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(825); + R2_GLOBALS._player._uiEnabled = false; + BF_GLOBALS._interfaceY = 200; + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player._effect = 0; + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _item2.setDetails(1, 825, 3, 4, 5); + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 825, 0, -1, -1, 1, NULL); + + _sceneMode = 10; + signal(); +} + +void Scene825::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_menuId); + s.syncAsSint16LE(_frame1); + s.syncAsSint16LE(_frame2); +} + +void Scene825::remove() { + SceneExt::remove(); + R2_GLOBALS._player._uiEnabled = true; +} + +void Scene825::signal() { + switch (_sceneMode) { + case 10: + _button1.setButton(1); + _button1.setup(825, 1, 1); + _button1.setPosition(Common::Point(71, 71)); + _button2.setButton(2); + _button2.setup(825, 3, 1); + _button2.setPosition(Common::Point(74, 90)); + _button3.setButton(3); + _button3.setup(825, 5, 1); + _button3.setPosition(Common::Point(78, 109)); + _button4.setButton(4); + _button4.setup(825, 2, 1); + _button4.setPosition(Common::Point(248, 71)); + _button5.setButton(5); + _button5.setup(825, 4, 1); + _button5.setPosition(Common::Point(245, 90)); + _button6.setButton(6); + _button6.setup(825, 6, 1); + _button6.setPosition(Common::Point(241, 109)); + + doButtonPress(1); + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + break; + case 825: + _object5.remove(); + _sceneText._color1 = 92; + _sceneText._color2 = 0; + _sceneText._width = 200; + _sceneText.fixPriority(20); + _sceneText._fontNumber = 50; + _sceneText.setPosition(Common::Point(120, 75)); + _sceneText.setup(NO_MALADY_DETECTED); + _sceneMode = 826; + setAction(&_sequenceManager1, this, 826, &R2_GLOBALS._player, NULL); + break; + case 826: + _sceneText.remove(); + doButtonPress(1); + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + break; + case 827: + _object5.remove(); + R2_INVENTORY.setObjectScene(R2_OPTO_DISK, 825); + _sceneText.setPosition(Common::Point(108, 75)); + _sceneText.setup(FOREIGN_OBJECT_EXTRACTED); + _sceneMode = 826; + setAction(&_sequenceManager1, this, 826, &R2_GLOBALS._player, NULL); + break; + default: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + break; + } +} + +void Scene825::process(Event &event) { + SceneExt::process(event); + + if (R2_GLOBALS._player._uiEnabled) { + _button1.process(event); + _button2.process(event); + _button3.process(event); + _button4.process(event); + _button5.process(event); + _button6.process(event); + } +} + +void Scene825::dispatch() { + if (R2_GLOBALS._sceneObjects->contains(&_object4) && + ((_object4._frame == 1) || (_object4._frame == 3)) && + (_object4._frame != _frame1)) { + _sound2.play(25); + } + + if (R2_GLOBALS._sceneObjects->contains(&_object1) && + (_object1._frame == 3) && (_object1._frame != _frame2)) { + _sound3.play(26); + } + + _frame1 = _object4._frame; + _frame2 = _object1._frame; + + Scene::dispatch(); +} + +void Scene825::doButtonPress(int buttonId) { + if ((_menuId != 4) || (buttonId == 5)) { + _button1.setText(0); + _button2.setText(0); + _button3.setText(0); + _button4.setText(0); + _button5.setText(0); + _button6.setText(0); + + switch (buttonId) { + case 2: + R2_GLOBALS._player.disableControl(); + _object5.postInit(); + _sceneMode = 825; + setAction(&_sequenceManager1, this, 825, &R2_GLOBALS._player, &_object5, NULL); + break; + case 3: + R2_GLOBALS._player.disableControl(); + _sceneText._color1 = 92; + _sceneText._color2 = 0; + _sceneText._width = 200; + _sceneText.fixPriority(20); + _sceneText._fontNumber = 50; + _sceneText.setPosition(Common::Point(115, 75)); + + if (R2_GLOBALS.getFlag(4)) { + if ((R2_INVENTORY.getObjectScene(R2_READER) != 800) || + (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) != 800)) { + _sceneText.setPosition(Common::Point(116, 75)); + _sceneText.setup(ACCESS_CODE_REQUIRED); + } else if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) != 800) { + _sceneText.setPosition(Common::Point(115, 75)); + _sceneText.setup(NO_TREATMENT_REQUIRED); + } else { + _button6._buttonId = 5; + + _object5.postInit(); + setAction(&_sequenceManager1, this, 827, &_object5, NULL); + } + } else { + R2_GLOBALS.setFlag(2); + + if ((R2_INVENTORY.getObjectScene(R2_READER) != 800) || + (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) != 800)) { + _sceneText.setPosition(Common::Point(116, 75)); + _sceneText.setup(ACCESS_CODE_REQUIRED); + } else { + _sceneText.setPosition(Common::Point(119, 75)); + _sceneText.setup(INVALID_ACCESS_CODE); + } + } + + if (_sceneMode != 827) { + _sceneMode = 826; + setAction(&_sequenceManager1, this, 826, &R2_GLOBALS._player, NULL); + } + break; + case 4: + _sound4.play(27); + _button6._buttonId = 5; + + _object1.postInit(); + _object1.setup(826, 7, 1); + _object1.setPosition(Common::Point(112, 67)); + _object1._numFrames = 1; + _object1.animate(ANIM_MODE_2); + + _object2.postInit(); + _object2.setup(826, 5, 1); + _object2.setPosition(Common::Point(158, 67)); + _object2._numFrames = 5; + _object2.animate(ANIM_MODE_2); + + _object3.postInit(); + _object3.setup(826, 6, 1); + _object3.setPosition(Common::Point(206, 67)); + _object3._numFrames = 1; + _object3.animate(ANIM_MODE_2); + + _object4.postInit(); + _object4.setup(826, 8, 1); + _object4.setPosition(Common::Point(158, 84)); + _object4._numFrames = 1; + _object4.animate(ANIM_MODE_2); + + _object5.postInit(); + _object5.setup(826, 4, 1); + _object5.setPosition(Common::Point(161, 110)); + break; + case 5: + R2_GLOBALS._player.disableControl(); + if (_menuId == 4) { + _menuId = 0; + + _object1.remove(); + _object2.remove(); + _object3.remove(); + _object4.remove(); + _object5.remove(); + + _sound2.stop(); + _sound3.stop(); + _sound4.stop(); + + doButtonPress(1); + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + } else { + R2_GLOBALS._sceneManager.changeScene(800); + } + break; + case 6: + R2_GLOBALS._player.disableControl(); + _sceneText._color1 = 92; + _sceneText._color2 = 0; + _sceneText._width = 200; + _sceneText.fixPriority(20); + _sceneText._fontNumber = 50; + _sceneText.setPosition(Common::Point(115, 75)); + _sceneText.setup(NO_TREATMENT_REQUIRED); + + _sceneMode = 826; + setAction(&_sequenceManager1, this, 826, &R2_GLOBALS._player, NULL); + break; + default: + _button1.setText(2); + _button2.setText(3); + _button3.setText(4); + _button4.setText(6); + _button6.setText(5); + break; + } + + _menuId = buttonId; + } +} + +/*-------------------------------------------------------------------------- + * Scene 850 - Deck #5 - By Lift + * + *--------------------------------------------------------------------------*/ + +bool Scene850::Indicator::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if ((action != CURSOR_USE) || (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) != 850)) + return NamedHotspot::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 851; + scene->setAction(&scene->_sequenceManager1, scene, 851, &R2_GLOBALS._player, &scene->_fibre, NULL); + return true; + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene850::LiftDoor::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 202; + scene->setAction(&scene->_sequenceManager1, scene, 202, &R2_GLOBALS._player, this, NULL); + return true; + } +} + +bool Scene850::SickBayDoor::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 204; + scene->setAction(&scene->_sequenceManager1, scene, 204, &R2_GLOBALS._player, this, NULL); + return true; + } +} + +bool Scene850::Clamp::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if (!R2_GLOBALS.getFlag(7)) + return false; + else if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_object1.postInit(); + scene->_sceneMode = 850; + scene->setAction(&scene->_sequenceManager1, scene, 850, &R2_GLOBALS._player, this, &scene->_object1, NULL); + return true; + } +} + +bool Scene850::Panel::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if ((action != CURSOR_USE) || R2_GLOBALS.getFlag(7)) + return SceneActor::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 852; + scene->setAction(&scene->_sequenceManager1, scene, 852, &R2_GLOBALS._player, this, &scene->_object1, NULL); + return true; + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene850::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(850); + + _liftDoor.postInit(); + _liftDoor.setup(850, 2, 1); + _liftDoor.setPosition(Common::Point(188, 79)); + _liftDoor.setDetails(850, 3, -1, -1, 1, (SceneItem *)NULL); + + _sickBayDoor.postInit(); + _sickBayDoor.setup(850, 3, 1); + _sickBayDoor.setPosition(Common::Point(62, 84)); + _sickBayDoor.setDetails(850, 9, -1, -1, 1, (SceneItem *)NULL); + + if (R2_INVENTORY.getObjectScene(R2_CLAMP) == 850) { + _clamp.postInit(); + _clamp.setup(850, 5, 1); + _clamp.setPosition(Common::Point(242, 93)); + _clamp.fixPriority(81); + _clamp.animate(ANIM_MODE_2, NULL); + _clamp.setDetails(850, 27, -1, -1, 1, (SceneItem *)NULL); + } + + _panel.postInit(); + _panel.setVisage(850); + + if (R2_GLOBALS.getFlag(7)) + _panel.setFrame(7); + + _panel.setPosition(Common::Point(232, 119)); + _panel.fixPriority(82); + _panel.setDetails(850, 24, -1, -1, 1, (SceneItem *)NULL); + + if (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) == 850) { + _fibre.postInit(); + _fibre.setup(850, 6, 1); + _fibre.setPosition(Common::Point(280, 87)); + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _eastDoor.setDetails(Rect(289, 53, 315, 125), 850, 6, -1, 8, 1, NULL); + _indicator.setDetails(Rect(275, 67, 286, 79), 850, 18, -1, 20, 1, NULL); + _sickBayIndicator.setDetails(Rect(41, 51, 48, 61), 850, 15, -1, -1, 1, NULL); + _liftControls.setDetails(Rect(156, 32, 166, 44), 850, 21, -1, -1, 1, NULL); + _compartment.setDetails(Rect(4, 88, 153, 167), 850, 12, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 850, 0, -1, -1, 1, NULL); + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 250: + _sceneMode = 203; + setAction(&_sequenceManager1, this, 203, &R2_GLOBALS._player, &_liftDoor, NULL); + break; + case 800: + _sceneMode = 205; + setAction(&_sequenceManager1, this, 205, &R2_GLOBALS._player, &_sickBayDoor, NULL); + break; + default: + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.setPosition(Common::Point(215, 115)); + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene850::signal() { + switch (_sceneMode) { + case 202: + R2_GLOBALS._sceneManager.changeScene(250); + break; + case 204: + R2_GLOBALS._sceneManager.changeScene(800); + break; + case 850: + R2_INVENTORY.setObjectScene(R2_CLAMP, 1); + _clamp.remove(); + _object1.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 851: + R2_INVENTORY.setObjectScene(R2_OPTICAL_FIBRE, 1); + _fibre.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 852: + R2_GLOBALS.setFlag(7); + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 900 - + * + *--------------------------------------------------------------------------*/ +Scene900::Actor4::Actor4() { + _fieldA4 = 0; +} + +void Scene900::Actor4::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_fieldA4); +} + +void Scene900::Actor4::sub96135(int arg1) { + _fieldA4 = arg1; + setDetails(900, -1, -1, -1, 2, (SceneItem *) NULL); +} + +Scene900::Scene900() { + _field412 = 0; + _field414 = 0; + _field416 = 0; +} + +void Scene900::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_field414); + s.syncAsSint16LE(_field416); +} + +bool Scene900::Actor4::startAction(CursorType action, Event &event) { + Scene900 *scene = (Scene900 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._sound2.play(14); + switch (_fieldA4) { + case 2: + if (scene->_field412 == 1) { + scene->_sceneMode = 2; + scene->signal(); + } else if (scene->_field412 == 2) { + if (R2_GLOBALS._v565E5 == 0) { + scene->_aSound1.play(30); + setup(900, 3, 11); + R2_GLOBALS._v565E5 = 1; + if ((R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS == 700)) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70) && (scene->_actor2._animateMode != ANIM_MODE_6)) { + scene->_actor2.animate(ANIM_MODE_6, NULL); + } else { + if (((scene->_actor3._percent * 49) / 100) + scene->_actor3._position.x == scene->_actor2._position.x) { + if (scene->_actor2._position.x == 166 - (R2_GLOBALS._v565E3 / 15)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 4; + scene->_actor2._moveDiff.y = (scene->_actor2._position.y - (scene->_actor3._position.y + ((scene->_actor3._percent * 3) / 10) - 2)) / 9; + Common::Point pt(scene->_actor3._position.x + ((scene->_actor3._percent * 49) / 100), scene->_actor3._position.y + ((scene->_actor3._percent * 3) / 10) - 2); + NpcMover *mover = new NpcMover(); + scene->_actor2.addMover(mover, &pt, this); + scene->_actor2.animate(ANIM_MODE_6, NULL); + } + } + } + } else { + scene->_aSound1.play(53); + setup(900, 3, 9); + R2_GLOBALS._v565E5 = 0; + + if ((R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) == 700) && (scene->_actor2._frame < 8) && (scene->_actor2._animateMode != ANIM_MODE_5)) { + scene->_actor2.animate(ANIM_MODE_5, NULL); + } else if ((R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 700) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) == 700) && (scene->_actor2._frame < 8)) { + R2_GLOBALS._v565E7 = 0; + if (scene->_actor2._animateMode != 5) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 5; + scene->_actor2.animate(ANIM_MODE_5, NULL); + scene->_actor2._moveDiff.y = (166 - scene->_actor2._position.y) / 9; + Common::Point pt(scene->_actor2._position.x, 166 - (R2_GLOBALS._v565E3 / 15)); + NpcMover *mover = new NpcMover(); + scene->_actor2.addMover(mover, &pt, this); + } + } + } + } + return true; + break; + case 3: + if (scene->_field412 == 1) { + scene->_sceneMode = 3; + scene->signal(); + } + return true; + break; + case 4: + if ((scene->_field416 == 0) && (scene->_field414 == 0) && (R2_GLOBALS._v565E3 != 0)) { + scene->_aSound1.play(38); + scene->_field416 = -5; + } + return true; + break; + case 5: + if ((scene->_field416 == 0) && (scene->_field414 == 0) && (R2_GLOBALS._v565E3 < 135)) { + scene->_aSound1.play(38); + scene->_field416 = 5; + } + return true; + break; + case 6: + if ((scene->_field416 == 0) && (scene->_field414 == 0) && (R2_GLOBALS._v565E1 > -10)) { + scene->_aSound1.play(38); + scene->_field414 = -5; + } + return true; + break; + case 7: + if ((scene->_field416 == 0) && (scene->_field414 == 0) && (R2_GLOBALS._v565E1 < 20)) { + scene->_aSound1.play(38); + scene->_field414 = 5; + } + return true; + break; + case 8: + SceneItem::display(5, 11, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + break; + case 9: + SceneItem::display(5, 12, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + break; + default: + if (scene->_field412 == 1) { + R2_GLOBALS._player.disableControl(); + scene->_actor5.remove(); + scene->_actor6.remove(); + scene->_actor7.remove(); + scene->_actor8.remove(); + scene->_actor9.remove(); + scene->_actor10.remove(); + R2_GLOBALS._sound2.play(37); + scene->_sceneMode = 901; + scene->setAction(&scene->_sequenceManager1, scene, 901, &scene->_actor1, this ,NULL); + } else if ((scene->_field412 == 2) || (scene->_field412 == 3)) { + scene->_sceneMode = 1; + scene->signal(); + } + + return true; + break; + } + } else if (action == CURSOR_LOOK) { + if ((_fieldA4 == 2) && (scene->_field412 == 2)) + SceneItem::display(900, 21, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + else + SceneItem::display(900, _fieldA4, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +void Scene900::postInit(SceneObjectList *OwnerList) { + g_globals->gfxManager()._bounds.moveTo(Common::Point(0, 0)); + loadScene(900); + SceneExt::postInit(); + R2_GLOBALS._sound1.play(34); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor1.setDetails(900, 3, -1, -1, 1, (SceneItem *) NULL); + + _field414 = 0; + _field416 = 0; + + _actor3.postInit(); + _actor3.fixPriority(1); + // useless, the original use it for debugging purposes: strcpy(_actor3._actorName, "Crane"); + _actor3.setup(900, 1, 2); + _actor3.setPosition(Common::Point(89, 0)); + _actor3._effect = 1; + _actor3.setDetails(900, 6, -1, 8, 1, (SceneItem *) NULL); + + if ((R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) != 1) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) != 1)) { + _actor2.postInit(); + _actor2.setPosition(Common::Point(0, 0)); + _actor2.fixPriority(1); + + if (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) { + if (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) != 700) { + _actor2.setup(901, 3, 2); + } else if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70)) { + _actor2.setup(901, 2, 1); + } else { + _actor2.setup(901, 2, 8); + } + _actor2.setPosition(Common::Point(171, 145)); + _actor2.setDetails(700, -1, -1, -1, 1, (SceneItem *) NULL); + } else { + _actor2.setDetails(700, -1, -1, -1, 1, (SceneItem *) NULL); + if (R2_GLOBALS._v565E7 == 0) { + _actor2.setup(901, 1, 8); + // Original set two times the same values: skipped + _actor2.setPosition(Common::Point((((100 - ((R2_GLOBALS._v565EB * 350) / 100)) * 49) / 100) + ((R2_GLOBALS._v565E9 * _actor3._percent * 6) / 100) + 89, 166 - (R2_GLOBALS._v565EB / 3))); + _actor2.changeZoom(((100 - ((R2_GLOBALS._v565EB * 350) / 100) + 52) / 10) * 10); + } + } + } + _item1.setDetails(Rect(0, 0, 320, 200), 900, 0, -1, -1, 1, NULL); + _sceneMode = 900; + setAction(&_sequenceManager1, this, 900, &_actor1, NULL); +} + +void Scene900::remove() { + if (_sceneMode != 901) + R2_GLOBALS._sound1.play(10); + + SceneExt::remove(); +} + +void Scene900::signal() { + switch (_sceneMode) { + case 1: + _field412 = 1; + R2_GLOBALS._sound2.play(37); + + _actor5.remove(); + _actor6.remove(); + _actor7.remove(); + _actor8.remove(); + _actor9.remove(); + _actor10.remove(); + + _actor5.sub96135(2); + _actor5.setup(900, 2, 1); + _actor5.setPosition(Common::Point(36, 166)); + + _actor6.sub96135(3); + _actor6.setup(900, 2, 5); + _actor6.setPosition(Common::Point(117, 166)); + break; + case 2: + _field412 = 2; + + _actor5.remove(); + _actor6.remove(); + + _actor5.sub96135(2); + if (R2_GLOBALS._v565E5 == 0) + _actor5.setup(900, 3, 9); + else + _actor5.setup(900, 3, 11); + _actor5.setPosition(Common::Point(36, 166)); + + _actor7.sub96135(5); + _actor7.setup(900, 3, 3); + _actor7.setPosition(Common::Point(76, 134)); + + _actor8.sub96135(4); + _actor8.setup(900, 3, 7); + _actor8.setPosition(Common::Point(76, 156)); + + _actor9.sub96135(6); + _actor9.setup(900, 3, 1); + _actor9.setPosition(Common::Point(55, 144)); + + _actor10.sub96135(7); + _actor10.setup(900, 3, 5); + _actor10.setPosition(Common::Point(99, 144)); + + break; + case 3: + _field412 = 3; + + _actor5.remove(); + _actor6.remove(); + _actor7.remove(); + _actor8.remove(); + _actor9.remove(); + _actor10.remove(); + + _actor5.sub96135(8); + _actor5.setup(900, 4, 1); + _actor5.setPosition(Common::Point(36, 166)); + + _actor6.sub96135(9); + _actor6.setup(900, 4, 5); + _actor6.setPosition(Common::Point(117, 166)); + break; + case 4: + _sceneMode = 0; + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + R2_GLOBALS._v565E7 = 1; + break; + case 900: + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + + _actor1.setup(900, 1, 1); + + _actor4.sub96135(1); + _actor4.setup(900, 1, 3); + _actor4.setPosition(Common::Point(77, 168)); + + _sceneMode = 1; + signal(); + break; + case 901: + R2_GLOBALS._sceneManager.changeScene(700); + break; + case 5: + _sceneMode = 0; + // No break on purpose + default: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + break; + } +} + +void Scene900::dispatch() { + if (_field416 != 0) { + if (_field416 < 0) { + R2_GLOBALS._v565E3--; + ++_field416; + } else { + ++R2_GLOBALS._v565E3; + _field416--; + } + } + + if (_field414 != 0) { + R2_GLOBALS._v565E1--; + ++_field414; + } else { + ++R2_GLOBALS._v565E1; + _field414++; + } + + if (R2_GLOBALS._sceneObjects->contains(&_actor2)) { + if ((R2_GLOBALS._v565E5 != 0) && (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) == 700) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70)) { + if ((_actor2._frame > 1) && (_actor2._animateMode != ANIM_MODE_6)) + _actor2.animate(ANIM_MODE_6, NULL); + } else { + if ((_actor2._frame < 8) && (_actor2._animateMode != ANIM_MODE_5) && (R2_GLOBALS._v565E7 == 0) && (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) == 700) && (_sceneMode != 4)) + _actor2.animate(ANIM_MODE_5, NULL); + } + } + + _actor3.changeZoom(100 - ((R2_GLOBALS._v565E3 * 70) / 100)); + _actor3.setPosition(Common::Point(((_actor3._percent * R2_GLOBALS._v565E1 * 6) / 100) + 89, R2_GLOBALS._v565E3)); + + if ((R2_GLOBALS._sceneObjects->contains(&_actor2)) && (R2_GLOBALS._v565E7 != 0) && (!_actor2._mover) && (_actor2._animateMode == ANIM_MODE_NONE)) { + _actor2.setPosition(Common::Point(_actor3._position.x + ((_actor3._percent * 49) / 100), _actor3._position.y + ((_actor3._percent * 3) / 10))); + if (R2_GLOBALS._v565E3 >= 75) { + _actor2.setup(901, 1, 1); + _actor2.changeZoom(((_actor3._percent + 52) / 10) * 10); + } else { + _actor2.setup(901, 5, 1); + _actor2.changeZoom(((_actor3._percent / 10) * 10) + 30); + } + } + Scene::dispatch(); +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 834b91c01c..2f52f9578f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -45,9 +45,9 @@ class Scene50: public SceneExt { public: void signal(); }; - + public: - Action1 _action1; + Action1 _action1; virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void process(Event &event); @@ -67,7 +67,7 @@ class Scene100: public SceneExt { public: bool startAction(CursorType action, Event &event); }; - class Object10: public SceneActorExt { + class DoorDisplay: public SceneActorExt { public: bool startAction(CursorType action, Event &event); }; @@ -85,12 +85,12 @@ class Scene100: public SceneExt { public: NamedHotspot _background, _duct, _bed, _desk; Terminal _terminal; - SceneActor _object1, _object2, _object3, _object4, _object5; - SceneActor _object6; + SceneActor _bedLights1, _bedLights2, _object3, _object4, _object5; + SceneActor _wardrobe; Door _door; Table _table; StasisNegator _stasisNegator; - Object10 _object10; + DoorDisplay _doorDisplay; SteppingDisks _steppingDisks; SequenceManager _sequenceManager1, _sequenceManager2; @@ -157,6 +157,75 @@ public: Common::String parseMessage(const Common::String &msg); }; +class Scene150: public Scene100 { +public: + SceneActor _emptyRoomTable; +public: + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + +class Scene160: public SceneExt { + class Action1: public Action { + public: + void signal(); + }; +public: + ASound _sound1; + Action1 _action1; + int _frameNumber, _yChange; + SceneObject _object1, _object2, _object3; + int _lineNum; + SynchronizedList<SceneText *> _creditsList; +public: + Scene160(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void synchronize(Serializer &s); + virtual void remove(); + virtual void process(Event &event); +}; + +class Scene175: public Scene150 { +}; + +class Scene180: public SceneExt { + class Action1: public Action { + public: + void signal(); + }; +private: + void setSceneDelay(int v); +public: + SpeakerWebbster _webbsterSpeaker; + SpeakerDutyOfficer _dutyOfficerSpeaker; + SpeakerTeal _tealSpeaker; + SpeakerGameText _gameTextSpeaker; + SceneActor _object1, _object2, _object3, _object4, _object5; + ScenePalette _palette; + SceneText _textList[20]; + AnimationPlayerExt _animationPlayer; + SequenceManager _sequenceManager; + Action1 _action1; + ASoundExt _sound1; + + int _frameNumber; + int _field412, _field480; + int _field482, _frameInc; + int _fontNumber, _fontHeight; + int _scene180Mode; +public: + Scene180(); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void synchronize(Serializer &s); + virtual void remove(); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); + virtual void restore(); +}; + class Scene200: public SceneExt { /* Objects */ class NorthDoor: public SceneActor { @@ -194,6 +263,81 @@ public: virtual void signal(); }; +class Scene205: public SceneExt { + /* Actions */ + class Action1: public Action { + private: + void textLoop(); + public: + virtual void signal(); + }; + + /* Objects */ + class Object: public SceneObject { + public: + int _x100, _y100; + public: + Object(); + + virtual void synchronize(Serializer &s); + }; +private: + void setup(); + void processList(Object **ObjList, int count, const Common::Rect &bounds, + int xMultiply, int yMultiply, int xCenter, int yCenter); + void handleText(); +public: + AnimationPlayer _animationPlayer; + int _fontHeight; + SceneText _textList[15]; + Object *_objList1[3]; + Object *_objList2[3]; + Object *_objList3[4]; + ASound _sound1; + Action1 _action1; + int _yp; + int _textIndex, _lineNum; + Common::String _message; +public: + Scene205(); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void synchronize(Serializer &s); + virtual void remove(); + virtual void process(Event &event); + virtual void dispatch(); +}; + + +class Scene250: public SceneExt { + class Button: public SceneActor { + public: + int _floorNumber, _v2; + Button(); + void setFloor(int floorNumber); + + virtual void synchronize(Serializer &s); + virtual bool startAction(CursorType action, Event &event); + }; +public: + int _field412, _field414, _field416, _field418, _field41A; + NamedHotspot _background, _item2, _item3, _item4; + Button _button1, _currentFloor; + Button _floor1, _floor2, _floor3, _floor4, _floor5; + Button _floor6, _floor7, _floor8, _floor9; + ASoundExt _sound1; + SequenceManager _sequenceManager1; +public: + Scene250(); + void changeFloor(int floorNumber); + + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); +}; + class Scene300: public SceneExt { /* Actions */ class Action1: public Action { @@ -240,6 +384,10 @@ class Scene300: public SceneExt { public: virtual bool startAction(CursorType action, Event &event); }; + class Doorway: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; public: SequenceManager _sequenceManager1, _sequenceManager2, _sequenceManager3, _sequenceManager4; ASoundExt _sound1; @@ -258,7 +406,8 @@ public: MirandaWorkstation _mirandaWorkstation1, _mirandaWorkstation2; SceneActor _object1, _object2, _object3, _object4, _protocolDisplay; SceneActor _object6, _object7, _object8, _object9; - SceneActor _teal, _soldier, _object12, _doorway; + SceneActor _teal, _soldier, _object12; + Doorway _doorway; Miranda _miranda; Seeker _seeker; Quinn _quinn; @@ -278,6 +427,479 @@ public: virtual void signal(); }; +class Scene325: public SceneExt { + class Icon: public SceneActor { + public: + int _lookLineNum, _field98; + bool _pressed; + SceneObject _object1, _object2; + SceneText _sceneText1, _sceneText2; + + Icon(); + virtual Common::String getClassName() { return "Scene325_Icon"; } + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void synchronize(Serializer &s); + virtual void process(Event &event); + + void setIcon(int id); + void showIcon(); + void hideIcon(); + }; + +private: + void removeText(); + void consoleAction(int id); + void setMessage(int resNum, int lineNum); + Common::String parseMessage(const Common::String &msg); +public: + int _field412, _iconFontNumber, _field416, _field418; + int _field41A, _field41C, _field41E, _field420; + int _soundCount, _soundIndex; + int _soundQueue[10]; + SpeakerQuinn _quinnSpeaker; + ScenePalette _palette; + SceneHotspot _background, _item2; + SceneObject _object1, _object2, _object3, _object4, _object5; + SceneObject _object6, _object7, _object8, _object9, _object10; + SceneObject _object11, _object12, _object13; + SceneObject _objList[4]; + Icon _icon1, _icon2, _icon3, _icon4, _icon5, _icon6; + ASoundExt _sound1; + SequenceManager _sequenceManager1; + SceneText _text1; +public: + Scene325(); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void synchronize(Serializer &s); + virtual void remove(); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); +}; + + +class Scene400: public SceneExt { + /* Items */ + class Terminal: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Objects */ + class Door: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Reader: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class SensorProbe: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class AttractorUnit: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + NamedHotspot _background, _equipment1, _equipment2, _equipment3; + NamedHotspot _equipment4, _equipment5, _equipment6; + NamedHotspot _desk, _desk2, _console; + NamedHotspot _duct, _shelves, _cabinet, _doorDisplay, _lights; + NamedHotspot _equalizer, _transducer, _optimizer, _soundModule, _tester; + NamedHotspot _helmet, _nullifier; + Terminal _terminal; + SceneActor _consoleDisplay, _testerDisplay; + Door _door; + Reader _reader; + SensorProbe _sensorProbe; + AttractorUnit _attractorUnit; + SequenceManager _sequenceManager1; + ASoundExt _sound1; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void dispatch(); +}; + +class Scene500: public SceneExt { + /* Items */ + class ControlPanel: public SceneHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Objects */ + class Object2: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Object3: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Doorway: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class OxygenTanks: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class AirLock: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Object8: public SceneActor { + // This classes uses a custom draw method + }; + class Aerosol: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class SonicStunner: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Locker1: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Locker2: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Object: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + int _stripNumber; + byte _buffer[2710]; + SpeakerSeeker _seekerSpeaker; + SpeakerQuinn _quinnSpeaker; + SceneHotspot _background, _item2; + ControlPanel _controlPanel; + SceneActor _object1; + Object2 _object2; + Object3 _object3; + Doorway _doorway; + OxygenTanks _tanks1, _tanks2; + AirLock _airLock; + Object8 _object8; + Aerosol _aerosol; + SonicStunner _sonicStunner; + Locker1 _locker1; + Locker2 _locker2; + SceneAreaObject _area1; + Object _obj1, _obj2, _obj3; + ASoundExt _sound1; + SequenceManager _sequenceManager1, _sequenceManager2; +public: + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void synchronize(Serializer &s); + virtual void signal(); +}; + +class Scene525: public SceneExt { +public: + SceneActor _actor1; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + +}; + +class Scene600 : public SceneExt { + class Item1 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item4 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor4 : public SceneActor { + public: + virtual void signal(); + virtual bool startAction(CursorType action, Event &event); + virtual void draw(); + }; + class Actor5 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor6 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor7 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor8 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + int _field412; + Item1 _item1; + Item1 _item2; + Item1 _item3; + Item4 _item4; + Item1 _item5; + BackgroundSceneObject _object1; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + Actor4 _actor4; + Actor5 _actor5; + Actor6 _actor6; + Actor7 _actor7; + Actor8 _actor8; + ASoundExt _aSound1; + SequenceManager _sequenceManager1; + SequenceManager _sequenceManager2; + byte _fieldAD2[256]; + + Scene600(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); + virtual void synchronize(Serializer &s); +}; + +class Scene700: public SceneExt { + class Item11 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item12 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor2 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor3 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor4 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor5 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor6 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + NamedHotspot _item6; + NamedHotspot _item7; + NamedHotspot _item8; + NamedHotspot _item9; + NamedHotspot _item10; + Item11 _item11; + Item12 _item12; + SceneActor _actor1; + Actor2 _actor2; + Actor3 _actor3; + Actor4 _actor4; + Actor5 _actor5; + Actor6 _actor6; + Actor6 _actor7; + Actor6 _actor8; + Actor6 _actor9; + SequenceManager _sequenceManager; + PaletteRotation *_rotation; + int _field100E; + + Scene700(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void synchronize(Serializer &s); +}; + +class Scene800: public SceneExt { + /* Items */ + class Button: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class CableJunction: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class DeviceSlot: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Objects */ + class Door: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Tray: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class ComScanner: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Cabinet: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + NamedHotspot _background, _autoDoc, _diskSlot, _couch; + NamedHotspot _medicalDatabase, _dataConduits; + Button _button; + CableJunction _cableJunction; + DeviceSlot _deviceSlot; + SceneActor _autodocCover, _opticalFibre, _reader; + Door _door; + Tray _tray; + ComScanner _comScanner; + Cabinet _cabinet; + SequenceManager _sequenceManager1; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene825: public SceneExt { + /* Objects */ + class Button: public SceneObject { + public: + int _buttonId, _v2; + bool _buttonDown; + SceneText _sceneText; + public: + Button(); + void setButton(int buttonId); + void setText(int textId); + + virtual void synchronize(Serializer &s); + virtual void process(Event &event); + virtual bool startAction(CursorType action, Event &event); + }; +public: + NamedHotspot _background, _item2; + SceneActor _object1, _object2, _object3, _object4, _object5; + Button _button1, _button2, _button3, _button4, _button5, _button6; + ASoundExt _sound1, _sound2, _sound3, _sound4; + SequenceManager _sequenceManager1; + SceneText _sceneText; + int _menuId, _frame1, _frame2; + const char *_autodocItems[11]; +public: + Scene825(); + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); + + void doButtonPress(int buttonId); +}; + +class Scene850: public SceneExt { + /* Items */ + class Indicator: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Objects */ + class LiftDoor: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class SickBayDoor: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Clamp: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Panel: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + NamedHotspot _background, _eastDoor, _compartment, _sickBayIndicator; + NamedHotspot _liftControls; + Indicator _indicator; + SceneActor _object1, _fibre; + LiftDoor _liftDoor; + SickBayDoor _sickBayDoor; + Clamp _clamp; + Panel _panel; + SequenceManager _sequenceManager1; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene900 : public SceneExt { + class Actor4 : public SceneActor { + public: + int _fieldA4; + + Actor4(); + void sub96135(int arg1); + virtual void synchronize(Serializer &s); + virtual bool startAction(CursorType action, Event &event); + }; +public: + int _field412; + int _field414; + int _field416; + NamedHotspot _item1; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + Actor4 _actor4; + Actor4 _actor5; + Actor4 _actor6; + Actor4 _actor7; + Actor4 _actor8; + Actor4 _actor9; + Actor4 _actor10; + ASoundExt _aSound1; + SequenceManager _sequenceManager1; + + Scene900(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void dispatch(); + virtual void synchronize(Serializer &s); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp new file mode 100644 index 0000000000..304d3a4298 --- /dev/null +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -0,0 +1,14622 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/staticres.h" +#include "tsage/ringworld2/ringworld2_scenes1.h" + +namespace TsAGE { + +namespace Ringworld2 { + +/*-------------------------------------------------------------------------- + * Scene 1010 - Cutscene: A pixel lost in space! + * + *--------------------------------------------------------------------------*/ +void Scene1010::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(1010); + + R2_GLOBALS._uiElements._active = false; + setZoomPercents(100, 1, 160, 100); + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setObjectWrapper(NULL); + R2_GLOBALS._player.setPosition(Common::Point(30, 264)); + R2_GLOBALS._player.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + + if (R2_GLOBALS.getFlag(57)) + _sceneMode = 1; + else { + R2_GLOBALS._sound1.play(89); + _sceneMode = 0; + } +} + +void Scene1010::signal() { + switch (_sceneMode) { + case 1: { + _sceneMode = 2; + R2_GLOBALS._player.setup(1010, 2, 1); + R2_GLOBALS._player.setPosition(Common::Point(297, 101)); + Common::Point pt(30, 264); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: + _sceneMode = 3; + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + R2_GLOBALS._player.hide(); + break; + case 3: + if (R2_GLOBALS.getFlag(57)) + R2_GLOBALS._sceneManager.changeScene(1500); + else + R2_GLOBALS._sceneManager.changeScene(1000); + break; + default: { + _sceneMode = 2; + R2_GLOBALS._player.setup(1010, 1, 1); + Common::Point pt(297, 101); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 1020 - + * + *--------------------------------------------------------------------------*/ +void Scene1020::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(1020); + + if (R2_GLOBALS._sceneManager._previousScene == 1010) + g_globals->gfxManager()._bounds.moveTo(Common::Point(160, 0)); + + R2_GLOBALS._v558B6.set(160, 0, 160, 161); + R2_GLOBALS._uiElements._active = false; + R2_GLOBALS._player.postInit(); + + if (R2_GLOBALS._sceneManager._previousScene == 1010) { + R2_GLOBALS._player.setPosition(Common::Point(500, 100)); + R2_GLOBALS._player.setup(1020, 1, 1); + } else { + R2_GLOBALS._player.setPosition(Common::Point(0, 100)); + R2_GLOBALS._player.setup(1020, 2, 1); + } + + R2_GLOBALS._player.setObjectWrapper(NULL); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + + if (R2_GLOBALS._sceneManager._previousScene == 1010) + _sceneMode = 0; + else + _sceneMode = 10; +} + +void Scene1020::signal() { + switch (_sceneMode) { + case 0: { + _sceneMode = 1; + R2_GLOBALS._player.show(); + R2_GLOBALS._player.setPosition(Common::Point(347, 48)); + R2_GLOBALS._player._moveDiff = Common::Point(2, 1); + R2_GLOBALS._player.setZoom(0); + Common::Point pt(392, 41); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 1: + _sceneMode = 2; + R2_GLOBALS._player.setZoom(100); + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 2: { + _sceneMode = 3; + R2_GLOBALS._player._moveDiff = Common::Point(30, 15); + Common::Point pt(-15, 149); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: + _sceneMode = 4; + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + break; + case 4: + R2_GLOBALS.setFlag(51); + R2_GLOBALS._sceneManager.changeScene(300); + break; + case 10: { + _sceneMode = 11; + R2_GLOBALS._player.setPosition(Common::Point(25, 133)); + R2_GLOBALS._player._moveDiff = Common::Point(30, 15); + R2_GLOBALS._player.setZoom(100); + Common::Point pt(355, 60); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 11: + R2_GLOBALS._player.setPosition(Common::Point(355, 57)); + _sceneMode = 12; + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 12: { + R2_GLOBALS._player.setPosition(Common::Point(355, 60)); + _sceneMode = 13; + R2_GLOBALS._player._moveDiff = Common::Point(3, 1); + Common::Point pt(347, 48); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 13: + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + if (R2_GLOBALS._player._percent < 1) + _sceneMode = 14; + break; + case 14: + R2_GLOBALS._sceneManager.changeScene(1010); + break; + default: + break; + } +} + +void Scene1020::dispatch() { + if (_sceneMode == 1) { + R2_GLOBALS._player.setZoom(R2_GLOBALS._player._percent + 1); + if (R2_GLOBALS._player._percent > 10) + R2_GLOBALS._player._moveDiff.x = 3; + if (R2_GLOBALS._player._percent > 20) + R2_GLOBALS._player._moveDiff.x = 4; + } + + if ((_sceneMode == 13) && (R2_GLOBALS._player._percent != 0)) { + R2_GLOBALS._player.setZoom(R2_GLOBALS._player._percent - 2); + if (R2_GLOBALS._player._percent < 80) + R2_GLOBALS._player._moveDiff.x = 2; + if (R2_GLOBALS._player._percent < 70) + R2_GLOBALS._player._moveDiff.x = 1; + } + + Scene::dispatch(); +} + +/*-------------------------------------------------------------------------- + * Scene 1100 - + * + *--------------------------------------------------------------------------*/ +Scene1100::Scene1100() { + _field412 = 0; + _field414 = 0; +} + +void Scene1100::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_field414); +} + +bool Scene1100::Actor16::startAction(CursorType action, Event &event) { + Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS.getFlag(52)) { + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_field412 = 327; + else + scene->_field412 = 328; + scene->_sceneMode = 53; + scene->setAction(&scene->_sequenceManager1, scene, 1122, &R2_GLOBALS._player, NULL); + } else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 55; + if (R2_GLOBALS._v565AE >= 3) { + if (R2_GLOBALS._player._characterIndex == 1) + scene->_stripManager.start3(329, scene, R2_GLOBALS._stripManager_lookupList); + else + scene->_stripManager.start3(330, scene, R2_GLOBALS._stripManager_lookupList); + } else { + ++R2_GLOBALS._v565AE; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_stripManager.start3(304, scene, R2_GLOBALS._stripManager_lookupList); + else + scene->_stripManager.start3(308, scene, R2_GLOBALS._stripManager_lookupList); + } + } + return true; +} + +bool Scene1100::Actor17::startAction(CursorType action, Event &event) { + Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case R2_NEGATOR_GUN: + if (_visage == 1105) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1114; + scene->setAction(&scene->_sequenceManager1, scene, 1114, &R2_GLOBALS._player, &scene->_actor17, NULL); + return true; + } else { + return SceneActor::startAction(action, event); + } + break; + case R2_SONIC_STUNNER: + // No break on purpose + case R2_PHOTON_STUNNER: + if (_visage == 1105) { + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._characterIndex == 1) { + scene->_sceneMode = 1112; + scene->setAction(&scene->_sequenceManager1, scene, 1112, &R2_GLOBALS._player, &scene->_actor17, NULL); + } else { + scene->_sceneMode = 1115; + scene->setAction(&scene->_sequenceManager1, scene, 1115, &R2_GLOBALS._player, &scene->_actor17, NULL); + } + return true; + } else if (_strip == 2) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1113; + if (R2_GLOBALS._player._characterIndex == 1) { + scene->setAction(&scene->_sequenceManager1, scene, 1113, &R2_GLOBALS._player, &scene->_actor17, NULL); + } else { + scene->setAction(&scene->_sequenceManager1, scene, 1118, &R2_GLOBALS._player, &scene->_actor17, NULL); + } + return true; + } else { + return SceneActor::startAction(action, event); + } + break; + default: + return SceneActor::startAction(action, event); + break; + } +} + +bool Scene1100::Actor18::startAction(CursorType action, Event &event) { + Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene; + + if ((action == CURSOR_TALK) && (!R2_GLOBALS.getFlag(54)) && (R2_GLOBALS.getFlag(52))) { + scene->_field412 = 0; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 53; + scene->setAction(&scene->_sequenceManager1, scene, 1122, &R2_GLOBALS._player, NULL); + return true; + } + + return SceneActor::startAction(action, event); +} + +void Scene1100::postInit(SceneObjectList *OwnerList) { + if ((R2_GLOBALS._sceneManager._previousScene == 300) || (R2_GLOBALS._sceneManager._previousScene == 1100)) + loadScene(1150); + else + loadScene(1100); + + if ((R2_GLOBALS._sceneManager._previousScene == 1000) && (!R2_GLOBALS.getFlag(44))) { + R2_GLOBALS._uiElements._active = false; + R2_GLOBALS._v5589E.left = 0; + R2_GLOBALS._v5589E.right = 200; + } + + if (R2_GLOBALS._player._characterScene[1] == 1100) + R2_GLOBALS._sceneManager._previousScene = 1100; + + if (R2_GLOBALS._sceneManager._previousScene == -1) { + R2_GLOBALS._uiElements._active = false; + R2_GLOBALS._v5589E.left = 0; + R2_GLOBALS._v5589E.right = 200; + } + + SceneExt::postInit(); + + if (R2_GLOBALS._sceneManager._previousScene == -1) + R2_GLOBALS._sceneManager._previousScene = 1000; + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_seekerSpeaker); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_chiefSpeaker); + + scalePalette(65, 65, 65); + + _actor2.postInit(); + _actor2.setup(1100, 1, 1); + _actor2.fixPriority(10); + + R2_GLOBALS._scrollFollower = NULL; + + _item3.setDetails(Rect(56, 47, 68, 83), 1100, 7, -1, -1, 1, NULL); + _item4.setDetails(Rect(167, 132, 183, 167), 1100, 7, -1, -1, 1, NULL); + _item5.setDetails(Rect(26, 112, 87, 145), 1100, 13, -1, -1, 1, NULL); + _item7.setDetails(Rect(4, 70, 79, 167), 1100, 16, -1, -1, 1, NULL); + + R2_GLOBALS._sound1.stop(); + + if (R2_GLOBALS._sceneManager._previousScene == 300) { + if (R2_GLOBALS._player._characterIndex == 3) + R2_GLOBALS._player._characterIndex = R2_QUINN; + R2_GLOBALS._player._characterScene[1] = 1100; + R2_GLOBALS._player._characterScene[2] = 1100; + _actor2.setPosition(Common::Point(150, 30)); + R2_GLOBALS._sound1.play(93); + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor16.postInit(); + _actor16.hide(); + if (R2_GLOBALS._player._characterIndex == 1) + _actor16.setDetails(9002, 0, 4, 3, 1, (SceneItem *) NULL); + else + _actor16.setDetails(9001, 0, 5, 3, 1, (SceneItem *) NULL); + + _actor18.postInit(); + _actor18.setup(1113, 3, 1); + _actor18.setPosition(Common::Point(181, 125)); + _actor18.fixPriority(110); + + if (R2_GLOBALS.getFlag(54)) + _actor18.setDetails(1100, 4, -1, -1, 1, (SceneItem *) NULL); + else + _actor18.setDetails(1100, 3, -1, -1, 1, (SceneItem *) NULL); + + _actor17.postInit(); + _actor17.setup(1105, 3, 1); + _actor17.setPosition(Common::Point(312, 165)); + _actor17._numFrames = 5; + _actor17.setDetails(1100, 22, 23, 24, 1, (SceneItem *) NULL); + + _actor1.postInit(); + _actor1.setup(1512, 1, 1); + _actor1.setPosition(Common::Point(187, -25)); + _actor1.fixPriority(48); + _actor1._moveDiff.y = 1; + _actor1.setDetails(1100, 37, -1, -1, 1, (SceneItem *) NULL); + + _sceneMode = 20; + + setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL); + } else if (R2_GLOBALS._sceneManager._previousScene == 1000) { + _actor2.setPosition(Common::Point(50, 30)); + _field414 = 0; + _palette1.loadPalette(1101); + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player._effect = 5; + R2_GLOBALS._player._field9C = _field312; + R2_GLOBALS._player.setup(1102, 3, 2); + R2_GLOBALS._player.setObjectWrapper(NULL); + R2_GLOBALS._player.setPosition(Common::Point(111,-20)); + R2_GLOBALS._player.fixPriority(150); + R2_GLOBALS._player._moveRate = 30; + R2_GLOBALS._player._moveDiff = Common::Point(16, 2); + + _object1.setup2(1104, 2, 1, 175, 125, 102, 1); + _object2.setup2(1102, 5, 1, 216, 167, 1, 0); + + _actor12.postInit(); + _actor12.setup(1113, 2, 1); + _actor12.setPosition(Common::Point(67, 151)); + _actor12.fixPriority(255); + + _actor3.postInit(); + _actor3.setup(1102, 6, 1); + _actor3._moveRate = 30; + _actor3._moveDiff.x = 2; + + _actor4.postInit(); + _actor4.setup(1102, 6, 2); + _actor4._moveRate = 30; + _actor4._moveDiff.x = 2; + _actor4._effect = 5; + _actor4._field9C = _field312; + + R2_GLOBALS._sound1.play(86); + + _sceneMode = 0; + + setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL); + } else { + _actor2.setPosition(Common::Point(180, 30)); + if (R2_GLOBALS.getFlag(52)) + R2_GLOBALS._sound1.play(98); + else + R2_GLOBALS._sound1.play(95); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + + _actor16.postInit(); + + if (R2_GLOBALS.getFlag(52)) { + if (R2_GLOBALS._player._characterIndex == 1) { + R2_GLOBALS._player.setup(19, 7, 1); + _actor16.setup(29, 6, 1); + } else { + R2_GLOBALS._player.setup(29, 7, 1); + _actor16.setup(19, 6, 1); + } + R2_GLOBALS._player.setPosition(Common::Point(140, 124)); + _actor16.setPosition(Common::Point(237, 134)); + R2_GLOBALS._player.enableControl(); + } else { + if (R2_GLOBALS._player._characterIndex == 1) { + R2_GLOBALS._player.setup(1107, 2, 1); + _actor16.setup(1107, 4, 1); + R2_GLOBALS._player.setPosition(Common::Point(247, 169)); + _actor16.setPosition(Common::Point(213, 169)); + } else { + R2_GLOBALS._player.setup(1107, 4, 1); + _actor16.setup(1107, 2, 1); + R2_GLOBALS._player.setPosition(Common::Point(213, 169)); + _actor16.setPosition(Common::Point(247, 169)); + } + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + } + + if (R2_GLOBALS._player._characterIndex == 1) + _actor16.setDetails(9002, 0, 4, 3, 1, (SceneItem *) NULL); + else + _actor16.setDetails(9001, 0, 5, 3, 1, (SceneItem *) NULL); + + _actor18.postInit(); + _actor18.setup(1113, 3, 1); + _actor18.setPosition(Common::Point(181, 125)); + _actor18.fixPriority(110); + + if (R2_GLOBALS.getFlag(54)) + _actor18.setDetails(1100, 4, -1, -1, 1, (SceneItem *) NULL); + else + _actor18.setDetails(1100, 3, -1, -1, 1, (SceneItem *) NULL); + + if (!R2_GLOBALS.getFlag(52)) { + _actor17.postInit(); + if (R2_GLOBALS.getFlag(53)) + _actor17.setup(1106, 2, 4); + else + _actor17.setup(1105, 4, 4); + + _actor17.setPosition(Common::Point(17, 54)); + _actor17._numFrames = 5; + + if (R2_GLOBALS.getFlag(53)) + _actor17.setDetails(1100, 28, -1, -1, 1, (SceneItem *) NULL); + else + _actor17.setDetails(1100, 22, 23, 24, 1, (SceneItem *) NULL); + + _actor17.fixPriority(200); + } + _actor1.postInit(); + _actor1.setup(1512, 1, 1); + _actor1.setPosition(Common::Point(187, 45)); + _actor1.fixPriority(48); + _actor1._moveDiff.y = 1; + _actor1.setDetails(1100, 37, -1, -1, 1, (SceneItem *) NULL); + } + _item6.setDetails(Rect(123, 69, 222, 105), 1100, 13, -1, -1, 1, NULL); + _item2.setDetails(Rect(0, 0, 480, 46), 1100, 0, -1, -1, 1, NULL); + _item1.setDetails(Rect(0, 0, 480, 200), 1100, 40, 41, 42, 1, NULL); +} + +void Scene1100::remove() { + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + if (_sceneMode > 20) + R2_GLOBALS._sound1.fadeOut2(NULL); + g_globals->gfxManager()._bounds.moveTo(Common::Point(0, 0)); + R2_GLOBALS._uiElements._active = true; + SceneExt::remove(); +} + +void Scene1100::signal() { + switch (_sceneMode++) { + case 0: + _actor3.setPosition(Common::Point(350, 20)); + setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL); + break; + case 1:{ + Common::Point pt(-150, 20); + NpcMover *mover = new NpcMover(); + _actor3.addMover(mover, &pt, this); + _actor4.setPosition(Common::Point(350, 55)); + + Common::Point pt2(-150, 55); + NpcMover *mover2 = new NpcMover(); + _actor4.addMover(mover2, &pt2, NULL); + } + break; + case 2: + _actor3.remove(); + _actor4.remove(); + _actor5.postInit(); + _actor6.postInit(); + _actor7.postInit(); + _actor8.postInit(); + _actor9.postInit(); + _actor10.postInit(); + setAction(&_sequenceManager1, this, 1102, &_actor5, &_actor6, &_actor7, &_actor8, &_actor9, &_actor10, NULL); + break; + case 3: { + R2_GLOBALS._sound2.play(84); + R2_GLOBALS._player.setPosition(Common::Point(-50, 126)); + Common::Point pt(350, 226); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 4: + _actor18.postInit(); + _actor18.show(); + setAction(&_sequenceManager1, this, 1101, &_actor18, &_actor10, NULL); + break; + case 5: + _actor13.postInit(); + _actor13._effect = 6; + _actor13.setup(1103, 3, 1); + _actor13._moveRate = 30; + + _actor14.postInit(); + _actor14._effect = 6; + _actor14.setup(1103, 4, 1); + _actor4._moveRate = 25; + + _actor13.setAction(&_sequenceManager2, this, 1109, &_actor13, &_actor14, NULL); + break; + case 6: { + _actor13.remove(); + _actor14.remove(); + R2_GLOBALS._player.setPosition(Common::Point(-50, 136)); + R2_GLOBALS._sound2.play(84); + Common::Point pt(350, 236); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 7: + setAction(&_sequenceManager1, this, 1103, &_actor18, &_actor10); + break; + case 8: + R2_GLOBALS._player._effect = 0; + _actor11.postInit(); + setAction(&_sequenceManager1, this, 1105, &R2_GLOBALS._player, &_actor10, &_actor11, &_actor18, NULL); + break; + case 9: + _object1.proc27(); + + _actor15.postInit(); + _actor15.setup(1103, 2, 1); + _actor15._moveRate = 30; + _actor15.setAction(&_sequenceManager3, this, 1107, &_actor15, NULL); + break; + case 10: + _actor13.postInit(); + _actor13.setup(1103, 1, 1); + _actor13._moveRate = 15; + _actor13.setAction(&_sequenceManager2, this, 1108, &_actor13, NULL); + break; + case 11: { + setAction(&_sequenceManager1, this, 1116, &_actor11, &_actor10, &_actor12, NULL); + R2_GLOBALS._player._effect = 5; + R2_GLOBALS._player.setup(1102, 3, 2); + R2_GLOBALS._player.setPosition(Common::Point(-50, 131)); + R2_GLOBALS._sound2.play(84); + Common::Point pt(350, 231); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 12: + // Really nothing + break; + case 13: + _actor17.postInit(); + R2_GLOBALS._scrollFollower = &_actor17; + + _actor11.setup(1100, 2, 1); + _actor11.setPosition(Common::Point(408, 121)); + + _actor10.setup(1100, 3, 5); + _actor10.setPosition(Common::Point(409, 121)); + + setAction(&_sequenceManager1, this, 1104, &_actor17, NULL); + break; + case 14: + setAction(&_sequenceManager1, this, 1100, &_actor11, &_actor10, NULL); + break; + case 15: + R2_GLOBALS._sceneManager.changeScene(1000); + break; + case 20: { + Common::Point pt(187, -13); + NpcMover *mover = new NpcMover(); + _actor1.addMover(mover, &pt, this); + } + break; + case 21: { + R2_GLOBALS._sound2.play(92); + _actor17.animate(ANIM_MODE_5, NULL); + Common::Point pt(187, 45); + NpcMover *mover = new NpcMover(); + _actor1.addMover(mover, &pt, this); + } + break; + case 22: + setAction(&_sequenceManager1, this, 1110, &_actor16, &R2_GLOBALS._player, NULL); + break; + case 23: + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(312, this); + R2_GLOBALS._player.setAction(&_sequenceManager1, this, 1119, &R2_GLOBALS._player, NULL); + break; + case 24: + if (!_stripManager._endHandler) + R2_GLOBALS._player.disableControl(); + break; + case 25: + R2_GLOBALS._player.disableControl(); + _stripManager._lookupList[9] = 1; + _stripManager._lookupList[10] = 1; + _stripManager._lookupList[11] = 1; + R2_GLOBALS._sound1.play(95); + setAction(&_sequenceManager1, this, 1111, &_actor17, &R2_GLOBALS._player, &_actor16, NULL); + break; + case 26: + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(302, this); + break; + case 27: + R2_GLOBALS._player.disableControl(); + setAction(&_sequenceManager1, this, 1120, &_actor16, &R2_GLOBALS._player, NULL); + break; + case 28: + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(303, this); + break; + case 51: + R2_GLOBALS.setFlag(53); + _actor17.setDetails(1100, 28, -1, -1, 3, (SceneItem *) NULL); + // No break on purpose + case 50: + // No break on purpose + case 29: + R2_GLOBALS._player.enableControl(CURSOR_USE); + break; + case 52: + R2_GLOBALS._sound1.play(98); + R2_GLOBALS.setFlag(52); + R2_GLOBALS._player.disableControl(); + _sceneMode = 1116; + if (R2_GLOBALS._player._characterIndex == 1) { + setAction(&_sequenceManager1, this, 1116, &R2_GLOBALS._player, NULL); + _actor16.setAction(&_sequenceManager2, NULL, 1123, &_actor16, NULL); + } else { + setAction(&_sequenceManager1, this, 1124, &R2_GLOBALS._player, NULL); + _actor16.setAction(&_sequenceManager2, NULL, 1117, &_actor16, NULL); + } + break; + case 53: + _sceneMode = 54; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + if (_field412 == 0) { + R2_GLOBALS.setFlag(55); + if (R2_GLOBALS.getFlag(55)) { + if (R2_GLOBALS._player._characterIndex == 1) + _stripManager.start(318, this); + else + _stripManager.start(323, this); + } else { + // This part is totally useless as flag 55 has been set right before the check + if (R2_GLOBALS._player._characterIndex == 1) + _stripManager.start(317, this); + else + _stripManager.start(322, this); + } + } else { + _stripManager.start3(_field412, this, _stripManager._lookupList); + } + break; + case 54: + if (_stripManager._field2E8 == 1) { + R2_GLOBALS._player.disableControl(); + _sceneMode = 1125; + setAction(&_sequenceManager1, this, 1125, &R2_GLOBALS._player, &_actor16, NULL); + } else + R2_GLOBALS._player.enableControl(CURSOR_TALK); + break; + case 55: + R2_GLOBALS._player.enableControl(CURSOR_TALK); + R2_GLOBALS._player._canWalk = false; + break; + case 99: + R2_GLOBALS._player._characterScene[1] = 300; + R2_GLOBALS._player._characterScene[2] = 300; + R2_GLOBALS._player._characterIndex = R2_QUINN; + R2_GLOBALS._sceneManager.changeScene(300); + break; + case 1112: + _sceneMode = 50; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start3(313, this, _stripManager._lookupList); + break; + case 1113: + _sceneMode = 52; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + R2_GLOBALS._sound1.play(96); + _stripManager.start3(316, this, _stripManager._lookupList); + break; + case 1114: + _sceneMode = 51; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start3(315, this, _stripManager._lookupList); + break; + case 1115: + _sceneMode = 50; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start3(314, this, _stripManager._lookupList); + break; + case 1116: + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + _stripManager._lookupList[9] = 1; + _stripManager._lookupList[10] = 1; + _stripManager._lookupList[11] = 1; + break; + case 1125: { + _sceneMode = 99; + R2_GLOBALS._sound2.play(100); + R2_GLOBALS._sound1.play(101); + Common::Point pt(187, -13); + NpcMover *mover = new NpcMover(); + _actor1.addMover(mover, &pt, this); + } + break; + default: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + break; + } +} + +void Scene1100::dispatch() { + if ((g_globals->_sceneObjects->contains(&_actor10)) && (_actor10._visage == 1102) && (_actor10._strip == 4) && (_actor10._frame == 1) && (_actor10._flags & OBJFLAG_HIDING)) { + if (_field414 == 1) { + _field414 = 2; + R2_GLOBALS._scenePalette.refresh(); + } + } else { + if (_field414 == 2) + R2_GLOBALS._scenePalette.refresh(); + _field414 = 1; + } + + Scene::dispatch(); + + if (R2_GLOBALS._player._bounds.contains(_actor13._position)) + _actor13._shade = 3; + else + _actor13._shade = 0; + + if (R2_GLOBALS._player._bounds.contains(_actor14._position)) + _actor14._shade = 3; + else + _actor14._shade = 0; + + if (R2_GLOBALS._player._bounds.contains(_actor15._position)) + _actor15._shade = 3; + else + _actor15._shade = 0; +} + +void Scene1100::saveCharacter(int characterIndex) { + if (R2_GLOBALS._player._characterIndex == 3) + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::saveCharacter(characterIndex); +} + +/*-------------------------------------------------------------------------- + * Scene 1200 - + * + *--------------------------------------------------------------------------*/ +Scene1200::Scene1200() { + _field412 = 0; + _field414 = 0; + _field416 = 0; + _field418 = 0; + _field41A = 0; + _field41C = 1; //CHECKME: Only if fixup_flag == 6?? +} + +void Scene1200::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_field414); + s.syncAsSint16LE(_field416); + s.syncAsSint16LE(_field418); + s.syncAsSint16LE(_field41A); + s.syncAsSint16LE(_field41C); +} + +Scene1200::Area1::Area1() { + _field20 = 0; +} + +void Scene1200::Area1::synchronize(Serializer &s) { + SceneArea::synchronize(s); + + s.syncAsByte(_field20); +} + +void Scene1200::Area1::Actor3::init(int state) { + _state = state; + + SceneActor::postInit(); + setup(1003, 1, 1); + fixPriority(255); + + switch (_state) { + case 1: + switch (R2_GLOBALS._v56AA6) { + case 1: + setFrame2(2); + setPosition(Common::Point(129, 101)); + break; + case 2: + setFrame2(3); + setPosition(Common::Point(135, 95)); + break; + default: + break; + } + case 2: + switch (R2_GLOBALS._v56AA7) { + case 1: + setFrame2(2); + setPosition(Common::Point(152, 101)); + break; + case 2: + setFrame2(3); + setPosition(Common::Point(158, 122)); + break; + case 3: + setFrame2(3); + setPosition(Common::Point(135, 122)); + break; + default: + break; + } + case 3: + switch (R2_GLOBALS._v56AA8) { + case 1: + setFrame2(3); + setPosition(Common::Point(158, 95)); + break; + case 2: + setFrame2(2); + setPosition(Common::Point(175, 101)); + break; + default: + break; + } + default: + break; + } + + setDetails(1200, 12, -1, -1, 2, (SceneItem *) NULL); +} + +bool Scene1200::Area1::Actor3::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._sound2.play(260); + switch (_state) { + case 1: + if (R2_GLOBALS._v56AA6 == 1) { + R2_GLOBALS._v56AA6 = 2; + setFrame2(3); + setPosition(Common::Point(135, 95)); + } else { + R2_GLOBALS._v56AA6 = 1; + setFrame2(2); + setPosition(Common::Point(129, 101)); + } + break; + case 2: + ++R2_GLOBALS._v56AA7; + if (R2_GLOBALS._v56AA7 == 4) + R2_GLOBALS._v56AA7 = 1; + + switch (R2_GLOBALS._v56AA7) { + case 1: + setFrame2(1); + setPosition(Common::Point(152, 101)); + break; + case 2: + setFrame2(3); + setPosition(Common::Point(158, 122)); + break; + case 3: + setFrame2(3); + setPosition(Common::Point(135, 122)); + break; + default: + break; + } + break; + case 3: + if (R2_GLOBALS._v56AA8 == 1) { + R2_GLOBALS._v56AA8 = 2; + setFrame2(2); + setPosition(Common::Point(175, 101)); + } else { + R2_GLOBALS._v56AA8 = 1; + setFrame2(3); + setPosition(Common::Point(158, 95)); + } + break; + default: + break; + } + + Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene; + scene->_field418 = 0; + + if ((R2_GLOBALS._v56AA6 == 1) && (R2_GLOBALS._v56AA7 == 1) && (R2_GLOBALS._v56AA8 == 1)) + scene->_field418 = 1; + else if ((R2_GLOBALS._v56AA6 == 2) && (R2_GLOBALS._v56AA7 == 1) && (R2_GLOBALS._v56AA8 == 1)) + scene->_field418 = 2; + else if ((R2_GLOBALS._v56AA6 == 2) && (R2_GLOBALS._v56AA7 == 1) && (R2_GLOBALS._v56AA8 == 2)) + scene->_field418 = 3; + else if ((R2_GLOBALS._v56AA6 == 2) && (R2_GLOBALS._v56AA7 == 3) && (R2_GLOBALS._v56AA8 == 1)) + scene->_field418 = 4; + + return true; +} + +void Scene1200::Area1::postInit(SceneObjectList *OwnerList) { + Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene; + + scene->_field41A = 1; + R2_GLOBALS._events.setCursor(CURSOR_USE); + proc12(1003, 1, 1, 100, 40); + proc13(1200, 11, -1, -1); + R2_GLOBALS._sound2.play(259); + _actor3.init(1); + _actor4.init(2); + _actor5.init(3); + + R2_GLOBALS._player._canWalk = false; +} + +void Scene1200::Area1::remove() { + Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene; + + scene->_field41A = 0; + warning("Unexpected _sceneAreas.remove() call"); +// scene->_sceneAreas.remove(&_actor3); +// scene->_sceneAreas.remove(&_actor4); +// scene->_sceneAreas.remove(&_actor5); + _actor3.remove(); + _actor4.remove(); + _actor5.remove(); + + // sub201EA + R2_GLOBALS._sceneItems.remove((SceneItem *)this); + _actor2.remove(); + SceneArea::remove(); + R2_GLOBALS._insetUp--; + // + + R2_GLOBALS._player._canWalk = true; +} + +void Scene1200::Area1::process(Event &event) { + if (_field20 != R2_GLOBALS._insetUp) + return; + + CursorType cursor = R2_GLOBALS._events.getCursor(); + + if (_actor2._bounds.contains(event.mousePos.x + g_globals->gfxManager()._bounds.left , event.mousePos.y)) { + if (cursor == _cursorNum) + warning("TODO: _cursorState = ???"); + R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState); + } else if (event.mousePos.y < 168) { + if (cursor != _cursorNum) { + _savedCursorNum = cursor; + warning("TODO: _cursorState = ???"); + R2_GLOBALS._events.setCursor(CURSOR_INVALID); + } + if (event.eventType == EVENT_BUTTON_DOWN) { + event.handled = true; + warning("TODO: _cursorState = ???"); + R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState); + remove(); + } + } +} + +void Scene1200::Area1::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { + Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene; + + _actor2.postInit(); + _actor2.setup(visage, stripFrameNum, frameNum); + _actor2.setPosition(Common::Point(posX, posY)); + _actor2.fixPriority(250); + _cursorNum = CURSOR_INVALID; + scene->_sceneAreas.push_front(this); + ++R2_GLOBALS._insetUp; + _field20 = R2_GLOBALS._insetUp; +} + +void Scene1200::Area1::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { + _actor2.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL); +} + +void Scene1200::postInit(SceneObjectList *OwnerList) { + Rect tmpRect; + + loadScene(1200); + SceneExt::postInit(); + + if (R2_GLOBALS._sceneManager._previousScene < 3200) + R2_GLOBALS._sound1.play(257); + + _field412 = 1; + _field414 = 0; + _field416 = 0; + _field418 = 0; + _field41A = 0; + _field41C = 0; + + if ((R2_GLOBALS._v56AA6 == 1) && (R2_GLOBALS._v56AA7 == 1) && (R2_GLOBALS._v56AA8 == 1)) + _field418 = 1; + else if ((R2_GLOBALS._v56AA6 == 2) && (R2_GLOBALS._v56AA7 == 1) && (R2_GLOBALS._v56AA8 == 1)) + _field418 = 2; + else if ((R2_GLOBALS._v56AA6 == 2) && (R2_GLOBALS._v56AA7 == 1) && (R2_GLOBALS._v56AA8 == 2)) + _field418 = 3; + else if ((R2_GLOBALS._v56AA6 == 2) && (R2_GLOBALS._v56AA7 == 3) && (R2_GLOBALS._v56AA8 == 1)) + _field418 = 4; + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.setup(3156, 1, 6); + R2_GLOBALS._player.setPosition(Common::Point(160, 70)); + R2_GLOBALS._player._numFrames = 10; + R2_GLOBALS._player._oldCharacterScene[3] = 1200; + + _actor1.postInit(); + _actor1.hide(); + + tmpRect.set(110, 20, 210, 120); + _object1.sub9EDE8(tmpRect); + + _object1.sub51AE9(1); + _object1.sub51AFD(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); + warning("int unk = set_pane_p(_paneNumber);"); + _object1.sub51B02(); + warning("set_pane_p(unk);"); + + R2_GLOBALS._player.enableControl(); + _item1.setDetails(Rect(0, 0, 320, 200), 1200, 0, 1, 2, 1, NULL); +} + +void Scene1200::signal() { + switch (_sceneMode++) { + case 1: + // No break on purpose + case 1200: + // No break on purpose + case 1201: + // No break on purpose + case 1202: + // No break on purpose + case 1203: + R2_GLOBALS._player.enableControl(); + warning("_eventManager.waitEvent()"); + _sceneMode = 2; + break; + case 10: + _field416 = 1; + _field414 = 6; + R2_GLOBALS._player._numFrames = 5; + R2_GLOBALS._player.setStrip(1); + R2_GLOBALS._player.setFrame(5); + R2_GLOBALS._player.animate(ANIM_MODE_6, this); + break; + case 11: + // No break on purpose + case 21: + // No break on purpose + case 31: + // No break on purpose + case 41: + _field416 = 0; + break; + case 12: + _field414 = 14; + R2_GLOBALS._player._numFrames = 10; + R2_GLOBALS._player.setup(3155, 1, 4); + R2_GLOBALS._player.setPosition(Common::Point(160, 70)); + R2_GLOBALS._player.animate(ANIM_MODE_2, NULL); + break; + case 13: + // No break on purpose + case 16: + // No break on purpose + case 23: + // No break on purpose + case 26: + // No break on purpose + case 33: + // No break on purpose + case 36: + // No break on purpose + case 43: + // No break on purpose + case 46: + R2_GLOBALS._player.setFrame(4); + _sceneMode = 1; + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + break; + case 15: + // No break on purpose + case 25: + // No break on purpose + case 35: + // No break on purpose + case 45: + _field414 = 20; + R2_GLOBALS._player.animate(ANIM_MODE_2, NULL); + break; + case 20: + _field416 = 1; + _field414 = 6; + R2_GLOBALS._player._numFrames = 5; + R2_GLOBALS._player.setStrip(2); + R2_GLOBALS._player.setFrame(5); + R2_GLOBALS._player.animate(ANIM_MODE_6, this); + break; + case 22: + _field414 = 14; + R2_GLOBALS._player._numFrames = 10; + R2_GLOBALS._player.setup(3155, 2, 4); + R2_GLOBALS._player.setPosition(Common::Point(160, 70)); + R2_GLOBALS._player.animate(ANIM_MODE_2, NULL); + break; + case 30: + _field416 = 1; + _field414 = 6; + R2_GLOBALS._player._numFrames = 5; + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.setFrame(5); + R2_GLOBALS._player.animate(ANIM_MODE_6, this); + break; + case 32: + _field414 = 14; + R2_GLOBALS._player._numFrames = 10; + R2_GLOBALS._player.setup(3155, 3, 4); + R2_GLOBALS._player.setPosition(Common::Point(160, 70)); + R2_GLOBALS._player.animate(ANIM_MODE_2, NULL); + break; + case 40: + _field416 = 1; + _field414 = 6; + R2_GLOBALS._player._numFrames = 5; + R2_GLOBALS._player.setStrip(4); + R2_GLOBALS._player.setFrame(5); + R2_GLOBALS._player.animate(ANIM_MODE_6, this); + break; + case 42: + _field414 = 14; + R2_GLOBALS._player._numFrames = 10; + R2_GLOBALS._player.setup(3155, 4, 4); + R2_GLOBALS._player.setPosition(Common::Point(160, 70)); + R2_GLOBALS._player.animate(ANIM_MODE_2, NULL); + break; + case 50: + // No break on purpose + case 55: + // No break on purpose + case 60: + R2_GLOBALS._player.setup(3156, 5, 1); + R2_GLOBALS._player._numFrames = 5; + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 51: + // No break on purpose + case 56: + // No break on purpose + case 117: + R2_GLOBALS._player.setup(3157, 1, 1); + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 52: + // No break on purpose + case 82: + // No break on purpose + case 118: + R2_GLOBALS._player.setup(3156, 3, 6); + _sceneMode = 1; + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + break; + case 57: + // No break on purpose + case 91: + // No break on purpose + case 96: + R2_GLOBALS._player.setup(3157, 2, 1); + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 58: + // No break on purpose + case 92: + // No break on purpose + case 122: + R2_GLOBALS._player.setup(3156, 2, 6); + _sceneMode = 1; + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + break; + case 61: + R2_GLOBALS._player.setup(3157, 4, 5); + R2_GLOBALS._player.animate(ANIM_MODE_6, this); + break; + case 62: + // No break on purpose + case 72: + // No break on purpose + case 98: + R2_GLOBALS._player.setup(3156, 4, 6); + _sceneMode = 1; + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + break; + case 70: + // No break on purpose + case 75: + // No break on purpose + case 80: + R2_GLOBALS._player.setup(3156, 6, 1); + R2_GLOBALS._player._numFrames = 5; + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 71: + // No break on purpose + case 76: + // No break on purpose + case 97: + R2_GLOBALS._player.setup(3157, 3, 1); + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 77: + // No break on purpose + case 111: + // No break on purpose + case 116: + R2_GLOBALS._player.setup(3157, 3, 1); + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 78: + // No break on purpose + case 102: + // No break on purpose + case 112: + R2_GLOBALS._player.setup(3156, 1, 6); + _sceneMode = 1; + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + break; + case 81: + R2_GLOBALS._player.setup(3157, 2, 5); + R2_GLOBALS._player.animate(ANIM_MODE_6, this); + break; + case 90: + // No break on purpose + case 95: + // No break on purpose + case 100: + R2_GLOBALS._player.setup(3156, 7, 1); + R2_GLOBALS._player._numFrames = 5; + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 101: + R2_GLOBALS._player.setup(3157, 1, 5); + R2_GLOBALS._player.animate(ANIM_MODE_6, this); + break; + case 110: + // No break on purpose + case 115: + // No break on purpose + case 120: + R2_GLOBALS._player.setup(3156, 8, 1); + R2_GLOBALS._player._numFrames = 5; + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 121: + R2_GLOBALS._player.setup(3157, 3, 5); + R2_GLOBALS._player.animate(ANIM_MODE_6, this); + break; + default: + warning("_eventManager.waitEvent()"); + _sceneMode = 2; + break; + } +} + +void Scene1200::process(Event &event) { + if (_field414 != 0) + return; + + Scene::process(event); + + if (!R2_GLOBALS._player._canWalk) + return; + + if (event.eventType == EVENT_BUTTON_DOWN) { + _object1.sub9EE22(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); + int unk = _object1.sub51AF8(event.mousePos); + switch (R2_GLOBALS._events.getCursor()) { + case CURSOR_ARROW: + event.handled = true; + if ((event.mousePos.x > 179) && (event.mousePos.x < 210) && (event.mousePos.y > 50) && (event.mousePos.y < 89)) + sub9DAD6(1); + + if ((event.mousePos.x > 109) && (event.mousePos.x < 140) && (event.mousePos.y > 50) && (event.mousePos.y < 89)) + sub9DAD6(2); + + if ((event.mousePos.x > 140) && (event.mousePos.x < 179) && (event.mousePos.y > 89) && (event.mousePos.y < 120)) + sub9DAD6(3); + + if ((event.mousePos.x > 140) && (event.mousePos.x < 179) && (event.mousePos.y > 19) && (event.mousePos.y < 50)) + sub9DAD6(4); + break; + case CURSOR_USE: + if (unk > 36) { + if ( ((R2_GLOBALS._v56AA2 == 3) && (R2_GLOBALS._v56AA4 == 33)) + || ((R2_GLOBALS._v56AA2 == 7) && (R2_GLOBALS._v56AA4 == 33)) + || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 41)) + || ((R2_GLOBALS._v56AA2 == 5) && (R2_GLOBALS._v56AA4 == 5)) + || ((R2_GLOBALS._v56AA2 == 13) && (R2_GLOBALS._v56AA4 == 21)) + || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 21)) + || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 5)) + || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 9)) + || ((R2_GLOBALS._v56AA2 == 29) && (R2_GLOBALS._v56AA4 == 17)) + || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 17)) + || ((R2_GLOBALS._v56AA2 == 35) && (R2_GLOBALS._v56AA4 == 17)) + || ((R2_GLOBALS._v56AA2 == 41) && (R2_GLOBALS._v56AA4 == 21)) ) { + _area1.postInit(); + event.handled = true; + } + } + + if ((unk == 1) || (unk == 4) || (unk == 11) || (unk == 14)) { + if ( ((R2_GLOBALS._v56AA2 == 3) && (R2_GLOBALS._v56AA4 == 9)) + || ((R2_GLOBALS._v56AA2 == 11) && (R2_GLOBALS._v56AA4 == 27)) + || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 7)) + || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 27)) + || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 33)) + || (R2_GLOBALS._v56AA2 == 33) ) { + switch (R2_GLOBALS._v56AA2) { + case 3: + R2_GLOBALS._sceneManager.changeScene(3150); + break; + case 33: + if (R2_GLOBALS._v56AA1 >= 4) + R2_GLOBALS._sceneManager.changeScene(3250); + else + SceneItem::display(1200, 6, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + default: + SceneItem::display(1200, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + } + event.handled = true; + } + } + break; + case CURSOR_LOOK: + if ((unk == 1) || (unk == 4) || (unk == 11) || (unk == 14)) { + event.handled = true; + switch (R2_GLOBALS._v56AA2) { + case 3: + SceneItem::display(1200, 8, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + case 9: + R2_GLOBALS._sceneManager.changeScene(3240); + break; + case 11: + if (R2_GLOBALS._v56AA4 == 27) + R2_GLOBALS._sceneManager.changeScene(3210); + else + SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + case 17: + switch (R2_GLOBALS._v56AA4) { + case 5: + R2_GLOBALS._sceneManager.changeScene(3230); + break; + case 21: + R2_GLOBALS._sceneManager.changeScene(3220); + break; + case 33: + R2_GLOBALS._sceneManager.changeScene(3200); + break; + default: + SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + } + case 33: + R2_GLOBALS._sceneManager.changeScene(3245); + break; + default: + SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + } + } + if (unk > 36) { + event.handled = true; + SceneItem::display(1200, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + break; + case CURSOR_TALK: + event.handled = true; + break; + default: + return; + } + } else if (event.eventType == EVENT_KEYPRESS) { + if (_field414 == 0) { + event.handled = false; + return; + } + + switch (event.kbd.keycode) { + case Common::KEYCODE_1: + warning("FIXME: keycode = 0x4800"); + sub9DAD6(4); + break; + case Common::KEYCODE_2: + warning("FIXME: keycode = 0x4B00"); + sub9DAD6(2); + break; + case Common::KEYCODE_3: + warning("FIXME: keycode = 0x4D00"); + sub9DAD6(1); + break; + case Common::KEYCODE_4: + warning("FIXME: keycode = 0x5000"); + sub9DAD6(3); + break; + default: + event.handled = false; + return; + break; + } + } else { + return; + } +} + +void Scene1200::dispatch() { + Rect tmpRect; + Scene::dispatch(); + if (_field41C != 0) { + _object1.sub51AFD(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); + warning("int unk = set_pane_p(_paneNumber);"); + _object1.sub51B02(); + warning("_gfxManager.sub294AC(unk);"); + warning("tmpRect.sub14DF3();"); + _field41C = 0; + } + + if (_field414 != 0) { + tmpRect.set(110, 20, 210, 120); + _field414--; + switch (_field412 - 1) { + case 0: + R2_GLOBALS._v56AA2 += 2; + break; + case 1: + R2_GLOBALS._v56AA2 -= 2; + break; + case 2: + R2_GLOBALS._v56AA4 += 2; + break; + case 3: + R2_GLOBALS._v56AA4 -= 2; + break; + default: + break; + } + _object1.sub51AFD(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); + warning("int unk = set_pane_p(_paneNumber);"); + _object1.sub51B02(); + warning("_gfxManager.sub294AC(unk);"); + warning("tmpRect.sub14DF3();"); + + if (_field416 != 0) { + switch(_field412 - 1) { + case 0: + R2_GLOBALS._player.setPosition(Common::Point(R2_GLOBALS._player._position.x - 2, R2_GLOBALS._player._position.y)); + break; + case 1: + R2_GLOBALS._player.setPosition(Common::Point(R2_GLOBALS._player._position.x + 2, R2_GLOBALS._player._position.y)); + break; + case 2: + R2_GLOBALS._player.setPosition(Common::Point(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y - 2)); + break; + case 3: + R2_GLOBALS._player.setPosition(Common::Point(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y + 2)); + break; + default: + break; + } + } + if (_field414 == 0) { + if (_field416 == 0) + R2_GLOBALS._player.animate(ANIM_MODE_NONE, NULL); + signal(); + } + } +} + +void Scene1200::saveCharacter(int characterIndex) { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::saveCharacter(characterIndex); +} + +/*-------------------------------------------------------------------------- + * Scene 1337 - Card game + * + *--------------------------------------------------------------------------*/ + +Scene1337::unkObj1337sub1::unkObj1337sub1() { + _field34 = 0; + _field36 = Common::Point(0, 0); +} + +void Scene1337::unkObj1337sub1::synchronize(Serializer &s) { + warning("STUBBED: unkObj1337sub1::synchronize()"); +} + +Scene1337::unkObj1337_1::unkObj1337_1() { + _fieldB94 = Common::Point(0, 0); + _fieldB98 = Common::Point(0, 0); + _fieldB9C = Common::Point(0, 0); + _fieldBA0 = Common::Point(0, 0); + _fieldBA4 = 0; +} + +void Scene1337::unkObj1337_1::synchronize(Serializer &s) { + warning("STUBBED: unkObj1337_1::synchronize()"); +} + +Scene1337::Scene1337() { + _autoplay = false; + _field3E24 = 0; + _field3E26 = 0; + + for (int i = 0; i < 100; i++) + _field3E28[i] = 0; + + _field423C = 0; + _field423E = 0; + _field4240 = 0; + _field4242 = 0; + _field4244 = 0; + _field4246 = 0; + _field4248 = 0; + _field424A = 0; + _field424C = 0; + _field424E = 0; +} + +void Scene1337::synchronize(Serializer &s) { + warning("STUBBED: Scene1337::synchronize()"); +} + +void Scene1337::Action1337::subD18B5(int resNum, int stripNum, int frameNum) { + warning("STUBBED: Action1337::subD18B5()"); +} + +void Scene1337::Action1337::skipFrames(int32 skipCount) { + uint32 firstFrameNumber = g_globals->_events.getFrameNumber(); + uint32 tmpFrameNumber = firstFrameNumber; + + while (tmpFrameNumber < firstFrameNumber + skipCount) + tmpFrameNumber = g_globals->_events.getFrameNumber(); + + warning("_eventManager.waitEvent(-1)"); +} + +void Scene1337::Action1::signal() { + Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 1: { + scene->actionDisplay(1331, 6, 159, 10, 1, 200, 0, 7, 0, 154, 154); + R2_GLOBALS._sceneObjects->draw(); + scene->actionDisplay(1331, 7, 159, 10, 1, 200, 0, 7, 0, 154, 154); + scene->actionDisplay(1331, 8, 159, 10, 1, 200, 0, 7, 0, 154, 154); + + scene->_arrunkObj1337[1]._arr2[0]._field34 = 2; + scene->_arrunkObj1337[1]._arr2[0]._object1.postInit(); + scene->_arrunkObj1337[1]._arr2[0]._object1.setVisage(1332); + scene->_arrunkObj1337[1]._arr2[0]._object1.setPosition(scene->_arrunkObj1337[1]._arr2[0]._field36, 0); + scene->_arrunkObj1337[1]._arr2[0]._object1.setStrip(2); + scene->_arrunkObj1337[1]._arr2[0]._object1.setFrame(scene->_arrunkObj1337[1]._arr2[0]._field34); + scene->_arrunkObj1337[1]._arr2[0]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[1]._arr2[0]); + + scene->_arrunkObj1337[1]._arr2[1]._field34 = 3; + scene->_arrunkObj1337[1]._arr2[1]._object1.postInit(); + scene->_arrunkObj1337[1]._arr2[1]._object1.setVisage(1332); + scene->_arrunkObj1337[1]._arr2[1]._object1.setPosition(scene->_arrunkObj1337[1]._arr2[1]._field36, 0); + scene->_arrunkObj1337[1]._arr2[1]._object1.setStrip(2); + scene->_arrunkObj1337[1]._arr2[1]._object1.setFrame(scene->_arrunkObj1337[1]._arr2[1]._field34); + scene->_arrunkObj1337[1]._arr2[1]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[1]._arr2[1]); + + scene->_arrunkObj1337[2]._arr2[0]._field34 = 4; + scene->_arrunkObj1337[2]._arr2[0]._object1.postInit(); + scene->_arrunkObj1337[2]._arr2[0]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr2[0]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[0]._field36, 0); + scene->_arrunkObj1337[2]._arr2[0]._object1.setStrip(2); + scene->_arrunkObj1337[2]._arr2[0]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[0]._field34); + scene->_arrunkObj1337[2]._arr2[0]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[0]); + + scene->_arrunkObj1337[3]._arr2[0]._field34 = 5; + scene->_arrunkObj1337[3]._arr2[0]._object1.postInit(); + scene->_arrunkObj1337[3]._arr2[0]._object1.setVisage(1332); + scene->_arrunkObj1337[3]._arr2[0]._object1.setPosition(scene->_arrunkObj1337[3]._arr2[0]._field36, 0); + scene->_arrunkObj1337[3]._arr2[0]._object1.setStrip(2); + scene->_arrunkObj1337[3]._arr2[0]._object1.setFrame(scene->_arrunkObj1337[3]._arr2[0]._field34); + scene->_arrunkObj1337[3]._arr2[0]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[3]._arr2[0]); + + scene->_arrunkObj1337[3]._arr2[1]._field34 = 6; + scene->_arrunkObj1337[3]._arr2[1]._object1.postInit(); + scene->_arrunkObj1337[3]._arr2[1]._object1.setVisage(1332); + scene->_arrunkObj1337[3]._arr2[1]._object1.setPosition(scene->_arrunkObj1337[3]._arr2[1]._field36, 0); + scene->_arrunkObj1337[3]._arr2[1]._object1.setStrip(2); + scene->_arrunkObj1337[3]._arr2[1]._object1.setFrame(scene->_arrunkObj1337[3]._arr2[1]._field34); + scene->_arrunkObj1337[3]._arr2[1]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[3]._arr2[1]); + + scene->_arrunkObj1337[3]._arr2[2]._field34 = 7; + scene->_arrunkObj1337[3]._arr2[2]._object1.postInit(); + scene->_arrunkObj1337[3]._arr2[2]._object1.setVisage(1332); + scene->_arrunkObj1337[3]._arr2[2]._object1.setPosition(scene->_arrunkObj1337[3]._arr2[2]._field36, 0); + scene->_arrunkObj1337[3]._arr2[2]._object1.setStrip(2); + scene->_arrunkObj1337[3]._arr2[2]._object1.setFrame(scene->_arrunkObj1337[3]._arr2[2]._field34); + scene->_arrunkObj1337[3]._arr2[2]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[3]._arr2[2]); + + scene->_arrunkObj1337[0]._arr2[0]._field34 = 8; + scene->_arrunkObj1337[0]._arr2[0]._object1.postInit(); + scene->_arrunkObj1337[0]._arr2[0]._object1.setVisage(1332); + scene->_arrunkObj1337[0]._arr2[0]._object1.setPosition(scene->_arrunkObj1337[0]._arr2[0]._field36, 0); + scene->_arrunkObj1337[0]._arr2[0]._object1.setStrip(2); + scene->_arrunkObj1337[0]._arr2[0]._object1.setFrame(scene->_arrunkObj1337[0]._arr2[0]._field34); + scene->_arrunkObj1337[0]._arr2[0]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[0]._arr2[0]); + + scene->_arrunkObj1337[0]._arr2[1]._field34 = 9; + scene->_arrunkObj1337[0]._arr2[1]._object1.postInit(); + scene->_arrunkObj1337[0]._arr2[1]._object1.setVisage(1332); + scene->_arrunkObj1337[0]._arr2[1]._object1.setPosition(scene->_arrunkObj1337[0]._arr2[1]._field36, 0); + scene->_arrunkObj1337[0]._arr2[1]._object1.setStrip(2); + scene->_arrunkObj1337[0]._arr2[1]._object1.setFrame(scene->_arrunkObj1337[0]._arr2[1]._field34); + scene->_arrunkObj1337[0]._arr2[1]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[0]._arr2[1]); + + R2_GLOBALS._sceneObjects->draw(); + + skipFrames(60); + scene->actionDisplay(1331, 9, 159, 10, 1, 200, 0, 7, 0, 154, 154); + + scene->_arrunkObj1337[2]._arr2[1]._field34 = 2; + scene->_arrunkObj1337[2]._arr2[1]._object1.postInit(); + scene->_arrunkObj1337[2]._arr2[1]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr2[1]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[1]._field36, 0); + scene->_arrunkObj1337[2]._arr2[1]._object1.setStrip(2); + scene->_arrunkObj1337[2]._arr2[1]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[1]._field34); + scene->_arrunkObj1337[2]._arr2[1]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[1]); + + scene->_arrunkObj1337[2]._arr2[2]._field34 = 3; + scene->_arrunkObj1337[2]._arr2[2]._object1.postInit(); + scene->_arrunkObj1337[2]._arr2[2]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr2[2]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[2]._field36, 0); + scene->_arrunkObj1337[2]._arr2[2]._object1.setStrip(2); + scene->_arrunkObj1337[2]._arr2[2]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[2]._field34); + scene->_arrunkObj1337[2]._arr2[2]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[2]); + + scene->_arrunkObj1337[2]._arr2[3]._field34 = 5; + scene->_arrunkObj1337[2]._arr2[3]._object1.postInit(); + scene->_arrunkObj1337[2]._arr2[3]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr2[3]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[3]._field36, 0); + scene->_arrunkObj1337[2]._arr2[3]._object1.setStrip(2); + scene->_arrunkObj1337[2]._arr2[3]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[3]._field34); + scene->_arrunkObj1337[2]._arr2[3]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[3]); + + scene->_arrunkObj1337[2]._arr2[4]._field34 = 6; + scene->_arrunkObj1337[2]._arr2[4]._object1.postInit(); + scene->_arrunkObj1337[2]._arr2[4]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr2[4]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[4]._field36, 0); + scene->_arrunkObj1337[2]._arr2[4]._object1.setStrip(2); + scene->_arrunkObj1337[2]._arr2[4]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[4]._field34); + scene->_arrunkObj1337[2]._arr2[4]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[4]); + + scene->_arrunkObj1337[2]._arr2[5]._field34 = 7; + scene->_arrunkObj1337[2]._arr2[5]._object1.postInit(); + scene->_arrunkObj1337[2]._arr2[5]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr2[5]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[5]._field36, 0); + scene->_arrunkObj1337[2]._arr2[5]._object1.setStrip(2); + scene->_arrunkObj1337[2]._arr2[5]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[5]._field34); + scene->_arrunkObj1337[2]._arr2[5]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[5]); + + scene->_arrunkObj1337[2]._arr2[6]._field34 = 8; + scene->_arrunkObj1337[2]._arr2[6]._object1.postInit(); + scene->_arrunkObj1337[2]._arr2[6]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr2[6]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[6]._field36, 0); + scene->_arrunkObj1337[2]._arr2[6]._object1.setStrip(2); + scene->_arrunkObj1337[2]._arr2[6]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[6]._field34); + scene->_arrunkObj1337[2]._arr2[6]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[6]); + + scene->_arrunkObj1337[2]._arr2[7]._field34 = 9; + scene->_arrunkObj1337[2]._arr2[7]._object1.postInit(); + scene->_arrunkObj1337[2]._arr2[7]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr2[7]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[7]._field36, 0); + scene->_arrunkObj1337[2]._arr2[7]._object1.setStrip(2); + scene->_arrunkObj1337[2]._arr2[7]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[7]._field34); + scene->_arrunkObj1337[2]._arr2[7]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[7]); + + scene->_aSound1.play(62); + + R2_GLOBALS._sceneObjects->draw(); + + skipFrames(120); + scene->_arrunkObj1337[2]._arr2[0]._object1.remove(); + scene->_arrunkObj1337[2]._arr2[1]._object1.remove(); + scene->_arrunkObj1337[2]._arr2[2]._object1.remove(); + scene->_arrunkObj1337[2]._arr2[3]._object1.remove(); + scene->_arrunkObj1337[2]._arr2[4]._object1.remove(); + scene->_arrunkObj1337[2]._arr2[5]._object1.remove(); + scene->_arrunkObj1337[2]._arr2[6]._object1.remove(); + scene->_arrunkObj1337[2]._arr2[7]._object1.remove(); + + scene->_arrunkObj1337[1]._arr2[0]._object1.remove(); + scene->_arrunkObj1337[1]._arr2[1]._object1.remove(); + + scene->_arrunkObj1337[3]._arr2[0]._object1.remove(); + scene->_arrunkObj1337[3]._arr2[1]._object1.remove(); + scene->_arrunkObj1337[3]._arr2[2]._object1.remove(); + + scene->_arrunkObj1337[0]._arr2[0]._object1.remove(); + scene->_arrunkObj1337[0]._arr2[1]._object1.remove(); + + scene->_background2.setup2(1332, 5, 1, 165, 95, 110, 1); + + scene->_arrunkObj1337[1]._arr1[0]._object1.postInit(); + scene->_arrunkObj1337[1]._arr1[0]._object1.setVisage(1332); + scene->_arrunkObj1337[1]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[1]._arr1[0]._field36, 0); + scene->_arrunkObj1337[1]._arr1[0]._object1.setStrip(1); + scene->_arrunkObj1337[1]._arr1[0]._object1.setFrame(4); + scene->_arrunkObj1337[1]._arr1[0]._object1.fixPriority(170); + + scene->_arrunkObj1337[1]._arr1[1]._object1.postInit(); + scene->_arrunkObj1337[1]._arr1[1]._object1.setVisage(1332); + scene->_arrunkObj1337[1]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[1]._arr1[1]._field36, 0); + scene->_arrunkObj1337[1]._arr1[1]._object1.setStrip(1); + scene->_arrunkObj1337[1]._arr1[1]._object1.setFrame(4); + scene->_arrunkObj1337[1]._arr1[1]._object1.fixPriority(170); + + scene->_arrunkObj1337[1]._arr1[2]._object1.postInit(); + scene->_arrunkObj1337[1]._arr1[2]._object1.setVisage(1332); + scene->_arrunkObj1337[1]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[1]._arr1[2]._field36, 0); + scene->_arrunkObj1337[1]._arr1[2]._object1.setStrip(1); + scene->_arrunkObj1337[1]._arr1[2]._object1.setFrame(4); + scene->_arrunkObj1337[1]._arr1[2]._object1.fixPriority(170); + + scene->_arrunkObj1337[2]._arr1[0]._field34 = 30; + scene->_arrunkObj1337[2]._arr1[0]._object1.postInit(); + scene->_arrunkObj1337[2]._arr1[0]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[2]._arr1[0]._field36, 0); + scene->_arrunkObj1337[2]._arr1[0]._object1.setStrip(1); + scene->_arrunkObj1337[2]._arr1[0]._object1.setFrame(2); + scene->_arrunkObj1337[2]._arr1[0]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr1[0]); + + scene->_arrunkObj1337[2]._arr1[1]._field34 = 16; + scene->_arrunkObj1337[2]._arr1[1]._object1.postInit(); + scene->_arrunkObj1337[2]._arr1[1]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[2]._arr1[1]._field36, 0); + scene->_arrunkObj1337[2]._arr1[1]._object1.setStrip(1); + scene->_arrunkObj1337[2]._arr1[1]._object1.setFrame(2); + scene->_arrunkObj1337[2]._arr1[1]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr1[1]); + + scene->_arrunkObj1337[2]._arr1[2]._field34 = 1; + scene->_arrunkObj1337[2]._arr1[2]._object1.postInit(); + scene->_arrunkObj1337[2]._arr1[2]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[2]._arr1[2]._field36, 0); + scene->_arrunkObj1337[2]._arr1[2]._object1.setStrip(1); + scene->_arrunkObj1337[2]._arr1[2]._object1.setFrame(2); + scene->_arrunkObj1337[2]._arr1[2]._object1.fixPriority(170); + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr1[2]); + + scene->_arrunkObj1337[3]._arr1[0]._object1.postInit(); + scene->_arrunkObj1337[3]._arr1[0]._object1.setVisage(1332); + scene->_arrunkObj1337[3]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[3]._arr1[0]._field36, 0); + scene->_arrunkObj1337[3]._arr1[0]._object1.setStrip(1); + scene->_arrunkObj1337[3]._arr1[0]._object1.setFrame(3); + scene->_arrunkObj1337[3]._arr1[0]._object1.fixPriority(170); + + scene->_arrunkObj1337[3]._arr1[1]._object1.postInit(); + scene->_arrunkObj1337[3]._arr1[1]._object1.setVisage(1332); + scene->_arrunkObj1337[3]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[3]._arr1[1]._field36, 0); + scene->_arrunkObj1337[3]._arr1[1]._object1.setStrip(1); + scene->_arrunkObj1337[3]._arr1[1]._object1.setFrame(3); + scene->_arrunkObj1337[3]._arr1[1]._object1.fixPriority(170); + + scene->_arrunkObj1337[3]._arr1[2]._object1.postInit(); + scene->_arrunkObj1337[3]._arr1[2]._object1.setVisage(1332); + scene->_arrunkObj1337[3]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[3]._arr1[2]._field36, 0); + scene->_arrunkObj1337[3]._arr1[2]._object1.setStrip(1); + scene->_arrunkObj1337[3]._arr1[2]._object1.setFrame(3); + scene->_arrunkObj1337[3]._arr1[2]._object1.fixPriority(170); + + scene->_arrunkObj1337[0]._arr1[0]._object1.postInit(); + scene->_arrunkObj1337[0]._arr1[0]._object1.setVisage(1332); + scene->_arrunkObj1337[0]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[0]._arr1[0]._field36, 0); + scene->_arrunkObj1337[0]._arr1[0]._object1.setStrip(1); + scene->_arrunkObj1337[0]._arr1[0]._object1.setFrame(2); + scene->_arrunkObj1337[0]._arr1[0]._object1.fixPriority(170); + + scene->_arrunkObj1337[0]._arr1[1]._object1.postInit(); + scene->_arrunkObj1337[0]._arr1[1]._object1.setVisage(1332); + scene->_arrunkObj1337[0]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[0]._arr1[1]._field36, 0); + scene->_arrunkObj1337[0]._arr1[1]._object1.setStrip(1); + scene->_arrunkObj1337[0]._arr1[1]._object1.setFrame(2); + scene->_arrunkObj1337[0]._arr1[1]._object1.fixPriority(170); + + scene->_arrunkObj1337[0]._arr1[2]._object1.postInit(); + scene->_arrunkObj1337[0]._arr1[2]._object1.setVisage(1332); + scene->_arrunkObj1337[0]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[0]._arr1[2]._field36, 0); + scene->_arrunkObj1337[0]._arr1[2]._object1.setStrip(1); + scene->_arrunkObj1337[0]._arr1[2]._object1.setFrame(2); + scene->_arrunkObj1337[0]._arr1[2]._object1.fixPriority(170); + + R2_GLOBALS._sceneObjects->draw(); + + scene->actionDisplay(1331, 10, 159, 10, 1, 200, 0, 7, 0, 154, 154); + scene->_item2._object1.setPosition(Common::Point(162, 95), 0); + scene->_item2._object1.show(); + scene->_aSound2.play(61); + + Common::Point pt(91, 174); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &pt, this); + } + break; + case 2: { + scene->_arrunkObj1337[2]._arr1[3]._field34 = 2; + scene->_arrunkObj1337[2]._arr1[3]._object1.postInit(); + scene->_arrunkObj1337[2]._arr1[3]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr1[3]._object1.setPosition(scene->_arrunkObj1337[2]._arr1[3]._field36, 0); + scene->_arrunkObj1337[2]._arr1[3]._object1.setStrip(1); + scene->_arrunkObj1337[2]._arr1[3]._object1.setFrame(2); + scene->_arrunkObj1337[2]._arr1[3]._object1.fixPriority(170); + + scene->_item2._object1.hide(); + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr1[3]); + + R2_GLOBALS._sceneObjects->draw(); + + skipFrames(60); + scene->actionDisplay(1331, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154); + scene->actionDisplay(1331, 12, 159, 10, 1, 200, 0, 7, 0, 154, 154); + + scene->_arrunkObj1337[2]._arr2[1]._field34 = 1; + scene->_arrunkObj1337[2]._arr2[1]._object1.postInit(); + scene->_arrunkObj1337[2]._arr2[1]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr2[1]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[1]._field36, 0); + scene->_arrunkObj1337[2]._arr2[1]._object1.hide(); + + scene->_item2._object1.setStrip(scene->_arrunkObj1337[2]._arr1[2]._object1._strip); + scene->_item2._object1.setFrame(scene->_arrunkObj1337[2]._arr1[2]._object1._frame); + scene->_item2._object1.animate(ANIM_MODE_NONE, NULL); + + scene->_arrunkObj1337[2]._arr1[2]._field34 = 0; + scene->_arrunkObj1337[2]._arr1[2]._object1.remove(); + + scene->_item2._object1.setPosition(scene->_arrunkObj1337[2]._arr1[2]._field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[2]._arr2[1]._field36, this); + } + break; + case 3: { + scene->_item2._object1.hide(); + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[1]); + scene->_aSound1.play(59); + + R2_GLOBALS._sceneObjects->draw(); + + skipFrames(60); + scene->actionDisplay(1331, 13, 159, 10, 1, 200, 0, 7, 0, 154, 154); + + scene->_arrunkObj1337[2]._arr2[1]._field34 = scene->_arrunkObj1337[2]._arr1[3]._field34; + + scene->_item2._object1.setStrip(scene->_arrunkObj1337[2]._arr1[3]._object1._strip); + scene->_item2._object1.setFrame(scene->_arrunkObj1337[2]._arr1[3]._object1._frame); + + scene->_arrunkObj1337[2]._arr1[3]._field34 = 0; + scene->_arrunkObj1337[2]._arr1[3]._object1.remove(); + + scene->_item2._object1.setPosition(scene->_arrunkObj1337[2]._arr1[3]._field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[2]._arr2[1]._field36, this); + } + break; + case 4: { + scene->_item2._object1.hide(); + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[1]); + scene->_aSound1.play(59); + + scene->_item7._field34 = 1; + scene->_item7._object1.hide(); + + scene->_item2._object1.setStrip(5); + scene->_item2._object1.setFrame(1); + scene->_item2._object1.animate(ANIM_MODE_2, NULL); + scene->_item2._object1.setPosition(scene->_arrunkObj1337[2]._arr2[1]._field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_item7._field36, this); + } + break; + case 5: { + scene->_item2._object1.hide(); + + scene->_item7._object1.postInit(); + scene->_item7._object1.setVisage(1332); + scene->_item7._object1.setPosition(scene->_item7._field36, 0); + scene->setAnimationInfo(&scene->_item7); + scene->_aSound2.play(61); + + R2_GLOBALS._sceneObjects->draw(); + + skipFrames(60); + scene->actionDisplay(1331, 14, 159, 10, 1, 200, 0, 7, 0, 154, 154); + + scene->_arrunkObj1337[2]._arr3[0]._object1.postInit(); + scene->_arrunkObj1337[2]._arr3[0]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr3[0]._object1.setPosition(scene->_arrunkObj1337[2]._arr3[0]._field36, 0); + scene->_arrunkObj1337[2]._arr3[0]._object1.hide(); + + scene->_arrunkObj1337[3]._arr1[2]._field34 = 0; + scene->_arrunkObj1337[3]._arr1[2].remove(); + + scene->_item2._object1.setPosition(scene->_arrunkObj1337[3]._arr1[2]._field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[2]._arr3[0]._field36, this); + } + break; + case 6: { + scene->_item2._object1.hide(); + scene->_arrunkObj1337[2]._arr3[0]._field34 = 21; + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr3[0]); + scene->_aSound1.play(57); + + R2_GLOBALS._sceneObjects->draw(); + + skipFrames(60); + scene->actionDisplay(1331, 15, 159, 10, 1, 200, 0, 7, 0, 154, 154); + + int tmpVal = 15; + int i = -1; + + for (i = 0; i <= 7; i++) { + tmpVal += 29; + + scene->_arrObject1[i].postInit(); + scene->_arrObject1[i].setVisage(1332); + scene->_arrObject1[i].setPosition(Common::Point(tmpVal, 90), 0); + scene->_arrObject1[i].setStrip(3); + scene->_arrObject1[i].fixPriority(190); + + scene->_arrObject2[i].postInit(); + scene->_arrObject2[i].setVisage(1332); + scene->_arrObject2[i].setPosition(Common::Point(tmpVal, 90), 0); + scene->_arrObject2[i].setStrip(7); + scene->_arrObject2[i].setFrame(1); + scene->_arrObject2[i].fixPriority(180); + } + + scene->_arrObject1[0].setFrame(1); + scene->_arrObject1[1].setFrame(3); + scene->_arrObject1[2].setFrame(6); + scene->_arrObject1[3].setFrame(8); + scene->_arrObject1[4].setFrame(9); + scene->_arrObject1[5].setFrame(10); + scene->_arrObject1[6].setFrame(11); + scene->_arrObject1[7].setFrame(12); + + R2_GLOBALS._sceneObjects->draw(); + + skipFrames(240); + + scene->_arrObject1[0].remove(); + scene->_arrObject1[1].remove(); + scene->_arrObject1[2].remove(); + scene->_arrObject1[3].remove(); + scene->_arrObject1[4].remove(); + scene->_arrObject1[5].remove(); + scene->_arrObject1[6].remove(); + scene->_arrObject1[7].remove(); + + scene->_arrObject2[0].remove(); + scene->_arrObject2[1].remove(); + scene->_arrObject2[2].remove(); + scene->_arrObject2[3].remove(); + scene->_arrObject2[4].remove(); + scene->_arrObject2[5].remove(); + scene->_arrObject2[6].remove(); + scene->_arrObject2[7].remove(); + + scene->_item7._field34 = scene->_arrunkObj1337[2]._arr3[0]._field34; + + scene->_arrunkObj1337[2]._arr3[0]._field34 = 0; + scene->_arrunkObj1337[2]._arr3[0]._object1.remove(); + + scene->_item2._object1.setPosition(scene->_arrunkObj1337[2]._arr3[0]._field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_item7._field36, this); + } + break; + case 7: { + scene->_item2._object1.hide(); + scene->setAnimationInfo(&scene->_item7); + scene->_aSound2.play(61); + + R2_GLOBALS._sceneObjects->draw(); + + scene->_arrunkObj1337[2]._arr3[0]._object1.postInit(); + scene->_arrunkObj1337[2]._arr3[0]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr3[0]._object1.setPosition(scene->_arrunkObj1337[2]._arr3[0]._field36, 0); + scene->_arrunkObj1337[2]._arr3[0]._object1.hide(); + + scene->_arrunkObj1337[3]._arr1[1]._field34 = 0; + scene->_arrunkObj1337[3]._arr1[1].remove(); + + scene->_item2._object1.setPosition(scene->_arrunkObj1337[3]._arr1[1]._field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[2]._arr3[0]._field36, this); + } + break; + case 8: { + scene->_item2._object1.hide(); + scene->_arrunkObj1337[2]._arr3[0]._field34 = 14; + scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr3[0]); + scene->_aSound1.play(57); + + R2_GLOBALS._sceneObjects->draw(); + + scene->actionDisplay(1331, 16, 159, 10, 1, 200, 0, 7, 0, 154, 154); + int tmpVal = 72; + int i = -1; + + for (i = 0; i <= 3; i++) { + tmpVal += 29; + scene->_arrObject1[i].postInit(); + scene->_arrObject1[i].setVisage(1332); + scene->_arrObject1[i].setPosition(Common::Point(tmpVal, 71), 0); + scene->_arrObject1[i].setStrip(3); + scene->_arrObject1[i].fixPriority(190); + + scene->_arrObject2[i].postInit(); + scene->_arrObject2[i].setVisage(1332); + scene->_arrObject2[i].setPosition(Common::Point(tmpVal, 71), 0); + scene->_arrObject2[i].setStrip(7); + scene->_arrObject2[i].setFrame(1); + scene->_arrObject2[i].fixPriority(180); + } + + scene->_arrObject1[0].setFrame(2); + scene->_arrObject1[1].setFrame(5); + scene->_arrObject1[2].setFrame(7); + scene->_arrObject1[3].setFrame(15); + + R2_GLOBALS._sceneObjects->draw(); + + skipFrames(240); + scene->actionDisplay(1331, 17, 159, 10, 1, 200, 0, 7, 0, 154, 154); + + tmpVal = 72; + for (i = 4; i <= 7; i++) { + tmpVal += 29; + + scene->_arrObject1[i].postInit(); + scene->_arrObject1[i].setVisage(1332); + scene->_arrObject1[i].setPosition(Common::Point(tmpVal, 100), 0); + scene->_arrObject1[i].setStrip(4); + scene->_arrObject1[i].fixPriority(190); + + scene->_arrObject2[i].postInit(); + scene->_arrObject2[i].setVisage(1332); + scene->_arrObject2[i].setPosition(Common::Point(tmpVal, 100), 0); + scene->_arrObject2[i].setStrip(7); + scene->_arrObject2[i].setFrame(1); + scene->_arrObject2[i].fixPriority(180); + } + + scene->_arrObject1[4].setFrame(1); + scene->_arrObject1[5].setFrame(5); + scene->_arrObject1[6].setFrame(7); + scene->_arrObject1[7].setFrame(3); + + R2_GLOBALS._sceneObjects->draw(); + + skipFrames(240); + + scene->_arrObject1[0].remove(); + scene->_arrObject1[1].remove(); + scene->_arrObject1[2].remove(); + scene->_arrObject1[3].remove(); + scene->_arrObject1[4].remove(); + scene->_arrObject1[5].remove(); + scene->_arrObject1[6].remove(); + scene->_arrObject1[7].remove(); + + scene->_arrObject2[0].remove(); + scene->_arrObject2[1].remove(); + scene->_arrObject2[2].remove(); + scene->_arrObject2[3].remove(); + scene->_arrObject2[4].remove(); + scene->_arrObject2[5].remove(); + scene->_arrObject2[6].remove(); + scene->_arrObject2[7].remove(); + + scene->_item7._field34 = scene->_arrunkObj1337[2]._arr1[0]._field34; + + scene->_item2._object1.setStrip(scene->_arrunkObj1337[2]._arr1[0]._object1._strip); + scene->_item2._object1.setFrame(scene->_arrunkObj1337[2]._arr1[0]._object1._frame); + scene->_item2._object1.animate(ANIM_MODE_NONE, NULL); + + scene->_arrunkObj1337[2]._arr1[0]._field34 = 0; + scene->_arrunkObj1337[2]._arr1[0]._object1.remove(); + + scene->_item2._object1.setPosition(scene->_arrunkObj1337[2]._arr1[0]._field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[2]._arr3[0]._field36, this); + } + break; + case 9: { + scene->_aSound1.play(58); + scene->_arrunkObj1337[2]._arr3[0]._field34 = 0; + scene->_arrunkObj1337[2]._arr3[0].remove(); + scene->_item2._object1.setStrip(5); + scene->_item2._object1.setFrame(1); + scene->_item2._object1.animate(ANIM_MODE_2, NULL); + scene->_item2._object1.setPosition(scene->_arrunkObj1337[2]._arr3[0]._field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_item7._field36, this); + } + break; + case 10: { + scene->_item2._object1.hide(); + scene->setAnimationInfo(&scene->_item7); + scene->_aSound2.play(61); + + R2_GLOBALS._sceneObjects->draw(); + scene->actionDisplay(1331, 18, 159, 10, 1, 200, 0, 7, 0, 154, 154); + + scene->_arrObject1[0].postInit(); + scene->_arrObject1[0].setVisage(1332); + scene->_arrObject1[0].setPosition(Common::Point(131, 71), 0); + scene->_arrObject1[0].fixPriority(190); + scene->_arrObject1[0].setStrip(3); + scene->_arrObject1[0].setFrame(4); + + scene->_arrObject2[0].postInit(); + scene->_arrObject2[0].setVisage(1332); + scene->_arrObject2[0].setPosition(Common::Point(131, 71), 0); + scene->_arrObject2[0].setStrip(7); + scene->_arrObject2[0].setFrame(1); + scene->_arrObject2[0].fixPriority(180); + + scene->_arrObject1[1].postInit(); + scene->_arrObject1[1].setVisage(1332); + scene->_arrObject1[1].setPosition(Common::Point(160, 71), 0); + scene->_arrObject1[1].fixPriority(190); + scene->_arrObject1[1].setStrip(3); + scene->_arrObject1[1].setFrame(16); + + scene->_arrObject2[1].postInit(); + scene->_arrObject2[1].setVisage(1332); + scene->_arrObject2[1].setPosition(Common::Point(160, 71), 0); + scene->_arrObject2[1].setStrip(7); + scene->_arrObject2[1].setFrame(1); + scene->_arrObject2[1].fixPriority(180); + + scene->_arrObject1[2].postInit(); + scene->_arrObject1[2].setVisage(1332); + scene->_arrObject1[2].setPosition(Common::Point(131, 100), 0); + scene->_arrObject1[2].fixPriority(190); + scene->_arrObject1[2].setStrip(4); + scene->_arrObject1[2].setFrame(4); + + scene->_arrObject2[2].postInit(); + scene->_arrObject2[2].setVisage(1332); + scene->_arrObject2[2].setPosition(Common::Point(131, 100), 0); + scene->_arrObject2[2].setStrip(7); + scene->_arrObject2[2].setFrame(1); + scene->_arrObject2[2].fixPriority(180); + + scene->_arrObject1[3].postInit(); + scene->_arrObject1[3].setVisage(1332); + scene->_arrObject1[3].setPosition(Common::Point(160, 100), 0); + scene->_arrObject1[3].fixPriority(190); + scene->_arrObject1[3].setStrip(4); + scene->_arrObject1[3].setFrame(2); + + scene->_arrObject2[3].postInit(); + scene->_arrObject2[3].setVisage(1332); + scene->_arrObject2[3].setPosition(Common::Point(160, 100), 0); + scene->_arrObject2[3].setStrip(7); + scene->_arrObject2[3].setFrame(1); + scene->_arrObject2[3].fixPriority(180); + + R2_GLOBALS._sceneObjects->draw(); + + skipFrames(240); + + scene->_arrObject1[0].remove(); + scene->_arrObject1[1].remove(); + scene->_arrObject1[2].remove(); + scene->_arrObject1[3].remove(); + + scene->_arrObject2[0].remove(); + scene->_arrObject2[1].remove(); + scene->_arrObject2[2].remove(); + scene->_arrObject2[3].remove(); + + scene->_object1.setFrame(1); + scene->_object1.show(); + scene->_object1.animate(ANIM_MODE_2, NULL); + + R2_GLOBALS._sceneObjects->draw(); + + scene->actionDisplay(1331, 19, 159, 10, 1, 220, 0, 7, 0, 154, 154); + + scene->_object1.hide(); + + scene->actionDisplay(1331, 20, 159, 10, 1, 220, 0, 7, 0, 154, 154); + scene->actionDisplay(1331, 21, 159, 10, 1, 220, 0, 7, 0, 154, 154); + + scene->_item7._field34 = scene->_arrunkObj1337[2]._arr1[1]._field34; + + scene->_item2._object1.setStrip(scene->_arrunkObj1337[2]._arr1[1]._object1._strip); + scene->_item2._object1.setFrame(scene->_arrunkObj1337[2]._arr1[1]._object1._frame); + scene->_item2._object1.animate(ANIM_MODE_NONE, NULL); + + scene->_arrunkObj1337[2]._arr1[1]._field34 = 0; + scene->_arrunkObj1337[2]._arr1[1]._object1.remove(); + + scene->_item2._object1.setPosition(scene->_arrunkObj1337[2]._arr1[1]._field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_item7._field36, this); + } + break; + case 11: { + scene->_item2._object1.hide(); + scene->setAnimationInfo(&scene->_item7); + scene->_aSound2.play(61); + scene->_item2._object1.setStrip(5); + scene->_item2._object1.setFrame(1); + scene->_item2._object1.animate(ANIM_MODE_2, NULL); + + R2_GLOBALS._sceneObjects->draw(); + + scene->actionDisplay(1331, 22, 159, 10, 1, 200, 0, 7, 0, 154, 154); + + int i = -1; + for (i = 0; i <= 3; i ++) { + scene->_arrunkObj1337[3]._arr1[i]._field34 = 0; + scene->_arrunkObj1337[3]._arr1[i]._object1.remove(); + + scene->_arrunkObj1337[2]._arr1[i]._field34 = 0; + scene->_arrunkObj1337[2]._arr1[i]._object1.remove(); + + scene->_arrunkObj1337[0]._arr1[i]._field34 = 0; + scene->_arrunkObj1337[0]._arr1[i]._object1.remove(); + + scene->_arrunkObj1337[1]._arr1[i]._field34 = 0; + scene->_arrunkObj1337[1]._arr1[i]._object1.remove(); + } + + for (i = 0; i <= 7; i++) { + scene->_arrunkObj1337[3]._arr2[i]._field34 = 0; + scene->_arrunkObj1337[3]._arr2[i]._object1.remove(); + + scene->_arrunkObj1337[2]._arr2[i]._field34 = 0; + scene->_arrunkObj1337[2]._arr2[i]._object1.remove(); + + scene->_arrunkObj1337[0]._arr2[i]._field34 = 0; + scene->_arrunkObj1337[0]._arr2[i]._object1.remove(); + + scene->_arrunkObj1337[1]._arr2[i]._field34 = 0; + scene->_arrunkObj1337[1]._arr2[i]._object1.remove(); + } + + scene->_arrunkObj1337[2]._arr3[0]._field34 = 0; + scene->_arrunkObj1337[2]._arr3[0]._object1.remove(); + + scene->_item7._field34 = 0; + scene->_item7._object1.remove(); + + scene->_background2.remove(); + } + // No break on purpose + case 0: + R2_GLOBALS._sceneObjects->draw(); + signal(); + break; + case 12: + scene->suggestInstructions(); + remove(); + break; + default: + break; + } +} + +void Scene1337::Action2::signal() { + Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + scene->_item3._object1.postInit(); + scene->_item3._object1.setVisage(1332); + scene->_item3._object1.setStrip(8); + scene->_item3._object1.setFrame(1); + scene->_item3._object1.fixPriority(300); + scene->_item3._object1.setPosition(Common::Point(156, 108)); + + scene->_item7._object1.remove(); + scene->_item7._field34 = 0; + + scene->_aSound1.play(60); + scene->_item3._object1.animate(ANIM_MODE_5, this); + break; + case 1: + scene->_item3._object1.setFrame(1); + + scene->_aSound1.play(60); + scene->_item3._object1.animate(ANIM_MODE_5, this); + break; + case 2: { + Common::Point pt(156, 108); + NpcMover *mover = new NpcMover(); + scene->_item3._object1.addMover(mover, &pt, this); + } + break; + case 3: + scene->_item3._object1.remove(); + scene->_background2.setup2(1332, 5, 1, 162, 95, 110, 1); + scene->_field423C = 1; + break; + default: + break; + } +} + +void Scene1337::Action3::signal() { + Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene; + + scene->_item2._object1.setPosition(Common::Point(162, 95), 0); + + switch (_actionIndex++) { + case 0: { + scene->_item2._object1._moveDiff = Common::Point(30, 30); + scene->_item2._object1.setVisage(1332); + scene->_item2._object1.setStrip(5); + scene->_item2._object1.setFrame(1); + scene->_item2._object1.fixPriority(400); + scene->_item2._object1.animate(ANIM_MODE_2, NULL); + scene->_aSound2.play(61); + + Common::Point pt(283, 146); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &pt, this); + + scene->_item2._object1.show(); + scene->_arrunkObj1337[1]._arr1[0]._field34 = scene->_field3E28[scene->_field3E24]; + } + break; + case 1: { + scene->_arrunkObj1337[1]._arr1[0]._object1.postInit(); + scene->_arrunkObj1337[1]._arr1[0]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[1]._arr1[0]._object1.setVisage(1332); + scene->_arrunkObj1337[1]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[1]._arr1[0]._field36, 0); + scene->_arrunkObj1337[1]._arr1[0]._object1.setStrip(1); + scene->_arrunkObj1337[1]._arr1[0]._object1.setFrame(4); + scene->_arrunkObj1337[1]._arr1[0]._object1.fixPriority(170); + scene->_aSound2.play(61); + + Common::Point pt(10, 174); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &pt, this); + + scene->_arrunkObj1337[2]._arr1[0]._field34 = scene->_field3E28[scene->_field3E24]; + } + break; + case 2: { + scene->_arrunkObj1337[2]._arr1[0]._object1.postInit(); + scene->_arrunkObj1337[2]._arr1[0]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[2]._arr1[0]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[2]._arr1[0]._field36, 0); + scene->_arrunkObj1337[2]._arr1[0]._object1.fixPriority(170); + if (scene->_arrunkObj1337[2]._arr1[0]._field34 > 9) { + if (scene->_arrunkObj1337[2]._arr1[0]._field34 > 25) { + scene->_arrunkObj1337[2]._arr1[0]._object1.setStrip(4); + scene->_arrunkObj1337[2]._arr1[0]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[0]._field34 - 25); + } else { + scene->_arrunkObj1337[2]._arr1[0]._object1.setStrip(3); + scene->_arrunkObj1337[2]._arr1[0]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[0]._field34 - 9); + } + } else { + scene->_arrunkObj1337[2]._arr1[0]._object1.setStrip(2); + scene->_arrunkObj1337[2]._arr1[0]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[0]._field34); + } + scene->_aSound2.play(61); + + Common::Point pt(14, 14); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &pt, this); + + scene->_arrunkObj1337[3]._arr1[0]._field34 = scene->_field3E28[scene->_field3E24]; + } + break; + case 3: { + scene->_arrunkObj1337[3]._arr1[0]._object1.postInit(); + scene->_arrunkObj1337[3]._arr1[0]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[3]._arr1[0]._object1.setVisage(1332); + scene->_arrunkObj1337[3]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[3]._arr1[0]._field36, 0); + scene->_arrunkObj1337[3]._arr1[0]._object1.setStrip(1); + scene->_arrunkObj1337[3]._arr1[0]._object1.setFrame(3); + scene->_arrunkObj1337[3]._arr1[0]._object1.fixPriority(170); + scene->_aSound2.play(61); + + Common::Point pt(280, 5); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &pt, this); + + scene->_arrunkObj1337[0]._arr1[0]._field34 = scene->_field3E28[scene->_field3E24]; + } + break; + case 4: { + scene->_arrunkObj1337[0]._arr1[0]._object1.postInit(); + scene->_arrunkObj1337[0]._arr1[0]._object1._moveDiff = Common::Point(30,30); + scene->_arrunkObj1337[0]._arr1[0]._object1.setVisage(1332); + scene->_arrunkObj1337[0]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[0]._arr1[0]._field36, 0); + scene->_arrunkObj1337[0]._arr1[0]._object1.setStrip(5); + scene->_arrunkObj1337[0]._arr1[0]._object1.setFrame(1); + scene->_arrunkObj1337[0]._arr1[0]._object1.fixPriority(170); + scene->_aSound2.play(61); + + Common::Point pt(283, 124); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &pt, this); + + scene->_arrunkObj1337[1]._arr1[1]._field34 = scene->_field3E28[scene->_field3E24]; + } + break; + case 5: { + scene->_arrunkObj1337[1]._arr1[1]._object1.postInit(); + scene->_arrunkObj1337[1]._arr1[1]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[1]._arr1[1]._object1.setVisage(1332); + scene->_arrunkObj1337[1]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[1]._arr1[1]._field36, 0); + scene->_arrunkObj1337[1]._arr1[1]._object1.setStrip(1); + scene->_arrunkObj1337[1]._arr1[1]._object1.setFrame(4); + scene->_arrunkObj1337[1]._arr1[1]._object1.fixPriority(170); + scene->_aSound2.play(61); + + Common::Point pt(37, 174); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &pt, this); + + scene->_arrunkObj1337[2]._arr1[1]._field34 = scene->_field3E28[scene->_field3E24]; + } + break; + case 6: { + scene->_arrunkObj1337[2]._arr1[1]._object1.postInit(); + scene->_arrunkObj1337[2]._arr1[1]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[2]._arr1[1]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[2]._arr1[1]._field36, 0); + scene->_arrunkObj1337[2]._arr1[1]._object1.fixPriority(170); + + if (scene->_arrunkObj1337[2]._arr1[1]._field34 > 9) { + if (scene->_arrunkObj1337[2]._arr1[1]._field34 > 25) { + scene->_arrunkObj1337[2]._arr1[1]._object1.setStrip(4); + scene->_arrunkObj1337[2]._arr1[1]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[1]._field34 - 25); + } else { + scene->_arrunkObj1337[2]._arr1[1]._object1.setStrip(3); + scene->_arrunkObj1337[2]._arr1[1]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[1]._field34 - 9); + } + } else { + scene->_arrunkObj1337[2]._arr1[1]._object1.setStrip(2); + scene->_arrunkObj1337[2]._arr1[1]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[1]._field34); + } + + scene->_aSound2.play(61); + + Common::Point pt(14, 36); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &pt, this); + + scene->_arrunkObj1337[3]._arr1[1]._field34 = scene->_field3E28[scene->_field3E24]; + } + break; + case 7: { + scene->_arrunkObj1337[3]._arr1[1]._object1.postInit(); + scene->_arrunkObj1337[3]._arr1[1]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[3]._arr1[1]._object1.setVisage(1332); + scene->_arrunkObj1337[3]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[3]._arr1[1]._field36); + scene->_arrunkObj1337[3]._arr1[1]._object1.setStrip(1); + scene->_arrunkObj1337[3]._arr1[1]._object1.setFrame(3); + scene->_arrunkObj1337[3]._arr1[1]._object1.fixPriority(170); + scene->_aSound2.play(61); + + Common::Point pt(253, 5); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &pt, this); + + scene->_arrunkObj1337[0]._arr1[1]._field34 = scene->_field3E28[scene->_field3E24]; + } + break; + case 8: { + scene->_arrunkObj1337[0]._arr1[1]._object1.postInit(); + scene->_arrunkObj1337[0]._arr1[1]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[0]._arr1[1]._object1.setVisage(1332); + scene->_arrunkObj1337[0]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[0]._arr1[1]._field36, 0); + scene->_arrunkObj1337[0]._arr1[1]._object1.setStrip(5); + scene->_arrunkObj1337[0]._arr1[1]._object1.setFrame(1); + scene->_arrunkObj1337[0]._arr1[1]._object1.fixPriority(170); + scene->_aSound2.play(61); + + Common::Point pt(283, 102); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &pt, this); + + scene->_arrunkObj1337[1]._arr1[2]._field34 = scene->_field3E28[scene->_field3E24]; + } + break; + case 9: { + scene->_arrunkObj1337[1]._arr1[2]._object1.postInit(); + scene->_arrunkObj1337[1]._arr1[2]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[1]._arr1[2]._object1.setVisage(1332); + scene->_arrunkObj1337[1]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[1]._arr1[2]._field36, 0); + scene->_arrunkObj1337[1]._arr1[2]._object1.setStrip(1); + scene->_arrunkObj1337[1]._arr1[2]._object1.setFrame(4); + scene->_arrunkObj1337[1]._arr1[2]._object1.fixPriority(170); + scene->_aSound2.play(61); + + Common::Point pt(64, 174); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &pt, this); + + scene->_arrunkObj1337[2]._arr1[2]._field34 = scene->_field3E28[scene->_field3E24]; + } + break; + case 10: { + scene->_arrunkObj1337[2]._arr1[2]._object1.postInit(); + scene->_arrunkObj1337[2]._arr1[2]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[2]._arr1[2]._object1.setVisage(1332); + scene->_arrunkObj1337[2]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[2]._arr1[2]._field36, 0); + scene->_arrunkObj1337[2]._arr1[2]._object1.fixPriority(170); + + if (scene->_arrunkObj1337[2]._arr1[2]._field34 > 9) { + if (scene->_arrunkObj1337[2]._arr1[2]._field34 > 25) { + scene->_arrunkObj1337[2]._arr1[2]._object1.setStrip(4); + scene->_arrunkObj1337[2]._arr1[2]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[2]._field34 - 25); + } else { + scene->_arrunkObj1337[2]._arr1[2]._object1.setStrip(3); + scene->_arrunkObj1337[2]._arr1[2]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[2]._field34 - 9); + } + } else { + scene->_arrunkObj1337[2]._arr1[2]._object1.setStrip(2); + scene->_arrunkObj1337[2]._arr1[2]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[2]._field34); + } + + scene->_aSound2.play(61); + + Common::Point pt(14, 58); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &pt, this); + + scene->_arrunkObj1337[3]._arr1[2]._field34 = scene->_field3E28[scene->_field3E24]; + } + break; + case 11: { + scene->_arrunkObj1337[3]._arr1[2]._object1.postInit(); + scene->_arrunkObj1337[3]._arr1[2]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[3]._arr1[2]._object1.setVisage(1332); + scene->_arrunkObj1337[3]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[3]._arr1[2]._field36, 0); + scene->_arrunkObj1337[3]._arr1[2]._object1.setStrip(1); + scene->_arrunkObj1337[3]._arr1[2]._object1.setFrame(3); + scene->_arrunkObj1337[3]._arr1[2]._object1.fixPriority(170); + scene->_aSound2.play(61); + + Common::Point pt(226, 5); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &pt, this); + + scene->_arrunkObj1337[0]._arr1[2]._field34 = scene->_field3E28[scene->_field3E24]; + } + break; + case 12: + scene->_arrunkObj1337[0]._arr1[2]._object1.postInit(); + scene->_arrunkObj1337[0]._arr1[2]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[0]._arr1[2]._object1.setVisage(1332); + scene->_arrunkObj1337[0]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[0]._arr1[2]._field36, 0); + scene->_arrunkObj1337[0]._arr1[2]._object1.setStrip(5); + scene->_arrunkObj1337[0]._arr1[2]._object1.setFrame(1); + scene->_arrunkObj1337[0]._arr1[2]._object1.fixPriority(170); + scene->_arrunkObj1337[0]._arr1[2]._object1.hide(); + default: + break; + } + + if (_actionIndex > 12) { + scene->_field423E = 0; + R2_GLOBALS._sceneObjects->draw(); + scene->actionDisplay(1330, 0, 159, 10, 1, 200, 0, 7, 0, 154, 154); + scene->subC20F9(); + } else if (_actionIndex >= 1) { + scene->_field3E28[scene->_field3E24] = 0; + scene->_field3E24--; + } +} + +void Scene1337::Action4::signal() { + Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + if ((scene->_arrunkObj1337[scene->_field423E]._arr1[0]._field34 == 0) && (scene->subC264B(scene->_arrunkObj1337[scene->_field423E]._arr3[0]._field34))) { + if (scene->_field3E24 < 0) + scene->subC264B(scene->_arrunkObj1337[scene->_field423E]._arr3[0]._field34); + scene->_item2._object1.setPosition(Common::Point(162, 95), 0); + scene->_item2._object1.show(); + scene->_aSound2.play(61); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[scene->_field423E]._fieldB94, this); + + scene->_arrunkObj1337[scene->_field423E]._arr1[0]._field34 = scene->_field3E28[scene->_field3E24]; + scene->_field3E28[scene->_field3E24] = 0; + scene->_field3E24--; + + if (scene->_field3E24 < 0) + scene->_background2.remove(); + } else { + // Self call, forcing next actionIndex + signal(); + } + break; + case 1: + if ( ( scene->_item2._object1._position.x == scene->_arrunkObj1337[scene->_field423E]._fieldB94.x) + && ( scene->_item2._object1._position.y == scene->_arrunkObj1337[scene->_field423E]._fieldB94.y) ) { + scene->_arrunkObj1337[scene->_field423E]._arr1[0]._object1.postInit(); + scene->_arrunkObj1337[scene->_field423E]._arr1[0]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[scene->_field423E]._arr1[0]._object1.setVisage(1332); + scene->_arrunkObj1337[scene->_field423E]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[scene->_field423E]._arr1[0]._field36, 0); + scene->_arrunkObj1337[scene->_field423E]._arr1[0]._object1.setStrip(1); + scene->_arrunkObj1337[scene->_field423E]._arr1[0]._object1.setFrame(scene->_arrunkObj1337[scene->_field423E]._fieldBA4); + scene->_arrunkObj1337[scene->_field423E]._arr1[0]._object1.fixPriority(170); + } + + if ((scene->_field4248 == 1) || (scene->_field423E == 2)) + scene->setAnimationInfo(&scene->_arrunkObj1337[scene->_field423E]._arr1[0]); + + scene->_item2._object1.hide(); + if ((scene->_arrunkObj1337[scene->_field423E]._arr1[0]._field34 == 0) && (scene->subC264B(scene->_arrunkObj1337[scene->_field423E]._arr3[0]._field34 == 0))) { + if (scene->_field3E24 < 0) + scene->shuffleCards(); + scene->_item2._object1.setPosition(Common::Point(162, 95)); + scene->_item2._object1.show(); + + scene->_aSound2.play(61); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[scene->_field423E]._fieldB98, this); + + scene->_arrunkObj1337[scene->_field423E]._arr1[1]._field34 = scene->_field3E28[scene->_field3E24]; + scene->_field3E28[scene->_field3E24] = 0; + scene->_field3E24--; + if (scene->_field3E24 < 0) + scene->_background2.remove(); + } else + signal(); + break; + case 2: + if ( ( scene->_item2._object1._position.x == scene->_arrunkObj1337[scene->_field423E]._fieldB98.x) + && ( scene->_item2._object1._position.y == scene->_arrunkObj1337[scene->_field423E]._fieldB98.y) ) { + scene->_arrunkObj1337[scene->_field423E]._arr1[1]._object1.postInit(); + scene->_arrunkObj1337[scene->_field423E]._arr1[1]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[scene->_field423E]._arr1[1]._object1.setVisage(1332); + scene->_arrunkObj1337[scene->_field423E]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[scene->_field423E]._arr1[1]._field36, 0); + scene->_arrunkObj1337[scene->_field423E]._arr1[1]._object1.setStrip(1); + scene->_arrunkObj1337[scene->_field423E]._arr1[1]._object1.setFrame(scene->_arrunkObj1337[scene->_field423E]._fieldBA4); + scene->_arrunkObj1337[scene->_field423E]._arr1[1]._object1.fixPriority(170); + } + + if ((scene->_field4248 == 1) || (scene->_field423E == 2)) + scene->setAnimationInfo(&scene->_arrunkObj1337[scene->_field423E]._arr1[1]); + + scene->_item2._object1.hide(); + if ((scene->_arrunkObj1337[scene->_field423E]._arr1[2]._field34 == 0) && (scene->subC264B(scene->_arrunkObj1337[scene->_field423E]._arr3[0]._field34 == 0))) { + if (scene->_field3E24 < 0) + scene->shuffleCards(); + scene->_item2._object1.setPosition(Common::Point(162, 95)); + scene->_item2._object1.show(); + + scene->_aSound2.play(61); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[scene->_field423E]._fieldB9C, this); + + scene->_arrunkObj1337[scene->_field423E]._arr1[2]._field34 = scene->_field3E28[scene->_field3E24]; + scene->_field3E28[scene->_field3E24] = 0; + scene->_field3E24--; + if (scene->_field3E24 < 0) + scene->_background2.remove(); + } else + signal(); + break; + case 3: + if ( ( scene->_item2._object1._position.x == scene->_arrunkObj1337[scene->_field423E]._fieldB9C.x) + && ( scene->_item2._object1._position.y == scene->_arrunkObj1337[scene->_field423E]._fieldB9C.y) ) { + scene->_arrunkObj1337[scene->_field423E]._arr1[2]._object1.postInit(); + scene->_arrunkObj1337[scene->_field423E]._arr1[2]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[scene->_field423E]._arr1[2]._object1.setVisage(1332); + scene->_arrunkObj1337[scene->_field423E]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[scene->_field423E]._arr1[2]._field36, 0); + scene->_arrunkObj1337[scene->_field423E]._arr1[2]._object1.setStrip(1); + scene->_arrunkObj1337[scene->_field423E]._arr1[2]._object1.setFrame(scene->_arrunkObj1337[scene->_field423E]._fieldBA4); + scene->_arrunkObj1337[scene->_field423E]._arr1[2]._object1.fixPriority(170); + } + + if ((scene->_field4248 == 1) || (scene->_field423E == 2)) + scene->setAnimationInfo(&scene->_arrunkObj1337[scene->_field423E]._arr1[2]); + + scene->_item2._object1.hide(); + if ((scene->_arrunkObj1337[scene->_field423E]._arr1[3]._field34 == 0) && (scene->subC264B(scene->_arrunkObj1337[scene->_field423E]._arr3[0]._field34 == 0))) { + if (scene->_field3E24 < 0) + scene->shuffleCards(); + scene->_item2._object1.setPosition(Common::Point(162, 95)); + scene->_item2._object1.show(); + + scene->_aSound2.play(61); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[scene->_field423E]._fieldBA0, this); + + scene->_arrunkObj1337[scene->_field423E]._arr1[3]._field34 = scene->_field3E28[scene->_field3E24]; + scene->_field3E28[scene->_field3E24] = 0; + scene->_field3E24--; + if (scene->_field3E24 < 0) + scene->_background2.remove(); + } else + signal(); + break; + case 4: + if ( ( scene->_item2._object1._position.x == scene->_arrunkObj1337[scene->_field423E]._fieldBA0.x) + && ( scene->_item2._object1._position.y == scene->_arrunkObj1337[scene->_field423E]._fieldBA0.y) ) { + scene->_arrunkObj1337[scene->_field423E]._arr1[3]._object1.postInit(); + scene->_arrunkObj1337[scene->_field423E]._arr1[3]._object1._moveDiff = Common::Point(30, 30); + scene->_arrunkObj1337[scene->_field423E]._arr1[3]._object1.setVisage(1332); + scene->_arrunkObj1337[scene->_field423E]._arr1[3]._object1.setPosition(scene->_arrunkObj1337[scene->_field423E]._arr1[3]._field36, 0); + scene->_arrunkObj1337[scene->_field423E]._arr1[3]._object1.setStrip(1); + scene->_arrunkObj1337[scene->_field423E]._arr1[3]._object1.setFrame(scene->_arrunkObj1337[scene->_field423E]._fieldBA4); + scene->_arrunkObj1337[scene->_field423E]._arr1[3]._object1.fixPriority(170); + } + + if ((scene->_field4248 == 1) || (scene->_field423E == 2)) + scene->setAnimationInfo(&scene->_arrunkObj1337[scene->_field423E]._arr1[3]); + + scene->_item2._object1.hide(); + switch (scene->_field423E) { + case 0: + scene->subCF979(); + break; + case 1: + scene->subCF31D(); + break; + case 2: + scene->subD0281(); + break; + case 3: + scene->subC2C2F(); + break; + default: + break; + } + break; + default: + break; + } +} + +void Scene1337::Action5::signal() { + Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: { + scene->_field3E28[scene->_field3E26] = scene->_field3EF0->_field34; + scene->_field3E26--; + if (!g_globals->_sceneObjects->contains(&scene->_item7._object1)) { + scene->_item7._object1.postInit(); + scene->_item7._object1.hide(); + scene->_item7._object1.setVisage(1332); + scene->_item7._object1.setPosition(scene->_item7._field36, 0); + scene->_item7._object1.fixPriority(170); + } + + scene->_item7._field34 = scene->_field3EF0->_field34; + scene->_field3EF0->_field34 = 0; + scene->_field3EF0->_object1.remove(); + + if (scene->_field3EF0 == &scene->_item6) { + subD18B5(5, 1, 4); + scene->subC4CEC(); + } + scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0); + scene->_item2._object1.show(); + Common::Point pt(128, 95); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &pt, this); + } + break; + case 1: + scene->_item2._object1.hide(); + scene->setAnimationInfo(&scene->_item7); + scene->_aSound2.play(61); + scene->subC20F9(); + break; + default: + break; + } +} + +void Scene1337::Action6::signal() { + Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: { + scene->_field3EF4->_field34 = 1; + scene->_field3EF4->_object1.postInit(); + scene->_field3EF4->_object1.hide(); + scene->_field3EF4->_object1.setVisage(1332); + scene->_field3EF4->_object1.setPosition(scene->_field3EF4->_field36); + scene->_field3EF4->_object1.fixPriority(170); + + scene->_field3EF0->_field34 = 0; + scene->_field3EF0->_object1.remove(); + + scene->_item2._object1.setPosition(scene->_field3EF0->_field36); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_field3EF4->_field36, this); + } + break; + case 1: + scene->_item2._object1.hide(); + scene->setAnimationInfo(scene->_field3EF4); + scene->_aSound1.play(59); + if (scene->_field3EF0 == &scene->_item6) { + subD18B5(5, 1, 4); + scene->subC4CEC(); + } + scene->subC20F9(); + break; + default: + break; + } +} + +void Scene1337::Action7::signal() { + Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: { + scene->_field3EF4->_field34 = scene->_field3EF0->_field34; + + scene->_field3EF0->_field34 = 0; + scene->_field3EF0->_object1.remove(); + + scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0); + scene->_item2._object1.show(); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_field3EF4->_field36, this); + } + break; + case 1: + if (scene->_field3EF0 == &scene->_item6) { + subD18B5(5, 1, 4); + scene->subC4CEC(); + } + scene->setAnimationInfo(scene->_field3EF4); + scene->_aSound1.play(59); + scene->_item5._field34 = 1; + scene->_item5._field36.x = scene->_field3EF4->_field36.x; + scene->_item5._field36.y = scene->_field3EF4->_field36.y; + scene->_item5._object1.postInit(); + scene->_item5._object1.hide(); + scene->_item5._object1._flags = 0x200; + + scene->subC4A39(&scene->_item5); + break; + default: + break; + } +} + +void Scene1337::Action8::signal() { + Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: { + scene->_field3E28[scene->_field3E26] = scene->_field3EF4->_field34; + scene->_field3E26--; + + scene->_field3EF4->_field34 = scene->_field3EF0->_field34; + scene->_field3EF0->_object1.remove(); + + scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_field3EF4->_field36, this); + } + break; + case 1: + scene->_item2._object1.hide(); + + if (scene->_field3EF0 == &scene->_item6) { + subD18B5(5, 1, 4); + scene->subC4CEC(); + } + scene->setAnimationInfo(scene->_field3EF4); + scene->_aSound1.play(58); + scene->subC4A39(scene->_field3EF4); + break; + default: + break; + } +} + +void Scene1337::Action9::signal() { + Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: { + scene->_field3EF4->_field34 = scene->_field3EF0->_field34; + scene->_field3EF4->_object1.postInit(); + scene->_field3EF4->_object1.hide(); + scene->_field3EF4->_object1.setVisage(1332); + scene->_field3EF4->_object1.setPosition(scene->_field3EF4->_field36, 0); + scene->_field3EF4->_object1.fixPriority(170); + + scene->_field3EF0->_field34 = 0; + scene->_field3EF0->_object1.remove(); + + scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_field3EF4->_field36, this); + } + break; + case 1: + scene->_item2._object1.hide(); + scene->setAnimationInfo(scene->_field3EF4); + scene->_aSound1.play(57); + + if (scene->_field3EF0 == &scene->_item6) { + subD18B5(5, 1, 4); + scene->subC4CEC(); + } + + scene->subC20F9(); + break; + default: + break; + } +} + +void Scene1337::Action10::signal() { + Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: { + scene->_field3EF8->_object1.postInit(); + scene->_field3EF8->_object1.hide(); + scene->_field3EF8->_object1.setVisage(1332); + scene->_field3EF8->_object1.setPosition(scene->_field3EF8->_field36, 0); + scene->_field3EF8->_object1.fixPriority(170); + scene->_field3EF8->_field34 = scene->_field3EF0->_field34; + + scene->_field3EF0->_field34 = 0; + scene->_field3EF0->_object1.remove(); + + if (scene->_field3EF0 == &scene->_item6) { + subD18B5(5, 1, 4); + scene->subC4CEC(); + } + + scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0); + scene->_item2._object1.show(); + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_field3EF8->_field36, this); + } + break; + case 1: { + scene->_item2._object1.hide(); + scene->setAnimationInfo(scene->_field3EF8); + scene->_aSound1.play(57); + + bool found = false; + int indexFound = -1; + + switch (scene->_field4240) { + case 0: + for (indexFound = 0; indexFound < 3; indexFound++) { + if (scene->_arrunkObj1337[0]._arr1[indexFound]._field34 == 29) { + found = true; + break; + } + } + break; + case 1: + for (indexFound = 0; indexFound < 3; indexFound++) { + if (scene->_arrunkObj1337[1]._arr1[indexFound]._field34 == 29) { + found = true; + break; + } + } + break; + case 2: + for (indexFound = 0; indexFound < 3; indexFound++) { + if (scene->_arrunkObj1337[2]._arr1[indexFound]._field34 == 29) { + found = true; + break; + } + } + break; + case 3: + for (indexFound = 0; indexFound < 3; indexFound++) { + if (scene->_arrunkObj1337[3]._arr1[indexFound]._field34 == 29) { + found = true; + break; + } + } + break; + default: + break; + } + + bool found2 = false; + + if (found) { + switch (scene->_field4240) { + case 0: + scene->subC51A0(&scene->_arrunkObj1337[0]._arr1[indexFound], scene->_field3EF8); + found2 = true; + break; + case 1: + scene->subC51A0(&scene->_arrunkObj1337[1]._arr1[indexFound], scene->_field3EF8); + found2 = true; + break; + case 2: + scene->subC4CD2(); + if (MessageDialog::show(USE_INTERCEPTOR, NO_MSG, YES_MSG) == 0) + scene->subC4CEC(); + else { + scene->subC51A0(&scene->_arrunkObj1337[2]._arr1[indexFound], scene->_field3EF8); + found2 = true; + } + break; + case 3: + scene->subC51A0(&scene->_arrunkObj1337[3]._arr1[indexFound], scene->_field3EF8); + found2 = true; + break; + default: + break; + } + } + + if (!found2) + break; + + if (scene->_field4240 == 2) { + int j = 0; + for (int i = 0; i <= 7; i++) { + if (scene->_arrunkObj1337[2]._arr2[i]._field34 != 0) + ++j; + } + + if (j <= 1) { + for (int i = 0; i <= 7; i++) { + if (scene->_arrunkObj1337[2]._arr2[i]._field34 != 0) { + scene->_field3EF4 = &scene->_arrunkObj1337[2]._arr2[i]; + break; + } + } + } else { + scene->subC4CD2(); + + found2 = false; + while (!found2) { + scene->actionDisplay(1330, 130, 159, 10, 1, 200, 0, 7, 0, 154, 154); + + // Wait for a mouse or keypress + Event event; + while (!g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS) && !g_vm->shouldQuit()) { + g_globals->_scenePalette.signalListeners(); + R2_GLOBALS._sceneObjects->draw(); + g_globals->_events.delay(g_globals->_sceneHandler->_delayTicks); + } + + scene->_item6._field36 = event.mousePos; + + for (int i = 0; i <= 7; i++) { + if ((scene->subC2BF8(&scene->_arrunkObj1337[2]._arr2[i], scene->_item6._field36) != 0) && (scene->_arrunkObj1337[2]._arr2[i]._field34 != 0)) { + scene->_field3EF4 = &scene->_arrunkObj1337[2]._arr2[0]; + found2 = true; + break; + } + } + } + scene->subC4CEC(); + } + } + + scene->_field3E28[scene->_field3E26] = scene->_field3EF4->_field34; + scene->_field3E26--; + scene->_field3EF4->_field34 = 0; + scene->_field3EF4->_object1.remove(); + + scene->_item2._object1.setPosition(scene->_field3EF4->_field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_field3EF8->_field36, this); + } + break; + case 2: + scene->_item2._object1.hide(); + scene->subC4A39(scene->_field3EF8); + break; + default: + break; + } +} + +void Scene1337::Action11::signal() { + Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene; + + bool noAction = true; + + switch (_actionIndex++) { + case 0: { + scene->_field3EF4->_object1.postInit(); + scene->_field3EF4->_object1.hide(); + scene->_field3EF4->_object1.setVisage(1332); + scene->_field3EF4->_object1.setPosition(scene->_field3EF4->_field36, 0); + scene->_field3EF4->_object1.fixPriority(170); + scene->_field3EF4->_field34 = 25; + + if (scene->_field4240 == 2) { + scene->_item2._object1.setPosition(scene->_field3EF4->_field36, 0); + subD18B5(5, 1, 4); + } else { + scene->_field3EF0->_field34 = 0; + scene->_field3EF0->_object1.remove(); + scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0); + } + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_field3EF4->_field36, this); + } + break; + case 1: { + scene->_item2._object1.hide(); + scene->setAnimationInfo(scene->_field3EF4); + scene->_aSound1.play(57); + + bool found = false; + int i = -1; + + switch (scene->_field4242) { + case 0: + for (i = 0; i <= 3; i++) { + if (scene->_arrunkObj1337[0]._arr1[i]._field34 == 27) { + found = true; + break; + } + } + + if ((found) && (scene->subC3E92(scene->_field4240) != -1)) { + scene->_field3EF0 = &scene->_arrunkObj1337[0]._arr1[i]; + scene->_field3EF4 = &scene->_arrunkObj1337[0]._arr4[0]; + if (scene->_field4240 != 0) { + int tmpVal = scene->subC3E92(scene->_field4240); + scene->_field3EF8 = &scene->_arrunkObj1337[scene->_field4240]._arr1[tmpVal]; + } + scene->_item1.setAction(&scene->_action12); + noAction = false; + } + break; + case 1: + for (i = 0; i <= 3; i++) { + if (scene->_arrunkObj1337[1]._arr1[i]._field34 == 27) { + found = true; + break; + } + } + + if ((found) && (scene->subC3E92(scene->_field4240) != -1)) { + scene->_field3EF0 = &scene->_arrunkObj1337[1]._arr1[i]; + scene->_field3EF4 = &scene->_arrunkObj1337[1]._arr4[0]; + if (scene->_field4240 != 1) { + int tmpVal = scene->subC3E92(scene->_field4240); + scene->_field3EF8 = &scene->_arrunkObj1337[scene->_field4240]._arr1[tmpVal]; + } + scene->_item1.setAction(&scene->_action12); + noAction = false; + } + break; + case 2: + for (i = 0; i <= 3; i++) { + if (scene->_arrunkObj1337[2]._arr1[i]._field34 == 27) { + found = true; + break; + } + } + + if ((found) && (scene->subC3E92(scene->_field4240) != -1)) { + scene->subC4CD2(); + if (MessageDialog::show(USE_DOUBLE_AGENT, NO_MSG, YES_MSG) == 0) + scene->subC4CEC(); + else { + scene->subC4CEC(); + scene->_field3EF0 = &scene->_arrunkObj1337[2]._arr1[i]; + scene->_field3EF4 = &scene->_arrunkObj1337[2]._arr4[0]; + if (scene->_field4240 != 2) { + int tmpVal = scene->subC3E92(scene->_field4240); + scene->_field3EF8 = &scene->_arrunkObj1337[scene->_field4240]._arr1[tmpVal]; + } + scene->_item1.setAction(&scene->_action12); + noAction = false; + } + } + break; + case 3: + for (i = 0; i <= 3; i++) { + if (scene->_arrunkObj1337[3]._arr1[i]._field34 == 27) { + found = true; + break; + } + } + + if ((found) && (scene->subC3E92(scene->_field4240) != -1)) { + scene->_field3EF0 = &scene->_arrunkObj1337[3]._arr1[i]; + scene->_field3EF4 = &scene->_arrunkObj1337[3]._arr4[0]; + if (scene->_field4240 != 3) { + int tmpVal = scene->subC3E92(scene->_field4240); + scene->_field3EF8 = &scene->_arrunkObj1337[scene->_field4240]._arr1[tmpVal]; + } + scene->_item1.setAction(&scene->_action12); + noAction = false; + } + break; + default: + break; + } + + if (!noAction) + return; + + if (scene->_field4240 == 2) { + int count = 0; + if (scene->_field4242 != 2) { + for (i = 0; i <= 3; i++) { + if (scene->_arrunkObj1337[scene->_field4242]._arr1[i]._field34 == 0) + ++count; + } + } + + if (count > 1) { + scene->subC4CD2(); + + found = false; + while (!found) { + switch (scene->_field4242) { + case 0: + scene->actionDisplay(1330, 131, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 1: + scene->actionDisplay(1330, 132, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 3: + scene->actionDisplay(1330, 133, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + default: + break; + } + + Event event; + while (!g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS) && !g_vm->shouldQuit()) { + g_globals->_scenePalette.signalListeners(); + R2_GLOBALS._sceneObjects->draw(); + g_globals->_events.delay(g_globals->_sceneHandler->_delayTicks); + } + + scene->_item6._field36 = event.mousePos; + + found = false; + + if (scene->_field4242 != 2) { + for (i = 0; i <= 3; i++) { + if ((scene->subC2BF8(&scene->_arrunkObj1337[scene->_field4242]._arr1[i], scene->_item6._field36) != 0) && (scene->_arrunkObj1337[scene->_field4242]._arr1[i]._field34 != 0)) { + scene->_field3EF8 = &scene->_arrunkObj1337[scene->_field4242]._arr1[i]; + found = true; + break; + } + } + } + } // while + scene->_field4246 = 1; + scene->subC4CEC(); + } else { + if (scene->_field4242 != 2) { + int tmpVal = scene->subC3E92(scene->_field4242); + scene->_field3EF8 = &scene->_arrunkObj1337[scene->_field4242]._arr1[tmpVal]; + } + } + } + + scene->_field3EF0->_object1.postInit(); + scene->_field3EF0->_object1.hide(); + scene->_field3EF0->_object1.setVisage(1332); + scene->_field3EF0->_object1.setPosition(scene->_field3EF0->_field36, 0); + scene->_field3EF0->_object1.fixPriority(170); + scene->_field3EF0->_object1.setStrip2(1); + scene->_field3EF0->_field34 = scene->_field3EF8->_field34; + + scene->_field3EF8->_field34 = 0; + scene->_field3EF8->_object1.remove(); + + scene->_item2._object1.setPosition(scene->_field3EF8->_field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_field3EF0->_field36, this); + } + break; + case 2: + scene->_item2._object1.hide(); + switch (scene->_field4240) { + case 0: + scene->_field3EF0->_object1.setFrame(2); + scene->_field3EF0->_object1.show(); + scene->_field423E--; + scene->_field4244 = 0; + break; + case 1: + scene->_field3EF0->_object1.setFrame(4); + scene->_field3EF0->_object1.show(); + scene->_field423E--; + scene->_field4244 = 0; + break; + case 3: + scene->_field3EF0->_object1.setFrame(3); + scene->_field3EF0->_object1.show(); + scene->_field423E--; + scene->_field4244 = 0; + break; + default: + scene->setAnimationInfo(scene->_field3EF0); + break; + } + + scene->subC4A39(scene->_field3EF4); + break; + default: + break; + } +} + +void Scene1337::Action12::signal() { + Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + signal(); + break; + case 1: { + scene->_field3E28[scene->_field3E26] = scene->_field3EF4->_field34; + scene->_field3EF4->_field34 = scene->_field3EF0->_field34; + scene->_field3EF0->_field34 = 0; + scene->_field3EF0->_object1.remove(); + scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_field3EF4->_field36, this); + } + break; + case 2: + scene->_item2._object1.hide(); + scene->setAnimationInfo(scene->_field3EF4); + scene->_aSound1.play(58); + if (scene->_field4242 == 2) { + int count = 0; + int i = -1; + switch (scene->_field4240) { + case 0: + for (i = 0; i <= 3; i++) { + if (scene->_arrunkObj1337[0]._arr1[i]._field34 != 0) + ++count; + } + break; + case 1: + for (i = 0; i <= 3; i++) { + if (scene->_arrunkObj1337[3]._arr1[i]._field34 != 0) + ++count; + } + break; + case 3: + for (i = 0; i <= 3; i++) { + if (scene->_arrunkObj1337[3]._arr1[i]._field34 != 0) + ++count; + } + break; + default: + break; + } + + if (count > 1) { + scene->subC4CD2(); + + bool found = false; + + while (!found) { + switch (scene->_field4240) { + case 0: + scene->actionDisplay(1330, 131, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 1: + scene->actionDisplay(1330, 132, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 3: + scene->actionDisplay(1330, 133, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + default: + break; + } + + Event event; + while (!g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS) && !g_vm->shouldQuit()) { + g_globals->_scenePalette.signalListeners(); + R2_GLOBALS._sceneObjects->draw(); + g_globals->_events.delay(g_globals->_sceneHandler->_delayTicks); + } + + scene->_item6._field36 = event.mousePos; + + if (scene->_field4240 == 0) { + for (i = 0; i <= 3; i++) { + if ((scene->subC2BF8(&scene->_arrunkObj1337[0]._arr1[i], scene->_item6._field36) != 0) && (scene->_arrunkObj1337[0]._arr1[i]._field34 != 0)) { + found = true; + scene->_field3EF8 = &scene->_arrunkObj1337[0]._arr1[i]; + break; + } + } + } + + if (scene->_field4240 == 3) { + for (i = 0; i <= 3; i++) { + if ((scene->subC2BF8(&scene->_arrunkObj1337[3]._arr1[i], scene->_item6._field36) != 0) && (scene->_arrunkObj1337[3]._arr1[i]._field34 != 0)) { + found = true; + scene->_field3EF8 = &scene->_arrunkObj1337[3]._arr1[i]; + break; + } + } + } + + if (scene->_field4240 == 1) { + for (i = 0; i <= 3; i++) { + if ((scene->subC2BF8(&scene->_arrunkObj1337[1]._arr1[i], scene->_item6._field36) != 0) && (scene->_arrunkObj1337[1]._arr1[i]._field34 != 0)) { + found = true; + scene->_field3EF8 = &scene->_arrunkObj1337[1]._arr1[i]; + break; + } + } + } + } + scene->subC4CEC(); + } else { + if (scene->_field4240 != 1) { + switch (scene->_field4240) { + case 0: + scene->_field3EF8 = &scene->_arrunkObj1337[0]._arr1[scene->subC3E92(0)]; + break; + case 3: + scene->_field3EF8 = &scene->_arrunkObj1337[3]._arr1[scene->subC3E92(3)]; + break; + default: + break; + } + } else { + scene->_field3EF8 = &scene->_arrunkObj1337[1]._arr1[scene->subC3E92(1)]; + } + } + + scene->_field3EF0->_object1.postInit(); + scene->_field3EF0->_object1.hide(); + scene->_field3EF0->_object1.setVisage(1332); + scene->_field3EF0->_object1.setPosition(scene->_field3EF0->_field36); + scene->_field3EF0->_object1.fixPriority(170); + scene->_field3EF0->_object1.setStrip2(1); + scene->_field3EF0->_field34 = scene->_field3EF8->_field34; + + scene->_field3EF8->_field34 = 0; + scene->_field3EF8->_object1.remove(); + + scene->_item2._object1.setPosition(scene->_field3EF8->_field36); + scene->_item2._object1.show(); + scene->_aSound1.play(57); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_field3EF0->_field36, this); + } + break; + case 3: + scene->_item2._object1.hide(); + switch (scene->_field4242) { + case 0: + scene->_field3EF0->_object1.setFrame2(2); + scene->_field3EF0->_object1.show(); + break; + case 1: + scene->_field3EF0->_object1.setFrame2(4); + scene->_field3EF0->_object1.show(); + break; + case 3: + scene->_field3EF0->_object1.setFrame2(3); + scene->_field3EF0->_object1.show(); + break; + default: + scene->setAnimationInfo(scene->_field3EF0); + break; + } + scene->subC4A39(scene->_field3EF4); + break; + default: + break; + } +} + +void Scene1337::Action13::signal() { + Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: { + scene->_field3E28[scene->_field3E26] = scene->_field3EF4->_field34; + scene->_field3E26--; + + scene->_field3EF4->_field34 = scene->_field3EF0->_field34; + + scene->_field3EF0->_field34 = 0; + scene->_field3EF0->_object1.remove(); + + scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0); + scene->_item2._object1.show(); + + NpcMover *mover = new NpcMover(); + scene->_item2._object1.addMover(mover, &scene->_field3EF4->_field36, this); + } + break; + case 1: + scene->_item2._object1.hide(); + scene->setAnimationInfo(scene->_field3EF4); + scene->_aSound1.play(58); + signal(); + break; + case 2: + scene->subC4A39(scene->_field3EF4); + break; + default: + break; + } +} + +void Scene1337::postInit(SceneObjectList *OwnerList) { +// In the original, may be found in subPostInit. +// Without it, enableControl asserts + loadScene(1330); + SceneExt::postInit(); +// + + // Hide the user interface + R2_GLOBALS._uiElements._active = false; + BF_GLOBALS._interfaceY = 200; + + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + + _unkFctPtr412 = NULL; + + _field3EF0 = NULL; + _field3EF4 = NULL; + _field3EF8 = NULL; + + _arrunkObj1337[2]._arr1[0]._field36 = Common::Point(10, 174); + _arrunkObj1337[2]._arr1[1]._field36 = Common::Point(37, 174); + _arrunkObj1337[2]._arr1[2]._field36 = Common::Point(64, 174); + _arrunkObj1337[2]._arr1[3]._field36 = Common::Point(91, 174); + + _arrunkObj1337[2]._arr2[0]._field36 = Common::Point(119, 174); + _arrunkObj1337[2]._arr2[1]._field36 = Common::Point(119, 148); + _arrunkObj1337[2]._arr2[2]._field36 = Common::Point(119, 122); + _arrunkObj1337[2]._arr2[3]._field36 = Common::Point(145, 122); + _arrunkObj1337[2]._arr2[4]._field36 = Common::Point(171, 122); + _arrunkObj1337[2]._arr2[5]._field36 = Common::Point(171, 148); + _arrunkObj1337[2]._arr2[6]._field36 = Common::Point(171, 174); + _arrunkObj1337[2]._arr2[7]._field36 = Common::Point(145, 174); + + _arrunkObj1337[2]._arr3[0]._field36 = Common::Point(199, 174); + + _arrunkObj1337[2]._arr4[0]._field36 = Common::Point(145, 148); + + _arrunkObj1337[2]._fieldB94 = Common::Point(10, 174); + _arrunkObj1337[2]._fieldB98 = Common::Point(37, 174); + _arrunkObj1337[2]._fieldB9C = Common::Point(64, 174); + _arrunkObj1337[2]._fieldBA0 = Common::Point(91, 174); + _arrunkObj1337[2]._fieldBA4 = 2; + + _arrunkObj1337[3]._arr1[0]._field36 = Common::Point(14, 14); + _arrunkObj1337[3]._arr1[1]._field36 = Common::Point(14, 36); + _arrunkObj1337[3]._arr1[2]._field36 = Common::Point(14, 58); + _arrunkObj1337[3]._arr1[3]._field36 = Common::Point(14, 80); + + _arrunkObj1337[3]._arr2[0]._field36 = Common::Point(37, 66); + _arrunkObj1337[3]._arr2[1]._field36 = Common::Point(63, 66); + _arrunkObj1337[3]._arr2[2]._field36 = Common::Point(89, 66); + _arrunkObj1337[3]._arr2[3]._field36 = Common::Point(89, 92); + _arrunkObj1337[3]._arr2[4]._field36 = Common::Point(89, 118); + _arrunkObj1337[3]._arr2[5]._field36 = Common::Point(63, 118); + _arrunkObj1337[3]._arr2[6]._field36 = Common::Point(37, 118); + _arrunkObj1337[3]._arr2[7]._field36 = Common::Point(37, 92); + + _arrunkObj1337[3]._arr3[0]._field36 = Common::Point(37, 145); + + _arrunkObj1337[3]._arr4[0]._field36 = Common::Point(63, 92); + + _arrunkObj1337[3]._fieldB94 = Common::Point(14, 14); + _arrunkObj1337[3]._fieldB98 = Common::Point(14, 36); + _arrunkObj1337[3]._fieldB9C = Common::Point(14, 58); + _arrunkObj1337[3]._fieldBA0 = Common::Point(14, 80); + _arrunkObj1337[3]._fieldBA4 = 3; + + _arrunkObj1337[0]._arr1[0]._field36 = Common::Point(280, 5); + _arrunkObj1337[0]._arr1[1]._field36 = Common::Point(253, 5); + _arrunkObj1337[0]._arr1[2]._field36 = Common::Point(226, 5); + _arrunkObj1337[0]._arr1[3]._field36 = Common::Point(199, 5); + + _arrunkObj1337[0]._arr2[0]._field36 = Common::Point(171, 16); + _arrunkObj1337[0]._arr2[1]._field36 = Common::Point(171, 42); + _arrunkObj1337[0]._arr2[2]._field36 = Common::Point(171, 68); + _arrunkObj1337[0]._arr2[3]._field36 = Common::Point(145, 68); + _arrunkObj1337[0]._arr2[4]._field36 = Common::Point(119, 68); + _arrunkObj1337[0]._arr2[5]._field36 = Common::Point(119, 42); + _arrunkObj1337[0]._arr2[6]._field36 = Common::Point(119, 16); + _arrunkObj1337[0]._arr2[7]._field36 = Common::Point(145, 16); + + _arrunkObj1337[0]._arr3[0]._field36 = Common::Point(91, 16); + + _arrunkObj1337[0]._arr4[0]._field36 = Common::Point(145, 42); + + _arrunkObj1337[0]._fieldB94 = Common::Point(280, 5); + _arrunkObj1337[0]._fieldB98 = Common::Point(253, 5); + _arrunkObj1337[0]._fieldB9C = Common::Point(226, 5); + _arrunkObj1337[0]._fieldBA0 = Common::Point(199, 5); + _arrunkObj1337[0]._fieldBA4 = 2; + + _arrunkObj1337[1]._arr1[0]._field36 = Common::Point(283, 146); + _arrunkObj1337[1]._arr1[1]._field36 = Common::Point(283, 124); + _arrunkObj1337[1]._arr1[2]._field36 = Common::Point(283, 102); + _arrunkObj1337[1]._arr1[3]._field36 = Common::Point(283, 80); + + _arrunkObj1337[1]._arr2[0]._field36 = Common::Point(253, 122); + _arrunkObj1337[1]._arr2[1]._field36 = Common::Point(227, 122); + _arrunkObj1337[1]._arr2[2]._field36 = Common::Point(201, 122); + _arrunkObj1337[1]._arr2[3]._field36 = Common::Point(201, 96); + _arrunkObj1337[1]._arr2[4]._field36 = Common::Point(201, 70); + _arrunkObj1337[1]._arr2[5]._field36 = Common::Point(227, 70); + _arrunkObj1337[1]._arr2[6]._field36 = Common::Point(253, 70); + _arrunkObj1337[1]._arr2[7]._field36 = Common::Point(253, 96); + + _arrunkObj1337[1]._arr3[0]._field36 = Common::Point(253, 43); + + _arrunkObj1337[1]._arr4[0]._field36 = Common::Point(227, 96); + + _arrunkObj1337[1]._fieldB94 = Common::Point(283, 146); + _arrunkObj1337[1]._fieldB98 = Common::Point(283, 124); + _arrunkObj1337[1]._fieldB9C = Common::Point(283, 102); + _arrunkObj1337[1]._fieldBA0 = Common::Point(283, 80); + _arrunkObj1337[1]._fieldBA4 = 4; + + subPostInit(); +} + +void Scene1337::remove() { + if (R2_GLOBALS._v57709 > 1) { + subD1917(); + subD1940(false); + } + + R2_GLOBALS._uiElements._active = true; + SceneExt::remove(); +} + +void Scene1337::process(Event &event) { + if (event.eventType == EVENT_BUTTON_DOWN) { + if (event.btnState != BTNSHIFT_RIGHT) { + subD183F(R2_GLOBALS._v5780E, 1); + event.handled = true; + } else if (_unkFctPtr412) { + FunctionPtrType tmpFctPtr = _unkFctPtr412; + _unkFctPtr412 = NULL; + (this->*tmpFctPtr)(); + event.handled = true; + } + } else if (event.eventType == EVENT_KEYPRESS) { + if (event.kbd.keycode == Common::KEYCODE_SPACE) { + if (_unkFctPtr412) { + FunctionPtrType tmpFctPtr = _unkFctPtr412; + _unkFctPtr412 = NULL; + (this->*tmpFctPtr)(); + event.handled = true; + } + } else + warning("Fixme: Find proper keycode value"); + } + + if (!event.handled) + Scene::process(event); +} + +void Scene1337::dispatch() { + if (_field424C == 0) { + ++_field424E; + if (_field424E == 4) { + _field424C = 1; + suggestInstructions(); + } + } + Scene::dispatch(); +} + +void Scene1337::actionDisplay(int resNum, int lineNum, int x, int y, int arg5, int width, int textMode, int fontNum, int colFG, int colBGExt, int colFGExt) { + // TODO: Check if it's normal that arg5 is unused and replaced by an hardcoded 0 value + // May hide an original bug + + SceneItem::display(resNum, lineNum, SET_X, x, SET_Y, y, SET_KEEP_ONSCREEN, 0, SET_WIDTH, width, SET_POS_MODE, -1, SET_TEXT_MODE, textMode, SET_FONT, fontNum, SET_FG_COLOR, colFG, SET_EXT_BGCOLOR, colBGExt, SET_EXT_FGCOLOR, colFGExt, LIST_END); +} + +void Scene1337::setAnimationInfo(unkObj1337sub1 *subObj) { + if (!subObj) + return; + + if (subObj->_field34 > 9) { + if (subObj->_field34 > 25) { + subObj->_object1.setStrip2(4); + subObj->_object1.setFrame(subObj->_field34 - 25); + } else { + subObj->_object1.setStrip2(3); + subObj->_object1.setFrame(subObj->_field34 - 9); + } + } else { + subObj->_object1.setStrip2(2); + subObj->_object1.setFrame(subObj->_field34); + } + + subObj->_object1.show(); + R2_GLOBALS._sceneObjects->draw(); +} + +void Scene1337::subC20E5() { + subC2586(); +} + +void Scene1337::subC20F9() { + switch (_field424A) { + case -1: + ++_field423E; + if (_field423E == 3) + _field423E = 0; + + if (_field4244 == 1) { + _object1.show(); + switch (_field423E) { + case 0: + _object1.setStrip(3); + break; + case 1: + _object1.setStrip(4); + break; + case 2: + subD1975(174, 107); + _object1.setStrip(1); + break; + case 3: + subC4CEC(); + _object1.setStrip(2); + break; + default: + break; + } + + if (!_autoplay) + _unkFctPtr412 = &Scene1337::subC20E5; + else + subC20E5(); + } else { + subC20E5(); + } + break; + case 0: + _aSound2.play(62); + actionDisplay(1330, 135, 159, 10, 1, 200, 0, 7, 0, 154, 154); + actionDisplay(1330, 121, 20, 99, 1, 136, 0, 7, 0, 172, 172); + actionDisplay(1330, 122, 300, 99, 1, 136, 0, 7, 0, 117, 117); + R2_GLOBALS._sceneObjects->draw(); + actionDisplay(1330, 123, 159, 134, 1, 200, 0, 7, 0, 105, 105); + break; + case 1: + _aSound2.play(62); + actionDisplay(1330, 151, 300, 99, 1, 136, 0, 7, 0, 117, 117); + actionDisplay(1330, 118, 20, 99, 1, 136, 0, 7, 0, 172, 172); + actionDisplay(1330, 119, 159, 10, 1, 200, 0, 7, 0, 154, 154); + R2_GLOBALS._sceneObjects->draw(); + actionDisplay(1330, 120, 159, 134, 1, 200, 0, 7, 0, 105, 105); + break; + case 2: + _aSound2.play(62); + actionDisplay(1330, 134, 159, 134, 1, 200, 0, 7, 0, 105, 105); + actionDisplay(1330, 124, 20, 99, 1, 136, 0, 7, 0, 172, 172); + actionDisplay(1330, 126, 159, 10, 1, 200, 0, 7, 0, 154, 154); + R2_GLOBALS._sceneObjects->draw(); + actionDisplay(1330, 125, 300, 99, 1, 136, 0, 7, 0, 117, 117); + break; + case 3: + _aSound2.play(62); + actionDisplay(1330, 150, 20, 99, 1, 136, 0, 7, 0, 172, 172); + actionDisplay(1330, 115, 300, 99, 1, 136, 0, 7, 0, 117, 117); + actionDisplay(1330, 116, 159, 10, 1, 200, 0, 7, 0, 154, 154); + R2_GLOBALS._sceneObjects->draw(); + actionDisplay(1330, 117, 159, 134, 1, 200, 0, 7, 0, 105, 105); + break; + default: + break; + } + + if (_field424A != -1) + R2_GLOBALS._sceneManager.changeScene(125); + +} + +void Scene1337::subC2586() { + if (_field4244 != 0) + _object1.hide(); + + switch (_field423E) { + case 2: + subC4CD2(); + if (_field4246 == 1) + actionDisplay(1330, 114, 159, 10, 1, 200, 0, 7, 0, 154, 154); + _field4246 = 0; + // No break on purpose + case 0: + // No break on purpose + case 1: + // No break on purpose + case 3: + _item1.setAction(&_action4); + default: + break; + } + + _field4244 = 1; + +} + +bool Scene1337::subC264B(int arg1) { + switch (arg1) { + case 10: + // No break on purpose + case 12: + // No break on purpose + case 15: + // No break on purpose + case 17: + // No break on purpose + case 18: + // No break on purpose + case 19: + // No break on purpose + case 20: + // No break on purpose + case 21: + return true; + default: + return false; + } +} + +bool Scene1337::subC2687(int arg1) { + switch (arg1) { + case 11: + // No break on purpose + case 14: + // No break on purpose + case 16: + // No break on purpose + case 24: + return true; + default: + return false; + } +} + +int Scene1337::subC26CB(int arg1, int arg2) { + if ((_arrunkObj1337[arg1]._arr1[arg2]._field34 > 1) && (_arrunkObj1337[arg1]._arr1[arg2]._field34 <= 9)) { + return arg2; + } + + return -1; +} + +int Scene1337::subC2719(int arg1) { + for (int i = 0; i <= 3; i++) { + if (_arrunkObj1337[arg1]._arr1[i]._field34 == 1) + return i; + } + + return -1; +} + +int Scene1337::subC274D(int arg1) { + for (int i = 0; i <= 3; i++) { + if (_arrunkObj1337[arg1]._arr1[i]._field34 == 13) + return i; + } + + return -1; +} + +int Scene1337::subC2781(int arg1) { + for (int i = 0; i <= 3; i++) { + if (_arrunkObj1337[arg1]._arr1[i]._field34 == 25) + return i; + } + + return -1; +} + +int Scene1337::subC27B5(int arg1) { + switch (arg1) { + case 11: + // No break on purpose + case 14: + // No break on purpose + case 16: + // No break on purpose + case 24: + return arg1; + break; + default: + return -1; + break; + } +} + +int Scene1337::subC27F9(int arg1) { + switch (arg1) { + case 10: + // No break on purpose + case 12: + // No break on purpose + case 15: + // No break on purpose + case 17: + // No break on purpose + case 18: + // No break on purpose + case 19: + // No break on purpose + case 20: + // No break on purpose + case 21: + return arg1; + default: + return -1; + } +} + +void Scene1337::subC2835(int arg1) { + int i; + bool found = false; + switch (arg1) { + case 0: + for (i = 0; i <= 3; i++) { + if (subC27F9(_arrunkObj1337[arg1]._arr1[i]._field34) != -1) { + found = true; + break; + } + } + + if (found) + break; + + for (i = 0; i <= 3; i++) { + if (subC27B5(_arrunkObj1337[arg1]._arr1[i]._field34) != -1) { + found = true; + break; + } + } + + if (found) + break; + + for (i = 0; i <= 3; i++) { + if ((_arrunkObj1337[arg1]._arr1[i]._field34 > 1) && (_arrunkObj1337[arg1]._arr1[i]._field34 <= 9)) { + found = true; + break; + } + } + + if (found) + break; + + for (i = 0; i <= 3; i++) { + if ((_arrunkObj1337[arg1]._arr1[i]._field34 >= 26) && (_arrunkObj1337[arg1]._arr1[i]._field34 <= 33)) { + found = true; + break; + } + } + + if (found) + break; + + for (i = 0; i <= 3; i++) { + if (_arrunkObj1337[arg1]._arr1[i]._field34 == 1) { + found = true; + break; + } + } + + if (found) + break; + + for (i = 0; i <= 3; i++) { + if (_arrunkObj1337[arg1]._arr1[i]._field34 == 25) { + found = true; + break; + } + } + + if (found) + break; + + for (i = 0; i <= 3; i++) { + if (_arrunkObj1337[arg1]._arr1[i]._field34 == 13) { + found = true; + break; + } + } + break; + case 1: + for (i = 0; i <= 3; i++) { + if ((_arrunkObj1337[arg1]._arr1[i]._field34 >= 26) && (_arrunkObj1337[arg1]._arr1[i]._field34 <= 33)) { + found = true; + break; + } + } + + if (found) + break; + + for (i = 0; i <= 3; i++) { + if (_arrunkObj1337[arg1]._arr1[i]._field34 == 1) { + found = true; + break; + } + } + + if (found) + break; + + for (i = 0; i <= 3; i++) { + if ((_arrunkObj1337[arg1]._arr1[i]._field34 > 1) && (_arrunkObj1337[arg1]._arr1[i]._field34 <= 9)) { + found = true; + break; + } + } + + if (found) + break; + + for (i = 0; i <= 3; i++) { + if (subC27F9(_arrunkObj1337[arg1]._arr1[i]._field34) != -1) { + found = true; + break; + } + } + + if (found) + break; + + for (i = 0; i <= 3; i++) { + if (subC27B5(_arrunkObj1337[arg1]._arr1[i]._field34) != -1) { + found = true; + break; + } + } + + if (found) + break; + + for (i = 0; i <= 3; i++) { + if (_arrunkObj1337[arg1]._arr1[i]._field34 == 25) { + found = true; + break; + } + } + + if (found) + break; + + for (i = 0; i <= 3; i++) { + if (_arrunkObj1337[arg1]._arr1[i]._field34 == 13) { + found = true; + break; + } + } + + break; + default: + return; + } + + subC4A39(&_arrunkObj1337[arg1]._arr1[i]); +} + +bool Scene1337::subC2BF8(unkObj1337sub1 *subObj1, Common::Point pt) { + if ((subObj1->_field36.x > pt.x) || (subObj1->_field36.x + 24 < pt.x)) + return false; + + if ((subObj1->_field36.y > pt.y) || (subObj1->_field36.y + 24 < pt.y)) + return false; + + return true; +} + +void Scene1337::subC2C2F() { + bool found = true; + + if (_arrunkObj1337[3]._arr3[0]._field34 != 0) { + switch (_arrunkObj1337[3]._arr3[0]._field34) { + case 10: + // No break on purpose + case 12: + // No break on purpose + case 15: + // No break on purpose + case 17: + // No break on purpose + case 18: + // No break on purpose + case 19: + // No break on purpose + case 20: + // No break on purpose + case 21: + subC4A39(&_arrunkObj1337[3]._arr3[0]); + found = false; + break; + default: + found = false; + int i; + for (i = 0; i <= 3; i++) { + if (subC3386(_arrunkObj1337[3]._arr3[0]._field34, _arrunkObj1337[3]._arr1[i]._field34)) { + found = true; + break; + } + } + + if (found) { + found = false; + subC34A1(&_arrunkObj1337[3]._arr1[i], &_arrunkObj1337[3]._arr3[0]); + } + break; + } + } + + if (!found) + return; + + int randIndx = R2_GLOBALS._randomSource.getRandomNumber(3); + + if (_arrunkObj1337[3]._arr1[randIndx]._field34 == 1) { + found = false; + + for (int i = 0; i <= 7; i++) { + if ((_arrunkObj1337[3]._arr2[i]._field34 == 0) && (!subC2687(_arrunkObj1337[3]._arr3[0]._field34))) { + subC340B(&_arrunkObj1337[3]._arr1[randIndx], &_arrunkObj1337[3]._arr2[i]); + found = true; + break; + } + } + + if (found) { + return; + } + } else if (_arrunkObj1337[3]._arr1[randIndx]._field34 <= 9) { + found = false; + + for (int i = 0; i <= 7; i++) { + if (_arrunkObj1337[3]._arr2[i]._field34 == _arrunkObj1337[3]._arr1[randIndx]._field34) { + found = true; + break; + } + } + + if (!found) { + for (int i = 0; i <= 7; i++) { + if ((_arrunkObj1337[3]._arr2[i]._field34 == 1) && (!subC2687(_arrunkObj1337[3]._arr3[i]._field34))) { + int tmpVal = 0; + + for (int j = 0; j <= 7; j++) { + if ((_arrunkObj1337[3]._arr2[j]._field34 > 1) && (_arrunkObj1337[3]._arr2[j]._field34 <= 9)) + ++tmpVal; + } + + if (tmpVal == 7) + _field424A = 3; + + subC33C0(&_arrunkObj1337[3]._arr1[randIndx], &_arrunkObj1337[3]._arr2[i]); + found = true; + break; + } + } + if (found) + return; + } + } else if (_arrunkObj1337[3]._arr1[randIndx]._field34 == 13) { + int tmpVal = subC331B(3); + + if (tmpVal != -1) { + subC358E(&_arrunkObj1337[3]._arr1[randIndx], tmpVal); + return; + } + } else if (_arrunkObj1337[3]._arr1[randIndx]._field34 == 25) { + int tmpVal = -1; + found = false; + int tmpRandIndx = R2_GLOBALS._randomSource.getRandomNumber(3); + + for (int i = 0; i <= 3; i++) { + if ( (tmpRandIndx != 3) + && ( (_arrunkObj1337[tmpRandIndx]._arr1[0]._field34 != 0) + || (_arrunkObj1337[tmpRandIndx]._arr1[1]._field34 != 0) + || (_arrunkObj1337[tmpRandIndx]._arr1[2]._field34 != 0) + || (_arrunkObj1337[tmpRandIndx]._arr1[3]._field34 != 0) )) { + tmpVal = tmpRandIndx; + break; + } + + ++tmpRandIndx; + if (tmpRandIndx > 3) + tmpRandIndx = 0; + } + + if (tmpVal != -1) { + subC318B(3, &_arrunkObj1337[3]._arr1[randIndx], tmpVal); + return; + } + } else { + switch (_arrunkObj1337[3]._arr1[randIndx]._field34) { + case 10: + // No break on purpose + case 11: + // No break on purpose + case 12: + // No break on purpose + case 14: + // No break on purpose + case 15: + // No break on purpose + case 16: + // No break on purpose + case 17: + // No break on purpose + case 18: + // No break on purpose + case 19: + // No break on purpose + case 20: + // No break on purpose + case 21: + // No break on purpose + case 24: { + int tmpVal = -1; + int tmpRandIndx = R2_GLOBALS._randomSource.getRandomNumber(3); + + for (int i = 0; i <= 3; i++) { + if (tmpRandIndx != 3) { + // The variables 'i' and 'j' are not used in the inner code of the loop. + // It's understandable for 'i', which helps making sure that tmpVal is used properly, + // but it's suspect for j + for (int j = 0; j <= 7; j++) { + if ((_arrunkObj1337[tmpRandIndx]._arr3[0]._field34 == 0) && (subC32B1(tmpRandIndx, _arrunkObj1337[3]._arr1[randIndx]._field34))) { + tmpVal = j; + } + } + } + + ++tmpRandIndx; + if (tmpRandIndx > 3) + tmpRandIndx = 0; + + if (tmpVal != -1) + break; + } + + if (tmpVal != -1) { + // Useless second identical check skipped + subC3456(&_arrunkObj1337[3]._arr1[randIndx], &_arrunkObj1337[tmpVal]._arr3[0]); + return; + } + } + default: + break; + } + } + + subC4A39(&_arrunkObj1337[3]._arr1[randIndx]); +} + +void Scene1337::subC318B(int arg1, unkObj1337sub1 *subObj1, int arg3) { + _field4240 = arg1; + _field4242 = arg3; + + int randIndx; + + for (;;) { + randIndx = R2_GLOBALS._randomSource.getRandomNumber(3); + if (_arrunkObj1337[arg3]._arr1[randIndx]._field34 != 0) + break; + } + + _field3EF0 = subObj1; + _field3EF4 = &_arrunkObj1337[arg3]._arr4[0]; + _field3EF8 = &_arrunkObj1337[arg3]._arr1[randIndx]; + + _item1.setAction(&_action11); +} + +int Scene1337::subC3257(int arg1) { + int retVal; + + switch (arg1) { + case 10: + retVal = 2; + break; + case 12: + retVal = 3; + break; + case 15: + retVal = 5; + break; + case 17: + retVal = 9; + break; + case 18: + retVal = 6; + break; + case 19: + retVal = 4; + break; + case 20: + retVal = 8; + break; + case 21: + retVal = 7; + break; + default: + retVal = -1; + } + + return retVal; +} + +bool Scene1337::subC32B1(int arg1, int arg2) { + for (int i = 0; i <= 7; i++) { + if (_arrunkObj1337[arg1]._arr2[i]._field34 != 0) { + int tmpVal = subC3257(arg2); + if (tmpVal == _arrunkObj1337[arg1]._arr2[i]._field34) + return false; + } + } + return true; +} + +int Scene1337::subC331B(int arg1) { + int randIndx = R2_GLOBALS._randomSource.getRandomNumber(3); + + for (int i = 0; i <= 3; i++) { + if (randIndx != arg1) { + for (int j = 0; j <= 7; j++) { + if (_arrunkObj1337[randIndx]._arr2[j]._field34 != 0) + return randIndx; + } + } + + if (arg1 == 1) { + randIndx--; + if (randIndx < 0) + randIndx = 3; + } else { + ++randIndx; + if (randIndx > 3) + randIndx = 0; + } + } + + return -1; +} + +bool Scene1337::subC3386(int arg1, int arg2) { + if ((arg1 == 11) && (arg2 == 26)) + return true; + + if ((arg1 == 14) && (arg2 == 30)) + return true; + + if ((arg1 == 16) && (arg2 == 32)) + return true; + + if ((arg1 == 24) && (arg2 == 28)) + return true; + + return false; +} + +void Scene1337::subC33C0(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) { + _field3EF4 = subObj2; + _field3EF0 = subObj1; + _item1.setAction(&_action7); +} + +int Scene1337::subC3E92(int arg1) { + if ( (_arrunkObj1337[arg1]._arr1[0]._field34 == 0) + && (_arrunkObj1337[arg1]._arr1[1]._field34 == 0) + && (_arrunkObj1337[arg1]._arr1[2]._field34 == 0) + && (_arrunkObj1337[arg1]._arr1[3]._field34 == 0)) + return -1; + + int randIndx; + for (;;) { + randIndx = R2_GLOBALS._randomSource.getRandomNumber(3); + if (_arrunkObj1337[arg1]._arr1[randIndx]._field34 == 0) + break; + } + + return randIndx; +} + +void Scene1337::subC340B(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) { + _field3EF0 = subObj1; + _field3EF4 = subObj2; + + _item1.setAction(&_action6); +} + +void Scene1337::subC3456(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) { + _field3EF0 = subObj1; + _field3EF4 = subObj2; + + _item1.setAction(&_action9); +} + +void Scene1337::subC34A1(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) { + _field3EF0 = subObj1; + _field3EF4 = subObj2; + + _item1.setAction(&_action8); +} + +Scene1337::unkObj1337sub1 *Scene1337::subC34EC(int arg1) { + for (int i = 0; i <= 7; i++) { + if (_arrunkObj1337[arg1]._arr2[i]._field34 == 1) { + return &_arrunkObj1337[arg1]._arr2[i]; + } + } + + for (int i = 0; i <= 7; i++) { + if ((_arrunkObj1337[arg1]._arr2[i]._field34 != 0) && (_arrunkObj1337[arg1]._arr2[i]._field34 < 10)) { + return &_arrunkObj1337[arg1]._arr2[i]; + } + } + + return NULL; +} + +void Scene1337::subC358E(unkObj1337sub1 *subObj1, int arg2) { + _field3EF0 = subObj1; + _field3EF4 = subC34EC(arg2); + _field3EF8 = &_arrunkObj1337[arg2]._arr4[0]; + _field4240 = arg2; + _item1.setAction(&_action10); +} + +void Scene1337::subC4A39(unkObj1337sub1 *subObj) { + _field3EF0 = subObj; + + _item1.setAction(&_action5); +} + +void Scene1337::subC4CD2() { + if (R2_GLOBALS._v57709 > 0) { + subD1917(); + subD1940(false); + } +} + +void Scene1337::subC4CEC() { + if (R2_GLOBALS._v57709 != 0) + return; + + subD18F5(); + subD1940(1); +} + +void Scene1337::subC51A0(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) { + _field3EF0 = subObj1; + _field3EF4 = subObj2; + + _item1.setAction(&_action13); +} + +void Scene1337::displayDialog(int dialogNumb) { + switch (dialogNumb - 1) { + case 0: + actionDisplay(1330, 53, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 1: + actionDisplay(1330, 57, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 2: + actionDisplay(1330, 58, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 3: + actionDisplay(1330, 59, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 4: + actionDisplay(1330, 60, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 5: + actionDisplay(1330, 61, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 6: + actionDisplay(1330, 62, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 7: + actionDisplay(1330, 63, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 8: + actionDisplay(1330, 64, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 9: + actionDisplay(1330, 65, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 10: + actionDisplay(1330, 67, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 11: + actionDisplay(1330, 69, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 12: + actionDisplay(1330, 71, 159, 10, 1, 200, 0, 7, 0, 154, 154); + actionDisplay(1330, 72, 159, 10, 1, 200, 0, 7, 0, 154, 154); + actionDisplay(1330, 73, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 13: + actionDisplay(1330, 79, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 14: + actionDisplay(1330, 81, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 15: + actionDisplay(1330, 83, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 16: + actionDisplay(1330, 85, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 17: + actionDisplay(1330, 87, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 18: + actionDisplay(1330, 89, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 19: + actionDisplay(1330, 91, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 20: + actionDisplay(1330, 93, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 23: + actionDisplay(1330, 95, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 24: + actionDisplay(1330, 97, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 25: + actionDisplay(1330, 104, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 26: + actionDisplay(1330, 105, 159, 10, 1, 200, 0, 7, 0, 154, 154); + actionDisplay(1330, 106, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 27: + actionDisplay(1330, 110, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 28: + actionDisplay(1330, 108, 159, 10, 1, 200, 0, 7, 0, 154, 154); + actionDisplay(1330, 109, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 29: + actionDisplay(1330, 111, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 31: + actionDisplay(1330, 112, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + default: + break; + } +} + +void Scene1337::subPostInit() { + R2_GLOBALS._v57709 = 0; + R2_GLOBALS._v5780C = 0; + subD183F(1, 0); + subD1940(true); + subD18F5(); + +// loadScene(1330); +// SceneExt::postInit(); + + R2_GLOBALS._scenePalette.addRotation(224, 235, 1); + + _field3E28[0] = 1; + _field3E28[1] = 1; + _field3E28[2] = 1; + _field3E28[3] = 1; + _field3E28[4] = 1; + _field3E28[5] = 1; + _field3E28[6] = 1; + _field3E28[7] = 1; + _field3E28[8] = 26; + _field3E28[9] = 2; + _field3E28[10] = 2; + _field3E28[11] = 2; + _field3E28[12] = 2; + _field3E28[13] = 2; + _field3E28[14] = 26; + _field3E28[15] = 3; + _field3E28[16] = 3; + _field3E28[17] = 3; + _field3E28[18] = 3; + _field3E28[19] = 3; + _field3E28[20] = 28; + _field3E28[21] = 4; + _field3E28[22] = 4; + _field3E28[23] = 4; + _field3E28[24] = 4; + _field3E28[25] = 4; + _field3E28[26] = 28; + _field3E28[27] = 5; + _field3E28[28] = 5; + _field3E28[29] = 5; + _field3E28[30] = 5; + _field3E28[31] = 5; + _field3E28[32] = 30; + _field3E28[33] = 6; + _field3E28[34] = 6; + _field3E28[35] = 6; + _field3E28[36] = 6; + _field3E28[37] = 6; + _field3E28[38] = 30; + _field3E28[39] = 7; + _field3E28[40] = 7; + _field3E28[41] = 7; + _field3E28[42] = 7; + _field3E28[43] = 7; + _field3E28[44] = 32; + _field3E28[45] = 8; + _field3E28[46] = 8; + _field3E28[47] = 8; + _field3E28[48] = 8; + _field3E28[49] = 8; + _field3E28[50] = 32; + _field3E28[51] = 9; + _field3E28[52] = 9; + _field3E28[53] = 9; + _field3E28[54] = 9; + _field3E28[55] = 9; + _field3E28[56] = 10; + _field3E28[57] = 11; + _field3E28[58] = 12; + _field3E28[59] = 13; + _field3E28[60] = 13; + _field3E28[61] = 14; + _field3E28[62] = 15; + _field3E28[63] = 16; + _field3E28[64] = 17; + _field3E28[65] = 18; + _field3E28[66] = 19; + _field3E28[67] = 20; + _field3E28[68] = 21; + _field3E28[69] = 26; + _field3E28[70] = 28; + _field3E28[71] = 24; + _field3E28[72] = 25; + _field3E28[73] = 25; + _field3E28[74] = 25; + _field3E28[75] = 25; + _field3E28[76] = 26; + _field3E28[77] = 26; + _field3E28[78] = 26; + _field3E28[79] = 27; + _field3E28[80] = 27; + _field3E28[81] = 28; + _field3E28[82] = 28; + _field3E28[83] = 28; + _field3E28[84] = 29; + _field3E28[85] = 29; + _field3E28[86] = 29; + _field3E28[87] = 30; + _field3E28[88] = 30; + _field3E28[89] = 30; + _field3E28[90] = 30; + _field3E28[91] = 32; + _field3E28[92] = 1; + _field3E28[93] = 32; + _field3E28[94] = 32; + _field3E28[95] = 32; + _field3E28[96] = 1; + _field3E28[97] = 1; + _field3E28[98] = 1; + _field3E28[99] = 0; + + _field3E24 = 98; + _field3E26 = 98; + + _item7._field34 = 0; + _item7._field36 = Common::Point(128, 95); + + _item8._field34 = 0; + _item8._field36 = Common::Point(162, 95); + + _item6._field34 = 0; + + _item2._object1.postInit(); + _item2._object1.setVisage(1332); + _item2._object1.setStrip(5); + _item2._object1.setFrame(1); + _item2._object1._moveDiff = Common::Point(10, 10); + _item2._object1.fixPriority(400); + _item2._object1.setPosition(Common::Point(128, 95), 0); + _item2._object1.animate(ANIM_MODE_2, NULL); + _item2._object1.hide(); + + _object1.postInit(); + _object1.setVisage(1334); + _object1.setStrip(1); + _object1.setFrame(1); + _object1._numFrames = 12; + _object1.fixPriority(500); + _object1.setPosition(Common::Point(174, 107), 0); + _object1.animate(ANIM_MODE_2, NULL); + _object1.hide(); + + _field4244 = 1; + _field4246 = 0; + _field4248 = 0; + _field424A = -1; + + _background1.setup2(9531, 1, 1, 249, 168, 155, 0); + + _autoplay = false; + _field424C = 0; + _field424E = 0; +} + +void Scene1337::suggestInstructions() { + if (R2_GLOBALS._v57709 > 0) + subD1917(); + if (MessageDialog::show(NEED_INSTRUCTIONS, NO_MSG, YES_MSG) == 0) { + if (R2_GLOBALS._v57709 == 0) + subD18F5(); + subCCF26(); + } else { + if (R2_GLOBALS._v57709 == 0) + subD18F5(); + subCB59B(); + } +} + +void Scene1337::subCB59B() { + _item1.setAction(&_action1); +} + +void Scene1337::shuffleCards() { + R2_GLOBALS._sceneObjects->draw(); + + for (int i = 0; i <= 98; i++) { + if (_field3E28[i] == 0) { + for (int j = i + 1; j <= 98; j ++) { + if (_field3E28[j] != 0) { + _field3E28[i] = _field3E28[j]; + _field3E28[j] = 0; + break; + } + } + } + } + + for (int i = 0; i <= 99; i ++) { + if (_field3E28[i] == 0) { + _field3E24 = i - 1; + _field3E26 = 98; + break; + } + } + + // tmpVal is never modified in the original. It looks weird but it works: at the end, the cards are suffled! + int tmpVal = 0; + int randIndx; + int swap; + for (int i = 0; i < 2000; i ++) { + randIndx = R2_GLOBALS._randomSource.getRandomNumber(_field3E24); + swap = _field3E28[tmpVal]; + _field3E28[tmpVal] = _field3E28[randIndx]; + _field3E28[randIndx] = swap; + } + + _field423C = 0; + _item2._object1.setAction(&_action2); + + while(_field423C == 0) { + g_globals->_scenePalette.signalListeners(); + R2_GLOBALS._sceneObjects->draw(); + warning("TODO: recurse on draw() and on signalListeners()?"); + g_globals->_events.delay(g_globals->_sceneHandler->_delayTicks); + + // Hack to avoid eternal loop + // To be removed when the recurse is working properly + _field423C = 1; + } +} + +void Scene1337::subCCF26() { + _item2._object1._moveDiff = Common::Point(30, 30); + shuffleCards(); + _item1.setAction(&_action3); +} +void Scene1337::subCD193() { + warning("STUBBED: subCD193()"); +} + +void Scene1337::subCDB90(int arg1, Common::Point pt) { + bool found = false; + int curReg = R2_GLOBALS._sceneRegions.indexOf(g_globals->_events._mousePos); + + if (arg1 == 3) { + int i; + for (i = 0; i <= 7; i++) { + if ( (subC2BF8(&_arrunkObj1337[2]._arr2[i], pt)) + || (subC2BF8(&_arrunkObj1337[0]._arr2[i], pt)) + || (subC2BF8(&_arrunkObj1337[1]._arr2[i], pt)) + || (subC2BF8(&_arrunkObj1337[3]._arr2[i], pt)) ) { + found = true; + break; + } + } + + if (found) { + switch (curReg) { + case 5: + if (_arrunkObj1337[2]._arr2[i]._field34 != 0) + displayDialog(_arrunkObj1337[2]._arr2[i]._field34); + else + actionDisplay(1330, 20, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 10: + if (_arrunkObj1337[3]._arr2[i]._field34 != 0) + displayDialog(_arrunkObj1337[3]._arr2[i]._field34); + else + actionDisplay(1330, 22, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 15: + if (_arrunkObj1337[0]._arr2[i]._field34 != 0) + displayDialog(_arrunkObj1337[0]._arr2[i]._field34); + else + actionDisplay(1330, 21, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 20: + if (_arrunkObj1337[1]._arr2[i]._field34 != 0) + displayDialog(_arrunkObj1337[1]._arr2[i]._field34); + else + actionDisplay(1330, 23, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + default: + break; + } + } else { + if ( (subC2BF8(&_arrunkObj1337[2]._arr3[0], pt)) + || (subC2BF8(&_arrunkObj1337[0]._arr3[0], pt)) + || (subC2BF8(&_arrunkObj1337[1]._arr3[0], pt)) + || (subC2BF8(&_arrunkObj1337[3]._arr3[0], pt)) ) { + found = true; + } + + if (found) { + switch (curReg) { + case 5: + if (_arrunkObj1337[2]._arr3[0]._field34 != 0) + displayDialog(_arrunkObj1337[2]._arr3[0]._field34); + else + actionDisplay(1330, 10, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 10: + if (_arrunkObj1337[3]._arr3[0]._field34 != 0) + displayDialog(_arrunkObj1337[3]._arr3[0]._field34); + else + actionDisplay(1330, 16, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 15: + if (_arrunkObj1337[0]._arr3[0]._field34 != 0) + displayDialog(_arrunkObj1337[3]._arr3[0]._field34); + else + actionDisplay(1330, 13, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 20: + if (_arrunkObj1337[1]._arr3[0]._field34 != 0) + displayDialog(_arrunkObj1337[1]._arr3[0]._field34); + else + actionDisplay(1330, 18, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + default: + break; + } + } else { + if (subC2BF8(&_item7, pt)) { + if (_item7._field34 != 0) + displayDialog(_item7._field34); + else + actionDisplay(1330, 7, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else if (_background1._bounds.contains(pt)) { + actionDisplay(1330, 43, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else if (subC2BF8(&_item8, pt)) { + actionDisplay(1330, 4, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else if ( (subC2BF8(&_arrunkObj1337[2]._arr4[0], pt)) + || (subC2BF8(&_arrunkObj1337[3]._arr4[0], pt)) + || (subC2BF8(&_arrunkObj1337[0]._arr4[0], pt)) + || (subC2BF8(&_arrunkObj1337[1]._arr4[0], pt)) ) { + actionDisplay(1330, 32, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else { + if (subC2BF8(&_arrunkObj1337[2]._arr1[0], pt)) + displayDialog(_arrunkObj1337[2]._arr1[0]._field34); + else if (subC2BF8(&_arrunkObj1337[2]._arr1[1], pt)) + displayDialog(_arrunkObj1337[2]._arr1[1]._field34); + else if (subC2BF8(&_arrunkObj1337[2]._arr1[2], pt)) + displayDialog(_arrunkObj1337[2]._arr1[2]._field34); + else if (subC2BF8(&_arrunkObj1337[2]._arr1[3], pt)) + displayDialog(_arrunkObj1337[2]._arr1[3]._field34); + else if ((curReg >= 6) || (curReg <= 9)) + actionDisplay(1330, 29, 159, 10, 1, 200, 0, 7, 0, 154, 154); + else if ((curReg >= 11) || (curReg <= 14)) + actionDisplay(1330, 31, 159, 10, 1, 200, 0, 7, 0, 154, 154); + else if ((curReg >= 16) || (curReg <= 19)) + actionDisplay(1330, 30, 159, 10, 1, 200, 0, 7, 0, 154, 154); + else { + switch (curReg) { + case 0: + actionDisplay(1330, 2, 159, 134, 1, 200, 0, 7, 0, 105, 105); + break; + case 5: + actionDisplay(1330, 25, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 10: + actionDisplay(1330, 27, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 15: + actionDisplay(1330, 26, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 20: + actionDisplay(1330, 28, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 21: + actionDisplay(1330, 24, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + default: + break; + } + } + } + } + } + } + + if (arg1 != 1) + return; + + for (int i = 0; i <= 7; i++) { + if (subC2BF8(&_arrunkObj1337[2]._arr2[i], pt)) { + switch (_arrunkObj1337[2]._arr2[i]._field34) { + case 0: + actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 1: + actionDisplay(1330, 54, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + default: + actionDisplay(1330, 34, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + } + found = true; + break; + } else if (subC2BF8(&_arrunkObj1337[0]._arr2[i], pt)) { + switch (_arrunkObj1337[0]._arr2[i]._field34) { + case 0: + actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + default: + actionDisplay(1330, 1, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + } + found = true; + break; + } else if (subC2BF8(&_arrunkObj1337[1]._arr2[i], pt)) { + switch (_arrunkObj1337[1]._arr2[i]._field34) { + case 0: + actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117); + break; + default: + actionDisplay(1330, 144, 300, 99, 1, 136, 0, 7, 0, 117, 117); + break; + } + found = true; + break; + } else if (subC2BF8(&_arrunkObj1337[3]._arr2[i], pt)) { + switch (_arrunkObj1337[3]._arr2[i]._field34) { + case 0: + actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172); + break; + default: + actionDisplay(1330, 145, 20, 99, 1, 136, 0, 7, 0, 172, 172); + break; + } + found = true; + break; + } + } + + if (subC2BF8(&_arrunkObj1337[2]._arr3[0], pt)) { + if (_arrunkObj1337[0]._arr3[0]._field34 != 0) { + actionDisplay(1330, 39, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else { + actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } + found = true; + } + + if (subC2BF8(&_arrunkObj1337[3]._arr3[0], pt)) { + if (_arrunkObj1337[3]._arr3[0]._field34 != 0) { + actionDisplay(1330, 145, 20, 99, 1, 136, 0, 7, 0, 172, 172); + } else { + actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172); + } + found = true; + } + + if (subC2BF8(&_arrunkObj1337[1]._arr3[0], pt)) { + if (_arrunkObj1337[1]._arr3[0]._field34 != 0) { + actionDisplay(1330, 144, 300, 99, 1, 136, 0, 7, 0, 117, 117); + } else { + actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117); + } + found = true; + } + + if (subC2BF8(&_arrunkObj1337[0]._arr3[0], pt)) { + if (_arrunkObj1337[0]._arr3[0]._field34 != 0) { + actionDisplay(1330, 1, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else { + actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } + found = true; + } + + if (subC2BF8(&_arrunkObj1337[3]._arr4[0], pt)) { + actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172); + found = true; + } + + if (subC2BF8(&_arrunkObj1337[1]._arr4[0], pt)) { + actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117); + found = true; + } + + if (subC2BF8(&_arrunkObj1337[0]._arr4[0], pt)) { + actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154); + found = true; + } + + if (found) + return; + + if (_background1._bounds.contains(pt)) { + subCD193(); + return; + } + + if (subC2BF8(&_item7, pt)) + actionDisplay(1330, 9, 159, 10, 1, 200, 0, 7, 0, 154, 154); + else if (subC2BF8(&_item8, pt)) + actionDisplay(1330, 5, 159, 10, 1, 200, 0, 7, 0, 154, 154); + else { + switch (curReg) { + case 0: + actionDisplay(1330, 3, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 6: + // no break on purpose + case 7: + // no break on purpose + case 8: + // no break on purpose + case 9: + actionDisplay(1330, 145, 20, 99, 1, 136, 0, 7, 0, 172, 172); + break; + case 10: + actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172); + break; + case 11: + // no break on purpose + case 12: + // no break on purpose + case 13: + // no break on purpose + case 14: + actionDisplay(1330, 1, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 16: + // no break on purpose + case 17: + // no break on purpose + case 18: + // no break on purpose + case 19: + actionDisplay(1330, 144, 300, 99, 1, 136, 0, 7, 0, 117, 117); + break; + case 20: + actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117); + break; + default: + actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + } + } +} + +void Scene1337::subCF31D() { + int tmpVal = 1; + bool found; + int count; + + if (this->_arrunkObj1337[1]._arr3[0]._field34 != 0) { + switch (_arrunkObj1337[1]._arr3[0]._field34) { + case 10: + // No break on purpose + case 12: + // No break on purpose + case 15: + // No break on purpose + case 17: + // No break on purpose + case 18: + // No break on purpose + case 19: + // No break on purpose + case 20: + // No break on purpose + case 21: + tmpVal = 0; + subC4A39(&_arrunkObj1337[1]._arr3[0]); + break; + default: + found = false; + int i; + for (i = 0; i <= 3; i++) { + if (subC3386(_arrunkObj1337[1]._arr3[0]._field34, _arrunkObj1337[1]._arr1[i]._field34)) { + found = true; + break; + } + } + + if (found) { + tmpVal = 0; + subC34A1(&_arrunkObj1337[1]._arr1[i], &_arrunkObj1337[1]._arr3[0]); + } + } + } + + if (tmpVal != 1) + return; + + found = false; + for (int i = 0; i <= 3; i++) { + int tmpIndx = subC26CB(1, i); + if (tmpIndx == -1) + break; + + tmpVal = 0; + for (int j = 0; j <= 7; j++) { + if (_arrunkObj1337[1]._arr2[j]._field34 == _arrunkObj1337[1]._arr1[tmpIndx]._field34) { + tmpVal = 1; + break; + } + } + + if (tmpVal == 0) + break; + + for (int j = 0; j <= 7; j++) { + if (_arrunkObj1337[1]._arr2[j]._field34 == 1) { + if (!subC2687(_arrunkObj1337[1]._arr3[0]._field34)) { + count = 0; + for (int k = 0; k <= 7; k++) { + if ((_arrunkObj1337[1]._arr2[k]._field34 > 1) && (_arrunkObj1337[1]._arr2[k]._field34 <= 9)) + ++count; + } + + if (count == 7) + _field424A = 1; + + subC33C0(&_arrunkObj1337[1]._arr1[tmpIndx], &_arrunkObj1337[1]._arr2[j]); + found = true; + break; + } + } + } + } + + if (found) + return; + + tmpVal = subC2719(1); + if (tmpVal != -1) { + for (int i = 0; i <= 7; i++) { + if ((_arrunkObj1337[1]._arr2[i]._field34 == 0) && (!subC2687(_arrunkObj1337[1]._arr3[0]._field34))) { + subC340B(&_arrunkObj1337[1]._arr1[tmpVal], &_arrunkObj1337[1]._arr2[i]); + found = true; + } + } + } + + if (found) + return; + + tmpVal = subC274D(1); + int tmpVal2 = subC331B(1); + + if ((tmpVal != -1) && ( tmpVal2 != -1)) + subC358E(&_arrunkObj1337[1]._arr1[tmpVal], tmpVal2); + + if (found) + return; + + tmpVal = subC2781(1); + if (tmpVal != -1) { + count = -1; + int rndVal = R2_GLOBALS._randomSource.getRandomNumber(3); + for (int i = 0; i <= 3; i++) { + if (rndVal != 1) { + if ( (_arrunkObj1337[rndVal]._arr1[0]._field34 != 0) + || (_arrunkObj1337[rndVal]._arr1[1]._field34 != 0) + || (_arrunkObj1337[rndVal]._arr1[2]._field34 != 0) + || (_arrunkObj1337[rndVal]._arr1[3]._field34 == 0)) { + count = rndVal; + break; + } + + rndVal--; + if (rndVal < 0) + rndVal = 3; + } + } + + if (count != -1) { + subC318B(1, &_arrunkObj1337[1]._arr1[tmpVal], count); + found = true; + } + } + + if (found) + return; + + count = -1; + int i; + for (i = 0; i <= 3; i++) { + tmpVal = subC27B5(_arrunkObj1337[1]._arr1[i]._field34); + if (tmpVal != -1) { + int rndVal = R2_GLOBALS._randomSource.getRandomNumber(3); + + for (int j = 0; j <= 3; j++) { + if (tmpVal != 1) { + for (int k = 0; k <= 7; k++) { + // 'k' is not used in that loop. + // It looks suspicious. + if ((_arrunkObj1337[tmpVal]._arr3[0]._field34 == 0) && (subC32B1(tmpVal, _arrunkObj1337[1]._arr1[i]._field34))) { + count = tmpVal; + break; + } + } + } + + if (count != -1) { + found = true; + break; + } else { + rndVal--; + if (rndVal < 0) + rndVal = 3; + } + } + + if (found) + break; + } + } + + if (found) { + if (count == -1) + return; + + subC3456(&_arrunkObj1337[1]._arr1[i], &_arrunkObj1337[count]._arr3[0]); + } else { + int j; + for (j = 0; j <= 3; j++) { + if (subC27F9(_arrunkObj1337[1]._arr1[j]._field34) != -1) { + count = -1; + int rndVal = R2_GLOBALS._randomSource.getRandomNumber(3); + for (int l = 0; l <= 3; l++) { + if (rndVal != 1) { + for (int m = 0; m <= 7; m++) { + // 'm' is not used in that loop. It looks suspicious. + if ((_arrunkObj1337[rndVal]._arr3[0]._field34 == 0) && (_arrunkObj1337[1]._arr1[j]._field34 == 1)) { + count = rndVal; + break; + } + } + } + if (count != -1) { + found = true; + break; + } else { + rndVal--; + if (rndVal < 0) + rndVal = 3; + } + } + if (found) + break; + } + } + + if (found) { + if (count == -1) + return; + + subC3456(&_arrunkObj1337[1]._arr1[j], &_arrunkObj1337[count]._arr3[0]); + } else { + subC2835(1); + } + } + +} + +void Scene1337::subCF979() { + bool found = true; + + if (_arrunkObj1337[0]._arr3[0]._field34 != 0) { + switch (_arrunkObj1337[0]._arr3[0]._field34) { + case 10: + //No break on purpose + case 12: + //No break on purpose + case 15: + //No break on purpose + case 17: + //No break on purpose + case 18: + //No break on purpose + case 19: + //No break on purpose + case 20: + //No break on purpose + case 21: + subC4A39(&_arrunkObj1337[0]._arr3[0]); + found = false; + break; + default: + int i; + found = false; + + for (i = 0; i <= 3; i++) { + if (subC3386(_arrunkObj1337[0]._arr3[0]._field34, _arrunkObj1337[0]._arr1[i]._field34)) { + found = true; + break; + } + } + + if (found) { + found = false; + subC34A1(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[0]._arr3[0]); + } + break; + } + } + + if (found) + return; + + int tmpVal; + found = false; + for (int i = 0; i <= 3; i++) { + tmpVal = subC26CB(0, i); + + if (tmpVal != -1) { + bool flag = false;; + for (int j = 0; j <= 7; j++) { + if (_arrunkObj1337[0]._arr2[j]._field34 == _arrunkObj1337[0]._arr1[tmpVal]._field34) { + flag = true; + break; + } + } + + if (!flag) { + for (int j = 0; j <= 7; j++) { + if ((_arrunkObj1337[0]._arr2[j]._field34 == 1) && (!subC2687(_arrunkObj1337[0]._arr3[0]._field34))) { + int count = 0; + for (int k = 0; k <= 7; k++) { + if ((_arrunkObj1337[0]._arr2[k]._field34 > 1) && (_arrunkObj1337[0]._arr2[k]._field34 <= 9)) { + ++count; + } + } + + if (count == 7) + _field424A = 0; + + subC33C0(&_arrunkObj1337[0]._arr1[tmpVal], &_arrunkObj1337[0]._arr2[j]); + found = true; + } + } + } + } + + if (found) + break; + } + + if (found) + return; + + found = false; + tmpVal = subC2719(0); + + if (tmpVal != -1) { + for (int i = 0; i <= 7; i++) { + if ((_arrunkObj1337[0]._arr2[i]._field34 == 0) && (!subC2687(_arrunkObj1337[0]._arr3[0]._field34))) { + subC340B(&_arrunkObj1337[0]._arr1[tmpVal], &_arrunkObj1337[0]._arr2[i]); + found = true; + break; + } + } + } + + if (found) + return; + + tmpVal = subC274D(0); + if (tmpVal != -1) { + for (int i = 0; i <= 7; i++) { + if (_arrunkObj1337[2]._arr2[i]._field34 != 0) { + subC358E(&_arrunkObj1337[0]._arr1[tmpVal], 2); + found = true; + break; + } + } + } + + if (found) + return; + + tmpVal = subC2781(0); + if (tmpVal != -1) { + if ( (_arrunkObj1337[2]._arr1[0]._field34 != 0) + || (_arrunkObj1337[2]._arr1[1]._field34 != 0) + || (_arrunkObj1337[2]._arr1[2]._field34 != 0) + || (_arrunkObj1337[2]._arr1[3]._field34 != 0) ) { + subC318B(0, &_arrunkObj1337[0]._arr1[tmpVal], 2); + found = true; + } + } + + if (found) + return; + + for (int i = 0; i <= 3; i++) { + if (subC27B5(_arrunkObj1337[0]._arr1[i]._field34) != -1) { + // The variable 'j' is not used in the inner code of the loop. It's suspect + for (int j = 0; j <= 7; j++) { + if ((_arrunkObj1337[2]._arr3[0]._field34 == 0) && (subC32B1(2, _arrunkObj1337[0]._arr1[i]._field34))) { + subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[2]._arr3[0]); + found = true; + break; + } + } + + if (found) + break; + } + } + + if (found) + return; + + for (int i = 0; i <= 3; i++) { + if (subC27F9(_arrunkObj1337[0]._arr1[i]._field34) != -1) { + // The variable 'j' is not used in the inner code of the loop. It's suspect + for (int j = 0; j <= 7; j++) { + if ((_arrunkObj1337[2]._arr3[0]._field34 == 0) && (subC32B1(2, _arrunkObj1337[0]._arr1[i]._field34))) { + subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[2]._arr3[0]); + found = true; + } + } + + if (found) + break; + } + } + + if (found) + return; + + tmpVal = subC274D(0); + int tmpVal2 = subC331B(0); + + if ((tmpVal != -1) && (tmpVal2 != -1)) { + subC358E(&_arrunkObj1337[0]._arr1[tmpVal], tmpVal2); + found = true; + } + + if (found) + return; + + tmpVal = subC2781(0); + if (tmpVal != -1) { + if ( (_arrunkObj1337[1]._arr1[0]._field34 != 0) + || (_arrunkObj1337[1]._arr1[1]._field34 != 0) + || (_arrunkObj1337[1]._arr1[2]._field34 != 0) + || (_arrunkObj1337[1]._arr1[3]._field34 != 0) ) { + subC318B(0, &_arrunkObj1337[0]._arr1[tmpVal], 1); + found = true; + } + } + + if (found) + return; + + for (int i = 0; i <= 3; i++) { + tmpVal = subC27F9(_arrunkObj1337[0]._arr1[i]._field34); + if (tmpVal != -1) { + // The variable 'j' is not used in the inner code of the loop. It's suspect. + for (int j = 0; j <= 7; j++) { + if ((_arrunkObj1337[1]._arr3[0]._field34 == 0) && (subC32B1(1, _arrunkObj1337[0]._arr1[i]._field34))) { + subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[1]._arr3[0]); + found = true; + } + } + + if (!found) { + // The variable 'j' is not used in the inner code of the loop. It's suspect. + for (int j = 0; j <= 7; j++) { + if ((_arrunkObj1337[3]._arr3[0]._field34 == 0) && (subC32B1(3, _arrunkObj1337[0]._arr1[i]._field34))) { + subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[3]._arr3[0]); + found = true; + } + } + } + + if (found) + break; + } + } + + if (found) + return; + + for (int i = 0; i <= 3; i++) { + tmpVal = subC27B5(_arrunkObj1337[0]._arr1[i]._field34); + if (tmpVal != -1) { + // The variable 'j' is not used in the inner code of the loop. It's suspect. + for (int j = 0; j <= 7; j++) { + if ((_arrunkObj1337[1]._arr3[0]._field34 == 0) && (subC32B1(1, _arrunkObj1337[0]._arr1[i]._field34))) { + subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[1]._arr3[0]); + found = true; + } + } + + if (!found) { + // The variable 'j' is not used in the inner code of the loop. It's suspect. + for (int j = 0; j <= 7; j++) { + if ((_arrunkObj1337[3]._arr3[0]._field34 == 0) && (subC32B1(3, _arrunkObj1337[0]._arr1[i]._field34))) { + subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[3]._arr3[0]); + found = true; + } + } + } + + if (found) + break; + } + } + + if (found) + return; + + subC2835(0); +} + +void Scene1337::subD026D() { + subD02CA(); +} + +void Scene1337::subD0281() { + if (subC27F9(this->_arrunkObj1337[2]._arr3[0]._field34) == -1) + _unkFctPtr412 = &Scene1337::subD026D; + else + subC4A39(&_arrunkObj1337[2]._arr3[0]); +} + +void Scene1337::subD02CA() { + _item6._field36 = g_globals->_events._mousePos; + + if (R2_GLOBALS._v57810 == 200) { + int di; + for (di = 0; di < 4; di++) { + if ((subC2BF8(&_arrunkObj1337[2]._arr1[di], _item6._field36) != 0) && (_arrunkObj1337[2]._arr1[di]._field34 != 0)) { + _item6._field34 = _arrunkObj1337[2]._arr1[di]._field34; + _item6._field36 = _arrunkObj1337[2]._arr1[di]._field36; + // _item6._actorName = _arrunkObj1337[2]._arr1[di]._actorName; + _item6._fieldE = _arrunkObj1337[2]._arr1[di]._fieldE; + _item6._field10 = _arrunkObj1337[2]._arr1[di]._field10; + warning("_item6._field12 = _arrunkObj1337[2]._arr1[di]._field12;"); + warning("_item6._field14 = _arrunkObj1337[2]._arr1[di]._field14;"); + warning("_item6._field16 = _arrunkObj1337[2]._arr1[di]._field16;"); + _item6._sceneRegionId = _arrunkObj1337[2]._arr1[di]._sceneRegionId; + _item6._position = _arrunkObj1337[2]._arr1[di]._position; + _item6._yDiff = _arrunkObj1337[2]._arr1[di]._yDiff; + _item6._bounds = _arrunkObj1337[2]._arr1[di]._bounds; + _item6._resNum = _arrunkObj1337[2]._arr1[di]._resNum; + _item6._lookLineNum = _arrunkObj1337[2]._arr1[di]._lookLineNum; + _item6._talkLineNum = _arrunkObj1337[2]._arr1[di]._talkLineNum; + _item6._useLineNum = _arrunkObj1337[2]._arr1[di]._useLineNum; + _item6._action = _arrunkObj1337[2]._arr1[di]._action; + warning("_item6._field0 = _arrunkObj1337[2]._arr1[di]._field0;"); + _item6._object1._updateStartFrame = _arrunkObj1337[2]._arr1[di]._object1._updateStartFrame; + _item6._object1._walkStartFrame = _arrunkObj1337[2]._arr1[di]._object1._walkStartFrame; + // _field2E is named _field3C in R2R + _item6._object1._field2E = _arrunkObj1337[2]._arr1[di]._object1._field2E; + _item6._object1._percent = _arrunkObj1337[2]._arr1[di]._object1._percent; + _item6._object1._priority = _arrunkObj1337[2]._arr1[di]._object1._priority; + _item6._object1._angle = _arrunkObj1337[2]._arr1[di]._object1._angle; + _item6._object1._flags = _arrunkObj1337[2]._arr1[di]._object1._flags; + _item6._object1._xe = _arrunkObj1337[2]._arr1[di]._object1._xe; + _item6._object1._xs = _arrunkObj1337[2]._arr1[di]._object1._xs; + _item6._object1._paneRects[0] = _arrunkObj1337[2]._arr1[di]._object1._paneRects[0]; + _item6._object1._paneRects[1] = _arrunkObj1337[2]._arr1[di]._object1._paneRects[1]; + _item6._object1._visage = _arrunkObj1337[2]._arr1[di]._object1._visage; + _item6._object1._objectWrapper = _arrunkObj1337[2]._arr1[di]._object1._objectWrapper; + _item6._object1._strip = _arrunkObj1337[2]._arr1[di]._object1._strip; + _item6._object1._animateMode = _arrunkObj1337[2]._arr1[di]._object1._animateMode; + _item6._object1._frame = _arrunkObj1337[2]._arr1[di]._object1._frame; + _item6._object1._endFrame = _arrunkObj1337[2]._arr1[di]._object1._endFrame; + // _field68 is named _field76 in R2R + _item6._object1._field68 = _arrunkObj1337[2]._arr1[di]._object1._field68; + _item6._object1._frameChange = _arrunkObj1337[2]._arr1[di]._object1._frameChange; + _item6._object1._numFrames = _arrunkObj1337[2]._arr1[di]._object1._numFrames; + _item6._object1._regionIndex = _arrunkObj1337[2]._arr1[di]._object1._regionIndex; + _item6._object1._mover = _arrunkObj1337[2]._arr1[di]._object1._mover; + _item6._object1._moveDiff = _arrunkObj1337[2]._arr1[di]._object1._moveDiff; + _item6._object1._moveRate = _arrunkObj1337[2]._arr1[di]._object1._moveRate; + _item6._object1._field8A = _arrunkObj1337[2]._arr1[di]._object1._field8A; + _item6._object1._endAction = _arrunkObj1337[2]._arr1[di]._object1._endAction; + _item6._object1._regionBitList = _arrunkObj1337[2]._arr1[di]._object1._regionBitList; + // _item6._object1._actorName = _arrunkObj1337[2]._arr1[di]._object1._actorName; + _item6._object1._fieldE = _arrunkObj1337[2]._arr1[di]._object1._fieldE; + _item6._object1._field10 = _arrunkObj1337[2]._arr1[di]._object1._field10; + warning("_item6._object1._field12 = _arrunkObj1337[2]._arr1[di]._object1._field12;"); + warning("_item6._object1._field14 = _arrunkObj1337[2]._arr1[di]._object1._field14;"); + warning("_item6._object1._field16 = _arrunkObj1337[2]._arr1[di]._object1._field16;"); + _item6._object1 = _arrunkObj1337[2]._arr1[di]._object1; + } + } + + if (di == 4) { + subCDB90(1, _item6._field36); + subD0281(); + return; + } + } else if (R2_GLOBALS._v57810 == 300) { + subCDB90(3, _item6._field36); + subD0281(); + return; + } else { + subD1A48(R2_GLOBALS._v57810); + subD0281(); + return; + } + + // That continues the block when R2_GLOBALS._v57810 == 200 and di != 4 + subD18B5(1332, _item6._object1._strip, _item6._object1._frame); + R2_GLOBALS._sceneObjects->draw(); + Event event; + bool found = false; + bool found_di; + for (;;) { + if ( ((g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN)) && (event.btnState == BTNSHIFT_RIGHT)) + || (g_globals->_events.getEvent(event, EVENT_KEYPRESS)) ){ + _item6._field36 = g_globals->_events._mousePos; + found_di = false; + + for (int i = 0; i <= 3; i ++) { + if (subC2BF8(&_arrunkObj1337[2]._arr1[i], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) { + if (_arrunkObj1337[2]._arr1[i]._field34 == 0) { + _arrunkObj1337[2]._arr1[i]._field34 = _item6._field34; + _arrunkObj1337[2]._arr1[i]._object1.postInit(); + _arrunkObj1337[2]._arr1[i]._object1.hide(); + _arrunkObj1337[2]._arr1[i]._object1.setVisage(1332); + _arrunkObj1337[2]._arr1[i]._object1.setPosition(_arrunkObj1337[2]._arr1[i]._field36, 0); + _arrunkObj1337[2]._arr1[i]._object1.fixPriority(170); + setAnimationInfo(&_arrunkObj1337[2]._arr1[i]); + subD18B5(5, 1, 4); + found = true; + _field423E--; + _field4244 = 0; + subC20F9(); + } else { + actionDisplay(1330, 127, 159, 10, 1, 200, 0, 7, 0, 154, 154); + found_di = true; + } + break; + } + } + + if ((!found) && (!found_di)) { + if (subC2BF8(&_item7, Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) { + subC4A39(&_item6); + } else if (!found) { + bool foundVar4; + int i; + if (_item6._field34 == 1) { + foundVar4 = false; + for (i = 0; i <= 7; i++) { + if (subC2BF8(&_arrunkObj1337[2]._arr2[i], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) { + foundVar4 = true; + break; + } + } + + if ((foundVar4) && (_arrunkObj1337[2]._arr2[i]._field34 == 0)) { + if (subC27B5(_arrunkObj1337[2]._arr3[0]._field34) != -1) { + actionDisplay(1330, 55, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else { + subC340B(&_item6, &_arrunkObj1337[2]._arr2[i]); + return; + } + } else { + actionDisplay(1330, 56, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } + } else if (_item6._field34 <= 9) { + foundVar4 = false; + for (i = 0; i <= 7; i++) { + if (subC2BF8(&_arrunkObj1337[2]._arr2[i], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) { + foundVar4 = true; + break; + } + } + if ((foundVar4) && (_arrunkObj1337[2]._arr2[i]._field34 == 1)) { + foundVar4 = false; + int j; + for (j = 0; j <= 7; j++) { + if (_item6._field34 == _arrunkObj1337[2]._arr2[j]._field34) { + foundVar4 = true; + break; + } + } + if (foundVar4) { + actionDisplay(1330, 34, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else if (subC27B5(_arrunkObj1337[2]._arr3[0]._field34) != -1) { + actionDisplay(1330, 35, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else { + if (j == 7) + _field424A = 2; + + subC33C0(&_item6, &_arrunkObj1337[2]._arr2[i]); + return; + } + } else { + actionDisplay(1330, 37, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } + } else { + if ((_item6._field34 == 26) || (_item6._field34 == 30) ||(_item6._field34 == 32) || (_item6._field34 == 28)) { + if (subC2BF8(&_arrunkObj1337[2]._arr3[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) { + actionDisplay(1330, 42, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else if (!subC3386(_arrunkObj1337[2]._arr3[0]._field34, _item6._field34)) { + if (_arrunkObj1337[2]._arr3[0]._field34 != 0) { + switch (_arrunkObj1337[2]._arr3[0]._field34) { + case 11: + actionDisplay(1330, 68, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 14: + actionDisplay(1330, 80, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 16: + actionDisplay(1330, 84, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 24: + actionDisplay(1330, 96, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + default: + break; + } + } else { + actionDisplay(1330, 41, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } + } else { + subC34A1(&_item6, &_arrunkObj1337[2]._arr3[0]); + return; + } + } else { + if ((subC27F9(_item6._field34) == -1) && (subC27B5(_item6._field34) == -1)) { + if (_item6._field34 == 13) { + if (subC2BF8(&_arrunkObj1337[0]._arr4[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) { + for (int k = 0; k <= 7; k++) { + if (_arrunkObj1337[0]._arr2[k]._field34 != 0) { + found = true; + subC358E(&_item6, 0); + } + } + + if (!found) + actionDisplay(1330, 74, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else if (subC2BF8(&_arrunkObj1337[3]._arr4[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) { + for (int k = 0; k <= 7; k++) { + if (_arrunkObj1337[3]._arr2[k]._field34 != 0) { + found = true; + subC358E(&_item6, 3); + } + } + if (!found) + actionDisplay(1330, 74, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else if (subC2BF8(&_arrunkObj1337[1]._arr4[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) { + for (int k = 0; k <= 7; k++) { + if (_arrunkObj1337[1]._arr2[k]._field34 == 0) { + found = true; + subC358E(&_item6, 1); + } + } + if (!found) + actionDisplay(1330, 74, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else { + actionDisplay(1330, 128, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } + } else if (_item6._field34 == 25) { + int k; + if (subC2BF8(&_arrunkObj1337[0]._arr4[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) { + if ( (_arrunkObj1337[0]._arr1[0]._field34 != 0) + || (_arrunkObj1337[0]._arr1[1]._field34 != 0) + || (_arrunkObj1337[0]._arr1[2]._field34 != 0) + || (_arrunkObj1337[0]._arr1[3]._field34 != 0) ) { + for (k = 0; k <= 3; k++){ + if (_arrunkObj1337[2]._arr1[k]._field34 == 0) + break; + } + subC318B(2, &_arrunkObj1337[2]._arr1[k], 0); + return; + } else { + actionDisplay(1330, 99, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } + } else if (subC2BF8(&_arrunkObj1337[1]._arr4[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) { + if ( (_arrunkObj1337[1]._arr1[0]._field34 != 0) + || (_arrunkObj1337[1]._arr1[1]._field34 != 0) + || (_arrunkObj1337[1]._arr1[2]._field34 != 0) + || (_arrunkObj1337[1]._arr1[3]._field34 != 0) ) { + for (k = 0; k <= 3; k++){ + if (_arrunkObj1337[2]._arr1[k]._field34 == 0) + break; + } + subC318B(2, &_arrunkObj1337[2]._arr1[k], 1); + return; + } else { + actionDisplay(1330, 99, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } + } + + if (subC2BF8(&_arrunkObj1337[3]._arr4[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) { + if ( (_arrunkObj1337[3]._arr1[0]._field34 != 0) + || (_arrunkObj1337[3]._arr1[1]._field34 != 0) + || (_arrunkObj1337[3]._arr1[2]._field34 != 0) + || (_arrunkObj1337[3]._arr1[3]._field34 != 0) ) { + for (k = 0; k <= 3; k++){ + if (_arrunkObj1337[2]._arr1[k]._field34 == 0) + break; + } + subC318B(2, &_arrunkObj1337[2]._arr1[k], 3); + return; + } else { + actionDisplay(1330, 99, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } + } else { + actionDisplay(1330, 129, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } + } else if (_item6._field34 == 29) { + actionDisplay(1330, 136, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else if (_item6._field34 == 27) { + actionDisplay(1330, 137, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } + } else { + if (subC2BF8(&_arrunkObj1337[0]._arr3[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) { + if (_arrunkObj1337[0]._arr3[0]._field34 != 0) { + actionDisplay(1330, 15, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else if (!subC32B1(0, _item6._field34)) { + switch (_item6._field34) { + case 10: + actionDisplay(1330, 66, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 12: + actionDisplay(1330, 70, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 15: + actionDisplay(1330, 82, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 17: + actionDisplay(1330, 86, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 18: + actionDisplay(1330, 88, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 19: + actionDisplay(1330, 90, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 20: + actionDisplay(1330, 92, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 21: + actionDisplay(1330, 94, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + default: + break; + } + } else { + subC3456(&_item6, &_arrunkObj1337[0]._arr3[0]); + found = true; + } + } else if (subC2BF8(&_arrunkObj1337[3]._arr3[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) { + if (_arrunkObj1337[3]._arr3[0]._field34 != 0) { + actionDisplay(1330, 17, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else if (!subC32B1(3, _item6._field34)) { + switch (_item6._field34) { + case 10: + actionDisplay(1330, 66, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 12: + actionDisplay(1330, 70, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 15: + actionDisplay(1330, 82, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 17: + actionDisplay(1330, 86, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 18: + actionDisplay(1330, 88, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 19: + actionDisplay(1330, 90, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 20: + actionDisplay(1330, 92, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 21: + actionDisplay(1330, 94, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + default: + break; + } + } else { + subC3456(&_item6, &_arrunkObj1337[3]._arr3[0]); + found = true; + } + } else if (subC2BF8(&_arrunkObj1337[1]._arr3[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) { + if (_arrunkObj1337[1]._arr3[0]._field34 != 0) { + actionDisplay(1330, 19, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } else if (!subC32B1(1, _item6._field34)) { + switch (_item6._field34) { + case 10: + actionDisplay(1330, 66, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 12: + actionDisplay(1330, 70, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 15: + actionDisplay(1330, 82, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 17: + actionDisplay(1330, 86, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 18: + actionDisplay(1330, 88, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 19: + actionDisplay(1330, 90, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 20: + actionDisplay(1330, 92, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + case 21: + actionDisplay(1330, 94, 159, 10, 1, 200, 0, 7, 0, 154, 154); + break; + default: + break; + } + } else { + subC3456(&_item6, &_arrunkObj1337[1]._arr3[0]); + found = true; + } + } else { + actionDisplay(1330, 38, 159, 10, 1, 200, 0, 7, 0, 154, 154); + } + } + } + } + } + } + + if (found) + return; + } else { + g_globals->_scenePalette.signalListeners(); + R2_GLOBALS._sceneObjects->draw(); + g_globals->_events.delay(g_globals->_sceneHandler->_delayTicks); + } + } +} + +void Scene1337::subD183F(int arg1, int arg2) { + if ((R2_GLOBALS._v57709 != 0) || (R2_GLOBALS._v5780C != 0)) + return; + + R2_GLOBALS._v5780E = arg1 + arg2; + + if (arg2 != 0) { + if (R2_GLOBALS._v5780E < 1) + R2_GLOBALS._v5780E = 2; + + if (R2_GLOBALS._v5780E > 2) + R2_GLOBALS._v5780E = 1; + } + + if (R2_GLOBALS._v5780E == 1) { + R2_GLOBALS._v57810 = 200; + subD195F(1, 4); + } else if (R2_GLOBALS._v5780E == 2) { + R2_GLOBALS._v57810 = 300; + subD195F(1, 5); + } else { + R2_GLOBALS._v57810 = 0; + subD195F(0, 0); + } +} + +void Scene1337::subD18B5(int resNum, int rlbNum, int arg3) { + warning("STUBBED lvl3 Scene1337::subD18B5()"); +} + +int Scene1337::subD18F5() { + if (R2_GLOBALS._v57709 == 0) + // The cursor looks... very dummy + // To be checked + warning("TODO: CursorManager.setData(R2_GLOBALS.off_57705)"); + + ++R2_GLOBALS._v57709; + + return R2_GLOBALS._v57709; +} + +int Scene1337::subD1917() { + if (R2_GLOBALS._v57709 != 0) { + R2_GLOBALS._v57709--; + if (R2_GLOBALS._v57709 != 0) + warning("FIXME: subD195F(_width, _data);"); + } + + return R2_GLOBALS._v57709; +} + +int Scene1337::subD1940(bool flag) { + if (flag) + ++R2_GLOBALS._v5780C; + else if (R2_GLOBALS._v5780C != 0) + --R2_GLOBALS._v5780C; + + return R2_GLOBALS._v5780C; +} + +void Scene1337::subD195F(int arg1, int arg2) { + subD18B5(5, arg1, arg2); +} + +void Scene1337::subD1975(int arg1, int arg2) { + warning("STUBBED lvl2 Scene1337::subD1975()"); +} + +void Scene1337::subD1A48(int arg1) { + int tmpVal = -1; + + switch (arg1) { + case 200: + tmpVal = 141; + break; + case 300: + tmpVal = 142; + break; + default: + MessageDialog::show(WRONG_ANSWER_MSG, OK_BTN_STRING); + break; + } + + if (tmpVal == -1) + return; + + actionDisplay(1330, tmpVal, -1, -1, 1, 220, 1, 5, 0, 105, 0); +} + +/*-------------------------------------------------------------------------- + * Scene 1500 - Cutscene: Ship landing + * + *--------------------------------------------------------------------------*/ +void Scene1500::postInit(SceneObjectList *OwnerList) { + loadScene(1500); + R2_GLOBALS._uiElements._active = false; + R2_GLOBALS._v5589E.top = 0; + R2_GLOBALS._v5589E.bottom = 200; + setZoomPercents(170, 13, 240, 100); + SceneExt::postInit(); + scalePalette(65, 65, 65); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor2.postInit(); + _actor2.setup(1401, 1, 1); + _actor2._effect = 5; + _actor2.fixPriority(10); + _actor2._field9C = _field312; + + _actor1.postInit(); + _actor1.setup(1400, 1, 1); + _actor1._moveDiff = Common::Point(1, 1); + _actor1._linkedActor = &_actor2; + + if (R2_GLOBALS._sceneManager._previousScene != 1010) { + _actor4.postInit(); + _actor4.setup(1401, 2, 1); + _actor4._effect = 5; + _actor4.fixPriority(10); + _actor4._field9C = _field312; + + _actor3.postInit(); + _actor3._moveRate = 30; + _actor3._moveDiff = Common::Point(1, 1); + _actor3._linkedActor = &_actor4; + } + + if (R2_GLOBALS._sceneManager._previousScene == 300) { + _actor1.setPosition(Common::Point(189, 139), 5); + + _actor3.setup(1400, 1, 2); + _actor3.setPosition(Common::Point(148, 108), 0); + + _sceneMode = 20; + R2_GLOBALS._sound1.play(110); + } else if (R2_GLOBALS._sceneManager._previousScene == 1550) { + _actor1.setPosition(Common::Point(189, 139), 5); + + _actor3.setup(1400, 2, 1); + _actor3.changeZoom(-1); + _actor3.setPosition(Common::Point(298, 258), 5); + + _sceneMode = 10; + R2_GLOBALS._sound1.play(106); + } else { + _actor1.setPosition(Common::Point(289, 239), -30); + _sceneMode = 0; + R2_GLOBALS._sound1.play(102); + } + signal(); +} + +void Scene1500::remove() { + R2_GLOBALS._v5589E.top = 3; + R2_GLOBALS._v5589E.bottom = 168; + R2_GLOBALS._uiElements._active = true; + + SceneExt::remove(); +} + +void Scene1500::signal() { + switch(_sceneMode++) { + case 0: + R2_GLOBALS.setFlag(25); + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + // No break on purpose + case 1: + if (_actor1._yDiff < 50) { + _actor1.setPosition(Common::Point(289, 239), _actor1._yDiff + 1); + _sceneMode = 1; + } + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + break; + case 2: { + Common::Point pt(189, 139); + NpcMover *mover = new NpcMover(); + _actor1.addMover(mover, &pt, this); + } + break; + case 3: + if (_actor1._yDiff > 5) { + _actor1.setPosition(Common::Point(189, 139), _actor1._yDiff - 1); + _sceneMode = 3; + } + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + break; + case 13: + R2_GLOBALS._player._characterIndex = R2_MIRANDA; + // No break on purpose + case 4: + R2_GLOBALS._sceneManager.changeScene(300); + break; + case 10: + // No break on purpose + case 20: + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + break; + case 11: { + Common::Point pt(148, 108); + NpcMover *mover = new NpcMover(); + _actor3.addMover(mover, &pt, this); + } + break; + case 12: + setAction(&_sequenceManager, this, 2, &R2_GLOBALS._player, NULL); + break; + case 21: { + Common::Point pt(-2, -42); + NpcMover *mover = new NpcMover(); + _actor3.addMover(mover, &pt, NULL); + signal(); + } + break; + case 22: + if (_actor1._yDiff < 50) { + _actor1.setPosition(Common::Point(189, 139), _actor1._yDiff + 1); + _sceneMode = 22; + } + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + break; + case 23: { + Common::Point pt(-13, -61); + NpcMover *mover = new NpcMover(); + _actor1.addMover(mover, &pt, this); + } + break; + case 24: + R2_GLOBALS._sceneManager.changeScene(300); + break; + default: + break; + } +} + +void Scene1500::dispatch() { + if (_sceneMode > 10) { + float yDiff = sqrt((float) (_actor3._position.x * _actor3._position.x) + (_actor3._position.y * _actor3._position.y)); + if (yDiff > 6) + _actor3.setPosition(_actor3._position, (int) yDiff); + } + + Scene::dispatch(); +} + +/*-------------------------------------------------------------------------- + * Scene 1525 - Cutscene - Ship + * + *--------------------------------------------------------------------------*/ +void Scene1525::postInit(SceneObjectList *OwnerList) { + loadScene(1525); + R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); + + R2_GLOBALS._player.postInit(); + if (R2_GLOBALS._sceneManager._previousScene == 525) + R2_GLOBALS._player.setup(1525, 1, 1); + else + R2_GLOBALS._player.setup(1525, 1, 16); + R2_GLOBALS._player.setPosition(Common::Point(244, 148)); + R2_GLOBALS._player.disableControl(); + + _sceneMode = 0; + setAction(&_sequenceManager, this, 2, &R2_GLOBALS._player, NULL); +} + +void Scene1525::signal() { + switch (_sceneMode++) { + case 0: + if (R2_GLOBALS._sceneManager._previousScene == 525) + setAction(&_sequenceManager, this, 1525, &R2_GLOBALS._player, NULL); + else + setAction(&_sequenceManager, this, 1526, &R2_GLOBALS._player, NULL); + break; + case 1: + setAction(&_sequenceManager, this, 2, &R2_GLOBALS._player, NULL); + break; + case 2: + if (R2_GLOBALS._sceneManager._previousScene == 1530) + R2_GLOBALS._sceneManager.changeScene(1550); + else + R2_GLOBALS._sceneManager.changeScene(1530); + default: + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 1530 - Cutscene - Elevator + * + *--------------------------------------------------------------------------*/ +void Scene1530::postInit(SceneObjectList *OwnerList) { + if (R2_GLOBALS._sceneManager._previousScene == 1000) + loadScene(1650); + else if (R2_GLOBALS._sceneManager._previousScene == 1580) + loadScene(1550); + else + loadScene(1530); + + R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); + + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + + if (R2_GLOBALS._sceneManager._previousScene == 1000) { + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(538, this); + R2_GLOBALS._sound1.play(114); + + _sceneMode = 3; + } else if (R2_GLOBALS._sceneManager._previousScene == 1580) { + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player._characterIndex = R2_QUINN; + R2_GLOBALS._player.setObjectWrapper(NULL); + R2_GLOBALS._player.setup(1516, 6, 1); + R2_GLOBALS._player.setPosition(Common::Point(160, 125)); + R2_GLOBALS._player._moveRate = 30; + R2_GLOBALS._player._moveDiff = Common::Point(4, 1); + + _actor2.postInit(); + _actor2.setup(1516, 7, 1); + _actor2.setPosition(Common::Point(121, 41)); + _actor2.animate(ANIM_MODE_2, NULL); + + _actor3.postInit(); + _actor3.setup(1516, 8, 1); + _actor3.setPosition(Common::Point(107, 116)); + _actor3.animate(ANIM_MODE_2, NULL); + + R2_GLOBALS._player.disableControl(); + Common::Point pt(480, 75); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + R2_GLOBALS._sound1.play(111); + + _sceneMode = 1; + } else { + _actor1.postInit(); + _actor1._effect = 1; + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + setAction(&_sequenceManager, this, 1530, &R2_GLOBALS._player, &_actor1, NULL); + + _sceneMode = 2; + } + +} + +void Scene1530::signal() { + switch (_sceneMode - 1) { + case 0: + R2_GLOBALS._sceneManager.changeScene(1000); + break; + case 1: + R2_GLOBALS._sceneManager.changeScene(1525); + break; + case 2: + R2_GLOBALS._player.disableControl(); + _sceneMode = 4; + R2_GLOBALS._player.show(); + setAction(&_sequenceManager, this, 1650, &R2_GLOBALS._player, NULL); + break; + case 3: + R2_GLOBALS._sceneManager.changeScene(1700); + break; + default: + break; + } +} + +void Scene1530::dispatch() { + int16 x = R2_GLOBALS._player._position.x; + int16 y = R2_GLOBALS._player._position.y; + + _actor2.setPosition(Common::Point(x - 39, y - 85)); + _actor3.setPosition(Common::Point(x - 53, y - 9)); + + Scene::dispatch(); +} + +/*-------------------------------------------------------------------------- + * Scene 1550 - + * + *--------------------------------------------------------------------------*/ +Scene1550::UnkObj15501::UnkObj15501() { + _fieldA4 = _fieldA6 = 0; +} + +void Scene1550::UnkObj15501::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_fieldA4); + s.syncAsSint16LE(_fieldA6); +} + +bool Scene1550::UnkObj15501::startAction(CursorType action, Event &event) { + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (_visage == 1561) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 40; + Common::Point pt(_position.x + 5, _position.y + 20); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + return true; + } + return SceneActor::startAction(action, event); + break; + case CURSOR_LOOK: + if (_visage == 1561) { + switch (_frame) { + case 2: + SceneItem::display(1550, 23, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + case 3: + SceneItem::display(1550, 26, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + case 4: + SceneItem::display(1550, 35, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + default: + break; + } + } else { + switch ((((_strip - 1) * 5) + _frame) % 3) { + case 0: + SceneItem::display(1550, 62, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + case 1: + SceneItem::display(1550, 53, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + case 2: + SceneItem::display(1550, 76, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + default: + break; + } + } + return true; + break; + default: + return SceneActor::startAction(action, event); + break; + } +} + +Scene1550::UnkObj15502::UnkObj15502() { + _fieldA4 = 0; +} + +void Scene1550::UnkObj15502::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_fieldA4); +} + +bool Scene1550::UnkObj15502::startAction(CursorType action, Event &event) { + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (_fieldA4 == 8) { + scene->_field412 = 1; + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1576; + else + scene->_sceneMode = 1584; + // strcpy(scene->_arrUnkObj15502[7]._actorName, 'hatch'); + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[7], NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + case CURSOR_LOOK: + if (_fieldA4 == 8) + SceneItem::display(1550, 75, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + else if (_frame == 1) + SceneItem::display(1550, 70, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + else + SceneItem::display(1550, 71, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + break; + case R2_FUEL_CELL: + scene->_field412 = 1; + if (_fieldA4 == 6) { + R2_GLOBALS._player.disableControl(); + scene->_actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1574; + else + scene->_sceneMode = 1582; + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[5], &scene->_actor1, NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + case R2_GYROSCOPE: + scene->_field412 = 1; + if (_fieldA4 == 3) { + R2_GLOBALS._player.disableControl(); + scene->_actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1571; + else + scene->_sceneMode = 1581; + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[2], &scene->_actor1, NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + case R2_GUIDANCE_MODULE: + scene->_field412 = 1; + if (_fieldA4 == 1) { + R2_GLOBALS._player.disableControl(); + scene->_actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1569; + else + scene->_sceneMode = 1579; + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[0], &scene->_actor1, NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + case R2_THRUSTER_VALVE: + scene->_field412 = 1; + if (_fieldA4 == 4) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1572; + scene->_actor1.postInit(); + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[3], &scene->_actor1, NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + case R2_RADAR_MECHANISM: + scene->_field412 = 1; + if (_fieldA4 == 2) { + R2_GLOBALS._player.disableControl(); + scene->_actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1570; + else + scene->_sceneMode = 1580; + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[1], &scene->_actor1, NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + case R2_IGNITOR: + scene->_field412 = 1; + if (_fieldA4 == 5) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1573; + scene->_actor1.postInit(); + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[4], &scene->_actor1, NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + case R2_BATTERY: + scene->_field412 = 1; + if (_fieldA4 == 7) { + R2_GLOBALS._player.disableControl(); + scene->_actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1575; + else + scene->_sceneMode = 1583; + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[6], &scene->_actor1, NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + default: + return SceneActor::startAction(action, event); + break; + } +} + +void Scene1550::UnkObj15502::subA5CDF(int strip) { + _fieldA4 = strip; + postInit(); + setup(1517, _fieldA4, 1); + switch (_fieldA4 - 1) { + case 0: + if (R2_INVENTORY.getObjectScene(R2_GUIDANCE_MODULE) == 0) + setFrame(5); + setPosition(Common::Point(287, 85)); + break; + case 1: + if (R2_INVENTORY.getObjectScene(R2_RADAR_MECHANISM) == 0) + setFrame(5); + setPosition(Common::Point(248, 100)); + break; + case 2: + if (R2_INVENTORY.getObjectScene(R2_DIAGNOSTICS_DISPLAY) == 0) + setFrame(5); + setPosition(Common::Point(217, 85)); + break; + case 3: + if (R2_INVENTORY.getObjectScene(R2_THRUSTER_VALVE)) + setFrame(5); + setPosition(Common::Point(161, 121)); + break; + case 4: + if (R2_INVENTORY.getObjectScene(R2_IGNITOR)) + setFrame(5); + setPosition(Common::Point(117, 121)); + break; + case 5: + if (R2_INVENTORY.getObjectScene(R2_FUEL_CELL)) + setFrame(5); + setPosition(Common::Point(111, 85)); + break; + case 6: + if (R2_INVENTORY.getObjectScene(R2_BATTERY)) + setFrame(5); + setPosition(Common::Point(95, 84)); + break; + case 7: { + setup(1516, 1, 1); + setPosition(Common::Point(201, 45)); + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + if ((scene->_sceneMode == 1577) || (scene->_sceneMode == 1578)) + hide(); + fixPriority(92); + setDetails(1550, 70, -1, -1, 2, (SceneItem *) NULL); + } + break; + default: + break; + } +} + +Scene1550::UnkObj15503::UnkObj15503() { + _fieldA4 = 0; +} + +void Scene1550::UnkObj15503::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_fieldA4); +} + +bool Scene1550::UnkObj15503::startAction(CursorType action, Event &event) { + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + switch (_fieldA4) { + case 1: + if (scene->_actor13._frame == 5) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 25; + if (scene->_actor4._frame == 1) { + scene->setAction(&scene->_sequenceManager1, scene, 1560, &scene->_actor4, NULL); + R2_GLOBALS.setFlag(20); + setFrame(2); + } else { + scene->setAction(&scene->_sequenceManager1, scene, 1561, &scene->_actor4, NULL); + R2_GLOBALS.clearFlag(20); + setFrame(1); + } + scene->_unkArea1.remove(); + } + break; + case 2: + R2_GLOBALS._player.disableControl(); + if (scene->_actor13._frame == 1) { + scene->_sceneMode = 23; + scene->setAction(&scene->_sequenceManager1, scene, 1560, this, NULL); + } else { + if (scene->_actor4._frame == 1) + scene->_sceneMode = 24; + else + scene->_sceneMode = 22; + scene->setAction(&scene->_sequenceManager1, scene, 1561, this, NULL); + } + break; + default: + break; + } + return true; +} + +void Scene1550::UnkArea1550::remove() { + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + _unkObj155031.remove(); + _unkObj155032.remove(); + // sub201EA is a common part with UnkArea1200 + R2_GLOBALS._sceneItems.remove((SceneItem *)this); + _areaActor.remove(); + SceneArea::remove(); + R2_GLOBALS._insetUp--; + // + if ((scene->_sceneMode >= 20) && (scene->_sceneMode <= 29)) + return; + + R2_GLOBALS._player.disableControl(); + if (scene->_actor4._frame == 1) { + scene->_sceneMode = 1559; + scene->setAction(&scene->_sequenceManager1, scene, 1559, &R2_GLOBALS._player, NULL); + } else { + scene->_sceneMode = 1562; + scene->setAction(&scene->_sequenceManager1, scene, 1562, &R2_GLOBALS._player, NULL); + } +} + +void Scene1550::UnkArea1550::process(Event &event) { +// This is a copy of Scene1200::Area1::process + if (_field20 != R2_GLOBALS._insetUp) + return; + + CursorType cursor = R2_GLOBALS._events.getCursor(); + + if (_areaActor._bounds.contains(event.mousePos.x + g_globals->gfxManager()._bounds.left , event.mousePos.y)) { + if (cursor == _cursorNum) + warning("TODO: _cursorState = ???"); + R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState); + } else if (event.mousePos.y < 168) { + if (cursor != _cursorNum) { + _savedCursorNum = cursor; + warning("TODO: _cursorState = ???"); + R2_GLOBALS._events.setCursor(CURSOR_INVALID); + } + if (event.eventType == EVENT_BUTTON_DOWN) { + event.handled = true; + warning("TODO: _cursorState = ???"); + R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState); + remove(); + } + } +} + +void Scene1550::UnkArea1550::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { + // UnkArea1200::proc12(); + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + _areaActor.postInit(); + _areaActor.setup(visage, stripFrameNum, frameNum); + _areaActor.setPosition(Common::Point(posX, posY)); + _areaActor.fixPriority(250); + _cursorNum = CURSOR_INVALID; + scene->_sceneAreas.push_front(this); + ++R2_GLOBALS._insetUp; + _field20 = R2_GLOBALS._insetUp; + // + + proc13(1550, 67, -1, -1); + _unkObj155031.postInit(); + _unkObj155031._fieldA4 = 1; + if (scene->_actor4._frame == 1) + _unkObj155031.setup(1559, 3, 1); + else + _unkObj155031.setup(1559, 3, 2); + _unkObj155031.setPosition(Common::Point(142, 79)); + _unkObj155031.fixPriority(251); + _unkObj155031.setDetails(1550, 68, -1, -1, 2, (SceneItem *) NULL); + + _unkObj155032.postInit(); + _unkObj155032._numFrames = 5; + _unkObj155032._fieldA4 = 2; + if (scene->_actor13._frame == 1) + _unkObj155032.setup(1559, 2, 1); + else + _unkObj155032.setup(1559, 2, 2); + _unkObj155032.setPosition(Common::Point(156, 103)); + _unkObj155032.fixPriority(251); + _unkObj155032.setDetails(1550, 69, -1, -1, 2, (SceneItem *) NULL); +} + +void Scene1550::UnkArea1550::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { + // Copy of Scene1200::Area1::proc13 + _areaActor.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL); +} + +bool Scene1550::Hotspot1::startAction(CursorType action, Event &event) { + return SceneHotspot::startAction(action, event); +} + +bool Scene1550::Hotspot3::startAction(CursorType action, Event &event) { + // Arrays related to this scene are all hacky in the origina: they are based on the impossibility to use Miranda + assert ((R2_GLOBALS._player._characterIndex == 1) || (R2_GLOBALS._player._characterIndex == 2)); + // The original contains a debug message when CURSOR_TALK is used. + // This part is totally useless, we could remove it (and the entire function as well) + if (action == CURSOR_TALK) + warning("Location: %d/%d - %d", R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex], R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2], k5A4D6[(R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] * 30)] + R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]); + + return SceneHotspot::startAction(action, event); +} + +bool Scene1550::Actor6::startAction(CursorType action, Event &event) { + return SceneActor::startAction(action, event); +} + +bool Scene1550::Actor7::startAction(CursorType action, Event &event) { + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + scene->_sceneMode = 80; + scene->signal(); + + return true; +} + +bool Scene1550::Actor8::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + scene->_field412 = 1; + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1552; + else + scene->_sceneMode = 1588; + + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor8, NULL); + return true; +} + +bool Scene1550::Actor9::startAction(CursorType action, Event &event) { + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + scene->_sceneMode = 50; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_stripManager.start(518, scene); + else + scene->_stripManager.start(520, scene); + return true; + break; + case CURSOR_LOOK: + SceneItem::display(1550, 41, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + break; + default: + return SceneActor::startAction(action, event); + } +} + +bool Scene1550::Actor10::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1555; + else + scene->_sceneMode = 1589; + + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor10, NULL); + return true; +} + +bool Scene1550::Actor11::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + scene->_field412 = 1; + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1586; + else + scene->_sceneMode = 1587; + + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor11, NULL); + return true; +} + +bool Scene1550::Actor12::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + if (R2_GLOBALS._player._characterIndex == 2) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1585; + scene->setAction(&scene->_sequenceManager1, scene, 1585, &R2_GLOBALS._player, NULL); + } else { + R2_GLOBALS._player.disableControl(); + switch(scene->_field415) { + case 0: + scene->_actor13.fixPriority(168); + scene->_actor4.fixPriority(125); + scene->_sceneMode = 1558; + scene->setAction(&scene->_sequenceManager1, scene, 1558, &R2_GLOBALS._player, NULL); + break; + case 1: + return SceneActor::startAction(action, event); + break; + case 2: + scene->_field415 = 1; + scene->_sceneMode = 1563; + scene->setAction(&scene->_sequenceManager1, scene, 1563, &R2_GLOBALS._player, &scene->_actor4, NULL); + break; + default: + break; + } + } + return true; + +} + +bool Scene1550::Actor13::startAction(CursorType action, Event &event) { + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (scene->_field415 != 2) + return SceneActor::startAction(action, event); + + if (R2_INVENTORY.getObjectScene(R2_BATTERY) == 1550) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1564; + scene->setAction(&scene->_sequenceManager1, scene, 1564, &R2_GLOBALS._player, NULL); + } else + SceneItem::display(1550, 64, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + break; + case CURSOR_LOOK: + if (scene->_field415 != 2) + return SceneActor::startAction(action, event); + + if (R2_INVENTORY.getObjectScene(R2_BATTERY) == 1550) { + SceneItem::display(1550, 74, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } else + SceneItem::display(1550, 64, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + break; + default: + return SceneActor::startAction(action, event); + break; + } +} + +Scene1550::Scene1550() { + _field412 = 0; + _field414 = 0; + _field415 = 0; + _field417 = 0; + _field419 = 0; +} + +void Scene1550::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsByte(_field414); + s.syncAsSint16LE(_field415); + s.syncAsSint16LE(_field417); + s.syncAsSint16LE(_field419); +} + +void Scene1550::postInit(SceneObjectList *OwnerList) { + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 9) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11)) + loadScene(1234); + else + loadScene(1550); + + scalePalette(65, 65, 65); + setZoomPercents(30, 75, 170, 100); + _field417 = 1550; + _field419 = 0; + SceneExt::postInit(); + + if (R2_GLOBALS._sceneManager._previousScene == -1) + R2_GLOBALS.setFlag(R2_ATTRACTOR_CABLE_HARNESS); + + if ((R2_GLOBALS._player._characterScene[1] != 1550) && (R2_GLOBALS._player._characterScene[1] != 1580)) { + R2_GLOBALS._player._characterScene[1] = 1550; + R2_GLOBALS._player._characterScene[2] = 1550; + } + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player._effect = 6; + + if (R2_GLOBALS._player._characterIndex == 1) + R2_GLOBALS._player.setup(1500, 3, 1); + else + R2_GLOBALS._player.setup(1505, 3, 1); + + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 9) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11)) + R2_GLOBALS._player.setPosition(Common::Point(157, 135)); + else + R2_GLOBALS._player.setPosition(Common::Point(160, 100)); + + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _field414 = 0; + _actor7.changeZoom(-1); + R2_GLOBALS._player.changeZoom(-1); + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 1530: + R2_GLOBALS._v565AE = 0; + // No break on purpose + case 300: + // No break on purpose + case 1500: + // No break on purpose + case 3150: + R2_GLOBALS._sound1.play(105); + break; + case 1580: + if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1580) { + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.animate(ANIM_MODE_NONE, NULL); + + _field412 = 1; + + _actor1.postInit(); + _arrUnkObj15502[7].subA5CDF(8); + _arrUnkObj15502[7].hide(); + if (R2_GLOBALS._player._characterIndex == 1) + _sceneMode = 1577; + else + _sceneMode = 1578; + + setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor1, &_arrUnkObj15502[7], NULL); + R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 1550; + } else { + R2_GLOBALS._player.enableControl(); + } + break; + default: + break; + } + + subA2B2F(); + + _item1.setDetails(16, 1550, 10, -1, -1); + _item2.setDetails(24, 1550, 10, -1, -1); + _item3.setDetails(Rect(0, 0, 320, 200), 1550, 0, 1, -1, 1, NULL); + + if ((R2_GLOBALS._sceneManager._previousScene == 1500) && (R2_GLOBALS.getFlag(16))) { + _sceneMode = 70; + if (!R2_GLOBALS._sceneObjects->contains(&_actor7)) + _actor7.postInit(); + + if (R2_GLOBALS._player._characterIndex == 1) + _actor7.setVisage(1505); + else + _actor7.setVisage(1500); + + _actor7.changeZoom(77); + _actor7.setDetails(1550, -1, -1, -1, 2, (SceneItem *) NULL); + + assert(_field419 >= 1550); + R2_GLOBALS._walkRegions.enableRegion(k5A750[_field419 - 1550]); + + setAction(&_sequenceManager1, this, 1590, &_actor7, NULL); + } else if ((_sceneMode != 1577) && (_sceneMode != 1578)) + R2_GLOBALS._player.enableControl(); +} + +void Scene1550::signal() { + switch (_sceneMode) { + case 1: + // No break on purpose + case 3: + // No break on purpose + case 5: + // No break on purpose + case 7: + _field412 = 0; + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + case 20: + // No break on purpose + case 21: + // No break on purpose + case 25: + // No break on purpose + case 1563: + R2_GLOBALS.clearFlag(20); + _unkArea1.proc12(1559, 1, 1, 160, 125); + R2_GLOBALS._player.enableControl(); + _sceneMode = 0; + break; + case 22: + _unkArea1.remove(); + _sceneMode = 24; + setAction(&_sequenceManager1, this, 1561, &_actor4, NULL); + R2_GLOBALS.clearFlag(20); + break; + case 23: + _unkArea1.remove(); + _sceneMode = 20; + setAction(&_sequenceManager1, this, 1566, &_actor13, &_actor5, NULL); + R2_GLOBALS.setFlag(21); + break; + case 24: + _unkArea1.remove(); + _sceneMode = 21; + setAction(&_sequenceManager1, this, 1567, &_actor13, &_actor5, NULL); + R2_GLOBALS.clearFlag(19); + break; + case 30: + // No break on purpose + case 1556: + // No break on purpose + case 1557: + // Nothing on purpose + break; + case 40: { + _sceneMode = 41; + Common::Point pt(_arrUnkObj15501[0]._position.x, _arrUnkObj15501[0]._position.y + 20); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 41: + _sceneMode = 42; + if (R2_GLOBALS._player._characterIndex == 1) { + R2_GLOBALS._player.setup(1502, 8, 1); + } else { + R2_GLOBALS._player.changeZoom(R2_GLOBALS._player._percent + 14); + R2_GLOBALS._player.setup(1516, 4, 1); + } + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 42: + _sceneMode = 43; + warning("TODO: unknown use of arrUnkObj15501[0]._fieldA6"); + switch (_arrUnkObj15501[0]._frame - 1) { + case 0: + R2_INVENTORY.setObjectScene(26, R2_GLOBALS._player._characterIndex); + break; + case 1: + R2_INVENTORY.setObjectScene(17, R2_GLOBALS._player._characterIndex); + break; + case 2: + R2_INVENTORY.setObjectScene(22, R2_GLOBALS._player._characterIndex); + break; + case 3: + R2_INVENTORY.setObjectScene(25, R2_GLOBALS._player._characterIndex); + break; + case 4: + R2_INVENTORY.setObjectScene(45, R2_GLOBALS._player._characterIndex); + break; + case 5: + R2_INVENTORY.setObjectScene(28, R2_GLOBALS._player._characterIndex); + break; + default: + break; + } + _arrUnkObj15501[0].remove(); + R2_GLOBALS._player.animate(ANIM_MODE_6, this); + break; + case 43: + warning("TODO: unknown use of arrUnkObj15501[0]._fieldA6"); + if (R2_GLOBALS._player._characterIndex == 1) + R2_GLOBALS._player.setVisage(1500); + else { + R2_GLOBALS._player.changeZoom(-1); + R2_GLOBALS._player.setVisage(1505); + } + R2_GLOBALS._player.animate(ANIM_MODE_1, this); + R2_GLOBALS._player.setStrip(8); + R2_GLOBALS._player.enableControl(); + break; + case 50: + warning("STUB: sub_1D227()"); + ++_sceneMode; + setAction(&_sequenceManager1, this, 1591, &R2_GLOBALS._player, NULL); + if (g_globals->_sceneObjects->contains(&_actor7)) + signal(); + else { + _actor7.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) + _actor7.setVisage(1505); + else + _actor7.setVisage(1500); + _actor7.changeZoom(77); + _actor7.setAction(&_sequenceManager2, this, 1590, &_actor7, NULL); + _actor7.setDetails(1550, -1, -1, -1, 2, (SceneItem *) NULL); + } + break; + case 51: + ++_sceneMode; + break; + case 52: + _actor7.changeZoom(-1); + _sceneMode = 1592; + if (R2_GLOBALS._player._characterIndex == 1) + setAction(&_sequenceManager1, this, 1592, &R2_GLOBALS._player, &_actor7, &_arrUnkObj15501[0], &_actor9, NULL); + else + setAction(&_sequenceManager1, this, 1593, &R2_GLOBALS._player, &_actor7, &_arrUnkObj15501[0], &_actor9, NULL); + break; + case 61: + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + _field415 = 2; + break; + case 62: + R2_GLOBALS._player.enableControl(CURSOR_TALK); + if (_field415 == 2) { + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + } + break; + case 70: + R2_GLOBALS._v565EC[2] = R2_GLOBALS._v565EC[1]; + R2_GLOBALS._v565EC[4] = R2_GLOBALS._v565EC[3]; + R2_GLOBALS._v565EC[0] = 1; + _sceneMode = 60; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(500, this); + break; + case 80: + if (R2_GLOBALS.getFlag(16)) { + _sceneMode = 60; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + if (R2_GLOBALS._v565AE >= 3) { + if (R2_GLOBALS._player._characterIndex == 1) + _stripManager.start(572, this); + else + _stripManager.start(573, this); + } else { + ++R2_GLOBALS._v565AE; + if (R2_GLOBALS._player._characterIndex == 1) + _stripManager.start(499 + R2_GLOBALS._v565AE, this); + else + _stripManager.start(502 + R2_GLOBALS._v565AE, this); + } + } else { + _sceneMode = 60; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + if (R2_GLOBALS._v565AE >= 4) { + if (R2_GLOBALS._player._characterIndex == 1) + _stripManager.start(572, this); + else + _stripManager.start(573, this); + } else { + ++R2_GLOBALS._v565AE; + if (R2_GLOBALS._player._characterIndex == 1) + _stripManager.start(563 + R2_GLOBALS._v565AE, this); + else + _stripManager.start(567 + R2_GLOBALS._v565AE, this); + } + } + break; + case 1550: + R2_GLOBALS._sceneManager.changeScene(1525); + break; + case 1552: + // No break on purpose + case 1588: + R2_INVENTORY.setObjectScene(R2_AIRBAG, R2_GLOBALS._player._characterIndex); + _actor8.remove(); + _field412 = 0; + R2_GLOBALS._player.enableControl(); + break; + case 1553: + R2_GLOBALS._sceneManager.changeScene(1575); + break; + case 1554: + R2_GLOBALS._player.enableControl(); + _field412 = 0; + break; + case 1555: + // No break on purpose + case 1589: + R2_INVENTORY.setObjectScene(R2_GYROSCOPE, R2_GLOBALS._player._characterIndex); + _actor10.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 1558: + _actor13.fixPriority(124); + _field415 = 1; + _unkArea1.proc12(1559, 1, 1, 160, 125); + R2_GLOBALS._player.enableControl(); + break; + case 1559: + _actor13.fixPriority(168); + _actor4.fixPriority(169); + R2_GLOBALS._player.fixPriority(-1); + R2_GLOBALS._player.changeZoom(-1); + _field415 = 0; + R2_GLOBALS._player.enableControl(); + break; + case 1562: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + _field415 = 2; + break; + case 1564: + R2_INVENTORY.setObjectScene(R2_BATTERY, 1); + _sceneMode = 1565; + setAction(&_sequenceManager1, this, 1565, &R2_GLOBALS._player, NULL); + break; + case 1565: + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + break; + case 1569: + // No break on purpose + case 1579: + _field412 = 0; + _actor1.remove(); + R2_INVENTORY.setObjectScene(R2_GUIDANCE_MODULE, 0); + R2_GLOBALS._player.enableControl(); + break; + case 1570: + // No break on purpose + case 1580: + _field412 = 0; + _actor1.remove(); + R2_INVENTORY.setObjectScene(R2_RADAR_MECHANISM, 0); + R2_GLOBALS._player.enableControl(); + break; + case 1571: + // No break on purpose + case 1581: + _field412 = 0; + _actor1.remove(); + R2_INVENTORY.setObjectScene(R2_GYROSCOPE, 0); + R2_GLOBALS._player.enableControl(); + break; + case 1572: + _field412 = 0; + _actor1.remove(); + R2_INVENTORY.setObjectScene(R2_THRUSTER_VALVE, 0); + R2_GLOBALS._player.enableControl(); + break; + case 1573: + _field412 = 0; + _actor1.remove(); + R2_INVENTORY.setObjectScene(R2_IGNITOR, 0); + R2_GLOBALS._player.enableControl(); + break; + case 1574: + // No break on purpose + case 1582: + _field412 = 0; + _actor1.remove(); + R2_INVENTORY.setObjectScene(R2_FUEL_CELL, 0); + R2_GLOBALS._player.enableControl(); + break; + case 1575: + // No break on purpose + case 1583: + _field412 = 0; + _actor1.remove(); + R2_INVENTORY.setObjectScene(R2_BATTERY, 0); + R2_GLOBALS._player.enableControl(); + break; + case 1576: + // No break on purpose + case 1584: + R2_GLOBALS._sceneManager.changeScene(1580); + R2_GLOBALS._player.enableControl(); + break; + case 1577: + // No break on purpose + case 1578: + _sceneMode = 0; + _actor1.remove(); + _field412 = 0; + R2_GLOBALS._player.fixPriority(-1); + R2_GLOBALS._player.enableControl(); + break; + case 1585: + SceneItem::display(1550, 66, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + R2_GLOBALS._player.enableControl(); + break; + case 1586: + // No break on purpose + case 1587: + R2_INVENTORY.setObjectScene(R2_DIAGNOSTICS_DISPLAY, R2_GLOBALS._player._characterIndex); + _actor1.remove(); + _field412 = 0; + R2_GLOBALS._player.enableControl(); + break; + case 1592: + _actor9.remove(); + R2_INVENTORY.setObjectScene(R2_JOYSTICK, 1); + if (R2_GLOBALS._player._characterIndex == 1) { + R2_GLOBALS._v565EC[2] = R2_GLOBALS._v565EC[1]; + R2_GLOBALS._v565EC[4] = R2_GLOBALS._v565EC[3]; + } else { + R2_GLOBALS._v565EC[1] = R2_GLOBALS._v565EC[2]; + R2_GLOBALS._v565EC[3] = R2_GLOBALS._v565EC[4]; + } + R2_GLOBALS._player.enableControl(); + break; + default: + _sceneMode = 62; + setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL); + break; + } +} + +void Scene1550::process(Event &event) { + if ((!R2_GLOBALS._player._canWalk) && (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN) && (event.eventType == EVENT_BUTTON_DOWN) && (this->_screenNumber == 1234)) { + int curReg = R2_GLOBALS._sceneRegions.indexOf(event.mousePos); + if (curReg == 0) + _field412 = 1; + else if (((R2_GLOBALS._player._position.y < 90) && (event.mousePos.y > 90)) || ((R2_GLOBALS._player._position.y > 90) && (event.mousePos.y < 90))) + _field412 = 1; + else + _field412 = 0; + + if ((curReg == 13) || (curReg == 14)) + _field412 = 0; + } + + Scene::process(event); +} + +void Scene1550::dispatch() { + Scene::dispatch(); + + // Arrays related to this scene are all hacky in the origina: they are based on the impossibility to use Miranda + assert ((R2_GLOBALS._player._characterIndex == 1) || (R2_GLOBALS._player._characterIndex == 2)); + + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 15) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 16)) { + R2_GLOBALS._player._shade = 0; + // Original game contains a switch based on an uninitialised variable. + // Until we understand what should really happen there, this code is unused on purpose + int missingVariable = 0; + switch (missingVariable) { + case 144: + // No break on purpose + case 146: + _actor13._frame = 5; + R2_GLOBALS._player._shade = 3; + break; + case 148: + // No break on purpose + case 149: + _actor13._frame = 1; + // No break on purpose + case 147: + // No break on purpose + case 150: + R2_GLOBALS._player._shade = 3; + break; + default: + break; + } + } + + if (_field412 != 0) + return; + + switch (R2_GLOBALS._player.getRegionIndex() - 11) { + case 0: + // No break on purpose + case 5: + R2_GLOBALS._player.disableControl(); + _sceneMode = 1; + _field412 = 1; + --R2_GLOBALS._v565EC[2 + R2_GLOBALS._player._characterIndex]; + + subA2B2F(); + + R2_GLOBALS._player.setPosition(Common::Point( 160 - (((((160 - R2_GLOBALS._player._position.x) * 100) / 108) * 172) / 100), 145)); + if (R2_GLOBALS._player._position.x < 160) { + Common::Point pt(R2_GLOBALS._player._position.x + 5, 135); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else if (R2_GLOBALS._player._position.x <= 160) { // the check is really in the original... + Common::Point pt(R2_GLOBALS._player._position.x, 135); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + Common::Point pt(R2_GLOBALS._player._position.x - 5, 135); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 1: + R2_GLOBALS._player.disableControl(); + _sceneMode = 3; + _field412 = 1; + ++R2_GLOBALS._v565EC[2 + R2_GLOBALS._player._characterIndex]; + + subA2B2F(); + + R2_GLOBALS._player.setPosition(Common::Point( 160 - (((((160 - R2_GLOBALS._player._position.x) * 100) / 172) * 108) / 100), 19)); + if (R2_GLOBALS._player._position.x < 160) { + Common::Point pt(R2_GLOBALS._player._position.x + 5, 29); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else if (R2_GLOBALS._player._position.x <= 160) { // the check is really in the original... + Common::Point pt(R2_GLOBALS._player._position.x, 29); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + Common::Point pt(R2_GLOBALS._player._position.x - 5, 29); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: + R2_GLOBALS._player.disableControl(); + _sceneMode = 5; + _field412 = 1; + ++R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]; + + subA2B2F(); + + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 9) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11) && (R2_GLOBALS._player._position.y > 50) && (R2_GLOBALS._player._position.y < 135)) { + if (R2_GLOBALS._player._position.y >= 85) { + R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y + 10)); + Common::Point pt(R2_GLOBALS._player._position.x + 30, R2_GLOBALS._player._position.y + 20); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y - 10)); + Common::Point pt(R2_GLOBALS._player._position.x + 30, R2_GLOBALS._player._position.y - 20); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + } else { + R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)); + Common::Point pt(R2_GLOBALS._player._position.x + 10, R2_GLOBALS._player._position.y); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: + R2_GLOBALS._player.disableControl(); + _sceneMode = 7; + _field412 = 1; + --R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]; + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 24) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11)) { + R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y / 2)); + Common::Point pt(265, 29); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 9) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11) && (R2_GLOBALS._player._position.y > 50) && (R2_GLOBALS._player._position.y < 135)) { + if (R2_GLOBALS._player._position.y >= 85) { + R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y + 10)); + Common::Point pt(R2_GLOBALS._player._position.x - 30, R2_GLOBALS._player._position.y + 20); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y - 10)); + Common::Point pt(R2_GLOBALS._player._position.x - 30, R2_GLOBALS._player._position.y - 20); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + } else { + R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)); + Common::Point pt(R2_GLOBALS._player._position.x - 10, R2_GLOBALS._player._position.y); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } +} + +void Scene1550::saveCharacter(int characterIndex) { + if (R2_GLOBALS._player._characterIndex == 3) + R2_GLOBALS._sound1.fadeOut2(NULL); + + SceneExt::saveCharacter(characterIndex); +} + +void Scene1550::SceneActor1550::subA4D14(int frameNumber, int strip) { + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + postInit(); + if (scene->_field414 == 2) + setup(1551, strip, frameNumber); + else + setup(1554, strip, frameNumber); + + switch (strip) { + case 0: + switch (frameNumber - 1) { + case 0: + setup(1551, 1, 1); + setPosition(Common::Point(30, 67)); + break; + case 1: + setup(1560, 1, 5); + setPosition(Common::Point(141, 54)); + break; + case 2: + setup(1560, 2, 5); + setPosition(Common::Point(178, 54)); + break; + case 3: + setup(1560, 2, 1); + setPosition(Common::Point(289, 67)); + break; + case 4: + setup(1560, 2, 2); + setPosition(Common::Point(298, 132)); + break; + case 5: + setup(1560, 1, 2); + setPosition(Common::Point(21, 132)); + break; + case 6: + setup(1560, 2, 4); + setPosition(Common::Point(285, 123)); + break; + case 7: + setup(1560, 1, 3); + setPosition(Common::Point(30, 111)); + break; + case 8: + setup(1560, 2, 3); + setPosition(Common::Point(289, 111)); + break; + case 9: + setup(1560, 1, 4); + setPosition(Common::Point(34, 123)); + break; + default: + break; + } + fixPriority(1); + break; + case 1: + if (frameNumber == 3) { + setup(1553, 3, 1); + setPosition(Common::Point(48, 44)); + fixPriority(2); + } else { + fixPriority(1); + setPosition(Common::Point(32, 17)); + } + + switch (frameNumber) { + case 2: + setDetails(1550, 3, -1, -1, 2, (SceneItem *) NULL); + break; + case 3: + setDetails(1550, 6, -1, -1, 2, (SceneItem *) NULL); + break; + default: + setDetails(1550, 72, -1, -1, 2, (SceneItem *) NULL); + break; + } + break; + case 2: + fixPriority(1); + switch (frameNumber) { + case 4: + setup(1553, 4, 1); + setPosition(Common::Point(48, 168)); + break; + case 5: + setup(1553, 3, 2); + setPosition(Common::Point(20, 168)); + fixPriority(250); + break; + default: + setPosition(Common::Point(28, 116)); + break; + } + + switch (frameNumber) { + case 2: + setDetails(1550, 3, -1, -1, 2, (SceneItem *) NULL); + break; + case 4: + setDetails(1550, 6, -1, -1, 2, (SceneItem *) NULL); + break; + case 5: + setDetails(1550, 6, -1, -1, 2, (SceneItem *) NULL); + break; + default: + setDetails(1550, 72, -1, -1, 2, (SceneItem *) NULL); + break; + } + break; + case 3: + switch (frameNumber) { + case 2: + fixPriority(2); + if (scene->_field414 == 2) + setup(1553, 2, 1); + else + setup(1556, 2, 1); + setPosition(Common::Point(160, 44)); + break; + case 3: + fixPriority(2); + setup(1553, 5, 1); + setPosition(Common::Point(178, 44)); + break; + default: + fixPriority(1); + setPosition(Common::Point(160, 17)); + break; + } + + if (frameNumber == 1) + setDetails(1550, 3, -1, -1, 2, (SceneItem *) NULL); + else + setDetails(1550, 6, -1, -1, 2, (SceneItem *) NULL); + break; + case 4: + if (frameNumber == 2) { + fixPriority(250); + if (scene->_field414 == 2) + setup(1553, 1, 1); + else + setup(1556, 1, 1); + } else { + fixPriority(2); + } + + if (frameNumber != 1) + setDetails(1550, 6, -1, -1, 2, (SceneItem *) NULL); + + setPosition(Common::Point(160, 168)); + break; + case 5: + fixPriority(1); + setPosition(Common::Point(287, 17)); + + switch (frameNumber) { + case 2: + setDetails(1550, 3, -1, -1, 2, (SceneItem *) NULL); + break; + case 3: + setDetails(1550, 6, -1, -1, 2, (SceneItem *) NULL); + break; + default: + setDetails(1550, 72, -1, -1, 2, (SceneItem *) NULL); + break; + } + break; + case 6: + fixPriority(1); + setPosition(Common::Point(291, 116)); + + if (frameNumber == 2) + setDetails(1550, 3, -1, -1, 2, (SceneItem *) NULL); + else + setDetails(1550, 72, -1, -1, 2, (SceneItem *) NULL); + break; + default: + break; + } + +} + +void Scene1550::subA2B2F() { + Rect tmpRect; + _field419 = 0; + _field415 = 0; + + tmpRect = R2_GLOBALS._v5589E; + + _actor14.remove(); + _actor17.remove(); + _actor15.remove(); + _actor19.remove(); + _actor16.remove(); + _actor18.remove(); + + for (int i = 0; i < 8; ++i) + _arrUnkObj15501[i].remove(); + + _actor6.remove(); + + for (int i = 0; i < 8; ++i) + _arrUnkObj15502[i].remove(); + + _actor8.remove(); + _actor9.remove(); + _actor10.remove(); + _actor3.remove(); + _actor11.remove(); + + if ((_sceneMode != 1577) && (_sceneMode != 1578)) + _actor1.remove(); + + _actor2.remove(); + _actor7.remove(); + _actor13.remove(); + _actor5.remove(); + _actor12.remove(); + _actor4.remove(); + + switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2]) { + case 0: + switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]) { + case 3: + R2_GLOBALS._walkRegions.load(1554); + _field419 = 1554; + break; + case 4: + R2_GLOBALS._walkRegions.load(1553); + _field419 = 1553; + break; + default: + break; + } + break; + case 3: + // No break on purpose + case 4: + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 23) || (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex])) { + if (!R2_GLOBALS.getFlag(16)) { + R2_GLOBALS._walkRegions.load(1559); + _field419 = 1559; + } + } + break; + case 7: + switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]) { + case 10: + R2_GLOBALS._walkRegions.load(1555); + _field419 = 1555; + break; + case 11: + R2_GLOBALS._walkRegions.load(1556); + _field419 = 1556; + break; + default: + break; + } + break; + case 11: + switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]) { + case 24: + R2_GLOBALS._walkRegions.load(1558); + _field419 = 1558; + break; + case 25: + R2_GLOBALS._walkRegions.load(1557); + _field419 = 1557; + break; + default: + break; + } + break; + case 16: + switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]) { + case 2: + R2_GLOBALS._walkRegions.load(1552); + _field419 = 1552; + break; + case 3: + R2_GLOBALS._walkRegions.load(1551); + _field419 = 1551; + break; + case 15: + R2_GLOBALS._walkRegions.load(1575); + _field419 = 1575; + default: + break; + } + break; + default: + break; + } + + int varA = 0; + + if (!R2_GLOBALS.getFlag(16)) { + switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] - 2) { + case 0: + switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] - 22) { + case 0: + varA = 1553; + _actor15.subA4D14(6, 0); + break; + case 1: + // No break on purpose + case 2: + // No break on purpose + case 3: + // No break on purpose + case 4: + varA = 1553; + break; + case 5: + varA = 1553; + _actor15.subA4D14(6, 0); + break; + default: + break; + } + break; + case 1: + // No break on purpose + case 2: + switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] - 21) { + case 0: + varA = 1550; + _actor15.subA4D14(9, 0); + break; + case 1: + varA = 1552; + _actor15.subA4D14(10, 0); + break; + case 2: + // No break on purpose + case 3: + // No break on purpose + case 4: + // No break on purpose + case 5: + varA = 1552; + break; + case 6: + varA = 1552; + _actor15.subA4D14(7, 0); + break; + case 7: + varA = 1550; + _actor15.subA4D14(8, 0); + break; + default: + break; + } + break; + case 3: + switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] - 21) { + case 0: + varA = 1550; + _actor15.subA4D14(4, 0); + break; + case 1: + varA = 1550; + _actor15.subA4D14(3, 0); + break; + case 2: + // No break on purpose + case 3: + // No break on purpose + case 4: + // No break on purpose + case 5: + varA = 1551; + break; + case 6: + varA = 1550; + _actor15.subA4D14(2, 0); + break; + case 7: + varA = 1550; + _actor15.subA4D14(1, 0); + break; + default: + break; + } + break; + default: + break; + } + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] > 0) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] <= 29) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] >= 20) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] > 7)) { + R2_GLOBALS.setFlag(16); + R2_GLOBALS._sceneManager.changeScene(1500); + } + } + + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 9) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11)) { + if (R2_GLOBALS._sceneManager._sceneNumber != 1234) { + R2_GLOBALS._sceneManager._fadeMode = FADEMODE_IMMEDIATE; + loadScene(1234); + R2_GLOBALS._sceneManager._hasPalette = false; + _field414 = 0; + } + } else { + if (R2_GLOBALS._sceneManager._sceneNumber == 1234) { + R2_GLOBALS._sceneManager._fadeMode = FADEMODE_IMMEDIATE; + loadScene(1550); + R2_GLOBALS._sceneManager._hasPalette = false; + } + } + + if (R2_GLOBALS._sceneManager._sceneNumber == 1234) + _field419 = 1576; + + if (_field414 == 0) { + _field414 = 1; + } else { + if (_field414 == 2) { + _field414 = 3; + } else { + _field414 = 2; + } + + if (R2_GLOBALS._sceneManager._sceneNumber == 1550){ + warning("Mouse_hideIfNeeded()"); + warning("gfx_set_pane_p"); + for (int i = 3; i != 168; ++i) { + warning("sub294D2(4, i, 312, var14C)"); + warning("missing for loop, to be implemented"); + warning("gfx_draw_slice"); + } + warning("Missing sub2957D()"); + warning("gfx_set_pane_p()"); + R2_GLOBALS._sceneManager._fadeMode = FADEMODE_IMMEDIATE; + + if (varA == 0) { + if (_field417 != 1550) + g_globals->_scenePalette.loadPalette(1550); + R2_GLOBALS._sceneManager._hasPalette = true; + } else { + g_globals->_scenePalette.loadPalette(varA); + R2_GLOBALS._sceneManager._hasPalette = true; + } + + if (R2_GLOBALS._sceneManager._hasPalette) + _field417 = varA; + + warning("sub_2C429()"); + } + } + + switch (k5A4D6[(R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] * 30)] + R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]) { + case 0: + if (_field419 == 0) { + R2_GLOBALS._walkRegions.load(1550); + _field419 = 1550; + } + break; + case 1: + if (_field419 == 0) { + R2_GLOBALS._walkRegions.load(1560); + _field419 = 1560; + } + _actor14.subA4D14(2, 1); + _actor15.subA4D14(1, 3); + _actor16.subA4D14(2, 5); + break; + case 2: + R2_GLOBALS._walkRegions.load(1561); + _field419 = 1561; + _actor14.subA4D14(2, 1); + _actor17.subA4D14(2, 2); + _actor15.subA4D14(1, 3); + _actor16.subA4D14(2, 5); + break; + case 3: + R2_GLOBALS._walkRegions.load(1562); + _field419 = 1562; + _actor14.subA4D14(2, 1); + _actor15.subA4D14(1, 3); + _actor16.subA4D14(2, 5); + _actor18.subA4D14(2, 6); + break; + case 4: + R2_GLOBALS._walkRegions.load(1563); + _field419 = 1563; + _actor15.subA4D14(2, 3); + break; + case 5: + R2_GLOBALS._walkRegions.load(1564); + _field419 = 1564; + _actor19.subA4D14(2, 4); + break; + case 6: + R2_GLOBALS._walkRegions.load(1565); + _field419 = 1565; + _actor14.subA4D14(1, 1); + _actor17.subA4D14(1, 2); + _actor15.subA4D14(3, 3); + break; + case 7: + R2_GLOBALS._walkRegions.load(1566); + _field419 = 1566; + _actor14.subA4D14(1, 1); + _actor17.subA4D14(1, 2); + _actor15.subA4D14(2, 4); + break; + case 8: + R2_GLOBALS._walkRegions.load(1567); + _field419 = 1567; + _actor17.subA4D14(5, 2); + break; + case 9: + R2_GLOBALS._walkRegions.load(1568); + _field419 = 1568; + _actor17.subA4D14(4, 2); + break; + case 10: + R2_GLOBALS._walkRegions.load(1569); + _field419 = 1569; + _actor14.subA4D14(3, 1); + break; + case 11: + R2_GLOBALS._walkRegions.load(1570); + _field419 = 1570; + _actor14.subA4D14(1, 1); + _actor17.subA4D14(1, 2); + break; + case 12: + R2_GLOBALS._walkRegions.load(1571); + _field419 = 1571; + _actor16.subA4D14(1, 5); + _actor18.subA4D14(1, 6); + break; + case 13: + R2_GLOBALS._walkRegions.load(1572); + _field419 = 1572; + _actor14.subA4D14(1, 1); + _actor17.subA4D14(1, 2); + _actor19.subA4D14(1, 4); + break; + case 14: + R2_GLOBALS._walkRegions.load(1573); + _field419 = 1573; + _actor19.subA4D14(1, 4); + _actor16.subA4D14(1, 5); + _actor18.subA4D14(1, 6); + break; + case 15: + R2_GLOBALS._walkRegions.load(1574); + _field419 = 1574; + _actor19.subA4D14(1, 4); + break; + case 16: + R2_GLOBALS._walkRegions.load(1570); + _field419 = 1570; + _actor14.subA4D14(2, 1); + _actor17.subA4D14(2, 2); + break; + case 17: + R2_GLOBALS._walkRegions.load(1570); + _field419 = 1570; + _actor14.subA4D14(2, 1); + _actor17.subA4D14(3, 2); + break; + case 18: + R2_GLOBALS._walkRegions.load(1571); + _field419 = 1571; + _actor16.subA4D14(2, 5); + _actor18.subA4D14(2, 6); + break; + case 19: + R2_GLOBALS._walkRegions.load(1571); + _field419 = 1571; + _actor16.subA4D14(2, 5); + _actor18.subA4D14(3, 6); + break; + default: + break; + } + + int di = 0; + int tmpIdx = 0; + // Original game was checking "i < 129" but it was clearly a bug as it's out of bounds + for (int i = 0; i < 129 * 4; i += 4) { + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == k562CC[i]) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == k562CC[i + 1]) && (k562CC[i + 2] != 0)) { + tmpIdx = k562CC[i + 3]; + _arrUnkObj15501[di].postInit(); + _arrUnkObj15501[di]._effect = 6; + _arrUnkObj15501[di]._shade = 0; + _arrUnkObj15501[di]._fieldA4 = tmpIdx; + _arrUnkObj15501[di]._fieldA6 = i; + _arrUnkObj15501[di].setDetails(1550, 62, -1, 63, 2, (SceneItem *) NULL); + if (k562CC[i + 2] == 41) { + _arrUnkObj15501[di].changeZoom(-1); + _arrUnkObj15501[di].setPosition(Common::Point(150, 70)); + _arrUnkObj15501[di].setup(1562, 1, 1); + R2_GLOBALS._walkRegions.enableRegion(k5A78C); + R2_GLOBALS._walkRegions.enableRegion(k5A78D); + R2_GLOBALS._walkRegions.enableRegion(k5A790); + R2_GLOBALS._walkRegions.enableRegion(k5A791); + if (R2_INVENTORY.getObjectScene(R2_JOYSTICK) == 1550) { + _actor9.postInit(); + _actor9.setup(1562, 3, 1); + _actor9.setPosition(Common::Point(150, 70)); + _actor9.fixPriority(10); + _actor9.setDetails(1550, 41, -1, 42, 2, (SceneItem *) NULL); + } + } else { + if (k562CC[i + 2] > 40) { + _arrUnkObj15501[di].changeZoom(100); + _arrUnkObj15501[di].setup(1561, 1, k562CC[i + 2] - 40); + } else { + _arrUnkObj15501[di].changeZoom(-1); + _arrUnkObj15501[di].setup(1552, ((k562CC[i + 2] - 1) / 5) + 1, ((k562CC[i + 2] - 1) % 5) + 1); + } + _arrUnkObj15501[di].setPosition(Common::Point(k5A72E[tmpIdx], k5A73F[tmpIdx])); + if (k5A78A[tmpIdx] != 0) + R2_GLOBALS._walkRegions.enableRegion(k5A78A[tmpIdx]); + di++; + } + } + } + + for (int i = 0; i < 15 * 3; i++) { + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == k5A79B[i]) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == k5A79B[i + 1])) { + tmpIdx = k5A79B[i + 2]; + switch (tmpIdx - 1) { + case 0: + if (!R2_GLOBALS.getFlag(16)) { + _actor1.postInit(); + if (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 3) + _actor1.setup(1555, 2, 1); + else + _actor1.setup(1555, 1, 1); + _actor1.setPosition(Common::Point(150, 100)); + _actor1.fixPriority(92); + _actor1.setDetails(1550, 73, -1, -1, 2, (SceneItem *) NULL); + } + break; + case 1: + _actor13.postInit(); + warning("_actor13._actorName = \"dish\";"); + if (R2_GLOBALS.getFlag(19)) + _actor13.setup(1556, 3, 5); + else + _actor13.setup(1556, 3, 1); + _actor13.changeZoom(95); + _actor13.setPosition(Common::Point(165, 83)); + _actor13.fixPriority(168); + _actor13.setDetails(1550, 17, -1, 19, 2, (SceneItem *) NULL); + + _actor12.postInit(); + _actor12.setup(1556, 4, 1); + _actor12.setPosition(Common::Point(191, 123)); + _actor12.changeZoom(95); + _actor12.setDetails(1550, 65, -1, 66, 2, (SceneItem *) NULL); + + _actor5.postInit(); + _actor5._numFrames = 5; + if (R2_GLOBALS.getFlag(19)) + _actor5.setup(1556, 8, 5); + else + _actor5.setup(1556, 8, 1); + + _actor5.setPosition(Common::Point(156, 151)); + _actor5.fixPriority(10); + + _actor4.postInit(); + if (R2_GLOBALS.getFlag(20)) + _actor4.setup(1558, 3, 10); + else + _actor4.setup(1558, 3, 1); + + _actor4.setPosition(Common::Point(172, 48)); + _actor4.fixPriority(169); + R2_GLOBALS._walkRegions.enableRegion(k5A78A[15]); + break; + case 2: + _actor6.postInit(); + _actor6.setup(1550, 1, 1); + _actor6.setPosition(Common::Point(259, 55)); + _actor6.fixPriority(133); + _actor6.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL); + + _actor1.postInit(); + _actor1.setup(1550, 1, 2); + _actor1.setPosition(Common::Point(259, 133)); + _actor1.fixPriority(105); + _actor1.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL); + if (R2_INVENTORY.getObjectScene(R2_GYROSCOPE) == 1550) { + _actor10.postInit(); + _actor10.setup(1550, 7, 2); + _actor10.setPosition(Common::Point(227, 30)); + _actor10.fixPriority(130); + _actor10.setDetails(1550, 29, -1, 63, 2, (SceneItem *) NULL); + } + break; + case 3: + _actor6.postInit(); + _actor6.setup(1550, 1, 4); + _actor6.setPosition(Common::Point(76, 131)); + _actor6.fixPriority(10); + _actor6.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL); + + _actor1.postInit(); + _actor1.setup(1550, 1, 3); + _actor1.setPosition(Common::Point(76, 64)); + _actor1.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL); + if (R2_INVENTORY.getObjectScene(R2_DIAGNOSTICS_DISPLAY) == 1550) { + _actor11.postInit(); + _actor11.setup(1504, 4, 1); + _actor11.setPosition(Common::Point(49, 35)); + _actor11.animate(ANIM_MODE_2, NULL); + _actor11._numFrames = 4; + _actor11.fixPriority(65); + _actor11.setDetails(1550, 14, 15, 63, 2, (SceneItem *) NULL); + } + if (R2_INVENTORY.getObjectScene(R2_AIRBAG) == 1550) { + _actor8.postInit(); + _actor8.setup(1550, 7, 1); + _actor8.setPosition(Common::Point(45, 44)); + _actor8.fixPriority(150); + _actor8.setDetails(1550, 44, -1, 63, 2, (SceneItem *) NULL); + } + break; + case 4: + _actor6.postInit(); + _actor6.setup(1550, 2, 4); + _actor6.setPosition(Common::Point(243, 131)); + _actor6.fixPriority(10); + _actor6.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL); + + _actor1.postInit(); + _actor1.setup(1550, 2, 3); + _actor1.setPosition(Common::Point(243, 64)); + _actor1.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL); + break; + case 5: + _actor6.postInit(); + _actor6.setup(1550, 2, 1); + _actor6.setPosition(Common::Point(60, 55)); + _actor6.fixPriority(133); + _actor6.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL); + + _actor1.postInit(); + _actor1.setup(1550, 2, 2); + _actor1.setPosition(Common::Point(60, 133)); + _actor1.fixPriority(106); + _actor1.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL); + break; + case 6: + _actor6.postInit(); + _actor6.setup(1550, 3, 1); + _actor6.setPosition(Common::Point(281, 132)); + _actor6.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL); + break; + case 7: + _actor6.postInit(); + _actor6.setup(1550, 3, 2); + _actor6.setPosition(Common::Point(57, 96)); + _actor6.fixPriority(70); + _actor6.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL); + + _actor1.postInit(); + _actor1.setup(1550, 3, 3); + _actor1.setPosition(Common::Point(145, 88)); + _actor1.fixPriority(55); + _actor1.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL); + + _actor2.postInit(); + _actor2.setup(1550, 3, 4); + _actor2.setPosition(Common::Point(64, 137)); + _actor2.fixPriority(115); + _actor2.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL); + + _actor3.postInit(); + _actor3.setup(1550, 5, 1); + _actor3.setPosition(Common::Point(60, 90)); + _actor3.fixPriority(45); + break; + case 8: + _actor6.postInit(); + _actor6.setup(1550, 4, 2); + _actor6.setPosition(Common::Point(262, 96)); + _actor6.fixPriority(70); + _actor6.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL); + + _actor1.postInit(); + _actor1.setup(1550, 4, 3); + _actor1.setPosition(Common::Point(174, 88)); + _actor1.fixPriority(55); + _actor1.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL); + + _actor2.postInit(); + _actor2.setup(1550, 4, 4); + _actor2.setPosition(Common::Point(255, 137)); + _actor2.fixPriority(115); + _actor2.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL); + + _actor3.postInit(); + _actor3.setup(1550, 6, 1); + _actor3.setPosition(Common::Point(259, 90)); + _actor3.fixPriority(45); + break; + case 9: + _actor6.postInit(); + _actor6.setup(1550, 4, 1); + _actor6.setPosition(Common::Point(38, 132)); + _actor6.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL); + break; + case 11: + _arrUnkObj15502[7].subA5CDF(8); + _arrUnkObj15502[0].subA5CDF(1); + _arrUnkObj15502[1].subA5CDF(2); + _arrUnkObj15502[2].subA5CDF(3); + _arrUnkObj15502[3].subA5CDF(4); + _arrUnkObj15502[4].subA5CDF(5); + _arrUnkObj15502[5].subA5CDF(6); + _arrUnkObj15502[6].subA5CDF(7); + default: + break; + } + } + } + + if ((R2_GLOBALS._v565EC[1] == R2_GLOBALS._v565EC[2]) && (R2_GLOBALS._v565EC[3] == R2_GLOBALS._v565EC[4])) { + _actor7.postInit(); + _actor7._effect = 7; + _actor7.changeZoom(-1); + + assert((_field419 >= 1550) && (_field419 <= 2008)); + R2_GLOBALS._walkRegions.enableRegion(k5A750[_field419 - 1550]); + _actor7.setPosition(Common::Point(k5A72E[k5A76D[_field419 - 1550]], k5A73F[k5A76D[_field419 - 1550]] + 8)); + if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterScene[2] == 1580) { + _actor7.setup(1516, 3, 17); + _actor7.setPosition(Common::Point(272, 94)); + _actor7.fixPriority(91); + _actor7.changeZoom(100); + _actor7.setDetails(1550, -1, -1, -1, 5, &_arrUnkObj15502[7]); + } else { + _actor7.setup(1505, 6, 1); + _actor7.setDetails(1550, -1, -1, -1, 2, (SceneItem *) NULL); + } + } else { + if (R2_GLOBALS._player._characterScene[1] == 1580) { + _actor7.setup(1516, 2, 14); + _actor7.setPosition(Common::Point(276, 97)); + _actor7.fixPriority(91); + _actor7.changeZoom(100); + _actor7.setDetails(1550, -1, -1, -1, 5, &_arrUnkObj15502[7]); + } else { + _actor7.setup(1500, 6, 1); + _actor7.setDetails(1550, -1, -1, -1, 2, (SceneItem *) NULL); + } + } + } + R2_GLOBALS._uiElements.updateInventory(); +} + +/*-------------------------------------------------------------------------- + * Scene 1575 - + * + *--------------------------------------------------------------------------*/ +Scene1575::Scene1575() { + _field412 = 0; + _field414 = 0; + _field416 = 0; + _field418 = 0; + _field41A = 0; +} + +void Scene1575::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_field414); + s.syncAsSint16LE(_field416); + s.syncAsSint16LE(_field418); + s.syncAsSint16LE(_field41A); +} + +Scene1575::Hotspot1::Hotspot1() { + _field34 = 0; + _field36 = 0; +} + +void Scene1575::Hotspot1::synchronize(Serializer &s) { + NamedHotspot::synchronize(s); + + s.syncAsSint16LE(_field34); + s.syncAsSint16LE(_field36); +} + +void Scene1575::Hotspot1::process(Event &event) { + if ((event.eventType != EVENT_BUTTON_DOWN) || (R2_GLOBALS._events.getCursor() != R2_STEPPING_DISKS) || (!_bounds.contains(event.mousePos))) { + if (_field36 == 0) + return; + if ((_field34 == 1) || (event.eventType == EVENT_BUTTON_UP) || (!_bounds.contains(event.mousePos))) { + _field36 = 0; + return; + } + } + _field36 = 1; + Scene1575 *scene = (Scene1575 *)R2_GLOBALS._sceneManager._scene; + + event.handled = true; + if (R2_GLOBALS.getFlag(18) && (_field34 > 1) && (_field34 < 6)) { + warning("sub1A03B(\"Better not move the laser while it\'s firing!\", 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);"); + return; + } + int di = scene->_actor1._position.x; + + switch (_field34 - 1) { + case 0: + if (R2_GLOBALS.getFlag(18)) { + scene->_actor14.hide(); + scene->_actor15.hide(); + R2_GLOBALS.clearFlag(18); + } else if ((scene->_actor12._position.x == 85) && (scene->_actor12._position.y == 123)) { + scene->_actor14.show(); + scene->_actor15.show(); + R2_GLOBALS.setFlag(18); + } else { + warning("sub1A03B(\"That\'s probably not a good thing, ya know!\", 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);"); + } + break; + case 1: + if (scene->_field41A < 780) { + if (di > 54) + di -= 65; + di += 2; + scene->_field41A += 2; + + for (int i = 0; i < 17; i++) + scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x + 2, scene->_arrActor[i]._position.y)); + + scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x + 2, scene->_actor13._position.y)); + scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x + 2, scene->_actor12._position.y)); + scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y)); + scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y)); + scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y)); + } + break; + case 2: + if (scene->_field41A > 0) { + if (di < -8) + di += 65; + + di -= 2; + scene->_field41A -= 2; + for (int i = 0; i < 178; i++) + scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x - 2, scene->_arrActor[i]._position.y)); + + scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x - 2, scene->_actor13._position.y)); + scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x - 2, scene->_actor12._position.y)); + scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y)); + scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y)); + scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y)); + } + break; + case 3: { + int tmpPosY = scene->_actor1._position.y; + if (tmpPosY < 176) { + ++tmpPosY; + for (int i = 0; i < 17; ++i) + scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x, scene->_arrActor[i]._position.y + 1)); + + scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x, scene->_actor13._position.y + 1)); + scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x, scene->_actor12._position.y + 1)); + scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y)); + scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y)); + scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y)); + } + } + break; + case 4: { + int tmpPosY = scene->_actor1._position.y; + if (tmpPosY > 145) { + tmpPosY--; + for (int i = 0; i < 17; ++i) + scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x, scene->_arrActor[i]._position.y - 1)); + + scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x, scene->_actor13._position.y - 1)); + scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x, scene->_actor12._position.y - 1)); + scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y)); + scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y)); + scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y)); + } + } + break; + case 5: + R2_GLOBALS._sceneManager.changeScene(1550); + break; + default: + break; + } + + int j = 0; + for (int i = 0; i < 17; i++) { + if (scene->_arrActor[i]._bounds.contains(85, 116)) + j = i; + } + + if (scene->_actor13._bounds.contains(85, 116)) + j = 18; + + if (scene->_actor12._bounds.contains(85, 116)) + j = 19; + + if (j) + scene->_actor11.show(); + else + scene->_actor11.hide(); +} + +bool Scene1575::Hotspot1::startAction(CursorType action, Event &event) { + if (action == CURSOR_USE) + return false; + return SceneHotspot::startAction(action, event); +} + +void Scene1575::Hotspot1::subA910D(int indx) { + warning("STUB: Scene1575:Hotspot1::subA910D(%d)", indx); +} + +void Scene1575::postInit(SceneObjectList *OwnerList) { + loadScene(1575); + R2_GLOBALS._uiElements._active = false; + R2_GLOBALS._v5589E = Rect(0, 0, 320, 200); + SceneExt::postInit(); + _field414 = 390; + + _actor1.postInit(); + _actor1.setup(1575, 1, 1); + _actor1.setPosition(Common::Point(54, 161)); + _actor1.fixPriority(5); + + _actor2.postInit(); + _actor2.setup(1575, 1, 1); + _actor2.setPosition(Common::Point(119, 161)); + _actor2.fixPriority(5); + + _actor3.postInit(); + _actor3.setup(1575, 1, 1); + _actor3.setPosition(Common::Point(184, 161)); + _actor3.fixPriority(5); + + for (int i = 0; i < 17; i++) { + _arrActor[i].postInit(); + _arrActor[i].setup(1575, 2, k5A7F6[(3 * i) + 2]); + warning("TODO: immense pile of floating operations"); + _arrActor[i].fixPriority(6); + } + + _actor4.postInit(); + _actor4.setup(1575, 3, 1); + _actor4.setPosition(Common::Point(48, 81)); + + _actor5.postInit(); + _actor5.setup(1575, 3,1); + _actor5.setPosition(Common::Point(121, 81)); + + _actor6.postInit(); + _actor6.setup(1575, 3, 2); + _actor6.setPosition(Common::Point(203, 80)); + + _actor7.postInit(); + _actor7.setup(1575, 3, 2); + _actor7.setPosition(Common::Point(217, 80)); + + _actor8.postInit(); + _actor8.setup(1575, 3, 2); + _actor8.setPosition(Common::Point(231, 80)); + + _actor9.postInit(); + _actor9.setup(1575, 3, 2); + _actor9.setPosition(Common::Point(273, 91)); + + _actor10.postInit(); + _actor10.setup(1575, 3, 2); + _actor10.setPosition(Common::Point(287, 91)); + + _item1.subA910D(1); + _item1.subA910D(2); + _item1.subA910D(3); + _item1.subA910D(4); + _item1.subA910D(5); + _item1.subA910D(6); + + _actor11.postInit(); + _actor11.setup(1575, 4, 2); + _actor11.setPosition(Common::Point(84, 116)); + _actor11.hide(); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.enableControl(); + + do { + _field412 = R2_GLOBALS._randomSource.getRandomNumber(20) - 10; + _field414 = R2_GLOBALS._randomSource.getRandomNumber(20) - 10; + } while ((_field412) && (_field414)); + + if (_field412 < 0) + _actor4.hide(); + + if (_field414 < 0) + _actor5.hide(); + + _field416 = R2_GLOBALS._randomSource.getRandomNumber(4) + 1; + _field418 = R2_GLOBALS._randomSource.getRandomNumber(4) + 1; + + _actor13.postInit(); + _actor13.setup(1575, 2, 4); + + warning("TODO: another immense pile of floating operations"); + + _actor12.postInit(); + _actor12.fixPriority(12); + + if (R2_GLOBALS.getFlag(17)) { + _actor13.setPosition(Common::Point(_actor13._position.x + 5, _actor13._position.y)); + _actor12.setPosition(Common::Point(_actor12._position.x + 5, _actor12._position.y)); + } + + _actor14.postInit(); + _actor14.setup(1575, 5, 1); + _actor14.setPosition(Common::Point(85, 176)); + _actor14.fixPriority(7); + _actor14.hide(); + + _actor15.postInit(); + _actor15.setup(1575, 5, 2); + _actor15.setPosition(Common::Point(85, 147)); + _actor15.fixPriority(7); + _actor15.hide(); +} + +void Scene1575::remove() { + SceneExt::remove(); + R2_GLOBALS._v5589E.top = 3; + R2_GLOBALS._v5589E.bottom = 168; + R2_GLOBALS._uiElements._active = true; +} + +void Scene1575::signal() { + R2_GLOBALS._player.enableControl(); +} + +void Scene1575::process(Event &event) { + Scene::process(event); + + g_globals->_sceneObjects->recurse(SceneHandler::dispatchObject); + warning("TODO: check Scene1575::process"); +} + +void Scene1575::dispatch() { + if (_field412 <= 0) { + ++_field412; + if (_field412 == 0) { + _actor4.show(); + _field412 = R2_GLOBALS._randomSource.getRandomNumber(9) + 1; + } + } else { + _field412--; + if (_field412 ==0) { + _actor4.hide(); + _field412 = R2_GLOBALS._randomSource.getRandomNumber(9) + 1; + } + } + + if (_field414 <= 0) { + ++_field414; + if (_field414 == 0) { + _actor5.show(); + _field414 = R2_GLOBALS._randomSource.getRandomNumber(9) + 1; + } + } else { + _field414--; + if (_field414 == 0) { + _actor5.hide(); + _field414 = R2_GLOBALS._randomSource.getRandomNumber(9) + 1; + } + } + + if (_field416 == 0) { + switch(R2_GLOBALS._randomSource.getRandomNumber(3)) { + case 0: + _actor6.hide(); + _actor7.hide(); + _actor8.hide(); + break; + case 1: + _actor6.show(); + _actor7.hide(); + _actor8.hide(); + break; + case 2: + _actor6.show(); + _actor7.show(); + _actor8.hide(); + break; + case 3: + _actor6.show(); + _actor7.show(); + _actor8.show(); + break; + default: + break; + } + _field416 = R2_GLOBALS._randomSource.getRandomNumber(4) + 1; + } else { + --_field416; + } + + if (_field418 == 0) { + switch(R2_GLOBALS._randomSource.getRandomNumber(2)) { + case 0: + _actor9.hide(); + _actor10.hide(); + break; + case 1: + _actor9.show(); + _actor10.hide(); + break; + case 2: + _actor9.show(); + _actor10.show(); + break; + default: + break; + } + _field418 = R2_GLOBALS._randomSource.getRandomNumber(4) + 1; + } else { + _field418--; + } + Scene::dispatch(); +} + +/*-------------------------------------------------------------------------- + * Scene 1580 - Inside wreck + * + *--------------------------------------------------------------------------*/ +Scene1580::Scene1580() { + _field412 = 0; +} + +void Scene1580::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); +} + +bool Scene1580::Hotspot1::startAction(CursorType action, Event &event) { + Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene; + + if (action == R2_JOYSTICK) { + R2_INVENTORY.setObjectScene(26, 1580); + R2_GLOBALS._sceneItems.remove(&scene->_item1); + scene->_actor2.postInit(); + scene->_actor2.setup(1580, 1, 4); + scene->_actor2.setPosition(Common::Point(159, 163)); + scene->_actor2.setDetails(1550, 78, -1, -1, 2, (SceneItem *) NULL); + + scene->_arrActor[5].remove(); + + return true; + } + + return SceneHotspot::startAction(action, event); +} + +bool Scene1580::Hotspot2::startAction(CursorType action, Event &event) { + Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene; + + if (action == R2_DIAGNOSTICS_DISPLAY) { + R2_INVENTORY.setObjectScene(28, 1580); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._sceneItems.remove(&scene->_item2); + + scene->_actor3.postInit(); + scene->_actor3.setup(1580, 1, 1); + scene->_actor3.setPosition(Common::Point(124, 108)); + scene->_actor3.fixPriority(10); + + if (R2_INVENTORY.getObjectScene(26) == 1580) + scene->_actor3.setDetails(1550, 14, -1, -1, 5, &scene->_actor2); + else + scene->_actor3.setDetails(1550, 14, -1, -1, 2, (SceneItem *)NULL); + + scene->_actor1.postInit(); + scene->_actor1.setup(1580, 3, 1); + scene->_actor1.setPosition(Common::Point(124, 109)); + scene->_actor1.fixPriority(20); + scene->_field412 = 1; + scene->_sceneMode = 10; + scene->setAction(&scene->_sequenceManager, scene, 1, &R2_GLOBALS._player, NULL); + + return true; + } + + return SceneHotspot::startAction(action, event); +} + +bool Scene1580::Actor2::startAction(CursorType action, Event &event) { + if ( (action == CURSOR_USE) && (R2_INVENTORY.getObjectScene(28) == 1580) + && (R2_INVENTORY.getObjectScene(17) == 0) && (R2_INVENTORY.getObjectScene(22) == 0) + && (R2_INVENTORY.getObjectScene(25) == 0) && (R2_INVENTORY.getObjectScene(18) == 0) + && (R2_INVENTORY.getObjectScene(23) == 0) && (R2_INVENTORY.getObjectScene(27) == 0)) { + Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene; + scene->_sceneMode = 31; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_stripManager.start(536, scene); + else + scene->_stripManager.start(537, scene); + + return true; + } + + return SceneActor::startAction(action, event); +} + +bool Scene1580::Actor3::startAction(CursorType action, Event &event) { + if ((action == CURSOR_USE) && (R2_INVENTORY.getObjectScene(51) == 1580)) { + Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene; + + R2_INVENTORY.setObjectScene(51, R2_GLOBALS._player._characterIndex); + scene->_item2.setDetails(Rect(69, 29, 177, 108), 1550, 82, -1, -1, 2, NULL); + scene->_actor1.remove(); + remove(); + return true; + } + + return SceneActor::startAction(action, event); +} + +bool Scene1580::Actor4::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._sceneItems.remove(&scene->_actor4); + scene->_sceneMode = 0; + animate(ANIM_MODE_5, scene); + + return true; +} + +bool Scene1580::Actor5::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(); + setFrame(2); + scene->_sceneMode = 20; + scene->setAction(&scene->_sequenceManager, scene, 2, &R2_GLOBALS._player, NULL); + + return true; +} + +bool Scene1580::Actor6::startAction(CursorType action, Event &event) { + Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (R2_GLOBALS._player._characterIndex == 1) { + R2_INVENTORY.setObjectScene(23, 1); + remove(); + return true; + } + break; + case R2_COM_SCANNER: + scene->_sceneMode = 30; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + scene->_stripManager.start(529, scene); + return true; + break; + case R2_COM_SCANNER_2: + scene->_sceneMode = 30; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + scene->_stripManager.start(527, scene); + return true; + break; + default: + break; + } + + return SceneActor::startAction(action, event); +} + +bool Scene1580::Actor7::startAction(CursorType action, Event &event) { + Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (R2_GLOBALS._player._characterIndex == 1) { + R2_INVENTORY.setObjectScene(27, 1); + remove(); + return true; + } + break; + case R2_COM_SCANNER: + scene->_sceneMode = 30; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + scene->_stripManager.start(529, scene); + return true; + break; + case R2_COM_SCANNER_2: + scene->_sceneMode = 30; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + scene->_stripManager.start(527, scene); + return true; + break; + default: + break; + } + + return SceneActor::startAction(action, event); +} + +void Scene1580::postInit(SceneObjectList *OwnerList) { + loadScene(1580); + R2_GLOBALS._sceneManager._fadeMode = FADEMODE_GRADUAL; + SceneExt::postInit(); + _field412 = 0; + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + + _sceneMode = 0; + + R2_GLOBALS._player.disableControl(); + if (R2_INVENTORY.getObjectScene(26) == 1580) { + _actor2.postInit(); + _actor2.setup(1580, 1, 4); + _actor2.setPosition(Common::Point(159, 163)); + _actor2.setDetails(1550, 78, -1, -1, 1, (SceneItem *) NULL); + } else { + _item1.setDetails(Rect(141, 148, 179, 167), 1550, 79, -1, -1, 1, NULL); + } + + if (R2_INVENTORY.getObjectScene(51) == 1580) { + _actor3.postInit(); + _actor3.setup(1580, 1, 1); + _actor3.setPosition(Common::Point(124, 108)); + _actor3.fixPriority(10); + _actor3.setDetails(1550, 13, -1, -1, 1, (SceneItem *) NULL); + + _actor1.postInit(); + _actor1.setup(1580, 1, 3); + _actor1.setPosition(Common::Point(124, 96)); + _actor1.fixPriority(20); + } else if (R2_INVENTORY.getObjectScene(28) == 1580) { + _actor3.postInit(); + _actor3.setup(1580, 1, 1); + _actor3.setPosition(Common::Point(124, 108)); + _actor3.fixPriority(10); + _actor3.setDetails(1550, 14, -1, -1, 1, (SceneItem *) NULL); + + _actor1.postInit(); + _actor1.setup(1580, 3, 1); + _actor1.setPosition(Common::Point(124, 109)); + _actor1.fixPriority(20); + + _sceneMode = 10; + } else { + _item2.setDetails(Rect(69, 29, 177, 108), 1550, 82, -1, -1, 1, NULL); + } + + _actor4.postInit(); + if (R2_INVENTORY.getObjectScene(58) == 0) { + _actor4.setup(1580, 5, 1); + _actor4.setDetails(1550, 80, -1, -1, 1, (SceneItem *) NULL); + } else { + _actor4.setup(1580, 5, 6); + } + + _actor4.setPosition(Common::Point(216, 108)); + _actor4.fixPriority(100); + + _actor5.postInit(); + _actor5.setup(1580, 4, 1); + _actor5.setPosition(Common::Point(291, 147)); + _actor5.fixPriority(100); + _actor5.setDetails(1550, 81, -1, -1, 1, (SceneItem *) NULL); + + if (R2_INVENTORY.getObjectScene(23) == 1580) { + _actor6.postInit(); + _actor6.setup(1580, 6, 2); + _actor6.setPosition(Common::Point(222, 108)); + _actor6.fixPriority(50); + _actor6.setDetails(1550, 32, -1, 34, 1, (SceneItem *) NULL); + } + + if (R2_INVENTORY.getObjectScene(27) == 1580) { + _actor7.postInit(); + _actor7.setup(1580, 6, 1); + _actor7.setPosition(Common::Point(195, 108)); + _actor7.fixPriority(50); + _actor7.setDetails(1550, 38, -1, 34, 1, (SceneItem *) NULL); + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 1580; + R2_GLOBALS._player.hide(); + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + _item3.setDetails(Rect(0, 0, 320, 200), 1550, 50, -1, -1, 1, NULL); + +} + +void Scene1580::signal() { + switch (_sceneMode++) { + case 10: + _actor1.animate(ANIM_MODE_5, this); + break; + case 11: + _actor1.setup(1580, 1, 2); + _actor1.setPosition(Common::Point(124, 94)); + + if (R2_INVENTORY.getObjectScene(18) != 0) { + _arrActor[0].postInit(); + _arrActor[0].setup(1580, 2, 1); + _arrActor[0].setPosition(Common::Point(138, 56)); + } + + if (R2_INVENTORY.getObjectScene(25) != 0) { + _arrActor[1].postInit(); + _arrActor[1].setup(1580, 2, 2); + _arrActor[1].setPosition(Common::Point(140, 66)); + } + + if (R2_INVENTORY.getObjectScene(27) != 0) { + _arrActor[2].postInit(); + _arrActor[2].setup(1580, 2, 3); + _arrActor[2].setPosition(Common::Point(142, 85)); + } + + if (R2_INVENTORY.getObjectScene(23) != 0) { + _arrActor[3].postInit(); + _arrActor[3].setup(1580, 2, 4); + _arrActor[3].setPosition(Common::Point(142, 92)); + } + + if (R2_INVENTORY.getObjectScene(22) != 0) { + _arrActor[4].postInit(); + _arrActor[4].setup(1580, 2, 5); + _arrActor[4].setPosition(Common::Point(108, 54)); + } + + if (R2_INVENTORY.getObjectScene(26) != 0) { + _arrActor[5].postInit(); + _arrActor[5].setup(1580, 2, 6); + _arrActor[5].setPosition(Common::Point(110, 64)); + } + + if (R2_INVENTORY.getObjectScene(45) != 0) { + _arrActor[6].postInit(); + _arrActor[6].setup(1580, 2, 7); + _arrActor[6].setPosition(Common::Point(108, 80)); + } + + if (R2_INVENTORY.getObjectScene(17) != 0) { + _arrActor[7].postInit(); + _arrActor[7].setup(1580, 2, 8); + _arrActor[7].setPosition(Common::Point(111, 92)); + } + + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + break; + case 20: + R2_GLOBALS._sceneManager.changeScene(1550); + break; + case 31: + R2_GLOBALS._sceneManager.changeScene(1530); + break; + default: + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 1625 - Miranda being questioned + * + *--------------------------------------------------------------------------*/ +Scene1625::Scene1625() { + _field412 = 0; +} + +void Scene1625::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); +} + +bool Scene1625::Actor7::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene1625 *scene = (Scene1625 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + + scene->_sceneMode = 1631; + scene->_actor3.postInit(); + scene->setAction(&scene->_sequenceManager, scene, 1631, &scene->_actor3, &scene->_actor7, NULL); + return true; +} + +void Scene1625::postInit(SceneObjectList *OwnerList) { + loadScene(1625); + R2_GLOBALS._player._characterIndex = R2_MIRANDA; + SceneExt::postInit(); + + _stripManager.addSpeaker(&_mirandaSpeaker); + _stripManager.addSpeaker(&_tealSpeaker); + _stripManager.addSpeaker(&_soldierSpeaker); + + R2_GLOBALS._player.postInit(); + + _actor7.postInit(); + _actor7.setup(1626, 2, 1); + _actor7.setPosition(Common::Point(206, 133)); + _actor7.setDetails(1625, 0, -1, -1, 1, (SceneItem *) NULL); + + _actor5.postInit(); + _actor5.setup(1625, 8, 1); + _actor5.setPosition(Common::Point(190, 131)); + _actor5.setDetails(1625, 6, -1, 2, 1, (SceneItem *) NULL); + + if (R2_GLOBALS._player._oldCharacterScene[3] == 1625) { + if (!R2_GLOBALS.getFlag(83)) { + _actor4.postInit(); + _actor4.setup(1626, 4, 1); + _actor4.setPosition(Common::Point(96, 166)); + _actor4.setDetails(1625, -1, -1, -1, 1, (SceneItem *) NULL); + } + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + } else { + _actor1.postInit(); + _actor1.fixPriority(10); + + _actor6.postInit(); + + R2_GLOBALS._player.disableControl(); + _sceneMode = 1625; + setAction(&_sequenceManager, this, 1625, &_actor1, &_actor6, NULL); + } + + R2_GLOBALS._sound1.play(245); + _item1.setDetails(Rect(0, 0, 320, 200), 1625, 12, -1, -1, 1, NULL); + R2_GLOBALS._player._oldCharacterScene[3] = 1625; + R2_GLOBALS._player._characterScene[3] = 1625; +} + +void Scene1625::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene1625::signal() { + switch (_sceneMode) { + case 10: + R2_GLOBALS._player.disableControl(); + _actor4.postInit(); + _actor4.setDetails(1625, -1, -1, -1, 2, (SceneItem *) NULL); + _sceneMode = 1626; + setAction(&_sequenceManager, this, 1626, &_actor2, &_actor4, NULL); + break; + case 12: + // TODO: check if OK_BTN_STRING is required + MessageDialog::show(DONE_MSG, OK_BTN_STRING); + break; + case 14: + _actor2.postInit(); + _actor2.setup(1627, 1, 1); + _actor2.setPosition(Common::Point(68, 68)); + _sceneMode = 99; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(831, this); + break; + case 99: + R2_GLOBALS._player.disableControl(); + switch (_stripManager._field2E8) { + case 0: + _sceneMode = 1627; + setAction(&_sequenceManager, this, 1627, &_actor3, &_actor4, NULL); + break; + case 1: + _sceneMode = 1629; + setAction(&_sequenceManager, this, 1629, &_actor2, &_actor5, NULL); + break; + case 3: + R2_GLOBALS._player._oldCharacterScene[3] = 3150; + R2_GLOBALS._player._characterScene[3] = 3150; + R2_GLOBALS._player._characterIndex = R2_QUINN; + R2_GLOBALS._sceneManager.changeScene(R2_GLOBALS._player._characterScene[1]); + break; + case 4: + _sceneMode = 1628; + _actor2.remove(); + setAction(&_sequenceManager, this, 1628, &_actor3, &_actor4, NULL); + break; + case 5: + _actor4.postInit(); + _actor4.setDetails(1625, -1, -1, -1, 2, (SceneItem *) NULL); + _sceneMode = 1632; + setAction(&_sequenceManager, this, 1632, &_actor4, NULL); + break; + case 6: + _sceneMode = 1633; + setAction(&_sequenceManager, this, 1633, &_actor4, NULL); + break; + case 7: + _sceneMode = 1635; + setAction(&_sequenceManager, this, 1635, &_actor3, &_actor5, NULL); + break; + case 8: + _actor4.postInit(); + _actor4.setDetails(1625, -1, -1, -1, 2, (SceneItem *) NULL); + _sceneMode = 1634; + setAction(&_sequenceManager, this, 1634, &_actor3, &_actor5, NULL); + break; + case 2: + // No break on purpose + default: + _sceneMode = 1630; + _actor2.postInit(); + setAction(&_sequenceManager, this, 1630, &_actor1, &_actor6, NULL); + break; + } + _field412 = _stripManager._field2E8; + _stripManager._field2E8 = 0; + break; + case 1625: + _actor2.postInit(); + _actor2.setup(1627, 1, 1); + _actor2.setPosition(Common::Point(68, 68)); + _sceneMode = 10; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(800, this); + break; + case 1626: + _actor2.setup(1627, 1, 1); + _actor2.setPosition(Common::Point(68, 68)); + _actor2.show(); + + _actor3.postInit(); + _actor3.setup(1627, 3, 1); + _actor3.setPosition(Common::Point(196, 65)); + + _sceneMode = 99; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(832, this); + break; + case 1627: + _actor3.setup(1627, 3, 1); + _actor3.setPosition(Common::Point(196, 65)); + _actor3.show(); + + _sceneMode = 99; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(833, this); + break; + case 1628: + R2_GLOBALS.setFlag(83); + _actor2.postInit(); + _actor2.setup(1627, 1, 1); + _actor2.setPosition(Common::Point(68, 68)); + + _actor3.setup(1627, 3, 1); + _actor3.setPosition(Common::Point(196, 65)); + _actor3.show(); + + _sceneMode = 99; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(834, this); + break; + case 1629: + _actor2.setup(1627, 1, 1); + _actor2.setPosition(Common::Point(68, 68)); + _actor2.show(); + + _sceneMode = 99; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(805, this); + break; + case 1630: + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = true; + break; + case 1631: + _actor3.setup(1627, 3, 1); + _actor3.setPosition(Common::Point(196, 65)); + _actor3.show(); + + _actor7.remove(); + + _actor1.postInit(); + _actor1.fixPriority(10); + + _actor6.postInit(); + warning("_actor6._actorName = \"arm\";"); + + R2_INVENTORY.setObjectScene(40, 3); + _sceneMode = 14; + + setAction(&_sequenceManager, this, 1625, &_actor1, &_actor6, NULL); + break; + case 1632: + _actor2.setup(1627, 1, 1); + _actor2.setPosition(Common::Point(68, 68)); + _actor2.show(); + + _sceneMode = 99; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(835, this); + break; + case 1633: + _actor4.remove(); + _sceneMode = 99; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(818, this); + break; + case 1634: + _sceneMode = 99; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(836, this); + break; + case 1635: + _actor3.setup(1627, 3, 1); + _actor3.setPosition(Common::Point(196, 65)); + _actor3.show(); + + _sceneMode = 99; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(818, this); + break; + default: + break; + } +} + +void Scene1625::process(Event &event) { + if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) + event.handled = true; + else + Scene::process(event); +} + +/*-------------------------------------------------------------------------- + * Scene 1700 - + * + *--------------------------------------------------------------------------*/ +Scene1700::Scene1700() { + _field77A = 0; + _field77C = 0; +} + +void Scene1700::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field77A); + s.syncAsSint16LE(_field77C); +} + +bool Scene1700::Item2::startAction(CursorType action, Event &event) { + // The original contains a debug trace. It's currently skipped. + // TODO: either add the debug trace, or remove this function and associated class + return SceneHotspot::startAction(action, event); +} + +bool Scene1700::Actor11::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene1700 *scene = (Scene1700 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._v558B6.set(80, 0, 240, 200); + scene->_sceneMode = 4; + + Common::Point pt(271, 90); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + + return true; +} + +bool Scene1700::Actor12::startAction(CursorType action, Event &event) { + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + Scene1700 *scene = (Scene1700 *)R2_GLOBALS._sceneManager._scene; + scene->_sceneMode = 30; + scene->signal(); + + return true; +} + +void Scene1700::Exit1::changeScene() { + Scene1700 *scene = (Scene1700 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(); + _moving = false; + scene->_sceneMode = 1; + + Common::Point pt(R2_GLOBALS._player._position.x, 0); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene1700::Exit2::changeScene() { + Scene1700 *scene = (Scene1700 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(); + _moving = false; + scene->_sceneMode = 2; + + Common::Point pt(R2_GLOBALS._player._position.x, 170); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene1700::Exit3::changeScene() { + Scene1700 *scene = (Scene1700 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(); + _moving = false; + scene->_sceneMode = 6; + + Common::Point pt(0, R2_GLOBALS._player._position.y); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene1700::subAF3F8() { + Rect tmpRect; + R2_GLOBALS._walkRegions.load(1700); + + _actor3.remove(); + _actor4.remove(); + _actor5.remove(); + _actor6.remove(); + _actor7.remove(); + _actor8.remove(); + _actor11.remove(); + + if (_sceneMode != 40) { + _actor9.remove(); + _actor10.remove(); + } + + warning("tmpRect = _v5589E;"); + warning("Mouse_hideIfNeeded"); + warning("set_pane_p(_paneNumber);"); + warning("Big loop calling gfx_draw_slice_p"); + + if (_field77A == 0) + _field77A = 1; + else + _field77A = 0; + + warning("set_pane_p(_paneNumber);"); + + if ((_sceneMode != 40) && (R2_GLOBALS._v565F6 != 0)){ + _actor9.postInit(); + _actor9.setup(1701, 1, 1); + _actor9.setPosition(Common::Point(220, 137)); + _actor9.setDetails(1700, 6, -1, -1, 2, (SceneItem *) NULL); + R2_GLOBALS._walkRegions.enableRegion(2); + R2_GLOBALS._walkRegions.enableRegion(12); + } + + if ((R2_GLOBALS._v565F6 + 2) % 4 == 0) { + _actor3.postInit(); + _actor3.setup(1700, 1, 1); + _actor3.setPosition(Common::Point(222, 82)); + _actor3.setDetails(100, -1, -1, -1, 2, (SceneItem *) NULL); + + _actor5.postInit(); + _actor5.setup(1700, 2, 1); + _actor5.setPosition(Common::Point(177, 82)); + _actor5.fixPriority(0); + + _actor6.postInit(); + _actor6.setup(1700, 2, 2); + _actor6.setPosition(Common::Point(332, 96)); + _actor6.fixPriority(0); + + _actor4.postInit(); + _actor4.setup(1700, 1, 2); + _actor4.setPosition(Common::Point(424, 84)); + + R2_GLOBALS._walkRegions.enableRegion(11); + } + + if ((R2_GLOBALS._v565F6 + 399) % 800 == 0) { + _actor7.postInit(); + _actor7.setup(1700, 3, 2); + _actor7.setPosition(Common::Point(51, 141)); + _actor7.fixPriority(0); + _actor7.setDetails(100, -1, -1, -1, 2, (SceneItem *) NULL); + + _exit3._enabled = true; + } else { + R2_GLOBALS._walkRegions.enableRegion(1); + _exit3._enabled = false; + } + + if ( ((!R2_GLOBALS.getFlag(15)) && ((R2_GLOBALS._v565F6 == 25) || (R2_GLOBALS._v565F6 == -3))) + || ((R2_GLOBALS.getFlag(15)) && (R2_GLOBALS._v565F6 == R2_GLOBALS._v565FA)) + ) { + R2_GLOBALS._v565FA = R2_GLOBALS._v565F6; + if (!R2_GLOBALS.getFlag(15)) + _field77C = 1; + + _actor11.postInit(); + _actor11.setup(1700, 3, 1); + _actor11.setPosition(Common::Point(338, 150)); + _actor11.setDetails(1700, 9, -1, -1, 2, (SceneItem *) NULL); + _actor11.fixPriority(15); + + _actor8.postInit(); + _actor8.setup(1700, 4, 1); + _actor8.setPosition(Common::Point(312, 106)); + _actor8.fixPriority(130); + } +} + +void Scene1700::postInit(SceneObjectList *OwnerList) { + loadScene(1700); + SceneExt::postInit(); + if (R2_GLOBALS._sceneManager._previousScene == -1) + R2_GLOBALS._sceneManager._previousScene = 1530; + + scalePalette(65, 65, 65); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + + _field77A = 0; + _field77C = 0; + + _exit1.setDetails(Rect(94, 0, 319, 12), EXITCURSOR_N, 1700); + _exit2.setDetails(Rect(0, 161, 319, 168), EXITCURSOR_S, 1700); + _exit3.setDetails(Rect(0, 0, 2, 138), EXITCURSOR_W, 1800); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setPosition(Common::Point(0, 0)); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + R2_GLOBALS._player.setVisage(1501); + R2_GLOBALS._player._moveDiff = Common::Point(2, 1); + } else { + R2_GLOBALS._player.setVisage(1506); + R2_GLOBALS._player._moveDiff = Common::Point(3, 1); + } + + _actor12.postInit(); + _actor12.animate(ANIM_MODE_1, NULL); + _actor12.setObjectWrapper(new SceneObjectWrapper()); + + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + _actor12.setVisage(1506); + _actor12._moveDiff = Common::Point(3, 1); + _actor12.setDetails(9002, 1, -1, -1, 1, (SceneItem *) NULL); + } else { + _actor12.setVisage(1501); + _actor12._moveDiff = Common::Point(2, 1); + _actor12.setDetails(9001, 1, -1, -1, 1, (SceneItem *) NULL); + } + + R2_GLOBALS._sound1.play(134); + + _actor1.postInit(); + _actor1.fixPriority(10); + + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + _actor1.setVisage(1112); + else + _actor1.setVisage(1111); + + _actor1._effect = 5; + _actor1._field9C = _field312; + R2_GLOBALS._player._linkedActor = &_actor1; + + _actor2.postInit(); + _actor2.fixPriority(10); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + _actor2.setVisage(1111); + else + _actor2.setVisage(1112); + + _actor2._effect = 5; + _actor2._field9C = _field312; + _actor12._linkedActor = &_actor2; + + R2_GLOBALS._sound1.play(134); + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 1530: + R2_GLOBALS._player._characterIndex = R2_QUINN; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.hide(); + _actor12.hide(); + + _actor10.postInit(); + warning("_actor10._actorName = \"hatch\";"); + _actor10.hide(); + + _actor9.postInit(); + _actor9.setup(1701, 1, 1); + _actor9.setPosition(Common::Point(220, 137)); + _actor9.setDetails(1700, 6, -1, -1, 1, (SceneItem *) NULL); + + _actor1.hide(); + _actor2.hide(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(539, this); + _sceneMode = 40; + break; + case 1750: { + R2_GLOBALS._player.setPosition(Common::Point(282, 121)); + _actor12.setPosition(Common::Point(282, 139)); + _sceneMode = 8; + Common::Point pt(262, 101); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + Common::Point pt2(262, 119); + NpcMover *mover2 = new NpcMover(); + _actor12.addMover(mover2, &pt2, this); + } + break; + case 1800: { + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.setPosition(Common::Point(0, 86)); + _actor12.setPosition(Common::Point(0, 64)); + _sceneMode = 7; + R2_GLOBALS._player.setObjectWrapper(NULL); + R2_GLOBALS._player._strip = 1; + Common::Point pt(64, 86); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + _actor12.setObjectWrapper(NULL); + _actor12._strip = 1; + Common::Point pt2(77, 64); + NpcMover *mover2 = new NpcMover(); + _actor12.addMover(mover2, &pt2, NULL); + } + break; + default: + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + R2_GLOBALS._player.setPosition(Common::Point(109, 160)); + _actor12.setPosition(Common::Point(156, 160)); + R2_GLOBALS._walkRegions.enableRegion(15); + } else { + R2_GLOBALS._player.setPosition(Common::Point(156, 160)); + _actor12.setPosition(Common::Point(109, 160)); + R2_GLOBALS._walkRegions.enableRegion(17); + } + _sceneMode = 50; + setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); + break; + } + R2_GLOBALS._player._characterScene[1] = 1700; + R2_GLOBALS._player._characterScene[2] = 1700; + R2_GLOBALS._player._oldCharacterScene[1] = 1700; + R2_GLOBALS._player._oldCharacterScene[2] = 1700; + + R2_GLOBALS._v558B6.set(20, 0, 320, 200); + subAF3F8(); + _item1.setDetails(1, 1700, 3, -1, -1); + _item2.setDetails(Rect(0, 0, 480, 200), 1700, 0, -1, -1, 1, NULL); +} + +void Scene1700::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene1700::signal() { + switch (_sceneMode) { + case 1: { + _sceneMode = 3; + if ((R2_GLOBALS._v565F6 < 2400) && (R2_GLOBALS._v565F6 >= 0)) + ++R2_GLOBALS._v565F6; + subAF3F8(); + R2_GLOBALS._player.setPosition(Common::Point(235 - (((((235 - R2_GLOBALS._player._position.x) * 100) / 103) * 167) / 100), 170)); + Common::Point pt(R2_GLOBALS._player._position.x, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + + if (R2_GLOBALS._player._position.x < 132) { + _actor12.setPosition(Common::Point(156, 170)); + Common::Point pt2(156, 160); + NpcMover *mover2 = new NpcMover(); + _actor12.addMover(mover2, &pt2, NULL); + R2_GLOBALS._walkRegions.enableRegion(15); + } else { + _actor12.setPosition(Common::Point(109, 170)); + Common::Point pt3(109, 160); + NpcMover *mover3 = new NpcMover(); + _actor12.addMover(mover3, &pt3, NULL); + R2_GLOBALS._walkRegions.enableRegion(17); + } + } + break; + case 2: { + _sceneMode = 3; + if ((R2_GLOBALS._v565F6 > -2400) && (R2_GLOBALS._v565F6 < 0)) + R2_GLOBALS._v565F6--; + subAF3F8(); + R2_GLOBALS._player.setPosition(Common::Point(235 - (((((235 - R2_GLOBALS._player._position.x) * 100) / 167) * 103) / 100), 0)); + Common::Point pt(R2_GLOBALS._player._position.x, 10); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + + if (R2_GLOBALS._player._position.x >= 171) { + _actor12.setPosition(Common::Point(155, 0)); + Common::Point pt2(155, 10); + NpcMover *mover2 = new NpcMover(); + _actor12.addMover(mover2, &pt2, NULL); + R2_GLOBALS._walkRegions.enableRegion(15); + } else { + _actor12.setPosition(Common::Point(188, 0)); + Common::Point pt3(188, 10); + NpcMover *mover3 = new NpcMover(); + _actor12.addMover(mover3, &pt3, NULL); + R2_GLOBALS._walkRegions.enableRegion(17); + } + } + break; + case 3: + if (_field77C == 0) { + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + } else { + R2_GLOBALS.setFlag(15); + _field77C = 0; + _sceneMode = 31; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + _stripManager.start(542, this); + else + _stripManager.start(543, this); + } + break; + case 4: { + _sceneMode = 5; + Common::Point pt(271, 90); + PlayerMover *mover = new PlayerMover(); + _actor12.addMover(mover, &pt, NULL); + if (R2_GLOBALS._player._characterIndex == 1) + setAction(&_sequenceManager, this, 1700, &R2_GLOBALS._player, &_actor8, NULL); + else + setAction(&_sequenceManager, this, 1701, &R2_GLOBALS._player, &_actor8, NULL); + } + break; + case 5: + R2_GLOBALS._sceneManager.changeScene(1750); + break; + case 6: + R2_GLOBALS._sceneManager.changeScene(1800); + break; + case 7: + R2_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + R2_GLOBALS._player._strip = 1; + _actor12.setObjectWrapper(new SceneObjectWrapper()); + _actor12._strip = 1; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + R2_GLOBALS._walkRegions.enableRegion(14); + break; + case 8: + R2_GLOBALS._player._strip = 2; + _actor12._strip = 1; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + R2_GLOBALS._walkRegions.enableRegion(12); + break; + case 30: + _sceneMode = 31; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + _stripManager.start(540, this); + else + _stripManager.start(541, this); + break; + case 31: + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.enableControl(CURSOR_TALK); + break; + case 40: + R2_GLOBALS._player.disableControl(); + _sceneMode = 1704; + setAction(&_sequenceManager, this, 1704, &R2_GLOBALS._player, &_actor12, &_actor10, &_actor9, &_actor1, &_actor2, NULL); + break; + case 50: + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + R2_GLOBALS._walkRegions.enableRegion(15); + else + R2_GLOBALS._walkRegions.enableRegion(17); + + R2_GLOBALS._player.enableControl(); + break; + case 1704: + R2_GLOBALS._sound1.play(134); + R2_GLOBALS._walkRegions.enableRegion(15); + R2_GLOBALS._walkRegions.enableRegion(2); + R2_GLOBALS._walkRegions.enableRegion(12); + R2_GLOBALS._player.fixPriority(-1); + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 1750 - + * + *--------------------------------------------------------------------------*/ +Scene1750::Actor4::Actor4() { + _fieldA4 = 0; + _fieldA6 = 0; + _fieldA8 = 0; + _fieldAA = 0; + _fieldAC = 0; + _fieldAE = 0; +} + +void Scene1750::Actor4::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_fieldA4); + s.syncAsSint16LE(_fieldA6); + s.syncAsSint16LE(_fieldA8); + s.syncAsSint16LE(_fieldAA); + s.syncAsSint16LE(_fieldAC); + s.syncAsSint16LE(_fieldAE); +} + +Scene1750::Actor5::Actor5() { + _fieldA4 = 0; +} + +void Scene1750::Actor5::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_fieldA4); +} + +Scene1750::Scene1750() { + _field412 = 0; + _field413 = 0; + _field415 = 0; + _field417 = 0; + _field419 = 0; + _field41B = 0; + _field41D = 0; +} + +void Scene1750::synchronize(Serializer &s) { + SceneExt::synchronize(s); + SYNC_POINTER(_rotation); + + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_field413); + s.syncAsSint16LE(_field415); + s.syncAsSint16LE(_field417); + s.syncAsSint16LE(_field419); + s.syncAsSint16LE(_field41B); + s.syncAsSint16LE(_field41D); +} + +void Scene1750::Actor4::subB1A76(int arg1, int arg2, int arg3, int arg4, int arg5) { + _fieldA4 = arg1; + _fieldAE = 0; + _fieldA6 = arg2; + _fieldA8 = arg3; + _fieldAA = arg4; + _fieldAC = arg5; + + postInit(); + setup(1750, 1, 1); + fixPriority(255); + setPosition(Common::Point(_fieldA6, _fieldA8 + ((_fieldAA * (arg1 - 1)) / (_fieldAC - 1)))); +} + +void Scene1750::Actor4::subB1B27() { + Scene1750 *scene = (Scene1750 *)R2_GLOBALS._sceneManager._scene; + + int tmpVar = (_fieldAA / (_fieldAC - 1)) / 2; + int tmpVar2 = ((_position.y - _fieldA8 + tmpVar) * _fieldAC) / (_fieldAA + 2 * tmpVar); + + setPosition(Common::Point(_fieldA6, _fieldA8 + ((_fieldAA * tmpVar2) / (_fieldAC - 1)))); + scene->_field415 = scene->_field412 * tmpVar2; +} + +void Scene1750::Actor4::remove() { + // Function kept to match IDA. Could be removed. + SceneActor::remove(); +} + +void Scene1750::Actor4::process(Event &event) { + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_USE) && (_bounds.contains(event.mousePos))) { + _fieldAE = 1; + event.eventType = EVENT_NONE; + } + + if ((event.eventType == EVENT_BUTTON_UP) && (_fieldAE != 0)) { + _fieldAE = 0; + event.handled = true; + addMover(NULL); + subB1B27(); + } + + if (_fieldAE != 0) { + event.handled = true; + if (event.mousePos.y >= _fieldA8) { + if (_fieldA8 + _fieldAA >= event.mousePos.y) + setPosition(Common::Point(_fieldA6, event.mousePos.y)); + else + setPosition(Common::Point(_fieldA6, _fieldA8 + _fieldAA)); + } else { + setPosition(Common::Point(_fieldA6, _fieldA8)); + } + } +} + +bool Scene1750::Actor4::startAction(CursorType action, Event &event) { + if (action == CURSOR_USE) + return SceneActor::startAction(action, event); + + return false; +} + +bool Scene1750::Actor5::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene1750 *scene = (Scene1750 *)R2_GLOBALS._sceneManager._scene; + + switch (_fieldA4) { + case 1: + show(); + scene->_actor6.hide(); + if (scene->_field415 < 0) + scene->_field415 ^= 0xFFFE; + scene->_field412 = 1; + break; + case 2: + show(); + scene->_actor5.hide(); + if (scene->_field415 > 0) + scene->_field415 ^= 0xFFFE; + scene->_field412 = -1; + break; + case 3: + if (scene->_rotation->_idxChange == 0) { + show(); + R2_GLOBALS._sceneManager.changeScene(1700); + } else { + scene->_field415 = 0; + scene->_actor4._moveRate = 20; + scene->_actor5._moveDiff.y = 1; + Common::Point pt(286, 143); + NpcMover *mover = new NpcMover(); + scene->_actor4.addMover(mover, &pt, NULL); + } + default: + break; + } + + return true; +} + +void Scene1750::postInit(SceneObjectList *OwnerList) { + loadScene(1750); + R2_GLOBALS._sound1.play(115); + R2_GLOBALS._uiElements._active = false; + R2_GLOBALS._v5589E.set(0, 0, 320, 200); + SceneExt::postInit(); + + R2_GLOBALS._player._characterScene[1] = 1750; + R2_GLOBALS._player._characterScene[2] = 1750; + R2_GLOBALS._player._oldCharacterScene[1] = 1750; + R2_GLOBALS._player._oldCharacterScene[2] = 1750; + + _rotation = R2_GLOBALS._scenePalette.addRotation(224, 254, 1); + _rotation->setDelay(0); + _rotation->_idxChange = 0; + _rotation->_countdown = 2; + + switch ((R2_GLOBALS._v565F6 + 2) % 4) { + case 0: + _rotation->_currIndex = 247; + break; + case 1: + _rotation->_currIndex = 235; + break; + case 2: + _rotation->_currIndex = 239; + break; + case 3: + _rotation->_currIndex = 243; + break; + default: + break; + } + + byte tmpPal[768]; + + for (int i = 224; i < 255; i++) { + int tmpIndex = _rotation->_currIndex - 224; + if (tmpIndex > 254) + tmpIndex -= 31; + tmpPal[3 * i] = R2_GLOBALS._scenePalette._palette[3 * tmpIndex]; + tmpPal[(3 * i) + 1] = R2_GLOBALS._scenePalette._palette[(3 * tmpIndex) + 1]; + tmpPal[(3 * i) + 2] = R2_GLOBALS._scenePalette._palette[(3 * tmpIndex) + 2]; + } + + for (int i = 224; i < 255; i++) { + R2_GLOBALS._scenePalette._palette[3 * i] = tmpPal[3 * i]; + R2_GLOBALS._scenePalette._palette[(3 * i) + 1] = tmpPal[(3 * i) + 1]; + R2_GLOBALS._scenePalette._palette[(3 * i) + 2] = tmpPal[(3 * i) + 2]; + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.enableControl(); + + _actor3.postInit(); + _actor3.setup(1750, 3, 1); + _actor3.setPosition(Common::Point(49, 185)); + _actor3.fixPriority(7); + _actor3.setDetails(1750, 30, -1, -1, 1, (SceneItem *) NULL); + + _actor1.postInit(); + _actor1.setup(1750, 2, 1); + _actor1.setPosition(Common::Point(35, ((_rotation->_currIndex - 218) % 4) + ((R2_GLOBALS._v565F6 % 800) * 4) - 1440)); + _actor1.fixPriority(8); + + _actor2.postInit(); + _actor2.setup(1750, 1, 4); + + int tmpVar = abs(_actor1._position.y - 158) / 100; + + if (tmpVar >= 8) + _actor2.hide(); + else if (_actor1._position.y <= 158) + _actor2.setPosition(Common::Point(137, (tmpVar * 7) + 122)); + else + _actor2.setPosition(Common::Point(148, (tmpVar * 7) + 122)); + + _actor4.subB1A76(1, 286, 143, 41, 15); + _actor4.setDetails(1750, 24, 1, -1, 1, (SceneItem *) NULL); + + _actor5.postInit(); + _actor5._fieldA4 = 1; + _actor5.setup(1750, 1, 2); + _actor5.setPosition(Common::Point(192, 140)); + _actor5.setDetails(1750, 18, 1, -1, 1, (SceneItem *) NULL); + + _actor6.postInit(); + _actor6._fieldA4 = 2; + _actor6.setup(1750, 1, 3); + _actor6.setPosition(Common::Point(192, 163)); + _actor6.setDetails(1750, 18, 1, -1, 1, (SceneItem *) NULL); + _actor6.hide(); + + _actor7.postInit(); + _actor7._fieldA4 = 3; + _actor7.setup(1750, 1, 5); + _actor7.setPosition(Common::Point(230, 183)); + _actor7.setDetails(1750, 27, 1, -1, 1, (SceneItem *) NULL); + + _field412 = 1; + _field417 = 0; + _field413 = 0; + _field415 = 0; + _field419 = ((_rotation->_currIndex - 218) / 4) % 4; + + _item2.setDetails(Rect(129, 112, 155, 175), 1750, 21, -1, -1, 1, NULL); + _item3.setDetails(Rect(93, 122, 126, 172), 1750, 15, -1, -1, 1, NULL); + _item4.setDetails(Rect(3, 3, 157, 99), 1750, 9, -1, -1, 1, NULL); + _item5.setDetails(Rect(162, 3, 316, 99), 1750, 12, -1, -1, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 1750, 6, 1, -1, 1, NULL); +} + +void Scene1750::remove() { + _rotation->remove(); + + if (R2_GLOBALS._v565F6 == 2400) + R2_GLOBALS._v565F6 = 2399; + + if (R2_GLOBALS._v565F6 == -2400) + R2_GLOBALS._v565F6 = -2399; + + R2_GLOBALS._v565FA = R2_GLOBALS._v565F6; + + SceneExt::remove(); + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._v5589E.top = 3; + R2_GLOBALS._v5589E.bottom = 168; + R2_GLOBALS._uiElements._active = true; +} + +void Scene1750::signal() { + R2_GLOBALS._player.enableControl(); +} + +void Scene1750::process(Event &event) { + Scene::process(event); + if (!event.handled) + _actor4.process(event); +} + +void Scene1750::dispatch() {} + +/*-------------------------------------------------------------------------- + * Scene 1800 - + * + *--------------------------------------------------------------------------*/ +Scene1800::Scene1800() { + _field412 = 0; +} + +void Scene1800::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); +} + +bool Scene1800::Hotspot5::startAction(CursorType action, Event &event) { + if ((action != R2_COM_SCANNER) && (action != R2_COM_SCANNER_2)) + return false; + + Scene1800 *scene = (Scene1800 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + if (R2_GLOBALS._v565F6 == 1201) { + scene->_stripManager.start(548, this); + } else if (R2_GLOBALS.getFlag(66)) { + return false; + } else { + scene->_stripManager.start(546, this); + } + } else { + if (R2_GLOBALS._v565F6 == 1201) { + scene->_stripManager.start(549, this); + } else if (R2_GLOBALS.getFlag(66)) { + return false; + } else { + scene->_stripManager.start(547, this); + } + } + + R2_GLOBALS.setFlag(66); + return true; +} + +bool Scene1800::Actor6::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (!R2_GLOBALS.getFlag(14)) + return false; + + if (R2_GLOBALS._player._characterIndex != R2_QUINN) + return SceneActor::startAction(action, event); + + Scene1800 *scene = (Scene1800 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + + if (_frame == 1) { + R2_GLOBALS.setFlag(64); + scene->_sceneMode = 1810; + scene->setAction(&scene->_sequenceManager, scene, 1810, &R2_GLOBALS._player, &scene->_actor6, &scene->_actor4, &scene->_actor5, NULL); + } else { + R2_GLOBALS.clearFlag(64); + scene->_sceneMode = 1811; + scene->setAction(&scene->_sequenceManager, scene, 1811, &R2_GLOBALS._player, &scene->_actor6, &scene->_actor4, &scene->_actor5, NULL); + } + return true; +} + +bool Scene1800::Actor7::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene1800 *scene = (Scene1800 *)R2_GLOBALS._sceneManager._scene; + + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { + R2_GLOBALS._player.disableControl(); + if (scene->_field412 >= 2) { + if (R2_GLOBALS.getFlag(14)) { + scene->_sceneMode = 1809; + scene->setAction(&scene->_sequenceManager, scene, 1809, &R2_GLOBALS._player, &scene->_actor7, NULL); + R2_GLOBALS.clearFlag(14); + } else { + scene->_sceneMode = 1808; + scene->setAction(&scene->_sequenceManager, scene, 1808, &R2_GLOBALS._player, &scene->_actor7, NULL); + R2_GLOBALS.setFlag(14); + } + } else { + scene->_sceneMode = 1813; + scene->setAction(&scene->_sequenceManager, scene, 1813, &R2_GLOBALS._player, NULL); + } + } else if (R2_GLOBALS.getFlag(14)) { + return SceneActor::startAction(action, event); + } else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1812; + scene->setAction(&scene->_sequenceManager, scene, 1812, &R2_GLOBALS._player, NULL); + } + + return true; +} + +bool Scene1800::Actor8::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene1800 *scene = (Scene1800 *)R2_GLOBALS._sceneManager._scene; + + if (_position.x < 160) { + if (scene->_actor4._frame == 1) { + return SceneActor::startAction(action, event); + } else { + R2_GLOBALS.setFlag(29); + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + if (R2_GLOBALS.getFlag(14)) { + scene->_sceneMode = 1804; + scene->setAction(&scene->_sequenceManager, scene, 1804, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor8, NULL); + } else { + scene->_sceneMode = 1; + scene->setAction(&scene->_sequenceManager, scene, 1809, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor7, NULL); + R2_GLOBALS.clearFlag(14); + } + } else { + if (R2_GLOBALS.getFlag(14)) { + scene->_sceneMode = 1; + scene->setAction(&scene->_sequenceManager, scene, 1809, &R2_GLOBALS._player, &scene->_actor7, NULL); + R2_GLOBALS.clearFlag(14); + } else { + scene->_sceneMode = 1805; + scene->setAction(&scene->_sequenceManager, scene, 1805, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor8, NULL); + } + } + } + } else { + if (scene->_actor4._frame == 1) { + return SceneActor::startAction(action, event); + } else { + R2_GLOBALS.clearFlag(29); + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + if (R2_GLOBALS.getFlag(14)) { + scene->_sceneMode = 2; + scene->setAction(&scene->_sequenceManager, scene, 1809, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor7, NULL); + R2_GLOBALS.clearFlag(14); + } else { + scene->_sceneMode = 1806; + scene->setAction(&scene->_sequenceManager, scene, 1806, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor9, NULL); + } + } else { + if (R2_GLOBALS.getFlag(14)) { + scene->_sceneMode = 2; + scene->setAction(&scene->_sequenceManager, scene, 1809, &R2_GLOBALS._player, &scene->_actor7, NULL); + R2_GLOBALS.clearFlag(14); + } else { + scene->_sceneMode = 1807; + scene->setAction(&scene->_sequenceManager, scene, 1807, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor9, NULL); + } + } + } + } + + return true; +} + +void Scene1800::Exit1::changeScene() { + Scene1800 *scene = (Scene1800 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS.getFlag(14)) { + scene->_sceneMode = 3; + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + scene->setAction(&scene->_sequenceManager, scene, 1809, &R2_GLOBALS._player, &scene->_actor7, NULL); + else + scene->setAction(&scene->_sequenceManager, scene, 1809, &scene->_actor2, &scene->_actor7, NULL); + R2_GLOBALS.clearFlag(14); + } else { + scene->_sceneMode = 1802; + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + scene->setAction(&scene->_sequenceManager, scene, 1802, &R2_GLOBALS._player, &scene->_actor2, NULL); + else + scene->setAction(&scene->_sequenceManager, scene, 1802, &R2_GLOBALS._player, &scene->_actor2, NULL); + } +} + +void Scene1800::postInit(SceneObjectList *OwnerList) { + loadScene(1800); + SceneExt::postInit(); + R2_GLOBALS._sound1.play(116); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + + if (R2_GLOBALS._sceneManager._previousScene == -1) + R2_GLOBALS._v565F6 = 1201; + + if (R2_GLOBALS._v565F6 == 1201) + _field412 = 2; + else + _field412 = 0; + + scalePalette(65, 65, 65); + _exit1.setDetails(Rect(0, 160, 319, 168), EXITCURSOR_S, 1800); + _item5.setDetails(Rect(0, 0, 320, 200), -1, -1, -1, -1, 1, NULL); + + _actor6.postInit(); + _actor6.setup(1801, 4, 1); + _actor6.setPosition(Common::Point(170, 24)); + _actor6.setDetails(1800, 13, 14, 15, 1, (SceneItem *) NULL); + + _actor7.postInit(); + _actor7.setup(1801, 3, 1); + _actor7.setPosition(Common::Point(160, 139)); + _actor7.setDetails(1800, 6, -1, -1, 1, (SceneItem *) NULL); + + _actor8.postInit(); + _actor8.setup(1800, 1, 1); + _actor8.setPosition(Common::Point(110, 78)); + _actor8.fixPriority(135); + _actor8.setDetails(1800, 20, -1, -1, 1, (SceneItem *) NULL); + + _actor9.postInit(); + _actor9.setup(1800, 2, 1); + _actor9.setPosition(Common::Point(209, 78)); + _actor9.fixPriority(135); + _actor9.setDetails(1800, 20, -1, -1, 1, (SceneItem *) NULL); + + _actor4.postInit(); + if ((_field412 != 1) && (_field412 != 3) && (!R2_GLOBALS.getFlag(64))) + _actor4.setup(1801, 2, 1); + else + _actor4.setup(1801, 2, 10); + _actor4.setPosition(Common::Point(76, 142)); + _actor4.setDetails(1800, 3, -1, -1, 1, (SceneItem *) NULL); + + _actor5.postInit(); + if ((_field412 != 1) && (_field412 != 3) && (!R2_GLOBALS.getFlag(64))) + _actor5.setup(1801, 1, 1); + else + _actor5.setup(1801, 1, 10); + _actor5.setPosition(Common::Point(243, 142)); + _actor5.setDetails(1800, 3, -1, -1, 1, (SceneItem *) NULL); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + if (R2_GLOBALS.getFlag(14)) { + R2_GLOBALS._player.animate(ANIM_MODE_NONE, NULL); + R2_GLOBALS._player.setObjectWrapper(NULL); + R2_GLOBALS._player.setup(1801, 5, 12); + R2_GLOBALS._player.setPosition(Common::Point(160, 139)); + R2_GLOBALS._walkRegions.enableRegion(9); + _actor7.hide(); + } else { + R2_GLOBALS._player.setVisage(1507); + } + R2_GLOBALS._player._moveDiff = Common::Point(4, 2); + } else { + R2_GLOBALS._player.setVisage(1503); + R2_GLOBALS._player._moveDiff = Common::Point(2, 2); + } + + _actor2.postInit(); + _actor2.animate(ANIM_MODE_1, NULL); + _actor2.setObjectWrapper(new SceneObjectWrapper()); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + if (R2_GLOBALS.getFlag(14)) { + _actor2.animate(ANIM_MODE_NONE, NULL); + _actor2.setObjectWrapper(NULL); + _actor2.setup(1801, 5, 12); + + R2_GLOBALS._walkRegions.enableRegion(9); + _actor7.hide(); + } else { + _actor2.setup(1507, 1, 1); + _actor2.setPosition(Common::Point(180, 160)); + } + _actor2.setDetails(9002, 0, 4, 3, 1, (SceneItem *) NULL); + _actor2._moveDiff = Common::Point(4, 2); + } else { + _actor2.setDetails(9001, 0, 5, 3, 1, (SceneItem *) NULL); + _actor2.setVisage(1503); + _actor2._moveDiff = Common::Point(2, 2); + } + + if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1800) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + R2_GLOBALS._player.setPosition(Common::Point(114, 150)); + R2_GLOBALS._player.setStrip(5); + if (R2_GLOBALS.getFlag(14)) { + _actor2.setPosition(Common::Point(160, 139)); + R2_GLOBALS._walkRegions.enableRegion(8); + } else { + _actor2.setPosition(Common::Point(209, 150)); + _actor2.setStrip(6); + R2_GLOBALS._walkRegions.enableRegion(8); + } + } else { + if (R2_GLOBALS.getFlag(14)) { + R2_GLOBALS._player.setup(1801, 5, 12); + R2_GLOBALS._player.setPosition(Common::Point(160, 139)); + } else { + R2_GLOBALS._player.setPosition(Common::Point(209, 150)); + R2_GLOBALS._player.setStrip(6); + } + _actor2.setPosition(Common::Point(114, 150)); + _actor2.setStrip(5); + R2_GLOBALS._walkRegions.enableRegion(10); + R2_GLOBALS._walkRegions.enableRegion(11); + } + } else { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + R2_GLOBALS._player.setPosition(Common::Point(140, 160)); + _actor2.setPosition(Common::Point(180, 160)); + } else { + R2_GLOBALS._player.setPosition(Common::Point(180, 160)); + _actor2.setPosition(Common::Point(140, 160)); + } + } + + _actor1.postInit(); + _actor1.fixPriority(10); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + _actor1.setVisage(1111); + else + _actor1.setVisage(1110); + + _actor1._effect = 5; + _actor1._field9C = _field312; + + R2_GLOBALS._player._linkedActor = &_actor1; + + _actor3.postInit(); + _actor3.fixPriority(10); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + _actor3.setVisage(1110); + else + _actor3.setVisage(1111); + + _actor3._effect = 5; + _actor3._field9C = _field312; + + _actor2._linkedActor = &_actor3; + + R2_GLOBALS._player._characterScene[1] = 1800; + R2_GLOBALS._player._characterScene[2] = 1800; + + _item2.setDetails(Rect(128, 95, 190, 135), 1800, 10, -1, -1, 1, NULL); + _item1.setDetails(Rect(95, 3, 223, 135), 1800, 0, -1, -1, 1, NULL); + + // Original was calling _item3.setDetails(Rect(1800, 11, 24, 23), 25, -1, -1, -1, 1, NULL); + // This is *wrong*. The following statement is a wild guess based on good common sense + _item3.setDetails(11, 1800, 23, 24, 25); + _item4.setDetails(Rect(0, 0, 320, 200), 1800, 17, -1, 19, 1, NULL); + + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1800) { + if ((R2_GLOBALS.getFlag(14)) && (R2_GLOBALS._player._characterIndex == R2_SEEKER)) { + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + } else { + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + } + } else if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1850) { + if (R2_GLOBALS.getFlag(29)) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + _sceneMode = 1814; + setAction(&_sequenceManager, this, 1814, &R2_GLOBALS._player, &_actor2, &_actor8, NULL); + } else { + _sceneMode = 1815; + setAction(&_sequenceManager, this, 1815, &R2_GLOBALS._player, &_actor2, &_actor8, NULL); + } + } else { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + _sceneMode = 1816; + setAction(&_sequenceManager, this, 1816, &R2_GLOBALS._player, &_actor2, &_actor9, NULL); + } else { + _sceneMode = 1817; + setAction(&_sequenceManager, this, 1817, &R2_GLOBALS._player, &_actor2, &_actor9, NULL); + } + } + } else { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + _sceneMode = 1800; + setAction(&_sequenceManager, this, 1800, &R2_GLOBALS._player, &_actor2, NULL); + } else { + _sceneMode = 1801; + setAction(&_sequenceManager, this, 1801, &R2_GLOBALS._player, &_actor2, NULL); + } + } + + R2_GLOBALS._player._oldCharacterScene[1] = 1800; + R2_GLOBALS._player._oldCharacterScene[2] = 1800; +} + +void Scene1800::signal() { + switch (_sceneMode) { + case 1: + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + _sceneMode = 1804; + setAction(&_sequenceManager, this, 1804, &R2_GLOBALS._player, &_actor2, &_actor8, NULL); + } else { + _sceneMode = 1805; + setAction(&_sequenceManager, this, 1805, &R2_GLOBALS._player, &_actor2, &_actor8, NULL); + } + break; + case 2: + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + _sceneMode = 1806; + setAction(&_sequenceManager, this, 1806, &R2_GLOBALS._player, &_actor2, &_actor9, NULL); + } else { + _sceneMode = 1807; + setAction(&_sequenceManager, this, 1807, &R2_GLOBALS._player, &_actor2, &_actor9, NULL); + } + break; + case 3: + _sceneMode = 1802; + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + setAction(&_sequenceManager, this, 1802, &R2_GLOBALS._player, &_actor2, NULL); + else + setAction(&_sequenceManager, this, 1803, &R2_GLOBALS._player, &_actor2, NULL); + break; + case 10: + // No break on purpose + case 11: + R2_GLOBALS._player.enableControl(CURSOR_TALK); + break; + case 12: + R2_GLOBALS._player.enableControl(CURSOR_TALK); + R2_GLOBALS._player._canWalk = false; + break; + case 13: + _sceneMode = 14; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + R2_GLOBALS._player.setup(1801, 7, 1); + R2_GLOBALS._player.animate(ANIM_MODE_8, NULL); + _stripManager.start(550, this); + break; + case 14: + _sceneMode = 15; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.setup(1801, 6, 1); + R2_GLOBALS._player.animate(ANIM_MODE_6, this); + break; + case 15: + R2_GLOBALS._player.setup(1503, 4, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.enableControl(CURSOR_USE); + break; + case 1800: + R2_GLOBALS._walkRegions.enableRegion(8); + if (R2_GLOBALS.getFlag(63)) + R2_GLOBALS._player.enableControl(CURSOR_USE); + else { + _sceneMode = 10; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(544, this); + } + break; + case 1801: + R2_GLOBALS._walkRegions.enableRegion(10); + R2_GLOBALS._walkRegions.enableRegion(11); + R2_GLOBALS.setFlag(63); + + // The following check is completely dumb. + // Either an original bug, or dead code. + if (R2_GLOBALS.getFlag(63)) { + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + } else { + _sceneMode = 10; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(545, this); + } + break; + case 1802: + R2_GLOBALS.clearFlag(14); + R2_GLOBALS._sceneManager.changeScene(1700); + break; + case 1804: + // No break on purpose + case 1805: + // No break on purpose + case 1806: + // No break on purpose + case 1807: + R2_GLOBALS.clearFlag(14); + R2_GLOBALS._sceneManager.changeScene(1850); + break; + case 1808: + _sceneMode = 12; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(553, this); + break; + case 1812: + _sceneMode = 13; + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 1814: + // No break on purpose + case 1815: + R2_GLOBALS._walkRegions.enableRegion(10); + R2_GLOBALS._walkRegions.enableRegion(11); + R2_GLOBALS._player.enableControl(); + break; + case 1816: + // No break on purpose + case 1817: + R2_GLOBALS._walkRegions.enableRegion(8); + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene1800::saveCharacter(int characterIndex) { + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) + R2_GLOBALS._sound1.fadeOut2(NULL); + + SceneExt::saveCharacter(characterIndex); +} + +/*-------------------------------------------------------------------------- + * Scene 1850 - + * + *--------------------------------------------------------------------------*/ +Scene1850::Scene1850() { + warning("STUBBED: Scene1850()"); +} + +void Scene1850::synchronize(Serializer &s) { + warning("STUBBED: Scene1850::synchronize()"); +} + +bool Scene1850::Hotspot2::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneHotspot::startAction(action, event); + + Scene1850 *scene = (Scene1850 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + scene->_sceneMode = 1852; + if (R2_GLOBALS.getFlag(32)) + scene->setAction(&scene->_sequenceManager1, scene, 1871, &R2_GLOBALS._player, NULL); + else + scene->setAction(&scene->_sequenceManager1, scene, 1852, &R2_GLOBALS._player, NULL); + } else if (R2_GLOBALS.getFlag(30)) { + scene->_field41E = 1; + scene->_sceneMode = 1860; + + if (R2_GLOBALS.getFlag(32)) + scene->setAction(&scene->_sequenceManager1, scene, 1860, &R2_GLOBALS._player, &scene->_actor5, NULL); + else + scene->setAction(&scene->_sequenceManager1, scene, 1859, &R2_GLOBALS._player, &scene->_actor5, NULL); + + R2_GLOBALS.clearFlag(30); + } else { + scene->_sceneMode = 1853; + + if (R2_GLOBALS.getFlag(32)) + scene->setAction(&scene->_sequenceManager1, scene, 1872, &R2_GLOBALS._player, NULL); + else + scene->setAction(&scene->_sequenceManager1, scene, 1853, &R2_GLOBALS._player, NULL); + } + + return true; +} + +bool Scene1850::Actor5::startAction(CursorType action, Event &event) { + Scene1850 *scene = (Scene1850 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if ((R2_GLOBALS._player._characterIndex != R2_SEEKER) || (R2_GLOBALS.getFlag(33)) || (R2_GLOBALS.getFlag(30))) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1857; + + if (R2_GLOBALS.getFlag(32)) + scene->setAction(&scene->_sequenceManager1, scene, 1858, &R2_GLOBALS._player, &scene->_actor5, NULL); + else + scene->setAction(&scene->_sequenceManager1, scene, 1857, &R2_GLOBALS._player, &scene->_actor5, NULL); + + R2_GLOBALS.setFlag(30); + return true; + break; + case CURSOR_LOOK: + if (R2_GLOBALS.getFlag(34)) + SceneItem::display(1850, 2, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + else + SceneItem::display(1850, 1, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + + return true; + break; + case R2_AIRBAG: + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { + if (R2_GLOBALS.getFlag(70)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 30; + + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + scene->_stripManager.start(558, scene); + + return true; + } else { + return SceneActor::startAction(action, event); + } + } else if (R2_GLOBALS.getFlag(30)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1875; + scene->_actor2.postInit(); + + if (R2_GLOBALS.getFlag(32)) + scene->setAction(&scene->_sequenceManager1, scene, 1876, &R2_GLOBALS._player, &scene->_actor2, NULL); + else + scene->setAction(&scene->_sequenceManager1, scene, 1875, &R2_GLOBALS._player, &scene->_actor2, NULL); + + return true; + } else if (R2_GLOBALS.getFlag(70)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 30; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + scene->_stripManager.start(557, scene); + R2_GLOBALS.setFlag(69); + + return true; + } else { + return SceneActor::startAction(action, event); + } + break; + case R2_REBREATHER_TANK: + if (R2_INVENTORY.getObjectScene(R2_AIRBAG) == 1850) { + if (R2_GLOBALS.getFlag(30)) + return SceneActor::startAction(action, event);; + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1878; + scene->setAction(&scene->_sequenceManager1, scene, 1878, &R2_GLOBALS._player, &scene->_actor5, &scene->_actor2, NULL); + } + + return true; + break; + default: + return SceneActor::startAction(action, event); + break; + } +} + +bool Scene1850::Actor6::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneHotspot::startAction(action, event); + + Scene1850 *scene = (Scene1850 *)R2_GLOBALS._sceneManager._scene; + + if (R2_GLOBALS.getFlag(32)) { + SceneItem::display(3240, 4, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + } + + R2_GLOBALS._player.disableControl(); + if (scene->_field412 == 1851) + R2_GLOBALS._player._effect = 1; + + if (_position.x >= 160) + R2_GLOBALS.setFlag(29); + else + R2_GLOBALS.clearFlag(29); + + if ((R2_GLOBALS._player._characterIndex == R2_SEEKER) && (R2_GLOBALS.getFlag(30))) { + if (_position.x >= 160) + scene->_field41E = 3; + else + scene->_field41E = 2; + + scene->_sceneMode = 1860; + + if (R2_GLOBALS.getFlag(32)) { + scene->setAction(&scene->_sequenceManager1, scene, 1860, &R2_GLOBALS._player, &scene->_actor5, NULL); + } else { + scene->setAction(&scene->_sequenceManager1, scene, 1859, &R2_GLOBALS._player, &scene->_actor5, NULL); + } + } else { + scene->_sceneMode = 11; + if (_position.x >= 160) { + scene->setAction(&scene->_sequenceManager1, scene, 1866, &R2_GLOBALS._player, &scene->_actor7, NULL); + } else { + scene->setAction(&scene->_sequenceManager1, scene, 1865, &R2_GLOBALS._player, &scene->_actor6, NULL); + } + } + + return true; +} + +bool Scene1850::Actor8::startAction(CursorType action, Event &event) { + if ((action != CURSOR_USE) || (_position.y != 120)) + return SceneHotspot::startAction(action, event); + + Scene1850 *scene = (Scene1850 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1881; + + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + scene->setAction(&scene->_sequenceManager1, scene, 1881, &R2_GLOBALS._player, NULL); + } else { + scene->setAction(&scene->_sequenceManager1, scene, 1880, &R2_GLOBALS._player, NULL); + } + + return true; +} + +void Scene1850::postInit(SceneObjectList *OwnerList) { + loadScene(1850); + + if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] != 1850) + R2_GLOBALS.clearFlag(31); + + _palette1.loadPalette(0); + + if (R2_GLOBALS.getFlag(31)) { + _field412 = 1850; + g_globals->_scenePalette.loadPalette(1850); + } else { + _field412 = 1851; + g_globals->_scenePalette.loadPalette(1851); + } + + SceneExt::postInit(); + + if (R2_GLOBALS._sceneManager._previousScene == 3150) + R2_GLOBALS._sound1.play(116); + + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + + _field418 = 0; + _field41E = 0; + _field41A = Common::Point(0, 0); + + R2_GLOBALS._player._characterScene[1] = 1850; + R2_GLOBALS._player._characterScene[2] = 1850; + + _item2.setDetails(Rect(101, 56, 111, 63), 1850, 19, -1, -1, 1, NULL); + + _actor6.postInit(); + _actor6.setup(1850, 3, 1); + _actor6.setPosition(Common::Point(66, 102)); + _actor6.setDetails(1850, 22, -1, -1, 1, (SceneItem *) NULL); + + _actor7.postInit(); + _actor7.setup(1850, 2, 1); + _actor7.setPosition(Common::Point(253, 102)); + _actor7.setDetails(1850, 22, -1, -1, 1, (SceneItem *) NULL); + + R2_GLOBALS._walkRegions.enableRegion(1); + + _actor5.postInit(); + + if (R2_GLOBALS.getFlag(34)) { + R2_GLOBALS._walkRegions.enableRegion(2); + _actor5.setup(1851, 4, 3); + } else if (R2_GLOBALS.getFlag(30)) { + _actor5.setup(1851, 2, 2); + } else { + R2_GLOBALS._walkRegions.enableRegion(5); + if (R2_GLOBALS.getFlag(33)) { + R2_GLOBALS._walkRegions.enableRegion(2); + _actor5.setup(1851, 1, 3); + } else { + _actor5.setup(1851, 2, 1); + } + } + + _actor5.setPosition(Common::Point(219, 130)); + _actor5.fixPriority(114); + _actor5.setDetails(1850, -1, -1, -1, 1, (SceneItem *) NULL); + + R2_GLOBALS._player.postInit(); + + _actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *) NULL); + } else { + _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *) NULL); + } + + if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1850) { + R2_GLOBALS._player._effect = 6; + _actor1._effect = 6; + if (R2_GLOBALS.getFlag(31)) { + R2_GLOBALS._player._shade = 0; + _actor1._shade = 0; + } else { + R2_GLOBALS._player._shade = 6; + _actor1._shade = 6; + } + + if (R2_INVENTORY.getObjectScene(R2_AIRBAG) == 1850) { + _actor2.postInit(); + if (R2_GLOBALS.getFlag(34)) { + _actor2.setup(1851, 4, 2); + _actor2.fixPriority(114); + } else { + _actor2.setup(1851, 4, 1); + } + + _actor2.setPosition(Common::Point(179, 113)); + + if ((_actor5._strip == 1) && (_actor5._frame == 3)){ + _actor2.hide(); + } + + _actor2.setDetails(1850, 6, -1, -1, 1, (SceneItem *) NULL); + } + + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + if (R2_GLOBALS.getFlag(32)) { + R2_GLOBALS._player.setVisage(1511); + _actor1.setVisage(1508); + + _actor3.postInit(); + _actor3.setup(1853, 3, 1); + _actor3.setPosition(Common::Point(122, 113)); + _actor3.fixPriority(114); + _actor3._effect = 6; + + // Totally useless test + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + _actor3.setDetails(1850, 28, -1, -1, 2, (SceneItem *) NULL); + } else { + // And the associated dead code + _actor3.setDetails(1850, 30, -1, -1, 2, (SceneItem *) NULL); + } + + _actor4.postInit(); + _actor4.setup(1853, 3, 2); + _actor4.setPosition(Common::Point(139, 111)); + _actor4.fixPriority(114); + _actor4._effect = 6; + + // Still totally useless test + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + _actor4.setDetails(1850, 29, -1, -1, 2, (SceneItem *) NULL); + } else { + // Another piece of dead code + _actor4.setDetails(1850, 28, -1, -1, 2, (SceneItem *) NULL); + } + + if (R2_GLOBALS.getFlag(31)) { + _actor3._shade = 0; + _actor4._shade = 0; + } else { + _actor3._shade = 6; + _actor4._shade = 6; + } + } else { + R2_GLOBALS._player.setVisage(1500); + _actor1.setVisage(1505); + } + } else { // Not Quinn + if (R2_GLOBALS.getFlag(32)) { + R2_GLOBALS._player.setVisage(1508); + _actor1.setVisage(1511); + + _actor3.postInit(); + _actor3.setup(1853, 3, 1); + _actor3.setPosition(Common::Point(122, 113)); + _actor3.fixPriority(114); + _actor3._effect = 6; + + // Totally useless test + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + // Dead code + _actor3.setDetails(1850, 28, -1, -1, 2, (SceneItem *) NULL); + } else { + _actor3.setDetails(1850, 30, -1, -1, 2, (SceneItem *) NULL); + } + + _actor4.postInit(); + _actor4.setup(1853, 3, 2); + _actor4.setPosition(Common::Point(139, 111)); + _actor4.fixPriority(114); + _actor4._effect = 6; + + // Again, useless test + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + // and dead code + _actor4.setDetails(1850, 29, -1, -1, 1, (SceneItem *) NULL); + } else { + _actor4.setDetails(1850, 28, -1, -1, 1, (SceneItem *) NULL); + } + + if (R2_GLOBALS.getFlag(31)) { + _actor3._shade = 0; + _actor4._shade = 0; + } else { + _actor3._shade = 6; + _actor4._shade = 6; + } + } else { + R2_GLOBALS._player.setVisage(1505); + _actor1.setVisage(1500); + } + } + + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.setPosition(Common::Point(80, 114)); + + _actor1.animate(ANIM_MODE_1, NULL); + _actor1.setObjectWrapper(new SceneObjectWrapper()); + _actor1.setStrip(3); + _actor1.setPosition(Common::Point(180, 96)); + + if (R2_GLOBALS.getFlag(30)) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + _actor1.animate(ANIM_MODE_NONE, NULL); + _actor1.setObjectWrapper(NULL); + if (R2_GLOBALS.getFlag(32)) { + _actor1.setup(1854, 1, 3); + } else { + _actor1.setup(1854, 2, 3); + } + + _actor1.setPosition(Common::Point(164, 106)); + } else { + _actor1.animate(ANIM_MODE_NONE, NULL); + _actor1.setObjectWrapper(NULL); + if (R2_GLOBALS.getFlag(32)) { + R2_GLOBALS._player.setup(1854, 1, 3); + } else { + R2_GLOBALS._player.setup(1854, 2, 3); + } + + R2_GLOBALS._player.setPosition(Common::Point(164, 106)); + } + } + + R2_GLOBALS._player.enableControl(); + } else { // R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] != 1850 + R2_GLOBALS._player._effect = 1; + _actor1._effect = 1; + R2_GLOBALS._player.disableControl(); + _sceneMode = 10; + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + if (R2_GLOBALS.getFlag(29)) { + setAction(&_sequenceManager1, this, 1863, &R2_GLOBALS._player, &_actor1, &_actor7, NULL); + } else { + setAction(&_sequenceManager1, this, 1861, &R2_GLOBALS._player, &_actor1, &_actor6, NULL); + } + } else { + if (R2_GLOBALS.getFlag(29)) { + setAction(&_sequenceManager1, this, 1864, &R2_GLOBALS._player, &_actor1, &_actor7, NULL); + } else { + setAction(&_sequenceManager1, this, 1862, &R2_GLOBALS._player, &_actor1, &_actor6, NULL); + } + } + } + + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + _actor1._moveDiff = Common::Point(5, 3); + } else { + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + _actor1._moveDiff = Common::Point(3, 2); + } + + _actor8.postInit(); + _actor8.setup(1850, 1, 1); + + if (R2_GLOBALS.getFlag(62)) { + _actor8.setPosition(Common::Point(159, 120)); + } else { + _actor8.setPosition(Common::Point(159, 184)); + } + + _actor8.fixPriority(113); + + if (R2_GLOBALS.getFlag(34)) { + _actor8.setDetails(1850, 25, -1, -1, 4, &_actor5); + } else { + _actor8.setDetails(1850, 25, -1, -1, 2, (SceneItem *) NULL); + } + + if (!R2_GLOBALS.getFlag(62)) { + _actor8.hide(); + } + + _item1.setDetails(Rect(0, 0, 320, 200), 1850, 16, -1, -1, 1, NULL); + + R2_GLOBALS._player._oldCharacterScene[1] = 1850; + R2_GLOBALS._player._oldCharacterScene[2] = 1850; +} + +void Scene1850::remove() { + g_globals->_scenePalette.loadPalette(0); + + R2_GLOBALS._scenePalette._palette[765] = 255; + R2_GLOBALS._scenePalette._palette[766] = 255; + R2_GLOBALS._scenePalette._palette[767] = 255; + + SceneExt::remove(); +} + +void Scene1850::signal() { + switch (_sceneMode) { + case 10: + R2_GLOBALS._player._effect = 6; + R2_GLOBALS._player._shade = 6; + + _actor1._effect = 6; + _actor1._shade = 6; + + R2_GLOBALS._walkRegions.enableRegion(5); + + if (R2_GLOBALS.getFlag(68)) { + R2_GLOBALS._player.enableControl(); + } else { + R2_GLOBALS.setFlag(68); + _sceneMode = 20; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(554, this); + } + break; + case 11: + R2_GLOBALS.clearFlag(30); + R2_GLOBALS._sceneManager.changeScene(1800); + break; + case 15: + _sceneMode = 16; + break; + case 16: + _sceneMode = 1870; + setAction(&_sequenceManager1, this, 1870, &R2_GLOBALS._player, &_actor1, &_actor3, &_actor4, NULL); + break; + case 20: + R2_GLOBALS._player.enableControl(CURSOR_TALK); + break; + case 21: + R2_GLOBALS._player.disableControl(); + _sceneMode = 1877; + setAction(&_sequenceManager1, this, 1877, &R2_GLOBALS._player, &_actor1, &_actor5, NULL); + break; + case 30: + R2_GLOBALS._player.disableControl(); + _sceneMode = 1882; + setAction(&_sequenceManager1, this, 1882, &R2_GLOBALS._player, NULL); + break; + case 1852: + // No break on purpose: + case 1853: + if (_field412 == 1851) { + R2_GLOBALS.setFlag(31); + _palette1.loadPalette(1850); + _field412 = 1850; + } else { + R2_GLOBALS.clearFlag(31); + _palette1.loadPalette(1851); + _field412 = 1851; + } + + _field418 = 1; + if (R2_GLOBALS.getFlag(30)) { + _actor8.setAction(&_sequenceManager2, NULL, 1867, &_actor8, NULL); + } else if (R2_GLOBALS.getFlag(34)) { + if (R2_GLOBALS.getFlag(62)) { + R2_GLOBALS.clearFlag(62); + _actor8.setAction(&_sequenceManager2, this, 1851, &_actor8, NULL); + } else { + R2_GLOBALS.setFlag(62); + _actor8.setAction(&_sequenceManager2, this, 1850, &_actor8, NULL); + } + } else if (R2_GLOBALS.getFlag(33)) { + R2_GLOBALS.setFlag(62); + R2_GLOBALS.setFlag(34); + R2_GLOBALS._walkRegions.enableRegion(2); + + _actor2.postInit(); + _actor2.setDetails(1850, 6, -1, -1, 5, &_actor5); + + _sceneMode = 1879; + + _actor8.setAction(&_sequenceManager2, this, 1879, &_actor5, &_actor8, &_actor2, NULL); + } else { + _actor8.setAction(&_sequenceManager2, NULL, 1867, &_actor8, NULL); + } + + if (R2_GLOBALS.getFlag(34)) + R2_GLOBALS._scenePalette.addFader(_palette1._palette, 256, 5, NULL); + else + R2_GLOBALS._scenePalette.addFader(_palette1._palette, 256, 5, this); + + if (_field412 == 1851) + _field416 = -20; + else + _field416 = 20; + + _field414 = 20; + + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + if (_sceneMode == 1879) + _sceneMode = 1854; + + if (R2_GLOBALS.getFlag(32)) { + setAction(&_sequenceManager1, NULL, 1873, &R2_GLOBALS._player, NULL); + } else { + setAction(&_sequenceManager1, NULL, 1854, &R2_GLOBALS._player, NULL); + } + } else { + if (_sceneMode == 1879) + _sceneMode = 1855; + + if (R2_GLOBALS.getFlag(32)) { + setAction(&_sequenceManager1, NULL, 1874, &R2_GLOBALS._player, NULL); + } else { + setAction(&_sequenceManager1, NULL, 1855, &R2_GLOBALS._player, NULL); + } + } + break; + case 1857: + if (R2_GLOBALS.getFlag(69)) { + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + } else { + _sceneMode = 1858; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(555, this); + R2_GLOBALS.setFlag(69); + } + break; + case 1858: + R2_GLOBALS._player.disableControl(); + _sceneMode = 1859; + setAction(&_sequenceManager1, this, 1859, &R2_GLOBALS._player, &_actor5, NULL); + R2_GLOBALS.clearFlag(30); + break; + case 1859: + R2_GLOBALS.setFlag(70); + _sceneMode = 20; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(575, this); + break; + case 1860: + if (_field41A.x != 0) { + R2_GLOBALS._player.enableControl(); + + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &_field41A, this); + + _field41A = Common::Point(0, 0); + } + + switch (_field41E) { + case 1: + _sceneMode = 1853; + if (R2_GLOBALS.getFlag(32)) { + setAction(&_sequenceManager1, this, 1872, &R2_GLOBALS._player, NULL); + } else { + setAction(&_sequenceManager1, this, 1853, &R2_GLOBALS._player, NULL); + } + break; + case 2: + _sceneMode = 11; + setAction(&_sequenceManager1, this, 1865, &R2_GLOBALS._player, &_actor6, NULL); + break; + case 3: + warning("_field41E == 3"); + _sceneMode = 11; + setAction(&_sequenceManager1, this, 1866, &R2_GLOBALS._player, &_actor7, NULL); + break; + default: + break; + } + + _field41E = 0; + break; + case 1870: + R2_GLOBALS._walkRegions.enableRegion(5); + R2_INVENTORY.setObjectScene(R2_REBREATHER_TANK, 1); + R2_GLOBALS.setFlag(32); + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + case 1875: + R2_INVENTORY.setObjectScene(R2_AIRBAG, 1850); + _sceneMode = 21; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(561, this); + break; + case 1877: + _actor3.postInit(); + _actor3._effect = 6; + + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + _actor3.setDetails(1850, 28, -1, -1, 2, (SceneItem *)NULL); + } else { + _actor3.setDetails(1850, 30, -1, -1, 2, (SceneItem *)NULL); + } + + _actor4.postInit(); + _actor4._effect = 6; + + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + _actor4.setDetails(1850, 29, -1, -1, 2, (SceneItem *)NULL); + } else { + _actor4.setDetails(1850, 28, -1, -1, 2, (SceneItem *)NULL); + } + + if (R2_GLOBALS.getFlag(31)) { + _actor3._shade = 0; + _actor4._shade = 0; + } else { + _actor3._shade = 6; + _actor4._shade = 6; + } + + R2_GLOBALS.clearFlag(30); + _sceneMode = 15; + setAction(&_sequenceManager1, this, 1869, &R2_GLOBALS._player, &_actor3, NULL); + setAction(&_sequenceManager2, this, 1868, &_actor1, &_actor4, NULL); + break; + case 1878: + R2_INVENTORY.setObjectScene(R2_REBREATHER_TANK, 1850); + R2_GLOBALS.setFlag(33); + R2_GLOBALS._walkRegions.enableRegion(2); + R2_GLOBALS._player.enableControl(); + break; + case 1879: + R2_GLOBALS._player.enableControl(); + break; + case 1881: + R2_GLOBALS._sceneManager.changeScene(1875); + break; + case 1882: + R2_INVENTORY.setObjectScene(R2_AIRBAG, 1); + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene1850::process(Event &event) { + if ( (event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_ARROW) + && (R2_GLOBALS._player._characterIndex == R2_SEEKER) && (R2_GLOBALS.getFlag(30))) { + _field41A = event.mousePos; + R2_GLOBALS._player.disableControl(); + _sceneMode = 1860; + if (R2_GLOBALS.getFlag(32)) { + setAction(&_sequenceManager1, this, 1860, &R2_GLOBALS._player, &_actor5, NULL); + } else { + setAction(&_sequenceManager1, this, 1859, &R2_GLOBALS._player, &_actor5, NULL); + } + R2_GLOBALS.clearFlag(32); + event.handled = true; + } + + Scene::process(event); +} + +void Scene1850::dispatch() { + if (_field418 != 0) { + _field414--; + if (_field414 == 0) + _field418 = 0; + + if (_field416 >= 0) { + R2_GLOBALS._player._shade = (_field414 * 6) / _field416; + } else { + R2_GLOBALS._player._shade = ((_field414 * 6) / _field416) + 6; + } + R2_GLOBALS._player._flags |= OBJFLAG_PANES; + + _actor1._shade = R2_GLOBALS._player._shade; + _actor1._flags |= OBJFLAG_PANES; + + _actor3._shade = R2_GLOBALS._player._shade; + _actor3._flags |= OBJFLAG_PANES; + + _actor4._shade = R2_GLOBALS._player._shade; + _actor4._flags |= OBJFLAG_PANES; + } + + if (R2_GLOBALS.getFlag(32)) { + _actor3.setPosition(Common::Point(_actor8._position.x - 37, _actor8._position.y - 71)); + _actor4.setPosition(Common::Point(_actor8._position.x - 20, _actor8._position.y - 73)); + } + + if (R2_INVENTORY.getObjectScene(R2_AIRBAG) == 1850) { + _actor2.setPosition(Common::Point(_actor8._position.x + 20, _actor8._position.y - 71)); + } + + Scene::dispatch(); +} + +/*-------------------------------------------------------------------------- + * Scene 1875 - + * + *--------------------------------------------------------------------------*/ +Scene1875::Actor1875::Actor1875() { + _fieldA4 = 0; + _fieldA6 = 0; +} + +void Scene1875::Actor1875::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_fieldA4); + s.syncAsSint16LE(_fieldA6); +} + +void Scene1875::Actor1875::subB84AB() { + Scene1875 *scene = (Scene1875 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._sound1.play(227); + + int newFrameNumber; + switch (_fieldA4) { + case 3: + if ((scene->_actor1._frame == 1) && (scene->_actor4._strip == 2)) { + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + scene->_sceneMode = 10; + scene->_stripManager.start(576, this); + } else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1890; + scene->_actor2.postInit(); + scene->setAction(&scene->_sequenceManager, scene, 1890, &scene->_actor2, NULL); + } + break; + case 4: + newFrameNumber = scene->_actor1._frame + 1; + if (newFrameNumber > 6) + newFrameNumber = 1; + scene->_actor1.setFrame(newFrameNumber); + break; + case 5: + newFrameNumber = scene->_actor1._frame - 1; + if (newFrameNumber < 1) + newFrameNumber = 6; + scene->_actor1.setFrame(newFrameNumber); + break; + default: + break; + } +} + +void Scene1875::Actor1875::subB8271(int indx) { + postInit(); + _fieldA4 = indx; + _fieldA6 = 0; + setVisage(1855); + + if (_fieldA4 == 1) + setStrip(2); + else + setStrip(1); + + setFrame(_fieldA4); + switch (_fieldA4 - 1) { + case 0: + setPosition(Common::Point(20, 144)); + break; + case 1: + setPosition(Common::Point(82, 144)); + break; + case 2: + setPosition(Common::Point(136, 144)); + break; + case 3: + setPosition(Common::Point(237, 144)); + break; + case 4: + setPosition(Common::Point(299, 144)); + break; + default: + break; + } + + setDetails(1875, 6, 1, -1, 2, (SceneItem *) NULL); +} + +void Scene1875::Actor1875::process(Event &event) { + if ((R2_GLOBALS._player._uiEnabled) || (event.handled)) + return; + + Scene1875 *scene = (Scene1875 *)R2_GLOBALS._sceneManager._scene; + + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == R2_STEPPING_DISKS) && (_bounds.contains(event.mousePos)) && (_fieldA6 == 0)) { + setStrip(2); + switch (_fieldA4) { + case 1: + R2_GLOBALS._sound2.play(227); + scene->_actor5.setStrip(1); + break; + case 2: + R2_GLOBALS._sound2.play(227); + scene->_actor4.setStrip(1); + break; + default: + break; + } + _fieldA6 = 1; + event.handled = true; + } + + if ((event.eventType == EVENT_BUTTON_UP) && (_fieldA6 != 0)) { + if ((_fieldA4 == 3) || (_fieldA4 == 4) || (_fieldA4 == 5)) { + setStrip(1); + subB84AB(); + } + _fieldA6 = 0; + event.handled = true; + } +} + +void Scene1875::postInit(SceneObjectList *OwnerList) { + loadScene(1875); + SceneExt::postInit(); + + R2_GLOBALS._player._characterScene[1] = 1875; + R2_GLOBALS._player._characterScene[2] = 1875; + + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + + _actor4.subB8271(1); + _actor5.subB8271(2); + _actor6.subB8271(3); + _actor7.subB8271(4); + _actor8.subB8271(5); + + _actor1.postInit(); + _actor1.setup(1855, 4, 1); + _actor1.setPosition(Common::Point(160, 116)); + + R2_GLOBALS._player.postInit(); + if (R2_GLOBALS._sceneManager._previousScene == 1625) { + R2_GLOBALS._sound1.play(122); + R2_GLOBALS._player.disableControl(); + _sceneMode = 11; + _actor2.postInit(); + setAction(&_sequenceManager, this, 1892, &_actor2, NULL); + } else if (R2_GLOBALS._sceneManager._previousScene == 3150) { + R2_GLOBALS._sound1.play(116); + } else { + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + } + + _item2.setDetails(Rect(43, 14, 275, 122), 1875, 9, 1, -1, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 1875, 3, -1, -1, 1, NULL); + + R2_GLOBALS._player._characterScene[1] = 1875; + R2_GLOBALS._player._characterScene[2] = 1875; + R2_GLOBALS._player._oldCharacterScene[1] = 1875; + R2_GLOBALS._player._oldCharacterScene[2] = 1875; +} + +void Scene1875::signal() { + switch (_sceneMode) { + case 10: + R2_GLOBALS._player.disableControl(); + _sceneMode = 1891; + _actor2.postInit(); + setAction(&_sequenceManager, this, 1891, &_actor2, NULL); + break; + case 11: + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _sceneMode = 1892; + _stripManager.start(577, this); + break; + case 1890: + _actor2.remove(); + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + break; + case 1891: + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._sceneManager.changeScene(1625); + break; + case 1892: + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._sceneManager.changeScene(1900); + break; + default: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + break; + } +} + +void Scene1875::process(Event &event) { + Scene::process(event); + + _actor4.process(event); + _actor5.process(event); + _actor6.process(event); + _actor7.process(event); + _actor8.process(event); +} + +/*-------------------------------------------------------------------------- + * Scene 1900 - + * + *--------------------------------------------------------------------------*/ +bool Scene1900::Actor2::startAction(CursorType action, Event &event) { + Scene1900 *scene = (Scene1900 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if ((_frame != 1) || (R2_GLOBALS._player._characterIndex != R2_SEEKER)) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + return SceneActor::startAction(action, event); + else + return true; + } + + R2_GLOBALS._player.enableControl(CURSOR_USE); + + if (_position.x >= 160) { + scene->_sceneMode = 1905; + scene->setAction(&scene->_sequenceManager1, scene, 1905, &R2_GLOBALS._player, &scene->_actor3, NULL); + } else { + R2_GLOBALS.setFlag(29); + scene->_sceneMode = 1904; + scene->setAction(&scene->_sequenceManager1, scene, 1904, &R2_GLOBALS._player, &scene->_actor2, NULL); + } + + return true; +} + +void Scene1900::Exit1::changeScene() { + Scene1900 *scene = (Scene1900 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + scene->_sceneMode = 10; + + Common::Point pt(-10, 135); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene1900::Exit2::changeScene() { + Scene1900 *scene = (Scene1900 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + scene->_sceneMode = 11; + + Common::Point pt(330, 135); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene1900::postInit(SceneObjectList *OwnerList) { + loadScene(1900); + SceneExt::postInit(); + + // Debug message, skipped + + if (R2_GLOBALS._sceneManager._previousScene == -1) { + R2_GLOBALS._sceneManager._previousScene = 1925; + R2_GLOBALS._player._characterIndex = R2_SEEKER; + R2_GLOBALS._player._oldCharacterScene[2] = 1925; + } + + if (R2_GLOBALS._sceneManager._previousScene != 1875) + R2_GLOBALS._sound1.play(200); + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_seekerSpeaker); + + _exit1.setDetails(Rect(0, 105, 14, 145), R2_COM_SCANNER, 2000); + _exit1.setDest(Common::Point(14, 135)); + + _exit2.setDetails(Rect(305, 105, 320, 145), R2_SPENT_POWER_CAPSULE, 2000); + _exit2.setDest(Common::Point(315, 135)); + + R2_GLOBALS._player.postInit(); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + R2_GLOBALS._player.setup(2008, 3, 1); + else + R2_GLOBALS._player.setup(20, 3, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + else + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS._sceneManager._previousScene != 1925) + R2_GLOBALS.clearFlag(29); + + _actor2.postInit(); + _actor2.setup(1901, 1, 1); + _actor2.setPosition(Common::Point(95, 109)); + _actor2.fixPriority(100); + + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + _actor2.setDetails(1900, 0, 1, 2, 1, (SceneItem *) NULL); + else + _actor2.setDetails(1900, 0, 1, -1, 1, (SceneItem *) NULL); + + _actor3.postInit(); + _actor3.setup(1901, 2, 1); + _actor3.setPosition(Common::Point(225, 109)); + _actor3.fixPriority(100); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) + _actor3.setDetails(1900, 0, 1, 2, 1, (SceneItem *) NULL); + else + _actor3.setDetails(1900, 0, 1, -1, 1, (SceneItem *) NULL); + + if (R2_GLOBALS._sceneManager._previousScene != 1875) { + _object1.postInit(); + _object1.setup(1945, 6, 1); + _object1.setPosition(Common::Point(96, 109)); + _object1.fixPriority(80); + + _object2.postInit(); + _object2.setup(1945, 6, 2); + _object2.setPosition(Common::Point(223, 109)); + _object2.fixPriority(80); + } + + if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1875) { + R2_GLOBALS._player._characterIndex = R2_QUINN; + _actor1.postInit(); + _sceneMode = 20; + R2_GLOBALS._player.setAction(&_sequenceManager1, NULL, 1901, &R2_GLOBALS._player, &_actor2, NULL); + _actor1.setAction(&_sequenceManager2, this, 1900, &_actor1, &_actor3, NULL); + } else if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1925) { + if (R2_GLOBALS.getFlag(29)) { + R2_GLOBALS.clearFlag(29); + _actor2.hide(); + + R2_GLOBALS._player.setStrip(6); + R2_GLOBALS._player.setPosition(Common::Point(90, 106)); + _sceneMode = 1906; + setAction(&_sequenceManager1, this, 1906, &R2_GLOBALS._player, &_actor2, NULL); + } else { + _actor3.hide(); + R2_GLOBALS._player.setStrip(5); + R2_GLOBALS._player.setPosition(Common::Point(230, 106)); + _sceneMode = 1907; + setAction(&_sequenceManager1, this, 1907, &R2_GLOBALS._player, &_actor3, NULL); + } + + if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) { + _actor1.postInit(); + _actor1.setPosition(Common::Point(30, 110)); + R2_GLOBALS._walkRegions.enableRegion(1); + _actor1.setup(2008, 3, 1); + _actor1.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL); + } + R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 1900; + } else if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) { + _actor1.postInit(); + _actor1.setPosition(Common::Point(30, 110)); + R2_GLOBALS._walkRegions.enableRegion(1); + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + _actor1.setup(20, 3, 1); + _actor1.setDetails(9002, 1, -1, -1, 1, (SceneItem *) NULL); + } else { + _actor1.setup(2008, 3, 1); + _actor1.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL); + } + + if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + if (R2_GLOBALS._v56605[1] == 5) { + _sceneMode = 1902; + setAction(&_sequenceManager1, this, 1902, &R2_GLOBALS._player, NULL); + } else { + _sceneMode = 1903; + setAction(&_sequenceManager1, this, 1903, &R2_GLOBALS._player, NULL); + } + } else { + if (R2_GLOBALS._v56605[2] == 5) { + _sceneMode = 1908; + setAction(&_sequenceManager1, this, 1908, &R2_GLOBALS._player, NULL); + } else { + _sceneMode = 1909; + setAction(&_sequenceManager1, this, 1909, &R2_GLOBALS._player, NULL); + } + } + } else { + R2_GLOBALS._player.setPosition(Common::Point(160, 135)); + R2_GLOBALS._player.enableControl(); + } + R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 1900; + } + + _item2.setDetails(Rect(77, 2, 240, 103), 1900, 6, -1, -1, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 1900, 3, -1, -1, 1, NULL); +} + +void Scene1900::remove() { + R2_GLOBALS._sound1.fadeOut(NULL); + SceneExt::remove(); +} + +void Scene1900::signal() { + switch (_sceneMode) { + case 10: + R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 5; + R2_GLOBALS._sceneManager.changeScene(2000); + break; + case 11: + R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 6; + R2_GLOBALS._sceneManager.changeScene(2000); + break; + case 20: + ++_sceneMode; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(1300, this); + break; + case 21: + ++_sceneMode; + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._action) + R2_GLOBALS._player._action->_endHandler = this; + else + signal(); + break; + case 22: + _sceneMode = 1910; + _actor1.setAction(&_sequenceManager2, this, 1910, &_actor1, NULL); + break; + case 1904: + R2_GLOBALS._scene1925CurrLevel = -3; + // No break on purpose + case 1905: + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._sceneManager.changeScene(1925); + break; + case 1910: + R2_INVENTORY.setObjectScene(22, 2535); + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._player._oldCharacterScene[1] = 1900; + R2_GLOBALS._player._oldCharacterScene[2] = 1900; + R2_GLOBALS._sceneManager.changeScene(2450); + break; + case 1906: + R2_GLOBALS._scene1925CurrLevel = -3; + // No break on purpose + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 1925 - + * + *--------------------------------------------------------------------------*/ +Scene1925::Scene1925() { + _field9B8 = 0; + for (int i = 0; i < 5; i++) + _levelResNum[i] = 0; +} + +void Scene1925::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field9B8); + for (int i = 0; i < 5; i++) + s.syncAsSint16LE(_levelResNum[i]); +} + +bool Scene1925::Hotspot2::startAction(CursorType action, Event &event) { + Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneHotspot::startAction(action, event); + + if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) + return SceneHotspot::startAction(action, event); + + if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 20)) + scene->_sceneMode = 1928; + else if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 200)) + scene->_sceneMode = 1929; + else + scene->_sceneMode = 1930; + + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL); + return true; +} + +bool Scene1925::Hotspot3::startAction(CursorType action, Event &event) { + if ((!R2_GLOBALS.getFlag(29)) || (action != CURSOR_USE)) + return SceneHotspot::startAction(action, event); + + Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(CURSOR_USE); + scene->_sceneMode = 0; + + if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) { + scene->_exit3._enabled = false; + scene->_sceneMode = 1925; + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL); + return true; + } + + if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 20) && (event.mousePos.y >= 30)) { + scene->_sceneMode = 1931; + } else if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 200) && (event.mousePos.y < 140)) { + scene->_sceneMode = 1932; + } else if ( ( ((R2_GLOBALS._player._position.x == 112) && (R2_GLOBALS._player._position.y == 101)) + || ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 110)) + ) && (event.mousePos.y >= 100)) { + scene->_sceneMode = 1926; + } else if ( ( ((R2_GLOBALS._player._position.x == 112) && (R2_GLOBALS._player._position.y == 101)) + || ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 110)) + ) && (event.mousePos.y < 60)) { + scene->_sceneMode = 1927; + } else { + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + } + + if (scene->_sceneMode != 0) + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); + + return true; +} + +void Scene1925::ExitUp::changeScene() { + Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene; + + _moving = false; + R2_GLOBALS._player.disableControl(CURSOR_USE); + scene->_sceneMode = 0; + + if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) { + scene->_exit3._enabled = false; + scene->_field9B8 = 1927; + scene->_sceneMode = 1925; + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL); + return; + } + + if ( ((R2_GLOBALS._player._position.x == 112) && (R2_GLOBALS._player._position.y == 101)) + || ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 110))) { + scene->_sceneMode = 1927; + } else if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 200)) { + scene->_sceneMode = 1932; + } + + if (scene->_sceneMode != 0) + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); + else { + scene->_sceneMode = 1932; + scene->signal(); + } +} + +void Scene1925::Exit2::changeScene() { + Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene; + + _moving = false; + R2_GLOBALS._player.disableControl(CURSOR_USE); + scene->_sceneMode = 0; + + if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) { + scene->_exit3._enabled = false; + scene->_field9B8 = 1926; + scene->_sceneMode = 1925; + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL); + return; + } + + if ( ((R2_GLOBALS._player._position.x == 112) && (R2_GLOBALS._player._position.y == 101)) + || ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 110))) { + scene->_sceneMode = 1926; + } else if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 20)) { + scene->_sceneMode = 1931; + } + + if (scene->_sceneMode == 0) { + scene->_sceneMode = 1931; + scene->signal(); + } else + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); +} + +void Scene1925::Exit3::changeScene() { + Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene; + + _moving = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + scene->_sceneMode = 1921; + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); +} + +void Scene1925::Exit4::changeScene() { + Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene; + + _moving = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + scene->_sceneMode = 1920; + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); +} + +void Scene1925::changeLevel(bool upFlag) { + if (R2_GLOBALS._scene1925CurrLevel < 0) + R2_GLOBALS._scene1925CurrLevel = 3; + + if (upFlag) { + R2_GLOBALS._player.setup(1925, 1, 1); + R2_GLOBALS._player.setPosition(Common::Point(154, 200)); + ++R2_GLOBALS._scene1925CurrLevel; + } else { + R2_GLOBALS._player.setup(1925, 1, 1); + R2_GLOBALS._player.setPosition(Common::Point(154, 20)); + R2_GLOBALS._scene1925CurrLevel--; + } + + switch (R2_GLOBALS._scene1925CurrLevel) { + case -1: + R2_GLOBALS._sceneManager.changeScene(1945); + return; + break; + case 3: + loadScene(_levelResNum[4]); + _item2.setDetails(Rect(133, 68, 140, 77), 1925, 3, -1, 5, 2, NULL); + _actor1.setDetails(1925, 0, 1, 2, 2, (SceneItem *) NULL); + _actor1.show(); + break; + case 512: + R2_GLOBALS._scene1925CurrLevel = 508; + // No break on purpose + default: + loadScene(_levelResNum[(R2_GLOBALS._scene1925CurrLevel % 4)]); + R2_GLOBALS._sceneItems.remove(&_item2); + R2_GLOBALS._sceneItems.remove(&_actor1); + _actor1.hide(); + break; + } + + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; +} + +void Scene1925::postInit(SceneObjectList *OwnerList) { + _levelResNum[0] = 1930; + _levelResNum[1] = 1935; + _levelResNum[2] = 1940; + _levelResNum[3] = 1935; + _levelResNum[4] = 1925; + + if (R2_GLOBALS.getFlag(29)) { + if ((R2_GLOBALS._scene1925CurrLevel == -3) || (R2_GLOBALS._scene1925CurrLevel == 3)) + loadScene(_levelResNum[4]); + else + loadScene(_levelResNum[R2_GLOBALS._scene1925CurrLevel % 4]); + } else { + R2_GLOBALS._scene1925CurrLevel = -2; + loadScene(1920); + } + SceneExt::postInit(); + R2_GLOBALS._sound1.play(220); + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player._characterScene[2] = 1925; + R2_GLOBALS._player._characterIndex = R2_SEEKER; + switch (R2_GLOBALS._scene1925CurrLevel) { + case -2: + _exit4.setDetails(Rect(203, 44, 247, 111), EXITCURSOR_E, 1925); + _item3.setDetails(Rect(31, 3, 45, 167), 1925, 6, -1, 8, 1, NULL); + break; + case 3: + _actor1.setDetails(1925, 0, 1, 2, 1, (SceneItem *) NULL); + _item2.setDetails(Rect(133, 68, 140, 77), 1925, 3, -1, 5, 1, NULL); + // No break on purpose + case -3: + _exit3.setDetails(Rect(83, 38, 128, 101), EXITCURSOR_W, 1925); + // No break on purpose + default: + _exitUp.setDetails(Rect(128, 0, 186, 10), EXITCURSOR_N, 1925); + _exit2.setDetails(Rect(128, 160, 190, 167), EXITCURSOR_S, 1925); + _item3.setDetails(Rect(141, 11, 167, 159), 1925, 6, -1, -1, 1, NULL); + break; + } + + _actor1.postInit(); + _actor1.setup(1925, 5, 1); + _actor1.setPosition(Common::Point(128, 35)); + _actor1.hide(); + + if (R2_GLOBALS._scene1925CurrLevel == 3) + _actor1.show(); + + R2_GLOBALS._player.enableControl(CURSOR_USE); + switch (R2_GLOBALS._scene1925CurrLevel) { + case -2: + R2_GLOBALS._player.setup(20, 6, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(224, 109)); + break; + case -3: + _actor1.hide(); + R2_GLOBALS._player.setup(20, 5, 1); + R2_GLOBALS._player.setPosition(Common::Point(110, 100)); + break; + case 0: + R2_GLOBALS._player.setup(1925, 1, 1); + R2_GLOBALS._player.setPosition(Common::Point(154, 200)); + break; + default: + R2_GLOBALS._player.setup(1925, 1, 3); + R2_GLOBALS._player.setPosition(Common::Point(154, 110)); + break; + } + + R2_GLOBALS._player._canWalk = false; + _field9B8 = 0; + R2_GLOBALS._sceneManager._previousScene = 1925; + _item1.setDetails(Rect(27, 0, 292, 200), 1925, 9, -1, -1, 1, NULL); +} + +void Scene1925::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._player._oldCharacterScene[2] = 1925; + SceneExt::remove(); +} + +void Scene1925::signal() { + switch (_sceneMode) { + case 1920: + // No break on purpose + case 1921: + // No break on purpose + case 1928: + // No break on purpose + case 1929: + // No break on purpose + case 1930: + R2_GLOBALS._scene1925CurrLevel = -3; + R2_GLOBALS._sceneManager.changeScene(1900); + break; + case 1926: + // No break on purpose + case 1931: + // Change level, down + changeLevel(false); + break; + case 1927: + // No break on purpose + case 1932: + // Change level, up + changeLevel(true); + break; + case 1925: + _exit3._enabled = false; + if (_field9B8 != 0) { + _sceneMode = _field9B8; + _field9B8 = 0; + setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL); + } + // No break on purpose + default: + R2_GLOBALS._player.enableControl(CURSOR_USE); + break; + } + + R2_GLOBALS._player._canWalk = false; +} + +/*-------------------------------------------------------------------------- + * Scene 1945 - + * + *--------------------------------------------------------------------------*/ +Scene1945::Scene1945() { + _fieldEAA = 0; + _fieldEAC = 0; + _fieldEAE = CURSOR_NONE; +} + +void Scene1945::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_fieldEAA); + s.syncAsSint16LE(_fieldEAC); + s.syncAsSint16LE(_fieldEAE); +} + +bool Scene1945::Hotspot3::startAction(CursorType action, Event &event) { + Scene1945 *scene = (Scene1945 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case R2_GUNPOWDER: + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 0; + if ((R2_GLOBALS._player._position.x == 191) && (R2_GLOBALS._player._position.y == 142)) + scene->_sceneMode = 1942; + else { + scene->_sceneMode = 1940; + scene->_fieldEAA = 1942; + } + // At this point the original check if _sceneMode != 0. Skipped. + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); + return true; + break; + case CURSOR_USE: + R2_GLOBALS._player.disableControl(CURSOR_USE); + scene->_sceneMode = 0; + if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 50) && (event.mousePos.x >= 130)) { + scene->_sceneMode = 1940; + // At this point the original check if _sceneMode != 0. Skipped. + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); + return true; + } else { + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + if (event.mousePos.x > 130) + scene->_item3.setDetails(1945, 3, -1, -1, 3, (SceneItem *) NULL); + else + scene->_item3.setDetails(1945, 3, -1, 5, 3, (SceneItem *) NULL); + } + // No break on purpose + default: + return SceneHotspot::startAction(action, event); + break; + } +} + +bool Scene1945::Hotspot4::startAction(CursorType action, Event &event) { + Scene1945 *scene = (Scene1945 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneHotspot::startAction(action, event); + + R2_GLOBALS._player.disableControl(CURSOR_USE); + scene->_sceneMode = 0; + + if ((R2_GLOBALS._player._position.x == 221) && (R2_GLOBALS._player._position.y == 142)) { + scene->_sceneMode = 1949; + scene->_fieldEAA = 1947; + } else if ( ((R2_GLOBALS._player._position.x == 197) && (R2_GLOBALS._player._position.y == 158)) + || ((R2_GLOBALS._player._position.x == 191) && (R2_GLOBALS._player._position.y == 142)) ) { + scene->_sceneMode = 1947; + } else if ((R2_GLOBALS._player._position.x == 221) && (R2_GLOBALS._player._position.y == 142) && (event.mousePos.y >= 30)) { + scene->_sceneMode = 1940; + } else { + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + } + + if (scene->_sceneMode != 0) + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); + + return true; +} + +bool Scene1945::Actor3::startAction(CursorType action, Event &event) { + if ((action == R2_ALCOHOL_LAMP_3) && (action == R2_ALCOHOL_LAMP_2)) { + Scene1945 *scene = (Scene1945 *)R2_GLOBALS._sceneManager._scene; + + scene->_fieldEAE = action; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 0; + if ((R2_GLOBALS._player._position.x == 191) && (R2_GLOBALS._player._position.y == 142)) { + scene->_sceneMode= 1947; + scene->_fieldEAA = 1943; + } else if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 50)) { + scene->_sceneMode = 1940; + scene->_fieldEAA = 1943; + } else { + scene->_sceneMode = 1949; + scene->_fieldEAA = 1947; + scene->_fieldEAC = 1943; + } + // At this point the original check if _sceneMode != 0. Skipped. + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +void Scene1945::ExitUp::changeScene() { + Scene1945 *scene = (Scene1945 *)R2_GLOBALS._sceneManager._scene; + + _moving = false; + R2_GLOBALS._player.disableControl(CURSOR_USE); + scene->_sceneMode = 0; + + if ((R2_GLOBALS._player._position.x == 221) && (R2_GLOBALS._player._position.y == 142)) { + scene->_sceneMode = 1949; + scene->_fieldEAA = 1947; + } else if ( ((R2_GLOBALS._player._position.x == 197) && (R2_GLOBALS._player._position.y == 158)) + || ((R2_GLOBALS._player._position.x == 191) && (R2_GLOBALS._player._position.y == 142)) ) { + scene->_sceneMode = 1947; + } + + if (scene->_sceneMode == 0) { + scene->_sceneMode = 1941; + signal(); + } else { + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); + } +} + +void Scene1945::Exit2::changeScene() { + Scene1945 *scene = (Scene1945 *)R2_GLOBALS._sceneManager._scene; + + _moving = false; + R2_GLOBALS._player.disableControl(CURSOR_USE); + scene->_sceneMode = 0; + + if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 50)) { + scene->_sceneMode = 1940; + scene->_fieldEAA = 1945; + } else if ( ((R2_GLOBALS._player._position.x == 197) && (R2_GLOBALS._player._position.y == 158)) + || ((R2_GLOBALS._player._position.x == 191) && (R2_GLOBALS._player._position.y == 142)) ) { + scene->_sceneMode = 1945; + } + + if (scene->_sceneMode != 0) + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); +} + +void Scene1945::postInit(SceneObjectList *OwnerList) { + loadScene(1945); + SceneExt::postInit(); + R2_GLOBALS._sound1.play(220); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + R2_GLOBALS._player._characterScene[2] = 1945; + R2_GLOBALS._player._characterIndex = R2_SEEKER; + + _exitUp.setDetails(Rect(128, 0, 186, 10), EXITCURSOR_N, 1945); + _exit2.setDetails(Rect(238, 144, 274, 167), EXITCURSOR_E, 1945); + + _item4.setDetails(Rect(141, 3, 167, 126), 1945, 9, -1, -1, 1, NULL); + + if (!R2_GLOBALS.getFlag(43)) { + _exit2._enabled = false; + _actor3.postInit(); + _actor3.setup(1945, 4, 1); + _actor3.setPosition(Common::Point(253, 169)); + _actor3.fixPriority(150); + + if (R2_GLOBALS.getFlag(42)) + _actor3.setDetails(1945, 15, -1, -1, 1, (SceneItem *) NULL); + else + _actor3.hide(); + + _actor1.postInit(); + _actor1.setup(1945, 8, 1); + _actor1.setPosition(Common::Point(253, 169)); + _actor1.fixPriority(130); + + _actor2.postInit(); + _actor2.setup(1945, 3, 1); + _actor2.hide(); + } else { + _exit2._enabled = true; + } + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 1925: + R2_GLOBALS._scene1925CurrLevel = 0; + R2_GLOBALS.clearFlag(29); + R2_GLOBALS._player.setup(1925, 1, 10); + R2_GLOBALS._player.setPosition(Common::Point(154, 50)); + break; + case 1950: + _sceneMode = 1944; + setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL); + R2_GLOBALS._player.disableControl(CURSOR_USE); + break; + default: + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setup(20, 5, 1); + R2_GLOBALS._player.setPosition(Common::Point(191, 142)); + break; + } + + R2_GLOBALS._player._canWalk = false; + _fieldEAA = 0; + _fieldEAC = 0; + + _item3.setDetails(11, 1945, 3, -1, 5); + _item1.setDetails(Rect(238, 144, 274, 167), 1945, 0, -1, 2, 1, NULL); + _item2.setDetails(Rect(27, 3, 292, 167), 1945, 3, -1, -1, 1, NULL); +} + +void Scene1945::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene1945::signal() { + switch (_sceneMode) { + case 1940: + if (_fieldEAA == 1943) { + _sceneMode = _fieldEAA; + setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor2, NULL); + } else { + _sceneMode = 1946; + setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL); + } + return; + break; + case 1941: + if (_fieldEAA == 0) { + R2_GLOBALS._scene1925CurrLevel = 0; + R2_GLOBALS.setFlag(29); + R2_GLOBALS._sceneManager.changeScene(1925); + } else { + _sceneMode = _fieldEAA; + _fieldEAA = 0; + setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL); + } + return; + case 1942: + R2_INVENTORY.setObjectScene(R2_GUNPOWDER, 0); + _actor3.setDetails(1945, 15, -1, -1, 2, (SceneItem *) NULL); + R2_GLOBALS.setFlag(42); + break; + case 1943: + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_INVENTORY.setObjectScene(_fieldEAE, 0); + _sceneMode = 1948; + setAction(&_sequenceManager1, this, _sceneMode, &_actor3, &_actor2, &_actor1, NULL); + setAction(&_sequenceManager2, NULL, 1941, &R2_GLOBALS._player, NULL); + return; + case 1944: + break; + case 1945: + R2_GLOBALS._sceneManager.changeScene(1950); + return; + case 1946: + if (_fieldEAA == 1942) { + _sceneMode = _fieldEAA; + _fieldEAA = 0; + setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor3, NULL); + return; + } + break; + case 1947: + if (_fieldEAA == 1943) { + _sceneMode = _fieldEAA; + _fieldEAA = 1948; + setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor2, NULL); + } else { + _sceneMode = 1941; + setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL); + } + return; + case 1948: + R2_GLOBALS._sound1.play(220); + _exit2._enabled = true; + R2_GLOBALS._sceneItems.remove(&_actor3); + R2_GLOBALS.clearFlag(42); + R2_GLOBALS.clearFlag(43); + _fieldEAA = 1940; + // No break on purpose + case 1949: + _sceneMode = _fieldEAA; + if (_fieldEAC == 1943) { + _fieldEAA = _fieldEAC; + _fieldEAC = 0; + setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor2, NULL); + } else { + _fieldEAA = 0; + setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL); + } + return; + default: + break; + } + + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; +} + +/*-------------------------------------------------------------------------- + * Scene 1950 - + * + *--------------------------------------------------------------------------*/ +Scene1950::Area1::Area1() { + _field20 = 0; + _fieldB65 = 0; +} +void Scene1950::Area1::synchronize(Serializer &s) { + SceneArea::synchronize(s); + + s.syncAsByte(_field20); + s.syncAsSint16LE(_fieldB65); +} + +Scene1950::Scene1950() { + _field412 = 0; + _field414 = 0; + _field416 = 0; + _field418 = Common::Point(0, 0); + _field41C = 0; +} + +void Scene1950::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_field414); + s.syncAsSint16LE(_field416); + s.syncAsSint16LE(_field418.x); + s.syncAsSint16LE(_field418.y); + s.syncAsSint16LE(_field41C); +} + +Scene1950::Area1::Actor10::Actor10() { + _fieldA4 = 0; + _fieldA6 = 0; + _fieldA8 = 0; +} + +void Scene1950::Area1::Actor10::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_fieldA4); + s.syncAsSint16LE(_fieldA6); + s.syncAsSint16LE(_fieldA8); +} + +void Scene1950::Area1::Actor10::init(int indx) { +// Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + _fieldA4 = indx; + _fieldA6 = 0; + _fieldA8 = 0; + + postInit(); + setup(1971, 2, 1); + fixPriority(249); + setPosition(Common::Point(((_fieldA4 / 4) * 22) + 127, ((_fieldA4 / 4) * 19) + 71)); + warning("FIXME: invalid call to scene->_sceneAreas.push_front(this);"); +} + +void Scene1950::Area1::Actor10::process(Event &event) { + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_USE) && (_bounds.contains(event.mousePos)) && (_fieldA6 == 0)) { + R2_GLOBALS._sound2.play(227); + if (_fieldA8 == 0) { + setFrame(2); + _fieldA8 = 1; + } else { + setFrame(1); + _fieldA8 = 0; + } + _fieldA6 = 1; + event.handled = true; + } + + if ((event.eventType == EVENT_BUTTON_UP) && (_fieldA6 != 0)) { + _fieldA6 = 0; + event.handled = true; + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + scene->subBF4B4(_fieldA4); + } +} + +bool Scene1950::Area1::Actor10::startAction(CursorType action, Event &event) { + if (action == CURSOR_USE) + return false; + return SceneActor::startAction(action, event); +} + +void Scene1950::Area1::remove() { + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + for (_fieldB65 = 0; _fieldB65 < 16; ++_fieldB65) { + warning("Unexpected _sceneAreas.remove() call"); + // R2_GLOBALS._sceneAreas.remove(&_arrActor1[_fieldB65]); + _arrActor1[_fieldB65].remove(); + } + + // sub201EA + R2_GLOBALS._sceneItems.remove((SceneItem *)this); + _areaActor.remove(); + SceneArea::remove(); + R2_GLOBALS._insetUp--; + // + + if (!R2_GLOBALS.getFlag(37)) + R2_GLOBALS._sound2.play(278); + + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + scene->_exit3._enabled = true; + + if (!R2_GLOBALS.getFlag(37)) { + if (R2_GLOBALS.getFlag(36)) { + scene->_sceneMode = 1964; + scene->setAction(&scene->_sequenceManager, scene, 1964, &R2_GLOBALS._player, NULL); + } else { + scene->_sceneMode = 1965; + scene->setAction(&scene->_sequenceManager, scene, 1965, &R2_GLOBALS._player, NULL); + } + } +} + +void Scene1950::Area1::process(Event &event) { +// This is a copy of Scene1200::Area1::process + if (_field20 != R2_GLOBALS._insetUp) + return; + + CursorType cursor = R2_GLOBALS._events.getCursor(); + + if (_areaActor._bounds.contains(event.mousePos.x + g_globals->gfxManager()._bounds.left , event.mousePos.y)) { + if (cursor == _cursorNum) + warning("TODO: _cursorState = ???"); + R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState); + } else if (event.mousePos.y < 168) { + if (cursor != _cursorNum) { + _savedCursorNum = cursor; + warning("TODO: _cursorState = ???"); + R2_GLOBALS._events.setCursor(CURSOR_INVALID); + } + if (event.eventType == EVENT_BUTTON_DOWN) { + event.handled = true; + warning("TODO: _cursorState = ???"); + R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState); + remove(); + } + } +} + +void Scene1950::Area1::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + R2_GLOBALS._player._canWalk = false; + + // UnkArea1200::proc12(); + _areaActor.postInit(); + _areaActor.setup(visage, stripFrameNum, frameNum); + _areaActor.setPosition(Common::Point(posX, posY)); + _areaActor.fixPriority(250); + _cursorNum = CURSOR_INVALID; + scene->_sceneAreas.push_front(this); + ++R2_GLOBALS._insetUp; + _field20 = R2_GLOBALS._insetUp; + // + + _areaActor.fixPriority(248); + scene->_exit3._enabled = false; + proc13(1950, 27, 28, 27); + + for (_fieldB65 = 0; _fieldB65 < 16; _fieldB65++) + _arrActor1[_fieldB65].init(_fieldB65); +} + +void Scene1950::Area1::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { + // Copy of Scene1200::Area1::proc13() + _areaActor.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL); +} + +bool Scene1950::Hotspot2::startAction(CursorType action, Event &event) { + if ((action != CURSOR_USE) || (R2_GLOBALS.getFlag(37))) + return SceneHotspot::startAction(action, event); + + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS.getFlag(36)) { + scene->_sceneMode = 1962; + scene->setAction(&scene->_sequenceManager, scene, 1962, &R2_GLOBALS._player, NULL); + } else { + scene->_sceneMode = 1963; + scene->setAction(&scene->_sequenceManager, scene, 1963, &R2_GLOBALS._player, NULL); + } + return true; +} + +bool Scene1950::Actor2::startAction(CursorType action, Event &event) { + if (action != R2_SCRITH_KEY) + return SceneActor::startAction(action, event); + + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(); + R2_INVENTORY.setObjectScene(31, 0); + scene->_sceneMode = 1958; + scene->setAction(&scene->_sequenceManager, scene, 1958, &R2_GLOBALS._player, &scene->_actor2, NULL); + return true; +} + +bool Scene1950::Actor3::startAction(CursorType action, Event &event) { + if ((action != CURSOR_USE) || (R2_INVENTORY.getObjectScene(35) != 1950)) + return SceneActor::startAction(action, event); + + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1968; + scene->setAction(&scene->_sequenceManager, scene, 1968, &R2_GLOBALS._player, NULL); + + return true; +} + +bool Scene1950::Actor5::startAction(CursorType action, Event &event) { + if ((action != CURSOR_USE) || (!R2_GLOBALS.getFlag(37))) + return SceneActor::startAction(action, event); + + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1967; + scene->setAction(&scene->_sequenceManager, scene, 1967, &R2_GLOBALS._player, NULL); + + return true; +} + +Scene1950::Actor8::Actor8() { + _fieldA4 = 0; + _fieldA6 = 0; + _fieldA8 = 0; + _fieldAA = 0; + _fieldAC = 0; + _fieldAE = 0; + _fieldAF = 0; +} + +void Scene1950::Actor8::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_fieldA4); + s.syncAsSint16LE(_fieldA6); + s.syncAsSint16LE(_fieldA8); + s.syncAsSint16LE(_fieldAA); + s.syncAsSint16LE(_fieldAC); + s.syncAsByte(_fieldAE); + s.syncAsByte(_fieldAF); +} + +void Scene1950::Actor8::signal() { + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + switch (_fieldAC) { + case 19: { + _fieldAC = 0; + setVisage(1960); + if (R2_GLOBALS._v566A5 == 3) + setStrip(2); + else + setStrip(1); + + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &scene->_field418, this); + } + break; + case 20: { + _fieldAC = 19; + R2_GLOBALS._player.setVisage(22); + if (R2_GLOBALS._v566A5 == 3) + R2_GLOBALS._player.setStrip(1); + else + R2_GLOBALS._player.setStrip(2); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._v56613[((scene->_field41C - 1) * 4) + 1]--; + + if (R2_GLOBALS._v566A5 == 3) + _fieldA4 = _position.x + 10; + else + _fieldA4 = _position.x - 10; + + _fieldA6 = _position.y -4; + setVisage(1961); + + if (R2_GLOBALS._v566A5 == 3) + setStrip(2); + else + setStrip(1); + + animate(ANIM_MODE_2, NULL); + Common::Point pt(_fieldA4, _fieldA6); + PlayerMover *mover = new PlayerMover(); + addMover(mover, &pt, this); + + R2_GLOBALS._player.enableControl(); + } + break; + case 21: + R2_GLOBALS._player.setVisage(22); + if (R2_GLOBALS._v566A5 == 3) + R2_GLOBALS._player.setStrip(1); + else + R2_GLOBALS._player.setStrip(2); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + + setVisage(1961); + if (R2_GLOBALS._v566A5 == 3) + setStrip(4); + else + setStrip(3); + setDetails(1950, 15, -1, 17, 2, (SceneItem *) NULL); + addMover(NULL); + _numFrames = 8; + R2_GLOBALS._sound2.play(226); + animate(ANIM_MODE_5, NULL); + fixPriority(10); + R2_GLOBALS._v56613[((scene->_field41C - 1) * 4) ]--; + R2_GLOBALS._v56613[((scene->_field41C - 1) * 4) + 1]--; + R2_GLOBALS._v56613[((scene->_field41C - 1) * 4) + 2] = _position.x; + R2_GLOBALS._v56613[((scene->_field41C - 1) * 4) + 3] = _position.y; + _fieldA8 = (_position.x - R2_GLOBALS._player._position.x) / 2; + _fieldAA = (_position.y - R2_GLOBALS._player._position.y) / 2; + + _fieldAE = 0; + for (_fieldAF = 0; _fieldAF < 18; ++_fieldAF) + if (R2_GLOBALS._v56613[4 * _fieldAF] == 0) + ++_fieldAE; + + if (_fieldAE == 18) { + R2_GLOBALS.setFlag(36); + _fieldAC = 23; + Common::Point pt(R2_GLOBALS._player._position.x + _fieldA8, R2_GLOBALS._player._position.y + _fieldAA); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else if (_fieldAE == 1) { + _fieldAC = 22; + Common::Point pt(R2_GLOBALS._player._position.x + _fieldA8, R2_GLOBALS._player._position.y + _fieldAA); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + } + + if (R2_GLOBALS._v566A5 == 3) + scene->_exit3._enabled = true; + else + scene->_exit6._enabled = true; + + scene->_field416 = 0; + break; + case 22: + SceneItem::display(1950, 18, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + case 23: + SceneItem::display(1950, 25, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + scene->_sceneMode = R2_GLOBALS._v566A5; + scene->setAction(&scene->_sequenceManager, scene, 1960, &R2_GLOBALS._player, NULL); + break; + default: + break; + } +} + +bool Scene1950::Actor8::startAction(CursorType action, Event &event) { + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + if ((R2_GLOBALS._v56613[(scene->_field41C - 1) * 4] == 0) || (action != R2_PHOTON_STUNNER)) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS._v56613[((scene->_field41C - 1) * 4) + 1] <= 1) + _fieldAC = 21; + else + _fieldAC = 20; + + R2_GLOBALS._player.setVisage(25); + if (R2_GLOBALS._v566A5 == 3) + R2_GLOBALS._player.setStrip(2); + else + R2_GLOBALS._player.setStrip(1); + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + R2_GLOBALS._sound3.play(99); + + return true; +} + +void Scene1950::Exit1::changeScene() { + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._v566A5 = 1; + scene->_sceneMode = 11; + + Common::Point pt(160, 127); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene1950::Exit2::changeScene() { + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._v566A5 = 2; + scene->_sceneMode = 12; + + if (scene->_field412 == 0) { + if (R2_GLOBALS.getFlag(36)) + scene->setAction(&scene->_sequenceManager, scene, 1953, &R2_GLOBALS._player, NULL); + else + scene->setAction(&scene->_sequenceManager, scene, 1970, &R2_GLOBALS._player, NULL); + } else { + if (R2_GLOBALS.getFlag(36)) + scene->setAction(&scene->_sequenceManager, scene, 1952, &R2_GLOBALS._player, NULL); + else + scene->setAction(&scene->_sequenceManager, scene, 1969, &R2_GLOBALS._player, NULL); + } +} + +void Scene1950::Exit3::changeScene() { + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._v566A5 = 3; + scene->_sceneMode = 13; + + if (scene->_field416 != 0) + R2_GLOBALS._player.animate(ANIM_MODE_9); + + Common::Point pt(340, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene1950::Exit4::changeScene() { + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._v566A5 = 4; + scene->_sceneMode = 14; + + if (R2_GLOBALS.getFlag(36)) + scene->setAction(&scene->_sequenceManager, scene, 1956, &R2_GLOBALS._player, NULL); + else + scene->setAction(&scene->_sequenceManager, scene, 1973, &R2_GLOBALS._player, NULL); +} + +void Scene1950::Exit5::changeScene() { + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._v566A5 = 5; + scene->_sceneMode = 15; + + Common::Point pt(160, 213); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene1950::Exit6::changeScene() { + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._v566A5 = 5; + if (R2_GLOBALS._v566A4 == 2) { + if ((R2_GLOBALS.getFlag(36)) && (R2_INVENTORY.getObjectScene(34) == 2) && (R2_INVENTORY.getObjectScene(35) == 2)) { + scene->_sceneMode = 1961; + Common::Point pt(-20, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + } else { + if (!R2_GLOBALS.getFlag(36)) + SceneItem::display(1950, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + if ((R2_INVENTORY.getObjectScene(34) == 1950) || (R2_INVENTORY.getObjectScene(35) == 1950)) + SceneItem::display(1950, 34, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + scene->_sceneMode = 0; + Common::Point pt(30, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + } + } else { + if (scene->_field416 != 0) + R2_GLOBALS._player.animate(ANIM_MODE_9); + + scene->_sceneMode = 16; + Common::Point pt(-20, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + } +} + +void Scene1950::Exit7::changeScene() { + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._v566A5 = 0; + scene->_sceneMode = 1951; + scene->setAction(&scene->_sequenceManager, scene, 1951, &R2_GLOBALS._player, NULL); +} + +void Scene1950::Exit8::changeScene() { + Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._v566A5 = 3; + if (R2_GLOBALS._player._visage == 22) { + scene->_sceneMode = 1975; + scene->setAction(&scene->_sequenceManager, scene, 1975, &R2_GLOBALS._player, NULL); + } else { + SceneItem::display(1950, 22, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + R2_GLOBALS._v566A5 = 0; + scene->_sceneMode = 0; + Common::Point pt(250, 150); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + _enabled = true; + } +} + +void Scene1950::subBDC1E() { + _exit1._enabled = false; + _exit2._enabled = false; + _exit3._enabled = false; + _exit4._enabled = false; + _exit5._enabled = false; + _exit6._enabled = false; + _exit7._enabled = false; + _exit8._enabled = false; + _exit1._insideArea = false; + _exit2._insideArea = false; + _exit3._insideArea = false; + _exit4._insideArea = false; + _exit5._insideArea = false; + _exit6._insideArea = false; + _exit7._insideArea = false; + _exit8._insideArea = false; + _exit1._moving = false; + _exit2._moving = false; + _exit3._moving = false; + _exit4._moving = false; + _exit5._moving = false; + _exit6._moving = false; + _exit7._moving = false; + _exit8._moving = false; + _field412 = 0; + switch (R2_GLOBALS._v566A4 - 1) { + case 0: + loadScene(1948); + break; + case 1: + // No break on purpose + case 8: + // No break on purpose + case 10: + // No break on purpose + case 12: + // No break on purpose + case 16: + // No break on purpose + case 19: + // No break on purpose + case 23: + // No break on purpose + case 30: + // No break on purpose + case 44: + // No break on purpose + case 72: + // No break on purpose + case 74: + // No break on purpose + case 86: + // No break on purpose + case 96: + // No break on purpose + case 103: + loadScene(1950); + break; + case 2: + // No break on purpose + case 29: + loadScene(1965); + break; + case 3: + // No break on purpose + case 9: + // No break on purpose + case 11: + // No break on purpose + case 15: + // No break on purpose + case 24: + // No break on purpose + case 39: + // No break on purpose + case 45: + // No break on purpose + case 71: + // No break on purpose + case 73: + // No break on purpose + case 75: + // No break on purpose + case 79: + // No break on purpose + case 85: + // No break on purpose + case 87: + // No break on purpose + case 95: + loadScene(1955); + break; + case 4: + // No break on purpose + case 6: + // No break on purpose + case 13: + // No break on purpose + case 27: + // No break on purpose + case 41: + // No break on purpose + case 48: + // No break on purpose + case 50: + // No break on purpose + case 54: + // No break on purpose + case 76: + // No break on purpose + case 80: + // No break on purpose + case 90: + // No break on purpose + case 104: + loadScene(1975); + break; + case 5: + // No break on purpose + case 7: + // No break on purpose + case 14: + // No break on purpose + case 28: + // No break on purpose + case 32: + // No break on purpose + case 47: + // No break on purpose + case 53: + loadScene(1997); + break; + case 17: + // No break on purpose + case 20: + // No break on purpose + case 25: + // No break on purpose + case 31: + // No break on purpose + case 33: + // No break on purpose + case 46: + loadScene(1995); + break; + case 18: + // No break on purpose + case 22: + // No break on purpose + case 26: + // No break on purpose + case 36: + // No break on purpose + case 38: + // No break on purpose + case 43: + // No break on purpose + case 51: + // No break on purpose + case 70: + // No break on purpose + case 78: + // No break on purpose + case 84: + // No break on purpose + case 89: + // No break on purpose + case 101: + loadScene(1970); + break; + case 21: + // No break on purpose + case 34: + // No break on purpose + case 57: + // No break on purpose + case 58: + // No break on purpose + case 59: + // No break on purpose + case 62: + // No break on purpose + case 65: + loadScene(1980); + break; + case 35: + // No break on purpose + case 61: + // No break on purpose + case 77: + // No break on purpose + case 83: + loadScene(1982); + break; + case 37: + // No break on purpose + case 52: + // No break on purpose + case 82: + // No break on purpose + case 88: + // No break on purpose + case 92: + // No break on purpose + case 97: + // No break on purpose + case 100: + loadScene(1962); + break; + case 40: + // No break on purpose + case 102: + loadScene(1960); + break; + case 42: + // No break on purpose + case 55: + // No break on purpose + case 60: + // No break on purpose + case 66: + // No break on purpose + case 68: + // No break on purpose + case 69: + // No break on purpose + case 93: + // No break on purpose + case 98: + loadScene(1990); + break; + case 49: + // No break on purpose + case 81: + // No break on purpose + case 91: + // No break on purpose + case 94: + // No break on purpose + case 99: + loadScene(1967); + break; + case 56: + // No break on purpose + case 63: + // No break on purpose + case 64: + // No break on purpose + case 67: + loadScene(1985); + _field412 = 1; + break; + default: + break; + } + + if (R2_GLOBALS._v566A4 != 1) + R2_GLOBALS._walkRegions.load(1950); + + switch (R2_GLOBALS._v566A4 - 1) { + case 0: + _exit7._enabled = true; + if ((R2_INVENTORY.getObjectScene(31) == 0) && (R2_INVENTORY.getObjectScene(34) == 1950)) + _exit8._enabled = true; + R2_GLOBALS._walkRegions.enableRegion(2); + R2_GLOBALS._walkRegions.enableRegion(3); + R2_GLOBALS._walkRegions.enableRegion(4); + R2_GLOBALS._walkRegions.enableRegion(5); + R2_GLOBALS._walkRegions.enableRegion(6); + break; + case 1: + // No break on purpose + case 2: + // No break on purpose + case 3: + // No break on purpose + case 8: + // No break on purpose + case 9: + // No break on purpose + case 10: + // No break on purpose + case 11: + // No break on purpose + case 12: + // No break on purpose + case 15: + // No break on purpose + case 16: + // No break on purpose + case 19: + // No break on purpose + case 23: + // No break on purpose + case 24: + // No break on purpose + case 29: + // No break on purpose + case 30: + // No break on purpose + case 39: + // No break on purpose + case 40: + // No break on purpose + case 44: + // No break on purpose + case 45: + // No break on purpose + case 71: + // No break on purpose + case 72: + // No break on purpose + case 73: + // No break on purpose + case 74: + // No break on purpose + case 75: + // No break on purpose + case 79: + // No break on purpose + case 85: + // No break on purpose + case 86: + // No break on purpose + case 87: + // No break on purpose + case 95: + // No break on purpose + case 96: + // No break on purpose + case 102: + // No break on purpose + case 103: + _exit3._enabled = true; + _exit6._enabled = true; + break; + case 4: + // No break on purpose + case 6: + // No break on purpose + case 13: + // No break on purpose + case 17: + // No break on purpose + case 20: + // No break on purpose + case 25: + // No break on purpose + case 27: + // No break on purpose + case 31: + // No break on purpose + case 33: + // No break on purpose + case 37: + // No break on purpose + case 41: + // No break on purpose + case 46: + // No break on purpose + case 48: + // No break on purpose + case 50: + // No break on purpose + case 52: + // No break on purpose + case 54: + // No break on purpose + case 76: + // No break on purpose + case 80: + // No break on purpose + case 82: + // No break on purpose + case 88: + // No break on purpose + case 90: + // No break on purpose + case 92: + // No break on purpose + case 97: + // No break on purpose + case 100: + // No break on purpose + case 104: + _exit6._enabled = true; + R2_GLOBALS._walkRegions.enableRegion(6); + R2_GLOBALS._walkRegions.enableRegion(9); + break; + case 5: + // No break on purpose + case 7: + // No break on purpose + case 14: + // No break on purpose + case 18: + // No break on purpose + case 22: + // No break on purpose + case 26: + // No break on purpose + case 28: + // No break on purpose + case 32: + // No break on purpose + case 36: + // No break on purpose + case 38: + // No break on purpose + case 43: + // No break on purpose + case 47: + // No break on purpose + case 49: + // No break on purpose + case 51: + // No break on purpose + case 53: + // No break on purpose + case 70: + // No break on purpose + case 78: + // No break on purpose + case 81: + // No break on purpose + case 84: + // No break on purpose + case 89: + // No break on purpose + case 91: + // No break on purpose + case 94: + // No break on purpose + case 99: + // No break on purpose + case 101: + _exit3._enabled = true; + R2_GLOBALS._walkRegions.enableRegion(1); + R2_GLOBALS._walkRegions.enableRegion(7); + R2_GLOBALS._walkRegions.enableRegion(13); + break; + default: + R2_GLOBALS._walkRegions.enableRegion(1); + R2_GLOBALS._walkRegions.enableRegion(6); + R2_GLOBALS._walkRegions.enableRegion(7); + R2_GLOBALS._walkRegions.enableRegion(9); + R2_GLOBALS._walkRegions.enableRegion(13); + break; + } + + _object1.remove(); + _object1.removeObject(); + _actor1.remove(); + + switch (R2_GLOBALS._v566A4 - 4) { + case 0: + // No break on purpose + case 3: + // No break on purpose + case 16: + // No break on purpose + case 22: + // No break on purpose + case 24: + // No break on purpose + case 32: + // No break on purpose + case 33: + // No break on purpose + case 45: + // No break on purpose + case 46: + // No break on purpose + case 48: + // No break on purpose + case 51: + // No break on purpose + case 56: + // No break on purpose + case 59: + // No break on purpose + case 67: + // No break on purpose + case 68: + // No break on purpose + case 70: + // No break on purpose + case 73: + // No break on purpose + case 82: + // No break on purpose + case 90: + _exit1._enabled = true; + _object1.setup2(1950, (R2_GLOBALS._v566A4 % 2) + 1, 1, 160, 237, 25, 0); + + _actor1.postInit(); + _actor1.setVisage(1950); + _actor1.setStrip((((R2_GLOBALS._v566A4 - 1) / 35) % 2) + 1); + _actor1.setFrame(2); + _actor1.setPosition(Common::Point(160, 167)); + _actor1.fixPriority(220); + R2_GLOBALS._walkRegions.enableRegion(3); + R2_GLOBALS._walkRegions.enableRegion(4); + break; + case 7: + // No break on purpose + case 10: + // No break on purpose + case 23: + // No break on purpose + case 29: + // No break on purpose + case 31: + // No break on purpose + case 39: + // No break on purpose + case 40: + // No break on purpose + case 52: + // No break on purpose + case 53: + // No break on purpose + case 55: + // No break on purpose + case 63: + // No break on purpose + case 65: + // No break on purpose + case 66: + // No break on purpose + case 75: + // No break on purpose + case 77: + // No break on purpose + case 81: + // No break on purpose + case 87: + // No break on purpose + case 89: + // No break on purpose + case 97: + _exit5._enabled = true; + _actor1.postInit(); + _actor1.setVisage(1950); + _actor1.setStrip((((R2_GLOBALS._v566A4 - 1) / 35) % 2) + 1); + _actor1.setFrame(3); + _actor1.setPosition(Common::Point(160, 167)); + _actor1.fixPriority(220); + break; + case 58: + // No break on purpose + case 74: + // No break on purpose + case 80: + _exit1._enabled = true; + _exit5._enabled = true; + + _object1.setup(1950, (R2_GLOBALS._v566A4 % 2) + 1, 1, 160, 137, 25); + + _actor1.postInit(); + _actor1.setVisage(1950); + _actor1.setStrip((((R2_GLOBALS._v566A4 - 1) / 35) % 2) + 1); + _actor1.setFrame(3); + _actor1.setPosition(Common::Point(160, 167)); + _actor1.fixPriority(220); + R2_GLOBALS._walkRegions.enableRegion(3); + R2_GLOBALS._walkRegions.enableRegion(4); + break; + default: + _actor1.postInit(); + _actor1.setVisage(1950); + _actor1.setStrip(((R2_GLOBALS._v566A4 - 1) % 35) + 1); + _actor1.setFrame(2); + _actor1.setPosition(Common::Point(160, 167)); + _actor1.fixPriority(220); + break; + } + + switch (R2_GLOBALS._v566A4 - 3) { + case 0: + // No break on purpose + case 3: + // No break on purpose + case 5: + // No break on purpose + case 12: + // No break on purpose + case 15: + // No break on purpose + case 18: + // No break on purpose + case 19: + // No break on purpose + case 23: + // No break on purpose + case 26: + // No break on purpose + case 27: + // No break on purpose + case 29: + // No break on purpose + case 30: + // No break on purpose + case 31: + // No break on purpose + case 32: + // No break on purpose + case 44: + // No break on purpose + case 45: + // No break on purpose + case 51: + // No break on purpose + case 55: + // No break on purpose + case 56: + // No break on purpose + case 57: + // No break on purpose + case 60: + // No break on purpose + case 63: + _exit2._enabled = true; + case 54: + // No break on purpose + case 61: + // No break on purpose + case 62: + // No break on purpose + case 65: + _exit2._enabled = true; + // No break on purpose + case 35: + // No break on purpose + case 38: + // No break on purpose + case 40: + // No break on purpose + case 47: + // No break on purpose + case 50: + // No break on purpose + case 53: + // No break on purpose + case 58: + // No break on purpose + case 64: + // No break on purpose + case 66: + // No break on purpose + case 67: + // No break on purpose + case 79: + // No break on purpose + case 80: + // No break on purpose + case 86: + // No break on purpose + case 89: + // No break on purpose + case 90: + // No break on purpose + case 91: + // No break on purpose + case 92: + // No break on purpose + case 95: + // No break on purpose + case 96: + // No break on purpose + case 97: + // No break on purpose + case 98: + // No break on purpose + case 100: + _exit4._enabled = true; + R2_GLOBALS._walkRegions.enableRegion(4); + R2_GLOBALS._walkRegions.enableRegion(5); + R2_GLOBALS._walkRegions.enableRegion(6); + R2_GLOBALS._walkRegions.enableRegion(10); + R2_GLOBALS._walkRegions.enableRegion(11); + default: + break; + } + R2_GLOBALS._uiElements.draw(); +} + +void Scene1950::subBE59B() { + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + + _actor8.remove(); + _actor2.remove(); + _actor3.remove(); + + _field416 = 0; + _field41C = 0; + + switch (R2_GLOBALS._v566A4) { + case 10: + _field41C = 1; + break; + case 13: + _field41C = 2; + break; + case 16: + _field41C = 3; + break; + case 17: + _field41C = 4; + break; + case 24: + _field41C = 5; + break; + case 25: + _field41C = 6; + break; + case 31: + _field41C = 7; + break; + case 40: + _field41C = 8; + break; + case 45: + _field41C = 9; + break; + case 46: + _field41C = 10; + break; + case 73: + _field41C = 11; + break; + case 75: + _field41C = 12; + break; + case 80: + _field41C = 13; + break; + case 87: + _field41C = 14; + break; + case 88: + _field41C = 15; + break; + case 96: + _field41C = 16; + break; + case 97: + _field41C = 17; + break; + case 104: + _field41C = 18; + break; + default: + break; + } + + if (_field41C != 0) { + _actor8.postInit(); + _actor8._numFrames = 6; + _actor8._moveRate = 6; + _actor8._moveDiff = Common::Point(3, 2); + _actor8._effect = 1; + if (R2_GLOBALS._v56613[(_field41C - 1) * 4] == 0) { + _actor8.setPosition(Common::Point(R2_GLOBALS._v56613[((_field41C - 1) * 4) + 2], R2_GLOBALS._v56613[((_field41C - 1) * 4) + 3])); + _actor8.animate(ANIM_MODE_NONE, NULL); + _actor8.addMover(NULL); + _actor8.setVisage(1961); + _actor8.setStrip(4); + _actor8.setFrame(10); + _actor8.fixPriority(10); + _actor8.setDetails(1950, 15, -1, 17, 2, (SceneItem *) NULL); + } else { + _actor8.setVisage(1960); + _actor8.setPosition(Common::Point(160, 130)); + _actor8.animate(ANIM_MODE_2, NULL); + _actor8.setDetails(1950, 12, -1, 14, 2, (SceneItem *) NULL); + _field416 = 1; + } + } + if ((R2_GLOBALS._v566A4 == 1) && (R2_INVENTORY.getObjectScene(31) != 0)) { + _actor2.postInit(); + _actor2.setVisage(1948); + _actor2.setStrip(3); + _actor2.setPosition(Common::Point(278, 155)); + _actor2.fixPriority(100); + _actor2.setDetails(1950, 19, 20, 23, 2, (SceneItem *) NULL); + } + + if (R2_GLOBALS._v566A4 == 102) { + R2_GLOBALS._walkRegions.load(1951); + R2_GLOBALS._walkRegions.enableRegion(1); + R2_GLOBALS._walkRegions.enableRegion(5); + R2_GLOBALS._walkRegions.enableRegion(6); + R2_GLOBALS._walkRegions.enableRegion(7); + + _actor6.postInit(); + _actor6.setVisage(1970); + _actor6.setStrip(1); + if (R2_GLOBALS.getFlag(37)) + _actor6.setFrame(3); + else + _actor6.setFrame(1); + _actor6.setPosition(Common::Point(193, 158)); + _actor6.setDetails(1950, 3, 4, 5, 2, (SceneItem *) NULL); + + _actor7.postInit(); + _actor7.setVisage(1970); + _actor7.setStrip(3); + _actor7.animate(ANIM_MODE_2, NULL); + _actor7._numFrames = 6; + _actor7.setPosition(Common::Point(194, 158)); + _actor7.fixPriority(159); + + _item2.setDetails(Rect(188, 124, 199, 133), 1950, 27, 28, -1, 2, NULL); + + if (R2_INVENTORY.getObjectScene(34) == 1950) { + _actor5.postInit(); + _actor5.setVisage(1970); + _actor5.setStrip(1); + _actor5.setFrame(2); + _actor5.fixPriority(160); + } + + if (R2_GLOBALS.getFlag(37)) { + _actor5.setPosition(Common::Point(192, 118)); + _actor5.setDetails(1950, 9, 4, -1, 2, (SceneItem *) NULL); + } else { + _actor4.postInit(); + _actor4.setVisage(1970); + _actor4.setStrip(4); + _actor4._numFrames = 4; + _actor4.animate(ANIM_MODE_8, NULL); + _actor4.setPosition(Common::Point(192, 121)); + _actor4.fixPriority(159); + _actor4.setDetails(1950, 6, 7, 8, 2, (SceneItem *) NULL); + + _actor5.setPosition(Common::Point(192, 109)); + _actor5.setDetails(1950, 9, 7, 8, 2, (SceneItem *) NULL); + } + + _actor3.postInit(); + _actor3.setVisage(1972); + _actor3.setStrip(1); + _actor3.setPosition(Common::Point(76, 94)); + _actor3.fixPriority(25); + _actor3.setDetails(1950, 30, -1, -1, 2, (SceneItem *) NULL); + if (R2_INVENTORY.getObjectScene(35) == 2) + _actor3.setFrame(2); + else + _actor3.setFrame(1); + + _field414 = 1; + } else if (_field414 != 0) { + _actor6.remove(); + _actor4.remove(); + _actor5.remove(); + _actor7.remove(); + _actor3.remove(); + + _item1.setDetails(Rect(0, 0, 320, 200), 1950, 0, 1, 2, 2, NULL); + } + + switch (R2_GLOBALS._v566A5) { + case 0: + _sceneMode = 1950; + if (R2_INVENTORY.getObjectScene(31) == 0) { + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + } else { + setAction(&_sequenceManager, this, 1950, &R2_GLOBALS._player, NULL); + } + break; + case 1: { + _sceneMode = R2_GLOBALS._v566A5; + R2_GLOBALS._player.setPosition(Common::Point(160, 213)); + Common::Point pt(160, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: + _sceneMode = R2_GLOBALS._v566A5; + if (R2_GLOBALS.getFlag(36)) + setAction(&_sequenceManager, this, 1957, &R2_GLOBALS._player, NULL); + else + setAction(&_sequenceManager, this, 1974, &R2_GLOBALS._player, NULL); + break; + case 3: + if (_field416 == 0) { + _sceneMode = R2_GLOBALS._v566A5; + R2_GLOBALS._player.setPosition(Common::Point(-20, 160)); + Common::Point pt(30, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + _sceneMode = 18; + _exit3._enabled = false; + _field418 = Common::Point(60, 152); + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + + _actor8.setStrip(2); + NpcMover *mover = new NpcMover(); + _actor8.addMover(mover, &_field418, this); + + R2_GLOBALS._player.setPosition(Common::Point(-20, 160)); + Common::Point pt2(30, 160); + NpcMover *mover2 = new NpcMover(); + R2_GLOBALS._player.addMover(mover2, &pt2, NULL); + } + break; + case 4: + _sceneMode = R2_GLOBALS._v566A5; + if (_field412 == 0) { + if (R2_GLOBALS.getFlag(36)) + setAction(&_sequenceManager, this, 1955, &R2_GLOBALS._player, NULL); + else + setAction(&_sequenceManager, this, 1972, &R2_GLOBALS._player, NULL); + } else { + if (R2_GLOBALS.getFlag(36)) + setAction(&_sequenceManager, this, 1954, &R2_GLOBALS._player, NULL); + else + setAction(&_sequenceManager, this, 1971, &R2_GLOBALS._player, NULL); + } + break; + case 5: { + _sceneMode = R2_GLOBALS._v566A5; + R2_GLOBALS._player.setPosition(Common::Point(160, 127)); + Common::Point pt(160, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 6: + if (_field416 == 0) { + _sceneMode = R2_GLOBALS._v566A5; + if (R2_GLOBALS._v566A4 == 1) { + setAction(&_sequenceManager, this, 1961, &R2_GLOBALS._player, NULL); + } else { + R2_GLOBALS._player.setPosition(Common::Point(340, 160)); + Common::Point pt(289, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + } else { + _sceneMode = 17; + _exit6._enabled = false; + _field418 = Common::Point(259, 152); + + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + + _actor8.setStrip(1); + NpcMover *mover = new NpcMover(); + _actor8.addMover(mover, &_field418, this); + + R2_GLOBALS._player.setPosition(Common::Point(340, 160)); + Common::Point pt2(289, 160); + NpcMover *mover2 = new NpcMover(); + R2_GLOBALS._player.addMover(mover2, &pt2, NULL); + } + break; + default: + break; + } +} + +void Scene1950::subBF4B4(int indx) { + R2_GLOBALS._player.disableControl(); + int si = indx - 1; + if ((indx / 4) == (si / 4)) { + if (si < 0) + si = 3; + } else + si = 4; + + if (_area1._arrActor1[si]._fieldA8 == 0) { + _area1._arrActor1[si].setFrame(2); + _area1._arrActor1[si]._fieldA8 = 1; + } else { + _area1._arrActor1[si].setFrame(1); + _area1._arrActor1[si]._fieldA8 = 0; + } + + si = indx + 1; + if ((indx / 4) == (si / 4)) { + if (si > 15) + si = 12; + } else + si -= 4; + + if (_area1._arrActor1[si]._fieldA8 == 0) { + _area1._arrActor1[si].setFrame(2); + _area1._arrActor1[si]._fieldA8 = 1; + } else { + _area1._arrActor1[si].setFrame(1); + _area1._arrActor1[si]._fieldA8 = 0; + } + + si = indx - 4; + if (si < 0) + si += 16; + + if (_area1._arrActor1[si]._fieldA8 == 0) { + _area1._arrActor1[si].setFrame(2); + _area1._arrActor1[si]._fieldA8 = 1; + } else { + _area1._arrActor1[si].setFrame(1); + _area1._arrActor1[si]._fieldA8 = 0; + } + + si = indx + 4; + if (si > 15) + si -= 16; + + if (_area1._arrActor1[si]._fieldA8 == 0) { + _area1._arrActor1[si].setFrame(2); + _area1._arrActor1[si]._fieldA8 = 1; + } else { + _area1._arrActor1[si].setFrame(1); + _area1._arrActor1[si]._fieldA8 = 0; + } + + int cpt = 0; + for (si = 0; si < 16; si++) { + if (_area1._arrActor1[si]._fieldA8 != 0) + ++cpt; + } + + if (cpt != 16) { + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + } else { + R2_GLOBALS.setFlag(37); + _sceneMode = 24; + // TODO: check if correct. The original doesn't countain a sceneActor in + // this call, but it's extremely unusual + setAction(&_sequenceManager, this, 1976, NULL); + } +} + +void Scene1950::postInit(SceneObjectList *OwnerList) { + _field412 = 0; + _field414 = 0; + _field416 = 0; + _field41C = 0; + if (R2_GLOBALS._sceneManager._previousScene == 300) + R2_GLOBALS._v566A4 = 103; + + subBDC1E(); + SceneExt::postInit(); + R2_GLOBALS._sound1.play(105); + + _exit1.setDetails(Rect(130, 46, 189, 135), SHADECURSOR_UP, 1950); + _exit1.setDest(Common::Point(160, 145)); + + _exit2.setDetails(Rect(208, 0, 255, 73), EXITCURSOR_N, 1950); + _exit2.setDest(Common::Point(200, 151)); + + _exit3.setDetails(Rect(305, 95, 320, 147), EXITCURSOR_E, 1950); + _exit3.setDest(Common::Point(312, 160)); + + _exit4.setDetails(Rect(208, 99, 255, 143), EXITCURSOR_S, 1950); + _exit4.setDest(Common::Point(200, 151)); + + _exit5.setDetails(Rect(113, 154, 206, 168), SHADECURSOR_DOWN, 1950); + _exit5.setDest(Common::Point(160, 165)); + + _exit6.setDetails(Rect(0, 95, 14, 147), EXITCURSOR_W, 1950); + _exit6.setDest(Common::Point(7, 160)); + + _exit7.setDetails(Rect(72, 54, 120, 128), EXITCURSOR_NW, 1950); + _exit7.setDest(Common::Point(120, 140)); + + _exit8.setDetails(Rect(258, 60, 300, 145), EXITCURSOR_NE, 1950); + _exit8.setDest(Common::Point(268, 149)); + + R2_GLOBALS._player.postInit(); + if ( (R2_INVENTORY.getObjectScene(32) == 0) && (R2_INVENTORY.getObjectScene(33) == 0) + && (R2_INVENTORY.getObjectScene(46) == 0) && (!R2_GLOBALS.getFlag(36)) ) + R2_GLOBALS._player.setVisage(22); + else + R2_GLOBALS._player.setVisage(20); + + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + _item1.setDetails(Rect(0, 0, 320, 200), 1950, 0, 1, 2, 1, NULL); + + subBE59B(); +} + +void Scene1950::remove() { + R2_GLOBALS._sound1.stop(); + R2_GLOBALS._sound2.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene1950::signal() { + switch (_sceneMode) { + case 11: + R2_GLOBALS._v566A4 += 7; + subBDC1E(); + subBE59B(); + break; + case 12: + R2_GLOBALS._v566A4 += 35; + subBDC1E(); + subBE59B(); + break; + case 1975: + SceneItem::display(1950, 21, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + // No break on purpose + case 13: + ++R2_GLOBALS._v566A4; + subBDC1E(); + subBE59B(); + break; + case 14: + R2_GLOBALS._v566A4 += 221; + subBDC1E(); + subBE59B(); + break; + case 15: + R2_GLOBALS._v566A4 += 249; + subBDC1E(); + subBE59B(); + break; + case 16: + // No break on purpose + case 1961: + --R2_GLOBALS._v566A4; + subBDC1E(); + subBE59B(); + break; + case 17: { + _sceneMode = 13; + R2_GLOBALS._v566A5 = 3; + _field416 = 0; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._player._canWalk = true; + R2_GLOBALS._player.setVisage(22); + R2_GLOBALS._player.animate(ANIM_MODE_9, NULL); + Common::Point pt(340, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + Common::Point pt2(289, 160); + NpcMover *mover2 = new NpcMover(); + _actor8.addMover(mover2, &pt2, NULL); + } + break; + case 18: { + _sceneMode = 16; + R2_GLOBALS._v566A5 = 6; + _field416 = 0; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._player._canWalk = true; + R2_GLOBALS._player.setVisage(22); + R2_GLOBALS._player.animate(ANIM_MODE_9, NULL); + Common::Point pt(-20, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + Common::Point pt2(30, 160); + NpcMover *mover2 = new NpcMover(); + _actor8.addMover(mover2, &pt2, NULL); + } + break; + case 24: + _area1.remove(); + _sceneMode = 1966; + _actor6.setFrame(3); + setAction(&_sequenceManager, this, 1966, &_actor4, &_actor5, NULL); + break; + case 1951: + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._sceneManager.changeScene(1945); + break; + case 1958: + SceneItem::display(1950, 24, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + _exit8._enabled = true; + break; + case 1959: + R2_INVENTORY.setObjectScene(46, 0); + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + _exit8._enabled = true; + break; + case 1962: + // No break on purpose + case 1963: + R2_GLOBALS._player.enableControl(); + _area1.proc12(1971, 1, 1, 160, 135); + break; + case 1964: + // No break on purpose + case 1965: + if (!R2_GLOBALS.getFlag(37)) + SceneItem::display(1950, 26, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + R2_GLOBALS._player.enableControl(); + break; + case 1966: + _actor4.remove(); + if (R2_GLOBALS.getFlag(36)) { + _sceneMode = 1964; + setAction(&_sequenceManager, this, 1964, &R2_GLOBALS._player, NULL); + } else { + _sceneMode = 1965; + setAction(&_sequenceManager, this, 1965, &R2_GLOBALS._player, NULL); + } + _actor5.setDetails(1950, 9, -1, -1, 2, (SceneItem *) NULL); + case 1967: { + _sceneMode = 0; + R2_INVENTORY.setObjectScene(34, 2); + _actor5.remove(); + if (R2_GLOBALS.getFlag(36)) + R2_GLOBALS._player.setVisage(20); + else + R2_GLOBALS._player.setVisage(22); + + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + Common::Point pt(218, 165); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 1968: + R2_GLOBALS._player.disableControl(); + R2_INVENTORY.setObjectScene(35, 2); + _actor3.setFrame(2); + if (R2_GLOBALS.getFlag(36)) + R2_GLOBALS._player.setVisage(20); + else + R2_GLOBALS._player.setVisage(22); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + break; + default: + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + } +} + +void Scene1950::process(Event &event) { + if ( (event.eventType == EVENT_BUTTON_DOWN) + && (R2_GLOBALS._player._uiEnabled) + && (R2_GLOBALS._events.getCursor() == R2_LIGHT_BULB) + && (R2_GLOBALS._player._bounds.contains(event.mousePos)) + && (R2_INVENTORY.getObjectScene(31) == 0)) { + event.handled = true; + R2_GLOBALS._player.disableControl(); + _exit7._enabled = false; + _exit8._enabled = false; + _sceneMode = 1959; + setAction(&_sequenceManager, this, 1959, &R2_GLOBALS._player, NULL); + } + Scene::process(event); +} + +} // End of namespace Ringworld2 +} // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h new file mode 100644 index 0000000000..f65a89972d --- /dev/null +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -0,0 +1,1242 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TSAGE_RINGWORLD2_SCENES1_H +#define TSAGE_RINGWORLD2_SCENES1_H + +#include "common/scummsys.h" +#include "tsage/converse.h" +#include "tsage/events.h" +#include "tsage/core.h" +#include "tsage/scenes.h" +#include "tsage/globals.h" +#include "tsage/sound.h" +#include "tsage/ringworld2/ringworld2_logic.h" +#include "tsage/ringworld2/ringworld2_speakers.h" + +namespace TsAGE { + +namespace Ringworld2 { + +using namespace TsAGE; + +class Scene1010 : public SceneExt { +public: + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene1020 : public SceneExt { +public: + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void dispatch(); +}; + +class Scene1100 : public SceneExt { + class Actor16 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor17 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor18 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + +public: + int _field412, _field414; + SpeakerSeeker1100 _seekerSpeaker; + SpeakerQuinn1100 _quinnSpeaker; + SpeakerChief1100 _chiefSpeaker; + ScenePalette _palette1; + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + NamedHotspot _item6; + NamedHotspot _item7; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SceneActor _actor8; + SceneActor _actor9; + SceneActor _actor10; + SceneActor _actor11; + SceneActor _actor12; + SceneActor _actor13; + SceneActor _actor14; + SceneActor _actor15; + BackgroundSceneObject _object1; + BackgroundSceneObject _object2; + Actor16 _actor16; + Actor17 _actor17; + Actor18 _actor18; + SequenceManager _sequenceManager1; + SequenceManager _sequenceManager2; + SequenceManager _sequenceManager3; + + Scene1100(); + void synchronize(Serializer &s); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void dispatch(); + virtual void saveCharacter(int characterIndex); +}; + +class Scene1200 : public SceneExt { + class Area1: public SceneArea { + public: + class Actor3 : public SceneActorExt { + public: + void init(int state); + virtual bool startAction(CursorType action, Event &event); + }; + + SceneActor _actor2; + Actor3 _actor3; + Actor3 _actor4; + Actor3 _actor5; + + byte _field20; + + Area1(); + void synchronize(Serializer &s); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void process(Event &event); + virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); + virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum); + }; + +public: + NamedHotspot _item1; + SceneActor _actor1; + Area1 _area1; + UnkObject1200 _object1; + SequenceManager _sequenceManager; + + int _field412; + int _field414; + int _field416; + int _field418; + int _field41A; + int _field41C; + + Scene1200(); + void synchronize(Serializer &s); + + void sub9DAD6(int indx); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); + virtual void saveCharacter(int characterIndex); +}; + +class Scene1337 : public SceneExt { + class unkObj1337sub1: public SceneHotspot { + public: + SceneObject _object1; + + int _field34; + Common::Point _field36; + + unkObj1337sub1(); + void synchronize(Serializer &s); + }; + + class unkObj1337_1: public SceneHotspot { + public: + unkObj1337sub1 _arr1[4]; + unkObj1337sub1 _arr2[8]; + unkObj1337sub1 _arr3[1]; + unkObj1337sub1 _arr4[1]; + + Common::Point _fieldB94; + Common::Point _fieldB98; + Common::Point _fieldB9C; + Common::Point _fieldBA0; + int _fieldBA4; + + unkObj1337_1(); + void synchronize(Serializer &s); + }; + + class Action1337: public Action { + public: + void subD18B5(int resNum, int stripNum, int frameNum); + void skipFrames(int32 skipCount); + }; + + class Action1: public Action1337 { + public: + void signal(); + }; + class Action2: public Action1337 { + public: + void signal(); + }; + class Action3: public Action1337 { + public: + void signal(); + }; + class Action4: public Action1337 { + public: + void signal(); + }; + class Action5: public Action1337 { + public: + void signal(); + }; + class Action6: public Action1337 { + public: + void signal(); + }; + class Action7: public Action1337 { + public: + void signal(); + }; + class Action8: public Action1337 { + public: + void signal(); + }; + class Action9: public Action1337 { + public: + void signal(); + }; + class Action10: public Action1337 { + public: + void signal(); + }; + class Action11: public Action1337 { + public: + void signal(); + }; + class Action12: public Action1337 { + public: + void signal(); + }; + class Action13: public Action1337 { + public: + void signal(); + }; +public: + typedef void (Scene1337::*FunctionPtrType)(); + FunctionPtrType _unkFctPtr412; + + ASound _aSound1; + ASound _aSound2; + BackgroundSceneObject _background1; + bool _autoplay; + unkObj1337_1 _arrunkObj1337[4]; + SceneItem _item1; + SceneObject _object1; + Action1 _action1; + Action2 _action2; + Action3 _action3; + Action4 _action4; + Action5 _action5; + Action6 _action6; + Action7 _action7; + Action8 _action8; + Action9 _action9; + Action10 _action10; + Action11 _action11; + Action12 _action12; + Action13 _action13; + unkObj1337sub1 _item2; + unkObj1337sub1 _item3; + unkObj1337sub1 _item4; + BackgroundSceneObject _background2; + int _field3E24; + int _field3E26; + int _field3E28[100]; + unkObj1337sub1 *_field3EF0; + unkObj1337sub1 *_field3EF4; + unkObj1337sub1 *_field3EF8; + unkObj1337sub1 _item5; + unkObj1337sub1 _item6; + unkObj1337sub1 _item7; + unkObj1337sub1 _item8; + int _field423C; + int _field423E; + int _field4240; + int _field4242; + int _field4244; + int _field4246; + int _field4248; + int _field424A; + int _field424C; + int _field424E; + + SceneObject _arrObject1[8]; + SceneObject _arrObject2[8]; + + Scene1337(); + virtual void synchronize(Serializer &s); + + void actionDisplay(int resNum, int lineNum, int x, int y, int arg5, int width, int textMode, int fontNum, int colFG, int colBGExt, int colFGExt); + void setAnimationInfo(unkObj1337sub1 *subObj); + void subC20E5(); + void subC20F9(); + void subC2586(); + bool subC264B(int arg1); + bool subC2687(int arg1); + int subC26CB(int arg1, int arg2); + int subC2719(int arg1); + int subC274D(int arg1); + int subC2781(int arg1); + int subC27B5(int arg1); + int subC27F9(int arg1); + void subC2835(int arg1); + bool subC2BF8(unkObj1337sub1 *subObj1, Common::Point pt); + void subC2C2F(); + void subC318B(int arg1, unkObj1337sub1 *subObj2, int arg3); + int subC3257(int arg1); + bool subC32B1(int arg1, int arg2); + int subC331B(int arg1); + bool subC3386(int arg1, int arg2); + void subC33C0(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2); + void subC3456(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2); + void subC340B(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2); + void subC34A1(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2); + unkObj1337sub1 *subC34EC(int arg1); + void subC358E(unkObj1337sub1 *subObj1, int arg2); + int subC3E92(int arg1); + void subC4A39(unkObj1337sub1 *subObj); + void subC4CD2(); + void subC4CEC(); + void subC51A0(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2); + void displayDialog(int dialogNumb); + void subPostInit(); + void subCB59B(); + void suggestInstructions(); + void shuffleCards(); + void subCCF26(); + void subCD193(); + void subCDB90(int arg1, Common::Point pt); + void subCF31D(); + void subCF979(); + void subD026D(); + void subD0281(); + void subD02CA(); + void subD183F(int arg1, int arg2); + void subD18B5(int resNum, int rlbNum, int arg3); + int subD18F5(); + int subD1917(); + int subD1940(bool flag); + void subD195F(int arg1, int arg2); + void subD1975(int arg1, int arg2); + void subD1A48(int arg1); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void process(Event &event); + virtual void dispatch(); +}; + +class Scene1500 : public SceneExt { +public: + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void dispatch(); +}; + +class Scene1525 : public SceneExt { +public: + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene1530 : public SceneExt { +public: + SpeakerQuinn _quinnSpeaker; + SpeakerSeeker _seekerSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void dispatch(); +}; + +class Scene1550 : public SceneExt { + class SceneActor1550 : public SceneActor { + public: + void subA4D14(int frameNumber, int strip); + }; + + class UnkObj15501 : public SceneActor { + public: + int _fieldA4; + int _fieldA6; + + UnkObj15501(); + void synchronize(Serializer &s); + + virtual bool startAction(CursorType action, Event &event); + }; + + class UnkObj15502 : public SceneActor { + public: + int _fieldA4; + + UnkObj15502(); + void synchronize(Serializer &s); + + virtual bool startAction(CursorType action, Event &event); + void subA5CDF(int strip); + }; + + class UnkObj15503 : public SceneActor { + public: + int _fieldA4; + + UnkObj15503(); + void synchronize(Serializer &s); + + virtual bool startAction(CursorType action, Event &event); + }; + + class UnkArea1550 : public SceneArea { + public: + byte _field20; + SceneActor _areaActor; + UnkObj15503 _unkObj155031; + UnkObj15503 _unkObj155032; + + virtual void remove(); + virtual void process(Event &event); + virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); + virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum); + }; + + class Hotspot1 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Hotspot3 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor6 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor7 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor8 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor9 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor10 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor11 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor12 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor13 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor14 : public SceneActor1550 { + // Nothing specific found in the original + // TODO: check if it's an useless class + }; + +public: + SpeakerQuinn _quinnSpeaker; + SpeakerSeeker _seekerSpeaker; + Hotspot1 _item1; + Hotspot1 _item2; + Hotspot3 _item3; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + Actor6 _actor6; + Actor7 _actor7; + Actor8 _actor8; + Actor9 _actor9; + Actor10 _actor10; + Actor11 _actor11; + Actor12 _actor12; + Actor13 _actor13; + UnkObj15501 _arrUnkObj15501[8]; + Actor14 _actor14; + Actor14 _actor15; + Actor14 _actor16; + Actor14 _actor17; + Actor14 _actor18; + Actor14 _actor19; + UnkObj15502 _arrUnkObj15502[8]; + UnkArea1550 _unkArea1; + SequenceManager _sequenceManager1; + SequenceManager _sequenceManager2; + + int _field412; + byte _field414; + int _field415; + int _field417; + int _field419; + + Scene1550(); + void synchronize(Serializer &s); + void subA2B2F(); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); + virtual void saveCharacter(int characterIndex); +}; + +class Scene1575 : public SceneExt { + class Hotspot1 : public NamedHotspot { + public: + int _field34; + int _field36; + + Hotspot1(); + void synchronize(Serializer &s); + void subA910D(int indx); + + virtual void process(Event &event); + virtual bool startAction(CursorType action, Event &event); + }; +public: + int _field412; + int _field414; + int _field416; + int _field418; + int _field41A; + Hotspot1 _item1; + Hotspot1 _item2; + Hotspot1 _item3; + Hotspot1 _item4; + Hotspot1 _item5; + Hotspot1 _item6; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SceneActor _actor8; + SceneActor _actor9; + SceneActor _actor10; + SceneActor _actor11; + SceneActor _actor12; + SceneActor _actor13; + SceneActor _actor14; + SceneActor _actor15; + SceneActor _arrActor[17]; + SequenceManager _sequenceManager1; + + Scene1575(); + void synchronize(Serializer &s); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); +}; + +class Scene1580 : public SceneExt { + class Hotspot1 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Hotspot2 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor2 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor3 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor4 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor5 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor6 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor7 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + int _field412; + SpeakerQuinn _quinnSpeaker; + SpeakerSeeker _seekerSpeaker; + Hotspot1 _item1; + Hotspot2 _item2; + NamedHotspot _item3; + SceneActor _actor1; + SceneActor _arrActor[8]; + Actor2 _actor2; + Actor3 _actor3; + Actor4 _actor4; + Actor5 _actor5; + Actor6 _actor6; + Actor7 _actor7; + SequenceManager _sequenceManager; + + Scene1580(); + void synchronize(Serializer &s); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene1625 : public SceneExt { + class Actor7 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + int _field412; + SpeakerMiranda1625 _mirandaSpeaker; + SpeakerTeal1625 _tealSpeaker; + SpeakerSoldier1625 _soldierSpeaker; + NamedHotspot _item1; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + Actor7 _actor7; + SequenceManager _sequenceManager; + + Scene1625(); + void synchronize(Serializer &s); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void process(Event &event); +}; + +class Scene1700 : public SceneExt { + class Item2 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor11 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor12 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit2 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit3 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + SpeakerQuinn _quinnSpeaker; + SpeakerSeeker _seekerSpeaker; + NamedHotspot _item1; + Item2 _item2; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SceneActor _actor8; + SceneActor _actor9; + SceneActor _actor10; + Actor11 _actor11; + Actor12 _actor12; + Exit1 _exit1; + Exit2 _exit2; + Exit3 _exit3; + SequenceManager _sequenceManager; + + int _field77A; + int _field77C; + + Scene1700(); + void synchronize(Serializer &s); + void subAF3F8(); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + +class Scene1750 : public SceneExt { + class Actor4 : public SceneActor { + public: + int _fieldA4; + int _fieldA6; + int _fieldA8; + int _fieldAA; + int _fieldAC; + int _fieldAE; + + Actor4(); + virtual void synchronize(Serializer &s); + void subB1A76(int arg1, int arg2, int arg3, int arg4, int arg5); + void subB1B27(); + + virtual void remove(); + virtual void process(Event &event); + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor5 : public SceneActor { + public: + int _fieldA4; + + Actor5(); + virtual void synchronize(Serializer &s); + + virtual bool startAction(CursorType action, Event &event); + }; + +public: + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + Actor4 _actor4; + Actor5 _actor5; + Actor5 _actor6; + Actor5 _actor7; + SequenceManager _sequenceManager; + PaletteRotation *_rotation; + + int _field412; + int _field413; + int _field415; + int _field417; + int _field419; + int _field41B; + int _field41D; + + Scene1750(); + virtual void synchronize(Serializer &s); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); +}; + +class Scene1800 : public SceneExt { + class Hotspot5 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor6 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor7 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor8 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + int _field412; + SpeakerQuinn _quinnSpeaker; + SpeakerSeeker _seekerSpeaker; + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + Hotspot5 _item5; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + Actor6 _actor6; + Actor7 _actor7; + Actor8 _actor8; + Actor8 _actor9; + Exit1 _exit1; + SequenceManager _sequenceManager; + + Scene1800(); + void synchronize(Serializer &s); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void saveCharacter(int characterIndex); +}; + +class Scene1850 : public SceneExt { + class Hotspot2 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor5 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor6 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor8 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + +public: + int _field412; + int _field414; + int _field416; + int _field418; + Common::Point _field41A; + int _field41E; + ScenePalette _palette1; + SpeakerQuinn _quinnSpeaker; + SpeakerSeeker _seekerSpeaker; + NamedHotspot _item1; + Hotspot2 _item2; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + Actor5 _actor5; + Actor6 _actor6; + Actor6 _actor7; + Actor8 _actor8; + SequenceManager _sequenceManager1; + SequenceManager _sequenceManager2; + + Scene1850(); + void synchronize(Serializer &s); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); +}; + +class Scene1875 : public SceneExt { + class Actor1875 : public SceneActor { + public: + int _fieldA4; + int _fieldA6; + + Actor1875(); + void subB84AB(); + void subB8271(int indx); + + void synchronize(Serializer &s); + virtual void process(Event &event); + }; +public: + SpeakerQuinn _quinnSpeaker; + SpeakerSeeker _seekerSpeaker; + NamedHotspot _item1; + NamedHotspot _item2; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + Actor1875 _actor4; + Actor1875 _actor5; + Actor1875 _actor6; + Actor1875 _actor7; + Actor1875 _actor8; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); +}; + +class Scene1900 : public SceneExt { + class Actor2 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit2 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + SpeakerSeeker1900 _seekerSpeaker; + NamedHotspot _item1; + NamedHotspot _item2; + SceneActor _actor1; + BackgroundSceneObject _object1; + BackgroundSceneObject _object2; + Actor2 _actor2; + Actor2 _actor3; + Exit1 _exit1; + Exit2 _exit2; + SequenceManager _sequenceManager1; + SequenceManager _sequenceManager2; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + +class Scene1925 : public SceneExt { + class Hotspot2 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Hotspot3 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class ExitUp : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit2 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit3 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit4 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + NamedHotspot _item1; + Hotspot2 _item2; + Hotspot3 _item3; + SceneActor _actor1; + ExitUp _exitUp; + Exit2 _exit2; + Exit3 _exit3; + Exit4 _exit4; + SequenceManager _sequenceManager; + + int _field9B8; + int _levelResNum[5]; + + Scene1925(); + void synchronize(Serializer &s); + + void changeLevel(bool upFlag); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + +class Scene1945 : public SceneExt { + class Hotspot3 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Hotspot4 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor3 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class ExitUp : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit2 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + NamedHotspot _item1; + NamedHotspot _item2; + Hotspot3 _item3; + Hotspot4 _item4; + SceneActor _actor1; + SceneActor _actor2; + Actor3 _actor3; + ExitUp _exitUp; + Exit2 _exit2; + SequenceManager _sequenceManager1; + SequenceManager _sequenceManager2; + + int _fieldEAA; + int _fieldEAC; + CursorType _fieldEAE; + + Scene1945(); + void synchronize(Serializer &s); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + +class Scene1950 : public SceneExt { + class Area1: public SceneArea { + public: + class Actor10 : public SceneActor { + public: + int _fieldA4; + int _fieldA6; + int _fieldA8; + + Actor10(); + void synchronize(Serializer &s); + + void init(int indx); + virtual void process(Event &event); + virtual bool startAction(CursorType action, Event &event); + }; + + SceneActor _areaActor; + Actor10 _arrActor1[16]; + + byte _field20; + int _fieldB65; + + Area1(); + void synchronize(Serializer &s); + + virtual void remove(); + virtual void process(Event &event); + virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); + virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum); + }; + + class Hotspot2 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor2 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor3 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor4 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor5 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor8 : public SceneActor { + public: + int _fieldA4; + int _fieldA6; + int _fieldA8; + int _fieldAA; + int _fieldAC; + byte _fieldAE; + byte _fieldAF; + + Actor8(); + void synchronize(Serializer &s); + + virtual void signal(); + virtual bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit2 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit3 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit4 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit5 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit6 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit7 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit8 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + NamedHotspot _item1; + Hotspot2 _item2; + SceneActor _actor1; + BackgroundSceneObject _object1; + Actor2 _actor2; + Actor3 _actor3; + SceneActor _actor4; + Actor5 _actor5; + SceneActor _actor6; + SceneActor _actor7; + Actor8 _actor8; + Area1 _area1; + Exit1 _exit1; + Exit2 _exit2; + Exit3 _exit3; + Exit4 _exit4; + Exit5 _exit5; + Exit6 _exit6; + Exit7 _exit7; + Exit8 _exit8; + SequenceManager _sequenceManager; + + int _field412; + int _field414; + int _field416; + Common::Point _field418; + int _field41C; + + Scene1950(); + void synchronize(Serializer &s); + + void subBDC1E(); + void subBE59B(); + void subBF4B4(int indx); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void process(Event &event); +}; +} // End of namespace Ringworld2 +} // End of namespace TsAGE + +#endif diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index 18fd6e6bde..6a030e5b44 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -30,14 +30,12 @@ namespace TsAGE { namespace Ringworld2 { /*-------------------------------------------------------------------------- - * Scene 2000 - Maze + * Scene 2000 - Ice Maze * *--------------------------------------------------------------------------*/ void Scene2000::initPlayer() { R2_GLOBALS._player.disableControl(); - warning("DisableControl, with arguments?"); - warning("initPlayer: %d", _mazePlayerMode); switch (_mazePlayerMode) { case 0: R2_GLOBALS._player.setStrip(5); @@ -49,7 +47,6 @@ void Scene2000::initPlayer() { } else R2_GLOBALS._player.setPosition(Common::Point(245, 129)); R2_GLOBALS._player.enableControl(); - warning("EnableControl, with 2 arguments?"); break; case 1: if (R2_GLOBALS._player._characterIndex == 1) @@ -140,10 +137,10 @@ void Scene2000::initPlayer() { _object1.postInit(); if (R2_GLOBALS._player._characterIndex == 1) { _object1.setup(20, 5, 1); - _object1.setDetails(9002, 0, 4, 3, 1, NULL); + _object1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { _object1.setup(2008, 5, 1); - _object1.setDetails(9001, 0, 5, 3, 1, NULL); + _object1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); } if (_exit1._enabled) { if (_exit2._enabled) @@ -179,8 +176,6 @@ void Scene2000::initExits() { _object1.remove(); - warning("initExits: %d", R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]); - switch (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]) { case 3: case 10: @@ -266,7 +261,7 @@ void Scene2000::initExits() { _mazePlayerMode = 0; } else if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2350) _mazePlayerMode = 1; - else + else _mazePlayerMode = 10; R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2000; R2_GLOBALS._sceneManager._previousScene = 2000; @@ -395,7 +390,6 @@ void Scene2000::Action1::signal() { case 0: { _actionIndex = 1; Common::Point pt(-20, 127); - warning("TODO: Check sub_22D26"); NpcMover *mover = new NpcMover(); scene->_objList1[_state].addMover(mover, &pt, scene); break; @@ -428,18 +422,17 @@ void Scene2000::Action1::signal() { default: break; } - + if (R2_GLOBALS._v56605[3 + _state] == R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]) scene->_objList1[_state].show(); else scene->_objList1[_state].hide(); - + signal(); break; case 5: { _actionIndex = 6; Common::Point pt(340, 127); - warning("TODO: Check sub_22D26"); NpcMover *mover = new NpcMover(); scene->_objList1[_state].addMover(mover, &pt, this); break; @@ -482,7 +475,6 @@ void Scene2000::Action1::signal() { break; case 10: { Common::Point pt(290, 127); - warning("TODO: Check sub_22D26"); NpcMover *mover = new NpcMover(); scene->_objList1[_state].addMover(mover, &pt, this); _actionIndex = 11; @@ -508,13 +500,11 @@ void Scene2000::Action1::signal() { case 15: if ((R2_GLOBALS._v56605[3 + _state] == 13) || (R2_GLOBALS._v56605[3 + _state] == 22) || (R2_GLOBALS._v56605[3 + _state] == 27)) { Common::Point pt(30, 127); - warning("TODO: Check sub_22D26"); NpcMover *mover = new NpcMover(); scene->_objList1[_state].addMover(mover, &pt, this); _actionIndex = 16; } else { Common::Point pt(120, 127); - warning("TODO: Check sub_22D26"); NpcMover *mover = new NpcMover(); scene->_objList1[_state].addMover(mover, &pt, this); _actionIndex = 16; @@ -546,15 +536,12 @@ void Scene2000::Action1::signal() { void Scene2000::Exit1::changeScene() { Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene; - warning("exit1"); scene->_exitingFlag = true; scene->_sceneMode = 0; - R2_GLOBALS._player.disableControl(); - warning("DisableControl, with arguments?"); + R2_GLOBALS._player.disableControl(CURSOR_ARROW); scene->_sceneMode = 10; - warning("TODO: Check sub_22D26"); Common::Point pt(-10, 129); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, scene); @@ -564,15 +551,12 @@ void Scene2000::Exit1::changeScene() { void Scene2000::Exit2::changeScene() { Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene; - warning("exit2"); scene->_exitingFlag = true; scene->_sceneMode = 0; - R2_GLOBALS._player.disableControl(); - warning("DisableControl, with arguments?"); + R2_GLOBALS._player.disableControl(CURSOR_ARROW); scene->_sceneMode = 11; - warning("TODO: Check sub_22D26"); Common::Point pt(330, 129); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, scene); @@ -580,12 +564,10 @@ void Scene2000::Exit2::changeScene() { void Scene2000::Exit3::changeScene() { Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene; - warning("exit13"); scene->_exitingFlag = true; scene->_sceneMode = 0; - R2_GLOBALS._player.disableControl(); - warning("DisableControl, with arguments?"); + R2_GLOBALS._player.disableControl(CURSOR_ARROW); scene->_sceneMode = 12; switch (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]) { @@ -650,12 +632,10 @@ void Scene2000::Exit3::changeScene() { } void Scene2000::Exit4::changeScene() { Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene; - warning("exit4"); scene->_exitingFlag = true; scene->_sceneMode = 0; - R2_GLOBALS._player.disableControl(); - warning("DisableControl, with arguments?"); + R2_GLOBALS._player.disableControl(CURSOR_ARROW); scene->_sceneMode = 13; switch (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]) { @@ -709,11 +689,9 @@ void Scene2000::Exit4::changeScene() { void Scene2000::Exit5::changeScene() { Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene; - warning("exit5"); scene->_sceneMode = 0; - R2_GLOBALS._player.disableControl(); - warning("DisableControl, with arguments?"); + R2_GLOBALS._player.disableControl(CURSOR_ARROW); scene->_sceneMode = 14; switch (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]) { @@ -805,7 +783,7 @@ void Scene2000::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._sound1.play(200); initExits(); g_globals->_sceneManager._fadeMode = FADEMODE_IMMEDIATE; - + R2_GLOBALS._player.postInit(); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); @@ -828,47 +806,47 @@ void Scene2000::postInit(SceneObjectList *OwnerList) { _objList1[0].setVisage(2000); _objList1[0].setStrip(2); - _objList1[0].setDetails(2001, 0, -1, -1, 1, NULL); + _objList1[0].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); _objList1[1].setVisage(2001); _objList1[1].setStrip(2); - _objList1[1].setDetails(2001, 0, -1, -1, 1, NULL); + _objList1[1].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); _objList1[2].setVisage(2003); _objList1[2].setStrip(1); - _objList1[2].setDetails(2001, 0, -1, -1, 1, NULL); + _objList1[2].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); _objList1[3].setVisage(2007); _objList1[3].setStrip(2); - _objList1[3].setDetails(2001, 12, -1, -1, 1, NULL); + _objList1[3].setDetails(2001, 12, -1, -1, 1, (SceneItem *)NULL); _objList1[4].setVisage(2004); _objList1[4].setStrip(2); - _objList1[4].setDetails(2001, 19, -1, -1, 1, NULL); + _objList1[4].setDetails(2001, 19, -1, -1, 1, (SceneItem *)NULL); _objList1[5].setVisage(2003); _objList1[5].setStrip(2); - _objList1[5].setDetails(2001, 0, -1, -1, 1, NULL); + _objList1[5].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); _objList1[6].setVisage(2000); _objList1[6].setStrip(1); - _objList1[6].setDetails(2001, 0, -1, -1, 1, NULL); + _objList1[6].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); _objList1[7].setVisage(2000); _objList1[7].setStrip(2); - _objList1[7].setDetails(2001, 0, -1, -1, 1, NULL); + _objList1[7].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); _objList1[8].setVisage(2000); _objList1[8].setStrip(2); - _objList1[8].setDetails(2001, 0, -1, -1, 1, NULL); + _objList1[8].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); _objList1[9].setVisage(2006); _objList1[9].setStrip(1); - _objList1[9].setDetails(2001, 6, -1, -1, 1, NULL); + _objList1[9].setDetails(2001, 6, -1, -1, 1, (SceneItem *)NULL); _objList1[10].setVisage(2007); _objList1[10].setStrip(1); - _objList1[10].setDetails(2001, 12, -1, -1, 1, NULL); + _objList1[10].setDetails(2001, 12, -1, -1, 1, (SceneItem *)NULL); for (int i = 0; i < 11; i++) { _objList1[i].animate(ANIM_MODE_1, NULL); @@ -1009,6 +987,9 @@ void Scene2000::signal() { g_globals->_sceneManager.changeScene(2535); break; default: + if (R2_GLOBALS._v56AAB != 0) + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); break; } break; @@ -1022,10 +1003,9 @@ void Scene2000::signal() { } void Scene2000::process(Event &event) { - if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN) && + if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_CROSSHAIRS)) { - warning("TODO: Check sub_22D26"); - + Common::Point pt(event.mousePos.x, 129); PlayerMover *mover = new PlayerMover(); R2_GLOBALS._player.addMover(mover, &pt, this); @@ -1047,7 +1027,7 @@ void Scene2000::synchronize(Serializer &s) { * *--------------------------------------------------------------------------*/ bool Scene2350::Actor2::startAction(CursorType action, Event &event) { - if (action != R2_6) + if (action != R2_SENSOR_PROBE) return(SceneActor::startAction(action, event)); return true; } @@ -1055,7 +1035,7 @@ bool Scene2350::Actor2::startAction(CursorType action, Event &event) { bool Scene2350::Actor3::startAction(CursorType action, Event &event) { Scene2350 *scene = (Scene2350 *)R2_GLOBALS._sceneManager._scene; - if ((action == R2_20) && (R2_GLOBALS.getFlag(74))) { + if ((action == R2_REBREATHER_TANK) && (R2_GLOBALS.getFlag(74))) { R2_GLOBALS._player.disableControl(); scene->_actor1.postInit(); scene->_sceneMode = 2355; @@ -1068,23 +1048,22 @@ bool Scene2350::Actor3::startAction(CursorType action, Event &event) { void Scene2350::ExitUp::changeScene() { Scene2350 *scene = (Scene2350 *)R2_GLOBALS._sceneManager._scene; - - R2_GLOBALS._player.disableControl(); + + R2_GLOBALS._player.disableControl(CURSOR_CROSSHAIRS); scene->_sceneMode = 12; if (R2_GLOBALS._player._characterIndex == 1) scene->setAction(&scene->_sequenceManager, scene, 2350, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2352, &R2_GLOBALS._player, NULL); } - + void Scene2350::ExitWest::changeScene() { Scene2350 *scene = (Scene2350 *)R2_GLOBALS._sceneManager._scene; - R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.disableControl(CURSOR_CROSSHAIRS); scene->_sceneMode = 11; Common::Point pt(-10, 129); - warning("TODO: Check sub_22D26"); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, scene); @@ -1120,10 +1099,10 @@ void Scene2350::postInit(SceneObjectList *OwnerList) { _actor2.postInit(); if (R2_GLOBALS._player._characterIndex == 1) { _actor2.setup(20, 5, 1); - _actor2.setDetails(9002, 0, 4, 3, 1, NULL); + _actor2.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { _actor2.setup(2008, 5, 1); - _actor2.setDetails(9001, 0, 5, 3, 1, NULL); + _actor2.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); } _actor2.setPosition(Common::Point(135, 128)); } @@ -1136,11 +1115,11 @@ void Scene2350::postInit(SceneObjectList *OwnerList) { } else { _actor3.setup(2350, 0, 1); _actor3.setPosition(Common::Point(197, 101)); - _actor3.setDetails(2000, 12, -1, -1, 1, NULL); + _actor3.setDetails(2000, 12, -1, -1, 1, (SceneItem *)NULL); _actor3.fixPriority(10); _actor4.setup(2350, 1, 2); _actor4.setPosition(Common::Point(199, 129)); - _actor4.setDetails(2000, 12, -1, -1, 1, NULL); + _actor4.setDetails(2000, 12, -1, -1, 1, (SceneItem *)NULL); _actor4.fixPriority(10); } _item1.setDetails(Rect(0, 0, 320, 200), 2000, 9, -1, -1, 1, NULL); @@ -1150,14 +1129,13 @@ void Scene2350::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] == 34) { if (R2_GLOBALS._player._characterIndex == 1) _sceneMode = 2351; - else + else _sceneMode = 2353; setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL); } else { _sceneMode = 10; R2_GLOBALS._player.setPosition(Common::Point(-20, 129)); Common::Point pt(20, 129); - warning("TODO: Check sub_22D26"); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); @@ -1169,7 +1147,7 @@ void Scene2350::postInit(SceneObjectList *OwnerList) { } R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2350; } - + void Scene2350::remove() { R2_GLOBALS._sound1.fadeOut(NULL); SceneExt::remove(); @@ -1211,7 +1189,7 @@ void Scene2350::signal() { } void Scene2350::process(Event &event) { - if ((R2_GLOBALS._player._canWalk) && (event.eventType != EVENT_BUTTON_DOWN) && + if ((R2_GLOBALS._player._canWalk) && (event.eventType != EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_CROSSHAIRS)){ Common::Point pt(event.mousePos.x, 129); PlayerMover *mover = new PlayerMover(); @@ -1222,12 +1200,12 @@ void Scene2350::process(Event &event) { } /*-------------------------------------------------------------------------- - * Scene 2400 - Maze: Large empty room + * Scene 2400 - Ice Maze: Large empty room * *--------------------------------------------------------------------------*/ void Scene2400::Exit1::changeScene() { Scene2400 *scene = (Scene2400 *)R2_GLOBALS._sceneManager._scene; - + R2_GLOBALS._player.disableControl(); scene->_sceneMode = 10; @@ -1236,7 +1214,7 @@ void Scene2400::Exit1::changeScene() { R2_GLOBALS._player.addMover(mover, &pt, scene); } - + void Scene2400::Exit2::changeScene() { Scene2400 *scene = (Scene2400 *)R2_GLOBALS._sceneManager._scene; @@ -1266,7 +1244,7 @@ void Scene2400::postInit(SceneObjectList *OwnerList) { setAction(&_sequenceManager, this, 2401, &R2_GLOBALS._player, NULL); } } - + void Scene2400::signal() { switch (_sceneMode) { case 10: @@ -1284,20 +1262,20 @@ void Scene2400::signal() { } /*-------------------------------------------------------------------------- - * Scene 2425 - Maze: + * Scene 2425 - Ice Maze: * *--------------------------------------------------------------------------*/ bool Scene2425::Item1::startAction(CursorType action, Event &event) { Scene2425 *scene = (Scene2425 *)R2_GLOBALS._sceneManager._scene; - if ((action == R2_37) && (!R2_GLOBALS.getFlag(84))) { + if ((action == R2_GUNPOWDER) && (!R2_GLOBALS.getFlag(84))) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 2426; scene->setAction(&scene->_sequenceManager, scene, 2426, &R2_GLOBALS._player, &scene->_actor1, NULL); R2_GLOBALS.setFlag(84); return true; - } else if (action == R2_37) { + } else if (action == R2_GUNPOWDER) { R2_GLOBALS._events.setCursor(R2_STEPPING_DISKS); R2_GLOBALS._player.enableControl(R2_STEPPING_DISKS); return NamedHotspot::startAction(R2_STEPPING_DISKS, event); @@ -1308,13 +1286,13 @@ bool Scene2425::Item1::startAction(CursorType action, Event &event) { bool Scene2425::Item2::startAction(CursorType action, Event &event) { Scene2425 *scene = (Scene2425 *)R2_GLOBALS._sceneManager._scene; - if ((action == R2_37) && (R2_GLOBALS.getFlag(84))) { + if ((action == R2_GUNPOWDER) && (R2_GLOBALS.getFlag(84))) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 2427; scene->setAction(&scene->_sequenceManager, scene, 2427, &R2_GLOBALS._player, &scene->_actor1, NULL); R2_GLOBALS.clearFlag(84); return true; - } else if (action == R2_37) { + } else if (action == R2_GUNPOWDER) { R2_GLOBALS._events.setCursor(R2_STEPPING_DISKS); R2_GLOBALS._player.enableControl(R2_STEPPING_DISKS); return NamedHotspot::startAction(R2_STEPPING_DISKS, event); @@ -1325,7 +1303,7 @@ bool Scene2425::Item2::startAction(CursorType action, Event &event) { bool Scene2425::Item3::startAction(CursorType action, Event &event) { Scene2425 *scene = (Scene2425 *)R2_GLOBALS._sceneManager._scene; - if (action != R2_37) + if (action != R2_GUNPOWDER) return NamedHotspot::startAction(action, event); else { R2_GLOBALS._player.disableControl(); @@ -1342,7 +1320,7 @@ bool Scene2425::Item3::startAction(CursorType action, Event &event) { } bool Scene2425::Item4::startAction(CursorType action, Event &event) { - if (action != R2_37) + if (action != R2_GUNPOWDER) return NamedHotspot::startAction(action, event); else { R2_GLOBALS._events.setCursor(R2_STEPPING_DISKS); @@ -1354,19 +1332,19 @@ bool Scene2425::Item4::startAction(CursorType action, Event &event) { bool Scene2425::Actor1::startAction(CursorType action, Event &event) { if (action == R2_STEPPING_DISKS) { if (R2_GLOBALS._player._characterIndex == 2) { - R2_GLOBALS._events.setCursor(R2_37); + R2_GLOBALS._events.setCursor(R2_GUNPOWDER); return true; } else { return SceneActor::startAction(action, event); } - } else if (R2_GLOBALS._events.getCursor() == R2_37) + } else if (R2_GLOBALS._events.getCursor() == R2_GUNPOWDER) return false; - else + else return SceneActor::startAction(action, event); } bool Scene2425::Actor2::startAction(CursorType action, Event &event) { - if (action != R2_37) + if (action != R2_GUNPOWDER) return SceneActor::startAction(action, event); else { R2_GLOBALS._events.setCursor(R2_STEPPING_DISKS); @@ -1414,10 +1392,10 @@ void Scene2425::postInit(SceneObjectList *OwnerList) { _actor2.postInit(); if (R2_GLOBALS._player._characterIndex == 1) { _actor2.setup(20, 5, 1); - _actor2.setDetails(9002, 0, 4, 3, 1, NULL); + _actor2.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { _actor2.setup(2008, 5, 1); - _actor2.setDetails(9001, 0, 5, 3, 1, NULL); + _actor2.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); } _actor2.setPosition(Common::Point(250, 185)); } @@ -1427,10 +1405,10 @@ void Scene2425::postInit(SceneObjectList *OwnerList) { _actor1.setup(2426, 1, 1); else _actor1.setup(2426, 1, 2); - + _actor1.setPosition(Common::Point(290, 9)); _actor1.fixPriority(20); - _actor1.setDetails(2455, 12, -1, -1, 1, NULL); + _actor1.setDetails(2455, 12, -1, -1, 1, (SceneItem *)NULL); _item1.setDetails(Rect(225, 52, 248, 65), 2425, -1, -1, -1, 1, NULL); _item2.setDetails(Rect(292, 81, 316, 94), 2425, -1, -1, -1, 1, NULL); @@ -1499,7 +1477,7 @@ void Scene2425::signal() { } /*-------------------------------------------------------------------------- - * Scene 2430 - Maze: Bedroom + * Scene 2430 - Ice Maze: Bedroom * *--------------------------------------------------------------------------*/ @@ -1533,7 +1511,7 @@ bool Scene2430::Actor3::startAction(CursorType action, Event &event) { void Scene2430::Exit1::changeScene() { Scene2430 *scene = (Scene2430 *)R2_GLOBALS._sceneManager._scene; - + scene->_sceneMode = 0; R2_GLOBALS._events.setCursor(R2_NEGATOR_GUN); R2_GLOBALS._player.disableControl(); @@ -1554,14 +1532,14 @@ void Scene2430::postInit(SceneObjectList *OwnerList) { _actor2.setup(2435, 1, 5); _actor2.setPosition(Common::Point(205, 119)); _actor2.fixPriority(152); - _actor2.setDetails(2430, 51, -1, 53, 1, NULL); + _actor2.setDetails(2430, 51, -1, 53, 1, (SceneItem *)NULL); } if (R2_INVENTORY.getObjectScene(50) == 2435) { _actor3.postInit(); _actor3.setup(2435, 1, 1); _actor3.setPosition(Common::Point(31, 65)); - _actor3.setDetails(2430, 48, -1, -1, 1, NULL); + _actor3.setDetails(2430, 48, -1, -1, 1, (SceneItem *)NULL); } R2_GLOBALS._player.postInit(); @@ -1579,10 +1557,10 @@ void Scene2430::postInit(SceneObjectList *OwnerList) { _actor1.postInit(); if (R2_GLOBALS._player._characterIndex == 1) { _actor1.setup(20, 5, 1); - _actor1.setDetails(9002, 0, 4, 3, 1, NULL); + _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { _actor1.setup(2008, 5, 1); - _actor1.setDetails(9001, 0, 5, 3, 1, NULL); + _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); } _actor1.setPosition(Common::Point(189, 137)); R2_GLOBALS._walkRegions.enableRegion(4); @@ -1623,12 +1601,12 @@ void Scene2430::signal() { break; case 2430: _actor2.remove(); - R2_INVENTORY.setObjectScene(R2_37, 2); + R2_INVENTORY.setObjectScene(R2_GUNPOWDER, 2); R2_GLOBALS._player.enableControl(); break; case 2435: _actor3.remove(); - R2_INVENTORY.setObjectScene(R2_50, 2); + R2_INVENTORY.setObjectScene(R2_ALCOHOL_LAMP_3, 2); R2_GLOBALS._player.enableControl(); break; default: @@ -1638,7 +1616,7 @@ void Scene2430::signal() { } /*-------------------------------------------------------------------------- - * Scene 2435 - Maze: Throne room + * Scene 2435 - Ice Maze: Throne room * *--------------------------------------------------------------------------*/ bool Scene2435::Actor1::startAction(CursorType action, Event &event) { @@ -1649,27 +1627,27 @@ bool Scene2435::Actor2::startAction(CursorType action, Event &event) { Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene; switch (action) { - case R2_34: + case R2_SAPPHIRE_BLUE: R2_GLOBALS._player.disableControl(); - R2_GLOBALS._events.setCursor(R2_2); + R2_GLOBALS._events.setCursor(CURSOR_ARROW); R2_GLOBALS.setFlag(82); scene->_stripManager.start(603, scene); return true; - case R2_35: + case R2_ANCIENT_SCROLLS: R2_GLOBALS._player.disableControl(); - R2_GLOBALS._events.setCursor(R2_2); + R2_GLOBALS._events.setCursor(CURSOR_ARROW); R2_GLOBALS.setFlag(82); scene->_stripManager.start(602, scene); - R2_INVENTORY.setObjectScene(R2_35, 2000); + R2_INVENTORY.setObjectScene(R2_ANCIENT_SCROLLS, 2000); return true; case CURSOR_TALK: R2_GLOBALS._player.disableControl(); scene->_sceneMode = 20; - R2_GLOBALS._events.setCursor(R2_2); + R2_GLOBALS._events.setCursor(CURSOR_ARROW); if ((R2_GLOBALS._player._characterIndex == 1) || (R2_GLOBALS.getFlag(82))) { scene->_stripManager.start(605, scene); return true; - } else if (R2_INVENTORY.getObjectScene(R2_35) == 2) { + } else if (R2_INVENTORY.getObjectScene(R2_ANCIENT_SCROLLS) == 2) { scene->_stripManager.start(601, scene); return true; } else { @@ -1707,7 +1685,7 @@ void Scene2435::postInit(SceneObjectList *OwnerList) { _actor2.postInit(); _actor2.setup(2005, 3, 1); _actor2.setPosition(Common::Point(219, 106)); - _actor2.setDetails(2001, 25, 26, -1, 1, NULL); + _actor2.setDetails(2001, 25, 26, -1, 1, (SceneItem *)NULL); R2_GLOBALS._player.postInit(); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); if (R2_GLOBALS._player._characterIndex == 1) { @@ -1722,10 +1700,10 @@ void Scene2435::postInit(SceneObjectList *OwnerList) { _actor1.postInit(); if (R2_GLOBALS._player._characterIndex == 1) { _actor1.setup(20, 5, 1); - _actor1.setDetails(9002, 0, 4, 3, 1, NULL); + _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { _actor1.setup(2008, 5, 1); - _actor1.setDetails(9001, 0, 5, 3, 1, NULL); + _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); } _actor1.setPosition(Common::Point(107, 145)); R2_GLOBALS._walkRegions.enableRegion(2); @@ -1765,7 +1743,7 @@ void Scene2435::signal() { g_globals->_sceneManager.changeScene(2000); break; case 20: - R2_GLOBALS._player.enableControl(R2_6); + R2_GLOBALS._player.enableControl(CURSOR_TALK); break; case 30: R2_GLOBALS._player._characterScene[1] = 2435; @@ -1787,7 +1765,7 @@ void Scene2435::signal() { case 2436: R2_GLOBALS._walkRegions.enableRegion(2); _sceneMode = 20; - R2_GLOBALS._events.setCursor(R2_2); + R2_GLOBALS._events.setCursor(CURSOR_ARROW); _stripManager.start(709, this); default: R2_GLOBALS._player.enableControl(); @@ -1796,7 +1774,7 @@ void Scene2435::signal() { } /*-------------------------------------------------------------------------- - * Scene 2440 - Maze: Another bedroom + * Scene 2440 - Ice Maze: Another bedroom * *--------------------------------------------------------------------------*/ @@ -1812,7 +1790,7 @@ bool Scene2440::Actor2::startAction(CursorType action, Event &event) { scene->_sceneMode = 2440; scene->setAction(&scene->_sequenceManager, scene, 2440, &R2_GLOBALS._player, &scene->_actor2, NULL); return true; - } + } return SceneActor::startAction(action, event); } @@ -1840,7 +1818,7 @@ void Scene2440::postInit(SceneObjectList *OwnerList) { _actor2.setup(2435, 1, 1); _actor2.setPosition(Common::Point(94, 80)); _actor2.fixPriority(106); - _actor2.setDetails(2430, 48, -1, -1, 1, NULL); + _actor2.setDetails(2430, 48, -1, -1, 1, (SceneItem *)NULL); } R2_GLOBALS._player.postInit(); R2_GLOBALS._player.enableControl(); @@ -1858,10 +1836,10 @@ void Scene2440::postInit(SceneObjectList *OwnerList) { _actor1.postInit(); if (R2_GLOBALS._player._characterIndex == 1) { _actor1.setup(20, 5, 1); - _actor1.setDetails(9002, 0, 4, 3, 1, NULL); + _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { _actor1.setup(2008, 5, 1); - _actor1.setDetails(9002, 0, 5, 3, 1, NULL); + _actor1.setDetails(9002, 0, 5, 3, 1, (SceneItem *)NULL); } _actor1.setPosition(Common::Point(38, 119)); } @@ -1909,7 +1887,7 @@ void Scene2440::signal() { } /*-------------------------------------------------------------------------- - * Scene 2445 - Maze: + * Scene 2445 - Ice Maze: * *--------------------------------------------------------------------------*/ void Scene2445::postInit(SceneObjectList *OwnerList) { @@ -1927,7 +1905,7 @@ void Scene2445::signal() { } /*-------------------------------------------------------------------------- - * Scene 2450 - Maze: Another bedroom + * Scene 2450 - Ice Maze: Another bedroom * *--------------------------------------------------------------------------*/ @@ -2005,7 +1983,7 @@ void Scene2450::postInit(SceneObjectList *OwnerList) { _actor2.setVisage(2009); _actor2.setPosition(Common::Point(190, 119)); _actor2.fixPriority(50); - _actor2.setDetails(2450, 0, -1, -1, 1, NULL); + _actor2.setDetails(2450, 0, -1, -1, 1, (SceneItem *)NULL); } R2_GLOBALS._player.postInit(); @@ -2028,7 +2006,7 @@ void Scene2450::postInit(SceneObjectList *OwnerList) { _actor1.postInit(); _actor1.setup(20, 6, 1); _actor1.setPosition(Common::Point(240, 120)); - _actor1.setDetails(9002, 0, 4, 3, 1, NULL); + _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } setAction(&_sequenceManager, this, 2451, &R2_GLOBALS._player, NULL); } else { @@ -2040,7 +2018,7 @@ void Scene2450::postInit(SceneObjectList *OwnerList) { _actor1.setup(2008, 6, 1); else _actor1.setup(10, 6, 1); - _actor1.setDetails(9001, 0, 5, 3, 1, NULL); + _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); _actor1.setPosition(Common::Point(106, 111)); } setAction(&_sequenceManager, this, 2456, &R2_GLOBALS._player, NULL); @@ -2061,18 +2039,18 @@ void Scene2450::postInit(SceneObjectList *OwnerList) { _actor1.postInit(); _actor1.setup(20, 6, 1); _actor1.setPosition(Common::Point(240, 120)); - _actor1.setDetails(9002, 0, 4, 3, 1, NULL); + _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } } else { _actor1.postInit(); _actor1.setup(20, 8, 1); _actor1.setPosition(Common::Point(93, 158)); - _actor1.setDetails(9002, 0, 4, 3, 1, NULL); + _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); _actor3.postInit(); _actor3.setup(2001, 7, 1); _actor3.setPosition(Common::Point(34, 153)); - _actor3.setDetails(2001, 40, -1, -1, 1, NULL); + _actor3.setDetails(2001, 40, -1, -1, 1, (SceneItem *)NULL); _exit1._enabled = false; } @@ -2090,7 +2068,7 @@ void Scene2450::postInit(SceneObjectList *OwnerList) { _actor1.setup(10, 6, 1); } _actor1.setPosition(Common::Point(106, 111)); - _actor1.setDetails(9001, 0, 5, 3, 1, NULL); + _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); } } else { _actor1.postInit(); @@ -2100,12 +2078,12 @@ void Scene2450::postInit(SceneObjectList *OwnerList) { _actor1.setup(10, 6, 1); } _actor1.setPosition(Common::Point(106, 111)); - _actor1.setDetails(9001, 0, 5, 3, 1, NULL); + _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); _actor3.postInit(); _actor3.setup(2001, 7, 1); _actor3.setPosition(Common::Point(34, 153)); - _actor3.setDetails(2001, 40, -1, -1, 1, NULL); + _actor3.setDetails(2001, 40, -1, -1, 1, (SceneItem *)NULL); _exit1._enabled = false; } @@ -2209,9 +2187,9 @@ void Scene2450::signal() { break; default: _actor1.postInit(); - _actor1.setDetails(9002, 0, 4, 3, 2, NULL); + _actor1.setDetails(9002, 0, 4, 3, 2, (SceneItem *)NULL); _actor3.postInit(); - _actor3.setDetails(2001, 40, -1, -1, 2, NULL); + _actor3.setDetails(2001, 40, -1, -1, 2, (SceneItem *)NULL); _sceneMode = 2453; setAction(&_sequenceManager, this, 2453, &_actor3, &_actor1, NULL); break; @@ -2219,21 +2197,21 @@ void Scene2450::signal() { } /*-------------------------------------------------------------------------- - * Scene 2455 - Maze: Inside crevasse + * Scene 2455 - Ice Maze: Inside crevasse * *--------------------------------------------------------------------------*/ bool Scene2455::Actor1::startAction(CursorType action, Event &event) { Scene2455 *scene = (Scene2455 *)R2_GLOBALS._sceneManager._scene; - if (action == R2_29) { + if (action == R2_GLASS_DOME) { if ((R2_INVENTORY.getObjectScene(49) == 2455) || (R2_INVENTORY.getObjectScene(50) == 2455)) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 2458; scene->_actor2._lookLineNum = 9; scene->_actor1.remove(); scene->_actor3.postInit(); - scene->_actor3.setDetails(2455, 16, 1, -1, 2, NULL); + scene->_actor3.setDetails(2455, 16, 1, -1, 2, (SceneItem *)NULL); scene->setAction(&scene->_sequenceManager, scene, 2458, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor3, NULL); return true; } @@ -2246,25 +2224,25 @@ bool Scene2455::Actor2::startAction(CursorType action, Event &event) { Scene2455 *scene = (Scene2455 *)R2_GLOBALS._sceneManager._scene; switch (action) { - case R2_49: + case R2_ALCOHOL_LAMP_2: if (R2_INVENTORY.getObjectScene(50) != 2455) { R2_GLOBALS._player.disableControl(); scene->_actor1.postInit(); scene->_actor1.setup(2456, 3, 3); scene->_actor1.setPosition(Common::Point(162, 165)); - scene->_actor1.setDetails(2455, 15, 1, -1, 2, NULL); + scene->_actor1.setDetails(2455, 15, 1, -1, 2, (SceneItem *)NULL); scene->_sceneMode = 11; scene->setAction(&scene->_sequenceManager, scene, 2457, &R2_GLOBALS._player, &scene->_actor2, NULL); return true; } break; - case R2_50: + case R2_ALCOHOL_LAMP_3: if (R2_INVENTORY.getObjectScene(49) != 2455) { R2_GLOBALS._player.disableControl(); scene->_actor1.postInit(); scene->_actor1.setup(2456, 3, 3); scene->_actor1.setPosition(Common::Point(162, 165)); - scene->_actor1.setDetails(2455, 15, 1, -1, 2, NULL); + scene->_actor1.setDetails(2455, 15, 1, -1, 2, (SceneItem *)NULL); scene->_sceneMode = 12; scene->setAction(&scene->_sequenceManager, scene, 2457, &R2_GLOBALS._player, &scene->_actor2, NULL); return true; @@ -2317,25 +2295,25 @@ void Scene2455::postInit(SceneObjectList *OwnerList) { _actor1.postInit(); _actor1.setup(2456, 3, 3); _actor1.setPosition(Common::Point(162, 165)); - _actor1.setDetails(2455, 15, 1, -1, 1, NULL); - } + _actor1.setDetails(2455, 15, 1, -1, 1, (SceneItem *)NULL); + } } else { _actor3.postInit(); _actor3.setup(2456, 3, 1); _actor3.setPosition(Common::Point(176, 165)); - _actor3.setDetails(2455, 16, 1, -1, 1, NULL); + _actor3.setDetails(2455, 16, 1, -1, 1, (SceneItem *)NULL); } _actor2.postInit(); if (R2_INVENTORY.getObjectScene(29) == 2455) { _actor2.setup(2456, 3, 2); - _actor2.setDetails(2455, 9, 1, -1, 1, NULL); + _actor2.setDetails(2455, 9, 1, -1, 1, (SceneItem *)NULL); } else { - if ((R2_INVENTORY.getObjectScene(50) != 2455) && (R2_INVENTORY.getObjectScene(49) != 2455)) + if ((R2_INVENTORY.getObjectScene(50) != 2455) && (R2_INVENTORY.getObjectScene(49) != 2455)) _actor2.setup(2455, 1, 1); - else + else _actor2.setup(2456, 1, 1); - _actor2.setDetails(2455, 3, 1, -1, 1, NULL); + _actor2.setDetails(2455, 3, 1, -1, 1, (SceneItem *)NULL); } _actor2.setPosition(Common::Point(162, 165)); _actor2.fixPriority(20); @@ -2399,7 +2377,7 @@ void Scene2455::signal() { } /*-------------------------------------------------------------------------- - * Scene 2500 - Maze: Large Cave + * Scene 2500 - Ice Maze: Large Cave * *--------------------------------------------------------------------------*/ @@ -2421,7 +2399,7 @@ void Scene2500::postInit(SceneObjectList *OwnerList) { SceneExt::postInit(); if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 3100) - R2_GLOBALS._v58CE2 = 0; + R2_GLOBALS._uiElements._active = false; _stripManager.addSpeaker(&_quinnSpeaker); _stripManager.addSpeaker(&_seekerSpeaker); @@ -2448,11 +2426,11 @@ void Scene2500::postInit(SceneObjectList *OwnerList) { _actor1.postInit(); if (R2_GLOBALS._player._characterIndex == 1) { _actor1.setup(21, 3, 1); - _actor1.setDetails(9002, 1, -1, -1, 1, NULL); + _actor1.setDetails(9002, 1, -1, -1, 1, (SceneItem *)NULL); } else { _actor1.setup(2008, 3, 1); _actor1.changeZoom(50); - _actor1.setDetails(9001, 0, -1, -1, 1, NULL); + _actor1.setDetails(9001, 0, -1, -1, 1, (SceneItem *)NULL); } _actor1.setPosition(Common::Point(141, 94)); } @@ -2503,5 +2481,2047 @@ void Scene2500::signal() { } } +/*-------------------------------------------------------------------------- + * Scene 2525 - Furnace room + * + *--------------------------------------------------------------------------*/ +bool Scene2525::Item5::startAction(CursorType action, Event &event) { + Scene2525 *scene = (Scene2525 *)R2_GLOBALS._sceneManager._scene; + + if ((action == R2_REBREATHER_TANK) && (!R2_GLOBALS.getFlag(74))) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2526; + scene->setAction(&scene->_sequenceManager, scene, 2526, &R2_GLOBALS._player, NULL); + return true; + } + + return SceneItem::startAction(action, event); +} + +bool Scene2525::Actor3::startAction(CursorType action, Event &event) { + Scene2525 *scene = (Scene2525 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS._player._characterIndex == 2) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2525; + scene->setAction(&scene->_sequenceManager, scene, 2525, &R2_GLOBALS._player, &scene->_actor3, NULL); + } else { + SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + return true; +} + +void Scene2525::Exit1::changeScene() { + Scene2525 *scene = (Scene2525 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 11; + + Common::Point pt(R2_GLOBALS._player._position.x, 200); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene2525::postInit(SceneObjectList *OwnerList) { + loadScene(2525); + SceneExt::postInit(); + R2_GLOBALS._sound1.play(200); + R2_GLOBALS._sound2.play(207); + + _exit1.setDetails(Rect(86, 155, 228, 168), EXITCURSOR_S, 2000); + + if (R2_INVENTORY.getObjectScene(29) == 2525) { + _actor3.postInit(); + _actor3.setup(2435, 1, 2); + _actor3.setPosition(Common::Point(78, 155)); + _actor3.fixPriority(155); + _actor3.setDetails(2525, 27, -1, -1, 1, (SceneItem *)NULL); + } + + _actor2.postInit(); + _actor2.setup(2525, 1, 1); + _actor2.setPosition(Common::Point(183, 114)); + _actor2.setDetails(2525, 15, -1, -1, 1, (SceneItem *)NULL); + _actor2.animate(ANIM_MODE_2, NULL); + _actor2._numFrames = 3; + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + if (R2_GLOBALS._player._characterIndex == 1) { + R2_GLOBALS._player.setup(2008, 3, 1); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + } else { + R2_GLOBALS._player.setup(20, 3, 1); + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + } + + if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) { + _actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) { + _actor1.setup(20, 5, 1); + _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); + } else { + _actor1.setup(2008, 5, 1); + _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); + } + _actor1.setPosition(Common::Point(209, 162)); + + R2_GLOBALS._walkRegions.enableRegion(4); + } + + _item5.setDetails(Rect(125, 73, 140, 86), 2525, 6, -1, -1, 1, NULL); + _item3.setDetails(Rect(137, 11, 163, 72), 2525, 12, -1, -1, 1, NULL); + _item4.setDetails(Rect(204, 20, 234, 78), 2525, 12, -1, -1, 1, NULL); + _item2.setDetails(Rect(102, 62, 230, 134), 2525, 0, -1, -1, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 2525, 24, -1, -1, 1, NULL); + + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) { + R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2525; + R2_GLOBALS._player.setPosition(Common::Point(160, 200)); + Common::Point pt(160, 150); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + R2_GLOBALS._player.setPosition(Common::Point(160, 150)); + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.enableControl(); + } +} + +void Scene2525::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._sound2.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene2525::signal() { + switch (_sceneMode) { + case 11: + g_globals->_sceneManager.changeScene(2000); + break; + case 2525: + _actor3.remove(); + R2_INVENTORY.setObjectScene(29, 2); + R2_GLOBALS._player.enableControl(); + break; + case 2526: + R2_GLOBALS.setFlag(74); + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 2530 - Ice Maze: Well + * + *--------------------------------------------------------------------------*/ +bool Scene2530::Actor2::startAction(CursorType action, Event &event) { + Scene2530 *scene = (Scene2530 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS._player._characterIndex == 2) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2530; + scene->setAction(&scene->_sequenceManager, scene, 2530, &R2_GLOBALS._player, &scene->_actor2, NULL); + } else { + SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + + return true; +} + +bool Scene2530::Actor3::startAction(CursorType action, Event &event) { + Scene2530 *scene = (Scene2530 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS.getFlag(73)) + SceneItem::display(2530, 35, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2532; + scene->setAction(&scene->_sequenceManager, scene, 2532, &R2_GLOBALS._player, &scene->_actor3, NULL); + } + } else { + if (R2_GLOBALS.getFlag(73)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2533; + scene->setAction(&scene->_sequenceManager, scene, 2533, &R2_GLOBALS._player, &scene->_actor3, NULL); + } else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2531; + scene->setAction(&scene->_sequenceManager, scene, 2531, &R2_GLOBALS._player, &scene->_actor3, NULL); + } + } + + return true; +} + +void Scene2530::Exit1::changeScene() { + Scene2530 *scene = (Scene2530 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 11; + + Common::Point pt(108, 200); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene2530::postInit(SceneObjectList *OwnerList) { + loadScene(2530); + SceneExt::postInit(); + + _exit1.setDetails(Rect(68, 155, 147, 168), EXITCURSOR_S, 2000); + _exit1.setDest(Common::Point(108, 160)); + + if (R2_INVENTORY.getObjectScene(33) == 2530) { + _actor2.postInit(); + _actor2.setup(2435, 1, 3); + _actor2.setPosition(Common::Point(299, 80)); + _actor2.fixPriority(80); + _actor2.setDetails(2530, 28, -1, -1, 1, (SceneItem *)NULL); + } + + _actor3.postInit(); + if (R2_GLOBALS.getFlag(73)) { + _actor3.setup(2531, 4, 2); + _actor3.setPosition(Common::Point(154, 130)); + } else { + _actor3.setup(2531, 4, 1); + _actor3.setPosition(Common::Point(173, 131)); + } + _actor3.setDetails(2530, 22, -1, -1, 1, (SceneItem *)NULL); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + + if (R2_GLOBALS._player._characterIndex == 1) { + R2_GLOBALS._player.setVisage(2008); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + } else { + R2_GLOBALS._player.setVisage(20); + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + } + R2_GLOBALS._player.setPosition(Common::Point(100, 200)); + + if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) { + _actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) { + _actor1.setup(20, 5, 1); + _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); + } else { + _actor1.setup(2008, 5, 1); + _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); + } + _actor1.setPosition(Common::Point(20, 130)); + R2_GLOBALS._walkRegions.enableRegion(1); + } + + _item2.setDetails(Rect(108, 90, 135, 205), 2530, 22, -1, -1, 1, NULL); + _item5.setDetails(Rect(115, 112, 206, 130), 2530, 25, -1, 27, 1, NULL); + _item3.setDetails(Rect(256, 64, 311, 85), 2530, 31, -1, 33, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 2530, 0, 1, -1, 1, NULL); + + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) { + R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2530; + Common::Point pt(108, 150); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + R2_GLOBALS._player.setPosition(Common::Point(105, 145)); + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.enableControl(); + } +} + +void Scene2530::signal() { + switch (_sceneMode) { + case 11: + g_globals->_sceneManager.changeScene(2000); + break; + case 2530: + R2_INVENTORY.setObjectScene(33, 2); + _actor2.remove(); + break; + case 2531: + // No break on purpose + case 2532: + R2_GLOBALS.setFlag(73); + R2_GLOBALS._player.enableControl(); + break; + case 2533: + R2_GLOBALS.clearFlag(73); + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 2535 - Ice Maze: Tannery + * + *--------------------------------------------------------------------------*/ + +bool Scene2535::Actor3::startAction(CursorType action, Event &event) { + Scene2535 *scene = (Scene2535 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS._player._characterIndex == 1) { + R2_GLOBALS._player.disableControl(); + if (R2_INVENTORY.getObjectScene(20) == 2535) { + scene->_sceneMode = 2536; + scene->setAction(&scene->_sequenceManager, scene, 2536, &R2_GLOBALS._player, &scene->_actor3, NULL); + } else { + scene->_sceneMode = 2537; + scene->setAction(&scene->_sequenceManager, scene, 2537, &R2_GLOBALS._player, &scene->_actor3, NULL); + } + } else { + SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + + return true; +} + +bool Scene2535::Actor4::startAction(CursorType action, Event &event) { + Scene2535 *scene = (Scene2535 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS._player._characterIndex == 2) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2535; + scene->setAction(&scene->_sequenceManager, scene, 2535, &R2_GLOBALS._player, &scene->_actor4, NULL); + } else { + SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + + return true; +} + +void Scene2535::Exit1::changeScene() { + Scene2535 *scene = (Scene2535 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 11; + Common::Point pt(210, 200); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene2535::postInit(SceneObjectList *OwnerList) { + loadScene(2535); + SceneExt::postInit(); + if (R2_GLOBALS._sceneManager._previousScene == -1) { + R2_GLOBALS.setFlag(73); + R2_INVENTORY.setObjectScene(20, 2535); + } + _exit1.setDetails(Rect(172, 155, 250, 167), EXITCURSOR_S, 2000); + _exit1.setDest(Common::Point(210, 160)); + + if (R2_INVENTORY.getObjectScene(32) == 2535) { + _actor4.postInit(); + _actor4.setup(2435, 1, 4); + _actor4.setPosition(Common::Point(47, 74)); + _actor4.fixPriority(74); + _actor4.setDetails(2535, 21, -1, -1, 1, (SceneItem *)NULL); + } + + if (R2_INVENTORY.getObjectScene(20) == 2535) { + _actor3.postInit(); + _actor3.setup(2535, 3, 1); + _actor3.setPosition(Common::Point(203, 131)); + _actor3.setDetails(3, 20, -1, -1, 1, (SceneItem *)NULL); + R2_GLOBALS._walkRegions.enableRegion(6); + } + + if ((R2_INVENTORY.getObjectScene(20) == 0) && (R2_GLOBALS.getFlag(73))) { + _actor3.postInit(); + _actor3.setup(2536, 1, 2); + _actor3.setPosition(Common::Point(164, 133)); + _actor3.setDetails(3, 20, -1, -1, 1, (SceneItem *)NULL); + } + + if (R2_GLOBALS.getFlag(73)) { + _actor2.postInit(); + _actor2.setup(2536, 1, 1); + _actor2.setPosition(Common::Point(160, 130)); + _actor2.fixPriority(122); + _actor2.setDetails(2535, 37, -1, -1, 1, (SceneItem *)NULL); + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + if (R2_GLOBALS._player._characterIndex == 1) { + R2_GLOBALS._player.setVisage(2008); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + } else { + R2_GLOBALS._player.setVisage(20); + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + } + R2_GLOBALS._player.setPosition(Common::Point(210, 200)); + + if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) { + _actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) { + _actor1.setup(20, 5, 1); + _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); + } else { + _actor1.setup(2008, 5, 1); + _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); + } + _actor1.setPosition(Common::Point(245, 115)); + R2_GLOBALS._walkRegions.enableRegion(2); + } + + _item2.setDetails(Rect(96, 3, 215, 33), 2535, 3, 6, 5, 1, NULL); + _item3.setDetails(Rect(4, 43, 40, 101), 2535, 6, 7, 8, 1, NULL); + _item4.setDetails(Rect(55, 13, 140, 89), 2535, 6, 7, 8, 1, NULL); + _item5.setDetails(Rect(144, 23, 216, 76), 2535, 6, 7, 8, 1, NULL); + _item6.setDetails(Rect(227, 8, 307, 99), 2535, 6, 7, 8, 1, NULL); + _item7.setDetails(Rect(116, 111, 201, 132), 2535, 18, 19, 20, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 2535, 0, 1, -1, 1, NULL); + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) { + R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2535; + Common::Point pt(210, 150); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + R2_GLOBALS._player.setPosition(Common::Point(210, 150)); + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.enableControl(); + } +} + +void Scene2535::signal() { + switch (_sceneMode) { + case 11: + g_globals->_sceneManager.changeScene(2000); + break; + case 2535: + R2_INVENTORY.setObjectScene(32, 2); + _actor4.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 2536: + R2_INVENTORY.setObjectScene(20, 0); + R2_GLOBALS._walkRegions.disableRegion(6); + if (!R2_GLOBALS.getFlag(73)) { + _actor3.remove(); + R2_GLOBALS._player.enableControl(); + } else { + _sceneMode = 20; + _actor3.show(); + _actor3.setup(2536, 1, 2); + _actor3.setDetails(3, 20, -1, -1, 3, (SceneItem *)NULL); + _actor3.setPosition(Common::Point(164, 150)); + _actor3.fixPriority(130); + _actor3._moveDiff.y = 1; + Common::Point pt(164, 133); + PlayerMover *mover = new PlayerMover(); + _actor3.addMover(mover, &pt, this); + } + break; + case 2537: + _actor3.remove(); + R2_INVENTORY.setObjectScene(20, 1); + R2_GLOBALS._player.enableControl(); + break; + case 20: + // No break on purpose + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 2600 - Ice Maze: Exit + * + *--------------------------------------------------------------------------*/ +Scene2600::Scene2600(): SceneExt() { + _rotation = NULL; +} + +void Scene2600::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + SYNC_POINTER(_rotation); +} + +void Scene2600::postInit(SceneObjectList *OwnerList) { + loadScene(2600); + R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); + R2_GLOBALS._sound1.fadeSound(214); + R2_GLOBALS._sound2.play(215); + _rotation = R2_GLOBALS._scenePalette.addRotation(176, 191, 1); + _rotation->setDelay(3); + _rotation->_countdown = 1; + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.disableControl(); + _sceneMode = 2600; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2600, &R2_GLOBALS._player, NULL); +} + +void Scene2600::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._sound2.fadeOut2(NULL); +// _rotation->remove(); + SceneExt::remove(); +} + +void Scene2600::signal() { + if (_sceneMode == 2600) + g_globals->_sceneManager.changeScene(3800); +} + +/*-------------------------------------------------------------------------- + * Scene 2700 - Forest Maze + * + *--------------------------------------------------------------------------*/ +Scene2700::Scene2700(): SceneExt() { + _field412 = _field414 = _field416 = 0; +} + +void Scene2700::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_field414); + s.syncAsSint16LE(_field416); +} + +void Scene2700::Action1::signal() { + Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor2.animate(ANIM_MODE_5, NULL); +} + +void Scene2700::Action2::signal() { + Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; + + setDelay(300 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor3.animate(ANIM_MODE_5, NULL); +} + +void Scene2700::Action3::signal() { + Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; + + setDelay(450 + R2_GLOBALS._randomSource.getRandomNumber(450)); + scene->_actor4.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2700::Action4::signal() { + Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; + + setDelay(300 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor5.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2700::Area1::process(Event &event) { + SceneArea::process(event); + if ((event.eventType == 1) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { + Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + scene->_field414 = 2703; + switch (scene->_field412) { + case 0: + // No break on purpose + case 6: + scene->_sceneMode = 2703; + scene->setAction(&scene->_sequenceManager, scene, 2703, &R2_GLOBALS._player, NULL); + break; + case 1: { + Common::Point pt(80, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 2: { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 3: { + Common::Point pt(140, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 4: { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 5: { + Common::Point pt(235, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + default: + break; + } + } +} + +void Scene2700::Area2::process(Event &event) { + SceneArea::process(event); + if ((event.eventType == 1) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { + Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + scene->_field414 = 2704; + switch (scene->_field412) { + case 0: { + Common::Point pt(140, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 1: { + Common::Point pt(80, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 2: { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 3: { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 4: { + Common::Point pt(235, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 5: + scene->_sceneMode = 2704; + scene->setAction(&scene->_sequenceManager, scene, 2704, &R2_GLOBALS._player, NULL); + break; + case 6: { + Common::Point pt(140, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + default: + break; + } + } +} + +void Scene2700::postInit(SceneObjectList *OwnerList) { + loadScene(2700); + SceneExt::postInit(); + R2_GLOBALS._sound1.stop(); + R2_GLOBALS._sound2.stop(); + + _area1.setDetails(Rect(135, 160, 185, 168), SHADECURSOR_DOWN); + _area2.setDetails(Rect(300, 90, 320, 135), EXITCURSOR_E); + _rect1.set(70, 122, 90, 132); + _rect2.set(150, 122, 160, 132); + _rect3.set(90, 142, 130, 157); + _rect4.set(175, 137, 200, 147); + _rect5.set(280, 127, 300, 137); + _rect6.set(240, 157, 265, 167); + + _actor2.postInit(); + _actor2.setup(2700, 1, 1); + _actor2.setPosition(Common::Point(140, 29)); + _actor2.setAction(&_action1); + + _actor3.postInit(); + _actor3.setup(2700, 2, 1); + _actor3.setPosition(Common::Point(213, 32)); + _actor3.setAction(&_action2); + + _actor4.postInit(); + _actor4.setup(2700, 3, 1); + _actor4.setPosition(Common::Point(17, 39)); + _actor4.setAction(&_action3); + + _actor5.postInit(); + _actor5.setup(2700, 5, 1); + _actor5.setPosition(Common::Point(17, 71)); + _actor5.setAction(&_action4); + + _item2.setDetails(Rect(52, 38, 68, 60), 2700, 4, -1, 6, 1, NULL); + _item3.setDetails(Rect(113, 22, 127, 33), 2700, 4, -1, 6, 1, NULL); + _item4.setDetails(Rect(161, 44, 170, 52), 2700, 4, -1, 6, 1, NULL); + _item5.setDetails(Rect(221, 19, 233, 31), 2700, 4, -1, 6, 1, NULL); + _item6.setDetails(Rect(235, 59, 250, 75), 2700, 4, -1, 6, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 2700, 4, -1, 6, 1, NULL); + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_nejSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(19); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player._moveDiff = Common::Point(2, 2); + R2_GLOBALS._player.disableControl(); + + if (R2_INVENTORY.getObjectScene(36) == 0) + R2_GLOBALS._sound1.changeSound(234); + + if (R2_GLOBALS._sceneManager._previousScene == 2750) { + _sceneMode = 2702; + _field412 = 5; + setAction(&_sequenceManager, this, 2702, &R2_GLOBALS._player, NULL); + } else { + _field412 = 0; + if (R2_GLOBALS._sceneManager._previousScene == 3900) { + _sceneMode = 2701; + setAction(&_sequenceManager, this, 2701, &R2_GLOBALS._player, NULL); + } else { + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.setPosition(Common::Point(164, 160)); + R2_GLOBALS._player.enableControl(); + } + } +} + +void Scene2700::signal() { + switch (_sceneMode) { + case 10: + switch (_field414) { + case 1: + switch (_field412) { + case 0: + case 2: + case 4: + case 6: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2705, &R2_GLOBALS._player, NULL); + break; + case 3: { + _sceneMode = _field414; + _field412 = 1; + Common::Point pt(80, 127); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 5: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); + break; + default: // includes case 1 + break; + } + break; + case 2: + switch (_field412) { + case 0: + case 1: + case 6: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL); + break; + case 3: + case 4: { + _sceneMode = _field414; + _field412 = 2; + Common::Point pt(155, 127); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 5: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); + break; + default: // includes case 2 + break; + } + break; + case 3: + switch (_field412) { + case 0: + case 1: + case 2: + case 4: + case 6: { + _sceneMode = _field414; + _field412 = 3; + Common::Point pt(115, 152); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 5: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); + break; + default: // includes case 3 + break; + } + break; + case 4: + switch (_field412) { + case 0: + case 1: + case 6: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL); + break; + case 2: + case 3: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2709, &R2_GLOBALS._player, NULL); + break; + case 4: + case 5: + _sceneMode = _field414; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2704, &R2_GLOBALS._player, NULL); + break; + default: + break; + } + break; + case 5: + switch (_field412) { + case 0: + case 1: + case 6: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL); + break; + case 2: + case 3: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2709, &R2_GLOBALS._player, NULL); + break; + case 4: { + _sceneMode = _field414; + _field412 = 5; + Common::Point pt(285, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + default: // includes case 5 + break; + } + break; + case 6: + switch (_field412) { + case 0: + case 3: { + _sceneMode = _field414; + _field412 = 6; + Common::Point pt(250, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 1: + case 2: + case 4: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2707, &R2_GLOBALS._player, NULL); + break; + case 5: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); + break; + default: + break; + } + break; + case 2703: + switch (_field412) { + case 0: + case 3: + case 6: + _sceneMode = _field414; + setAction(&_sequenceManager, this, 2703, &R2_GLOBALS._player, NULL); + break; + case 1: + case 2: + case 4: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2707, &R2_GLOBALS._player, NULL); + break; + case 5: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); + break; + default: + break; + } + break; + case 2704: + switch (_field412) { + case 0: + case 1: + case 6: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL); + break; + case 2: + case 3: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2709, &R2_GLOBALS._player, NULL); + break; + case 4: + case 5: + _sceneMode = _field414; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2704, &R2_GLOBALS._player, NULL); + break; + default: + break; + } + break; + case 2710: + switch (_field412) { + case 0: + case 1: + case 3: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2707, &R2_GLOBALS._player, NULL); + break; + case 2: + case 5: { + _sceneMode = _field414; + Common::Point pt(164, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 4: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); + break; + default: + break; + } + break; + default: + break; + } + break; + case 11: + R2_INVENTORY.setObjectScene(36, 0); + R2_GLOBALS._player.disableControl(); + _field412 = 0; + _sceneMode = 2700; + setAction(&_sequenceManager, this, 2700, &_actor1, NULL); + break; + case 12: + R2_GLOBALS._sound1.play(234); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _sceneMode = 2711; + _stripManager.start(_field416, this); + break; + case 13: + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _sceneMode = 2712; + _stripManager.start(_field416, this); + break; + case 14: + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _sceneMode = 2713; + _stripManager.start(_field416, this); + break; + case 15: + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _sceneMode = 11; + _stripManager.start(_field416, this); + break; + case 2700: + _actor1.remove(); + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + case 2703: + g_globals->_sceneManager.changeScene(3900); + break; + case 2704: + g_globals->_sceneManager.changeScene(2750); + break; + case 2710: + _field416 = 1200; + _sceneMode = 12; + _actor1.postInit(); + setAction(&_sequenceManager, this, 2710, &R2_GLOBALS._player, &_actor1, NULL); + break; + case 2711: + R2_GLOBALS._player.disableControl(); + _field416 = 1201; + _sceneMode = 13; + setAction(&_sequenceManager, this, 2711, &R2_GLOBALS._player, &_actor1, NULL); + break; + case 2712: + R2_GLOBALS._player.disableControl(); + _field416 = 1202; + _sceneMode = 14; + setAction(&_sequenceManager, this, 2712, &R2_GLOBALS._player, &_actor1, NULL); + break; + case 2713: + R2_GLOBALS._player.disableControl(); + _field416 = 1203; + _sceneMode = 14; + setAction(&_sequenceManager, this, 2713, &R2_GLOBALS._player, &_actor1, NULL); + break; + default: + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + } +} +void Scene2700::process(Event &event) { + if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN)) { + if (R2_GLOBALS._events.getCursor() == R2_FLUTE) { + if (R2_GLOBALS._player._bounds.contains(event.mousePos)) { + _sceneMode = 10; + _field414 = 2710; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + switch (_field412) { + case 0: { + _sceneMode = 2710; + Common::Point pt(164, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 1: { + Common::Point pt(80, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 2: { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 3: { + Common::Point pt(140, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 4: { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 5: { + Common::Point pt(235, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 6: { + Common::Point pt(205, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + default: + break; + } + event.handled = true; + } else { + SceneItem::display(2700, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + } else if (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN) { + if (_rect1.contains(event.mousePos)) { + if (!_rect1.contains(R2_GLOBALS._player._position)) { + event.handled = true; + _sceneMode = 10; + _field414 = 1; + } + } else if (_rect2.contains(event.mousePos)) { + if (!_rect2.contains(R2_GLOBALS._player._position)) { + event.handled = true; + _sceneMode = 10; + _field414 = 2; + } + } else if (_rect3.contains(event.mousePos)) { + if (!_rect3.contains(R2_GLOBALS._player._position)) { + event.handled = true; + _sceneMode = 10; + _field414 = 3; + } + } else if (_rect4.contains(event.mousePos)) { + if (!_rect4.contains(R2_GLOBALS._player._position)) { + event.handled = true; + _sceneMode = 10; + _field414 = 4; + } + } else if (_rect5.contains(event.mousePos)) { + if (!_rect5.contains(R2_GLOBALS._player._position)) { + event.handled = true; + _sceneMode = 10; + _field414 = 5; + } + } else if (_rect6.contains(event.mousePos)) { + if (!_rect6.contains(R2_GLOBALS._player._position)) { + event.handled = true; + _sceneMode = 10; + _field414 = 6; + } + } else { + event.handled = true; + R2_GLOBALS._player.updateAngle(Common::Point(event.mousePos.x, event.mousePos.y)); + } + if (_sceneMode == 10) { + R2_GLOBALS._player.disableControl(); + switch (_field412) { + case 0: + if (_field414 >= 6) { + Common::Point pt(205, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + Common::Point pt(140, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 1: { + Common::Point pt(80, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 2: { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 3: + if (_field414 == 1) { + Common::Point pt(80, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else if (_field414 == 6) { + Common::Point pt(140, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 4: + if (_field414 == 5) { + Common::Point pt(235, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 5: { + Common::Point pt(235, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 6: { + Common::Point pt(140, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + default: + break; + } + } + } + } + Scene::process(event); +} + +/*-------------------------------------------------------------------------- + * Scene 2750 - Forest Maze + * + *--------------------------------------------------------------------------*/ +Scene2750::Scene2750(): SceneExt() { + _field412 = _field414 = _field416 = 0; +} + +void Scene2750::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_field414); + s.syncAsSint16LE(_field416); +} + +void Scene2750::Action1::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex) { + case 1: + setDelay(60 + R2_GLOBALS._randomSource.getRandomNumber(240)); + _actionIndex = 2; + scene->_actor5.show(); + scene->_actor5.animate(ANIM_MODE_8, 1, NULL); + break; + case 2: + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(600)); + _actionIndex = 0; + scene->_actor5.show(); + scene->_actor3.animate(ANIM_MODE_2, NULL); + break; + default: + setDelay(30); + _actionIndex = 1; + scene->_actor3.animate(ANIM_MODE_6, NULL); + scene->_actor4.animate(ANIM_MODE_8, 1, NULL); + break; + } +} + +void Scene2750::Action2::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor6.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Action3::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + if (scene->_actor7._position.x <= 320) { + setDelay(1800 + R2_GLOBALS._randomSource.getRandomNumber(600)); + } else { + setDelay(60); + scene->_actor7.setPosition(Common::Point(-10, 25)); + Common::Point pt(330, 45); + NpcMover *mover = new NpcMover(); + scene->_actor7.addMover(mover, &pt, NULL); + } +} + +void Scene2750::Action4::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor8.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Action5::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor9.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Action6::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor10.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Action7::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor11.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Area1::process(Event &event) { + SceneArea::process(event); + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + scene->_field414 = 2752; + switch (scene->_field412) { + case 1: { + scene->_sceneMode = 2752; + scene->setAction(&scene->_sequenceManager, scene, 2752, &R2_GLOBALS._player, NULL); + break; + } + case 2: { + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 3: { + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + default: + break; + } + } +} + +void Scene2750::Area2::process(Event &event) { + SceneArea::process(event); + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + scene->_field414 = 2753; + switch (scene->_field412) { + case 1: { + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 2: { + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 3: { + scene->_sceneMode = 2753; + scene->setAction(&scene->_sequenceManager, scene, 2753, &R2_GLOBALS._player, NULL); + break; + } + default: + break; + } + } +} + +void Scene2750::postInit(SceneObjectList *OwnerList) { + loadScene(2750); + R2_GLOBALS._sound2.stop(); + SceneExt::postInit(); + _area1.setDetails(Rect(0, 90, 20, 135), EXITCURSOR_W); + _area2.setDetails(Rect(300, 90, 320, 135), EXITCURSOR_E); + + _rect1.set(30, 127, 155, 147); + _rect2.set(130, 142, 210, 167); + _rect3.set(-1, 137, 290, 147); + + if (R2_INVENTORY.getObjectScene(36) == 0) { + R2_GLOBALS._sound1.changeSound(235); + _actor2.postInit(); + _actor2.setup(2751, 1, 1); + _actor2.setPosition(Common::Point(104, 158)); + _actor2.animate(ANIM_MODE_2, NULL); + } + + _actor3.postInit(); + _actor3.setup(2750, 1, 1); + _actor3.setPosition(Common::Point(188, 34)); + _actor3.animate(ANIM_MODE_2, NULL); + _actor3._numFrames = 16; + + _actor4.postInit(); + _actor4.setup(2700, 4, 1); + _actor4.setPosition(Common::Point(188, 37)); + _actor4.fixPriority(26); + + _actor5.postInit(); + _actor5.setup(2750, 2, 1); + _actor5.setPosition(Common::Point(188, 34)); + _actor5.hide(); + + _actor3.setAction(&_action1); + + _actor6.postInit(); + _actor6.setup(2750, 3, 1); + _actor6.setPosition(Common::Point(9, 167)); + _actor6.fixPriority(252); + _actor6.setAction(&_action2); + + _actor7.postInit(); + _actor7.setup(2750, 4, 1); + _actor7.setPosition(Common::Point(-10, 25)); + _actor7.animate(ANIM_MODE_1, NULL); + _actor7.setStrip2(4); + _actor7._moveRate = 20; + _actor7.setAction(&_action3); + + _actor8.postInit(); + _actor8.fixPriority(26); + _actor8.setup(2750, 5, 1); + _actor8.setPosition(Common::Point(258, 33)); + _actor8.setAction(&_action4); + + _actor9.postInit(); + _actor9.fixPriority(26); + _actor9.setup(2750, 6, 1); + _actor9.setPosition(Common::Point(61, 38)); + _actor9.setAction(&_action5); + + _actor10.postInit(); + _actor10.fixPriority(26); + _actor10.setup(2750, 7, 1); + _actor10.setPosition(Common::Point(69, 37)); + _actor10.setAction(&_action6); + + _actor11.postInit(); + _actor11.fixPriority(26); + _actor11.setup(2750, 8, 1); + _actor11.setPosition(Common::Point(80, 35)); + _actor11.setAction(&_action7); + + _item2.setDetails(Rect(29, 50, 35, 56), 2750, 3, -1, 5, 1, NULL); + _item3.setDetails(Rect(47, 36, 54, 42), 2750, 3, -1, 5, 1, NULL); + _item4.setDetails(Rect(193, 21, 206, 34), 2750, 3, -1, 5, 1, NULL); + _item5.setDetails(Rect(301, 18, 315, 32), 2750, 3, -1, 5, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 2700, 0, -1, 2, 1, NULL); + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_nejSpeaker); + + if (R2_INVENTORY.getObjectScene(36) == 0) { + _actor1.postInit(); + _actor1.setup(2752, 5, 1); + _actor1.animate(ANIM_MODE_NONE, NULL); + _actor1.setPosition(Common::Point(101, 148)); + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(19); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player._moveDiff = Common::Point(2, 2); + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS._sceneManager._previousScene == 2700) { + if (R2_INVENTORY.getObjectScene(36) == 0) { + R2_GLOBALS._player.setVisage(2752); + R2_GLOBALS._player.setStrip(6); + R2_GLOBALS._player.animate(ANIM_MODE_NONE, NULL); + R2_GLOBALS._player.setPosition(Common::Point(81, 165)); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _field416 = 1204; + _sceneMode = 11; + _stripManager.start(_field416, this); + } else { + _sceneMode = 2750; + _field412 = 1; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2750, &R2_GLOBALS._player, NULL); + } + } else if (R2_GLOBALS._sceneManager._previousScene == 2800) { + _sceneMode = 2751; + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2751, &R2_GLOBALS._player, NULL); + } else { + _field412 = 1; + R2_GLOBALS._player.setPosition(Common::Point(90, 137)); + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.enableControl(); + } +} +void Scene2750::signal() { + switch (_sceneMode) { + case 10: + switch (_field414) { + case 1: + switch (_field412) { + case 2: { + _sceneMode = _field414; + _field412 = 1; + Common::Point pt(90, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: { + _field412 = 2; + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } + break; + case 2: { + _sceneMode = _field414; + _field412 = 2; + Common::Point pt(170, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: + switch (_field412) { + case 1: { + _field412 = 2; + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: { + _sceneMode = _field414; + _field412 = 3; + Common::Point pt(270, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } + break; + case 2752: + switch (_field412) { + case 1: + _sceneMode = _field414; + setAction(&_sequenceManager, this, 2752, &R2_GLOBALS._player, NULL); + break; + case 2: { + _field412 = 1; + Common::Point pt(20, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: { + _field412 = 2; + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } + break; + case 2753: + switch (_field412) { + case 1: { + _field412 = 2; + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: { + _field412 = 3; + Common::Point pt(300, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: + _sceneMode = _field414; + setAction(&_sequenceManager, this, 2753, &R2_GLOBALS._player, NULL); + break; + default: + break; + } + break; + default: + break; + } + break; + case 11: + // No break on purpose + case 2753: + g_globals->_sceneManager.changeScene(2800); + break; + case 2752: + g_globals->_sceneManager.changeScene(2700); + break; + default: + R2_GLOBALS._player.enableControl(R2_NEGATOR_GUN); + break; + } +} + +void Scene2750::process(Event &event) { + if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN)) { + if (_rect1.contains(event.mousePos)) { + if (!_rect1.contains(R2_GLOBALS._player._position)) { + event.handled = true; + _sceneMode = 10; + _field414 = 1; + } + } else if (_rect2.contains(event.mousePos)) { + if (!_rect2.contains(R2_GLOBALS._player._position)) { + event.handled = true; + _sceneMode = 10; + _field414 = 2; + } + } else if (_rect3.contains(event.mousePos)) { + if (!_rect3.contains(R2_GLOBALS._player._position)) { + event.handled = true; + _sceneMode = 10; + _field414 = 3; + } + } else { + event.handled = true; + R2_GLOBALS._player.updateAngle(Common::Point(event.mousePos.x, event.mousePos.y)); + } + + if (_sceneMode == 10) { + R2_GLOBALS._player.disableControl(); + switch (_field412) { + case 1: { + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: + if (_field414 == 1) { + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: { + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } + } + } + Scene::process(event); +} + +/*-------------------------------------------------------------------------- + * Scene 2800 - Exiting forest + * + *--------------------------------------------------------------------------*/ +Scene2800::Scene2800(): SceneExt() { + _field412 = 0; +} + +void Scene2800::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); +} + +bool Scene2800::Item2::startAction(CursorType action, Event &event) { + Scene2800 *scene = (Scene2800 *)R2_GLOBALS._sceneManager._scene; + + if ((action == CURSOR_USE) && (R2_GLOBALS.getFlag(47))) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2805; + scene->setAction(&scene->_sequenceManager, scene, 2805, &R2_GLOBALS._player, NULL); + return true; + } else + return SceneHotspot::startAction(action, event); +} + +bool Scene2800::Actor1::startAction(CursorType action, Event &event) { + Scene2800 *scene = (Scene2800 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_TALK) { + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + R2_GLOBALS.setFlag(47); + scene->_field412 = 1205; + scene->_sceneMode = 2803; + scene->_stripManager.start(scene->_field412, scene); + return true; + } else if (action == R2_SONIC_STUNNER) { + R2_GLOBALS._events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS.setFlag(47); + scene->_sceneMode = 10; + scene->setAction(&scene->_sequenceManager, scene, 2802, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor1, NULL); + return true; + } else + return SceneActor::startAction(action, event); +} + +void Scene2800::Action1::signal() { + Scene2800 *scene = (Scene2800 *)R2_GLOBALS._sceneManager._scene; + + if (R2_GLOBALS._player._position.x <= 320) { + setDelay(120); + Common::Point pt(330, 25); + NpcMover *mover = new NpcMover(); + scene->_object1.addMover(mover, &pt, NULL); + } else { + setDelay(1800 + R2_GLOBALS._randomSource.getRandomNumber(600)); + scene->_object1.setPosition(Common::Point(-10, 45)); + } +} + +void Scene2800::Action2::signal() { + Scene2800 *scene = (Scene2800 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + setDelay(240); + R2_GLOBALS._sound1.changeSound(240); + R2_GLOBALS._sound2.stop(); + break; + case 1: + _object2.postInit(); + _object2.setVisage(2800); + _object2.setStrip(1); + _object2._numFrames = 8; + _object2._moveRate = 8; + _object2.changeZoom(100); + _object2.setPosition(Common::Point(1, 1)); + _object2.show(); + _object2.animate(ANIM_MODE_5, this); + break; + case 2: + R2_GLOBALS._sound2.play(130); + _object2.setVisage(2800); + _object2.setStrip(7); + + _object3.postInit(); + _object3.setVisage(2800); + _object3.setStrip(3); + _object3._numFrames = 8; + _object3._moveRate = 8; + _object3.changeZoom(100); + _object3.setPosition(Common::Point(300, 104)); + _object3.show(); + _object3.animate(ANIM_MODE_5, this); + break; + case 3: + R2_GLOBALS._sound1.play(241); + _object4.postInit(); + _object4.setVisage(2800); + _object4.setStrip(2); + _object4._numFrames = 4; + _object4._moveRate = 4; + _object4.changeZoom(100); + _object4.setPosition(Common::Point(300, 104)); + _object4.fixPriority(105); + _object4.show(); + _object4.animate(ANIM_MODE_5, this); + break; + case 4: + setDelay(18); + _object4.setStrip(4); + scene->_actor1.setVisage(2800); + scene->_actor1.setStrip(5); + scene->_actor1.setFrame(1); + scene->_actor1._numFrames = 5; + scene->_actor1._moveRate = 5; + scene->_actor1.setPosition(Common::Point(300, 104)); + scene->_actor1.fixPriority(110); + scene->_actor1.changeZoom(100); + scene->_actor1.show(); + break; + case 5: + scene->_actor1.animate(ANIM_MODE_5, this); + break; + case 6: { + scene->_actor1.changeZoom(-1); + scene->_actor1.setVisage(3107); + scene->_actor1.animate(ANIM_MODE_1, NULL); + scene->_actor1.setStrip(3); + scene->_actor1.setPosition(Common::Point(297, 140)); + scene->_actor1._numFrames = 10; + scene->_actor1._moveRate = 10; + scene->_actor1._moveDiff = Common::Point(3, 2); + + Common::Point pt(297, 160); + NpcMover *mover = new NpcMover(); + scene->_actor1.addMover(mover, &pt, this); + break; + } + case 7: { + scene->_actor1.changeZoom(75); + scene->_actor1.updateAngle(R2_GLOBALS._player._position); + + Common::Point pt(105, 82); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 8: { + R2_GLOBALS._player._numFrames = 8; + R2_GLOBALS._player._moveRate = 8; + R2_GLOBALS._player.animate(ANIM_MODE_2, NULL); + R2_GLOBALS._player.setObjectWrapper(NULL); + R2_GLOBALS._player.setStrip(2); + R2_GLOBALS._player.changeZoom(-1); + + Common::Point pt(79, 100); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 9: { + R2_GLOBALS._player._numFrames = 10; + R2_GLOBALS._player._moveRate = 10; + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + + Common::Point pt(100, 64); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 10: { + R2_GLOBALS._player.fixPriority(124); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + + Common::Point pt(160, 124); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 11: { + R2_GLOBALS._player.fixPriority(-1); + + Common::Point pt(160, 160); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 12: { + Common::Point pt(270, 160); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 13: + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + scene->_field412 = 1207; + scene->_stripManager.start(scene->_field412, this); + break; + case 14: { + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.fixPriority(110); + + Common::Point pt(288, 140); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 15: + setDelay(18); + scene->_actor1.updateAngle(R2_GLOBALS._player._position); + R2_GLOBALS._player.setVisage(2800); + R2_GLOBALS._player.setStrip(6); + R2_GLOBALS._player.setFrame(1); + R2_GLOBALS._player.changeZoom(100); + R2_GLOBALS._player.setPosition(Common::Point(300, 104)); + R2_GLOBALS._player._numFrames = 5; + R2_GLOBALS._player._moveRate = 5; + break; + case 16: + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 17: + setDelay(6); + _object4.setStrip(2); + _object4.setFrame(11); + R2_GLOBALS._player.hide(); + // No break on purpose + case 18: + R2_GLOBALS._sound1.play(241); + _object4.animate(ANIM_MODE_6, this); + break; + case 19: + _object4.remove(); + _object3.animate(ANIM_MODE_6, this); + break; + case 20: + setDelay(6); + _object3.remove(); + _object2.setStrip(1); + _object2.setFrame(19); + break; + case 21: + setDelay(150); + R2_GLOBALS._sound1.play(269); + R2_GLOBALS._sound2.stop(); + break; + case 22: + scene->_sceneMode = 12; + _object2.animate(ANIM_MODE_6, scene); + break; + default: + break; + } +} + +void Scene2800::postInit(SceneObjectList *OwnerList) { + loadScene(2800); + setZoomPercents(100, 50, 124, 75); + R2_GLOBALS._sound1.stop(); + R2_GLOBALS._sound2.stop(); + SceneExt::postInit(); + + _object1.postInit(); + _object1.setup(2750, 4, 1); + _object1.setPosition(Common::Point(-10, 25)); + _object1.animate(ANIM_MODE_1, NULL); + _object1.setStrip2(4); + _object1._moveRate = 20; + _object1.setAction(&_action1); + + _actor3.postInit(); + _actor3.setup(2802, 1, 1); + _actor3.setPosition(Common::Point(116, 80)); + _actor3.fixPriority(111); + _actor3.animate(ANIM_MODE_2, NULL); + _actor3._numFrames = 6; + + if (!R2_GLOBALS.getFlag(47)) { + _actor1.postInit(); + _actor1.setVisage(3105); + _actor1.setStrip(3); + _actor1.setFrame(1); + _actor1.setZoom(50); + _actor1._moveDiff = Common::Point(2, 1); + _actor1.setPosition(Common::Point(122, 82)); + _actor1.animate(ANIM_MODE_NONE, NULL); + _actor1.setDetails(2800, -1, -1, -1, 1, (SceneItem *)NULL); + } + + _item1.setDetails(Rect(0, 0, 320, 200), 2800, -1, -1, -1, 1, NULL); + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_nejSpeaker); + _stripManager.addSpeaker(&_guardSpeaker); + + if (R2_INVENTORY.getObjectScene(36) == 0) { + R2_GLOBALS._sound1.fadeSound(237); + if (R2_GLOBALS.getFlag(47)) { + _item2.setDetails(Rect(76, 45, 155, 90), 2800, 3, -1, -1, 2, NULL); + } else { + _actor2.postInit(); + _actor2.setup(2752, 5, 1); + _actor2.animate(ANIM_MODE_NONE, NULL); + _actor2.changeZoom(100); + _actor2._moveDiff = Common::Point(2, 1); + _actor2.setPosition(Common::Point(101, 148)); + } + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(19); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.changeZoom(100); + R2_GLOBALS._player._moveDiff = Common::Point(2, 2); + R2_GLOBALS._player.disableControl(); + + if (R2_INVENTORY.getObjectScene(36) == 0) { + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2800, &R2_GLOBALS._player, NULL); + } else if (R2_GLOBALS.getFlag(47)) { + R2_GLOBALS._player.setVisage(3110); + R2_GLOBALS._player.changeZoom(-1); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.setPosition(Common::Point(160, 124)); + R2_GLOBALS._player.enableControl(); + } else { + _sceneMode = 2801; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2801, &R2_GLOBALS._player, &_actor2, &_actor1, NULL); + } +} + +void Scene2800::signal() { + switch (_sceneMode) { + case 10: + R2_GLOBALS._sound1.play(238); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _field412 = 1206; + _sceneMode = 2804; + _stripManager.start(_field412, this); + break; + case 11: + _actor2.remove(); + _object1.setAction(NULL); + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + _item2.setDetails(Rect(76, 45, 155, 90), 2800, 3, -1, -1, 2, NULL); + break; + case 12: + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._sound2.fadeOut2(NULL); + g_globals->_sceneManager.changeScene(1000); + break; + case 2800: + g_globals->_sceneManager.changeScene(2750); + break; + case 2801: + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + R2_GLOBALS._player._canWalk = false; + break; + case 2803: + R2_GLOBALS._player.disableControl(); + _sceneMode = 10; + setAction(&_sequenceManager, this, 2803, &R2_GLOBALS._player, &_actor2, &_actor1, NULL); + break; + case 2804: + R2_GLOBALS._player.disableControl(); + _sceneMode = 11; + setAction(&_sequenceManager, this, 2804, &R2_GLOBALS._player, &_actor2, NULL); + break; + case 2805: + _object1.remove(); + setAction(&_action2); + break; + default: + break; + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.h b/engines/tsage/ringworld2/ringworld2_scenes2.h index 82898a45dd..281d1da366 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.h +++ b/engines/tsage/ringworld2/ringworld2_scenes2.h @@ -106,8 +106,8 @@ class Scene2350 : public SceneExt { }; public: - SpeakerQuinn2350 _quinnSpeaker; - SpeakerPharisha2350 _pharishaSpeaker; + SpeakerQuinn _quinnSpeaker; + SpeakerPharisha _pharishaSpeaker; NamedHotspot _item1; SceneActor _actor1; Actor2 _actor2; @@ -368,9 +368,9 @@ class Scene2500 : public SceneExt { virtual void changeScene(); }; public: - SpeakerQuinn2500 _quinnSpeaker; - SpeakerSeeker2500 _seekerSpeaker; - SpeakerMiranda2500 _mirandaSpeaker; + SpeakerQuinn _quinnSpeaker; + SpeakerSeeker _seekerSpeaker; + SpeakerMiranda _mirandaSpeaker; SpeakerWebbster2500 _webbsterSpeaker; NamedHotspot _item1; SceneActor _actor1; @@ -383,6 +383,289 @@ public: virtual void signal(); }; +class Scene2525 : public SceneExt { + class Item5 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor3 : public SceneActor { + public: + bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + Item5 _item5; + SceneActor _actor1; + SceneActor _actor2; + Actor3 _actor3; + Exit1 _exit1; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + +class Scene2530 : public SceneExt { + class Actor2 : public SceneActor { + public: + bool startAction(CursorType action, Event &event); + }; + class Actor3 : public SceneActor { + public: + bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + SceneActor _actor1; + Actor2 _actor2; + Actor3 _actor3; + Exit1 _exit1; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene2535 : public SceneExt { + class Actor3 : public SceneActor { + public: + bool startAction(CursorType action, Event &event); + }; + class Actor4 : public SceneActor { + public: + bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + NamedHotspot _item6; + NamedHotspot _item7; + SceneActor _actor1; + SceneActor _actor2; + Actor3 _actor3; + Actor4 _actor4; + Exit1 _exit1; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene2600 : public SceneExt { +public: + SequenceManager _sequenceManager; + PaletteRotation *_rotation; + + Scene2600(); + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + +class Scene2700 : public SceneExt { + class Action1: public Action { + public: + void signal(); + }; + class Action2: public Action { + public: + void signal(); + }; + class Action3: public Action { + public: + void signal(); + }; + class Action4: public Action { + public: + void signal(); + }; + + class Area1: public SceneArea { + public: + void process(Event &event); + }; + class Area2: public SceneArea { + public: + void process(Event &event); + }; +public: + SpeakerQuinn2700 _quinnSpeaker; + SpeakerNej2700 _nejSpeaker; + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + NamedHotspot _item6; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + Action1 _action1; + Action2 _action2; + Action3 _action3; + Action4 _action4; + Area1 _area1; + Area2 _area2; + Rect _rect1, _rect2, _rect3, _rect4, _rect5, _rect6; + SequenceManager _sequenceManager; + int _field412, _field414, _field416; + + Scene2700(); + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); +}; + +class Scene2750 : public SceneExt { + class Action1: public Action { + public: + void signal(); + }; + class Action2: public Action { + public: + void signal(); + }; + class Action3: public Action { + public: + void signal(); + }; + class Action4: public Action { + public: + void signal(); + }; + class Action5: public Action { + public: + void signal(); + }; + class Action6: public Action { + public: + void signal(); + }; + class Action7: public Action { + public: + void signal(); + }; + + class Area1: public SceneArea { + public: + void process(Event &event); + }; + class Area2: public SceneArea { + public: + void process(Event &event); + }; +public: + SpeakerQuinn2750 _quinnSpeaker; + SpeakerNej2750 _nejSpeaker; + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SceneActor _actor8; + SceneActor _actor9; + SceneActor _actor10; + SceneActor _actor11; + Action1 _action1; + Action2 _action2; + Action3 _action3; + Action4 _action4; + Action5 _action5; + Action6 _action6; + Action7 _action7; + Area1 _area1; + Area2 _area2; + Rect _rect1, _rect2, _rect3; + SequenceManager _sequenceManager; + int _field412, _field414, _field416; + + Scene2750(); + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); +}; + +class Scene2800 : public SceneExt { + class Item2 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor1 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + + class Action1: public Action { + public: + void signal(); + }; + class Action2: public Action { + SceneObject _object2; + SceneObject _object3; + SceneObject _object4; + public: + void signal(); + }; +public: + SpeakerQuinn2800 _quinnSpeaker; + SpeakerNej2800 _nejSpeaker; + SpeakerGuard2800 _guardSpeaker; + NamedHotspot _item1; + Item2 _item2; + Actor1 _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneObject _object1; + Action1 _action1; + Action2 _action2; + SequenceManager _sequenceManager; + int _field412; + + Scene2800(); + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp new file mode 100644 index 0000000000..3dd566c900 --- /dev/null +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -0,0 +1,5603 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/staticres.h" +#include "tsage/ringworld2/ringworld2_scenes3.h" + +namespace TsAGE { + +namespace Ringworld2 { + +/*-------------------------------------------------------------------------- + * Scene 3100 - + * + *--------------------------------------------------------------------------*/ +Scene3100::Scene3100() { + _field412 = 0; +} + +void Scene3100::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); +} + +bool Scene3100::Guard::startAction(CursorType action, Event &event) { + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + Scene3100 *scene = (Scene3100 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + scene->_stripManager.start(606, scene); + return true; +} + +void Scene3100::postInit(SceneObjectList *OwnerList) { + if (R2_GLOBALS._sceneManager._previousScene == 1000) { + if (R2_GLOBALS._player._oldCharacterScene[1] == 3100) { + loadScene(3101); + R2_GLOBALS._uiElements._active = false; + } else { + loadScene(3100); + g_globals->gfxManager()._bounds.moveTo(Common::Point(160, 0)); + } + } else { + loadScene(3100); + } + // Original was doing it twice in a row. Skipped. + + if (R2_GLOBALS._sceneManager._previousScene == 3255) + R2_GLOBALS._uiElements._active = false; + + SceneExt::postInit(); + _stripManager.addSpeaker(&_guardSpeaker); + + if (R2_GLOBALS._sceneManager._previousScene == -1) + R2_GLOBALS._sceneManager._previousScene = 1000; + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player._characterIndex = R2_QUINN; + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _item2.setDetails(Rect(212, 97, 320, 114), 3100, 3, -1, -1, 1, NULL); + _item1.setDetails(Rect(0, 0, 480, 200), 3100, 0, -1, -1, 1, NULL); + _field412 = 0; + + if (R2_GLOBALS._sceneManager._previousScene == 1000) { + if (R2_GLOBALS._player._oldCharacterScene[1] == 3100) { + _sceneMode = 3102; + _actor3.postInit(); + _actor4.postInit(); + _actor5.postInit(); + R2_GLOBALS._sound1.play(274); + _sound1.fadeSound(130); + setAction(&_sequenceManager, this, 3102, &_actor1, &R2_GLOBALS._player, &_actor3, &_actor4, &_actor5, NULL); + } else { + _guard.postInit(); + _guard.setup(3110, 5, 1); + _guard.changeZoom(50); + _guard.setPosition(Common::Point(10, 149)); + _guard.setDetails(3100, 6, -1, -1, 2, (SceneItem *)NULL); + + _actor4.postInit(); + _actor4.setup(3103, 1, 1); + _actor4.setPosition(Common::Point(278, 113)); + _actor4.setDetails(3100, 9, -1, -1, 2, (SceneItem *)NULL); + _actor4.animate(ANIM_MODE_2, NULL); + + _field412 = 1; + _actor1.setDetails(3100, 3, -1, -1, 2, (SceneItem *)NULL); + R2_GLOBALS._sound1.play(243); + R2_GLOBALS._sound2.play(130); + _sceneMode = 3100; + + setAction(&_sequenceManager, this, 3100, &R2_GLOBALS._player, &_actor1, NULL); + } + } else if (R2_GLOBALS._sceneManager._previousScene == 3255) { + _sceneMode = 3101; + _actor2.postInit(); + _actor3.postInit(); + _field412 = 1; + + setAction(&_sequenceManager, this, 3101, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); + } else { + _guard.postInit(); + _guard.setup(3110, 5, 1); + _guard.changeZoom(50); + _guard.setPosition(Common::Point(10, 149)); + _guard.setDetails(3100, 6, -1, -1, 2, (SceneItem *)NULL); + + _actor4.postInit(); + _actor4.setup(3103, 1, 1); + _actor4.setPosition(Common::Point(278, 113)); + _actor4.setDetails(3100, 9, -1, -1, 2, (SceneItem *)NULL); + _actor4.animate(ANIM_MODE_2, NULL); + + _actor1.postInit(); + _actor1.setup(3104, 4, 1); + _actor1.setPosition(Common::Point(143, 104)); + _actor1.setDetails(3100, 3, -1, -1, 2, (SceneItem *)NULL); + + R2_GLOBALS._player.setup(3110, 3, 1); + R2_GLOBALS._player.changeZoom(50); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(160, 150)); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + + R2_GLOBALS._sound1.play(243); + } + + R2_GLOBALS._player._oldCharacterScene[1] = 3100; +} + +void Scene3100::remove() { + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._sound2.fadeOut2(NULL); + _sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene3100::signal() { + switch (_sceneMode) { + case 10: + R2_GLOBALS._player.enableControl(CURSOR_TALK); + break; + case 3100: + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + case 3101: + R2_GLOBALS._sceneManager.changeScene(1000); + break; + case 3102: + R2_GLOBALS._player._oldCharacterScene[1] = 1000; + R2_GLOBALS._sceneManager.changeScene(1000); + break; + default: + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + } +} + +void Scene3100::dispatch() { + if ((_sceneMode == 3100) && (_field412 != 0) && (R2_GLOBALS._player._position.y == 104)) { + _field412 = 0; + R2_GLOBALS._sound2.fadeOut2(NULL); + } + + if ((_sceneMode == 3101) && (_field412 != 0) && (R2_GLOBALS._player._position.y < 104)) { + _field412 = 0; + _sound1.fadeSound(130); + } + + Scene::dispatch(); +} + +/*-------------------------------------------------------------------------- + * Scene 3125 - Ghouls dormitory + * + *--------------------------------------------------------------------------*/ +Scene3125::Scene3125() { + _field412 = 0; +} + +void Scene3125::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); +} + +bool Scene3125::Item1::startAction(CursorType action, Event &event) { + Scene3125 *scene = (Scene3125 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (_useLineNum != -1) + SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + case CURSOR_LOOK: + if (_lookLineNum != -1) + SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + case CURSOR_TALK: + if (_talkLineNum != -1) + SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + default: + return scene->display(action, event); + break; + } + + return true; +} + +bool Scene3125::Item2::startAction(CursorType action, Event &event) { + Scene3125 *scene = (Scene3125 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3125; + scene->setAction(&scene->_sequenceManager1, scene, 3125, &R2_GLOBALS._player, NULL); + break; + case CURSOR_LOOK: + SceneItem::display(3125, 15, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + case CURSOR_TALK: + SceneItem::display(3125, 13, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + default: + return SceneHotspot::startAction(action, event); + break; + } + + return true; +} + +bool Scene3125::Item3::startAction(CursorType action, Event &event) { + Scene3125 *scene = (Scene3125 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + R2_GLOBALS._player.disableControl(); + scene->_actor5.postInit(); + scene->_sceneMode = 3126; + scene->setAction(&scene->_sequenceManager1, scene, 3126, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor3, &scene->_actor4, &scene->_actor1, &scene->_actor5, NULL); + break; + case CURSOR_LOOK: + SceneItem::display(3125, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + case CURSOR_TALK: + SceneItem::display(3125, 13, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + default: + return SceneHotspot::startAction(action, event); + break; + } + + return true; +} + +bool Scene3125::Actor1::startAction(CursorType action, Event &event) { + Scene3125 *scene = (Scene3125 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3176; + scene->setAction(&scene->_sequenceManager1, scene, 3176, &R2_GLOBALS._player, &scene->_actor1, NULL); + return true; +} + +void Scene3125::postInit(SceneObjectList *OwnerList) { + loadScene(3125); + SceneExt::postInit(); + _field412 = 0; + + _actor1.postInit(); + _actor1.setup(3175, 1, 1); + _actor1.setPosition(Common::Point(35, 72)); + _actor1.setDetails(3125, 12, 13, -1, 1, (SceneItem *)NULL); + + _actor2.postInit(); + _actor2.setup(3126, 4, 1); + _actor2.setPosition(Common::Point(71, 110)); + _actor2._numFrames = 20; + + _actor3.postInit(); + _actor3.setup(3126, 1, 1); + _actor3.setPosition(Common::Point(215, 62)); + _actor3.fixPriority(71); + + _actor4.postInit(); + _actor4.setup(3126, 1, 1); + _actor4.setPosition(Common::Point(171, 160)); + _actor4.fixPriority(201); + + _item3.setDetails(12, 3125, 9, 13, -1); + _item2.setDetails(11, 3125, 15, 13, -1); + _item1.setDetails(Rect(0, 0, 320, 200), 3125, 0, 1, 2, 1, NULL); + + R2_GLOBALS._sound1.play(262); + R2_GLOBALS._player.postInit(); + + if (R2_GLOBALS._player._oldCharacterScene[3] == 3250) { + _sceneMode = 3175; + setAction(&_sequenceManager1, this, 3175, &R2_GLOBALS._player, &_actor1, NULL); + } else { + R2_GLOBALS._player.setup(30, 5, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(89, 76)); + R2_GLOBALS._player.enableControl(); + } + R2_GLOBALS._player._oldCharacterScene[3] = 3125; +} + +void Scene3125::signal() { + switch (_sceneMode) { + case 3125: + SceneItem::display(3125, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + _sceneMode = 3127; + setAction(&_sequenceManager1, this, 3127, &R2_GLOBALS._player, NULL); + break; + case 3126: + R2_GLOBALS.setFlag(79); + // No break on purpose + case 3176: + R2_GLOBALS._sceneManager.changeScene(3250); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene3125::dispatch() { + if ((_sceneMode == 3126) && (_actor2._frame == 2) && (_field412 == 0)) { + _field412 = 1; + R2_GLOBALS._sound1.play(265); + } + Scene::dispatch(); +} + +/*-------------------------------------------------------------------------- + * Scene 3150 - Jail + * + *--------------------------------------------------------------------------*/ +bool Scene3150::Item5::startAction(CursorType action, Event &event) { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (R2_INVENTORY.getObjectScene(47) != 3150) + return SceneHotspot::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3154; + scene->setAction(&scene->_sequenceManager, scene, 3154, &R2_GLOBALS._player, &scene->_actor3, NULL); + return true; + case R2_SUPERCONDUCTOR_WIRE: + if ((R2_INVENTORY.getObjectScene(47) != 3150) && (R2_GLOBALS.getFlag(75))) { + R2_GLOBALS._player.disableControl(); + scene->_actor3.postInit(); + scene->_actor3._effect = 3; + scene->_actor3._shade = 5; + scene->_sceneMode = 3155; + scene->setAction(&scene->_sequenceManager, scene, 3155, &R2_GLOBALS._player, &scene->_actor3, NULL); + } else { + SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + return true; + default: + return SceneHotspot::startAction(action, event); + break; + } +} + +bool Scene3150::Item6::startAction(CursorType action, Event &event) { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case R2_PILLOW: + R2_GLOBALS._player.disableControl(); + scene->_actor4.postInit(); + scene->_actor4._effect = 6; + scene->_actor4._shade = 3; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3158; + scene->setAction(&scene->_sequenceManager, scene, 3158, &R2_GLOBALS._player, &scene->_actor4, NULL); + return true; + case R2_FOOD_TRAY: + if ((R2_INVENTORY.getObjectScene(47) != 3150) && (R2_INVENTORY.getObjectScene(40) == 3150) && (R2_GLOBALS.getFlag(75))) { + scene->_actor5.postInit(); + scene->_actor5._effect = 6; + scene->_actor5._shade = 3; + scene->_actor5.setDetails(3150, 30, -1, -1, 2, (SceneItem *)NULL); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3159; + scene->setAction(&scene->_sequenceManager, scene, 3159, &R2_GLOBALS._player, &scene->_actor5, NULL); + } else { + SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + default: + return SceneHotspot::startAction(action, event); + break; + } +} + +bool Scene3150::Actor4::startAction(CursorType action, Event &event) { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (R2_GLOBALS.getFlag(75)) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3151; + scene->setAction(&scene->_sequenceManager, scene, 3151, &R2_GLOBALS._player, &scene->_actor4, NULL); + return true; + case R2_FOOD_TRAY: + return false; + default: + return SceneActor::startAction(action, event); + break; + } +} + +bool Scene3150::Actor5::startAction(CursorType action, Event &event) { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + if ((action != CURSOR_USE) || (R2_GLOBALS.getFlag(77))) + return SceneActor::startAction(action ,event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3157; + scene->setAction(&scene->_sequenceManager, scene, 3157, &R2_GLOBALS._player, &scene->_actor5, NULL); + return true; +} + +bool Scene3150::Actor6::startAction(CursorType action, Event &event) { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + if (R2_GLOBALS.getFlag(75)) { + if (R2_GLOBALS.getFlag(77)) { + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS.getFlag(76)) { + scene->_sceneMode = 3152; + scene->setAction(&scene->_sequenceManager, scene, 3152, &R2_GLOBALS._player, NULL); + } else { + scene->_sceneMode = 3153; + scene->setAction(&scene->_sequenceManager, scene, 3152, &R2_GLOBALS._player, &scene->_actor4, NULL); + } + } else { + SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + } else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3152; + scene->setAction(&scene->_sequenceManager, scene, 3152, &R2_GLOBALS._player, NULL); + } + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene3150::Actor7::startAction(CursorType action, Event &event) { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + if ((action == R2_LASER_HACKSAW) && (!R2_GLOBALS.getFlag(80))) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3160; + scene->setAction(&scene->_sequenceManager, scene, 3160, &R2_GLOBALS._player, &scene->_actor7, NULL); + return true; + } + + return SceneActor::startAction(action, event); +} + +void Scene3150::Exit1::changeScene() { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + g_globals->_events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 11; + + Common::Point pt(-20, 180); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene3150::Exit2::changeScene() { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + g_globals->_events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 12; + + scene->setAction(&scene->_sequenceManager, scene, 3163, &R2_GLOBALS._player, NULL); +} + +void Scene3150::postInit(SceneObjectList *OwnerList) { + loadScene(3150); + if (R2_GLOBALS._sceneManager._previousScene == -1) { + R2_INVENTORY.setObjectScene(35, 2000); + R2_GLOBALS._player._oldCharacterScene[1] = 3100; + R2_GLOBALS._player._oldCharacterScene[3] = 0; + R2_GLOBALS._player._characterIndex = R2_MIRANDA; + } + SceneExt::postInit(); + + if (R2_GLOBALS.getFlag(78)) { + _exit1.setDetails(Rect(0, 135, 60, 168), EXITCURSOR_SW, 3275); + _exit1.setDest(Common::Point(70, 125)); + } + + if (R2_GLOBALS.getFlag(80)) { + _exit2.setDetails(Rect(249, 36, 279, 60), EXITCURSOR_NE, 3150); + _exit2.setDest(Common::Point(241, 106)); + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.disableControl(); + + _actor2.postInit(); + _actor2.setPosition(Common::Point(64, 139)); + if (R2_GLOBALS.getFlag(78)) { + _actor2.setup(3151, 1, 5); + _actor2.fixPriority(125); + } else { + _actor2.setup(3151, 1, 1); + _actor2.setDetails(3150, 8, -1, 9, 1, (SceneItem *)NULL); + } + + if (R2_GLOBALS.getFlag(78)) { + _actor1.postInit(); + _actor1.setup(3154, 1, 16); + _actor1.setPosition(Common::Point(104, 129)); + _actor1._effect = 6; + _actor1._shade = 3; + _actor1.setDetails(3150, 24, -1, -1, -1, (SceneItem *)NULL); + } + + _actor7.postInit(); + _actor7.setup(3154, 5, 1); + if (R2_GLOBALS.getFlag(80)) + _actor7.setPosition(Common::Point(264, 108)); + else + _actor7.setPosition(Common::Point(264, 58)); + _actor7.fixPriority(50); + _actor7.setDetails(3150, 17, -1, 19, 1, (SceneItem *)NULL); + + if (R2_INVENTORY.getObjectScene(41) == 3150) { + _actor4.postInit(); + if (R2_GLOBALS.getFlag(75)) { + if (R2_GLOBALS.getFlag(76)) { + R2_GLOBALS._walkRegions.enableRegion(1); + R2_GLOBALS._walkRegions.enableRegion(4); + R2_GLOBALS._walkRegions.enableRegion(5); + R2_GLOBALS._walkRegions.enableRegion(6); + _actor4.setup(3152, 4, 10); + _actor4.setDetails(3150, 14, -1, -1, 1, (SceneItem *)NULL); + } else { + _actor4.setup(3152, 7, 4); + _actor4.setDetails(3150, 13, -1, -1, 1, (SceneItem *)NULL); + } + _actor4.fixPriority(110); + _actor4.setPosition(Common::Point(83, 88)); + _actor4._effect = 6; + _actor4._shade = 3; + } else { + _actor4.setup(3152, 7, 3); + _actor4.setPosition(Common::Point(143, 70)); + _actor4.setDetails(3150, 15, -1, -1, 1, (SceneItem *)NULL); + } + } + + if (R2_INVENTORY.getObjectScene(47) == 3150) { + _actor3.postInit(); + _actor3.setup(3152, 7, 1); + _actor3.setPosition(Common::Point(73, 83)); + } + + if (R2_INVENTORY.getObjectScene(40) == 3150) { + _actor3.postInit(); + _actor3.setup(3152, 7, 3); + _actor3.setPosition(Common::Point(70, 55)); + _actor3.fixPriority(111); + _actor3._effect = 6; + _actor3._shade = 5; + } + + if (R2_INVENTORY.getObjectScene(42) == 3150) { + _actor5.postInit(); + if (R2_GLOBALS.getFlag(77)) { + _actor5.setup(3152, 7, 8); + _actor5.setPosition(Common::Point(82, 92)); + _actor5.fixPriority(111); + _actor5._effect = 6; + _actor5._shade = 3; + } else { + _actor5.setup(3152, 7, 7); + _actor5.setPosition(Common::Point(155, 79)); + } + _actor5.setDetails(3150, 30, -1, -1, 2, (SceneItem *)NULL); + } + + _actor6.postInit(); + _actor6.setup(3152, 7, 6); + _actor6.setPosition(Common::Point(98, 73)); + _actor6.setDetails(3150, 43, -1, -1, 1, (SceneItem *)NULL); + + _item2.setDetails(12, 3150, 10, -1, 12); + _item3.setDetails(Rect(186, 17, 210, 36), 3150, 6, -1, -1, 1, NULL); + _item4.setDetails(Rect(61, 21, 92, 41), 3150, 7, -1, -1, 1, NULL); + _item5.setDetails(Rect(63, 48, 78, 58), 3150, 6, -1, -1, 1, NULL); + _item6.setDetails(Rect(63, 81, 100, 95), 3150, 3, 4, -1, 1, NULL); + _item1.setDetails(Rect(0, 0, 200, 320), 3150, 0, 1, 2, 1, NULL); + + switch (R2_GLOBALS._player._oldCharacterScene[3]) { + case 0: + _sceneMode = 3150; + _actor1.postInit(); + _actor1._effect = 6; + _actor1._shade = 5; + setAction(&_sequenceManager, this, 3150, &R2_GLOBALS._player, &_actor1, &_actor2, NULL); + break; + case 1200: + _sceneMode = 3162; + setAction(&_sequenceManager, this, 3162, &R2_GLOBALS._player, NULL); + break; + case 3275: { + _sceneMode = 10; + R2_GLOBALS._player.setup(30, 3, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(-20, 180)); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + + Common::Point pt(80, 125); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + default: + if ((R2_GLOBALS._v56AA0 == 1) && (R2_INVENTORY.getObjectScene(35) == 2000) && (R2_GLOBALS._player._oldCharacterScene[1] == 3100)) { + ++R2_GLOBALS._v56AA0; + _sceneMode = 3156; + _actor1.postInit(); + _actor1._effect = 6; + _actor1._shade = 3; + + _actor2.postInit(); + _actor5.postInit(); + _actor5._effect = 6; + _actor5._shade = 3; + + setAction(&_sequenceManager, this, 3156, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor5, NULL); + } else { + if (R2_GLOBALS._v56AA0 != 2) + ++R2_GLOBALS._v56AA0; + + R2_GLOBALS._player.setup(30, 3, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(155, 120)); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.enableControl(); + } + } + + R2_GLOBALS._player._oldCharacterScene[3] = 3150; +} + +void Scene3150::signal() { + switch (_sceneMode) { + case 11: + R2_GLOBALS._sceneManager.changeScene(3275); + break; + case 12: + R2_GLOBALS._sceneManager.changeScene(1200); + break; + case 3151: + _actor1.remove(); + R2_INVENTORY.setObjectScene(41, 3); + R2_GLOBALS._player.enableControl(); + break; + case 3153: + R2_GLOBALS.setFlag(76); + _actor4.setDetails(3150, 14, -1, -1, 3, (SceneItem *)NULL); + _actor1.postInit(); + _actor1.setDetails(3150, 24, -1, -1, 2, (SceneItem *)NULL); + _sceneMode = 3161; + setAction(&_sequenceManager, this, 3161, &_actor1, &_actor2, NULL); + break; + case 3154: + _actor3.remove(); + R2_INVENTORY.setObjectScene(47, 3); + R2_GLOBALS._player.enableControl(); + break; + case 3155: + R2_INVENTORY.setObjectScene(40, 3150); + R2_GLOBALS._player.enableControl(); + break; + case 3156: + _actor5.setDetails(3150, 30, -1, -1, 2, (SceneItem *)NULL); + R2_INVENTORY.setObjectScene(42, 3150); + R2_GLOBALS._player.enableControl(); + break; + case 3157: + _actor5.remove(); + R2_INVENTORY.setObjectScene(42, 3); + R2_GLOBALS._player.enableControl(); + break; + case 3158: + R2_GLOBALS.setFlag(75); + R2_INVENTORY.setObjectScene(41, 3150); + _actor4.fixPriority(110); + _actor4.setDetails(3150, 13, -1, -1, 2, (SceneItem *)NULL); + R2_GLOBALS._player.enableControl(); + break; + case 3159: + R2_GLOBALS.setFlag(77); + R2_INVENTORY.setObjectScene(42, 3150); + R2_GLOBALS._player.enableControl(); + break; + case 3160: + R2_INVENTORY.setObjectScene(52, 3150); + R2_GLOBALS.setFlag(80); + R2_GLOBALS._sceneManager.changeScene(1200); + break; + case 3161: + R2_GLOBALS._sceneItems.remove(&_actor2); + _exit1.setDetails(Rect(0, 135, 60, 168), EXITCURSOR_SW, 3275); + _exit1.setDest(Common::Point(70, 125)); + R2_GLOBALS._walkRegions.enableRegion(1); + R2_GLOBALS._walkRegions.enableRegion(4); + R2_GLOBALS._walkRegions.enableRegion(5); + R2_GLOBALS._walkRegions.enableRegion(6); + R2_GLOBALS.setFlag(78); + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene3150::dispatch() { + if (_actor5._position.x == 155) { + _actor5._effect = 0; + _actor5._shade = 0; + } + + if (_actor1._visage == 3154) { + _actor1._effect = 0; + _actor1._shade = 0; + } + + Scene::dispatch(); +} + +/*-------------------------------------------------------------------------- + * Scene 3175 - Autopsy room + * + *--------------------------------------------------------------------------*/ +bool Scene3175::Item1::startAction(CursorType action, Event &event) { + Scene3175 *scene = (Scene3175 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (_useLineNum != -1) { + SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + } + break; + case CURSOR_LOOK: + if (_lookLineNum != -1) { + SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + } + break; + case CURSOR_TALK: + if (_talkLineNum != -1) { + SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + } + break; + default: + break; + } + + return scene->display(action, event); +} + +bool Scene3175::Actor3::startAction(CursorType action, Event &event) { + Scene3175 *scene = (Scene3175 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (_useLineNum != -1) { + SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + } + break; + case CURSOR_LOOK: + if (_lookLineNum != -1) { + SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + } + break; + case CURSOR_TALK: + if (_talkLineNum != -1) { + SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + } + break; + default: + break; + } + + return scene->display(action, event); +} + +bool Scene3175::Actor1::startAction(CursorType action, Event &event) { + Scene3175 *scene = (Scene3175 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3176; + scene->setAction(&scene->_sequenceManager, scene, 3176, &R2_GLOBALS._player, &scene->_actor1, NULL); + return true; + break; + case CURSOR_LOOK: + SceneItem::display(3175, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + break; + case CURSOR_TALK: + SceneItem::display(3175, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + break; + default: + return SceneActor::startAction(action, event); + break; + } +} + +void Scene3175::postInit(SceneObjectList *OwnerList) { + loadScene(3175); + SceneExt::postInit(); + + _actor1.postInit(); + _actor1.setup(3175, 1, 1); + _actor1.setPosition(Common::Point(35, 72)); + _actor1.setDetails(3175, 9, 10, -1, 1, (SceneItem *)NULL); + + _actor2.postInit(); + _actor2.setup(3175, 2, 1); + _actor2.setPosition(Common::Point(87, 148)); + + _actor3.postInit(); + _actor3.setup(3175, 3, 1); + _actor3.setPosition(Common::Point(199, 117)); + _actor3.setDetails(3175, 15, 16, 17, 1, (SceneItem *)NULL); + + _item2.setDetails(12, 3175, 3, 1, 5); + _item3.setDetails(11, 3175, 6, 7, 8); + _item1.setDetails(Rect(0, 0, 320, 200), 3175, 0, 1, 2, 1, NULL); + + R2_GLOBALS._player.postInit(); + + if (R2_GLOBALS._player._oldCharacterScene[3] == 3250) { + R2_GLOBALS._player.setup(30, 5, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(126, 77)); + R2_GLOBALS._player.enableControl(); + } else { + _sceneMode = 3175; + setAction(&_sequenceManager, this, 3175, &R2_GLOBALS._player, &_actor1, NULL); + } + + R2_GLOBALS._player._oldCharacterScene[3] = 3175; +} + +void Scene3175::signal() { + if (_sceneMode == 3176) + R2_GLOBALS._sceneManager.changeScene(3250); + else + R2_GLOBALS._player.enableControl(); +} + +/*-------------------------------------------------------------------------- + * Scene 3200 - Cutscene : Guards - Discussion + * + *--------------------------------------------------------------------------*/ +void Scene3200::postInit(SceneObjectList *OwnerList) { + loadScene(3200); + R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); + + _stripManager.addSpeaker(&_rockoSpeaker); + _stripManager.addSpeaker(&_jockoSpeaker); + _stripManager.addSpeaker(&_sockoSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor3.postInit(); + _actor2.postInit(); + + setAction(&_sequenceManager, this, 3200 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, &_actor3, NULL); +} + +void Scene3200::signal() { + R2_GLOBALS._sceneManager.changeScene(1200); +} + +/*-------------------------------------------------------------------------- + * Scene 3210 - Cutscene : Captain and Private - Discussion + * + *--------------------------------------------------------------------------*/ +void Scene3210::postInit(SceneObjectList *OwnerList) { + loadScene(3210); + R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); + + _stripManager.addSpeaker(&_privateSpeaker); + _stripManager.addSpeaker(&_captainSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor2.postInit(); + + setAction(&_sequenceManager, this, 3210 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, NULL); +} + +void Scene3210::signal() { + R2_GLOBALS._sceneManager.changeScene(1200); +} + +/*-------------------------------------------------------------------------- + * Scene 3220 - Cutscene : Guards in cargo zone + * + *--------------------------------------------------------------------------*/ +void Scene3220::postInit(SceneObjectList *OwnerList) { + loadScene(3220); + R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); + + _stripManager.addSpeaker(&_rockoSpeaker); + _stripManager.addSpeaker(&_jockoSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor2.postInit(); + + setAction(&_sequenceManager, this, 3220 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, NULL); +} + +void Scene3220::signal() { + R2_GLOBALS._sceneManager.changeScene(1200); +} + +/*-------------------------------------------------------------------------- + * Scene 3230 - Cutscene : Guards on duty + * + *--------------------------------------------------------------------------*/ +void Scene3230::postInit(SceneObjectList *OwnerList) { + loadScene(3230); + R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); + + _stripManager.addSpeaker(&_rockoSpeaker); + _stripManager.addSpeaker(&_jockoSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor2.postInit(); + _actor3.postInit(); + + setAction(&_sequenceManager, this, 3230 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, &_actor3, NULL); +} + +void Scene3230::signal() { + R2_GLOBALS._sceneManager.changeScene(1200); +} + +/*-------------------------------------------------------------------------- + * Scene 3240 - Cutscene : Teal monolog + * + *--------------------------------------------------------------------------*/ +void Scene3240::postInit(SceneObjectList *OwnerList) { + loadScene(3240); + R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); + + _stripManager.addSpeaker(&_tealSpeaker); + _stripManager.addSpeaker(&_webbsterSpeaker); + _stripManager.addSpeaker(&_mirandaSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor2.postInit(); + + setAction(&_sequenceManager, this, 3240 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, NULL); +} + +void Scene3240::signal() { + R2_GLOBALS._sceneManager.changeScene(1200); +} + +/*-------------------------------------------------------------------------- + * Scene 3245 - Cutscene : Discussions with Dr. Tomko + * + *--------------------------------------------------------------------------*/ +void Scene3245::postInit(SceneObjectList *OwnerList) { + loadScene(3245); + R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); + + _stripManager.addSpeaker(&_ralfSpeaker); + _stripManager.addSpeaker(&_tomkoSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor2.postInit(); + + if (R2_GLOBALS._v56AA1 < 4) + ++R2_GLOBALS._v56AA1; + + if (R2_GLOBALS._v56AA1 >= 4) { + SceneItem::display(1200, 7, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + signal(); + } else { + setAction(&_sequenceManager, this, 3244 + R2_GLOBALS._v56AA1, &_actor1, &_actor2, NULL); + } +} + +void Scene3245::signal() { + R2_GLOBALS._sceneManager.changeScene(1200); +} + +/*-------------------------------------------------------------------------- + * Scene 3250 - Room with large stasis field negator + * + *--------------------------------------------------------------------------*/ +bool Scene3250::Item::startAction(CursorType action, Event &event) { + Scene3250 *scene = (Scene3250 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (_useLineNum != -1) { + SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + } + break; + case CURSOR_LOOK: + if (_lookLineNum != -1) { + SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + } + break; + case CURSOR_TALK: + if (_talkLineNum != -1) { + SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + } + break; + default: + break; + } + + return scene->display(action, event); +} + +bool Scene3250::Actor::startAction(CursorType action, Event &event) { + Scene3250 *scene = (Scene3250 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + + switch(_position.x) { + case 25: + scene->_sceneMode = 3262; + scene->setAction(&scene->_sequenceManager, scene, 3262, &R2_GLOBALS._player, &scene->_actor1, NULL); + break; + case 259: + scene->_sceneMode = 3260; + scene->setAction(&scene->_sequenceManager, scene, 3260, &R2_GLOBALS._player, &scene->_actor2, NULL); + break; + case 302: + scene->_sceneMode = 3261; + scene->setAction(&scene->_sequenceManager, scene, 3261, &R2_GLOBALS._player, &scene->_actor3, NULL); + break; + default: + break; + } + return true; +} + +void Scene3250::postInit(SceneObjectList *OwnerList) { + loadScene(3250); + + if (R2_GLOBALS._sceneManager._previousScene == -1) { + R2_GLOBALS._player._oldCharacterScene[3] = 1200; + R2_GLOBALS._player._characterIndex = R2_MIRANDA; + } + + SceneExt::postInit(); + _actor1.postInit(); + _actor1.setup(3250, 6, 1); + _actor1.setPosition(Common::Point(25, 148)); + _actor1.fixPriority(10); + _actor1.setDetails(3250, 9, 10, -1, 1, (SceneItem *)NULL); + + _actor2.postInit(); + _actor2.setup(3250, 4, 1); + _actor2.setPosition(Common::Point(259, 126)); + _actor2.fixPriority(10); + _actor2.setDetails(3250, 9, 10, -1, 1, (SceneItem *)NULL); + + _actor3.postInit(); + _actor3.setup(3250, 5, 1); + _actor3.setPosition(Common::Point(302, 138)); + _actor3.fixPriority(10); + _actor3.setDetails(3250, 9, 10, -1, 1, (SceneItem *)NULL); + + _item3.setDetails(Rect(119, 111, 149, 168), 3250, 6, 7, 2, 1, NULL); + _item2.setDetails(Rect(58, 85, 231, 138), 3250, 12, 7, 2, 1, NULL); + _item4.setDetails(12, 3250, 3, 1, 2); + _item1.setDetails(Rect(0, 0, 320, 200), 3250, 0, 1, 2, 1, NULL); + + R2_GLOBALS._player.postInit(); + + switch (R2_GLOBALS._player._oldCharacterScene[3]) { + case 1200: + _sceneMode = 3250; + _actor4.postInit(); + R2_GLOBALS._player._effect = 0; + setAction(&_sequenceManager, this, 3250, &R2_GLOBALS._player, &_actor4, NULL); + break; + case 3125: + if (R2_GLOBALS.getFlag(79)) { + _sceneMode = 3254; + _actor5.postInit(); + _actor5._effect = 1; + _actor6.postInit(); + _actor6._effect = 1; + _actor7.postInit(); + _actor7._effect = 1; + setAction(&_sequenceManager, this, 3254, &R2_GLOBALS._player, &_actor3, &_actor5, &_actor6, &_actor7, &_actor1, NULL); + } else { + _sceneMode = 3252; + setAction(&_sequenceManager, this, 3252, &R2_GLOBALS._player, &_actor3, NULL); + } + break; + case 3175: + _sceneMode = 3251; + setAction(&_sequenceManager, this, 3251, &R2_GLOBALS._player, &_actor2, NULL); + break; + case 3255: + _sceneMode = 3253; + setAction(&_sequenceManager, this, 3253, &R2_GLOBALS._player, &_actor1, NULL); + break; + default: + R2_GLOBALS._player.setup(31, 3, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(185, 150)); + R2_GLOBALS._player.enableControl(); + break; + } + + R2_GLOBALS._player._oldCharacterScene[3] = 3250; +} + +void Scene3250::signal() { + switch(_sceneMode) { + case 3250: + R2_GLOBALS._player._effect = 1; + R2_GLOBALS._player.enableControl(); + break; + case 3254: + //No break on purpose + case 3262: + R2_GLOBALS._sceneManager.changeScene(3255); + break; + case 3260: + R2_GLOBALS._sceneManager.changeScene(3175); + break; + case 3261: + R2_GLOBALS._sceneManager.changeScene(3125); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene3250::dispatch() { + if ((R2_GLOBALS._player._visage == 3250) && (R2_GLOBALS._player._strip == 3) && (R2_GLOBALS._player._effect == 0)) { + R2_GLOBALS._player._effect = 6; + R2_GLOBALS._player._shade = 6; + } + + Scene::dispatch(); +} + +/*-------------------------------------------------------------------------- + * Scene 3255 - + * + *--------------------------------------------------------------------------*/ +void Scene3255::postInit(SceneObjectList *OwnerList) { + loadScene(3255); + SceneExt::postInit(); + + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_mirandaSpeaker); + + if (R2_GLOBALS._sceneManager._previousScene == -1) + R2_GLOBALS.setFlag(79); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS.getFlag(79)) { + R2_GLOBALS._sound1.play(267); + R2_GLOBALS._sound2.play(268); + _sceneMode = 3257; + _actor3.postInit(); + _actor4.postInit(); + _actor4._effect = 1; + setAction(&_sequenceManager, this, 3257, &R2_GLOBALS._player, &_actor4, &_actor3, NULL); + } else { + _actor1.postInit(); + _actor1.setup(303, 1, 1); + _actor1.setPosition(Common::Point(208, 128)); + _actor2.postInit(); + _actor2.setup(3107, 3, 1); + _actor2.setPosition(Common::Point(230, 127)); + _sceneMode = 3255; + setAction(&_sequenceManager, this, 3255, &R2_GLOBALS._player, NULL); + } + R2_GLOBALS._player._oldCharacterScene[3] = 3255; +} + +void Scene3255::signal() { + switch (_sceneMode) { + case 10: + _sceneMode = 3258; + _actor5.postInit(); + _actor6.postInit(); + _actor7.postInit(); + setAction(&_sequenceManager, this, 3258, &R2_GLOBALS._player, &_actor4, &_actor3, &_actor5, &_actor6, &_actor7, NULL); + break; + case 3256: + R2_GLOBALS._sceneManager.changeScene(3250); + break; + case 3257: + _sceneMode = 10; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(607, this); + break; + case 3258: + R2_GLOBALS._sceneManager.changeScene(3100); + break; + default: + SceneItem::display(3255, 0, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + _sceneMode = 3256; + setAction(&_sequenceManager, this, 3256, &R2_GLOBALS._player, NULL); + } +} + +void Scene3255::dispatch() { + if (R2_GLOBALS.getFlag(79)) { + if (_actor5._position.y >= 95) { + if (_actor5._position.y <= 110) + _actor5._shade = 6 - (_actor5._position.y - 95) / 3; + else + _actor5._effect = 1; + } else { + _actor5._effect = 6; + _actor5._shade = 6; + } + + if (_actor6._position.y >= 95) { + if (_actor6._position.y <= 110) + _actor6._shade = 6 - (_actor6._position.y - 95) / 3; + else + _actor6._effect = 1; + } else { + _actor6._effect = 6; + _actor6._shade = 6; + } + + if (_actor7._position.y >= 95) { + if (_actor7._position.y <= 110) + _actor7._shade = 6 - (_actor7._position.y - 95) / 3; + else + _actor7._effect = 1; + } else { + _actor7._effect = 6; + _actor7._shade = 6; + } + } + + if ((R2_GLOBALS._player._position.x > 250) && (R2_GLOBALS._player._shade == 1)) { + R2_GLOBALS._player._effect = 6; + _actor4._effect = 6; + } + Scene::dispatch(); +} + +/*-------------------------------------------------------------------------- + * Scene 3260 - Computer room + * + *--------------------------------------------------------------------------*/ +bool Scene3260::Actor13::startAction(CursorType action, Event &event) { + Scene3260 *scene = (Scene3260 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3271; + scene->setAction(&scene->_sequenceManager, scene, 3271, &R2_GLOBALS._player, &scene->_actor13, NULL); + return true; +} + +bool Scene3260::Actor14::startAction(CursorType action, Event &event) { + Scene3260 *scene = (Scene3260 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3272; + scene->setAction(&scene->_sequenceManager, scene, 3272, &R2_GLOBALS._player, &scene->_actor14, NULL); + return true; +} + +void Scene3260::Action1::signal() { + SceneObjectExt *fmtObj = (SceneObjectExt *) _endHandler; + + fmtObj->setFrame(R2_GLOBALS._randomSource.getRandomNumber(6)); + setDelay(120 + R2_GLOBALS._randomSource.getRandomNumber(179)); +} + +void Scene3260::postInit(SceneObjectList *OwnerList) { + loadScene(3260); + R2_GLOBALS._player._characterIndex = R2_MIRANDA; + SceneExt::postInit(); + R2_GLOBALS._sound1.play(285); + + _actor13.postInit(); + _actor13.setup(3260, 6, 1); + _actor13.setPosition(Common::Point(40, 106)); + _actor13.setDetails(3260, 18, 1, -1, 1, (SceneItem *)NULL); + + if (R2_INVENTORY.getObjectScene(52) == 3260) { + _actor14.postInit(); + _actor14.setup(3260, 7, 1); + _actor14.setPosition(Common::Point(202, 66)); + _actor14.setDetails(3260, 12, 1, -1, 1, (SceneItem *)NULL); + } + + _actor1.postInit(); + _actor1.setup(3260, 1, 1); + _actor1.setPosition(Common::Point(93, 73)); + _actor1.setDetails(3260, 3, 1, 5, 1, (SceneItem *)NULL); + _actor1.setAction(&_action1, &_actor1); + + _actor2.postInit(); + _actor2.setup(3260, 2, 1); + _actor2.setPosition(Common::Point(142, 63)); + _actor2.setDetails(3260, 3, 1, 5, 1, (SceneItem *)NULL); + _actor2.setAction(&_action2, &_actor2); + + _actor3.postInit(); + _actor3.setup(3260, 2, 1); + _actor3.setPosition(Common::Point(166, 54)); + _actor3.setDetails(3260, 3, 1, 5, 1, (SceneItem *)NULL); + _actor3.setAction(&_action3, &_actor3); + + _actor4.postInit(); + _actor4.setup(3260, 2, 1); + _actor4.setPosition(Common::Point(190, 46)); + _actor4.setDetails(3260, 3, 1, 5, 1, (SceneItem *)NULL); + _actor4.setAction(&_action4, &_actor4); + + _actor5.postInit(); + _actor5.setup(3260, 2, 1); + _actor5.setPosition(Common::Point(142, 39)); + _actor5.setDetails(3260, 3, 1, 5, 1, (SceneItem *)NULL); + _actor5.setAction(&_action5, &_actor5); + + _actor6.postInit(); + _actor6.setup(3260, 2, 1); + _actor6.setPosition(Common::Point(166, 30)); + _actor6.setDetails(3260, 3, 1, 5, 1, (SceneItem *)NULL); + _actor6.setAction(&_action6, &_actor6); + + _actor7.postInit(); + _actor7.setup(3260, 2, 1); + _actor7.setPosition(Common::Point(190, 22)); + _actor7.setDetails(3260, 3, 1, 5, 1, (SceneItem *)NULL); + _actor7.setAction(&_action7, &_actor7); + + _actor8.postInit(); + _actor8.setup(3260, 2, 1); + _actor8.setPosition(Common::Point(142, 14)); + _actor8.setDetails(3260, 3, 1, 5, 1, (SceneItem *)NULL); + _actor8.setAction(&_action8, &_actor8); + + _actor9.postInit(); + _actor9.setup(3260, 2, 1); + _actor9.setPosition(Common::Point(166, 6)); + _actor9.setDetails(3260, 3, 1, 5, 1, (SceneItem *)NULL); + _actor9.setAction(&_action9, &_actor9); + + _actor10.postInit(); + _actor10.setup(3260, 3, 1); + _actor10.setPosition(Common::Point(265, 163)); + _actor10.fixPriority(180); + _actor10._numFrames = 10; + _actor10.setDetails(3260, 6, 1, 8, 1, (SceneItem *)NULL); + _actor10.animate(ANIM_MODE_2, NULL); + + _actor11.postInit(); + _actor11.setup(3260, 4, 1); + _actor11.setPosition(Common::Point(127, 108)); + _actor11.fixPriority(120); + _actor11.setAction(&_action11, &_actor11); + _actor11._numFrames = 15; + _actor11.setDetails(3260, 6, 1, 8, 1, (SceneItem *)NULL); + _actor11.animate(ANIM_MODE_2, NULL); + + _actor12.postInit(); + _actor12.setup(3260, 5, 1); + _actor12.setPosition(Common::Point(274, 65)); + _actor12.setAction(&_action12, &_actor12); + _actor12._numFrames = 5; + _actor12.setDetails(3260, 9, 1, 11, 1, (SceneItem *)NULL); + _actor12.animate(ANIM_MODE_2, NULL); + + _item1.setDetails(Rect(0, 0, 320, 200), 3260, 0, 1, 2, 1, NULL); + R2_GLOBALS._player.postInit(); + + if (R2_GLOBALS._player._oldCharacterScene[3] == 3275) { + _sceneMode = 3270; + setAction(&_sequenceManager, this, 3270, &R2_GLOBALS._player, &_actor13, NULL); + } else { + R2_GLOBALS._player.setup(30, 5, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(53, 113)); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.enableControl(); + } + R2_GLOBALS._player._oldCharacterScene[3] = 3260; +} + +void Scene3260::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene3260::signal() { + switch (_sceneMode) { + case 3271: + R2_GLOBALS._sceneManager.changeScene(3275); + break; + case 3272: + _sceneMode = 3273; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + SceneItem::display(3260, 15, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + R2_GLOBALS._player.disableControl(); + R2_INVENTORY.setObjectScene(52, 3); + R2_INVENTORY.setObjectScene(43, 3); + setAction(&_sequenceManager, this, 3273, &R2_GLOBALS._player, &_actor14, NULL); + break; + case 3273: + _actor4.remove(); + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 3275 - Hall + * + *--------------------------------------------------------------------------*/ +bool Scene3275::Actor2::startAction(CursorType action, Event &event) { + Scene3275 *scene = (Scene3275 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3275; + scene->setAction(&scene->_sequenceManager, scene, 3275, &R2_GLOBALS._player, &scene->_actor2, NULL); + return true; +} + +void Scene3275::Exit1::changeScene() { + Scene3275 *scene = (Scene3275 *)R2_GLOBALS._sceneManager._scene; + + scene->_sceneMode = 0; + g_globals->_events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + Common::Point pt(418, 118); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene3275::postInit(SceneObjectList *OwnerList) { + loadScene(3275); + + if (R2_GLOBALS._sceneManager._previousScene == -1) + R2_GLOBALS._sceneManager._previousScene = 3260; + + if (R2_GLOBALS._sceneManager._previousScene == 3150) + g_globals->gfxManager()._bounds.moveTo(Common::Point(160, 0)); + else + g_globals->gfxManager()._bounds.moveTo(Common::Point(0, 0)); + + SceneExt::postInit(); + _exit1.setDetails(Rect(398, 60, 439, 118), SHADECURSOR_UP, 3150); + _exit1.setDest(Common::Point(418, 128)); + + _actor1.postInit(); + _actor1.setup(3275, 1, 7); + _actor1.setPosition(Common::Point(419, 119)); + + _actor2.postInit(); + _actor2.setup(3275, 2, 1); + _actor2.setPosition(Common::Point(56, 118)); + _actor2.setDetails(3275, 3, 4, -1, 1, (SceneItem *)NULL); + + _item2.setDetails(Rect(153, 58, 200, 120), 3275, 6, 7, 8, 1, NULL); + _item3.setDetails(Rect(275, 58, 331, 120), 3275, 6, 7, 8, 1, NULL); + _item4.setDetails(Rect(0, 66, 22, 127), 3275, 9, 10, 11, 1, NULL); + _item5.setDetails(Rect(457, 66, 480, 127), 3275, 9, 10, 11, 1, NULL); + _item1.setDetails(Rect(0, 0, 480, 200), 3275, 0, 1, 2, 1, NULL); + + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._oldCharacterScene[3] == 3150) { + _sceneMode = 11; + R2_GLOBALS._player.setup(30, 3, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(418, 118)); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + Common::Point pt(418, 128); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else if (R2_GLOBALS._player._oldCharacterScene[3] == 3260) { + _sceneMode = 3276; + setAction(&_sequenceManager, this, 3276, &R2_GLOBALS._player, &_actor2, NULL); + } else { + R2_GLOBALS._player.setup(30, 3, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(245, 135)); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.enableControl(); + } + R2_GLOBALS._player._oldCharacterScene[3] = 3275; +} + +void Scene3275::signal() { + switch (_sceneMode) { + case 10: + R2_GLOBALS._sceneManager.changeScene(3150); + break; + case 3275: + R2_GLOBALS._sceneManager.changeScene(3260); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 3350 - Cutscene - Ship landing + * + *--------------------------------------------------------------------------*/ +void Scene3350::postInit(SceneObjectList *OwnerList) { + loadScene(3350); + R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); + R2_GLOBALS._sound2.play(310); + + _rotation = R2_GLOBALS._scenePalette.addRotation(176, 203, 1); + _rotation->setDelay(3); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor1.hide(); + _actor2.postInit(); + _actor2.hide(); + _actor3.postInit(); + _actor3.hide(); + _actor4.postInit(); + _actor4.hide(); + _actor9.postInit(); + _actor9.hide(); + _actor8.postInit(); + _actor8.hide(); + _actor5.postInit(); + _actor5.hide(); + _actor6.postInit(); + _actor6.hide(); + _actor7.postInit(); + _actor7.hide(); + + _sceneMode = 3350; + setAction(&_sequenceManager, this, _sceneMode, &_actor5, &_actor6, &_actor7, NULL); +} + +void Scene3350::remove() { + R2_GLOBALS._sound2.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene3350::signal() { + switch (_sceneMode) { + case 3350: + _sceneMode = 3351; + setAction(&_sequenceManager, this, 3351, &_actor4, &_actor9, &_actor8, NULL); + break; + case 3351: + _sceneMode = 3352; + setAction(&_sequenceManager, this, 3352, &_actor4, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); + case 3352: + R2_GLOBALS._sceneManager.changeScene(3395); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 3375 - + * + *--------------------------------------------------------------------------*/ +Scene3375::Scene3375() { + _field1488 = _field1492 = 0; + for (int i = 0; i < 4; ++i) + _field148A[i] = 0; +} + +void Scene3375::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field1488); + s.syncAsSint16LE(_field1492); + for (int i = 0; i < 4; ++i) + s.syncAsSint16LE(_field148A[i]); +} + +void Scene3375::subFC696(int sceneMode) { + switch (sceneMode) { + case 3379: + R2_GLOBALS._player.setPosition(Common::Point(0, 155)); + _actor1.setPosition(Common::Point(-20, 163)); + _actor2.setPosition(Common::Point(-5, 150)); + _actor3.setPosition(Common::Point(-20, 152)); + break; + case 3380: + ++R2_GLOBALS._v56A9E; + if (R2_GLOBALS._v56A9E >= 4) + R2_GLOBALS._v56A9E = 0; + + loadScene(_field148A[R2_GLOBALS._v56A9E]); + + R2_GLOBALS._uiElements.show(); + R2_GLOBALS._player.setStrip(4); + R2_GLOBALS._player.setPosition(Common::Point(148, 230)); + + _actor1.setPosition(Common::Point(191, 274)); + _actor1._effect = 1; + _actor2.setPosition(Common::Point(124, 255)); + _actor2._effect = 1; + _actor3.setPosition(Common::Point(155, 245)); + _actor3._effect = 1; + break; + case 3381: + --R2_GLOBALS._v56A9E; + if (R2_GLOBALS._v56A9E < 0) + R2_GLOBALS._v56A9E = 3; + + loadScene(_field148A[R2_GLOBALS._v56A9E]); + + R2_GLOBALS._uiElements.show(); + R2_GLOBALS._player.setStrip(6); + R2_GLOBALS._player.setPosition(Common::Point(201, 131)); + + _actor1.setPosition(Common::Point(231, 127)); + _actor1._effect = 1; + _actor2.setPosition(Common::Point(231, 127)); + _actor2._effect = 1; + _actor3.setPosition(Common::Point(231, 127)); + _actor3._effect = 1; + break; + default: + R2_GLOBALS._player.setPosition(Common::Point(192, 155)); + + _actor1.setPosition(Common::Point(138, 134)); + _actor2.setPosition(Common::Point(110, 139)); + _actor3.setPosition(Common::Point(125, 142)); + break; + } + + if (R2_GLOBALS._v56A9E == 2) { + R2_GLOBALS._sceneItems.remove(&_actor4); + for (int i = 0; i <= 12; i++) + R2_GLOBALS._sceneItems.remove(&_itemArray[i]); + R2_GLOBALS._sceneItems.remove(&_item1); + + _actor4.show(); + _actor4.setDetails(3375, 9, 10, -1, 1, (SceneItem *)NULL); + + for (int i = 0; i <= 12; i++) + _itemArray[i].setDetails(3375, 3, -1, -1); + + _item1.setDetails(Rect(0, 0, 320, 200), 3375, 0, -1, -1, 1, NULL); + } else { + _actor4.hide(); + R2_GLOBALS._sceneItems.remove(&_actor4); + } + + if (_sceneMode == 0) + signal(); + else + setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); +} + +bool Scene3375::Actor1::startAction(CursorType action, Event &event) { + Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + scene->_sceneMode = 9999; + if (R2_GLOBALS._player._characterIndex == 2) + scene->_stripManager.start(3302, scene); + else + scene->_stripManager.start(3304, scene); + + return true; +} + +bool Scene3375::Actor2::startAction(CursorType action, Event &event) { + Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + scene->_sceneMode = 9999; + if (R2_GLOBALS._player._characterIndex == 3) + scene->_stripManager.start(3302, scene); + else + scene->_stripManager.start(3301, scene); + + return true; +} + +bool Scene3375::Actor3::startAction(CursorType action, Event &event) { + Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + scene->_sceneMode = 9999; + scene->_stripManager.start(3303, scene); + + return true; +} + +bool Scene3375::Actor4::startAction(CursorType action, Event &event) { + Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS._v56A9E != 0) { + R2_GLOBALS._walkRegions.disableRegion(2); + R2_GLOBALS._walkRegions.disableRegion(3); + } else { + R2_GLOBALS._walkRegions.disableRegion(1); + R2_GLOBALS._walkRegions.disableRegion(3); + R2_GLOBALS._walkRegions.disableRegion(4); + } + R2_GLOBALS._walkRegions.disableRegion(6); + R2_GLOBALS._walkRegions.disableRegion(7); + R2_GLOBALS._walkRegions.disableRegion(8); + + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + + scene->_sceneMode = 3375; + scene->setAction(&scene->_sequenceManager, scene, 3375, &R2_GLOBALS._player, &scene->_actor1, &scene->_actor2, &scene->_actor3, &scene->_actor4, NULL); + + return true; +} + +void Scene3375::Exit1::changeScene() { + Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; + + _moving = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + scene->_sceneMode = 3376; + if (R2_GLOBALS._v56A9E != 0) { + R2_GLOBALS._walkRegions.disableRegion(2); + R2_GLOBALS._walkRegions.disableRegion(3); + } else { + R2_GLOBALS._walkRegions.disableRegion(1); + R2_GLOBALS._walkRegions.disableRegion(3); + R2_GLOBALS._walkRegions.disableRegion(4); + } + if (scene->_actor1._position.y != 163) { + R2_GLOBALS._player.setStrip(-1); + scene->_actor1.setStrip2(-1); + scene->_actor2.setStrip2(-1); + scene->_actor3.setStrip2(-1); + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, &scene->_actor2, &scene->_actor3, NULL); + } else { + R2_GLOBALS._player.setStrip2(2); + scene->_actor1.setStrip2(2); + scene->_actor2.setStrip2(2); + scene->_actor3.setStrip2(2); + R2_GLOBALS._sound2.play(314); + + Common::Point pt(50, 150); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + } +} + +void Scene3375::Exit2::changeScene() { + Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; + + _moving = false; + R2_GLOBALS._player._effect = 6; + R2_GLOBALS._player._shade = 4; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + + scene->_sceneMode = 3377; + scene->_field1488 = 3381; + + if (R2_GLOBALS._v56A9E != 0) { + R2_GLOBALS._walkRegions.disableRegion(2); + R2_GLOBALS._walkRegions.disableRegion(3); + } else { + R2_GLOBALS._walkRegions.disableRegion(1); + R2_GLOBALS._walkRegions.disableRegion(3); + R2_GLOBALS._walkRegions.disableRegion(4); + } + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, &scene->_actor2, &scene->_actor3, NULL); +} + +void Scene3375::Exit3::changeScene() { + Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; + + _moving = false; + R2_GLOBALS._player._effect = 6; + R2_GLOBALS._player._shade = 4; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + + scene->_sceneMode = 3378; + scene->_field1488 = 3380; + + if (R2_GLOBALS._v56A9E != 0) { + R2_GLOBALS._walkRegions.disableRegion(2); + R2_GLOBALS._walkRegions.disableRegion(3); + } else { + R2_GLOBALS._walkRegions.disableRegion(1); + R2_GLOBALS._walkRegions.disableRegion(3); + R2_GLOBALS._walkRegions.disableRegion(4); + } + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, &scene->_actor2, &scene->_actor3, NULL); +} + +void Scene3375::postInit(SceneObjectList *OwnerList) { + _field148A[0] = 3376; + _field148A[1] = 3377; + _field148A[2] = 3375; + _field148A[3] = 3378; + + loadScene(_field148A[R2_GLOBALS._v56A9E]); + SceneExt::postInit(); + + R2_GLOBALS._sound1.play(313); + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + _stripManager.addSpeaker(&_mirandaSpeaker); + _stripManager.addSpeaker(&_webbsterSpeaker); + + R2_GLOBALS._player._characterScene[1] = 3375; + R2_GLOBALS._player._characterScene[2] = 3375; + R2_GLOBALS._player._characterScene[3] = 3375; + + setZoomPercents(126, 55, 200, 167); + R2_GLOBALS._player.postInit(); + + if (R2_GLOBALS._player._characterIndex == 2) { + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + } else { + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + } + R2_GLOBALS._player.changeZoom(-1); + + switch (R2_GLOBALS._player._characterIndex) { + case 2: + if (R2_GLOBALS._sceneManager._previousScene == 3385) + R2_GLOBALS._player.setup(20, 1, 1); + else + R2_GLOBALS._player.setup(20, 3, 1); + break; + case 3: + if (R2_GLOBALS._sceneManager._previousScene == 3385) + R2_GLOBALS._player.setup(30, 1, 1); + else + R2_GLOBALS._player.setup(30, 3, 1); + break; + default: + if (R2_GLOBALS._sceneManager._previousScene == 3385) + R2_GLOBALS._player.setup(10, 1, 1); + else + R2_GLOBALS._player.setup(10, 3, 1); + break; + } + + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 2) { + _actor1._moveRate = 10; + _actor1._moveDiff = Common::Point(3, 2); + } else { + _actor1._moveRate = 7; + _actor1._moveDiff = Common::Point(5, 3); + } + _actor1.changeZoom(-1); + _actor1._effect = 1; + + int tmpStrip, tmpVisage; + if (R2_GLOBALS._sceneManager._previousScene == 3385) + tmpStrip = 1; + else + tmpStrip = 4; + + if (R2_GLOBALS._player._characterIndex == 2) + tmpVisage = 10; + else + tmpVisage = 20; + + _actor1.setup(tmpVisage, tmpStrip, 1); + _actor1.animate(ANIM_MODE_1, NULL); + + _actor2.postInit(); + _actor2._moveDiff = Common::Point(3, 2); + _actor2.changeZoom(-1); + _actor2._effect = 1; + if (R2_GLOBALS._sceneManager._previousScene == 3385) + tmpStrip = 1; + else + tmpStrip = 8; + + if (R2_GLOBALS._player._characterIndex == 3) + tmpVisage = 10; + else + tmpVisage = 30; + + _actor2.setup(tmpVisage, tmpStrip, 1); + _actor2.animate(ANIM_MODE_1, NULL); + + _actor3.postInit(); + _actor3._moveRate = 7; + _actor3._moveDiff = Common::Point(5, 3); + _actor3.changeZoom(-1); + _actor3._effect = 1; + if (R2_GLOBALS._sceneManager._previousScene == 3385) + tmpStrip = 1; + else + tmpStrip = 4; + + _actor3.setup(40, tmpStrip, 1); + _actor3.animate(ANIM_MODE_1, NULL); + + _actor2.setDetails(3375, -1, -1, -1, 1, (SceneItem *)NULL); + _actor3.setDetails(3375, 21, -1, -1, 1, (SceneItem *)NULL); + _actor1.setDetails(3375, -1, -1, -1, 1, (SceneItem *)NULL); + + _actor4.postInit(); + _actor4.setup(3375, 1, 1); + _actor4.setPosition(Common::Point(254, 166)); + _actor4.fixPriority(140); + _actor4.hide(); + + _exit1.setDetails(Rect(0, 84, 24, 167), EXITCURSOR_W, 3375); + _exit1.setDest(Common::Point(65, 155)); + _exit2.setDetails(Rect(103, 152, 183, 170), SHADECURSOR_DOWN, 3375); + _exit2.setDest(Common::Point(158, 151)); + _exit3.setDetails(Rect(180, 75, 213, 132), EXITCURSOR_E, 3375); + _exit3.setDest(Common::Point(201, 131)); + + for (int i = 0; i <= 12; ++i) + _itemArray[i].setDetails(i, 3375, 3, -1, -1); + + _item1.setDetails(Rect(0, 0, 320, 200), 3375, 0, -1, 1, 1, NULL); + + if (R2_GLOBALS._sceneManager._previousScene == 3385) + _sceneMode = 3379; + else + _sceneMode = 0; + + subFC696(_sceneMode); +} + +void Scene3375::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene3375::signalCase3379() { + switch (R2_GLOBALS._v56A9E) { + case 0: + _exit1._enabled = true; + if (R2_GLOBALS._sceneManager._previousScene == 3385) + R2_GLOBALS._walkRegions.enableRegion(1); + else { + R2_GLOBALS._walkRegions.enableRegion(3); + R2_GLOBALS._walkRegions.enableRegion(4); + } + R2_GLOBALS._walkRegions.enableRegion(6); + R2_GLOBALS._walkRegions.enableRegion(7); + case 2: + _exit1._enabled = false; + R2_GLOBALS._walkRegions.enableRegion(2); + R2_GLOBALS._walkRegions.enableRegion(3); + R2_GLOBALS._walkRegions.enableRegion(5); + R2_GLOBALS._walkRegions.enableRegion(6); + R2_GLOBALS._walkRegions.enableRegion(7); + R2_GLOBALS._walkRegions.enableRegion(8); + R2_GLOBALS._walkRegions.enableRegion(9); + default: + _exit1._enabled = false; + R2_GLOBALS._walkRegions.enableRegion(2); + R2_GLOBALS._walkRegions.enableRegion(3); + R2_GLOBALS._walkRegions.enableRegion(5); + R2_GLOBALS._walkRegions.enableRegion(6); + break; + } + R2_GLOBALS._sceneManager._previousScene = 3375; + R2_GLOBALS._player._effect = 1; + _actor1._effect = 1; + _actor2._effect = 1; + _actor3._effect = 1; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); +} + +void Scene3375::signal() { + switch (_sceneMode) { + case 3375: + R2_GLOBALS._sceneManager.changeScene(3400); + break; + case 3376: + R2_GLOBALS._sceneManager.changeScene(3385); + break; + case 3377: + // No break on purpose + case 3378: + _sceneMode = _field1488; + _field1488 = 0; + _actor1._effect = 6; + _actor1._shade = 4; + _actor2._effect = 6; + _actor2._shade = 4; + _actor3._effect = 6; + _actor3._shade = 4; + subFC696(_sceneMode); + break; + case 3379: + signalCase3379(); + break; + case 9999: + if (_actor1._position.y == 163) + R2_GLOBALS._player.setStrip(1); + else + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.enableControl(CURSOR_TALK); + default: + _actor1.setPriority(130); + _actor2.setPriority(132); + _actor3.setPriority(134); + signalCase3379(); + break; + } +} + +void Scene3375::dispatch() { + if ((R2_GLOBALS._player._position.y >= 168) && (R2_GLOBALS._player._effect == 1)) + R2_GLOBALS._player._effect = 6; + else if ((R2_GLOBALS._player._position.y < 168) && (R2_GLOBALS._player._effect == 6)) + R2_GLOBALS._player._effect = 1; + + if ((_actor1._position.y >= 168) && (_actor1._effect == 1)) + _actor1._effect = 6; + else if ((_actor1._position.y < 168) && (_actor1._effect == 6)) + _actor1._effect = 1; + + if ((_actor2._position.y >= 168) && (_actor2._effect == 1)) + _actor2._effect = 6; + else if ((_actor2._position.y < 168) && (_actor2._effect == 6)) + _actor2._effect = 1; + + if ((_actor3._position.y >= 168) && (_actor3._effect == 1)) + _actor3._effect = 6; + else if ((_actor3._position.y < 168) && (_actor3._effect == 6)) + _actor3._effect = 1; + + Scene::dispatch(); +} + +/*-------------------------------------------------------------------------- + * Scene 3385 - + * + *--------------------------------------------------------------------------*/ +Scene3385::Scene3385() { + _field11B2 = 0; +} + +void Scene3385::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field11B2); +} + +bool Scene3385::Actor1::startAction(CursorType action, Event &event) { + Scene3385 *scene = (Scene3385 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + scene->_sceneMode = 9999; + if (R2_GLOBALS._player._characterIndex == 2) + scene->_stripManager.start(3302, scene); + else + scene->_stripManager.start(3304, scene); + + return true; +} + +bool Scene3385::Actor2::startAction(CursorType action, Event &event) { + Scene3385 *scene = (Scene3385 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + scene->_sceneMode = 9999; + if (R2_GLOBALS._player._characterIndex == 3) + scene->_stripManager.start(3302, scene); + else + scene->_stripManager.start(3301, scene); + + return true; +} + +bool Scene3385::Actor3::startAction(CursorType action, Event &event) { + Scene3385 *scene = (Scene3385 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + scene->_sceneMode = 9999; + scene->_stripManager.start(3303, scene); + + return true; +} + +bool Scene3385::Actor4::startAction(CursorType action, Event &event) { + Scene3385 *scene = (Scene3385 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + if (R2_GLOBALS._sceneManager._previousScene == 3375) + R2_GLOBALS._sound2.play(314); + + scene->_sceneMode = 3386; + scene->setAction(&scene->_sequenceManager, scene, 3386, &R2_GLOBALS._player, &scene->_actor1, &scene->_actor2, &scene->_actor3, &scene->_actor4, NULL); + + return true; +} + +void Scene3385::Exit1::changeScene() { + Scene3385 *scene = (Scene3385 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + scene->_sceneMode = 3387; + + if (R2_GLOBALS._sceneManager._previousScene == 3375) + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, &scene->_actor2, &scene->_actor3, NULL); + else + scene->signal(); +} + +void Scene3385::Action1::signal() { + int v = _actionIndex; + ++_actionIndex; + + if (v == 0) + setDelay(1); + else if (v == 1) + R2_GLOBALS._sound2.play(314); +} + +void Scene3385::postInit(SceneObjectList *OwnerList) { + loadScene(3385); + SceneExt::postInit(); + + R2_GLOBALS._sound1.play(313); + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + _stripManager.addSpeaker(&_mirandaSpeaker); + _stripManager.addSpeaker(&_webbsterSpeaker); + + R2_GLOBALS._player._characterScene[1] = 3385; + R2_GLOBALS._player._characterScene[2] = 3385; + R2_GLOBALS._player._characterScene[3] = 3385; + + if (R2_GLOBALS._sceneManager._previousScene == 3375) + _field11B2 = 3; + else + _field11B2 = 4; + + setZoomPercents(102, 40, 200, 160); + R2_GLOBALS._player.postInit(); + + if (R2_GLOBALS._player._characterIndex == 2) + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + else + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + + R2_GLOBALS._player.changeZoom(-1); + + if (R2_GLOBALS._player._characterIndex == 2) + R2_GLOBALS._player.setup(20, _field11B2, 1); + else if (R2_GLOBALS._player._characterIndex == 3) + R2_GLOBALS._player.setup(30, _field11B2, 1); + else + R2_GLOBALS._player.setup(10, _field11B2, 1); + + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 2) { + _actor1._moveRate = 10; + _actor1._moveDiff = Common::Point(3, 2); + } else { + _actor1._moveRate = 7; + _actor1._moveDiff = Common::Point(5, 3); + } + _actor1.changeZoom(-1); + _actor1._effect = 1; + if (R2_GLOBALS._player._characterIndex == 2) + _actor1.setup(10, _field11B2, 1); + else + _actor1.setup(20, _field11B2, 1); + _actor1.animate(ANIM_MODE_1, NULL); + _actor1.setDetails(3385, -1, -1, -1, 1, (SceneItem *) NULL); + + _actor2.postInit(); + _actor2._moveDiff = Common::Point(3, 2); + _actor2.changeZoom(-1); + _actor2._effect = 1; + if (R2_GLOBALS._player._characterIndex == 3) + _actor2.setup(10, _field11B2, 1); + else + _actor2.setup(30, _field11B2, 1); + _actor2.animate(ANIM_MODE_1, NULL); + _actor2.setDetails(3385, -1, -1, -1, 1, (SceneItem *) NULL); + + _actor3.postInit(); + _actor3._moveDiff = Common::Point(3, 2); + _actor3.changeZoom(-1); + _actor3._effect = 1; + _actor3.setup(40, _field11B2, 1); + _actor3.animate(ANIM_MODE_1, NULL); + _actor3.setDetails(3385, 15, -1, -1, 1, (SceneItem *) NULL); + + _exit1.setDetails(Rect(103, 152, 217, 170), SHADECURSOR_DOWN, 3395); + _exit1.setDest(Common::Point(158, 151)); + + _actor4.postInit(); + _actor4.setPosition(Common::Point(160, 100)); + _actor4.fixPriority(90); + _actor4.setDetails(3385, 3, 4, -1, 1, (SceneItem *) NULL); + + if (R2_GLOBALS._sceneManager._previousScene == 3375) { + R2_GLOBALS._player.setPosition(Common::Point(158, 102)); + _actor1.setPosition(Common::Point(164, 100)); + _actor1.fixPriority(98); + _actor2.setPosition(Common::Point(150, 100)); + _actor2.fixPriority(97); + _actor3.setPosition(Common::Point(158, 100)); + _actor3.fixPriority(96); + _sceneMode = 3384; + _actor4.setup(3385, 1, 6); + _actor4.animate(ANIM_MODE_6, this); + setAction(&_action1, &_actor4); + } else { + R2_GLOBALS._player.setPosition(Common::Point(158, 230)); + _actor1.setPosition(Common::Point(191, 270)); + _actor2.setPosition(Common::Point(124, 255)); + _actor3.setPosition(Common::Point(155, 245)); + _actor4.setup(3385, 1, 1); + _sceneMode = 3385; + setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); + } + + _item1.setDetails(Rect(0, 0, 320, 200), 3385, 0, -1, -1, 1, NULL); + R2_GLOBALS._v56A9E = 0; +} + +void Scene3385::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene3385::signal() { + switch (_sceneMode) { + case 3386: + R2_GLOBALS._sceneManager.changeScene(3375); + break; + case 3387: + R2_GLOBALS._sceneManager.changeScene(3395); + break; + case 9999: + if (R2_GLOBALS._sceneManager._previousScene == 3375) + R2_GLOBALS._player.setStrip(3); + else + R2_GLOBALS._player.setStrip(4); + R2_GLOBALS._player.enableControl(CURSOR_TALK); + break; + default: + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 3395 - + * + *--------------------------------------------------------------------------*/ +Scene3395::Scene3395() { + _field142E = 0; +} + +void Scene3395::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field142E); +} + +bool Scene3395::Actor1::startAction(CursorType action, Event &event) { + Scene3395 *scene = (Scene3395 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + scene->_sceneMode = 9999; + if (R2_GLOBALS._player._characterIndex == 2) + scene->_stripManager.start(3302, scene); + else + scene->_stripManager.start(3304, scene); + + return true; +} + +bool Scene3395::Actor2::startAction(CursorType action, Event &event) { + Scene3395 *scene = (Scene3395 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + scene->_sceneMode = 9999; + if (R2_GLOBALS._player._characterIndex == 3) + scene->_stripManager.start(3302, scene); + else + scene->_stripManager.start(3301, scene); + + return true; +} + +bool Scene3395::Actor3::startAction(CursorType action, Event &event) { + Scene3395 *scene = (Scene3395 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + scene->_sceneMode = 9999; + scene->_stripManager.start(3303, scene); + + return true; +} + +bool Scene3395::Actor4::startAction(CursorType action, Event &event) { + Scene3395 *scene = (Scene3395 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + if (R2_GLOBALS._sceneManager._previousScene == 3385) + R2_GLOBALS._sound2.play(314); + + scene->_sceneMode = 3396; + scene->setAction(&scene->_sequenceManager, scene, 3396, &R2_GLOBALS._player, &scene->_actor1, &scene->_actor2, &scene->_actor3, &scene->_actor4, NULL); + + return true; +} + +void Scene3395::Action1::signal() { + int v = _actionIndex; + ++_actionIndex; + + if (v == 0) + setDelay(2); + else if (v == 1) + R2_GLOBALS._sound2.play(314); +} + +void Scene3395::postInit(SceneObjectList *OwnerList) { + loadScene(3395); + SceneExt::postInit(); + + R2_GLOBALS._sound1.play(313); + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + _stripManager.addSpeaker(&_mirandaSpeaker); + _stripManager.addSpeaker(&_webbsterSpeaker); + + R2_GLOBALS._player._characterScene[1] = 3395; + R2_GLOBALS._player._characterScene[2] = 3395; + R2_GLOBALS._player._characterScene[3] = 3395; + + if (R2_GLOBALS._sceneManager._previousScene == 3385) + _field142E = 3; + else + _field142E = 4; + + setZoomPercents(51, 40, 200, 137); + R2_GLOBALS._player.postInit(); + + if (R2_GLOBALS._player._characterIndex == 2) + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + else + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + + R2_GLOBALS._player.changeZoom(-1); + + if (R2_GLOBALS._player._characterIndex == 2) + R2_GLOBALS._player.setup(20, _field142E, 1); + else if (R2_GLOBALS._player._characterIndex == 3) + R2_GLOBALS._player.setup(30, _field142E, 1); + else + R2_GLOBALS._player.setup(10, _field142E, 1); + + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 2) { + _actor1._moveRate = 10; + _actor1._moveDiff = Common::Point(3, 2); + } else { + _actor1._moveRate = 7; + _actor1._moveDiff = Common::Point(5, 3); + } + _actor1.changeZoom(-1); + _actor1._effect = 1; + if (R2_GLOBALS._player._characterIndex == 2) + _actor1.setup(10, _field142E, 1); + else + _actor1.setup(20, _field142E, 1); + _actor1.animate(ANIM_MODE_1, NULL); + _actor1.setDetails(3395, -1, -1, -1, 1, (SceneItem *) NULL); + + _actor2.postInit(); + _actor2._moveDiff = Common::Point(3, 2); + _actor2.changeZoom(-1); + _actor2._effect = 1; + if (R2_GLOBALS._player._characterIndex == 3) + _actor2.setup(10, _field142E, 1); + else + _actor2.setup(30, _field142E, 1); + _actor2.animate(ANIM_MODE_1, NULL); + _actor2.setDetails(3395, -1, -1, -1, 1, (SceneItem *) NULL); + + _actor3.postInit(); + _actor3._moveDiff = Common::Point(3, 2); + _actor3.changeZoom(-1); + _actor3._effect = 1; + _actor3.setup(40, _field142E, 1); + _actor3.animate(ANIM_MODE_1, NULL); + _actor3.setDetails(3385, 18, -1, -1, 1, (SceneItem *) NULL); + + _actor4.postInit(); + _actor4.setPosition(Common::Point(159, 50)); + _actor4.fixPriority(40); + _actor4.setDetails(3395, 6, 7, -1, 1, (SceneItem *) NULL); + + if (R2_GLOBALS._sceneManager._previousScene == 3385) { + R2_GLOBALS._player.setPosition(Common::Point(158, 53)); + _actor1.setPosition(Common::Point(164, 51)); + _actor1.fixPriority(48); + _actor2.setPosition(Common::Point(150, 51)); + _actor2.fixPriority(47); + _actor3.setPosition(Common::Point(158, 51)); + _actor3.fixPriority(46); + _sceneMode = 3394; + _actor4.setup(3395, 1, 7); + _actor4.animate(ANIM_MODE_6, this); + setAction(&_action1, &_actor4); + } else { + R2_GLOBALS._player.setPosition(Common::Point(158, 200)); + _actor1.setPosition(Common::Point(191, 255)); + _actor2.setPosition(Common::Point(124, 240)); + _actor3.setPosition(Common::Point(155, 242)); + _actor4.setup(3395, 1, 1); + + R2_GLOBALS._walkRegions.enableRegion(1); + + _sceneMode = 3395; + setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); + } + + for (int i = 0; i <= 12; i++) { + _itemArray[i].setDetails(i, 3995, 0, -1, -1); + } + + _item1.setDetails(Rect(0, 0, 320, 200), 3395, 3, -1, -1, 1, NULL); +} + +void Scene3395::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene3395::signal() { + switch (_sceneMode) { + case 3396: + R2_GLOBALS._sceneManager.changeScene(3385); + break; + case 9999: + if (R2_GLOBALS._sceneManager._previousScene == 3385) + R2_GLOBALS._player.setStrip(3); + else + R2_GLOBALS._player.setStrip(4); + R2_GLOBALS._player.enableControl(CURSOR_TALK); + break; + default: + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 3400 - + * + *--------------------------------------------------------------------------*/ +Scene3400::Scene3400() { + _field157C = 0; +} + +void Scene3400::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field157C); +} + +void Scene3400::postInit(SceneObjectList *OwnerList) { + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + g_globals->gfxManager()._bounds.moveTo(Common::Point(160, 0)); + loadScene(3400); + _field157C = 0; + R2_GLOBALS._v558B6.set(60, 0, 260, 200); + SceneExt::postInit(); + R2_GLOBALS._sound1.play(317); + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + _stripManager.addSpeaker(&_mirandaSpeaker); + _stripManager.addSpeaker(&_webbsterSpeaker); + _stripManager.addSpeaker(&_tealSpeaker); + + setZoomPercents(51, 46, 180, 200); + R2_GLOBALS._player._characterScene[1] = 3400; + R2_GLOBALS._player._characterScene[2] = 3400; + R2_GLOBALS._player._characterScene[3] = 3400; + + _actor7.postInit(); + _actor7.setup(3403, 1, 1); + _actor7.setPosition(Common::Point(190, 103)); + _actor7.fixPriority(89); + + R2_GLOBALS._player.postInit(); + if (R2_GLOBALS._player._characterIndex == 2) + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + else + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.changeZoom(-1); + R2_GLOBALS._player.setPosition(Common::Point(239, 64)); + + if (R2_GLOBALS._player._characterIndex == 2) + R2_GLOBALS._player.setup(20, 5, 1); + else if (R2_GLOBALS._player._characterIndex == 3) + R2_GLOBALS._player.setup(30, 5, 1); + else + R2_GLOBALS._player.setup(10, 5, 1); + + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 2) { + _actor1._numFrames = 10; + _actor1._moveDiff = Common::Point(3, 2); + } else { + _actor1._numFrames = 7; + _actor1._moveDiff = Common::Point(5, 3); + } + _actor1.changeZoom(-1); + _actor1._effect = 1; + _actor1.setPosition(Common::Point(247, 63)); + if (R2_GLOBALS._player._characterIndex == 2) + _actor1.setup(10, 5, 1); + else + _actor1.setup(20, 5, 1); + _actor1.animate(ANIM_MODE_1, NULL); + + _actor2.postInit(); + _actor2._moveDiff = Common::Point(3, 2); + _actor2.changeZoom(-1); + _actor2._effect = 1; + _actor2.setPosition(Common::Point(225, 63)); + if (R2_GLOBALS._player._characterIndex == 3) + _actor2.setup(10, 5, 1); + else + _actor2.setup(30, 5, 1); + _actor2.animate(ANIM_MODE_1, NULL); + + _actor3.postInit(); + _actor3._numFrames = 7; + _actor3._moveDiff = Common::Point(5, 3); + _actor3.changeZoom(-1); + _actor3._effect = 1; + _actor3.setPosition(Common::Point(235, 61)); + _actor3.setup(40, 3, 1); + _actor3.animate(ANIM_MODE_1, NULL); + + _actor6.postInit(); + _actor6.setup(3400, 1, 6); + _actor6.setPosition(Common::Point(236, 51)); + _actor6.fixPriority(51); + _actor6.animate(ANIM_MODE_6, NULL); + + R2_GLOBALS.clearFlag(71); + _sceneMode = 3400; + setAction(&_sequenceManager, this, 3400, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); +} + +void Scene3400::remove() { + R2_GLOBALS._sound2.fadeOut2(NULL); + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene3400::signal() { + switch (_sceneMode) { + case 3305: { + warning("STUB: sub_1D227()"); + _tealSpeaker._object1.hide(); + _actor4.show(); + _actor4.setStrip(1); + Common::Point pt(158, 190); + NpcMover *mover = new NpcMover(); + _actor4.addMover(mover, &pt, this); + _sceneMode = 3402; + setAction(&_sequenceManager, this, 3402, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); + } + break; + case 3306: + R2_GLOBALS._sound2.play(318); + _actor1.setStrip(2); + R2_GLOBALS._player.setStrip(6); + _actor2.setStrip(6); + _actor3.setStrip(3); + _actor4.setStrip(1); + R2_INVENTORY.setObjectScene(34, 0); + _stripManager.start(3307, this); + if (R2_GLOBALS._player._characterIndex == 2) { + _sceneMode = 3400; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 3400, &R2_GLOBALS._player, &_actor4, &_actor8, NULL); + } else { + _sceneMode = 3408; + _actor1.setAction(&_sequenceManager, this, 3408, &_actor1, &_actor4, &_actor8, NULL); + } + break; + case 3307: + case 3404: + case 3408: + if (_field157C == 0) { + R2_GLOBALS._sound2.fadeOut2(NULL); + _field157C = 1; + } else { + _sceneMode = 3308; + _stripManager.start(3308, this); + } + break; + case 3308: + warning("STUB: sub_1D227()"); + _actor1.setStrip(2); + R2_GLOBALS._player.setStrip(6); + _actor2.setStrip(6); + _actor3.setStrip(3); + _actor4.setStrip(1); + _sceneMode = 3403; + if (R2_GLOBALS._player._characterIndex == 2) + setAction(&_sequenceManager, this, 3403, &R2_GLOBALS._player, &_actor3, &_actor7, NULL); + else + setAction(&_sequenceManager, this, 3403, &_actor1, &_actor3, &_actor7, NULL); + break; + case 3309: + warning("STUB: sub_1D227()"); + _actor4.setStrip(1); + _sceneMode = 3405; + if (R2_GLOBALS._player._characterIndex == 3) + setAction(&_sequenceManager, this, 3405, &R2_GLOBALS._player, &_actor7, NULL); + else + setAction(&_sequenceManager, this, 3405, &_actor2, &_actor7, NULL); + break; + case 3310: + warning("STUB: sub_1D227()"); + _actor4.setStrip(1); + _sceneMode = 3406; + if (R2_GLOBALS._player._characterIndex == 1) + setAction(&_sequenceManager, this, 3406, &R2_GLOBALS._player, &_actor7, NULL); + else if (R2_GLOBALS._player._characterIndex == 2) + setAction(&_sequenceManager, this, 3406, &_actor1, &_actor7, NULL); + else if (R2_GLOBALS._player._characterIndex == 3) + setAction(&_sequenceManager, this, 3406, &_actor2, &_actor7, NULL); + break; + case 3311: + warning("STUB: sub_1D227()"); + _tealSpeaker._object1.hide(); + _actor4.show(); + _actor4.setStrip(1); + _sceneMode = 3407; + setAction(&_sequenceManager, this, 3407, &_actor4, &_actor7, NULL); + break; + case 3400: { + _actor8.postInit(); + _actor8.hide(); + _actor4.postInit(); + _actor4._numFrames = 7; + _actor4._moveDiff = Common::Point(3, 2); + _actor4.changeZoom(-1); + _actor4._effect = 1; + _actor4.setPosition(Common::Point(-15, 90)); + _actor4.setup(3402, 1, 1); + _actor4.animate(ANIM_MODE_1, NULL); + Common::Point pt1(115, 90); + NpcMover *mover1 = new NpcMover(); + _actor4.addMover(mover1, &pt1, this); + R2_GLOBALS._scrollFollower = &_actor4; + Common::Point pt2(203, 76); + NpcMover *mover2 = new NpcMover(); + _actor3.addMover(mover2, &pt2, NULL); + _sceneMode = 3401; + } + break; + case 3401: + _sceneMode = 3305; + _stripManager.start(3305, this); + break; + case 3402: + _sceneMode = 3306; + _stripManager.start(3306, this); + break; + case 3403: + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + _sceneMode = 3309; + _stripManager.start(3309, this); + break; + case 3405: + _sceneMode = 3310; + _stripManager.start(3310, this); + break; + case 3406: + _sceneMode = 3311; + _stripManager.start(3311, this); + break; + case 3407: + R2_GLOBALS._sceneManager.changeScene(3600); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 3500 - + * + *--------------------------------------------------------------------------*/ +Scene3500::Action1::Action1() { + _field1E = 0; + _field20 = 0; + _field22 = 0; + _field24 = 0; +} + +void Scene3500::Action1::synchronize(Serializer &s) { + Action::synchronize(s); + + s.syncAsSint16LE(_field1E); + s.syncAsSint16LE(_field20); + s.syncAsSint16LE(_field22); + s.syncAsSint16LE(_field24); +} + +void Scene3500::Action1::sub108670(int arg1) { + Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; + + _field1E = arg1; + _field20 = 1; + _field24 = 1; + + scene->_actor9.setStrip(2); + scene->_actor9.show(); + + if (_field1E == 1) + scene->_actor6.show(); + else + scene->_actor5.show(); + + if (scene->_actor1._frame % 2 == 0) + scene->_actor1._frameChange = _field1E; + scene->_actor1.setFrame(scene->_actor1.changeFrame()); + + setActionIndex(0); +} + +void Scene3500::Action1::sub108732(int arg1) { + Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; + + _field20 = arg1; + _field1E = -_field1E; + + if (_field1E == 1) { + scene->_actor6.show(); + scene->_actor5.hide(); + } else { + scene->_actor5.show(); + scene->_actor6.hide(); + } + + switch (_actionIndex) { + case 4: + scene->_actor1._frameChange = _field1E; + scene->_actor1.setFrame(scene->_actor1.changeFrame()); + // No break on purpose + case 3: + _actionIndex = 10; + setDelay(0); + break; + case 5: { + scene->_fieldAF8 = 160; + Common::Point pt(160, 73); + NpcMover *mover = new NpcMover(); + scene->_actor8.addMover(mover, &pt, NULL); + + scene->_fieldB9E = 160 - (_field1E * 2 * 160); + Common::Point pt2(scene->_fieldB9E, 73); + NpcMover *mover2 = new NpcMover(); + scene->_actor9.addMover(mover2, &pt2, this); + + _actionIndex = 11; + } + break; + case 6: + scene->_actor1._frameChange = _field1E; + scene->_actor1.setFrame(scene->_actor1.changeFrame()); + setDelay(1); + // No break on purpose + case 8: + scene->_actor9.setStrip(2); + _actionIndex = 1; + break; + default: + break; + } +} + +Scene3500::Action2::Action2() { + _field1E = 0; +} + +void Scene3500::Action2::synchronize(Serializer &s) { + Action::synchronize(s); + + s.syncAsSint16LE(_field1E); +} + +Scene3500::Item4::Item4() { + _field34 = 0; +} + +void Scene3500::Item4::synchronize(Serializer &s) { + NamedHotspot::synchronize(s); + + s.syncAsSint16LE(_field34); +} + +Scene3500::Actor7::Actor7() { + _fieldA4 = 0; + _fieldA6 = 0; + _fieldA8 = 0; + _fieldAA = 0; + _fieldAC = 0; + _fieldAE = 0; +} + +void Scene3500::Actor7::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_fieldA4); + s.syncAsSint16LE(_fieldA6); + s.syncAsSint16LE(_fieldA8); + s.syncAsSint16LE(_fieldAA); + s.syncAsSint16LE(_fieldAC); + s.syncAsSint16LE(_fieldAE); +} + +void Scene3500::Actor7::sub109466(int arg1, int arg2, int arg3, int arg4, int arg5) { + _fieldAE = 0; + _fieldA4 = arg1; + _fieldA6 = arg2; + _fieldA8 = arg3; + _fieldAA = arg4; + _fieldAC = _fieldAA / _fieldA8; + + postInit(); + setup(10501, 3, 1); + fixPriority(255); + sub109663(arg5); +} + +void Scene3500::Actor7::sub1094ED() { + Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; + + scene->_field1270 = _position.x - _fieldA4; +} + +void Scene3500::Actor7::sub109663(int arg1){ + sub109693(Common::Point(_fieldA4 + arg1, _fieldA6 - (_fieldAC * arg1))); +} + +void Scene3500::Actor7::sub109693(Common::Point Pt) { + setPosition(Pt); +} + +int Scene3500::UnkObject3500::sub1097C9(int arg1) { + return (_field2A / 2) + arg1 - (arg1 % _field2A); +} + +int Scene3500::UnkObject3500::sub1097EF(int arg1) { + return (_field2C / 2) + arg1 - (arg1 % _field2C); +} + +int Scene3500::UnkObject3500::sub109C09(Common::Point pt) { + int vx = pt.x / _field2A; + int vy = pt.y / _field2C; + + if ((vx >= 0) && (_field26 > vx) && (_field28 > vy)) { + return _field16[((_field26 * vy) + vx) * 2]; + } else + return -1; +} + +int Scene3500::UnkObject3500::sub109C5E(int &x, int &y) { + int retVal = sub51AFD(Common::Point(x, y)); + x = _field2E; + y = _field30; + + return retVal; +} + +Scene3500::Scene3500() { + _fieldAF8 = 0; + _fieldB9E = 0; + _rotation = NULL; + _field126E = 0; + _field1270 = 0; + _field1272 = 0; + _field1274 = 0; + _field1276 = 0; + _field1278 = 0; + _field127A = 0; + _field127C = 0; + _field127E = 0; + _field1280 = 0; + _field1282 = 0; + _field1284 = 0; + _field1286 = 0; +} + +void Scene3500::synchronize(Serializer &s) { + SceneExt::synchronize(s); + SYNC_POINTER(_rotation); + + s.syncAsSint16LE(_fieldAF8); + s.syncAsSint16LE(_fieldB9E); + s.syncAsSint16LE(_field126E); + s.syncAsSint16LE(_field1270); + s.syncAsSint16LE(_field1272); + s.syncAsSint16LE(_field1274); + s.syncAsSint16LE(_field1276); + s.syncAsSint16LE(_field1278); + s.syncAsSint16LE(_field127A); + s.syncAsSint16LE(_field127C); + s.syncAsSint16LE(_field127E); + s.syncAsSint16LE(_field1280); + s.syncAsSint16LE(_field1282); + s.syncAsSint16LE(_field1284); + s.syncAsSint16LE(_field1286); +} + +void Scene3500::sub107F71(int arg1) { + switch (arg1) { + case -1: + _actor7.sub1094ED(); + if (_field1270 != 0) { + _field1270--; + _actor7.sub109663(_field1270); + } + if (_action1._field24 != 0) + _field1270 = 0; + break; + case 1: + _actor7.sub1094ED(); + if (_field1270 < 16) { + ++_field1270; + _actor7.sub109663(_field1270); + } + if (_action1._field24 != 0) + _field1270 = 0; + break; + case 88: + if ((_action == 0) || (_action1._field24 == 0)) { + // The original makes a second useless check on action, skipped + _action2.sub10831F(2); + if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != 2))) { + _action2.signal(); + } else { + _actor9.setAction(&_action2, &_actor9, NULL); + } + } + break; + case 96: + if ((_action) && (_action1._field24 != 0) && (_action2._field1E != 1)) { + _field1278 = 0; + _action1.sub108732(0); + } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) { + _field1278 = arg1; + } else if ((_action) && (_action1._field24 == 0)) { + _action1.sub108670(1); + _action1.signal(); + } else if (_action == 0) { + _action1.sub108670(1); + setAction(&_action1, &_actor1, NULL); + } + break; + case 104: + if ((_action == 0) || (_action1._field24 == 0)) { + _action2.sub10831F(-1); + if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != -1))) { + _action2.signal(); + } else { + _actor9.setAction(&_action2, &_actor9, NULL); + } + } + break; + case 112: + if ((_action) && (_action1._field24 != 0) && (_action2._field1E != -1)) { + _field1278 = 0; + _action1.sub108732(0); + } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) { + _field1278 = arg1; + } else if ((_action) && (_action1._field24 == 0)) { + _action1.sub108670(-1); + _action1.signal(); + } else if (_action == 0) { + _action1.sub108670(-1); + setAction(&_action1, &_actor1, NULL); + } + break; + default: + _field1270 = arg1; + _actor7.sub109663(arg1); + if (_action1._field24 != 0) { + _field1270 = 0; + } + break; + } +} + +void Scene3500::Action1::signal() { + Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; + + switch(_actionIndex++) { + case 0: + R2_GLOBALS._player.disableControl(); + scene->_field1286 = 0; + if (scene->_field1270 != 0) { + scene->_field1270 = 0; + scene->_field126E = 0; + scene->_field1272 = 0; + scene->_rotation->_idxChange = 0; + } + break; + case 1: + if ((scene->_actor1._frame % 2) == 0) { + setDelay(1); + return; + } + // No break on purpose + case 3: + scene->_actor1._frameChange = _field1E; + scene->_actor1.setFrame(scene->_actor1.changeFrame()); + setDelay(1); + break; + case 4: { + int si = scene->_unkObj1.sub109C09(Common::Point(scene->_field127A + 70, scene->_field127C + 46)); + int var2 = scene->_unkObj1.sub1097C9(scene->_field127A + 70) - 70; + int var4 = scene->_unkObj1.sub1097EF(scene->_field127C + 46) - 46; + int di = abs(var2 - scene->_field127A); + int var6 = abs(var4 - scene->_field127C); + + if ((scene->_actor1._frame % 2) != 0) { + scene->_actor1._frameChange = _field1E; + scene->_actor1.setFrame(scene->_actor1.changeFrame()); + } + + int var8 = (scene->_action1._field1E * 2 + scene->_field1276); + if (var8 > 7) + var8 = 1; + else if (var8 < 1) + var8 = 7; + + switch (var8) { + case 0: + if ( ((si != 2) && (si != 3) && (si != 6) && (si != 1) && (si != 23) && (si != 24) && (si != 4) && (si != 11)) + || (var6 != 0)) { + if ((si != 25) && (si != 26) && (si != 5) && (si != 14) && (si != 15)) + _field20 = 0; + else if ((var6 != 0) || (di <= 3)) // useless, skipped: "|| (di == 0)" + _field20 = 0; + else + _field20 = 1; + } else + _field20 = 1; + break; + case 2: + if ( ((si != 12) && (si != 13) && (si != 11) && (si != 16) && (si != 26) && (si != 24) && (si != 15) && (si != 6) && (si != 31)) + || (di != 0)) { + if ((si != 25) && (si != 23) && (si != 14) && (si != 5) && (si != 4)) + _field20 = 0; + else if ((di != 0) || (var6 <= 3)) // useless, skipped: "|| (var6 == 0)" + _field20 = 0; + else + _field20 = 1; + } else + _field20 = 1; + break; + case 4: + if ( ((si != 2) && (si != 3) && (si != 6) && (si != 1) && (si != 25) && (si != 26) && (si != 5) && (si != 16) && (si != 31)) + || (var6 != 0)) { + if ((si != 23) && (si != 24) && (si != 4) && (si != 14) && (si != 15)) + _field20 = 0; + else if ((var6 != 0) || (di <= 3)) // useless, skipped: "|| (di == 0)" + _field20 = 0; + else + _field20 = 1; + } else + _field20 = 1; + break; + case 6: + if ( ((si != 12) && (si != 13) && (si != 11) && (si != 16) && (si != 25) && (si != 23) && (si != 14) && (si != 1) && (si != 31)) + || (var6 != 0)) { + if ((si != 26) && (si != 24) && (si != 15) && (si != 5) && (si != 4)) + _field20 = 0; + else if ((var6 <= 0) || (di != 0)) // useless, skipped: "|| (var6 == 0)" + _field20 = 0; + else + _field20 = 1; + } else + _field20 = 1; + default: + break; + } + } + // No break on purpose + case 2: { + scene->_actor8.setPosition(Common::Point(160, 73)); + scene->_actor8._moveDiff.x = 160 - scene->_field126E; + scene->_fieldAF8 = 160 - ((_field1E * 2) * 160); + Common::Point pt(scene->_fieldAF8, 73); + NpcMover *mover = new NpcMover(); + scene->_actor8.addMover(mover, &pt, this); + + scene->_actor9.setPosition(Common::Point(160 + ((_field1E * 2) * 160), 73));; + scene->_actor9._moveDiff.x = 160 - scene->_field126E; + scene->_fieldB9E = 160; + Common::Point pt2(scene->_fieldB9E, 73); + NpcMover *mover2 = new NpcMover(); + scene->_actor9.addMover(mover2, &pt2, NULL); + } + break; + case 5: + scene->_actor1._frameChange = _field1E; + scene->_field1276 = scene->_actor1.changeFrame(); + scene->_actor1.setFrame(scene->_field1276); + setDelay(1); + break; + case 6: + scene->_actor8.setPosition(Common::Point(160, 73)); + if (_field20 == 0) + scene->_actor8.setStrip(1); + else + scene->_actor8.setStrip(2); + scene->_actor8.fixPriority(1); + + scene->_actor9.setPosition(Common::Point(-160, 73)); + scene->_actor9.setStrip(9); + scene->_actor9.fixPriority(11); + scene->_actor9.hide(); + setDelay(1); + break; + case 7: + if ((scene->_actor1._frame % 2) == 0) { + scene->_actor1._frameChange = _field1E; + scene->_field1276 = scene->_actor1.changeFrame(); + scene->_actor1.setFrame(scene->_field1276); + } + setDelay(1); + break; + case 8: { + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + scene->_field1286 = 1; + if ((scene->_actor1._frame % 2) == 0) { + scene->_actor1._frameChange = _field1E; + scene->_actor1.setFrame(scene->_actor1.changeFrame()); + } + // All the var_8 initialization was missing in the original + // but it's clearly a cut and paste error from case 4. + // The following code allows the switch to work properly. + warning("Checkme: fix for dead code"); + int var_8 = (_field1E * 2 + scene->_field1276); + if (var_8 > 7) + var_8 = 1; + else if (var_8 < 1) + var_8 = 7; + // + + switch (var_8 - 1) { + case 0: + // No break on purpose + case 4: + scene->_field127A = scene->_unkObj1.sub1097C9(scene->_field127A + 70) - 70; + break; + case 2: + // No break on purpose + case 6: + scene->_field127C = scene->_unkObj1.sub1097EF(scene->_field127C + 46) - 46; + break; + default: + break; + } + scene->_actor5.hide(); + scene->_actor6.hide(); + _field24 = 0; + if (_field20 == 0) { + scene->_actor7.sub1094ED(); + if (scene->_field126E == scene->_field1270) + scene->_aSound1.play(276); + } + break; + } + case 10: { + scene->_fieldAF8 = 160; + Common::Point pt(160, 73); + NpcMover *mover = new NpcMover(); + scene->_actor8.addMover(mover, &pt, NULL); + + scene->_fieldB9E = 160 - (_field1E * 2 * 160); + Common::Point pt2(scene->_fieldB9E, 73); + NpcMover *mover2 = new NpcMover(); + scene->_actor9.addMover(mover2, &pt2, this); + _actionIndex = 6; + } + break; + case 11: { + scene->_actor8.setStrip(2); + scene->_actor8.setPosition(Common::Point(160, 73)); + scene->_fieldAF8 = 160 - (_field1E * 2 * 160); + Common::Point pt(scene->_fieldAF8, 73); + NpcMover *mover = new NpcMover(); + scene->_actor8.addMover(mover, &pt, NULL); + scene->_actor8.fixPriority(11); + if (_field20 == 0) + scene->_actor9.setStrip(1); + else + scene->_actor9.setStrip(2); + scene->_actor9.setPosition(Common::Point(160 - (_field1E * 2 * 160), 73)); + scene->_fieldB9E = 160; + Common::Point pt2(scene->_fieldB9E, 73); + NpcMover *mover2 = new NpcMover(); + scene->_actor9.addMover(mover2, &pt2, this); + scene->_actor9.fixPriority(1); + _actionIndex = 5; + } + break; + default: + break; + } +} + +void Scene3500::Action1::dispatch() { + Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; + + Action::dispatch(); + if ((_actionIndex == 1) && (scene->_field126E <= 4)) { + scene->_rotation->_idxChange = 0; + signal(); + } +} + +void Scene3500::Action2::sub10831F(int arg1) { + Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; + + _field1E = arg1; + if (_field1E == -1) + scene->_actor3.setFrame2(3); + else + scene->_actor3.setFrame2(1); + + setActionIndex(0); +} + +void Scene3500::Action2::signal() { + Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; + + int si; + int di; + + switch (_actionIndex++) { + case 0: { + if (scene->_actor8._mover) { + si = scene->_fieldAF8; + di = scene->_fieldB9E; + } else { + scene->_fieldAF8 = scene->_actor8._position.x; + si = scene->_fieldAF8; + scene->_fieldB9E = scene->_actor9._position.y; + di = scene->_fieldB9E; + } + + scene->_actor8._moveDiff.y = 9 - (scene->_field126E / 2); + Common::Point pt(si, 73 - (_field1E * 12)); + NpcMover *mover = new NpcMover(); + scene->_actor8.addMover(mover, &pt, NULL); + + scene->_actor9._moveDiff.y = 9 - (scene->_field126E / 2); + Common::Point pt2(di, 73 - (_field1E * 12)); + NpcMover *mover2 = new NpcMover(); + scene->_actor9.addMover(mover2, &pt2, NULL); + scene->_field126E = (scene->_field126E / 2) + (scene->_field126E % 2); + setDelay(17 - scene->_field126E); + } + break; + case 1: { + R2_GLOBALS._sound2.play(339); + if (scene->_actor8._mover) { + si = scene->_fieldAF8; + di = scene->_fieldB9E; + } else { + si = scene->_actor8._position.x; + di = scene->_actor9._position.x; + } + + scene->_actor7.sub1094ED(); + + scene->_actor8._moveDiff.y = 9 - (scene->_field126E / 2); + Common::Point pt(si, 73); + NpcMover *mover = new NpcMover(); + scene->_actor8.addMover(mover, &pt, NULL); + + scene->_actor9._moveDiff.y = 9 - (scene->_field126E / 2); + Common::Point pt2(di, 73); + NpcMover *mover2 = new NpcMover(); + scene->_actor9.addMover(mover2, &pt2, NULL); + + scene->_actor3.setFrame2(2); + } + break; + default: + break; + } +} + +bool Scene3500::Item4::startAction(CursorType action, Event &event) { + Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; + + if (scene->_field1286 == 0) + return true; + + if (scene->_field1286 != 4) + return SceneHotspot::startAction(action, event); + + R2_GLOBALS._sound2.play(14); + scene->sub107F71(_field34); + + return true; +} + +void Scene3500::Actor7::process(Event &event) { + Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; + + if (scene->_field1286 == 0) + return; + + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_USE) && (_bounds.contains(event.mousePos))) { + _fieldAE = 1 + event.mousePos.y - _position.y; + event.eventType = EVENT_NONE; + } + + if ((event.eventType == EVENT_BUTTON_UP) && (_fieldAE != 0)) { + _fieldAE = 0; + event.handled = true; + if (scene->_action1._field24 == 0) + sub1094ED(); + } + + if (_fieldAE == 0) + return; + + R2_GLOBALS._sound2.play(338); + event.handled = true; + + int cx = event.mousePos.y - _fieldAE + 1; + if (_fieldA6 >= cx) { + if (_fieldA6 - _fieldAA <= cx) + sub109693(Common::Point(((_fieldA6 - cx) / 2) + _fieldA4 + ((_fieldA6 - cx) % 2), cx)); + else + sub109693(Common::Point(_fieldA4 + _fieldA8, _fieldA6 - _fieldAA)); + } else { + sub109693(Common::Point(_fieldA4, _fieldA6)); + } +} + +bool Scene3500::Actor7::startAction(CursorType action, Event &event) { + Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; + + if (scene->_field1286 == 0) + return true; + + if (scene->_field1286 == 4) + return false; + + return SceneActor::startAction(action, event); +} + +void Scene3500::postInit(SceneObjectList *OwnerList) { + byte tmpPal[768]; + Rect tmpRect; + + loadScene(1050); + R2_GLOBALS._uiElements._active = false; + R2_GLOBALS._v5589E.set(0, 0, 320, 200); + R2_GLOBALS._sound1.play(305); + R2_GLOBALS._player._characterIndex = R2_QUINN; + R2_GLOBALS._player._characterScene[1] = 3500; + R2_GLOBALS._player._characterScene[2] = 3500; + R2_GLOBALS._player._characterScene[3] = 3500; + _field1284 = 0; + _field1282 = 0; + _field1278 = 0; + _field1272 = 1; + _field1270 = 4; + _field126E = 4; + _field127A = 860; + _field127C = 891; + _rotation = R2_GLOBALS._scenePalette.addRotation(240, 254, -1); + _rotation->setDelay(0); + _rotation->_idxChange = 1; + + for (int i = 240; i <= 254; i++) { + int tmpIndex = _rotation->_currIndex - 240; + + if (tmpIndex > 254) + tmpIndex--; + + tmpPal[3 * i] = R2_GLOBALS._scenePalette._palette[3 * tmpIndex]; + tmpPal[(3 * i) + 1] = R2_GLOBALS._scenePalette._palette[(3 * tmpIndex) + 1]; + tmpPal[(3 * i) + 2] = R2_GLOBALS._scenePalette._palette[(3 * tmpIndex) + 2]; + } + + for (int i = 240; i <= 254; i++) { + R2_GLOBALS._scenePalette._palette[3 * i] = tmpPal[3 * i]; + R2_GLOBALS._scenePalette._palette[(3 * i) + 1] = tmpPal[(3 * i) + 1]; + R2_GLOBALS._scenePalette._palette[(3 * i) + 2] = tmpPal[(3 * i) + 2]; + } + + _actor7.sub109466(38, 165, 16, 32, _field1270); + _actor7.setDetails(3500, 6, 7, -1, 1, (SceneItem *)NULL); + R2_GLOBALS._sound1.play(276); + + _item4._field34 = 88; + _item4.setDetails(88, 3500, 18, 10, -1); + + _item5._field34 = 112; + _item5.setDetails(112, 3500, 9, 10, -1); + + _item6._field34 = 104; + _item6.setDetails(104, 3500, 15, 10, -1); + + _item7._field34 = 96; + _item7.setDetails(96, 3500, 12, 10, -1); + + _actor8.postInit(); + _actor8.setup(10501, 1, 1); + _actor8.setPosition(Common::Point(160, 73)); + _actor8.fixPriority(1); + + _actor9.postInit(); + _actor9.setup(1050, 2, 1); + _actor9.setPosition(Common::Point(-160, 73)); + _actor9.fixPriority(11); + _actor9.hide(); + + _item2.setDetails(27, 3500, 21, -1, -1); + _item3.setDetails(Rect(160, 89, 299, 182), 3500, 3, -1, -1, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 3500, 0, -1, 2, 1, NULL); + + _actor1.postInit(); + _field1276 = 1; + _actor1.setup(1004, 1, _field1276); + _actor1.setPosition(Common::Point(230, 135)); + _actor1.fixPriority(200); + _actor1._frameChange = 1; + + _actor5.postInit(); + _actor5.setup(1004, 3, 1); + _actor5.setPosition(Common::Point(117, 163)); + _actor5.fixPriority(200); + _actor5.hide(); + + _actor4.postInit(); + _actor4.setup(1004, 3, 2); + _actor4.setPosition(Common::Point(126, 163)); + _actor4.fixPriority(200); + + _actor6.postInit(); + _actor6.setup(1004, 3, 3); + _actor6.setPosition(Common::Point(135, 163)); + _actor6.fixPriority(200); + _actor6.hide(); + + _actor2.postInit(); + _actor2.setup(1004, 4, _field126E + 1); + _actor2.setPosition(Common::Point(126, 137)); + _actor2.fixPriority(200); + + _actor3.postInit(); + _actor3.setup(1004, 5, 2); + _actor3.setPosition(Common::Point(126, 108)); + _actor3.fixPriority(200); + + tmpRect.set(160, 89, 299, 182); + _unkObj1.sub9EDE8(tmpRect); + _unkObj1.sub51AE9(2); + _unkObj1.sub51AFD(Common::Point(_field127A, _field127C)); + + _action1._field24 = 0; + warning("gfx_set_pane_p()"); + _unkObj1.sub51B02(); + warning("gfx_set_pane_p()"); + _field1286 = 1; + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._uiEnabled = false; + R2_GLOBALS._player._canWalk = false; +} + +void Scene3500::remove() { + _rotation->remove(); + R2_GLOBALS._sound2.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene3500::signal() { + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + _field1286 = 1; +} + +void Scene3500::process(Event &event) { + if (_field1286 == 0) + return; + + if (event.eventType == EVENT_KEYPRESS) { + switch (event.kbd.keycode) { + case Common::KEYCODE_1: + warning("FIXME: keycode = 0x4700"); + R2_GLOBALS._sound2.play(338); + sub107F71(16); + event.handled = true; + break; + case Common::KEYCODE_2: + warning("FIXME: keycode = 0x4800"); + R2_GLOBALS._sound2.play(14, NULL, 63); + sub107F71(88); + event.handled = true; + break; + case Common::KEYCODE_3: + warning("FIXME: keycode = 0x4900"); + if (_field1270 < 16) + R2_GLOBALS._sound2.play(338); + sub107F71(1); + event.handled = true; + break; + case Common::KEYCODE_4: + warning("FIXME: keycode = 0x4B00"); + R2_GLOBALS._sound2.play(14, NULL, 63); + sub107F71(112); + event.handled = true; + break; + case Common::KEYCODE_5: + warning("FIXME: keycode = 0x4D00"); + R2_GLOBALS._sound2.play(14, NULL, 63); + sub107F71(96); + event.handled = true; + break; + case Common::KEYCODE_6: + warning("FIXME: keycode = 0x4F00"); + R2_GLOBALS._sound2.play(338); + sub107F71(0); + event.handled = true; + break; + case Common::KEYCODE_7: + warning("FIXME: keycode = 0x5000"); + R2_GLOBALS._sound2.play(14, NULL, 63); + sub107F71(104); + event.handled = true; + break; + case Common::KEYCODE_8: + warning("FIXME: keycode = 0x5100"); + if (_field1270 != 0) + R2_GLOBALS._sound2.play(338); + sub107F71(-1); + event.handled = true; + break; + case Common::KEYCODE_9: + warning("FIXME: keycode = 0x5200"); + R2_GLOBALS._sound2.play(338); + sub107F71(8); + event.handled = true; + break; + case Common::KEYCODE_0: + warning("FIXME: keycode = 0x5300"); + R2_GLOBALS._sound2.play(338); + sub107F71(4); + event.handled = true; + break; + default: + break; + } + } + + if (!event.handled) + _actor7.process(event); + + if (!event.handled) + _item4.process(event); + + if (!event.handled) + _item5.process(event); + + if (!event.handled) + _item6.process(event); + + if (!event.handled) + _item7.process(event); + + Scene::process(event); +} + +void Scene3500::dispatch() { + Rect tmpRect; + Scene::dispatch(); + if (((_actor1._frame % 2) == 0) && (_action1._field24 == 0)) { + _actor1.setFrame(_actor1.changeFrame()); + _field1276 = _actor1._frame; + } + int oldField1278; + if ((_field1278 != 0) && (_action1._field24 == 0)) { + oldField1278 = _field1278; + _field1278 = 0; + sub107F71(oldField1278); + } + + if (!_rotation) + return; + + int var_field127A = 0; + int di = 0; + int var_4 = 0; + int var_6 = 0; + int var_8 = 0; + int var_a = 0; + int dx = 0; + int tmpVar = 0; + + if ((_field126E == 0) && (_field1282 == 0)) { + if (_field1284 == 2) + R2_GLOBALS._sceneManager.changeScene(1000); + } else { + _field1282 = 0; + tmpRect.set(160, 89, 299, 182); + + var_field127A = _field127A; + di = _field127C; + var_4 = _unkObj1.sub1097C9(70) - 70; + var_6 = _unkObj1.sub1097EF(_field127C + 46) - 46; + var_8 = abs(var_4 - var_field127A); + var_a = abs(var_6 - di); + dx = 0; + + switch (_field1276) { + case 0: + tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, 46)); + if ( ((tmpVar == 2) || (tmpVar == 3) || (tmpVar == 6) || (tmpVar == 1)) + || (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 > 3)) ) { + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else { + var_6 = _unkObj1.sub1097EF(di + 46) - 46; + di = _field127C - _field126E; + dx = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + if (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4)) && (tmpVar != dx)) { + di = var_6; + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else if ((tmpVar == 11) && (tmpVar != dx)) { + di = var_6 + 3; + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else { + var_6 = _unkObj1.sub1097EF(di + 46) - 46; + var_a = abs(var_6 - di); + tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + + if ( (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4)) && (di <= var_6) && (_field127C>= var_6)) + || (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (_field126E >= var_a) && (_field126E > 3) && (_action1._field24 != 0)) ) { + di = var_6; + if ((tmpVar != 25) && (tmpVar != 26) && (tmpVar != 5) && (tmpVar != 14) && (tmpVar == 15)) + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else if ((tmpVar == 11) && (var_6 + 3 >= di) && (_field127C >= var_6 + 3)) { + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else if (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 != 0) && (var_8 <= 3)) { + var_field127A = var_4; + R2_GLOBALS._sound2.play(339); + } else { + // Nothing + } + } + } + break; + case 2: + tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + if ( ((tmpVar == 12) || (tmpVar == 13) || (tmpVar == 11) || (tmpVar == 16) || (tmpVar == 31)) + || (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (var_a > 3)) ) { + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else { + var_4 = _unkObj1.sub1097C9(var_field127A + 70) - 70; + var_field127A = _field127A + _field126E; + dx = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + if (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15)) && (tmpVar != dx)) { + var_field127A = var_4; + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else if ((tmpVar == 6) && (tmpVar != dx)) { + var_field127A = var_4 - 5; + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else { + var_4 = _unkObj1.sub1097C9(var_field127A + 70) - 70; + var_8 = abs(var_field127A - var_4); + tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, tmpVar + 46)); + if ( (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15)) && (var_field127A >= var_4) && (_field127A <= var_4)) + || (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (_field126E >= var_8) && (_field126E <= 3) && (_action1._field24 != 0)) ) { + var_field127A = var_4; + if ((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else if ((tmpVar == 6) && (var_4 - 5 <= var_field127A) && (_field127A <= var_4 - 5)) { + var_field127A = var_4 - 5; + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else if (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (var_a != 0) && (var_a <= 3)) { + di = var_6; + R2_GLOBALS._sound2.play(339); + } else { + // Nothing + } + } + } + break; + case 4: + tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + if ( ((tmpVar == 2) || (tmpVar == 3) || (tmpVar == 6) || (tmpVar == 1)) + || (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 > 3)) ) { + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else { + var_6 = _unkObj1.sub1097EF(di + 46) - 46; + di = _field127C + _field126E; + dx = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + if (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5)) && (tmpVar == dx)) { + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else if ((tmpVar == 16) && (tmpVar == dx)) { + di = var_6 - 3; + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else if ((tmpVar == 31) && (tmpVar == dx)) { + di = var_6 + 4; + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else { + var_6 = _unkObj1.sub1097EF(di + 46) - 46; + var_a = abs(di - var_6); + tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + if ( (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5)) && (di >= var_6) && (_field127C <= var_6)) + || (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (_field126E >= var_a) && (_field126E <= 3) && (_action1._field24 != 0)) ){ + if ((tmpVar != 23) && (tmpVar != 24) && (tmpVar != 4) && (tmpVar != 14) && (tmpVar != 15)) + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else if ((tmpVar == 16) && (var_6 - 3 <= di) && (_field127C <= var_6 - 3)) { + di = var_6 - 3; + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else if ((tmpVar == 31) && (var_6 + 4 <= di) && (_field127C <= var_6 + 4)) { + di = var_6 + 4; + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + if ((var_field127A == 660) && (_field126E + 306 <= di) && (di <= 307)) + ++_field1284; + else + R2_GLOBALS._sound2.play(339); + } else if (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 != 0) && (var_8 <= 3)) { + var_field127A = var_4; + R2_GLOBALS._sound2.play(339); + } else { + // Nothing + } + } + } + break; + case 6: + tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + if ( ((tmpVar == 12) || (tmpVar == 13) || (tmpVar == 11) || (tmpVar == 16) || (tmpVar == 31)) + || (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (var_a > 3)) ) { + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else { + var_4 = _unkObj1.sub1097C9(var_field127A + 70) - 70; + var_field127A = _field127A - _field126E; + dx = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + if (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14)) && (tmpVar != dx)) { + var_field127A = var_4; + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else if ((tmpVar == 1) && (tmpVar != dx)) { + var_field127A = var_4 + 5; + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else { + var_4 = _unkObj1.sub1097C9(var_field127A + 70) - 70; + var_8 = abs(var_4 - var_field127A); + tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + if ( (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14)) && (var_field127A <= var_4) && (_field127A >= var_4)) + || (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (_field126E >= var_8) && (_field126E <= 3) && (_action1._field24 != 0)) ) { + var_field127A = var_4; + if ((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else if ((tmpVar == 1) && (var_field127A >= var_4 + 5) && (_field127A >= var_4 + 5)) { + var_field127A = var_4 + 5; + R2_GLOBALS._sound2.play(339); + _rotation->_idxChange = 0; + _field1270 = 0; + _field126E = 0; + _field1272 = 0; + if (_action1._field24 == 0) + _actor8.hide(); + } else if (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (var_a != 0) && (var_a <= 3)) { + di = var_6; + R2_GLOBALS._sound2.play(339); + } else { + // Nothing + } + } + } + break; + default: + break; + } + + if (_field1284 < 2) { + _field127A = var_field127A; + _field127C = di; + if (_unkObj1.sub109C5E(_field127A, _field127C) != 0) { + _field1272 = 0; + _field126E = 0; + _field1270 = 0; + _rotation->setDelay(0); + _rotation->_idxChange = 0; + } + warning("gfx_set_pane_p"); + _unkObj1.sub51B02(); + if (_field1284 != 0) + ++_field1284; + } + } + + if (_field1272 == 0) { + if (_field126E != _field1270) { + if (_field126E >= _field1270) { + if (_field126E == 1) { + if (_action1._field24 != 0) { + if ( ((_field1276 == 1) && (var_8 == 0) && (var_a != 0) && (var_a <= 3) && ((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15))) + || ((_field1276 == 3) && (var_a == 0) && (var_8 != 0) && (var_8 <= 3) && ((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4))) + || ((_field1276 == 5) && (var_8 == 0) && (var_a != 0) && (var_a <= 3) && ((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15))) + || ((_field1276 == 7) && (var_a == 0) && (var_8 != 0) && (var_8 <= 3) && ((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4))) ){ + _field126E = 1; + } else + _field126E--; + } else + _field126E--; + } else + _field126E--; + } else + ++_field126E; + _field1272 = 1; + } + _actor2.setFrame2(_field126E); + } + + if (_field1272 == 1) { + if (_field126E == 0) + _rotation->_idxChange = 0; + else if (_field126E > 8) + _rotation->_idxChange = 2; + else + _rotation->_idxChange = 1; + } + + if (_field1272 != 0) + _field1272--; + + if (_field126E != 0) { + R2_GLOBALS._player._uiEnabled = false; + if (_field126E != _field1270) + _aSound1.play(276); + } else { + R2_GLOBALS._player._uiEnabled = true; + _aSound1.fadeOut2(NULL); + } + + if (_rotation->_currIndex != _field1274) + _field1274 = _rotation->_currIndex; +} + +/*-------------------------------------------------------------------------- + * Scene 3600 - + * + *--------------------------------------------------------------------------*/ +Scene3600::Scene3600() { + _field2548 = 0; + _field254A = 0; + _field254C = 0; + _field254E = 0; + _field2550 = false; +} +void Scene3600::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field2548); + s.syncAsSint16LE(_field254A); + s.syncAsSint16LE(_field254C); + s.syncAsSint16LE(_field254E); + s.syncAsSint16LE(_field2550); +} + +Scene3600::Action3600::Action3600() { + _field1E = 0; + _field20 = 0; +} + +void Scene3600::Action3600::synchronize(Serializer &s) { + Action::synchronize(s); + + s.syncAsSint16LE(_field1E); + s.syncAsSint16LE(_field20); +} + +void Scene3600::Action3600::signal() { + Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex) { + case 0: + ++_actionIndex; + setDelay(60); + break; + case 1: + if (_field1E == 0) { + _field1E = 1; + scene->_actor2.setAction(NULL); + R2_GLOBALS._sound2.play(330, NULL, 0); + R2_GLOBALS._sound2.fade(127, 5, 10, false, NULL); + } + setDelay(1); + warning("TODO: Palette fader using parameter 2 = 256"); + R2_GLOBALS._scenePalette.fade((const byte *)&scene->_palette1._palette, true, _field20); + if (_field20 > 0) + _field20 -= 2; + break; + case 2: + R2_GLOBALS._sound2.stop(); + ++_actionIndex; + setDelay(3); + break; + case 3: + R2_GLOBALS._sound2.play(330, this, 0); + R2_GLOBALS._sound2.fade(127, 5, 10, false, NULL); + _actionIndex = 1; + break; + default: + break; + } +} + +void Scene3600::Action2::signal() { + Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex) { + case 3621: + R2_GLOBALS._events.proc1(); + R2_GLOBALS._player.enableControl(); + _actionIndex = 3619; + scene->_actor13._state = 0; + // No break on purpose + case 3619: { + ++_actionIndex; + scene->_actor13.setup(3127, 2, 1); + scene->_actor13.animate(ANIM_MODE_1, NULL); + NpcMover *mover = new NpcMover(); + scene->_actor13.addMover(mover, &scene->_actor13._field8A, scene); + } + break; + default: + _actionIndex = 3619; + setDelay(360); + break; + } +} + +bool Scene3600::Item5::startAction(CursorType action, Event &event) { + Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; + + if ((action != CURSOR_USE) || (scene->_action1._field1E == 0)) + return SceneItem::startAction(action, event); + + R2_GLOBALS._walkRegions.disableRegion(2); + R2_GLOBALS._walkRegions.disableRegion(7); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3624; + scene->_actor10.setStrip2(-1); + scene->_actor11.setStrip2(-1); + scene->_actor12.setStrip2(-1); + scene->_actor4.setStrip2(-1); + + if (R2_GLOBALS._player._characterIndex == 2) + R2_GLOBALS._player.setAction(&scene->_sequenceManager3, scene, 3611, &R2_GLOBALS._player, NULL); + else if (R2_GLOBALS._player._characterIndex == 3) + R2_GLOBALS._player.setAction(&scene->_sequenceManager4, scene, 3612, &R2_GLOBALS._player, NULL); + else + R2_GLOBALS._player.setAction(&scene->_sequenceManager2, scene, 3610, &R2_GLOBALS._player, NULL); + + return true; +} + +bool Scene3600::Actor13::startAction(CursorType action, Event &event) { + Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; + + switch(action) { + case CURSOR_TALK: + if (!_action) + return SceneActor::startAction(action, event); + + scene->_protectorSpeaker._displayMode = 1; + if (!R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + if (!scene->_actor10._mover) + scene->_actor10.addMover(NULL); + if (!scene->_actor11._mover) + scene->_actor11.addMover(NULL); + if (!scene->_actor12._mover) + scene->_actor12.addMover(NULL); + if (!scene->_actor4._mover) + scene->_actor4.addMover(NULL); + + setup(3127, 2, 1); + scene->_sceneMode = 3327; + scene->_stripManager.start(3327, scene); + + return true; + case R2_SONIC_STUNNER: + // No break on purpose + case R2_PHOTON_STUNNER: + if (action == R2_SONIC_STUNNER) + R2_GLOBALS._sound3.play(43); + else + R2_GLOBALS._sound3.play(99); + if (_state != 0) { + _state = 1; + setup(3128, 1, 1); + addMover(NULL); + } + scene->_action2.setActionIndex(3621); + + if (!_action) + setAction(&scene->_action2, scene, NULL); + + animate(ANIM_MODE_5, &scene->_action2); + R2_GLOBALS._player.disableControl(); + return true; + break; + default: + return SceneActor::startAction(action, event); + break; + } +} + +void Scene3600::postInit(SceneObjectList *OwnerList) { + if (R2_GLOBALS._sceneManager._previousScene == 3600) { + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + R2_GLOBALS._v558B6.set(60, 0, 260, 200); + } else { + R2_GLOBALS._scrollFollower = &_actor2; + g_globals->gfxManager()._bounds.moveTo(Common::Point(160, 0)); + R2_GLOBALS._v558B6.set(25, 0, 260, 200); + } + + loadScene(3600); + SceneExt::postInit(); + _field254C = 0; + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + _stripManager.addSpeaker(&_mirandaSpeaker); + _stripManager.addSpeaker(&_tealSpeaker); + _stripManager.addSpeaker(&_protectorSpeaker); + + setZoomPercents(142, 80, 167, 105); + R2_GLOBALS._player._characterScene[1] = 3600; + R2_GLOBALS._player._characterScene[2] = 3600; + R2_GLOBALS._player._characterScene[3] = 3600; + + _item2.setDetails(33, 3600, 6, -1, -1); + _item3.setDetails(Rect(3, 3, 22, 45), 3600, 9, -1, -1, 1, NULL); + _item4.setDetails(Rect(449, 3, 475, 45), 3600, 9, -1, -1, 1, NULL); + + _actor10.postInit(); + _actor10._moveDiff = Common::Point(3, 2); + _actor10.changeZoom(-1); + _actor10._effect = 1; + + if (R2_GLOBALS._player._characterIndex != 1) + _actor10.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL); + + _actor11.postInit(); + _actor11._numFrames = 7; + _actor11._moveDiff = Common::Point(5, 3); + _actor11.changeZoom(-1); + _actor11._effect = 1; + + if (R2_GLOBALS._player._characterIndex != 2) + _actor11.setDetails(9002, 1, -1, -1, 1, (SceneItem *) NULL); + + _actor12.postInit(); + _actor12._moveDiff = Common::Point(3, 2); + _actor12.changeZoom(-1); + _actor12._effect = 1; + + if (R2_GLOBALS._player._characterIndex != 3) + _actor12.setDetails(9003, 1, -1, -1, 1, (SceneItem *) NULL); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.changeZoom(-1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _actor4.postInit(); + _actor4._numFrames = 7; + _actor4._moveDiff = Common::Point(5, 3); + _actor4.changeZoom(-1); + _actor4._effect = 1; + _actor4.setDetails(3600, 27, -1, -1, 1, (SceneItem *) NULL); + + _actor5.postInit(); + _actor5._numFrames = 7; + _actor5._moveDiff = Common::Point(3, 2); + _actor5.changeZoom(-1); + _actor5._effect = 1; + _actor5.setDetails(3600, 12, -1, -1, 1, (SceneItem *) NULL); + + _palette1.loadPalette(0); + _palette1.loadPalette(3601); + + if (R2_GLOBALS._sceneManager._previousScene == 3600) { + _item5._sceneRegionId = 200; + _item5.setDetails(3600, 30, -1, -1, 5, &_actor4); + _field254A = 1; + _field2548 = 1; + + R2_GLOBALS._walkRegions.enableRegion(2); + R2_GLOBALS._walkRegions.enableRegion(7); + R2_GLOBALS._walkRegions.enableRegion(14); + R2_GLOBALS._walkRegions.enableRegion(15); + R2_GLOBALS._walkRegions.enableRegion(16); + + _actor10.setup(10, 5, 11); + _actor10.animate(ANIM_MODE_1, NULL); + + _actor11.setup(20, 5, 11); + _actor11.animate(ANIM_MODE_1, NULL); + + _actor12.setup(30, 5, 11); + _actor12.animate(ANIM_MODE_1, NULL); + + if (R2_GLOBALS._player._characterIndex == 2) { + _actor10.setPosition(Common::Point(76, 148)); + _actor11.setPosition(Common::Point(134, 148)); + _actor12.setPosition(Common::Point(100, 148)); + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + R2_GLOBALS._player.setup(20, _actor11._strip, 1); + R2_GLOBALS._player.setPosition(_actor11._position); + _actor11.hide(); + } else if (R2_GLOBALS._player._characterIndex == 3) { + _actor10.setPosition(Common::Point(110, 148)); + _actor11.setPosition(Common::Point(76, 148)); + _actor12.setPosition(Common::Point(134, 148)); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.setup(30, _actor12._strip, 1); + R2_GLOBALS._player.setPosition(_actor12._position); + _actor12.hide(); + } else { + _actor10.setPosition(Common::Point(134, 148)); + _actor11.setPosition(Common::Point(76, 148)); + _actor12.setPosition(Common::Point(110, 148)); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.setup(10, _actor10._strip, 1); + R2_GLOBALS._player.setPosition(_actor10._position); + _actor10.hide(); + } + _actor4.setPosition(Common::Point(47, 149)); + _actor4.setup(40, 1, 11); + _actor4.animate(ANIM_MODE_1, NULL); + + _actor5.setPosition(Common::Point(367, 148)); + _actor5.setup(3601, 7, 5); + + if (!R2_GLOBALS.getFlag(71)) { + _actor13.postInit(); + _actor13._state = 0; + _actor13._field8A = Common::Point(226, 152); + _actor13._moveDiff = Common::Point(3, 2); + _actor13.setPosition(Common::Point(284, 152)); + _actor13.setup(3127, 2, 1); + _actor13.changeZoom(-1); + _actor13.setDetails(3600, 15, -1, 17, 1, (SceneItem *) NULL); + } + + R2_GLOBALS._sound2.play(330); + _actor3.postInit(); + _actor3.setPosition(Common::Point(84, 156)); + _actor3.fixPriority(158); + _actor3.setup(3601, 5, 1); + _actor3.animate(ANIM_MODE_2, NULL); + + _action1._field1E = 1; + _action1._field20 = 0; + _action1.setActionIndex(1); + + _actor3.setAction(&_action1); + _sceneMode = 3623; + + g_globals->_events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + } else { + _field254A = 0; + _field2548 = 0; + + R2_GLOBALS._walkRegions.enableRegion(17); + R2_GLOBALS._walkRegions.enableRegion(18); + + _actor10.setPosition(Common::Point(393, 148)); + _actor11.setPosition(Common::Point(364, 153)); + _actor12.setPosition(Common::Point(413, 164)); + + R2_GLOBALS._player.hide(); + + _actor4.setPosition(Common::Point(373, 164)); + + _actor5.setup(3403, 8, 11); + _actor5.setPosition(Common::Point(403, 155)); + + _actor12.setup(3403, 7, 1); + + _actor13.setPosition(Common::Point(405, 155)); + + _actor2.postInit(); + _actor2.setup(3600, 2, 1); + _actor2.setPosition(Common::Point(403, 161)); + _actor2.fixPriority(149); + _actor2.changeZoom(-1); + + _action1._field1E = 0; + _action1._field20 = 90; + + _sceneMode = 3600; + setAction(&_sequenceManager1, this, 3600, &_actor11, &_actor10, &_actor12, &_actor4, &_actor5, &_actor2, NULL); + _field254E = 0; + } + _field254E = 0; + _field2550 = R2_GLOBALS.getFlag(71); + + R2_GLOBALS._sound1.play(326); + _item1.setDetails(Rect(0, 0, 480, 200), 3600, 0, -1, -1, 1, NULL); +} + +void Scene3600::remove() { + _actor3.animate(ANIM_MODE_NONE, NULL); + _actor3.setAction(NULL); + R2_GLOBALS._sound2.fadeOut2(NULL); + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + SceneExt::remove(); +} + +void Scene3600::signal() { + switch (_sceneMode) { + case 3320: + warning("STUB: sub_1D227()"); + R2_GLOBALS._walkRegions.enableRegion(14); + R2_GLOBALS._scrollFollower = &_actor11; + _tealSpeaker._object1.hide(); + _actor5.show(); + _actor5.setStrip(2); + if (R2_GLOBALS._player._characterIndex == 2) + _sceneMode = 3602; + else if (R2_GLOBALS._player._characterIndex == 3) + _sceneMode = 3603; + else + _sceneMode = 3601; + setAction(&_sequenceManager1, this, _sceneMode, &_actor11, &_actor10, &_actor12, &_actor4, &_actor5, NULL); + break; + case 3321: + warning("STUB: sub_1D227()"); + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + _tealSpeaker.proc16(); + _actor5.show(); + _actor5.setStrip(1); + _actor3.postInit(); + _sceneMode = 3604; + setAction(&_sequenceManager1, this, _sceneMode, &_actor5, &_actor3, &_actor10, &_actor11, &_actor12, &_actor4, NULL); + break; + case 3322: + warning("STUB: sub_1D227()"); + _quinnSpeaker.proc16(); + _quinnSpeaker._displayMode = 1; + _tealSpeaker.proc16(); + _tealSpeaker._displayMode = 7; + R2_GLOBALS._scrollFollower = &_actor5; + _sceneMode = 3605; + setAction(&_sequenceManager1, this, _sceneMode, &_actor5, &_actor13, &_actor2, NULL); + break; + case 3323: + if (_field254A == 0) + _field254A = 1; + else { + warning("STUB: sub_1D227()"); + _protectorSpeaker.proc16(); + _actor13.show(); + _actor13.setup(3258, 6, 1); + _sceneMode = 3607; + _actor13.setAction(&_sequenceManager1, this, _sceneMode, &_actor13, NULL); + R2_GLOBALS._v558C2 = 1; + _protectorSpeaker.proc16(); + _protectorSpeaker._displayMode = 1; + _quinnSpeaker._displayMode = 1; + _actor13.show(); + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + R2_GLOBALS._walkRegions.disableRegion(17); + R2_GLOBALS._walkRegions.disableRegion(18); + R2_GLOBALS._walkRegions.enableRegion(2); + R2_GLOBALS._walkRegions.enableRegion(7); + R2_GLOBALS._walkRegions.enableRegion(14); + R2_GLOBALS._walkRegions.enableRegion(15); + R2_GLOBALS._walkRegions.enableRegion(16); + _actor13.setAction(&_action1); + } + break; + case 3324: + // No break on purpose + case 3607: + g_globals->_events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + _actor13.fixPriority(-1); + _sceneMode = 3623; + _field2548 = 1; + break; + case 3327: + g_globals->_events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + _sceneMode = 3623; + break; + case 3450: + R2_GLOBALS._sound1.stop(); + _actor1.hide(); + _actor6.hide(); + g_globals->gfxManager()._bounds.moveTo(Common::Point(40, 0)); + setZoomPercents(142, 80, 167, 105); + loadScene(3600); + R2_GLOBALS._uiElements.show(); + _item5._sceneRegionId = 200; + _item5.setDetails(3600, 30, -1, -1, 5, &_actor4); + + _actor3.show(); + _actor10.show(); + _actor11.show(); + _actor12.show(); + _actor4.show(); + _actor5.show(); + + _actor5.setPosition(Common::Point(298, 151)); + + _actor13.postInit(); + _actor13._state = 0; + _actor13._field8A = Common::Point(226, 152); + _actor13._moveDiff = Common::Point(5, 3); + _actor13.setup(3403, 7, 1); + _actor13.setPosition(Common::Point(405, 155)); + _actor13.changeZoom(-1); + _actor13.addMover(NULL); + _actor13.animate(ANIM_MODE_NONE); + _actor13.hide(); + _actor13.setDetails(3600, 15, -1, 17, 5, &_item5); + + _actor2.setup(3600, 2, 1); + _actor2.setPosition(Common::Point(403, 161)); + _actor2.fixPriority(149); + _actor2.changeZoom(-1); + _actor2.show(); + + _quinnSpeaker._displayMode = 2; + _tealSpeaker._displayMode = 2; + + if (R2_GLOBALS._player._characterIndex == 2) { + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + R2_GLOBALS._player.setup(20, _actor11._strip, 1); + R2_GLOBALS._player.setPosition(_actor11._position); + _actor11.hide(); + } else if (R2_GLOBALS._player._characterIndex == 3) { + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.setup(30, _actor12._strip, 1); + R2_GLOBALS._player.setPosition(_actor12._position); + _actor12.hide(); + } else { + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.setup(10, _actor10._strip, 1); + R2_GLOBALS._player.setPosition(_actor10._position); + _actor10.hide(); + } + R2_GLOBALS._player.show(); + R2_GLOBALS._sound1.play(326); + _sceneMode = 3322; + _stripManager.start(3322, this); + R2_GLOBALS._sound2.play(329); + break; + case 3600: + _sceneMode = 3320; + _stripManager.start(3320, this); + break; + case 3601: + // No break on purpose + case 3602: + // No break on purpose + case 3603: + R2_GLOBALS._walkRegions.enableRegion(2); + R2_GLOBALS._walkRegions.enableRegion(7); + R2_GLOBALS._v558B6.set(60, 0, 260, 200); + _tealSpeaker._displayMode = 1; + _sceneMode = 3321; + _stripManager.start(3321, this); + break; + case 3604: + R2_GLOBALS._sound2.fadeOut2(NULL); + R2_GLOBALS._sound1.stop(); + R2_GLOBALS._walkRegions.disableRegion(2); + R2_GLOBALS._walkRegions.disableRegion(7); + + _actor2.hide(); + _actor3.hide(); + R2_GLOBALS._player.hide(); + _actor10.hide(); + _actor11.hide(); + _actor12.hide(); + _actor4.hide(); + _actor5.hide(); + + g_globals->gfxManager()._bounds.moveTo(Common::Point(60, 0)); + setZoomPercents(51, 46, 180, 200); + + loadScene(3400); + R2_GLOBALS._uiElements.show(); + _actor1.postInit(); + + _actor2.setup(3403, 1, 1); + _actor2.setPosition(Common::Point(190, 103)); + _actor2.fixPriority(89); + _actor2.show(); + + _actor6.postInit(); + _actor6.setup(3400, 1, 6); + _actor6.setPosition(Common::Point(236, 51)); + _actor6.fixPriority(51); + R2_GLOBALS._scrollFollower = &_actor6; + + R2_GLOBALS._sound1.play(323); + _sceneMode = 3450; + setAction(&_sequenceManager1, this, 3450, &_actor1, &_actor6, NULL); + break; + case 3605: + _actor13.setup(3258, 4, 1); + _actor13.setAction(&_sequenceManager1, this, 3606, &_actor5, &_actor13, &_actor2, NULL); + _sceneMode = 3323; + _stripManager.start(3323, this); + + break; + case 3620: + // No break on purpose + case 3623: + if ((_actor13._position.x == 226) && (_actor13._position.y == 152) && (_action1._field1E != 0) && (_actor13._visage == 3127) && (!R2_GLOBALS.getFlag(71))) { + R2_GLOBALS._sound2.stop(); + R2_GLOBALS._sound2.play(331); + R2_GLOBALS.setFlag(71); + _sceneMode = 3626; + setAction(&_sequenceManager1, this, 3626, &_actor13, NULL); + } + break; + case 3624: + R2_GLOBALS._player.disableControl(); + if ((_field254E != 0) && (_actor10._position.x == 229) && (_actor10._position.y == 154) && (_actor11._position.x == 181) && (_actor11._position.y == 154) && (_actor12._position.x == 207) && (_actor12._position.y == 154) && (_actor4._position.x == 155) && (_actor4._position.y == 154)) { + R2_GLOBALS._sound2.stop(); + R2_GLOBALS._sound2.play(331); + _sceneMode = 3625; + setAction(&_sequenceManager1, this, 3625, &_actor10, &_actor11, &_actor12, &_actor4, NULL); + } + break; + case 3625: + R2_GLOBALS._sound2.stop(); + R2_GLOBALS._sceneManager.changeScene(3700); + break; + case 3626: + _actor13.setPosition(Common::Point(0, 0)); + _action1.setActionIndex(2); + if (R2_GLOBALS._events.getCursor() > R2_LAST_INVENT) { + R2_GLOBALS._events.setCursor(CURSOR_USE); + R2_GLOBALS._player.enableControl(CURSOR_USE); + } else { + R2_GLOBALS._player.enableControl(); + } + R2_GLOBALS._sound2.stop(); + _sceneMode = 3623; + break; + default: + break; + } +} + +void Scene3600::process(Event &event) { + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_ARROW) && (event.mousePos.x > 237) && (!R2_GLOBALS.getFlag(71))) { + SceneItem::display(3600, 17, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7 -999); + event.handled = true; + } + Scene::process(event); +} + +void Scene3600::dispatch() { + if ((R2_GLOBALS._player.getRegionIndex() == 200) && (_action1._field1E != 0) && (_field254E == 0)){ + R2_GLOBALS._sound2.fadeOut2(NULL); + if (_actor13._mover) + _actor13.addMover(NULL); + if (R2_GLOBALS._player._action) + R2_GLOBALS._player.setAction(NULL); + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + + _field254C = 0; + _field254E = 1; + + R2_GLOBALS._walkRegions.disableRegion(2); + R2_GLOBALS._walkRegions.disableRegion(7); + R2_GLOBALS._player.disableControl(); + + _sceneMode = 3624; + + _actor10.setStrip(-1); + _actor11.setStrip(-1); + _actor12.setStrip(-1); + _actor4.setStrip(-1); + + R2_GLOBALS._player.hide(); + + if (R2_GLOBALS._player._characterIndex == 2) { + _actor11.setPosition(R2_GLOBALS._player._position); + _actor11.show(); + } else if (R2_GLOBALS._player._characterIndex == 3) { + _actor12.setPosition(R2_GLOBALS._player._position); + _actor12.show(); + } else { + _actor10.setPosition(R2_GLOBALS._player._position); + _actor10.show(); + } + _actor10.setAction(&_sequenceManager2, this, 3610, &_actor10, NULL); + _actor11.setAction(&_sequenceManager3, this, 3611, &_actor11, NULL); + _actor12.setAction(&_sequenceManager4, this, 3612, &_actor12, NULL); + _actor4.setAction(&_sequenceManager1, this, 3613, &_actor4, NULL); + } + + if ((_actor13.getRegionIndex() == 200) && (_action1._field1E != 0) && (_field254E == 0)){ + R2_GLOBALS._sound2.fadeOut2(NULL); + _sceneMode = 3620; + _field2550 = 1; + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + if (_actor10._mover) + _actor10.addMover(NULL); + if (_actor11._mover) + _actor11.addMover(NULL); + if (_actor12._mover) + _actor12.addMover(NULL); + if (_actor4._mover) + _actor4.addMover(NULL); + } + Scene::dispatch(); +} + +/*-------------------------------------------------------------------------- + * Scene 3700 - Cutscene - Teleport outside + * + *--------------------------------------------------------------------------*/ +void Scene3700::postInit(SceneObjectList *OwnerList) { + loadScene(3700); + R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + _stripManager.addSpeaker(&_mirandaSpeaker); + + _actor1.postInit(); + _actor1._moveDiff = Common::Point(3, 2); + + _actor2.postInit(); + _actor2._numFrames = 7; + _actor2._moveDiff = Common::Point(5, 3); + _actor2.hide(); + + _actor3.postInit(); + _actor3._moveDiff = Common::Point(3, 2); + _actor3.hide(); + + _actor4.postInit(); + _actor4._numFrames = 7; + _actor4._moveDiff = Common::Point(5, 3); + _actor4.hide(); + + _actor5.postInit(); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._sound1.play(332); + + _sceneMode = 3700; + setAction(&_sequenceManager, this, 3700, &_actor1, &_actor2, &_actor3, &_actor4, &_actor5, NULL); +} + +void Scene3700::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene3700::signal() { + switch (_sceneMode) { + case 3328: + // No break on purpose + case 3329: + warning("STUB: sub_1D227()"); + _sceneMode = 3701; + setAction(&_sequenceManager, this, 3701, &_actor2, &_actor3, &_actor4, NULL); + break; + case 3700: + _actor1.setup(10, 6, 1); + _actor2.setup(20, 5, 1); + if (R2_GLOBALS.getFlag(71)) { + _sceneMode = 3329; + _stripManager.start(3329, this); + } else { + _sceneMode = 3328; + _stripManager.start(3328, this); + } + break; + case 3701: + R2_GLOBALS._sceneManager.changeScene(1000); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 3800 - + * + *--------------------------------------------------------------------------*/ +Scene3800::Scene3800() { + _field412 = 0; +} +void Scene3800::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); +} + +void Scene3800::Exit1::changeScene() { + Scene3800 *scene = (Scene3800 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + scene->_field412 = 1; + + if (R2_GLOBALS.getFlag(46)) { + if (scene->_field412 == R2_GLOBALS._v566A9) { + R2_GLOBALS._v566AA = 3; + if (R2_GLOBALS._v56A93 + 1 == 0) { + R2_GLOBALS._v566A8--; + R2_GLOBALS._v566A9 = 0; + } else { + R2_GLOBALS._v566A9 = R2_GLOBALS._v566AB[R2_GLOBALS._v56A93]; + R2_GLOBALS._v56A93--; + } + } else { + ++R2_GLOBALS._v56A93; + if (R2_GLOBALS._v56A93 > 999) + R2_GLOBALS._v56A93 = 999; + R2_GLOBALS._v566AB[R2_GLOBALS._v56A93] = R2_GLOBALS._v566A9; + R2_GLOBALS._v566A9 = 3; + } + } + + if (R2_GLOBALS._v566A8 == 0) + scene->_sceneMode = 16; + else + scene->_sceneMode = 11; + + Common::Point pt(160, 115); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene3800::Exit2::changeScene() { + Scene3800 *scene = (Scene3800 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + scene->_field412 = 2; + + if (R2_GLOBALS.getFlag(46)) { + if (scene->_field412 == R2_GLOBALS._v566A9) { + R2_GLOBALS._v566AA = 4; + if (R2_GLOBALS._v56A93 + 1 == 0) { + R2_GLOBALS._v566A8--; + R2_GLOBALS._v566A9 = 0; + } else { + R2_GLOBALS._v566A9 = R2_GLOBALS._v566AB[R2_GLOBALS._v56A93]; + R2_GLOBALS._v56A93--; + } + } else { + ++R2_GLOBALS._v56A93; + if (R2_GLOBALS._v56A93 > 999) + R2_GLOBALS._v56A93 = 999; + R2_GLOBALS._v566AB[R2_GLOBALS._v56A93] = R2_GLOBALS._v566A9; + R2_GLOBALS._v566A9 = 4; + } + } + + if (R2_GLOBALS._v566A8 == 0) + scene->_sceneMode = 16; + else + scene->_sceneMode = 12; + + Common::Point pt(330, 145); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene3800::Exit3::changeScene() { + Scene3800 *scene = (Scene3800 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + scene->_field412 = 3; + + if (R2_GLOBALS.getFlag(46)) { + if (scene->_field412 == R2_GLOBALS._v566A9) { + R2_GLOBALS._v566AA = 1; + if (R2_GLOBALS._v56A93 + 1 == 0) { + R2_GLOBALS._v566A8--; + R2_GLOBALS._v566A9 = 0; + } else { + R2_GLOBALS._v566A9 = R2_GLOBALS._v566AB[R2_GLOBALS._v56A93]; + R2_GLOBALS._v56A93--; + } + } else { + ++R2_GLOBALS._v56A93; + if (R2_GLOBALS._v56A93 > 999) + R2_GLOBALS._v56A93 = 999; + R2_GLOBALS._v566AB[R2_GLOBALS._v56A93] = R2_GLOBALS._v566A9; + R2_GLOBALS._v566A9 = 1; + } + } + + if (R2_GLOBALS._v566A8 == 0) + scene->_sceneMode = 16; + else + scene->_sceneMode = 13; + + Common::Point pt(160, 220); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene3800::Exit4::changeScene() { + Scene3800 *scene = (Scene3800 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + scene->_field412 = 4; + + if (R2_GLOBALS.getFlag(46)) { + if (scene->_field412 == R2_GLOBALS._v566A9) { + R2_GLOBALS._v566AA = 2; + if (R2_GLOBALS._v56A93 + 1 == 0) { + R2_GLOBALS._v566A8--; + R2_GLOBALS._v566A9 = 0; + } else { + R2_GLOBALS._v566A9 = R2_GLOBALS._v566AB[R2_GLOBALS._v56A93]; + R2_GLOBALS._v56A93--; + } + } else { + ++R2_GLOBALS._v56A93; + if (R2_GLOBALS._v56A93 > 999) + R2_GLOBALS._v56A93 = 999; + R2_GLOBALS._v566AB[R2_GLOBALS._v56A93] = R2_GLOBALS._v566A9; + R2_GLOBALS._v566A9 = 2; + } + } + + if (R2_GLOBALS._v566A8 == 0) + scene->_sceneMode = 16; + else + scene->_sceneMode = 14; + + Common::Point pt(-10, 145); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene3800::initScene3800() { + _exit1._enabled = true; + _exit2._enabled = true; + _exit3._enabled = true; + _exit4._enabled = true; + _exit1._insideArea = false; + _exit2._insideArea = false; + _exit3._insideArea = false; + _exit4._insideArea = false; + _exit1._moving = false; + _exit2._moving = false; + _exit3._moving = false; + _exit4._moving = false; + + loadScene(R2_GLOBALS._v566A6); + + R2_GLOBALS._uiElements.draw(); +} + +void Scene3800::sub110BBD() { + R2_GLOBALS._player.disableControl(); + switch (_field412) { + case 0: + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(160, 145)); + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.changeZoom(-1); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + _actor1.postInit(); + _actor1.fixPriority(10); + _actor1.changeZoom(-1); + _actor1.setVisage(1110); + _actor1._effect = 5; + _actor1._field9C = this->_field312; + R2_GLOBALS._player._linkedActor = &_actor1; + switch (R2_GLOBALS._sceneManager._previousScene) { + case 2600: + _object1.postInit(); + _object2.postInit(); + _actor1.hide(); + _sceneMode = 3800; + setAction(&_sequenceManager1, this, 3800, &R2_GLOBALS._player, &_object1, &_object2, NULL); + break; + case 3900: + _sceneMode = 15; + switch (R2_GLOBALS._v566AA - 1) { + case 0: { + R2_GLOBALS._player.setPosition(Common::Point(160, 220)); + Common::Point pt(160, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 1: { + R2_GLOBALS._player.setPosition(Common::Point(-10, 145)); + Common::Point pt(19, 145); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: { + R2_GLOBALS._player.setPosition(Common::Point(160, 115)); + Common::Point pt(160, 120); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: { + R2_GLOBALS._player.setPosition(Common::Point(330, 145)); + Common::Point pt(300, 145); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } + default: + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + } + break; + case 1: { + _sceneMode = 15; + R2_GLOBALS._player.setPosition(Common::Point(160, 220)); + Common::Point pt(160, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: { + _sceneMode = 15; + R2_GLOBALS._player.setPosition(Common::Point(-10, 145)); + Common::Point pt(19, 145); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: { + _sceneMode = 15; + R2_GLOBALS._player.setPosition(Common::Point(160, 115)); + Common::Point pt(160, 120); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 4: { + _sceneMode = 15; + R2_GLOBALS._player.setPosition(Common::Point(330, 145)); + Common::Point pt(300, 145); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } +} + +void Scene3800::postInit(SceneObjectList *OwnerList) { + _field412 = 0; + + initScene3800(); + + SceneExt::postInit(); + R2_GLOBALS._sound1.play(231); + + scalePalette(65, 65, 65); + + setZoomPercents(87, 40, 144, 100); + + _exit1.setDetails(Rect(14, 87, 305, 125), SHADECURSOR_UP, 3800); + _exit1.setDest(Common::Point(160, 126)); + _exit2.setDetails(Rect(305, 87, 320, 128), EXITCURSOR_E, 3800); + _exit2.setDest(Common::Point(312, 145)); + _exit3.setDetails(Rect(14, 160, 305, 168), SHADECURSOR_DOWN, 3800); + _exit3.setDest(Common::Point(160, 165)); + _exit4.setDetails(Rect(0, 87, 14, 168), EXITCURSOR_W, 3800); + _exit4.setDest(Common::Point(7, 145)); + + _rect1.set(0, 0, 320, 87); + _item1.setDetails(Rect(0, 0, 320, 200), 3800, 0, 1, 2, 1, (SceneItem *) NULL); + + sub110BBD(); +} + +void Scene3800::signal() { + switch (_sceneMode) { + case 11: + R2_GLOBALS._v566A6 += 15; + if (R2_GLOBALS._v566A6 > 3815) + R2_GLOBALS._v566A6 -= 20; + initScene3800(); + sub110BBD(); + break; + case 12: + R2_GLOBALS._v566A6 += 5; + if (R2_GLOBALS._v566A6 > 3815) + R2_GLOBALS._v566A6 = 3800; + initScene3800(); + sub110BBD(); + break; + case 13: + R2_GLOBALS._v566A6 -= 15; + if (R2_GLOBALS._v566A6 < 3800) + R2_GLOBALS._v566A6 += 20; + initScene3800(); + sub110BBD(); + break; + case 14: + R2_GLOBALS._v566A6 -= 5; + if (R2_GLOBALS._v566A6 < 3800) + R2_GLOBALS._v566A6 = 3815; + initScene3800(); + sub110BBD(); + break; + case 15: + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + break; + case 16: + g_globals->_sceneManager.changeScene(3900); + break; + case 3800: + _actor1.show(); + _object1.remove(); + _object2.remove(); + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + break; + case 3805: + _exit1._enabled = false; + _exit2._enabled = false; + _exit3._enabled = false; + _exit4._enabled = false; + R2_GLOBALS._player._canWalk = false; + R2_GLOBALS._events.setCursor(CURSOR_USE); + break; + case 3806: + _exit1._enabled = true; + _exit2._enabled = true; + _exit3._enabled = true; + _exit4._enabled = true; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + break; + default: + break; + } +} + +void Scene3800::process(Event &event) { + if ((R2_GLOBALS._player._uiEnabled) && (event.eventType == 1) && (_rect1.contains(event.mousePos))) { + event.handled = true; + switch (R2_GLOBALS._events.getCursor()) { + case R2_NEGATOR_GUN: + R2_GLOBALS._player.addMover(NULL); + R2_GLOBALS._player.updateAngle(event.mousePos); + break; + case R2_STEPPING_DISKS: + SceneItem::display(3800, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + case R2_ATTRACTOR_UNIT: + SceneItem::display(3800, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + default: + event.handled = false; + break; + } + } + + Scene::process(event); +} + +/*-------------------------------------------------------------------------- + * Scene 3900 - + * + *--------------------------------------------------------------------------*/ +void Scene3900::Exit1::changeScene() { + Scene3900 *scene = (Scene3900 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._v566A9 = 3; + R2_GLOBALS._v566AA = 1; + R2_GLOBALS._v566A8 = 1; + scene->_sceneMode = 14; + + Common::Point pt(160, 115); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene3900::Exit2::changeScene() { + Scene3900 *scene = (Scene3900 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._v566A9 = 4; + R2_GLOBALS._v566AA = 2; + R2_GLOBALS._v566A8 = 1; + scene->_sceneMode = 14; + + Common::Point pt(330, 145); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene3900::Exit3::changeScene() { + Scene3900 *scene = (Scene3900 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._v566A9 = 1; + R2_GLOBALS._v566AA = 3; + R2_GLOBALS._v566A8 = 1; + scene->_sceneMode = 14; + + Common::Point pt(160, 220); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene3900::Exit4::changeScene() { + Scene3900 *scene = (Scene3900 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + R2_GLOBALS._v566A9 = 2; + R2_GLOBALS._v566AA = 4; + R2_GLOBALS._v566A8 = 1; + scene->_sceneMode = 14; + + Common::Point pt(-10, 145); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene3900::Exit5::changeScene() { + Scene3900 *scene = (Scene3900 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(CURSOR_ARROW); + scene->_sceneMode = 13; + + if (R2_GLOBALS._v566A9 == 4) { + Common::Point pt(-10, 135); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + } else { + Common::Point pt(330, 135); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + } + + R2_GLOBALS._v566A9 = 0; +} + +void Scene3900::postInit(SceneObjectList *OwnerList) { + if ((R2_GLOBALS._v566AA == 2) && (R2_GLOBALS._sceneManager._previousScene != 2700)) + loadScene(3825); + else + loadScene(3820); + SceneExt::postInit(); + R2_GLOBALS._sound1.changeSound(231); + setZoomPercents(87, 40, 144, 100); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.changeZoom(-1); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + _actor1.postInit(); + _actor1.fixPriority(10); + _actor1.changeZoom(-1); + _actor1.setVisage(1110); + _actor1._effect = 5; + _actor1._field9C = _field312; + R2_GLOBALS._player._linkedActor = &_actor1; + if ((R2_GLOBALS._v566AA == 2) && (R2_GLOBALS._sceneManager._previousScene != 2700)) { +// loadScene(3825); + R2_GLOBALS._v566AA = 4; + _exit1.setDetails(Rect(29, 87, 305, 125), SHADECURSOR_UP, 3900); + _exit3.setDetails(Rect(29, 160, 305, 168), SHADECURSOR_DOWN, 3900); + + _exit2.setDetails(Rect(305, 87, 320, 168), EXITCURSOR_E, 3900); + _exit2.setDest(Common::Point(312, 145)); + _exit2._enabled = true; + _exit2._insideArea = false; + _exit2._moving = false; + + _exit4._enabled = false; + + _exit5.setDetails(Rect(0, 87, 29, 168), EXITCURSOR_W, 3900); + _exit5.setDest(Common::Point(24, 135)); + } else { +// loadScene(3820); + R2_GLOBALS._v566AA = 2; + _exit1.setDetails(Rect(14, 87, 290, 125), SHADECURSOR_UP, 3900); + _exit3.setDetails(Rect(14, 160, 290, 168), SHADECURSOR_DOWN, 3900); + + + _exit2._enabled = false; + + _exit4.setDetails(Rect(0, 87, 14, 168), EXITCURSOR_W, 3900); + _exit4.setDest(Common::Point(7, 145)); + _exit4._enabled = true; + _exit4._insideArea = false; + _exit4._moving = false; + + _exit5.setDetails(Rect(290, 87, 320, 168), EXITCURSOR_E, 3900); + _exit5.setDest(Common::Point(295, 135)); + } + _exit5._enabled = true; + _exit5._insideArea = false; + _exit5._moving = false; + + scalePalette(65, 65, 65); + + _exit1.setDest(Common::Point(160, 126)); + _exit1._enabled = true; + _exit1._insideArea = false; + _exit1._moving = false; + + _exit3.setDest(Common::Point(160, 165)); + _exit3._enabled = true; + _exit3._insideArea = false; + _exit3._moving = false; + + R2_GLOBALS._uiElements.draw(); + + _rect1.set(0, 0, 320, 87); + _item1.setDetails(Rect(0, 0, 320, 200), 3800, 0, 1, 2, 1, (SceneItem *)NULL); + if (R2_GLOBALS._sceneManager._previousScene == 3800) { + _sceneMode = 11; + switch (R2_GLOBALS._v566AA - 1) { + case 0: { + R2_GLOBALS._player.setPosition(Common::Point(160, 115)); + Common::Point pt(160, 120); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 1: { + R2_GLOBALS._player.setPosition(Common::Point(330, 145)); + Common::Point pt(300, 145); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: { + R2_GLOBALS._player.setPosition(Common::Point(160, 220)); + Common::Point pt(160, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: { + R2_GLOBALS._player.setPosition(Common::Point(-10, 145)); + Common::Point pt(19, 145); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } + } else if (R2_GLOBALS._sceneManager._previousScene == 2700) { + _sceneMode = 12; + R2_GLOBALS._player.setPosition(Common::Point(330, 135)); + Common::Point pt(265, 135); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + R2_GLOBALS._player.setPosition(Common::Point(160, 145)); + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + } +} + +void Scene3900::signal() { + switch (_sceneMode) { + case 11: + // No break on purpose + case 12: + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + case 13: + R2_GLOBALS._sceneManager.changeScene(2700); + break; + case 14: + R2_GLOBALS._sceneManager.changeScene(3800); + break; + case 3805: + _exit1._enabled = false; + _exit2._enabled = false; + _exit3._enabled = false; + _exit4._enabled = false; + R2_GLOBALS._player._canWalk = false; + R2_GLOBALS._events.setCursor(R2_STEPPING_DISKS); + break; + case 3806: + _exit1._enabled = true; + _exit2._enabled = true; + _exit3._enabled = true; + _exit4._enabled = true; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + default: + break; + } +} + +void Scene3900::process(Event &event) { + if ((R2_GLOBALS._player._uiEnabled) && (event.eventType == 1) && (_rect1.contains(event.mousePos))) { + event.handled = true; + switch (R2_GLOBALS._events.getCursor()) { + case R2_NEGATOR_GUN: + R2_GLOBALS._player.addMover(NULL); + R2_GLOBALS._player.updateAngle(event.mousePos); + break; + case R2_STEPPING_DISKS: + SceneItem::display(3800, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + case R2_ATTRACTOR_UNIT: + SceneItem::display(3800, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + default: + event.handled = false; + break; + } + } + Scene::process(event); +} + +} // End of namespace Ringworld2 +} // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h new file mode 100644 index 0000000000..44787b9eef --- /dev/null +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -0,0 +1,868 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TSAGE_RINGWORLD2_SCENES3_H +#define TSAGE_RINGWORLD2_SCENES3_H + +#include "common/scummsys.h" +#include "tsage/converse.h" +#include "tsage/events.h" +#include "tsage/core.h" +#include "tsage/scenes.h" +#include "tsage/globals.h" +#include "tsage/sound.h" +#include "tsage/ringworld2/ringworld2_logic.h" +#include "tsage/ringworld2/ringworld2_speakers.h" + +namespace TsAGE { + +namespace Ringworld2 { + +using namespace TsAGE; + + +class Scene3100 : public SceneExt { + class Guard : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; +public: + + int _field412; + SpeakerGuard _guardSpeaker; + NamedHotspot _item1; + NamedHotspot _item2; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + Guard _guard; + ASoundExt _sound1; + SequenceManager _sequenceManager; + + Scene3100(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void dispatch(); + virtual void synchronize(Serializer &s); +}; + +class Scene3125 : public SceneExt { + class Item1 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item2 : public Item1 { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item3 : public Item1 { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor1 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; +public: + + int _field412; + Item1 _item1; + Actor1 _actor1; + Item2 _item2; + Item3 _item3; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SequenceManager _sequenceManager1; + // Second sequence manager... Unused? + SequenceManager _sequenceManager2; + + Scene3125(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void dispatch(); + virtual void synchronize(Serializer &s); +}; + +class Scene3150 : public SceneExt { + class Item5 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item6 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor4 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor5 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor6 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor7 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit2 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + Item5 _item5; + Item6 _item6; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + Actor4 _actor4; + Actor5 _actor5; + Actor6 _actor6; + Actor7 _actor7; + Exit1 _exit1; + Exit2 _exit2; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void dispatch(); +}; + +class Scene3175 : public SceneExt { + class Item1 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor3 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor1 : public Actor3 { + virtual bool startAction(CursorType action, Event &event); + }; +public: + + Item1 _item1; + Item1 _item2; + Item1 _item3; + Actor1 _actor1; + SceneActor _actor2; + Actor3 _actor3; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene3200 : public SceneExt { +public: + SpeakerRocko3200 _rockoSpeaker; + SpeakerJocko3200 _jockoSpeaker; + SpeakerSocko3200 _sockoSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene3210 : public SceneExt { +public: + SpeakerCaptain3210 _captainSpeaker; + SpeakerPrivate3210 _privateSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene3220 : public SceneExt { +public: + SpeakerRocko3220 _rockoSpeaker; + SpeakerJocko3220 _jockoSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene3230 : public SceneExt { +public: + SpeakerRocko3230 _rockoSpeaker; + SpeakerJocko3230 _jockoSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene3240 : public SceneExt { +public: + SpeakerTeal3240 _tealSpeaker; + SpeakerWebbster3240 _webbsterSpeaker; + SpeakerMiranda _mirandaSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene3245 : public SceneExt { +public: + SpeakerRalf3245 _ralfSpeaker; + SpeakerTomko3245 _tomkoSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene3250 : public SceneExt { + class Item : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; +public: + + Item _item1; + Item _item2; + Item _item3; + Item _item4; + Actor _actor1; + Actor _actor2; + Actor _actor3; + Actor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void dispatch(); +}; + +class Scene3255 : public SceneExt { +public: + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SpeakerQuinn3255 _quinnSpeaker; + SpeakerMiranda3255 _mirandaSpeaker; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void dispatch(); +}; + +class Scene3260 : public SceneExt { + class Actor13 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor14 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + + class Action1: public Action { + public: + void signal(); + }; +public: + + NamedHotspot _item1; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SceneActor _actor8; + SceneActor _actor9; + SceneActor _actor10; + SceneActor _actor11; + SceneActor _actor12; + Actor13 _actor13; + Actor14 _actor14; + Action1 _action1; + Action1 _action2; + Action1 _action3; + Action1 _action4; + Action1 _action5; + Action1 _action6; + Action1 _action7; + Action1 _action8; + Action1 _action9; + Action1 _action10; + Action1 _action11; + Action1 _action12; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + +class Scene3275 : public SceneExt { + class Actor2 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + SceneActor _actor1; + Actor2 _actor2; + Exit1 _exit1; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene3350 : public SceneExt { +public: + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SceneActor _actor8; + SceneActor _actor9; + SequenceManager _sequenceManager; + PaletteRotation *_rotation; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + +class Scene3375 : public SceneExt { + class Actor1 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor2 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor3 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor4 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit2 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit3 : public SceneExit { + public: + virtual void changeScene(); + }; + + void signalCase3379(); + void subFC696(int sceneMode); + +public: + SpeakerQuinn3375 _quinnSpeaker; + SpeakerSeeker3375 _seekerSpeaker; + SpeakerMiranda3375 _mirandaSpeaker; + SpeakerWebbster3375 _webbsterSpeaker; + NamedHotspot _item1; + NamedHotspot _itemArray[13]; + Actor1 _actor1; + Actor2 _actor2; + Actor3 _actor3; + Actor4 _actor4; + Exit1 _exit1; + Exit2 _exit2; + Exit3 _exit3; + SequenceManager _sequenceManager; + int _field1488; + int _field148A[4]; + int _field1492; + + Scene3375(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void dispatch(); + virtual void synchronize(Serializer &s); +}; + +class Scene3385 : public SceneExt { + class Actor1 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor2 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor3 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor4 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; + + class Action1: public Action { + public: + virtual void signal(); + }; + +public: + SpeakerQuinn3385 _quinnSpeaker; + SpeakerSeeker3385 _seekerSpeaker; + SpeakerMiranda3385 _mirandaSpeaker; + SpeakerWebbster3385 _webbsterSpeaker; + NamedHotspot _item1; + Actor1 _actor1; + Actor2 _actor2; + Actor3 _actor3; + Actor4 _actor4; + Exit1 _exit1; + Action1 _action1; + SequenceManager _sequenceManager; + + int _field11B2; + + Scene3385(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void synchronize(Serializer &s); +}; + +class Scene3395 : public SceneExt { + class Actor1 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor2 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor3 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor4 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + + class Action1: public Action { + public: + virtual void signal(); + }; + +public: + SpeakerQuinn3395 _quinnSpeaker; + SpeakerSeeker3395 _seekerSpeaker; + SpeakerMiranda3395 _mirandaSpeaker; + SpeakerWebbster3395 _webbsterSpeaker; + NamedHotspot _item1; + NamedHotspot _itemArray[13]; + Actor1 _actor1; + Actor2 _actor2; + Actor3 _actor3; + Actor4 _actor4; + Action1 _action1; + SequenceManager _sequenceManager; + + int _field142E; + + Scene3395(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void synchronize(Serializer &s); +}; + +class Scene3400 : public SceneExt { +public: + SpeakerQuinn3400 _quinnSpeaker; + SpeakerSeeker3400 _seekerSpeaker; + SpeakerMiranda3400 _mirandaSpeaker; + SpeakerWebbster3400 _webbsterSpeaker; + SpeakerTeal3400 _tealSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SceneActor _actor8; + SequenceManager _sequenceManager; + int16 _field157C; + + Scene3400(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void synchronize(Serializer &s); +}; + +class Scene3500 : public SceneExt { + class Action1: public Action { + public: + int _field1E; + int _field20; + int _field22; + int _field24; + + Action1(); + virtual void synchronize(Serializer &s); + void sub108670(int arg1); + void sub108732(int arg1); + virtual void signal(); + virtual void dispatch(); + }; + class Action2: public Action { + public: + int _field1E; + + Action2(); + virtual void synchronize(Serializer &s); + void sub10831F(int arg1); + + virtual void signal(); + }; + + class Item4 : public NamedHotspot { + public: + int _field34; + + Item4(); + virtual void synchronize(Serializer &s); + + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor7 : public SceneActor { + public: + int _fieldA4; + int _fieldA6; + int _fieldA8; + int _fieldAA; + int _fieldAC; + int _fieldAE; + + Actor7(); + virtual void synchronize(Serializer &s); + + void sub109466(int arg1, int arg2, int arg3, int arg4, int arg5); + void sub1094ED(); + void sub109663(int arg1); + void sub109693(Common::Point Pt); + + virtual void process(Event &event); + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor8 : public SceneActor { + public: + // TODO: double check if nothing specific is present, then remove this class + }; + + class UnkObject3500 : public UnkObject1200 { + public: + int sub1097C9(int arg1); + int sub1097EF(int arg1); + int sub109C09(Common::Point pt); + int sub109C5E(int &x, int &y); + }; +public: + Action1 _action1; + Action2 _action2; + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + Item4 _item4; + Item4 _item5; + Item4 _item6; + Item4 _item7; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + Actor7 _actor7; + Actor8 _actor8; + Actor8 _actor9; + ASoundExt _aSound1; + UnkObject3500 _unkObj1; + SequenceManager _sequenceManager; + + int _fieldAF8; + int _fieldB9E; + PaletteRotation *_rotation; + int _field126E; + int _field1270; + int _field1272; + int _field1274; + int _field1276; + int _field1278; + int _field127A; + int _field127C; + int _field127E; + int _field1280; + int _field1282; + int _field1284; + int _field1286; + + Scene3500(); + void sub107F71(int arg1); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); + virtual void synchronize(Serializer &s); +}; + +class Scene3600 : public SceneExt { + class Action3600: public ActionExt { + public: + int _field1E, _field20; + + Action3600(); + virtual void synchronize(Serializer &s); + virtual void signal(); + }; + class Action2: public Action { + public: + virtual void signal(); + }; + + class Item5 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor13 : public SceneActorExt { + virtual bool startAction(CursorType action, Event &event); + }; +public: + Action3600 _action1; + Action2 _action2; + SpeakerQuinn3600 _quinnSpeaker; + SpeakerSeeker3600 _seekerSpeaker; + SpeakerMiranda3600 _mirandaSpeaker; + SpeakerTeal3600 _tealSpeaker; + SpeakerProtector3600 _protectorSpeaker; + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + Item5 _item5; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SceneActor _actor8; + SceneActor _actor9; + SceneActor _actor10; + SceneActor _actor11; + SceneActor _actor12; + Actor13 _actor13; + SequenceManager _sequenceManager1; + SequenceManager _sequenceManager2; + SequenceManager _sequenceManager3; + SequenceManager _sequenceManager4; + ScenePalette _palette1; + + int _field2548; + int _field254A; + int _field254C; + int _field254E; + bool _field2550; + + Scene3600(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); + virtual void synchronize(Serializer &s); +}; + +class Scene3700 : public SceneExt { +public: + SpeakerQuinn3700 _quinnSpeaker; + SpeakerSeeker3700 _seekerSpeaker; + SpeakerMiranda3700 _mirandaSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + +class Scene3800 : public SceneExt { + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; + + class Exit2 : public SceneExit { + public: + virtual void changeScene(); + }; + + class Exit3 : public SceneExit { + public: + virtual void changeScene(); + }; + + class Exit4 : public SceneExit { + public: + virtual void changeScene(); + }; + +public: + SceneObject _object1; + SceneObject _object2; + SceneActor _actor1; + NamedHotspot _item1; + Exit1 _exit1; + Exit2 _exit2; + Exit3 _exit3; + Exit4 _exit4; + Rect _rect1; + SequenceManager _sequenceManager1; + + int _field412; + + Scene3800(); + void initScene3800(); + void sub110BBD(); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); + virtual void synchronize(Serializer &s); +}; + +class Scene3900 : public SceneExt { + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; + + class Exit2 : public SceneExit { + public: + virtual void changeScene(); + }; + + class Exit3 : public SceneExit { + public: + virtual void changeScene(); + }; + + class Exit4 : public SceneExit { + public: + virtual void changeScene(); + }; + + class Exit5 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + SceneActor _actor1; + NamedHotspot _item1; + Exit1 _exit1; + Exit2 _exit2; + Exit3 _exit3; + Exit4 _exit4; + Exit5 _exit5; + Rect _rect1; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); +}; + +} // End of namespace Ringworld2 +} // End of namespace TsAGE + +#endif diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index 8c8bd7171a..da1449efdf 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -26,7 +26,9 @@ #include "tsage/graphics.h" #include "tsage/staticres.h" #include "tsage/ringworld2/ringworld2_scenes0.h" +#include "tsage/ringworld2/ringworld2_scenes1.h" #include "tsage/ringworld2/ringworld2_scenes2.h" +#include "tsage/ringworld2/ringworld2_scenes3.h" namespace TsAGE { @@ -128,7 +130,7 @@ void VisualSpeaker::setText(const Common::String &msg) { //_sceneText.clone(); _sceneText.setPosition(_textPos); - _sceneText.setPriority(0x100); + _sceneText.fixPriority(256); // If subtitles are turned off, don't show the text if (!(R2_GLOBALS._speechSubtitles & SPEECH_TEXT)) { @@ -148,7 +150,7 @@ void VisualSpeaker::setText(const Common::String &msg) { ++numWords; _numFrames = numWords * 30 + 120; - setFrame(_numFrames); + setDelay(_numFrames); } else { _numFrames = 1; } @@ -157,7 +159,7 @@ void VisualSpeaker::setText(const Common::String &msg) { if (s.empty()) _numFrames = 0; - + if (_fieldF6) { if ((R2_GLOBALS._speechSubtitles & SPEECH_TEXT) || !_soundId) _sceneText.hide(); @@ -185,9 +187,265 @@ void VisualSpeaker::setFrame(int numFrames) { _frameNumber = R2_GLOBALS._events.getFrameNumber(); } -/*--------------------------------------------------------------------------*/ +void VisualSpeaker::setDelay(int delay) { + _delayAmount = delay; + _frameNumber = R2_GLOBALS._events.getFrameNumber(); +} + +//---------------------------------------------------------------------------- + +SpeakerGameText::SpeakerGameText(): VisualSpeaker() { + _speakerName = "GAMETEXT"; + _color1 = 8; + _color2 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; +} + +//---------------------------------------------------------------------------- +// Classes related to CAPTAIN +//---------------------------------------------------------------------------- + +SpeakerCaptain3210::SpeakerCaptain3210() { + _speakerName = "Captain"; + _color1 = 5; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerCaptain3210::proc15() { + int v = _fieldF6; + Scene3210 *scene = (Scene3210 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +//---------------------------------------------------------------------------- +// Classes related to CARETAKER +//---------------------------------------------------------------------------- + +SpeakerCaretaker2450::SpeakerCaretaker2450() { + _speakerName = "CARETAKER"; + _color1 = 43; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +//---------------------------------------------------------------------------- +// Classes related to CHIEF +//---------------------------------------------------------------------------- + +SpeakerChief1100::SpeakerChief1100() { + _speakerName = "CHIEF"; + _color1 = 8; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerChief1100::proc15() { + int v = _fieldF6; + Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor18; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4080, 1, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4080, 3, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 100: + _numFrames = 0; + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setStrip(_object1._strip - 1); + _object1.setFrame(_object1.getFrameCount()); + _object1.animate(ANIM_MODE_6, this); + break; + default: + signal(); + break; + } +} + +//---------------------------------------------------------------------------- +// Classes related to GUARD +//---------------------------------------------------------------------------- + +SpeakerGuard::SpeakerGuard() { + _speakerName = "GUARD"; + _color1 = 5; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} -SpeakerMiranda300::SpeakerMiranda300(): VisualSpeaker() { +void SpeakerGuard2800::proc15() { + int v = _fieldF6; + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setZoom(75); + _object1.setup(4060, 3, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +//---------------------------------------------------------------------------- +// Classes related to JOCKO +//---------------------------------------------------------------------------- + +SpeakerJocko::SpeakerJocko() { + _speakerName = "Jocko"; + _color1 = 45; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerJocko3200::proc15() { + int v = _fieldF6; + Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +void SpeakerJocko3220::proc15() { + int v = _fieldF6; + Scene3220 *scene = (Scene3220 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +void SpeakerJocko3230::proc15() { + int v = _fieldF6; + Scene3230 *scene = (Scene3230 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +//---------------------------------------------------------------------------- +// Classes related to MIRANDA +//---------------------------------------------------------------------------- + +SpeakerMiranda::SpeakerMiranda(): VisualSpeaker() { _speakerName = "MIRANDA"; _color1 = 154; _color2 = 0; @@ -214,7 +472,7 @@ void SpeakerMiranda300::proc15() { _object1.postInit(); _object1.setPosition(_object2->_position); - if (_object2->_mover) + if (_object2->_mover) _object2->addMover(NULL); } @@ -239,11 +497,348 @@ void SpeakerMiranda300::proc15() { } } -/*--------------------------------------------------------------------------*/ +void SpeakerMiranda1625::proc15() { + int v = _fieldF6; -SpeakerSeeker300::SpeakerSeeker300(): VisualSpeaker() { - _speakerName = "SEEKER"; - _color1 = 35; + if (!_object2) { + Scene1625 *scene = (Scene1625 *)R2_GLOBALS._sceneManager._scene; + _object2 = &scene->_actor3; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(Common::Point(196, 65)); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(1627, 3, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +void SpeakerMiranda3255::proc15() { + int v = _fieldF6; + + if (!_object2) { + _object2 = &R2_GLOBALS._player; + _object2->hide(); + _object1.postInit(); + _object1._effect = _object2->_effect; + _object1._shade = _object2->_shade; + _object1.setPosition(_object2->_position); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(3257, 5, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +void SpeakerMiranda3375::proc15() { + Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 3) + _object2 = &R2_GLOBALS._player; + else + _object2 = &scene->_actor2; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + + if (scene->_actor1._position.y != 163) + R2_GLOBALS._player.setStrip(8); + else + R2_GLOBALS._player.setStrip(2); + + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4051, 5, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +void SpeakerMiranda3385::proc15() { + Scene3385 *scene = (Scene3385 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 3) + _object2 = &R2_GLOBALS._player; + else + _object2 = &scene->_actor2; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + + if (R2_GLOBALS._sceneManager._previousScene == 3375) + R2_GLOBALS._player.setStrip(4); + else + R2_GLOBALS._player.setStrip(3); + + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + + R2_GLOBALS._player.disableControl(CURSOR_TALK); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4051, 5, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +void SpeakerMiranda3395::proc15() { + Scene3395 *scene = (Scene3395 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 3) + _object2 = &R2_GLOBALS._player; + else + _object2 = &scene->_actor2; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + + if (R2_GLOBALS._sceneManager._previousScene == 3385) + R2_GLOBALS._player.setStrip(4); + else + R2_GLOBALS._player.setStrip(3); + + R2_GLOBALS._player.disableControl(CURSOR_TALK); + + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4051, 5, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +void SpeakerMiranda3400::proc15() { + Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 3) + _object2 = &R2_GLOBALS._player; + else + _object2 = &scene->_actor2; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4051, 5, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4050, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + default: + signal(); + break; + } +} + +void SpeakerMiranda3600::proc15() { + Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 3) + _object2 = &R2_GLOBALS._player; + else + _object2 = &scene->_actor12; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + + _object1.setPosition(_object2->_position); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4051, 1, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4050, 1, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +void SpeakerMiranda3700::proc15() { + Scene3700 *scene = (Scene3700 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + _object2 = &scene->_actor3; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + _object1.setPosition(_object2->_position); + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + scene->_actor1.setup(10, 6, 1); + scene->_actor2.setup(20, 5, 1); + _object2->setup(30, 1, 1); + scene->_actor4.setup(40, 1, 1); + _object1.setup(4050, 5, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + scene->_actor3.setup(30, 8, 1); + _object1.setup(4052, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 3: + ((SceneItem *)_action)->_sceneRegionId = 0; + scene->_actor2.setup(20, 1, 1); + scene->_actor3.setup(30, 1, 1); + _object1.setup(4051, 7, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + default: + signal(); + break; + } +} + +//---------------------------------------------------------------------------- +// Classes related to NEJ +//---------------------------------------------------------------------------- + +SpeakerNej::SpeakerNej() { + _speakerName = "NEJ"; + _color1 = 171; _color2 = 0; _fieldF6 = 0; _textWidth = 300; @@ -253,47 +848,105 @@ SpeakerSeeker300::SpeakerSeeker300(): VisualSpeaker() { _numFrames = 0; } -void SpeakerSeeker300::proc15() { +void SpeakerNej2700::proc15() { int v = _fieldF6; + Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 3) { - _object2 = &R2_GLOBALS._player; - } else { - Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene; - _object2 = &scene->_seeker; + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + switch (_object2->_visage) { + case 2701: + _object1.setup(4022, 3, 1); + _object1.setPosition(Common::Point(164, 163)); + _object2->setPosition(Common::Point(-10, -10)); + break; + case 2705: + _object1.setup(4022, 7, 1); + _object1.fixPriority(162); + break; + default: + break; } + _object1.animate(ANIM_MODE_5, this); + } +} + +void SpeakerNej2750::proc15() { + int v = _fieldF6; + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + if (!_object2) { + _object2 = &scene->_actor1; _object2->hide(); _object1.postInit(); - _object1.fixPriority(140); _object1.setPosition(_object2->_position); - if (_object2->_mover) + if (_object2->_mover) _object2->addMover(NULL); } if (v == 0) { _object1.animate(ANIM_MODE_2, NULL); - } else if (v == 100) { - _numFrames = 0; + } else { ((SceneItem *)_action)->_sceneRegionId = 0; + switch (_object2->_visage) { + case 2705: + _object1.setup(4022, 7, 1); + break; + case 2752: + _object1.setup(2752, 1, 1); + break; + default: + break; + } + _object1.animate(ANIM_MODE_5, this); + } +} - _object1.setStrip(_object1._strip - 1); - _object1.setFrame(_object1.getFrameCount()); - _object1.animate(ANIM_MODE_6, this); +void SpeakerNej2800::proc15() { + int v = _fieldF6; + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); } else { ((SceneItem *)_action)->_sceneRegionId = 0; - _object1.setup(306, v * 2 - 1, 1); + _object1.setup(4023, 3, 1); + if (_object2->_visage == 2801) + _object1.setPosition(Common::Point(R2_GLOBALS._player._position.x - 12, R2_GLOBALS._player._position.y)); _object1.animate(ANIM_MODE_5, this); } } -/*--------------------------------------------------------------------------*/ +//---------------------------------------------------------------------------- +// Classes related to PHARISHA +//---------------------------------------------------------------------------- -SpeakerSeekerL::SpeakerSeekerL(): VisualSpeaker() { - _speakerName = "SEEKERL"; - _color1 = 35; +SpeakerPharisha::SpeakerPharisha(): VisualSpeaker() { + _speakerName = "PHARISHA"; + _color1 = 151; _color2 = 0; _fieldF6 = 0; _textWidth = 300; @@ -301,14 +954,35 @@ SpeakerSeekerL::SpeakerSeekerL(): VisualSpeaker() { _object2 = NULL; _displayMode = 1; _numFrames = 0; - _fontNumber = 10; } -/*--------------------------------------------------------------------------*/ +void SpeakerPharisha2435::proc15() { + int v = _fieldF6; + Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene; -SpeakerQuinnL::SpeakerQuinnL(): VisualSpeaker() { - _speakerName = "QUINNL"; - _color1 = 35; + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4098, 5, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +//---------------------------------------------------------------------------- +// Classes related to PRIVATE +//---------------------------------------------------------------------------- + +SpeakerPrivate3210::SpeakerPrivate3210() { + _speakerName = "Private"; + _color1 = 45; _color2 = 0; _fieldF6 = 0; _textWidth = 300; @@ -316,12 +990,97 @@ SpeakerQuinnL::SpeakerQuinnL(): VisualSpeaker() { _object2 = NULL; _displayMode = 1; _numFrames = 0; - _fontNumber = 10; } -/*--------------------------------------------------------------------------*/ +void SpeakerPrivate3210::proc15() { + int v = _fieldF6; + Scene3210 *scene = (Scene3210 *)R2_GLOBALS._sceneManager._scene; -SpeakerQuinn300::SpeakerQuinn300(): VisualSpeaker() { + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +//---------------------------------------------------------------------------- +// Classes related to PROTECTOR +//---------------------------------------------------------------------------- + +SpeakerProtector3600::SpeakerProtector3600() { + _speakerName = "Protector"; + _color1 = 170; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 7; + _numFrames = 0; +} + +void SpeakerProtector3600::proc15() { + int v = _fieldF6; + Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor13; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + _object1.setPosition(_object2->_position); + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + if (scene->_sceneMode != 3324) { + _object1.setup(4125, 3, 1); + _object1.animate(ANIM_MODE_5, this); + } else { + _object1.setup(3258, 6, 1); + _object1.animate(ANIM_MODE_2, NULL); + _object1.hide(); + _object2->setup(3258, 6, 1); + _object2->show(); + } + break; + default: + signal(); + break; + } +} + +//---------------------------------------------------------------------------- +// Classes related to QUINN +//---------------------------------------------------------------------------- + +SpeakerQuinn::SpeakerQuinn(): VisualSpeaker() { _speakerName = "QUINN"; _color1 = 60; _color2 = 0; @@ -348,7 +1107,7 @@ void SpeakerQuinn300::proc15() { _object1.postInit(); _object1.setPosition(_object2->_position); - if (_object2->_mover) + if (_object2->_mover) _object2->addMover(NULL); } @@ -363,7 +1122,7 @@ void SpeakerQuinn300::proc15() { _object1.animate(ANIM_MODE_6, this); } else { ((SceneItem *)_action)->_sceneRegionId = 0; - + switch (_object2->_visage) { case 10: _object1.setup((v - 1) / 4 + 4010, ((v - ((v - 1) / 4 * 4) - 1) % 8) * 2 + 1, 1); @@ -380,32 +1139,118 @@ void SpeakerQuinn300::proc15() { } } -/*--------------------------------------------------------------------------*/ +void SpeakerQuinn1100::proc15() { + int v = _fieldF6; -SpeakerTeal300::SpeakerTeal300(): VisualSpeaker() { - _speakerName = "TEAL"; - _color1 = 22; - _color2 = 0; - _fieldF6 = 0; - _textWidth = 300; - _hideObjects = false; - _object2 = NULL; - _displayMode = 1; - _numFrames = 0; + if (!_object2) { + if (v == 0) + return; + + if (R2_GLOBALS._player._characterIndex == 1) { + _object2 = &R2_GLOBALS._player; + } else { + Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene; + _object2 = &scene->_actor16; + } + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(1108, 7, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(1109, 1, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 3: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(1109, 5, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } } -void SpeakerTeal300::proc15() { +void SpeakerQuinn2435::proc15() { int v = _fieldF6; if (!_object2) { - Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene; - _object2 = &scene->_teal; + if (R2_GLOBALS._player._characterIndex == 1) { + _object2 = &R2_GLOBALS._player; + } else { + Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene; + _object2 = &scene->_actor1; + } + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + } + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object2->setStrip(7); + _object1.setup(2020, 5, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +void SpeakerQuinn2450::proc15() { + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 1) { + _object2 = &R2_GLOBALS._player; + } else { + Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene; + _object2 = &scene->_actor1; + } + + _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); + } - if (_object2->_mover) + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + if (R2_GLOBALS.getFlag(61)) + _object1.setup(2020, 3, 1); + else + _object1.setup(2020, 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +void SpeakerQuinn2700::proc15() { + int v = _fieldF6; + + if (!_object2) { + _object2 = &R2_GLOBALS._player; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) _object2->addMover(NULL); } @@ -413,38 +1258,61 @@ void SpeakerTeal300::proc15() { _object1.animate(ANIM_MODE_2, NULL); } else { ((SceneItem *)_action)->_sceneRegionId = 0; - _object1.setup(303, 1, 1); + switch (_object2->_visage) { + case 19: + _object1.setup(4022, 5, 1); + break; + case 2701: + _object1.setup(4022, 1, 1); + break; + default: + break; + } _object1.animate(ANIM_MODE_5, this); } } +void SpeakerQuinn2750::proc15() { + int v = _fieldF6; -/*--------------------------------------------------------------------------*/ + if (!_object2) { + _object2 = &R2_GLOBALS._player; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); -SpeakerSoldier300::SpeakerSoldier300(): VisualSpeaker() { - _speakerName = "SOLDIER"; - _color1 = 60; - _color2 = 0; - _fieldF6 = 0; - _textWidth = 300; - _hideObjects = false; - _object2 = NULL; - _displayMode = 1; - _numFrames = 0; + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + switch (_object2->_visage) { + case 19: + _object1.setup(4022, 5, 1); + break; + case 2752: + _object1.setup(2752, 1, 1); + break; + default: + break; + } + _object1.animate(ANIM_MODE_5, this); + } } -void SpeakerSoldier300::proc15() { +void SpeakerQuinn2800::proc15() { int v = _fieldF6; if (!_object2) { - Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene; - _object2 = &scene->_teal; + _object2 = &R2_GLOBALS._player; _object2->hide(); - _object1.postInit(); _object1.setPosition(_object2->_position); - if (_object2->_mover) + if (_object2->_mover) _object2->addMover(NULL); } @@ -452,16 +1320,386 @@ void SpeakerSoldier300::proc15() { _object1.animate(ANIM_MODE_2, NULL); } else { ((SceneItem *)_action)->_sceneRegionId = 0; - _object1.setup(303, 3, 1); + switch (_object2->_visage) { + case 16: + _object1.setZoom(75); + _object1.setup(4023, 5, 1); + break; + case 19: + _object1.setup(4023, 1, 1); + break; + case 3110: + _object1.setZoom(75); + if (_object2->_strip == 1) + _object1.setup(4061 , 1, 1); + else + _object1.setup(4061 , 3, 1); + break; + default: + break; + } _object1.animate(ANIM_MODE_5, this); } } -/*--------------------------------------------------------------------------*/ +void SpeakerQuinn3255::proc15() { + Scene3255 *scene = (Scene3255 *)R2_GLOBALS._sceneManager._scene; -SpeakerQuinn2350::SpeakerQuinn2350(): VisualSpeaker() { - _speakerName = "QUINN"; - _color1 = 60; + int v = _fieldF6; + + if (!_object2) { + _object2 = &scene->_actor4; + _object2->hide(); + _object1.postInit(); + _object1._effect = _object2->_effect; + _object1._shade = _object2->_shade; + _object1.setPosition(_object2->_position); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(3257, 3, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +void SpeakerQuinn3375::proc15() { + Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 1) + _object2 = &R2_GLOBALS._player; + else if (R2_GLOBALS._player._characterIndex == 2) + _object2 = &scene->_actor1; + else + _object2 = &scene->_actor2; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + + if (scene->_actor1._position.y != 163) + R2_GLOBALS._player.setStrip(8); + else + R2_GLOBALS._player.setStrip(2); + + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + + R2_GLOBALS._player.disableControl(CURSOR_TALK); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4010, 5, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +void SpeakerQuinn3385::proc15() { + Scene3385 *scene = (Scene3385 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 1) + _object2 = &R2_GLOBALS._player; + else if (R2_GLOBALS._player._characterIndex == 2) + _object2 = &scene->_actor1; + else + _object2 = &scene->_actor2; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + + if (R2_GLOBALS._sceneManager._previousScene == 3375) + R2_GLOBALS._player.setStrip(4); + else + R2_GLOBALS._player.setStrip(3); + + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + + R2_GLOBALS._player.disableControl(CURSOR_TALK); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + if (R2_GLOBALS._player._characterIndex == 2) + _object1.setup(4010, 3, 1); + else + _object1.setup(4010, 5, 1); + + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +void SpeakerQuinn3395::proc15() { + Scene3395 *scene = (Scene3395 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 1) + _object2 = &R2_GLOBALS._player; + else if (R2_GLOBALS._player._characterIndex == 2) + _object2 = &scene->_actor1; + else + _object2 = &scene->_actor2; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + + if (R2_GLOBALS._sceneManager._previousScene == 3385) + R2_GLOBALS._player.setStrip(4); + else + R2_GLOBALS._player.setStrip(3); + + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + + R2_GLOBALS._player.disableControl(CURSOR_TALK); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + if (R2_GLOBALS._player._characterIndex == 2) + _object1.setup(4010, 3, 1); + else + _object1.setup(4010, 5, 1); + + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +void SpeakerQuinn3400::proc15() { + Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 1) + _object2 = &R2_GLOBALS._player; + else if (R2_GLOBALS._player._characterIndex == 2) + _object2 = &scene->_actor1; + else + _object2 = &scene->_actor2; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4010, 5, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4010, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 3: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4012, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + default: + signal(); + break; + } +} + +void SpeakerQuinn3600::proc15() { + Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 1) + _object2 = &R2_GLOBALS._player; + else + _object2 = &scene->_actor10; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4021, 7, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4010, 1, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 3: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4012, 1, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +void SpeakerQuinn3700::setText(const Common::String &msg) { + Scene3700 *scene = (Scene3700 *)R2_GLOBALS._sceneManager._scene; + + switch (_fieldF6) { + case 2: + scene->_actor3.setup(30, 1, 1); + R2_GLOBALS._sound2.play(44); + break; + case 3: + scene->_actor3.setup(30, 1, 1); + break; + default: + scene->_actor3.setup(30, 7, 1); + break; + } + VisualSpeaker::setText(msg); +} + +void SpeakerQuinn3700::proc15() { + Scene3700 *scene = (Scene3700 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + _object1.setPosition(_object2->_position); + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + R2_GLOBALS._sound2.stop(); + scene->_actor1.setup(10, 4, 1); + scene->_actor3.setup(30, 7, 1); + _object1.setup(3701, 1, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + scene->_actor2.setup(20, 1, 1); + scene->_actor3.setup(30, 1, 1); + _object1.setup(3701, 2, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 3: + ((SceneItem *)_action)->_sceneRegionId = 0; + scene->_actor1.setup(10, 2, 1); + scene->_actor3.setup(30, 1, 1); + _object1.setup(4011, 1, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + default: + signal(); + break; + } +} + +//---------------------------------------------------------------------------- +// Classes related to QUINNL +//---------------------------------------------------------------------------- + +SpeakerQuinnL::SpeakerQuinnL(): VisualSpeaker() { + _speakerName = "QUINNL"; + _color1 = 35; _color2 = 0; _fieldF6 = 0; _textWidth = 300; @@ -469,11 +1707,16 @@ SpeakerQuinn2350::SpeakerQuinn2350(): VisualSpeaker() { _object2 = NULL; _displayMode = 1; _numFrames = 0; + _fontNumber = 10; } -SpeakerPharisha2350::SpeakerPharisha2350(): VisualSpeaker() { - _speakerName = "PHARISHA"; - _color1 = 151; +//---------------------------------------------------------------------------- +// Classes related to RALF +//---------------------------------------------------------------------------- + +SpeakerRalf3245::SpeakerRalf3245() { + _speakerName = "Ralf"; + _color1 = 5; _color2 = 0; _fieldF6 = 0; _textWidth = 300; @@ -483,11 +1726,49 @@ SpeakerPharisha2350::SpeakerPharisha2350(): VisualSpeaker() { _numFrames = 0; } -/*--------------------------------------------------------------------------*/ +void SpeakerRalf3245::proc15() { + int v = _fieldF6; + Scene3245 *scene = (Scene3245 *)R2_GLOBALS._sceneManager._scene; -SpeakerQuinn2435::SpeakerQuinn2435() { - _speakerName = "QUINN"; - _color1 = 60; + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + switch (_object2->_visage) { + case 3100: + _object1.setup(4105, (_object2->_strip * 2) - 1, 1); + break; + case 3101: + _object1.setup(4108, (_object2->_strip * 2) - 1, 1); + break; + case 3102: + _object1.setup(4109, (_object2->_strip * 2) - 1, 1); + break; + default: + break; + } + + _object1.animate(ANIM_MODE_5, this); + } +} + +//---------------------------------------------------------------------------- +// Classes related to ROCKO +//---------------------------------------------------------------------------- + +SpeakerRocko::SpeakerRocko() { + _speakerName = "Rocko"; + _color1 = 5; _color2 = 0; _fieldF6 = 0; _textWidth = 300; @@ -496,33 +1777,81 @@ SpeakerQuinn2435::SpeakerQuinn2435() { _displayMode = 1; _numFrames = 0; } -void SpeakerQuinn2435::proc15() { + +void SpeakerRocko3200::proc15() { int v = _fieldF6; + Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 1) { - _object2 = &R2_GLOBALS._player; - } else { - Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene; - _object2 = &scene->_actor1; - } + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} +void SpeakerRocko3220::proc15() { + int v = _fieldF6; + Scene3220 *scene = (Scene3220 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor1; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); } if (v == 0) { _object1.animate(ANIM_MODE_2, NULL); } else { ((SceneItem *)_action)->_sceneRegionId = 0; - _object2->setStrip(7); - _object1.setup(2020, 5, 1); + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); _object1.animate(ANIM_MODE_5, this); } } -SpeakerSeeker2435::SpeakerSeeker2435() { +void SpeakerRocko3230::proc15() { + int v = _fieldF6; + Scene3230 *scene = (Scene3230 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4111, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +//---------------------------------------------------------------------------- +// Classes related to SEEKER +//---------------------------------------------------------------------------- + +SpeakerSeeker::SpeakerSeeker(): VisualSpeaker() { _speakerName = "SEEKER"; _color1 = 35; _color2 = 0; @@ -534,6 +1863,131 @@ SpeakerSeeker2435::SpeakerSeeker2435() { _numFrames = 0; } +void SpeakerSeeker300::proc15() { + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 3) { + _object2 = &R2_GLOBALS._player; + } else { + Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene; + _object2 = &scene->_seeker; + } + + _object2->hide(); + _object1.postInit(); + _object1.fixPriority(140); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else if (v == 100) { + _numFrames = 0; + ((SceneItem *)_action)->_sceneRegionId = 0; + + _object1.setStrip(_object1._strip - 1); + _object1.setFrame(_object1.getFrameCount()); + _object1.animate(ANIM_MODE_6, this); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(306, v * 2 - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +void SpeakerSeeker1100::proc15() { + int v = _fieldF6; + + if (!_object2) { + if (v == 0) + return; + + if (R2_GLOBALS._player._characterIndex == 2) { + _object2 = &R2_GLOBALS._player; + } else { + Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene; + _object2 = &scene->_actor16; + } + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(1108, 1, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(1108, 3, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 3: + _object1.setPosition(Common::Point(197, 134)); + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(1108, 5, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 4: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(1109, 7, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 5: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(1109, 3, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +void SpeakerSeeker1900::proc15() { + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 2) { + _object2 = &R2_GLOBALS._player; + } else { + Scene1900 *scene = (Scene1900 *)R2_GLOBALS._sceneManager._scene; + _object2 = &scene->_actor1; + } + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else if (v == 1) { + _object1.setup(4032, 1, 1); + _object1.animate(ANIM_MODE_5, this); + } else { + signal(); + } +} + void SpeakerSeeker2435::proc15() { int v = _fieldF6; @@ -560,24 +2014,17 @@ void SpeakerSeeker2435::proc15() { } } -SpeakerPharisha2435::SpeakerPharisha2435() { - _speakerName = "PHARISHA"; - _color1 = 151; - _color2 = 0; - _fieldF6 = 0; - _textWidth = 300; - _hideObjects = false; - _object2 = NULL; - _displayMode = 1; - _numFrames = 0; -} - -void SpeakerPharisha2435::proc15() { +void SpeakerSeeker2450::proc15() { int v = _fieldF6; - Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor2; + if (R2_GLOBALS._player._characterIndex == 2) { + _object2 = &R2_GLOBALS._player; + } else { + Scene2450 *scene = (Scene2450 *)R2_GLOBALS._sceneManager._scene; + _object2 = &scene->_actor1; + } + _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -587,54 +2034,329 @@ void SpeakerPharisha2435::proc15() { _object1.animate(ANIM_MODE_2, NULL); } else { ((SceneItem *)_action)->_sceneRegionId = 0; - _object1.setup(4098, 5, 1); + _object1.setup(4099, 3, 1); _object1.animate(ANIM_MODE_5, this); } } -/*--------------------------------------------------------------------------*/ +void SpeakerSeeker3375::proc15() { + Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; -SpeakerQuinn2450::SpeakerQuinn2450() { - _speakerName = "QUINN"; - _color1 = 60; - _color2 = 0; - _fieldF6 = 0; - _textWidth = 300; - _hideObjects = false; - _object2 = NULL; - _displayMode = 1; - _numFrames = 0; + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 2) + _object2 = &R2_GLOBALS._player; + else + _object2 = &scene->_actor1; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + + if (scene->_actor1._position.y != 163) + R2_GLOBALS._player.setStrip(8); + else + R2_GLOBALS._player.setStrip(2); + + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + + R2_GLOBALS._player.disableControl(CURSOR_TALK); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4031, 1, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } } -void SpeakerQuinn2450::proc15() { + +void SpeakerSeeker3385::proc15() { + Scene3385 *scene = (Scene3385 *)R2_GLOBALS._sceneManager._scene; + int v = _fieldF6; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == 2) _object2 = &R2_GLOBALS._player; - } else { - Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene; + else _object2 = &scene->_actor1; - } _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + + if (R2_GLOBALS._sceneManager._previousScene == 3375) + R2_GLOBALS._player.setStrip(4); + else + R2_GLOBALS._player.setStrip(3); + + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + + R2_GLOBALS._player.disableControl(CURSOR_TALK); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); } - if (v == 0) { + + switch (v) { + case 0: _object1.animate(ANIM_MODE_2, NULL); - } else { + break; + case 1: ((SceneItem *)_action)->_sceneRegionId = 0; - if (R2_GLOBALS.getFlag(61)) - _object1.setup(2020, 3, 1); + _object1.setup(4031, 3, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +void SpeakerSeeker3395::proc15() { + Scene3395 *scene = (Scene3395 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 2) + _object2 = &R2_GLOBALS._player; else - _object1.setup(2020, 1, 1); + _object2 = &scene->_actor1; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + + if (R2_GLOBALS._sceneManager._previousScene == 3385) + R2_GLOBALS._player.setStrip(4); + else + R2_GLOBALS._player.setStrip(3); + + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + + R2_GLOBALS._player.disableControl(CURSOR_TALK); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4031, 3, 1); _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; } } -SpeakerSeeker2450::SpeakerSeeker2450() { - _speakerName = "SEEKER"; +void SpeakerSeeker3400::proc15() { + Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 2) + _object2 = &R2_GLOBALS._player; + else + _object2 = &scene->_actor1; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4031, 1, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4031, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 3: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4030, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 4: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4031, 7, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 5: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4033, 1, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + default: + signal(); + break; + } +} + +void SpeakerSeeker3600::proc15() { + Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 2) + _object2 = &R2_GLOBALS._player; + else + _object2 = &scene->_actor11; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + + _object1.setPosition(_object2->_position); + + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4031, 5, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4030, 1, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +void SpeakerSeeker3700::setText(const Common::String &msg) { + Scene3700 *scene = (Scene3700 *)R2_GLOBALS._sceneManager._scene; + + if (_fieldF6 == 1) { + R2_GLOBALS._sound2.play(44); + scene->_actor3.setup(30, 8, 1); + } else { + scene->_actor3.setup(30, 2, 1); + } + VisualSpeaker::setText(msg); +} + +void SpeakerSeeker3700::proc15() { + Scene3700 *scene = (Scene3700 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + _object1.setPosition(_object2->_position); + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + R2_GLOBALS._sound2.stop(); + scene->_actor1.setup(10, 8, 1); + scene->_actor2.setup(20, 7, 1); + scene->_actor3.setup(30, 8, 1); + _object1.setup(3701, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + scene->_actor1.setup(10, 2, 1); + scene->_actor2.setup(20, 1, 1); + scene->_actor3.setup(30, 1, 1); + _object1.setup(4031, 1, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + default: + signal(); + break; + } +} + +//---------------------------------------------------------------------------- +// Classes related to SEEKERL +//---------------------------------------------------------------------------- + +SpeakerSeekerL::SpeakerSeekerL(): VisualSpeaker() { + _speakerName = "SEEKERL"; _color1 = 35; _color2 = 0; _fieldF6 = 0; @@ -643,36 +2365,55 @@ SpeakerSeeker2450::SpeakerSeeker2450() { _object2 = NULL; _displayMode = 1; _numFrames = 0; + _fontNumber = 10; } -void SpeakerSeeker2450::proc15() { +//---------------------------------------------------------------------------- +// Classes related to SOCKO +//---------------------------------------------------------------------------- + +SpeakerSocko3200::SpeakerSocko3200() { + _speakerName = "Socko"; + _color1 = 10; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerSocko3200::proc15() { int v = _fieldF6; + Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 2) { - _object2 = &R2_GLOBALS._player; - } else { - Scene2450 *scene = (Scene2450 *)R2_GLOBALS._sceneManager._scene; - _object2 = &scene->_actor1; - } - + _object2 = &scene->_actor3; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); } if (v == 0) { _object1.animate(ANIM_MODE_2, NULL); } else { ((SceneItem *)_action)->_sceneRegionId = 0; - _object1.setup(4099, 3, 1); + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); _object1.animate(ANIM_MODE_5, this); } } -SpeakerCaretaker2450::SpeakerCaretaker2450() { - _speakerName = "CARETAKER"; - _color1 = 43; +//---------------------------------------------------------------------------- +// Classes related to SOLDIER +//---------------------------------------------------------------------------- + +SpeakerSoldier::SpeakerSoldier(int colour) { + _speakerName = "SOLDIER"; + _color1 = colour; _color2 = 0; _fieldF6 = 0; _textWidth = 300; @@ -682,11 +2423,37 @@ SpeakerCaretaker2450::SpeakerCaretaker2450() { _numFrames = 0; } -/*--------------------------------------------------------------------------*/ +void SpeakerSoldier300::proc15() { + int v = _fieldF6; -SpeakerQuinn2500::SpeakerQuinn2500() { - _speakerName = "QUINN"; - _color1 = 60; + if (!_object2) { + Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene; + _object2 = &scene->_teal; + _object2->hide(); + + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(303, 3, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +//---------------------------------------------------------------------------- +// Classes related to TEAL +//---------------------------------------------------------------------------- + +SpeakerTeal::SpeakerTeal(): VisualSpeaker() { + _speakerName = "TEAL"; + _color1 = 22; _color2 = 0; _fieldF6 = 0; _textWidth = 300; @@ -696,9 +2463,201 @@ SpeakerQuinn2500::SpeakerQuinn2500() { _numFrames = 0; } -SpeakerSeeker2500::SpeakerSeeker2500() { - _speakerName = "SEEKER"; - _color1 = 35; +SpeakerTealMode7::SpeakerTealMode7(): SpeakerTeal() { + _displayMode = 7; +} + +void SpeakerTeal300::proc15() { + int v = _fieldF6; + + if (!_object2) { + Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene; + _object2 = &scene->_teal; + _object2->hide(); + + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(303, 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +void SpeakerTeal1625::proc15() { + int v = _fieldF6; + + if (!_object2) { + Scene1625 *scene = (Scene1625 *)R2_GLOBALS._sceneManager._scene; + _object2 = &scene->_actor2; + _object2->hide(); + + _object1.postInit(); + _object1.setPosition(Common::Point(68, 68)); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(1627, 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +void SpeakerTeal3240::proc15() { + int v = _fieldF6; + Scene3240 *scene = (Scene3240 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4070, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +void SpeakerTeal3400::proc15() { + Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + _object2 = &scene->_actor4; + _object2->hide(); + _object1.postInit(); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + _object1.setPosition(_object2->_position); + _object1.show(); + + if (scene ->_sceneMode == 3305) { + R2_GLOBALS._player.setStrip(6); + scene->_actor1.setStrip(6); + scene->_actor2.setStrip(6); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4107, 5, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4107, 1, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 3: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4107, 7, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 4: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4107, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + default: + signal(); + break; + } +} + +void SpeakerTeal3600::proc15() { + Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + _object2 = &scene->_actor5; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + _object1.setPosition(_object2->_position); + + if (scene ->_sceneMode == 3323) { + _object1.hide(); + _object2->show(); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4107, 5, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4107, 1, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 3: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4107, 7, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 4: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4107, 3, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +//---------------------------------------------------------------------------- +// Classes related to TOMKO +//---------------------------------------------------------------------------- + +SpeakerTomko3245::SpeakerTomko3245() { + _speakerName = "Tomko"; + _color1 = 10; _color2 = 0; _fieldF6 = 0; _textWidth = 300; @@ -708,10 +2667,49 @@ SpeakerSeeker2500::SpeakerSeeker2500() { _numFrames = 0; } -SpeakerMiranda2500::SpeakerMiranda2500() { - // Not in uppercase in the original - _speakerName = "Miranda"; - _color1 = 154; +void SpeakerTomko3245::proc15() { + int v = _fieldF6; + Scene3245 *scene = (Scene3245 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + switch (_object2->_visage) { + case 3100: + _object1.setup(4105, (_object2->_strip * 2) - 1, 1); + break; + case 3101: + _object1.setup(4108, (_object2->_strip * 2) - 1, 1); + break; + case 3102: + _object1.setup(4109, (_object2->_strip * 2) - 1, 1); + break; + default: + break; + } + + _object1.animate(ANIM_MODE_5, this); + } +} + +//---------------------------------------------------------------------------- +// Classes related to WEBBSTER +//---------------------------------------------------------------------------- + +SpeakerWebbster::SpeakerWebbster(int colour) { + _speakerName = "WEBBSTER"; + _color1 = colour; _color2 = 0; _fieldF6 = 0; _textWidth = 300; @@ -721,10 +2719,211 @@ SpeakerMiranda2500::SpeakerMiranda2500() { _numFrames = 0; } -SpeakerWebbster2500::SpeakerWebbster2500() { - // Not in uppercase in the original - _speakerName = "Webbster"; - _color1 = 27; +void SpeakerWebbster3240::proc15() { + int v = _fieldF6; + Scene3240 *scene = (Scene3240 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4110, 5, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +void SpeakerWebbster3375::proc15() { + Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + _object2 = &scene->_actor3; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + + if (scene->_actor1._position.y != 163) + R2_GLOBALS._player.setStrip(8); + else + R2_GLOBALS._player.setStrip(2); + + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4110, 5, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +void SpeakerWebbster3385::proc15() { + Scene3385 *scene = (Scene3385 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + _object2 = &scene->_actor3; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + + if (R2_GLOBALS._sceneManager._previousScene == 3375) + R2_GLOBALS._player.setStrip(4); + else + R2_GLOBALS._player.setStrip(3); + + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + + R2_GLOBALS._player.disableControl(CURSOR_TALK); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4110, 5, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +void SpeakerWebbster3395::proc15() { + Scene3395 *scene = (Scene3395 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + _object2 = &scene->_actor3; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + + if (R2_GLOBALS._sceneManager._previousScene == 3385) + R2_GLOBALS._player.setStrip(4); + else + R2_GLOBALS._player.setStrip(3); + + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + + R2_GLOBALS._player.disableControl(CURSOR_TALK); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4110, 5, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + +void SpeakerWebbster3400::proc15() { + Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + _object2 = &scene->_actor3; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4110, 5, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4110, 7, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 3: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4110, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + default: + signal(); + break; + } +} + +//---------------------------------------------------------------------------- + +SpeakerDutyOfficer::SpeakerDutyOfficer(): VisualSpeaker() { + _speakerName = "DUTYOFFICER"; + _color1 = 5; _color2 = 0; _fieldF6 = 0; _textWidth = 300; @@ -734,5 +2933,36 @@ SpeakerWebbster2500::SpeakerWebbster2500() { _numFrames = 0; } +void SpeakerDutyOfficer::proc15() { + Scene180 *scene = (Scene180 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + _object2 = &scene->_object2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + _action = NULL; + _object1.setup(76, 2, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index e6a805f31b..e336564c5f 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -59,31 +59,304 @@ public: virtual void setText(const Common::String &msg); virtual void proc15() {} virtual void proc16(); + + void setDelay(int delay); +}; + +class SpeakerGameText : public VisualSpeaker { +public: + SpeakerGameText(); + + virtual Common::String getClassName() { return "SpeakerGameText"; } +}; + +// Classes related to Captain + +class SpeakerCaptain3210 : public VisualSpeaker { +public: + SpeakerCaptain3210(); + + virtual Common::String getClassName() { return "SpeakerCaptain3210"; } + virtual void proc15(); +}; + +// Classes related to Caretaker + +class SpeakerCaretaker2450 : public VisualSpeaker { +public: + SpeakerCaretaker2450(); + + virtual Common::String getClassName() { return "SpeakerCaretaker2450"; } }; -class SpeakerMiranda300 : public VisualSpeaker { +// Classes related to Chief + +class SpeakerChief1100 : public VisualSpeaker { +public: + SpeakerChief1100(); + + virtual Common::String getClassName() { return "SpeakerChief1100"; } + virtual void proc15(); +}; + +// Classes related to Guard + +class SpeakerGuard : public VisualSpeaker { public: - SpeakerMiranda300(); + SpeakerGuard(); + virtual Common::String getClassName() { return "SpeakerGuard"; } +}; +class SpeakerGuard2800 : public SpeakerGuard { +public: + virtual Common::String getClassName() { return "SpeakerGuard2800"; } + virtual void proc15(); +}; + +// Classes related to Jocko + +class SpeakerJocko : public VisualSpeaker { +public: + SpeakerJocko(); + virtual Common::String getClassName() { return "SpeakerJocko"; } +}; + +class SpeakerJocko3200 : public SpeakerJocko { +public: + virtual Common::String getClassName() { return "SpeakerJocko3200"; } + virtual void proc15(); +}; + +class SpeakerJocko3220 : public SpeakerJocko { +public: + virtual Common::String getClassName() { return "SpeakerJocko3220"; } + virtual void proc15(); +}; + +class SpeakerJocko3230 : public SpeakerJocko { +public: + virtual Common::String getClassName() { return "SpeakerJocko3230"; } + virtual void proc15(); +}; + +// Classes related to Miranda + +class SpeakerMiranda : public VisualSpeaker { +public: + SpeakerMiranda(); + virtual Common::String getClassName() { return "SpeakerMiranda"; } +}; + +class SpeakerMiranda300 : public SpeakerMiranda { +public: virtual Common::String getClassName() { return "SpeakerMiranda300"; } virtual void proc15(); }; -class SpeakerSeeker300 : public VisualSpeaker { +class SpeakerMiranda1625 : public SpeakerMiranda { public: - SpeakerSeeker300(); + virtual Common::String getClassName() { return "SpeakerMiranda1625"; } + virtual void proc15(); +}; - virtual Common::String getClassName() { return "SpeakerSeeker300"; } +class SpeakerMiranda3255 : public SpeakerMiranda { +public: + virtual Common::String getClassName() { return "SpeakerMiranda3255"; } virtual void proc15(); }; -class SpeakerSeekerL : public VisualSpeaker { +class SpeakerMiranda3375 : public SpeakerMiranda { public: - SpeakerSeekerL(); + virtual Common::String getClassName() { return "SpeakerMiranda3375"; } + virtual void proc15(); +}; - virtual Common::String getClassName() { return "SpeakerSeekerL"; } +class SpeakerMiranda3385 : public SpeakerMiranda { +public: + virtual Common::String getClassName() { return "SpeakerMiranda3385"; } + virtual void proc15(); +}; + +class SpeakerMiranda3395 : public SpeakerMiranda { +public: + virtual Common::String getClassName() { return "SpeakerMiranda3395"; } + virtual void proc15(); +}; + +class SpeakerMiranda3400 : public SpeakerMiranda { +public: + virtual Common::String getClassName() { return "SpeakerMiranda3400"; } + virtual void proc15(); +}; + +class SpeakerMiranda3600 : public SpeakerMiranda { +public: + virtual Common::String getClassName() { return "SpeakerMiranda3600"; } + virtual void proc15(); }; +class SpeakerMiranda3700 : public SpeakerMiranda { +public: + virtual Common::String getClassName() { return "SpeakerMiranda3700"; } + virtual void proc15(); +}; + +// Classes related to Nej + +class SpeakerNej : public VisualSpeaker { +public: + SpeakerNej(); + virtual Common::String getClassName() { return "SpeakerNej"; } +}; + +class SpeakerNej2700 : public SpeakerNej { +public: + virtual Common::String getClassName() { return "SpeakerNej2700"; } + virtual void proc15(); +}; + +class SpeakerNej2750 : public SpeakerNej { +public: + virtual Common::String getClassName() { return "SpeakerNej2750"; } + virtual void proc15(); +}; + +class SpeakerNej2800 : public SpeakerNej { +public: + virtual Common::String getClassName() { return "SpeakerNej2800"; } + virtual void proc15(); +}; + +// Classes related to Pharisha + +class SpeakerPharisha : public VisualSpeaker { +public: + SpeakerPharisha(); + + virtual Common::String getClassName() { return "SpeakerPharisha"; } +}; + +class SpeakerPharisha2435 : public SpeakerPharisha { +public: + virtual Common::String getClassName() { return "SpeakerPharisha2435"; } + virtual void proc15(); +}; + +// Classes related to Private + +class SpeakerPrivate3210 : public VisualSpeaker { +public: + SpeakerPrivate3210(); + + virtual Common::String getClassName() { return "SpeakerPrivate3210"; } + virtual void proc15(); +}; + +// Classes related to Protector + +class SpeakerProtector3600 : public VisualSpeaker { +public: + SpeakerProtector3600(); + + virtual Common::String getClassName() { return "SpeakerProtector3600"; } + virtual void proc15(); +}; + +// Classes related to Quinn + +class SpeakerQuinn : public VisualSpeaker { +public: + SpeakerQuinn(); + virtual Common::String getClassName() { return "SpeakerQuinn"; } +}; + +class SpeakerQuinn300 : public SpeakerQuinn { +public: + virtual Common::String getClassName() { return "SpeakerQuinn300"; } + virtual void proc15(); +}; + +class SpeakerQuinn1100 : public SpeakerQuinn { +public: + virtual Common::String getClassName() { return "SpeakerQuinn1100"; } + virtual void proc15(); +}; + +class SpeakerQuinn2435 : public SpeakerQuinn { +public: + virtual Common::String getClassName() { return "SpeakerQuinn2435"; } + virtual void proc15(); +}; + +class SpeakerQuinn2450 : public SpeakerQuinn { +public: + virtual Common::String getClassName() { return "SpeakerQuinn2450"; } + virtual void proc15(); +}; + +class SpeakerQuinn2700 : public SpeakerQuinn { +public: + virtual Common::String getClassName() { return "SpeakerQuinn2700"; } + virtual void proc15(); +}; + +class SpeakerQuinn2750 : public SpeakerQuinn { +public: + virtual Common::String getClassName() { return "SpeakerQuinn2750"; } + virtual void proc15(); +}; + +class SpeakerQuinn2800 : public SpeakerQuinn { +public: + virtual Common::String getClassName() { return "SpeakerQuinn2800"; } + virtual void proc15(); +}; + +class SpeakerQuinn3255 : public SpeakerQuinn { +public: + virtual Common::String getClassName() { return "SpeakerQuinn3255"; } + virtual void proc15(); +}; + +class SpeakerQuinn3375 : public SpeakerQuinn { +public: + virtual Common::String getClassName() { return "SpeakerQuinn3375"; } + virtual void proc15(); +}; + +class SpeakerQuinn3385 : public SpeakerQuinn { +public: + virtual Common::String getClassName() { return "SpeakerQuinn3385"; } + virtual void proc15(); +}; + +class SpeakerQuinn3395 : public SpeakerQuinn { +public: + virtual Common::String getClassName() { return "SpeakerQuinn3395"; } + virtual void proc15(); +}; + +class SpeakerQuinn3400 : public SpeakerQuinn { +public: + virtual Common::String getClassName() { return "SpeakerQuinn3400"; } + virtual void proc15(); +}; + +class SpeakerQuinn3600 : public SpeakerQuinn { +public: + virtual Common::String getClassName() { return "SpeakerQuinn3600"; } + virtual void proc15(); +}; + +class SpeakerQuinn3700 : public SpeakerQuinn { +public: + virtual Common::String getClassName() { return "SpeakerQuinn3700"; } + virtual void setText(const Common::String &msg); + virtual void proc15(); +}; + +// Classes related to QuinnL + class SpeakerQuinnL : public VisualSpeaker { public: SpeakerQuinnL(); @@ -91,118 +364,273 @@ public: virtual Common::String getClassName() { return "SpeakerQuinnL"; } }; -class SpeakerQuinn300 : public VisualSpeaker { +// Classes related to Ralf + +class SpeakerRalf3245 : public VisualSpeaker { public: - SpeakerQuinn300(); + SpeakerRalf3245(); - virtual Common::String getClassName() { return "SpeakerQuinn300"; } + virtual Common::String getClassName() { return "SpeakerRalf3245"; } virtual void proc15(); }; -class SpeakerTeal300 : public VisualSpeaker { +// Classes related to Rocko + +class SpeakerRocko : public VisualSpeaker { public: - SpeakerTeal300(); + SpeakerRocko(); + virtual Common::String getClassName() { return "SpeakerRocko"; } +}; - virtual Common::String getClassName() { return "SpeakerTeal300"; } +class SpeakerRocko3200 : public SpeakerRocko { +public: + virtual Common::String getClassName() { return "SpeakerRocko3200"; } virtual void proc15(); }; -class SpeakerSoldier300 : public VisualSpeaker { +class SpeakerRocko3220 : public SpeakerRocko { public: - SpeakerSoldier300(); + virtual Common::String getClassName() { return "SpeakerRocko3220"; } + virtual void proc15(); +}; - virtual Common::String getClassName() { return "SpeakerSoldier300"; } +class SpeakerRocko3230 : public SpeakerRocko { +public: + virtual Common::String getClassName() { return "SpeakerRocko3230"; } virtual void proc15(); }; -class SpeakerQuinn2350 : public VisualSpeaker { +// Classes related to Seeker + +class SpeakerSeeker : public VisualSpeaker { public: - SpeakerQuinn2350(); + SpeakerSeeker(); + virtual Common::String getClassName() { return "SpeakerSeeker"; } +}; - virtual Common::String getClassName() { return "SpeakerQuinn2350"; } +class SpeakerSeeker300 : public SpeakerSeeker { +public: + virtual Common::String getClassName() { return "SpeakerSeeker300"; } + virtual void proc15(); }; -class SpeakerPharisha2350 : public VisualSpeaker { +class SpeakerSeeker1100 : public SpeakerSeeker { public: - SpeakerPharisha2350(); + virtual Common::String getClassName() { return "SpeakerSeeker1100"; } + virtual void proc15(); +}; - virtual Common::String getClassName() { return "SpeakerPharisha2350"; } +class SpeakerSeeker1900 : public SpeakerSeeker { +public: + virtual Common::String getClassName() { return "SpeakerSeeker1900"; } + virtual void proc15(); }; -class SpeakerQuinn2435 : public VisualSpeaker { +class SpeakerSeeker2435 : public SpeakerSeeker { public: - SpeakerQuinn2435(); + virtual Common::String getClassName() { return "SpeakerSeeker2435"; } + virtual void proc15(); +}; - virtual Common::String getClassName() { return "SpeakerQuinn2435"; } +class SpeakerSeeker2450 : public SpeakerSeeker { +public: + virtual Common::String getClassName() { return "SpeakerSeeker2450"; } virtual void proc15(); }; -class SpeakerSeeker2435 : public VisualSpeaker { +class SpeakerSeeker3375 : public SpeakerSeeker { public: - SpeakerSeeker2435(); + virtual Common::String getClassName() { return "SpeakerSeeker3375"; } + virtual void proc15(); +}; - virtual Common::String getClassName() { return "SpeakerSeeker2435"; } +class SpeakerSeeker3385 : public SpeakerSeeker { +public: + virtual Common::String getClassName() { return "SpeakerSeeker3385"; } virtual void proc15(); }; -class SpeakerPharisha2435 : public VisualSpeaker { +class SpeakerSeeker3395 : public SpeakerSeeker { public: - SpeakerPharisha2435(); + virtual Common::String getClassName() { return "SpeakerSeeker3395"; } + virtual void proc15(); +}; - virtual Common::String getClassName() { return "SpeakerPharisha2435"; } +class SpeakerSeeker3400 : public SpeakerSeeker { +public: + virtual Common::String getClassName() { return "SpeakerSeeker3400"; } virtual void proc15(); }; -class SpeakerQuinn2450 : public VisualSpeaker { +class SpeakerSeeker3600 : public SpeakerSeeker { public: - SpeakerQuinn2450(); + virtual Common::String getClassName() { return "SpeakerSeeker3600"; } + virtual void proc15(); +}; - virtual Common::String getClassName() { return "SpeakerQuinn2450"; } +class SpeakerSeeker3700 : public SpeakerSeeker { +public: + virtual Common::String getClassName() { return "SpeakerSeeker3700"; } + virtual void setText(const Common::String &msg); + virtual void proc15(); +}; + +// Classes related to SeekerL + +class SpeakerSeekerL : public VisualSpeaker { +public: + SpeakerSeekerL(); + + virtual Common::String getClassName() { return "SpeakerSeekerL"; } +}; + +// Classes related to Socko + +class SpeakerSocko3200 : public VisualSpeaker { +public: + SpeakerSocko3200(); + + virtual Common::String getClassName() { return "SpeakerSocko3200"; } virtual void proc15(); }; -class SpeakerSeeker2450 : public VisualSpeaker { +// Classes related to Soldier + +class SpeakerSoldier : public VisualSpeaker { public: - SpeakerSeeker2450(); + SpeakerSoldier(int colour); + virtual Common::String getClassName() { return "SpeakerSoldier"; } +}; - virtual Common::String getClassName() { return "SpeakerSeeker2450"; } +class SpeakerSoldier300 : public SpeakerSoldier { +public: + SpeakerSoldier300() : SpeakerSoldier(60) {}; + virtual Common::String getClassName() { return "SpeakerSoldier300"; } virtual void proc15(); }; -class SpeakerCaretaker2450 : public VisualSpeaker { +class SpeakerSoldier1625 : public SpeakerSoldier { public: - SpeakerCaretaker2450(); + SpeakerSoldier1625() : SpeakerSoldier(5) {}; + virtual Common::String getClassName() { return "SpeakerSoldier1625"; } +}; - virtual Common::String getClassName() { return "SpeakerCaretaker2450"; } +// Classes related to Teal + +class SpeakerTeal : public VisualSpeaker { +public: + SpeakerTeal(); + virtual Common::String getClassName() { return "SpeakerTeal"; } +}; + +class SpeakerTealMode7 : public SpeakerTeal { +public: + SpeakerTealMode7(); + virtual Common::String getClassName() { return "SpeakerTealMode7"; } +}; + +class SpeakerTeal300 : public SpeakerTeal { +public: + virtual Common::String getClassName() { return "SpeakerTeal300"; } + virtual void proc15(); }; -class SpeakerQuinn2500 : public VisualSpeaker { +class SpeakerTeal1625 : public SpeakerTeal { public: - SpeakerQuinn2500(); + virtual Common::String getClassName() { return "SpeakerTeal1625"; } + virtual void proc15(); +}; - virtual Common::String getClassName() { return "SpeakerQuinn2500"; } +class SpeakerTeal3240 : public SpeakerTeal { +public: + virtual Common::String getClassName() { return "SpeakerTeal3240"; } + virtual void proc15(); }; -class SpeakerSeeker2500 : public VisualSpeaker { +class SpeakerTeal3400 : public SpeakerTeal { public: - SpeakerSeeker2500(); + virtual Common::String getClassName() { return "SpeakerTeal3400"; } + virtual void proc15(); +}; - virtual Common::String getClassName() { return "SpeakerSeeker2500"; } +class SpeakerTeal3600 : public SpeakerTealMode7 { +public: + virtual Common::String getClassName() { return "SpeakerTeal3600"; } + virtual void proc15(); }; -class SpeakerMiranda2500 : public VisualSpeaker { +// Classes related to Tomko + +class SpeakerTomko3245 : public VisualSpeaker { public: - SpeakerMiranda2500(); + SpeakerTomko3245(); - virtual Common::String getClassName() { return "SpeakerMiranda2500"; } + virtual Common::String getClassName() { return "SpeakerTomko3245"; } + virtual void proc15(); }; -class SpeakerWebbster2500 : public VisualSpeaker { +// Classes related to Webbster + +class SpeakerWebbster : public VisualSpeaker { public: - SpeakerWebbster2500(); + SpeakerWebbster(int colour); + virtual Common::String getClassName() { return "SpeakerWebbster"; } +}; +class SpeakerWebbster2500 : public SpeakerWebbster { +public: + SpeakerWebbster2500() : SpeakerWebbster(27) {} virtual Common::String getClassName() { return "SpeakerWebbster2500"; } }; + +class SpeakerWebbster3240 : public SpeakerWebbster { +public: + SpeakerWebbster3240() : SpeakerWebbster(10) {}; + + virtual Common::String getClassName() { return "SpeakerWebbster3240"; } + virtual void proc15(); +}; + +class SpeakerWebbster3375 : public SpeakerWebbster { +public: + SpeakerWebbster3375() : SpeakerWebbster(60) {}; + + virtual Common::String getClassName() { return "SpeakerWebbster3375"; } + virtual void proc15(); +}; + +class SpeakerWebbster3385 : public SpeakerWebbster { +public: + SpeakerWebbster3385() : SpeakerWebbster(60) {}; + + virtual Common::String getClassName() { return "SpeakerWebbster3385"; } + virtual void proc15(); +}; + +class SpeakerWebbster3395 : public SpeakerWebbster { +public: + SpeakerWebbster3395() : SpeakerWebbster(60) {}; + + virtual Common::String getClassName() { return "SpeakerWebbster3395"; } + virtual void proc15(); +}; + +class SpeakerWebbster3400 : public SpeakerWebbster { +public: + SpeakerWebbster3400() : SpeakerWebbster(27) {}; + + virtual Common::String getClassName() { return "SpeakerWebbster3400"; } + virtual void proc15(); +}; + +class SpeakerDutyOfficer: public VisualSpeaker { +public: + SpeakerDutyOfficer(); + + virtual Common::String getClassName() { return "SpeakerDutyOfficer"; } + virtual void proc15(); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE |