diff options
author | strangerke | 2011-04-12 22:02:36 +0200 |
---|---|---|
committer | strangerke | 2011-04-12 22:02:36 +0200 |
commit | 842d37711824a74a9415369c0cc1e38c7a238ad9 (patch) | |
tree | 33dffdba74b9a6e313e950dac9566d5939950c76 /engines | |
parent | 8b790e03883ad5ea5c47b9a330a414a2580ec763 (diff) | |
parent | d61ad0153017f67e6eb6aaa87b54c1d6fec566ad (diff) | |
download | scummvm-rg350-842d37711824a74a9415369c0cc1e38c7a238ad9.tar.gz scummvm-rg350-842d37711824a74a9415369c0cc1e38c7a238ad9.tar.bz2 scummvm-rg350-842d37711824a74a9415369c0cc1e38c7a238ad9.zip |
Merge branch 'tsage' of http://github.com/dreammaster/scummvm
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tsage/core.cpp | 4 | ||||
-rw-r--r-- | engines/tsage/events.cpp | 1 | ||||
-rw-r--r-- | engines/tsage/globals.h | 1 | ||||
-rw-r--r-- | engines/tsage/graphics.cpp | 40 | ||||
-rw-r--r-- | engines/tsage/graphics.h | 2 | ||||
-rw-r--r-- | engines/tsage/resources.cpp | 26 | ||||
-rw-r--r-- | engines/tsage/resources.h | 36 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes1.cpp | 186 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes1.h | 18 | ||||
-rw-r--r-- | engines/tsage/scenes.cpp | 3 | ||||
-rw-r--r-- | engines/tsage/tsage.cpp | 19 | ||||
-rw-r--r-- | engines/tsage/tsage.h | 1 |
12 files changed, 190 insertions, 147 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 4ce7513e12..84bd878f6f 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -1127,7 +1127,7 @@ void PaletteRotation::signal() { void PaletteRotation::remove() { Action *action = _action; - g_system->getPaletteManager()->setPalette((const byte *)&_palette[0], _start, _end - _start); + g_system->getPaletteManager()->setPalette((const byte *)&_palette[_start], _start, _end - _start); if (_scenePalette->_listeners.contains(this)) _scenePalette->_listeners.remove(this); @@ -2527,7 +2527,6 @@ void SceneText::setup(const Common::String &msg) { gfxMan._font._colours2.foreground = _colour3; gfxMan.getStringBounds(msg.c_str(), textRect, _width); - _bounds = textRect; // Set up a new blank surface to hold the text _textSurface.create(textRect.width(), textRect.height()); @@ -2535,6 +2534,7 @@ void SceneText::setup(const Common::String &msg) { _textSurface.fillRect(textRect, _textSurface._transColour); // Write the text to the surface + gfxMan._bounds = textRect; gfxMan._font.writeLines(msg.c_str(), textRect, _textMode); // Do post-init, which adds this SceneText object to the scene diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index be3b7e3f53..7b02683226 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -37,6 +37,7 @@ namespace tSage { EventsClass::EventsClass() { + _currentCursor = CURSOR_NONE; _frameNumber = 0; _priorFrameTime = 0; _prevDelayFrame = 0; diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index c06c073691..1696ae300d 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -70,7 +70,6 @@ public: SequenceManager _sequenceManager; Common::RandomSource _randomSource; int _stripNum; - FloatSet _floatSet; public: Globals(); ~Globals(); diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 2b323da07a..9a13abcf59 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -226,30 +226,16 @@ GfxSurface::GfxSurface(): _bounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) { _lockSurfaceCtr = 0; _customSurface = NULL; _screenSurfaceP = NULL; - _freeSurface = false; } GfxSurface::GfxSurface(const GfxSurface &s) { - assert(!s._lockSurfaceCtr); - _disableUpdates = false; _lockSurfaceCtr = 0; - _screenSurface = s._screenSurface; - _screenSurfaceP = s._screenSurfaceP; - _customSurface = s._customSurface; - _centroid = s._centroid; - _transColour = s._transColour; - _bounds = s._bounds; - - if (!_screenSurface) { - create(s._customSurface->w, s._customSurface->h); - Common::copy((const byte *)s._customSurface->pixels, - (const byte *)s._customSurface->pixels + (_bounds.width() * _bounds.height()), - (byte *)_customSurface->pixels); - } + _customSurface = NULL; + this->operator =(s); } GfxSurface::~GfxSurface() { - if (_freeSurface) { + if (_customSurface) { _customSurface->free(); delete _customSurface; } @@ -265,15 +251,6 @@ void GfxSurface::setScreenSurface() { } /** - * Specifies the underlying ScummmVM surface that this class should encapsulate - */ -void GfxSurface::setSurface(Graphics::Surface *s) { - _customSurface = s; - _screenSurface = false; - _lockSurfaceCtr = 0; -} - -/** * Specifies that the surface should maintain it's own internal surface */ void GfxSurface::create(int width, int height) { @@ -281,7 +258,6 @@ void GfxSurface::create(int width, int height) { _screenSurface = false; _customSurface = new Graphics::Surface(); _customSurface->create(width, height, 1); - _freeSurface = true; _bounds = Rect(0, 0, width, height); } @@ -340,18 +316,22 @@ GfxSurface &GfxSurface::operator=(const GfxSurface &s) { assert(_lockSurfaceCtr == 0); assert(s._lockSurfaceCtr == 0); + if (_customSurface) { + _customSurface->free(); + delete _customSurface; + } + _customSurface = s._customSurface; _screenSurface = s._screenSurface; - _freeSurface = s._freeSurface; _disableUpdates = s._disableUpdates; _bounds = s._bounds; _centroid = s._centroid; _transColour = s._transColour; - if (_freeSurface) { + if (_customSurface) { // Surface owns the internal data, so replicate it so new surface owns it's own _customSurface = new Graphics::Surface(); - _customSurface->create(_bounds.width(), _bounds.height(), 1); + _customSurface->create(s._customSurface->w, s._customSurface->h, 1); const byte *srcP = (const byte *)s._customSurface->getBasePtr(0, 0); byte *destP = (byte *)_customSurface->getBasePtr(0, 0); diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h index 678fdd7ccd..e1527bdbcb 100644 --- a/engines/tsage/graphics.h +++ b/engines/tsage/graphics.h @@ -80,7 +80,6 @@ private: Graphics::Surface *_screenSurfaceP; int _lockSurfaceCtr; bool _screenSurface; - bool _freeSurface; bool _disableUpdates; Rect _bounds; @@ -93,7 +92,6 @@ public: ~GfxSurface(); void setScreenSurface(); - void setSurface(Graphics::Surface *s); Graphics::Surface lockSurface(); void unlockSurface(); void create(int width, int height); diff --git a/engines/tsage/resources.cpp b/engines/tsage/resources.cpp index 74e9183cf5..619f818f6e 100644 --- a/engines/tsage/resources.cpp +++ b/engines/tsage/resources.cpp @@ -178,14 +178,14 @@ void RlbManager::loadSection(uint32 fileOffset) { assert(type <= 1); uint32 offset = _file.readUint32LE(); - ResourceEntry *re = new ResourceEntry(); - re->id = id; - re->fileOffset = offset; - re->isCompressed = type != 0; - re->size = ((sizeHi & 0xF) << 16) | size; - re->uncompressedSize = ((sizeHi & 0xF0) << 12) | uncSize; - - _resources.push_back(*re); + ResourceEntry re; + re.id = id; + re.fileOffset = offset; + re.isCompressed = type != 0; + re.size = ((sizeHi & 0xF) << 16) | size; + re.uncompressedSize = ((sizeHi & 0xF0) << 12) | uncSize; + + _resources.push_back(re); } } @@ -340,12 +340,12 @@ void RlbManager::loadIndex() { fileOffset = READ_LE_UINT16(p + 4); p += 6; - SectionEntry *se = new SectionEntry(); - se->resNum = resNum; - se->resType = (ResourceType)(configId & 0x1f); - se->fileOffset = (((configId >> 5) & 0x7ff) << 16) | fileOffset; + SectionEntry se; + se.resNum = resNum; + se.resType = (ResourceType)(configId & 0x1f); + se.fileOffset = (((configId >> 5) & 0x7ff) << 16) | fileOffset; - _sections.push_back(*se); + _sections.push_back(se); } _memoryManager.deallocate(pData); diff --git a/engines/tsage/resources.h b/engines/tsage/resources.h index 418563261f..5d00e5f70c 100644 --- a/engines/tsage/resources.h +++ b/engines/tsage/resources.h @@ -45,27 +45,53 @@ enum ResourceType { RES_LIBRARY, RES_STRIP, RES_IMAGE, RES_PALETTE, RES_VISAGE, RES_FONT, RES_POINTER, RES_BANK, RES_SND_DRIVER, RES_PRIORITY, RES_CONTROL, RES_WALKRGNS, RES_BITMAP, RES_SAVE, RES_SEQUENCE }; -struct MemoryHeader { +class MemoryHeader { +public: uint32 id; int16 index; int lockCtr; int criticalCtr; uint8 tag; uint32 size; + + MemoryHeader() { + id = 0; + index = 0; + lockCtr = 0; + criticalCtr = 0; + tag = 0; + size = 0; + } }; -struct SectionEntry { +class SectionEntry { +public: ResourceType resType; uint16 resNum; uint32 fileOffset; + + SectionEntry() { + resType = RES_LIBRARY; + resNum = 0; + fileOffset = 0; + } }; -struct ResourceEntry { +class ResourceEntry { +public: uint16 id; bool isCompressed; uint32 fileOffset; uint32 size; uint32 uncompressedSize; + + ResourceEntry() { + id = 0; + isCompressed = false; + fileOffset = 0; + size = 0; + uncompressedSize = 0; + } }; typedef Common::List<ResourceEntry> ResourceList; @@ -73,6 +99,10 @@ typedef Common::List<ResourceEntry> ResourceList; class SectionList: public Common::List<SectionEntry> { public: uint32 fileOffset; + + SectionList() { + fileOffset = 0; + } }; class MemoryManager { diff --git a/engines/tsage/ringworld_scenes1.cpp b/engines/tsage/ringworld_scenes1.cpp index 033c684aeb..f847943bc5 100644 --- a/engines/tsage/ringworld_scenes1.cpp +++ b/engines/tsage/ringworld_scenes1.cpp @@ -2836,7 +2836,7 @@ void Scene6100::Action3::signal() { switch (_actionIndex++) { case 0: - scene->_field_30E = 0; + scene->_speed = 0; setDelay(60); break; case 1: @@ -2847,10 +2847,10 @@ void Scene6100::Action3::signal() { scene->_object1.hide(); scene->_object2.hide(); scene->_object3.hide(); - scene->_object6.hide(); - scene->_object7.hide(); - scene->_object8.hide(); - scene->_object4.hide(); + scene->_sunflower1.hide(); + scene->_sunflower2.hide(); + scene->_sunflower3.hide(); + scene->_rocks.hide(); scene->_sceneText.hide(); _globals->_events.setCursor(CURSOR_WALK); @@ -2892,8 +2892,8 @@ void Scene6100::Action4::signal() { void Scene6100::Action5::dispatch() { Scene6100 *scene = (Scene6100 *)_globals->_sceneManager._scene; - FloatSet floatSet = _globals->_floatSet; - const double MULTIPLY_FACTOR = 0.01744; + FloatSet zeroSet; + const double MULTIPLY_FACTOR = 0.01744; // 2 * pi / 360 if (scene->_turnAmount) { scene->_angle = (scene->_turnAmount + scene->_angle) % 360; @@ -2915,30 +2915,26 @@ void Scene6100::Action5::dispatch() { scene->_object2._flags |= OBJFLAG_PANES; scene->_object3._flags |= OBJFLAG_PANES; - double v2, v3; - v2 = scene->_field_30E; - v3 = (double)scene->_angle * MULTIPLY_FACTOR; - scene->_object5._floats._float1 += sin(v3) * v2; - - v2 = scene->_field_30E; - v3 = scene->_angle * MULTIPLY_FACTOR; - scene->_object5._floats._float2 += cos(v3) * v2; + double distance = scene->_speed; + double angle = (double)scene->_angle * MULTIPLY_FACTOR; + scene->_probe._floats._float1 += sin(angle) * distance; + scene->_probe._floats._float2 += cos(angle) * distance; for (int idx = 0; idx < 4; ++idx) { FloatSet tempSet = scene->_objList[idx]->_floats; - tempSet.add(-scene->_object5._floats._float1, -scene->_object5._floats._float2, - -scene->_object5._floats._float3); + tempSet.add(-scene->_probe._floats._float1, -scene->_probe._floats._float2, + -scene->_probe._floats._float3); tempSet.proc1(scene->_angle * MULTIPLY_FACTOR); - double sqrtVal = tempSet.sqrt(floatSet); + double sqrtVal = tempSet.sqrt(zeroSet); if (sqrtVal != 0.0) { - scene->_objList[idx]->_position.y = static_cast<int>( - sqrtVal / 13800.0 + 62.0); + scene->_objList[idx]->_position.y = static_cast<int>(13800.0 / sqrtVal + 62.0); } scene->_objList[idx]->_position.x = static_cast<int>( - 160.0 - ((tempSet._float2 + 330.0) / 330.0 * tempSet._float1)); + 160.0 - (330.0 / (tempSet._float2 + 330.0) * tempSet._float1)); + scene->_objList[idx]->dispatch(); if (tempSet._float2 < 0) { scene->_objList[idx]->_position.y = 300; @@ -2951,24 +2947,20 @@ void Scene6100::Action5::dispatch() { scene->_objList[idx]->_floats.proc1( -(scene->_turnAmount * 10 + scene->_angle) * MULTIPLY_FACTOR); - - scene->_objList[idx]->_floats.add(scene->_object5._floats._float1, - scene->_object5._floats._float2, scene->_object5._floats._float3); + scene->_objList[idx]->_floats.add(scene->_probe._floats._float1, + scene->_probe._floats._float2, scene->_probe._floats._float3); } } if (idx == 3) { - if (((int)tempSet._float1 >= 100) || (tempSet._float2 > 0)) - scene->_field_314 = 0; - else - scene->_field_314 = 1; + scene->_rocksCheck = (ABS((int)tempSet._float1) < 100) && (tempSet._float2 > 0); } scene->_objList[idx]->_flags |= OBJFLAG_PANES; /* if ((idx != 3) && (scene->_fadePercent == 100) && (tempSet.sqrt(floatSet) < 150.0)) { - switch (scene->_field_312++) { + switch (scene->_hitCount++) { case 1: scene->_soundHandler.startSound(233); scene->showMessage(0, NULL, 0); @@ -3001,29 +2993,29 @@ void Scene6100::Action5::dispatch() { } } -void Scene6100::Action6::signal() { +void Scene6100::GetBoxAction::signal() { Scene6100 *scene = (Scene6100 *)_globals->_sceneManager._scene; switch (_actionIndex++) { case 0: { scene->_turnAmount = 0; - Common::Point pt(scene->_object4._position.x, scene->_object4._position.y + 10); - NpcMover *mover = new NpcMover(); - scene->_object5.addMover(mover, &pt, NULL); - scene->_object5.show(); + Common::Point pt(scene->_rocks._position.x, scene->_rocks._position.y + 10); + ProbeMover *mover = new ProbeMover(); + scene->_probe.addMover(mover, &pt, NULL); + scene->_probe.show(); break; } case 1: { scene->showMessage(SCENE6100_TAKE_CONTROLS, 35, this); _globals->_scenePalette.clearListeners(); - Common::Point pt(scene->_object4._position.x, scene->_object4._position.y - 10); + Common::Point pt(scene->_rocks._position.x, scene->_rocks._position.y - 10); NpcMover *mover = new NpcMover(); - scene->_object5.addMover(mover, &pt, NULL); + scene->_probe.addMover(mover, &pt, NULL); break; } case 2: - scene->_object5._percent = 4; + scene->_probe._percent = 4; scene->showMessage(SCENE6100_SURPRISE, 13, this); break; case 3: @@ -3039,6 +3031,24 @@ void Scene6100::Action6::signal() { } } +void Scene6100::GetBoxAction::dispatch() { + Scene6100 *scene = (Scene6100 *)_globals->_sceneManager._scene; + + if (!scene->_probe._mover && (scene->_getBoxAction._actionIndex >= 1)) { + if (scene->_getBoxAction._actionIndex == 1) { + scene->_speed = 0; + scene->_getBoxAction.signal(); + } + + if (scene->_probe._percent > 4) + // Handle the probe disappearing into the rocks + scene->_probe._percent = scene->_probe._percent * 7 / 8; + scene->_probe._flags |= OBJFLAG_PANES; + } + + Action::dispatch(); +} + void Scene6100::Action7::signal() { switch (_actionIndex++) { case 0: @@ -3056,6 +3066,21 @@ void Scene6100::Action7::signal() { /*--------------------------------------------------------------------------*/ +void Scene6100::ProbeMover::dispatch() { + Scene6100 *scene = (Scene6100 *)_globals->_sceneManager._scene; + + if (!dontMove()) { + if (scene->_speed > 0) { + scene->_action5.dispatch(); + scene->_speed = (scene->_speed * 4) / 5; + } + } + + NpcMover::dispatch(); +} + +/*--------------------------------------------------------------------------*/ + void Scene6100::Item1::doAction(int action) { SceneItem::display2(4000, 0); } @@ -3093,33 +3118,33 @@ void Scene6100::postInit(SceneObjectList *OwnerList) { _object3.setPosition(Common::Point(320, 60)); _object3.setPriority2(1); - _object4.postInit(); - _object4.setVisage(6100); - _object4._frame = 1; - _object4._strip = 3; - _object4.setPosition(Common::Point(320, 0)); - _object4.setPriority2(2); - _object4.changeZoom(-1); - _object4._floats._float1 = 320.0; - _object4._floats._float2 = 25000.0; - _object4._floats._float3 = 0.0; - - _object5.postInit(); - _object5._moveDiff = Common::Point(15, 15); - _object5.setVisage(6100); - _object5._frame = 1; - _object5._strip = 5; - _object5.setPosition(Common::Point(160, 260)); - _object5.setPriority2(3); - _object5._floats._float1 = 320.0; - _object5._floats._float2 = 0.0; - _object5._floats._float3 = 0.0; - _object5.hide(); - - _objList[0] = &_object6; - _objList[1] = &_object7; - _objList[2] = &_object8; - _objList[3] = &_object4; + _rocks.postInit(); + _rocks.setVisage(6100); + _rocks._frame = 1; + _rocks._strip = 3; + _rocks.setPosition(Common::Point(320, 0)); + _rocks.setPriority2(2); + _rocks.changeZoom(-1); + _rocks._floats._float1 = 320.0; + _rocks._floats._float2 = 25000.0; + _rocks._floats._float3 = 0.0; + + _probe.postInit(); + _probe._moveDiff = Common::Point(15, 15); + _probe.setVisage(6100); + _probe._frame = 1; + _probe._strip = 5; + _probe.setPosition(Common::Point(160, 260)); + _probe.setPriority2(3); + _probe._floats._float1 = 320.0; + _probe._floats._float2 = 0.0; + _probe._floats._float3 = 0.0; + _probe.hide(); + + _objList[0] = &_sunflower1; + _objList[1] = &_sunflower2; + _objList[2] = &_sunflower3; + _objList[3] = &_rocks; int baseVal = 2000; for (int idx = 0; idx < 3; ++idx) { @@ -3139,10 +3164,10 @@ void Scene6100::postInit(SceneObjectList *OwnerList) { _objList[idx]->changeZoom(-1); } - _field_30E = 30; + _speed = 30; _fadePercent = 100; - _field_314 = 0; - _field_312 = 0; + _rocksCheck = false; + _hitCount = 0; _turnAmount = 0; _angle = 0; _msgActive = false; @@ -3151,7 +3176,7 @@ void Scene6100::postInit(SceneObjectList *OwnerList) { _globals->_scenePalette.addRotation(96, 143, -1); if (!_globals->getFlag(76)) - _object5.setAction(&_action4); + _probe.setAction(&_action4); _globals->_soundHandler.startSound(231); } @@ -3174,15 +3199,15 @@ void Scene6100::process(Event &event) { } } - if (_object5._action) - _object5._action->process(event); + if (_probe._action) + _probe._action->process(event); } void Scene6100::dispatch() { Scene::dispatch(); - if (_object5._action) - _object5._action->dispatch(); + if (_probe._action) + _probe._action->dispatch(); // Handle mouse controlling the turning int changeAmount = (_globals->_events._mousePos.x - 160) / -20; @@ -3201,8 +3226,8 @@ void Scene6100::dispatch() { if (_action != &_action3) { // Display the distance remaining to the target - int distance = _object5._floats.sqrt(_object4._floats); - Common::String s = Common::String::format("%06lu", distance); + int distance = _probe._floats.sqrt(_rocks._floats); + Common::String s = Common::String::format("%06d", distance); _sceneText.setPosition(Common::Point(24, 160)); _sceneText._fontNumber = 0; @@ -3210,13 +3235,12 @@ void Scene6100::dispatch() { _sceneText.setup(s); } - if (_field_314) { - if (_action == &_action5) { - double distance = _object5._floats.sqrt(_object4._floats); - - if ((distance >= 300.0) && (distance <= 500.0)) - setAction(&_action6); - } + if (_rocksCheck && (_action == &_action5)) { + // Check whether the probe is close enough to the rocks + double distance = _probe._floats.sqrt(_rocks._floats); + + if ((distance >= 300.0) && (distance <= 500.0)) + setAction(&_getBoxAction); } } diff --git a/engines/tsage/ringworld_scenes1.h b/engines/tsage/ringworld_scenes1.h index cc3d472fab..89aa0a65c5 100644 --- a/engines/tsage/ringworld_scenes1.h +++ b/engines/tsage/ringworld_scenes1.h @@ -494,9 +494,10 @@ class Scene6100: public Scene { public: virtual void dispatch(); }; - class Action6: public Action { + class GetBoxAction: public Action { public: virtual void signal(); + virtual void dispatch(); }; class Action7: public Action { public: @@ -508,6 +509,10 @@ class Scene6100: public Scene { public: FloatSet _floats; }; + class ProbeMover: public NpcMover { + public: + virtual void dispatch(); + }; /* Items */ class Item1: public SceneItem { @@ -521,20 +526,21 @@ public: Action3 _action3; Action4 _action4; Action5 _action5; - Action6 _action6; + GetBoxAction _getBoxAction; Action7 _action7; SoundHandler _soundHandler; Speaker _speaker1; SpeakerQR _speakerQR; SpeakerSL _speakerSL; SceneObject _object1, _object2, _object3; - Object _object4, _object5, _object6; - Object _object7, _object8; + Object _rocks, _probe; + Object _sunflower1, _sunflower2, _sunflower3; SceneText _sceneText; SceneItem _item1; - int _turnAmount, _angle, _field_30E, _fadePercent; - int _field_312, _field_314; + int _turnAmount, _angle, _speed, _fadePercent; + int _hitCount; + bool _rocksCheck; Object *_objList[4]; bool _msgActive; diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 5cd4fb7f4b..5a351f3772 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -35,6 +35,7 @@ SceneManager::SceneManager() { _hasPalette = false; _sceneNumber = -1; _nextSceneNumber = -1; + _previousScene = 0; _fadeMode = FADEMODE_GRADUAL; _scrollerRect = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); _saver->addListener(this); @@ -135,7 +136,7 @@ void SceneManager::changeScene(int newSceneNumber) { // Fade out the scene ScenePalette scenePalette; uint32 adjustData = 0; - scenePalette.clearListeners(); + _globals->_scenePalette.clearListeners(); scenePalette.getPalette(); for (int percent = 100; percent >= 0; percent -= 5) { diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp index 5a1d8d3f76..5be5875652 100644 --- a/engines/tsage/tsage.cpp +++ b/engines/tsage/tsage.cpp @@ -59,8 +59,6 @@ TSageEngine::~TSageEngine() { // Remove all of our debug levels here DebugMan.clearAllDebugChannels(); delete _debugger; - delete _dataManager; - delete _tSageManager; } bool TSageEngine::hasFeature(EngineFeature f) const { @@ -73,15 +71,21 @@ bool TSageEngine::hasFeature(EngineFeature f) const { void TSageEngine::initialise() { _tSageManager = new RlbManager(_memoryManager, "tsage.rlb"); _dataManager = new RlbManager(_memoryManager, "ring.rlb"); -} -Common::Error TSageEngine::run() { - // Basic initialisation - initialise(); _saver = new Saver(); _globals = new Globals(); _globals->gfxManager().setDefaults(); +} +void TSageEngine::deinitialise() { + delete _globals; + delete _saver; + delete _tSageManager; + delete _dataManager; +} + +Common::Error TSageEngine::run() { + // Basic initialisation initialise(); _globals->_events.showCursor(); @@ -89,8 +93,7 @@ Common::Error TSageEngine::run() { _globals->_sceneHandler.registerHandler(); _globals->_game.execute(); - delete _globals; - delete _saver; + deinitialise(); return Common::kNoError; } diff --git a/engines/tsage/tsage.h b/engines/tsage/tsage.h index 2bb9e3803f..02516152ae 100644 --- a/engines/tsage/tsage.h +++ b/engines/tsage/tsage.h @@ -90,6 +90,7 @@ public: Common::String generateSaveName(int slot); void initialise(); + void deinitialise(); }; extern TSageEngine *_vm; |