diff options
Diffstat (limited to 'engines/tsage')
-rw-r--r-- | engines/tsage/core.cpp | 2 | ||||
-rw-r--r-- | engines/tsage/debugger.cpp | 15 | ||||
-rw-r--r-- | engines/tsage/globals.cpp | 7 | ||||
-rw-r--r-- | engines/tsage/globals.h | 6 | ||||
-rw-r--r-- | engines/tsage/graphics.cpp | 6 | ||||
-rw-r--r-- | engines/tsage/graphics.h | 18 | ||||
-rw-r--r-- | engines/tsage/ringworld_logic.cpp | 13 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes1.cpp | 16 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes10.cpp | 28 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes3.cpp | 125 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes3.h | 2 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes5.cpp | 32 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes6.cpp | 31 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes8.cpp | 20 | ||||
-rw-r--r-- | engines/tsage/saveload.cpp | 6 | ||||
-rw-r--r-- | engines/tsage/scenes.cpp | 47 | ||||
-rw-r--r-- | engines/tsage/tsage.cpp | 10 | ||||
-rw-r--r-- | engines/tsage/tsage.h | 6 |
18 files changed, 234 insertions, 156 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 7534abdec7..ae337765a2 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -21,6 +21,7 @@ */ #include "common/system.h" +#include "common/config-manager.h" #include "engines/engine.h" #include "graphics/palette.h" #include "tsage/tsage.h" @@ -1687,6 +1688,7 @@ SceneObject::SceneObject() : SceneHotspot() { _flags |= OBJFLAG_PANES; _frameChange = 0; + _visage = 0; } SceneObject::SceneObject(const SceneObject &so) : SceneHotspot() { diff --git a/engines/tsage/debugger.cpp b/engines/tsage/debugger.cpp index 42ae366ced..5288c98b72 100644 --- a/engines/tsage/debugger.cpp +++ b/engines/tsage/debugger.cpp @@ -63,13 +63,13 @@ bool Debugger::Cmd_Scene(int argc, const char **argv) { if (argc < 2) { DebugPrintf("Usage: %s <scene number> [prior scene #]\n", argv[0]); return true; - } else { - if (argc == 3) - _globals->_sceneManager._sceneNumber = strToInt(argv[2]); + } - _globals->_sceneManager.changeScene(strToInt(argv[1])); - return false; - } + if (argc == 3) + _globals->_sceneManager._sceneNumber = strToInt(argv[2]); + + _globals->_sceneManager.changeScene(strToInt(argv[1])); + return false; } /** @@ -377,7 +377,8 @@ bool Debugger::Cmd_MoveObject(int argc, const char **argv) { RING_INVENTORY._jar._sceneNumber = sceneNum; break; default: - DebugPrintf("Invlid object Id %s\n", argv[1]); + DebugPrintf("Invalid object Id %s\n", argv[1]); + break; } return true; diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index e38fb21237..e629396501 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -64,6 +64,13 @@ Globals::Globals() : _fontColors.background = 0; _fontColors.foreground = 0; _dialogCenter.y = 80; + } else if ((_vm->getGameID() == GType_Ringworld) && (_vm->getFeatures() & GF_CD)) { + _gfxFontNumber = 50; + _gfxColors.background = 53; + _gfxColors.foreground = 0; + _fontColors.background = 51; + _fontColors.foreground = 54; + warning("TODO: Check the 3 additional colors"); } else { _gfxFontNumber = 50; _gfxColors.background = 53; diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index bec05a3c9a..6b3df587b6 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -73,15 +73,15 @@ public: void reset(); void setFlag(int flagNum) { - assert((flagNum > 0) && (flagNum < MAX_FLAGS)); + assert((flagNum >= 0) && (flagNum < MAX_FLAGS)); _flags[flagNum] = true; } void clearFlag(int flagNum) { - assert((flagNum > 0) && (flagNum < MAX_FLAGS)); + assert((flagNum >= 0) && (flagNum < MAX_FLAGS)); _flags[flagNum] = false; } bool getFlag(int flagNum) const { - assert((flagNum > 0) && (flagNum < MAX_FLAGS)); + assert((flagNum >= 0) && (flagNum < MAX_FLAGS)); return _flags[flagNum]; } diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index a212c5dd77..cc11343c9c 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -874,7 +874,7 @@ GfxDialog::~GfxDialog() { void GfxDialog::setDefaults() { GfxElement::setDefaults(); - // Initialise the embedded graphics manager + // Initialize the embedded graphics manager _gfxManager.setDefaults(); // Figure out a rect needed for all the added elements @@ -1209,7 +1209,7 @@ int GfxFont::getStringWidth(const char *s) { /** * Returns the maximum number of characters for words that will fit into a given width * - * @s Message to be analysed + * @s Message to be analyzed * @maxWidth Maximum allowed width */ int GfxFont::getStringFit(const char *&s, int maxWidth) { @@ -1255,7 +1255,7 @@ int GfxFont::getStringFit(const char *&s, int maxWidth) { * Fills out the passed rect with the dimensions of a given string word-wrapped to a * maximum specified width * - * @s Message to be analysed + * @s Message to be analyzed * @bounds Rectangle to put output size into * @maxWidth Maximum allowed line width in pixels */ diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h index c90833a95f..b269520039 100644 --- a/engines/tsage/graphics.h +++ b/engines/tsage/graphics.h @@ -40,8 +40,8 @@ class Region; */ class Rect : public Common::Rect, public Serialisable { public: - Rect() : Common::Rect() {}; - Rect(int16 x1, int16 y1, int16 x2, int16 y2) : Common::Rect(x1, y1, x2, y2) {}; + Rect() : Common::Rect() {} + Rect(int16 x1, int16 y1, int16 x2, int16 y2) : Common::Rect(x1, y1, x2, y2) {} void set(int16 x1, int16 y1, int16 x2, int16 y2); void collapse(int dx, int dy); @@ -60,7 +60,7 @@ public: uint8 foreground; uint8 background; - GfxColors() : foreground(0), background(0) {}; + GfxColors() : foreground(0), background(0) {} }; class LineSlice { @@ -92,8 +92,8 @@ public: Graphics::Surface lockSurface(); void unlockSurface(); void create(int width, int height); - void setBounds(const Rect &bounds) { _bounds = bounds; }; - const Rect &getBounds() const { return _bounds; }; + void setBounds(const Rect &bounds) { _bounds = bounds; } + const Rect &getBounds() const { return _bounds; } void copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Region *priorityRegion = NULL); void copyFrom(GfxSurface &src, Rect destBounds, Region *priorityRegion = NULL) { @@ -187,8 +187,8 @@ public: virtual void setDefaults(); virtual void remove() { _owner = NULL; } virtual void highlight(); - virtual void draw() {}; - virtual bool process(Event &event) { return false; }; + virtual void draw() {} + virtual bool process(Event &event) { return false; } virtual bool focusedEvent(Event &event); }; @@ -229,7 +229,7 @@ private: public: Common::String _message; public: - GfxButton() : GfxElement() {}; + GfxButton() : GfxElement() {} virtual ~GfxButton() {} void setText(const Common::String &s) { @@ -271,7 +271,7 @@ public: _surface.setBounds(_bounds); return _surface.lockSurface(); } - void unlockSurface() { _surface.unlockSurface(); }; + void unlockSurface() { _surface.unlockSurface(); } void fillArea(int xp, int yp, int color); void fillRect(const Rect &bounds, int color); void fillRect2(int xs, int ys, int width, int height, int color); diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp index 2141fcce5a..95c9da9fe7 100644 --- a/engines/tsage/ringworld_logic.cpp +++ b/engines/tsage/ringworld_logic.cpp @@ -1334,8 +1334,12 @@ void RingworldGame::start() { RING_INVENTORY._scanner._sceneNumber = 1; RING_INVENTORY._ring._sceneNumber = 1; - // Switch to the title screen - _globals->_sceneManager.setNewScene(1000); + + if (ConfMan.hasKey("save_slot")) + _globals->_sceneHandler._loadGameSlot = ConfMan.getInt("save_slot"); + else + // Switch to the title screen + _globals->_sceneManager.setNewScene(1000); _globals->_events.showCursor(); } @@ -1409,7 +1413,10 @@ void RingworldGame::endGame(int resNum, int lineNum) { // Savegames exist, so prompt for Restore/Restart bool breakFlag; do { - if (MessageDialog::show(msg, RESTART_BTN_STRING, RESTORE_BTN_STRING) == 0 || _vm->shouldQuit()) { + if (_vm->shouldQuit()) { + breakFlag = true; + } else if (MessageDialog::show(msg, RESTART_BTN_STRING, RESTORE_BTN_STRING) == 0) { + restart(); breakFlag = true; } else { handleSaveLoad(false, _globals->_sceneHandler._loadGameSlot, _globals->_sceneHandler._saveName); diff --git a/engines/tsage/ringworld_scenes1.cpp b/engines/tsage/ringworld_scenes1.cpp index b6daadbef7..82f0153d8f 100644 --- a/engines/tsage/ringworld_scenes1.cpp +++ b/engines/tsage/ringworld_scenes1.cpp @@ -2999,6 +2999,13 @@ void Scene6100::Action5::dispatch() { if ((idx != 3) && (scene->_fadePercent == 100) && (tempSet.sqrt(zeroSet) < 150.0)) { switch (scene->_hitCount++) { + case 0: + scene->_soundHandler.startSound(233); + scene->showMessage(NULL, 0, NULL); + + if (!_globals->getFlag(76)) + scene->_probe.setAction(&scene->_action1); + break; case 1: scene->_soundHandler.startSound(233); scene->showMessage(NULL, 0, NULL); @@ -3006,7 +3013,6 @@ void Scene6100::Action5::dispatch() { if (!_globals->getFlag(76)) scene->_probe.setAction(&scene->_action2); break; - case 2: scene->_soundHandler.startSound(234); scene->showMessage(NULL, 0, NULL); @@ -3015,14 +3021,6 @@ void Scene6100::Action5::dispatch() { scene->_probe.setAction(NULL); scene->setAction(&scene->_action3); break; - - default: - scene->_soundHandler.startSound(233); - scene->showMessage(NULL, 0, NULL); - - if (!_globals->getFlag(76)) - scene->_probe.setAction(&scene->_action1); - break; } _globals->_scenePalette.clearListeners(); diff --git a/engines/tsage/ringworld_scenes10.cpp b/engines/tsage/ringworld_scenes10.cpp index f8844ec486..0b4186531d 100644 --- a/engines/tsage/ringworld_scenes10.cpp +++ b/engines/tsage/ringworld_scenes10.cpp @@ -49,7 +49,7 @@ void Object9350::draw() { } /*-------------------------------------------------------------------------- - * Scene 9100 + * Scene 9100 - Near beach: Slave washing clothes * *--------------------------------------------------------------------------*/ void Scene9100::SceneHotspot1::doAction(int action) { @@ -174,7 +174,7 @@ void Scene9100::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9150 + * Scene 9150 - Castle: Outside the bulwarks * *--------------------------------------------------------------------------*/ void Scene9150::Object3::signal() { @@ -294,7 +294,7 @@ void Scene9150::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9200 + * Scene 9200 - Castle: Near the fountain * *--------------------------------------------------------------------------*/ void Scene9200::SceneHotspot1::doAction(int action) { @@ -470,7 +470,7 @@ void Scene9200::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9300 + * Scene 9300 - Castle: In front of a large guarded door * *--------------------------------------------------------------------------*/ void Scene9300::signal() { @@ -537,7 +537,7 @@ void Scene9300::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9350 + * Scene 9350 - Castle: In a hallway * *--------------------------------------------------------------------------*/ @@ -623,7 +623,7 @@ void Scene9350::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9360 + * Scene 9360 - Castle: In a hallway * *--------------------------------------------------------------------------*/ @@ -701,7 +701,7 @@ void Scene9360::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9400 + * Scene 9400 - Castle: Black-Smith room * *--------------------------------------------------------------------------*/ Scene9400::Scene9400() { @@ -826,7 +826,7 @@ void Scene9400::synchronize(Serializer &s) { } /*-------------------------------------------------------------------------- - * Scene 9450 + * Scene 9450 - Castle: Dining room * *--------------------------------------------------------------------------*/ void Scene9450::Object2::signal() { @@ -1009,7 +1009,7 @@ void Scene9450::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9500 + * Scene 9500 - Castle: Bedroom * *--------------------------------------------------------------------------*/ void Scene9500::Hotspot1::doAction(int action) { @@ -1230,7 +1230,7 @@ void Scene9500::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9700 + * Scene 9700 - Castle: Balcony * *--------------------------------------------------------------------------*/ void Scene9700::signal() { @@ -1302,7 +1302,7 @@ void Scene9700::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9750 + * Scene 9750 - Castle: In the garden * *--------------------------------------------------------------------------*/ void Scene9750::signal() { @@ -1338,7 +1338,7 @@ void Scene9750::postInit(SceneObjectList *OwnerList) { /*-------------------------------------------------------------------------- - * Scene 9850 + * Scene 9850 - Castle: Dressing room * *--------------------------------------------------------------------------*/ void Scene9850::Object6::doAction(int action) { @@ -1642,7 +1642,7 @@ void Scene9850::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9900 + * Scene 9900 - Ending * *--------------------------------------------------------------------------*/ void Scene9900::strAction1::signal() { @@ -1997,7 +1997,7 @@ void Scene9900::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9999 + * Scene 9999 - Space travel * *--------------------------------------------------------------------------*/ diff --git a/engines/tsage/ringworld_scenes3.cpp b/engines/tsage/ringworld_scenes3.cpp index 9931d89ad4..a19f15eca6 100644 --- a/engines/tsage/ringworld_scenes3.cpp +++ b/engines/tsage/ringworld_scenes3.cpp @@ -488,11 +488,11 @@ void Scene2100::Action1::signal() { switch (_actionIndex++) { case 0: _globals->_player.disableControl(); - if (!scene->_field1800) + if (!scene->_sitFl) setDelay(1); else { setAction(&scene->_sequenceManager, this, 2102, &_globals->_player, NULL); - scene->_field1800 = 0; + scene->_sitFl = 0; } break; case 1: { @@ -631,7 +631,7 @@ void Scene2100::Action4::signal() { switch (_actionIndex++) { case 0: _globals->_player.disableControl(); - if (!scene->_field1800) + if (!scene->_sitFl) setDelay(1); else setAction(&scene->_sequenceManager, this, 2102, &_globals->_player, NULL); @@ -655,6 +655,7 @@ void Scene2100::Action4::signal() { } void Scene2100::Action5::signal() { + // Quinn enters the cokpit after Seeker decided to enter the cave alone Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -1401,6 +1402,7 @@ void Scene2100::Hotspot8::doAction(int action) { } void Scene2100::Hotspot10::doAction(int action) { + // Quinn's Console Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene; switch (action) { @@ -1408,13 +1410,15 @@ void Scene2100::Hotspot10::doAction(int action) { SceneItem::display2(2100, 13); break; case CURSOR_USE: - if (scene->_field1800) { + if (scene->_sitFl) { _globals->_player.disableControl(); scene->_sceneMode = 2102; scene->setAction(&scene->_sequenceManager, scene, 2102, &_globals->_player, NULL); } else if (_globals->getFlag(13)) { SceneItem::display2(2100, 28); } else { + _globals->_player.disableControl(); + scene->_sceneMode = 2101; scene->setAction(&scene->_sequenceManager, scene, 2101, &_globals->_player, NULL); } break; @@ -1471,24 +1475,23 @@ void Scene2100::Object2::doAction(int action) { case CURSOR_TALK: if (_globals->getFlag(72)) { _globals->_player.disableControl(); - if (!_globals->getFlag(52)) + if (!_globals->getFlag(52)) { + scene->_sceneMode = 2111; scene->setAction(&scene->_sequenceManager, scene, 2111, NULL); - else { + } else { scene->_sceneMode = _globals->getFlag(53) ? 2112 : 2110; scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, NULL); } - } else { - if (_globals->getFlag(14)) + } else if (_globals->getFlag(13)) { + SceneItem::display2(2100, 31); + } else if (_globals->getFlag(14)) { SceneItem::display2(2100, 32); - else { + } else { _globals->setFlag(14); _globals->_player.disableControl(); scene->_sceneMode = 2108; scene->setAction(&scene->_sequenceManager, scene, 2109, NULL); - } } - - scene->setAction(&scene->_action4); break; default: SceneHotspot::doAction(action); @@ -1497,18 +1500,19 @@ void Scene2100::Object2::doAction(int action) { } void Scene2100::Object3::doAction(int action) { + // Miranda Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene; switch (action) { case CURSOR_LOOK: - if (!_globals->getFlag(59)) + if (_globals->getFlag(59)) SceneItem::display2(2100, 34); else error("***I have no response."); break; case CURSOR_TALK: - if (!_globals->getFlag(59)) { + if (_globals->getFlag(59)) { _globals->_player.disableControl(); scene->_sceneMode = 2108; scene->setAction(&scene->_sequenceManager, scene, 2108, NULL); @@ -1534,6 +1538,14 @@ Scene2100::Scene2100() : _hotspot12(0, CURSOR_LOOK, 2100, 24, CURSOR_USE, 2100, 25, LIST_END), _hotspot13(0, CURSOR_LOOK, 2100, 17, LIST_END), _hotspot15(0, CURSOR_LOOK, 2100, 22, CURSOR_USE, 2100, 23, LIST_END) { + _area1.setup(2153, 2, 1, 2100); + _area1._pt = Common::Point(200, 31); + _area2.setup(2153, 3, 1, 2150); + _area2._pt = Common::Point(200, 50); + _area3.setup(2153, 4, 1, 2320); + _area3._pt = Common::Point(200, 75); + _area4.setup(2153, 1, 1, OBJECT_TRANSLATOR); + _area4._pt = Common::Point(237, 77); } void Scene2100::postInit(SceneObjectList *OwnerList) { @@ -1660,15 +1672,6 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { &_hotspot13, &_hotspot12, &_hotspot8, &_object1, &_hotspot2, &_hotspot3, &_hotspot4, &_hotspot5, &_hotspot6, &_hotspot7, &_hotspot1, NULL); - _area1.setup(2153, 2, 1, 2100); - _area1._pt = Common::Point(200, 31); - _area2.setup(2153, 3, 1, 2150); - _area2._pt = Common::Point(200, 50); - _area3.setup(2153, 4, 1, 2320); - _area3._pt = Common::Point(200, 75); - _area4.setup(2153, 1, 1, OBJECT_TRANSLATOR); - _area4._pt = Common::Point(237, 77); - _globals->_player.postInit(); if (_globals->getFlag(13)) { _globals->_player.setVisage(2170); @@ -1683,7 +1686,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _globals->_player._moveDiff.x = 4; _globals->_player.changeZoom(-1); _globals->_player.disableControl(); - _field1800 = 0; + _sitFl = 0; switch (_globals->_sceneManager._previousScene) { case 2120: @@ -1748,6 +1751,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { setAction(&_action14); } else { _globals->_player.disableControl(); + _globals->_player.fixPriority(1); _globals->_player.setPosition(Common::Point(157, 56)); _sceneMode = 2104; @@ -1818,7 +1822,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _globals->_player.fixPriority(152); _globals->_player.setStrip(2); - _field1800 = 1; + _sitFl = 1; _object4.postInit(); _object4.setVisage(2102); @@ -1852,7 +1856,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _globals->_player.fixPriority(152); _globals->_player.setStrip(2); - _field1800 = 1; + _sitFl = 1; setAction(&_action16); } break; @@ -1926,12 +1930,12 @@ void Scene2100::stripCallback(int v) { void Scene2100::signal() { switch (_sceneMode) { case 2101: - _field1800 = 1; + _sitFl = 1; _globals->_player._uiEnabled = true; _globals->_events.setCursor(CURSOR_USE); break; case 2102: - _field1800 = 0; + _sitFl = 0; _globals->_player.enableControl(); break; case 2103: @@ -1958,7 +1962,7 @@ void Scene2100::signal() { void Scene2100::synchronize(Serializer &s) { Scene::synchronize(s); if (s.getVersion() >= 3) - s.syncAsSint16LE(_field1800); + s.syncAsSint16LE(_sitFl); } /*-------------------------------------------------------------------------- @@ -2479,6 +2483,15 @@ Scene2150::Scene2150() : _hotspot11(0, CURSOR_LOOK, 2150, 12, LIST_END) { _rect1 = Rect(260, 70, 270, 77); _rect2 = Rect(222, 142, 252, 150); + _area1.setup(2153, 2, 1, 2100); + _area1._pt = Common::Point(200, 31); + _area2.setup(2153, 3, 1, 2150); + _area2._pt = Common::Point(200, 50); + _area3.setup(2153, 4, 1, 2320); + _area3._pt = Common::Point(200, 75); + _area4.setup(2153, 1, 1, 10); + _area4._pt = Common::Point(237, 77); + } void Scene2150::postInit(SceneObjectList *OwnerList) { @@ -2492,7 +2505,7 @@ void Scene2150::postInit(SceneObjectList *OwnerList) { _hotspot7.setVisage(2152); _hotspot7._frame = 1; _hotspot7._strip = 2; - _hotspot7.animate(ANIM_MODE_8, NULL); + _hotspot7.animate(ANIM_MODE_8, 0, NULL); _hotspot7.setPosition(Common::Point(122, 62)); _hotspot7.changeZoom(100); _hotspot7.fixPriority(76); @@ -2544,15 +2557,6 @@ void Scene2150::postInit(SceneObjectList *OwnerList) { _globals->_sceneItems.addItems(&_hotspot1, &_hotspot2, &_hotspot3, &_hotspot4, &_hotspot5, &_hotspot6, &_hotspot7, &_hotspot10, &_hotspot9, &_hotspot11, &_hotspot8, NULL); - _area1.setup(2153, 2, 1, 2100); - _area1._pt = Common::Point(200, 31); - _area2.setup(2153, 3, 1, 2150); - _area2._pt = Common::Point(200, 50); - _area3.setup(2153, 4, 1, 2320); - _area3._pt = Common::Point(200, 75); - _area4.setup(2153, 1, 1, 10); - _area4._pt = Common::Point(237, 77); - switch (_globals->_sceneManager._previousScene) { case 2120: _globals->_soundHandler.startSound(160); @@ -4371,6 +4375,7 @@ void Scene2280::synchronize(Serializer &s) { *--------------------------------------------------------------------------*/ void Scene2300::Action1::signal() { + // Quinn and Seeker Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -4441,6 +4446,7 @@ void Scene2300::Action1::signal() { break; case 8: _globals->_game->endGame(2300, 0); + remove(); break; case 9: if (scene->_hotspot5._mover) @@ -4513,6 +4519,7 @@ void Scene2300::Action1::signal() { } void Scene2300::Action2::signal() { + // Miranda tearing cables Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -4579,6 +4586,7 @@ void Scene2300::Action2::signal() { } void Scene2300::Action3::signal() { + // Stunned Miranda Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -4631,6 +4639,7 @@ void Scene2300::Action3::signal() { } void Scene2300::Action4::signal() { + // Ennemies coming Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -4669,6 +4678,7 @@ void Scene2300::Action4::signal() { /*--------------------------------------------------------------------------*/ void Scene2300::Hotspot5::doAction(int action) { + // Ennemies Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene; switch (action) { @@ -4691,6 +4701,7 @@ void Scene2300::Hotspot5::doAction(int action) { } void Scene2300::Hotspot7::doAction(int action) { + // Miranda Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene; switch (action) { @@ -5162,6 +5173,7 @@ void Scene2320::Action3::signal() { } void Scene2320::Action4::signal() { + // Fly Cycle actions Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -5228,11 +5240,13 @@ void Scene2320::Action4::signal() { setDelay(13); break; case 9: - if (!_globals->getFlag(109)) { - SceneItem::display2(2320, 19); - } else { - _globals->_sceneManager.changeScene(7600); - } + // Quinn sits in the flycycle + scene->_hotspot16.hide(); + _globals->_player.setVisage(2323); + _globals->_player.setPosition(Common::Point(303, 176)); + _globals->_player.setStrip(2); + _globals->_player.setFrame(1); + _globals->_player.animate(ANIM_MODE_5, this); break; case 10: if (_globals->getFlag(109)) { @@ -5289,6 +5303,7 @@ void Scene2320::Action4::signal() { break; } case 18: { + scene->_hotspot16.fixPriority(149); Common::Point pt(320, 202); PlayerMover *mover = new PlayerMover(); scene->_hotspot16.addMover(mover, &pt, this); @@ -5588,6 +5603,7 @@ void Scene2320::Hotspot8::doAction(int action) { } void Scene2320::Hotspot10::doAction(int action) { + // Seeker Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene; switch (action) { @@ -5681,6 +5697,7 @@ void Scene2320::Hotspot12::doAction(int action) { } void Scene2320::Hotspot14::doAction(int action) { + // Right Console Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene; switch (action) { @@ -5733,6 +5750,7 @@ void Scene2320::Hotspot14::doAction(int action) { } void Scene2320::Hotspot15::doAction(int action) { + // Left console (Flycycle console) Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene; switch (action) { @@ -5761,6 +5779,14 @@ Scene2320::Scene2320() : _hotspot4(0, CURSOR_LOOK, 2320, 14, LIST_END), _hotspot13(0, CURSOR_LOOK, 2320, 12, LIST_END) { + _area1.setup(2153, 2, 1, 2100); + _area1._pt = Common::Point(200, 31); + _area2.setup(2153, 3, 1, 2150); + _area2._pt = Common::Point(200, 50); + _area3.setup(2153, 4, 1, 2320); + _area3._pt = Common::Point(200, 75); + _area4.setup(2153, 1, 1, 10); + _area4._pt = Common::Point(237, 77); } void Scene2320::postInit(SceneObjectList *OwnerList) { @@ -5813,15 +5839,6 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { _globals->_sceneItems.push_back(&_hotspot8); } - _area1.setup(2153, 2, 1, 2100); - _area1._pt = Common::Point(200, 31); - _area2.setup(2153, 3, 1, 2150); - _area2._pt = Common::Point(200, 50); - _area3.setup(2153, 4, 1, 2320); - _area3._pt = Common::Point(200, 75); - _area4.setup(2153, 1, 1, 10); - _area4._pt = Common::Point(237, 77); - if (_globals->getFlag(43)) { _hotspot11.postInit(); _hotspot11.setVisage(2705); @@ -5897,7 +5914,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { _globals->_player.disableControl(); _globals->_player.animate(ANIM_MODE_NONE, NULL); - _globals->_player.setObjectWrapper(new SceneObjectWrapper()); + _globals->_player.setObjectWrapper(NULL); _globals->_player.setVisage(2347); _globals->_player.setStrip(2); _globals->_player.setFrame(5); diff --git a/engines/tsage/ringworld_scenes3.h b/engines/tsage/ringworld_scenes3.h index 3c3b90db56..cc237a1f91 100644 --- a/engines/tsage/ringworld_scenes3.h +++ b/engines/tsage/ringworld_scenes3.h @@ -278,7 +278,7 @@ public: Action15 _action15; Action16 _action16; Action17 _action17; - int _field1800; + int _sitFl; SceneArea _area1, _area2, _area3, _area4; Scene2100(); diff --git a/engines/tsage/ringworld_scenes5.cpp b/engines/tsage/ringworld_scenes5.cpp index cda69b859f..8b95e40abe 100644 --- a/engines/tsage/ringworld_scenes5.cpp +++ b/engines/tsage/ringworld_scenes5.cpp @@ -34,6 +34,7 @@ namespace tSage { *--------------------------------------------------------------------------*/ void Scene4000::Action1::signal() { + // Quinn has the peg. Everybody enter the screen. Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -124,6 +125,8 @@ void Scene4000::Action1::signal() { } void Scene4000::Action2::signal() { + // Quinn, Seeker and Miranda walks down to the village + // Then, they talk to Rock, and enter the priest hut Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -179,6 +182,7 @@ void Scene4000::Action2::signal() { } void Scene4000::Action3::signal() { + // The guard walks to the left and exits the screen Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -197,6 +201,7 @@ void Scene4000::Action3::signal() { } void Scene4000::Action4::signal() { + // Quinn ties the rope to the rock Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -235,6 +240,7 @@ void Scene4000::Action4::signal() { } void Scene4000::Action5::signal() { + // Chat with Miranda Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -261,6 +267,8 @@ void Scene4000::Action5::signal() { } void Scene4000::Action6::signal() { + // Quinn and Miranda enter the screen and walk to the village. + // Rock comes and notices the alcohol. They all enter his hut. Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -322,6 +330,7 @@ void Scene4000::Action7::signal() { } void Scene4000::Action8::signal() { + // Climb down right Chimney using a rope Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -335,7 +344,7 @@ void Scene4000::Action8::signal() { case 1: _globals->_player.setVisage(4008); _globals->_player.setStrip(5); - _globals->_player.setPriority(16); + _globals->_player.fixPriority(16); _globals->_player.setFrame(1); _globals->_player.setPosition(Common::Point(283, 52)); _globals->_player.animate(ANIM_MODE_5, this); @@ -362,6 +371,7 @@ void Scene4000::Action8::signal() { } void Scene4000::Action9::signal() { + // Villager animations switch (_actionIndex++) { case 0: setDelay(_globals->_randomSource.getRandomNumber(119) + 240); @@ -374,6 +384,7 @@ void Scene4000::Action9::signal() { } void Scene4000::Action10::signal() { + // Villager animations switch (_actionIndex++) { case 0: setDelay(_globals->_randomSource.getRandomNumber(119) + 240); @@ -432,6 +443,7 @@ void Scene4000::Action11::signal() { } void Scene4000::Action12::signal() { + // Quinn enter Rock's hut Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -473,6 +485,7 @@ void Scene4000::Action12::signal() { } void Scene4000::Action13::signal() { + // Lander is landing Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -538,6 +551,7 @@ void Scene4000::Miranda::doAction(int action) { } void Scene4000::Hotspot8::doAction(int action) { + // Guard Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (action) { @@ -652,7 +666,7 @@ void Scene4000::TheTech::doAction(int action) { } void Scene4000::Hotspot13::doAction(int action) { - // Rock + // Rock between the two chimneys Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (action) { @@ -672,6 +686,7 @@ void Scene4000::Hotspot13::doAction(int action) { } void Scene4000::Hotspot::doAction(int action) { + // Wall between the two doors Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (action) { @@ -752,6 +767,7 @@ void Scene4000::Hotspot18::doAction(int action) { } void Scene4000::Hotspot23::doAction(int action) { + // Door of the temple switch (action) { case CURSOR_LOOK: SceneItem::display2(4000, _globals->getFlag(31) ? 10 : 9); @@ -996,6 +1012,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _miranda.setPosition(Common::Point(246, 146)); if (_globals->getFlag(39)) { + // Ollo follows Quinn and gives explanations on the Tech. _globals->clearFlag(39); _olo.postInit(); @@ -1006,6 +1023,8 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _sceneMode = 4010; _globals->_player.disableControl(); + // This is the buggy animation where Miranda comments the Tech even + // if she's not in the room but in the lander. setAction(&_sequenceManager1, this, 4010, &_globals->_player, &_olo, NULL); } @@ -1458,7 +1477,7 @@ void Scene4025::Hole::doAction(int action) { void Scene4025::Peg::synchronize(Serializer &s) { SceneObject::synchronize(s); s.syncAsSint16LE(_field88); - SYNC_POINTER(_armStrip); + s.syncAsSint16LE(_armStrip); } void Scene4025::Peg::doAction(int action) { @@ -2712,6 +2731,10 @@ void Scene4100::postInit(SceneObjectList *OwnerList) { setAction(&_action4); _globals->clearFlag(43); + } else { + // Workaround: In the original, the mouse is hidden when Quinn + // goes back to scene 4150 then to scene 4100. This enables everything. + _globals->_player.enableControl(); } _globals->_player.setPosition(Common::Point(252, 139)); @@ -2978,7 +3001,7 @@ Scene4150::Scene4150() : _hotspot11(0, CURSOR_LOOK, 4150, 6, CURSOR_USE, 4150, 29, LIST_END), _hotspot12(0, CURSOR_LOOK, 4150, 7, CURSOR_USE, 4150, 29, LIST_END), _hotspot17(0, CURSOR_LOOK, 4150, 10, CURSOR_USE, 4150, 27, OBJECT_STUNNER, 4150, 32, LIST_END), - _hotspot18(0, CURSOR_LOOK, 4150, 11, CURSOR_USE, 4150, 32, OBJECT_STUNNER, 4150, 27, LIST_END), + _hotspot18(0, CURSOR_LOOK, 4150, 11, CURSOR_USE, 4150, 27, OBJECT_STUNNER, 4150, 32, LIST_END), _hotspot19(0, CURSOR_LOOK, 4150, 12, CURSOR_USE, 4150, 29, LIST_END), _hotspot20(0, CURSOR_LOOK, 4150, 13, CURSOR_USE, 4150, 29, LIST_END), _hotspot21(0, CURSOR_LOOK, 4150, 13, CURSOR_USE, 4150, 29, LIST_END), @@ -3088,6 +3111,7 @@ void Scene4150::dispatch() { if (!_action && (_globals->_player._position.x >= 316)) { _globals->_soundHandler.proc1(NULL); + _soundHandler.proc1(NULL); _globals->_player.disableControl(); _sceneMode = 4152; setAction(&_sequenceManager, this, 4152, &_globals->_player, NULL); diff --git a/engines/tsage/ringworld_scenes6.cpp b/engines/tsage/ringworld_scenes6.cpp index 958c0ef9e2..9e5766d656 100644 --- a/engines/tsage/ringworld_scenes6.cpp +++ b/engines/tsage/ringworld_scenes6.cpp @@ -614,6 +614,7 @@ void Scene5000::dispatch() { *--------------------------------------------------------------------------*/ void Scene5100::Action1::signal() { + // Quinn enters the cave for the first time Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -663,6 +664,7 @@ void Scene5100::Action1::signal() { } void Scene5100::Action2::signal() { + // Quinn and Seeker exit the cave Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -712,6 +714,7 @@ void Scene5100::Action2::signal() { } void Scene5100::Action3::signal() { + // Quinns shots flesheater Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -746,7 +749,7 @@ void Scene5100::Action3::signal() { scene->_hotspot2.setAction(NULL); scene->_hotspot3.setStrip2(1); - ADD_PLAYER_MOVER_THIS(scene->_hotspot3, 1200, 100); + ADD_PLAYER_MOVER_NULL(scene->_hotspot3, 1200, 100); } else { scene->_hotspot3.setVisage(5130); scene->_hotspot3._strip = 1; @@ -807,6 +810,7 @@ void Scene5100::Action4::signal() { } void Scene5100::Action5::signal() { + // Quinns forgot the statis box in the throne room, and goes back Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -822,7 +826,7 @@ void Scene5100::Action5::signal() { break; case 3: scene->_sceneMode = 5106; - scene->setAction(&scene->_sequenceManager, scene, 5106, &_globals->_player, NULL); + scene->setAction(&scene->_sequenceManager, scene, 5106, &_globals->_player, &scene->_hotspot14, NULL); break; } } @@ -943,6 +947,7 @@ void Scene5100::Hotspot9::doAction(int action) { } void Scene5100::Hotspot17::doAction(int action) { + // Rock blocking pit entrance Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; switch (action) { @@ -1083,7 +1088,7 @@ void Scene5100::postInit(SceneObjectList *OwnerList) { _globals->_player.animate(ANIM_MODE_1, NULL); _globals->_player.disableControl(); - if (!_globals->getFlag(66)) { + if ((!_globals->getFlag(66)) || (RING_INVENTORY._stasisBox._sceneNumber != 1)) { _hotspot14.postInit(); _hotspot14.setVisage(5101); _hotspot14.setPosition(Common::Point(498, 147)); @@ -1744,6 +1749,7 @@ void Scene5200::dispatch() { *--------------------------------------------------------------------------*/ void Scene5300::Action1::signal() { + // Seeker waking up Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -1777,7 +1783,8 @@ void Scene5300::Action1::signal() { _globals->_player.enableControl(); remove(); } else { - _globals->getFlag(60); + _globals->setFlag(60); + scene->_hotspot2._numFrames = 10; if (_globals->getFlag(67)) { scene->_sceneMode = 5310; @@ -1855,8 +1862,8 @@ void Scene5300::Hotspot1::doAction(int action) { break; } } - void Scene5300::Hotspot2::doAction(int action) { + // Seeker Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene; switch (action) { @@ -1883,11 +1890,17 @@ void Scene5300::Hotspot2::doAction(int action) { _globals->_player.disableControl(); if (RING_INVENTORY._stasisBox._sceneNumber != 1) { + scene->_sceneMode = 5316; scene->setAction(&scene->_sequenceManager, scene, 5316, NULL); } else { _globals->setFlag(60); - scene->_sceneMode = _globals->getFlag(67) ? 5315 : 5347; - scene->setAction(&scene->_sequenceManager, scene, 5315, this); + if (_globals->getFlag(67)) { + scene->_sceneMode = 5315; + scene->setAction(&scene->_sequenceManager, scene, 5315, this, NULL); + } else { + scene->_sceneMode = 5347; + scene->setAction(&scene->_sequenceManager, scene, 5347, NULL); + } } } break; @@ -1924,6 +1937,7 @@ void Scene5300::Hotspot2::doAction(int action) { } void Scene5300::Hotspot5::doAction(int action) { + // Sharp bone Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene; switch (action) { @@ -2068,6 +2082,7 @@ void Scene5300::postInit(SceneObjectList *OwnerList) { _globals->_player.disableControl(); if (_globals->getFlag(107) && _globals->getFlag(106)) { + _hotspot2.setVisage(2806); _hotspot2.postInit(); _hotspot2.setObjectWrapper(new SceneObjectWrapper()); _hotspot2.animate(ANIM_MODE_1, NULL); @@ -2175,7 +2190,7 @@ void Scene5300::signal() { setAction(&_sequenceManager, this, 5315, &_hotspot2, NULL); break; case 5315: - _globals->_stripNum = 5315; + _globals->_stripNum = 5302; _globals->_sceneManager.changeScene(5100); break; } diff --git a/engines/tsage/ringworld_scenes8.cpp b/engines/tsage/ringworld_scenes8.cpp index 05306fb450..934c7494fa 100644 --- a/engines/tsage/ringworld_scenes8.cpp +++ b/engines/tsage/ringworld_scenes8.cpp @@ -43,11 +43,12 @@ void SceneObject7700::synchronize(Serializer &s) { } /*-------------------------------------------------------------------------- - * Scene 7000 + * Scene 7000 - Landing near beach * *--------------------------------------------------------------------------*/ void Scene7000::Action1::signal() { + // Quinn walks from the lander to the seaside (action6) then discuss with Skeenar Scene7000 *scene = (Scene7000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -125,6 +126,7 @@ void Scene7000::Action3::dispatch() { /*--------------------------------------------------------------------------*/ void Scene7000::Action3::signal() { + // Lander is landing Scene7000 *scene = (Scene7000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -260,6 +262,7 @@ void Scene7000::Action5::signal() { /*--------------------------------------------------------------------------*/ void Scene7000::Action6::signal() { + // Quinn walks from the lander to the seaside switch (_actionIndex++) { case 0: _globals->_player.disableControl(); @@ -361,6 +364,7 @@ void Scene7000::Hotspot1::doAction(int action) { /*--------------------------------------------------------------------------*/ void Scene7000::Object1::doAction(int action) { + // Skeenar Scene7000 *scene = (Scene7000 *)_globals->_sceneManager._scene; switch (action) { @@ -439,10 +443,10 @@ void Scene7000::Object1::doAction(int action) { scene->_sceneMode = 7005; scene->setAction(&scene->_sequenceManager, scene, 7013, NULL); } else if (_globals->getFlag(13)) { - _globals->_sceneManager._sceneNumber = 7002; + scene->_sceneMode = 7002; scene->setAction(&scene->_sequenceManager, scene, 7014, NULL); } else { - _globals->_sceneManager._sceneNumber = 7002; + scene->_sceneMode = 7002; scene->setAction(&scene->_sequenceManager, scene, 7002, NULL); } break; @@ -652,7 +656,7 @@ void Scene7000::signal() { /*-------------------------------------------------------------------------- - * Scene 7100 + * Scene 7100 - Underwater: swimming * *--------------------------------------------------------------------------*/ @@ -1136,7 +1140,7 @@ void Scene7100::postInit(SceneObjectList *OwnerList) { _globals->_soundHandler.startSound(270); } /*-------------------------------------------------------------------------- - * Scene 7200 + * Scene 7200 - Underwater: Entering the cave * *--------------------------------------------------------------------------*/ @@ -1302,7 +1306,7 @@ void Scene7200::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 7300 + * Scene 7300 - Underwater: Lord Poria * *--------------------------------------------------------------------------*/ @@ -1497,7 +1501,7 @@ void Scene7300::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 7600 + * Scene 7600 - Floating Buildings: Outside * *--------------------------------------------------------------------------*/ @@ -1602,7 +1606,7 @@ void Scene7600::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 7700 + * Scene 7700 - Floating Buildings: In the lab * *--------------------------------------------------------------------------*/ diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp index 6ae62568a3..56df32146a 100644 --- a/engines/tsage/saveload.cpp +++ b/engines/tsage/saveload.cpp @@ -64,14 +64,12 @@ Saver::~Saver() { void Serializer::syncPointer(SavedObject **ptr, Common::Serializer::Version minVersion, Common::Serializer::Version maxVersion) { - int idx; + int idx = 0; assert(ptr); if (isSaving()) { // Get the object index for the given pointer and write it out - if (!*ptr) { - idx = 0; - } else { + if (*ptr) { idx = _saver->blockIndexOf(*ptr); assert(idx > 0); } diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 3741bdafd7..4625661b62 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -227,6 +227,11 @@ void SceneManager::setBgOffset(const Common::Point &pt, int loadCount) { void SceneManager::listenerSynchronize(Serializer &s) { s.validate("SceneManager"); + if (s.isLoading() && !_globals->_sceneManager._scene) + // Loading a savegame straight from the launcher, so instantiate a blank placeholder scene + // in order for the savegame loading to work correctly + _globals->_sceneManager._scene = new Scene(); + _altSceneObjects.synchronize(s); s.syncAsSint32LE(_sceneNumber); s.syncAsUint16LE(_globals->_sceneManager._scene->_activeScreenNumber); @@ -319,7 +324,7 @@ void Scene::loadSceneData(int sceneNum) { // Load the priority regions _priorities.load(sceneNum); - // Initialise the section enabled list + // Initialize the section enabled list Common::set_to(&_enabledSections[0], &_enabledSections[16 * 16], 0xffff); _globals->_sceneOffset.x = (_sceneBounds.left / 160) * 160; @@ -458,32 +463,32 @@ void Scene::drawAltObjects() { } void Scene::setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent) { - int var_6 = 0; + int currDiff = 0; int v = 0; while (v < yStart) _zoomPercents[v++] = minPercent; int diff1 = ABS(maxPercent - minPercent); int diff2 = ABS(yEnd - yStart); - int var_8 = MAX(diff1, diff2); - - while (var_8-- != 0) { - _zoomPercents[v] = minPercent; - if (diff2 <= diff1) { - ++minPercent; - var_6 += diff2; - if (var_6 >= diff1) { - var_6 -= diff1; - ++v; - } - } else { - ++v; - var_6 += diff1; - if (var_6 >= diff2) { - var_6 -= diff2; - ++minPercent; - } - } + int remainingDiff = MAX(diff1, diff2); + + while (remainingDiff-- != 0) { + _zoomPercents[v] = minPercent; + if (diff2 <= diff1) { + ++minPercent; + currDiff += diff2; + if (currDiff >= diff1) { + currDiff -= diff1; + ++v; + } + } else { + ++v; + currDiff += diff1; + if (currDiff >= diff2) { + currDiff -= diff2; + ++minPercent; + } + } } while (yEnd < 256) diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp index 4f55ecfb83..50ce0ce4be 100644 --- a/engines/tsage/tsage.cpp +++ b/engines/tsage/tsage.cpp @@ -60,7 +60,7 @@ bool TSageEngine::hasFeature(EngineFeature f) const { (f == kSupportsSavingDuringRuntime); } -void TSageEngine::initialise() { +void TSageEngine::initialize() { _saver = new Saver(); // Set up the resource manager @@ -83,7 +83,7 @@ void TSageEngine::initialise() { _globals->gfxManager().setDefaults(); } -void TSageEngine::deinitialise() { +void TSageEngine::deinitialize() { delete _globals; delete _resourceManager; delete _saver; @@ -91,12 +91,12 @@ void TSageEngine::deinitialise() { Common::Error TSageEngine::run() { // Basic initialisation - initialise(); + initialize(); _globals->_sceneHandler.registerHandler(); _globals->_game->execute(); - deinitialise(); + deinitialize(); return Common::kNoError; } @@ -124,7 +124,7 @@ Common::Error TSageEngine::loadGameState(int slot) { /** * Save the game to the given slot index, and with the given name */ -Common::Error TSageEngine::saveGameState(int slot, const char *desc) { +Common::Error TSageEngine::saveGameState(int slot, const Common::String &desc) { return _saver->save(slot, desc); } diff --git a/engines/tsage/tsage.h b/engines/tsage/tsage.h index 2228212510..563fdfcc21 100644 --- a/engines/tsage/tsage.h +++ b/engines/tsage/tsage.h @@ -83,11 +83,11 @@ public: virtual bool canLoadGameStateCurrently(); virtual bool canSaveGameStateCurrently(); virtual Common::Error loadGameState(int slot); - virtual Common::Error saveGameState(int slot, const char *desc); + virtual Common::Error saveGameState(int slot, const Common::String &desc); Common::String generateSaveName(int slot); - void initialise(); - void deinitialise(); + void initialize(); + void deinitialize(); }; extern TSageEngine *_vm; |