diff options
Diffstat (limited to 'engines/tsage')
51 files changed, 769 insertions, 498 deletions
diff --git a/engines/tsage/blueforce_logic.cpp b/engines/tsage/blueforce_logic.cpp new file mode 100644 index 0000000000..9813bef6f7 --- /dev/null +++ b/engines/tsage/blueforce_logic.cpp @@ -0,0 +1,120 @@ +/* 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/blueforce_logic.h" +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/staticres.h" + +namespace tSage { + +void BlueForceGame::start() { + // Start the game + _globals->_sceneManager.changeScene(20); + + _globals->_events.setCursor(CURSOR_WALK); +} + +Scene *BlueForceGame::createScene(int sceneNumber) { + switch (sceneNumber) { + case 20: + case 50: + case 60: + error("Scene group 0 not implemented"); + case 100: + case 109: + case 110: + case 114: + case 115: + case 125: + case 140: + case 150: + case 160: + case 180: + case 190: + error("Scene group 1 not implemented"); + case 200: + case 210: + case 220: + case 225: + case 265: + case 270: + case 271: + case 280: + error("Scene group 2 not implemented"); + case 300: + case 315: + case 325: + case 330: + case 340: + case 342: + case 350: + case 355: + case 360: + case 370: + case 380: + case 385: + case 390: + error("Scene group 3 not implemented"); + case 410: + case 415: + case 440: + case 450: + error("Scene group 4 not implemented"); + case 550: + case 551: + case 560: + case 570: + case 580: + case 590: + error("Scene group 5 not implemented"); + case 600: + case 620: + case 666: + case 690: + error("Scene group 6 not implemented"); + case 710: + error("Scene group 7 not implemented"); + case 800: + case 810: + case 820: + case 830: + case 840: + case 850: + case 860: + case 870: + case 880: + error("Scene group 8 not implemented"); + case 900: + case 910: + case 920: + case 930: + case 935: + case 940: + error("Scene group 9 not implemented"); + default: + error("Unknown scene number - %d", sceneNumber); + break; + } +} + +} // End of namespace tSage diff --git a/engines/tsage/blueforce_logic.h b/engines/tsage/blueforce_logic.h new file mode 100644 index 0000000000..9237e50a13 --- /dev/null +++ b/engines/tsage/blueforce_logic.h @@ -0,0 +1,42 @@ +/* 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_BLUEFORCE_LOGIC_H +#define TSAGE_BLUEFORCE_LOGIC_H + +#include "common/scummsys.h" +#include "tsage/events.h" +#include "tsage/core.h" +#include "tsage/scenes.h" +#include "tsage/globals.h" + +namespace tSage { + +class BlueForceGame: public Game { +public: + virtual void start(); + virtual Scene *createScene(int sceneNumber); +}; + +} // End of namespace tSage + +#endif diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 789ec8fa8d..5fa36142e7 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/str-array.h" @@ -421,8 +418,10 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) { Event event; while (!_vm->getEventManager()->shouldQuit()) { while (!_globals->_events.getEvent(event, EVENT_KEYPRESS | EVENT_BUTTON_DOWN | EVENT_MOUSE_MOVE) && - !_vm->getEventManager()->shouldQuit()) - ; + !_vm->getEventManager()->shouldQuit()) { + g_system->delayMillis(10); + g_system->updateScreen(); + } if (_vm->getEventManager()->shouldQuit()) break; diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index f8c5bc7b14..6876fa41cb 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_CONVERSE_H diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 8ad920e6fd..8c1bd2fd39 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -18,12 +18,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/system.h" +#include "common/config-manager.h" #include "engines/engine.h" #include "graphics/palette.h" #include "tsage/tsage.h" @@ -2914,15 +2912,22 @@ void Region::uniteRect(const Rect &rect) { void SceneRegions::load(int sceneNum) { clear(); - - byte *regionData = _resourceManager->getResource(RES_CONTROL, sceneNum, 9999, true); + bool altRegions = _vm->getFeatures() & GF_ALT_REGIONS; + byte *regionData = _resourceManager->getResource(RES_CONTROL, sceneNum, altRegions ? 1 : 9999, true); if (regionData) { int regionCount = READ_LE_UINT16(regionData); for (int regionCtr = 0; regionCtr < regionCount; ++regionCtr) { - int rlbNum = READ_LE_UINT16(regionData + regionCtr * 6 + 2); + int regionId = READ_LE_UINT16(regionData + regionCtr * 6 + 2); - push_back(Region(sceneNum, rlbNum)); + if (altRegions) { + // Load data from within this resource + uint32 dataOffset = READ_LE_UINT32(regionData + regionCtr * 6 + 4); + push_back(Region(regionId, regionData + dataOffset)); + } else { + // Load region from a separate resource + push_back(Region(sceneNum, regionId)); + } } DEALLOCATE(regionData); @@ -3477,52 +3482,11 @@ void SceneHandler::postInit(SceneObjectList *OwnerList) { void SceneHandler::process(Event &event) { // Main keypress handler - if ((event.eventType == EVENT_KEYPRESS) && !event.handled) { - switch (event.kbd.keycode) { - case Common::KEYCODE_F1: - // F1 - Help - MessageDialog::show((_vm->getFeatures() & GF_DEMO) ? DEMO_HELP_MSG : HELP_MSG, OK_BTN_STRING); - break; - - case Common::KEYCODE_F2: { - // F2 - Sound Options - ConfigDialog *dlg = new ConfigDialog(); - dlg->runModal(); - delete dlg; - _globals->_events.setCursorFromFlag(); - break; - } - - case Common::KEYCODE_F3: - // F3 - Quit - _globals->_game->quitGame(); - event.handled = false; - break; - - case Common::KEYCODE_F4: - // F4 - Restart - _globals->_game->restartGame(); - _globals->_events.setCursorFromFlag(); - break; - - case Common::KEYCODE_F7: - // F7 - Restore - _globals->_game->restoreGame(); - _globals->_events.setCursorFromFlag(); - break; + if (!event.handled) { + _globals->_game->processEvent(event); - case Common::KEYCODE_F10: - // F10 - Pause - GfxDialog::setPalette(); - MessageDialog::show(GAME_PAUSED_MSG, OK_BTN_STRING); + if (event.eventType == EVENT_KEYPRESS) _globals->_events.setCursorFromFlag(); - break; - - default: - break; - } - - _globals->_events.setCursorFromFlag(); } // Check for displaying right-click dialog @@ -3643,22 +3607,4 @@ void SceneHandler::saveListener(Serializer &ser) { warning("TODO: SceneHandler::saveListener"); } -/*--------------------------------------------------------------------------*/ - -void Game::execute() { - // Main game loop - bool activeFlag = false; - do { - // Process all currently atcive game handlers - activeFlag = false; - for (SynchronizedList<GameHandler *>::iterator i = _handlers.begin(); i != _handlers.end(); ++i) { - GameHandler *gh = *i; - if (gh->_lockCtr.getCtr() == 0) { - gh->execute(); - activeFlag = true; - } - } - } while (activeFlag && !_vm->getEventManager()->shouldQuit()); -} - } // End of namespace tSage diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 001b478fc9..71130e5b0b 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_CORE_H @@ -912,30 +909,6 @@ public: static void saveListener(Serializer &ser); }; -/*--------------------------------------------------------------------------*/ - -class Game { -protected: - SynchronizedList<GameHandler *> _handlers; - - static bool notLockedFn(GameHandler *g); - virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {} -public: - virtual ~Game() {} - - void addHandler(GameHandler *entry) { _handlers.push_back(entry); } - void removeHandler(GameHandler *entry) { _handlers.remove(entry); } - - void execute(); - virtual void start() = 0; - virtual void restart() {} - virtual void restartGame() {} - virtual void saveGame() {} - virtual void restoreGame() {} - virtual void quitGame() {} - virtual void endGame(int resNum, int lineNum) {} -}; - } // End of namespace tSage #endif diff --git a/engines/tsage/debugger.cpp b/engines/tsage/debugger.cpp index 7944bad776..5288c98b72 100644 --- a/engines/tsage/debugger.cpp +++ b/engines/tsage/debugger.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "tsage/debugger.h" @@ -66,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; } /** @@ -380,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/debugger.h b/engines/tsage/debugger.h index eeb5bc86f6..3c14cd7bed 100644 --- a/engines/tsage/debugger.h +++ b/engines/tsage/debugger.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_DEBUGGER_H diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp index ba7b459304..20c2002257 100644 --- a/engines/tsage/detection.cpp +++ b/engines/tsage/detection.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/config-manager.h" @@ -91,7 +88,7 @@ public: } virtual const char *getName() const { - return "TsAGE Engine"; + return "TsAGE"; } virtual const char *getOriginalCopyright() const { diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h index d165900d55..dc55f2a66d 100644 --- a/engines/tsage/detection_tables.h +++ b/engines/tsage/detection_tables.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ namespace tSage { @@ -112,7 +109,34 @@ static const tSageGameDescription gameDescriptions[] = { GType_BlueForce, GF_FLOPPY }, - + // Blue Force floppy + { + { + "blueforce", + "Floppy", + AD_ENTRY1s("blue.rlb", "17c3993415e8a2cf93040eef7e88ec93", 1156508), + Common::EN_ANY, + Common::kPlatformPC, + ADGF_NO_FLAGS, + Common::GUIO_NONE + }, + GType_BlueForce, + GF_FLOPPY + }, + // Blue Force CD and First Wave use the same files + { + { + "blueforce", + "CD", + AD_ENTRY1s("blue.rlb", "ac29f38184cb3b874ea18523059872ba", 63863322), + Common::EN_ANY, + Common::kPlatformPC, + ADGF_NO_FLAGS, + Common::GUIO_NONE + }, + GType_BlueForce, + GF_CD + }, { AD_TABLE_END_MARKER, 0, 0 } }; diff --git a/engines/tsage/dialogs.cpp b/engines/tsage/dialogs.cpp index f8e35f74f9..759deebbef 100644 --- a/engines/tsage/dialogs.cpp +++ b/engines/tsage/dialogs.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/translation.h" @@ -73,12 +70,11 @@ MessageDialog::MessageDialog(const Common::String &message, const Common::String int MessageDialog::show(const Common::String &message, const Common::String &btn1Message, const Common::String &btn2Message) { // Ensure that the cursor is the arrow - _globals->_events.pushCursor(CURSOR_ARROW); - _globals->_events.showCursor(); + _globals->_events.setCursor(CURSOR_ARROW); int result = show2(message, btn1Message, btn2Message); - _globals->_events.popCursor(); + _globals->_events.setCursorFromFlag(); return result; } @@ -472,8 +468,10 @@ void InventoryDialog::execute() { while (!_vm->getEventManager()->shouldQuit()) { // Get events Event event; - while (!_globals->_events.getEvent(event) && !_vm->getEventManager()->shouldQuit()) - ; + while (!_globals->_events.getEvent(event) && !_vm->getEventManager()->shouldQuit()) { + g_system->delayMillis(10); + g_system->updateScreen(); + } if (_vm->getEventManager()->shouldQuit()) return; diff --git a/engines/tsage/dialogs.h b/engines/tsage/dialogs.h index c24fa2dd3b..a50307f775 100644 --- a/engines/tsage/dialogs.h +++ b/engines/tsage/dialogs.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_DIALOGS_H diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index e51c5da479..e889c56c4d 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/events.h" @@ -38,7 +35,7 @@ namespace tSage { EventsClass::EventsClass() { _currentCursor = CURSOR_NONE; - hideCursor(); + _lastCursor = CURSOR_NONE; _frameNumber = 0; _priorFrameTime = 0; _prevDelayFrame = 0; @@ -140,17 +137,11 @@ bool EventsClass::getEvent(Event &evt, int eventMask) { * @cursorType Specified cursor number */ void EventsClass::setCursor(CursorType cursorType) { - _globals->clearFlag(122); - - if ((_currentCursor == cursorType) && CursorMan.isVisible()) + if (cursorType == _lastCursor) return; - if (cursorType == CURSOR_NONE) { - if (CursorMan.isVisible()) - CursorMan.showMouse(false); - return; - } - + _lastCursor = cursorType; + _globals->clearFlag(122); CursorMan.showMouse(true); const byte *cursor; @@ -158,10 +149,15 @@ void EventsClass::setCursor(CursorType cursorType) { uint size; switch (cursorType) { - case OBJECT_STUNNER: - // Stunner cursor - cursor = _resourceManager->getSubResource(4, 1, 6, &size); + case CURSOR_NONE: + // No cursor _globals->setFlag(122); + + if (_vm->getFeatures() & GF_DEMO) { + CursorMan.showMouse(false); + return; + } + cursor = _resourceManager->getSubResource(4, 1, 6, &size); break; case CURSOR_LOOK: @@ -215,8 +211,8 @@ void EventsClass::pushCursor(CursorType cursorType) { uint size; switch (cursorType) { - case CURSOR_CROSSHAIRS: - // Crosshairs cursor + case CURSOR_NONE: + // No cursor cursor = _resourceManager->getSubResource(4, 1, 6, &size); break; @@ -273,19 +269,19 @@ void EventsClass::setCursor(Graphics::Surface &cursor, int transColor, const Com } void EventsClass::setCursorFromFlag() { - setCursor(_globals->getFlag(122) ? CURSOR_CROSSHAIRS : _currentCursor); + setCursor(isCursorVisible() ? _currentCursor : CURSOR_NONE); } void EventsClass::showCursor() { - CursorMan.showMouse(true); + setCursor(_currentCursor); } void EventsClass::hideCursor() { - CursorMan.showMouse(false); + setCursor(CURSOR_NONE); } bool EventsClass::isCursorVisible() const { - return CursorMan.isVisible(); + return !_globals->getFlag(122); } /** diff --git a/engines/tsage/events.h b/engines/tsage/events.h index d2dbd9e058..9a7bdbe82c 100644 --- a/engines/tsage/events.h +++ b/engines/tsage/events.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_EVENTS_H @@ -80,6 +77,7 @@ public: Common::Point _mousePos; CursorType _currentCursor; + CursorType _lastCursor; void setCursor(CursorType cursorType); void pushCursor(CursorType cursorType); diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index c6e1344714..e629396501 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -18,13 +18,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "tsage/globals.h" #include "tsage/tsage.h" +#include "tsage/blueforce_logic.h" +#include "tsage/ringworld_demo.h" #include "tsage/ringworld_logic.h" namespace tSage { @@ -52,8 +51,9 @@ static SavedObject *classFactoryProc(const Common::String &className) { /*--------------------------------------------------------------------------*/ Globals::Globals() : - _dialogCenter(160, 140), - _gfxManagerInstance(_screenSurface) { + _dialogCenter(160, 140), + _gfxManagerInstance(_screenSurface), + _randomSource("tsage") { reset(); _stripNum = 0; @@ -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; @@ -84,11 +91,19 @@ Globals::Globals() : _scrollFollower = NULL; _inventory = NULL; - if (!(_vm->getFeatures() & GF_DEMO)) { - _inventory = new RingworldInvObjectList(); - _game = new RingworldGame(); - } else { - _game = new RingworldDemoGame(); + switch (_vm->getGameID()) { + case GType_Ringworld: + if (!(_vm->getFeatures() & GF_DEMO)) { + _inventory = new RingworldInvObjectList(); + _game = new RingworldGame(); + } else { + _game = new RingworldDemoGame(); + } + break; + + case GType_BlueForce: + _game = new BlueForceGame(); + break; } } diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 3a6fab5b70..6b3df587b6 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_GLOBALS_H @@ -76,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 c50da6beef..cc11343c9c 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "tsage/events.h" @@ -673,12 +670,18 @@ void GfxElement::drawFrame() { * @event Event to process */ bool GfxElement::focusedEvent(Event &event) { + Common::Point mousePos = event.mousePos; bool highlightFlag = false; - while (!_vm->getEventManager()->shouldQuit()) { + // HACK: It should use the GfxManager object to figure out the relative + // position, but for now this seems like the easiest way. + int xOffset = mousePos.x - _globals->_events._mousePos.x; + int yOffset = mousePos.y - _globals->_events._mousePos.y; + + while (event.eventType != EVENT_BUTTON_UP && !_vm->getEventManager()->shouldQuit()) { g_system->delayMillis(10); - if (_bounds.contains(event.mousePos)) { + if (_bounds.contains(mousePos)) { if (!highlightFlag) { // First highlight call to show the highlight highlightFlag = true; @@ -690,8 +693,12 @@ bool GfxElement::focusedEvent(Event &event) { highlight(); } - if (_globals->_events.getEvent(event, EVENT_BUTTON_UP)) - break; + if (_globals->_events.getEvent(event, EVENT_MOUSE_MOVE | EVENT_BUTTON_UP)) { + if (event.eventType == EVENT_MOUSE_MOVE) { + mousePos.x = event.mousePos.x + xOffset; + mousePos.y = event.mousePos.y + yOffset; + } + } } if (highlightFlag) { @@ -867,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 @@ -970,9 +977,10 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) { // Event loop GfxButton *selectedButton = NULL; - while (!_vm->getEventManager()->shouldQuit()) { + bool breakFlag = false; + while (!_vm->getEventManager()->shouldQuit() && !breakFlag) { Event event; - while (_globals->_events.getEvent(event)) { + while (_globals->_events.getEvent(event) && !breakFlag) { // Adjust mouse positions to be relative within the dialog event.mousePos.x -= _gfxManager._bounds.left; event.mousePos.y -= _gfxManager._bounds.top; @@ -981,19 +989,25 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) { if ((*i)->process(event)) selectedButton = static_cast<GfxButton *>(*i); } - } - if (selectedButton) - break; - else if (!event.handled) { - if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) { - selectedButton = NULL; - break; - } else if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_RETURN)) { - selectedButton = defaultButton; + if (selectedButton) { + breakFlag = true; break; + } else if (!event.handled) { + if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) { + selectedButton = NULL; + breakFlag = true; + break; + } else if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_RETURN)) { + selectedButton = defaultButton; + breakFlag = true; + break; + } } } + + g_system->delayMillis(10); + g_system->updateScreen(); } _gfxManager.deactivate(); @@ -1195,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) { @@ -1241,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 8be4629493..b269520039 100644 --- a/engines/tsage/graphics.h +++ b/engines/tsage/graphics.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef RING_GRAPHICS_H @@ -43,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); @@ -63,7 +60,7 @@ public: uint8 foreground; uint8 background; - GfxColors() : foreground(0), background(0) {}; + GfxColors() : foreground(0), background(0) {} }; class LineSlice { @@ -95,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) { @@ -190,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); }; @@ -232,7 +229,7 @@ private: public: Common::String _message; public: - GfxButton() : GfxElement() {}; + GfxButton() : GfxElement() {} virtual ~GfxButton() {} void setText(const Common::String &s) { @@ -274,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/module.mk b/engines/tsage/module.mk index 2f9194a9ba..aefc8b0992 100644 --- a/engines/tsage/module.mk +++ b/engines/tsage/module.mk @@ -1,6 +1,7 @@ MODULE := engines/tsage MODULE_OBJS := \ + blueforce_logic.o \ converse.o \ core.o \ debugger.o \ diff --git a/engines/tsage/resources.cpp b/engines/tsage/resources.cpp index 2b678a848a..676d319ba9 100644 --- a/engines/tsage/resources.cpp +++ b/engines/tsage/resources.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/scummsys.h" diff --git a/engines/tsage/resources.h b/engines/tsage/resources.h index 7b518cabd6..efbb86b24e 100644 --- a/engines/tsage/resources.h +++ b/engines/tsage/resources.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef RING_RESOURCES_H diff --git a/engines/tsage/ringworld_demo.cpp b/engines/tsage/ringworld_demo.cpp index 29438c0347..3ad414fa20 100644 --- a/engines/tsage/ringworld_demo.cpp +++ b/engines/tsage/ringworld_demo.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "tsage/ringworld_demo.h" @@ -30,6 +27,80 @@ namespace tSage { +void RingworldDemoGame::start() { + // Start the demo's single scene + _globals->_sceneManager.changeScene(1); + + _globals->_events.setCursor(CURSOR_NONE); +} + +Scene *RingworldDemoGame::createScene(int sceneNumber) { + // The demo only has a single scene, so ignore the scene number and always return it + return new RingworldDemoScene(); +} + +void RingworldDemoGame::quitGame() { + _globals->_events.setCursor(CURSOR_ARROW); + MessageDialog *dlg = new MessageDialog(DEMO_EXIT_MSG, EXIT_BTN_STRING, DEMO_BTN_STRING); + dlg->draw(); + + GfxButton *selectedButton = dlg->execute(&dlg->_btn2); + bool exitFlag = selectedButton != &dlg->_btn2; + + delete dlg; + _globals->_events.hideCursor(); + + if (exitFlag) + _vm->quitGame(); +} + +void RingworldDemoGame::pauseGame() { + _globals->_events.setCursor(CURSOR_ARROW); + MessageDialog *dlg = new MessageDialog(DEMO_PAUSED_MSG, EXIT_BTN_STRING, DEMO_RESUME_BTN_STRING); + dlg->draw(); + + GfxButton *selectedButton = dlg->execute(&dlg->_btn2); + bool exitFlag = selectedButton != &dlg->_btn2; + + delete dlg; + _globals->_events.hideCursor(); + + if (exitFlag) + _vm->quitGame(); +} + +void RingworldDemoGame::processEvent(Event &event) { + if (event.eventType == EVENT_KEYPRESS) { + switch (event.kbd.keycode) { + case Common::KEYCODE_F1: + // F1 - Help + MessageDialog::show(DEMO_HELP_MSG, OK_BTN_STRING); + break; + + case Common::KEYCODE_F2: { + // F2 - Sound Options + ConfigDialog *dlg = new ConfigDialog(); + dlg->runModal(); + delete dlg; + _globals->_events.setCursorFromFlag(); + break; + } + + case Common::KEYCODE_F3: + // F3 - Quit + quitGame(); + event.handled = false; + break; + + default: + break; + } + } else if (event.eventType == EVENT_BUTTON_DOWN) { + pauseGame(); + event.handled = true; + } +} + /*-------------------------------------------------------------------------- * Ringworld Demo scene * diff --git a/engines/tsage/ringworld_demo.h b/engines/tsage/ringworld_demo.h index 63ffe56555..7492c1e871 100644 --- a/engines/tsage/ringworld_demo.h +++ b/engines/tsage/ringworld_demo.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_RINGWORLD_DEMO_H @@ -34,6 +31,15 @@ namespace tSage { +class RingworldDemoGame: public Game { +private: + void pauseGame(); +public: + virtual void start(); + virtual Scene *createScene(int sceneNumber); + virtual void quitGame(); + virtual void processEvent(Event &event); +}; class RingworldDemoScene: public Scene { public: diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp index d334e0ce1f..95c9da9fe7 100644 --- a/engines/tsage/ringworld_logic.cpp +++ b/engines/tsage/ringworld_logic.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/config-manager.h" @@ -42,10 +39,7 @@ namespace tSage { -Scene *SceneFactory::createScene(int sceneNumber) { - if (_vm->getFeatures() & GF_DEMO) - return new RingworldDemoScene(); - +Scene *RingworldGame::createScene(int sceneNumber) { switch (sceneNumber) { /* Scene group 1 */ // Kziniti Palace (Introduction) @@ -1328,10 +1322,9 @@ void RingworldGame::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String } void RingworldGame::start() { - // Set some default flags and cursor + // Set some default flags _globals->setFlag(12); _globals->setFlag(34); - _globals->_events.setCursor(CURSOR_WALK); // Set the screen to scroll in response to the player moving off-screen _globals->_scrollFollower = &_globals->_player; @@ -1341,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(); } @@ -1416,11 +1413,14 @@ 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) { + 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); - breakFlag = _globals->_sceneHandler._loadGameSlot > 0; + breakFlag = _globals->_sceneHandler._loadGameSlot >= 0; } } while (!breakFlag); } @@ -1428,16 +1428,52 @@ void RingworldGame::endGame(int resNum, int lineNum) { _globals->_events.setCursorFromFlag(); } -/*--------------------------------------------------------------------------*/ +void RingworldGame::processEvent(Event &event) { + if (event.eventType == EVENT_KEYPRESS) { + switch (event.kbd.keycode) { + case Common::KEYCODE_F1: + // F1 - Help + MessageDialog::show(HELP_MSG, OK_BTN_STRING); + break; -void RingworldDemoGame::start() { - // Start the demo's single scene - _globals->_sceneManager.changeScene(1); - - _globals->_events.setCursor(CURSOR_NONE); -} + case Common::KEYCODE_F2: { + // F2 - Sound Options + ConfigDialog *dlg = new ConfigDialog(); + dlg->runModal(); + delete dlg; + _globals->_events.setCursorFromFlag(); + break; + } -void RingworldDemoGame::restart() { + case Common::KEYCODE_F3: + // F3 - Quit + quitGame(); + event.handled = false; + break; + + case Common::KEYCODE_F4: + // F4 - Restart + restartGame(); + _globals->_events.setCursorFromFlag(); + break; + + case Common::KEYCODE_F7: + // F7 - Restore + restoreGame(); + _globals->_events.setCursorFromFlag(); + break; + + case Common::KEYCODE_F10: + // F10 - Pause + GfxDialog::setPalette(); + MessageDialog::show(GAME_PAUSED_MSG, OK_BTN_STRING); + _globals->_events.setCursorFromFlag(); + break; + + default: + break; + } + } } } // End of namespace tSage diff --git a/engines/tsage/ringworld_logic.h b/engines/tsage/ringworld_logic.h index e84779e6ad..19b0f10b42 100644 --- a/engines/tsage/ringworld_logic.h +++ b/engines/tsage/ringworld_logic.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_RINGWORLD_LOGIC_H @@ -454,21 +451,11 @@ public: virtual void restoreGame(); virtual void quitGame(); virtual void endGame(int resNum, int lineNum); -}; -class RingworldDemoGame: public Game { -protected: - virtual void restart(); -public: - virtual void start(); - virtual void restartGame() {} - virtual void saveGame() {} - virtual void restoreGame() {} - virtual void quitGame() {} - virtual void endGame(int resNum, int lineNum) {} + virtual Scene *createScene(int sceneNumber); + virtual void processEvent(Event &event); }; - } // End of namespace tSage #endif diff --git a/engines/tsage/ringworld_scenes1.cpp b/engines/tsage/ringworld_scenes1.cpp index e5ec60c690..b6daadbef7 100644 --- a/engines/tsage/ringworld_scenes1.cpp +++ b/engines/tsage/ringworld_scenes1.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "tsage/ringworld_scenes1.h" @@ -1762,6 +1759,8 @@ Scene50::Scene50() : _item3(8, OBJECT_STUNNER, 50, 14, OBJECT_SCANNER, 50, 13, CURSOR_LOOK, 50, 3, LIST_END), _item4(9, OBJECT_SCANNER, 40, 39, OBJECT_STUNNER, 40, 40, CURSOR_USE, 40, 41, CURSOR_LOOK, 50, 5, LIST_END), _item5(10, OBJECT_SCANNER, 50, 17, OBJECT_STUNNER, 50, 18, CURSOR_LOOK, 50, 6, CURSOR_USE, 30, 8, LIST_END) { + + _doorwayRect = Rect(80, 108, 160, 112); } void Scene50::postInit(SceneObjectList *OwnerList) { @@ -1824,7 +1823,6 @@ void Scene50::postInit(SceneObjectList *OwnerList) { _item0.setBounds(Rect(200, 0, 320, 200)); _globals->_sceneItems.addItems(&_item3, &_item4, &_item5, &_item0, NULL); - _doorwayRect = Rect(80, 108, 160, 112); } void Scene50::signal() { @@ -1843,6 +1841,8 @@ void Scene50::signal() { } void Scene50::dispatch() { + Scene::dispatch(); + if ((_sceneMode != 55) && _doorwayRect.contains(_globals->_player._position)) { // Player in house doorway, start player moving to within _globals->_player.disableControl(); diff --git a/engines/tsage/ringworld_scenes1.h b/engines/tsage/ringworld_scenes1.h index be6d8e6337..554b261f2c 100644 --- a/engines/tsage/ringworld_scenes1.h +++ b/engines/tsage/ringworld_scenes1.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_RINGWORLD_SCENES1_H @@ -443,7 +440,6 @@ class Scene95 : public Scene { public: Action1 _action1; - int _field326; SceneObject _object1, _object2, _object3; SoundHandler _soundHandler; diff --git a/engines/tsage/ringworld_scenes10.cpp b/engines/tsage/ringworld_scenes10.cpp index 65e415748d..0b4186531d 100644 --- a/engines/tsage/ringworld_scenes10.cpp +++ b/engines/tsage/ringworld_scenes10.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "graphics/cursorman.h" @@ -52,7 +49,7 @@ void Object9350::draw() { } /*-------------------------------------------------------------------------- - * Scene 9100 + * Scene 9100 - Near beach: Slave washing clothes * *--------------------------------------------------------------------------*/ void Scene9100::SceneHotspot1::doAction(int action) { @@ -177,7 +174,7 @@ void Scene9100::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9150 + * Scene 9150 - Castle: Outside the bulwarks * *--------------------------------------------------------------------------*/ void Scene9150::Object3::signal() { @@ -297,7 +294,7 @@ void Scene9150::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9200 + * Scene 9200 - Castle: Near the fountain * *--------------------------------------------------------------------------*/ void Scene9200::SceneHotspot1::doAction(int action) { @@ -473,7 +470,7 @@ void Scene9200::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9300 + * Scene 9300 - Castle: In front of a large guarded door * *--------------------------------------------------------------------------*/ void Scene9300::signal() { @@ -540,7 +537,7 @@ void Scene9300::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9350 + * Scene 9350 - Castle: In a hallway * *--------------------------------------------------------------------------*/ @@ -626,7 +623,7 @@ void Scene9350::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9360 + * Scene 9360 - Castle: In a hallway * *--------------------------------------------------------------------------*/ @@ -704,7 +701,7 @@ void Scene9360::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9400 + * Scene 9400 - Castle: Black-Smith room * *--------------------------------------------------------------------------*/ Scene9400::Scene9400() { @@ -822,8 +819,14 @@ void Scene9400::postInit(SceneObjectList *OwnerList) { setAction(&_sequenceManager, this, 9400, &_globals->_player, &_object1, &_object3, NULL); } +void Scene9400::synchronize(Serializer &s) { + Scene::synchronize(s); + if (s.getVersion() >= 3) + s.syncAsSint16LE(_field1032); +} + /*-------------------------------------------------------------------------- - * Scene 9450 + * Scene 9450 - Castle: Dining room * *--------------------------------------------------------------------------*/ void Scene9450::Object2::signal() { @@ -1006,7 +1009,7 @@ void Scene9450::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9500 + * Scene 9500 - Castle: Bedroom * *--------------------------------------------------------------------------*/ void Scene9500::Hotspot1::doAction(int action) { @@ -1227,7 +1230,7 @@ void Scene9500::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9700 + * Scene 9700 - Castle: Balcony * *--------------------------------------------------------------------------*/ void Scene9700::signal() { @@ -1299,7 +1302,7 @@ void Scene9700::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9750 + * Scene 9750 - Castle: In the garden * *--------------------------------------------------------------------------*/ void Scene9750::signal() { @@ -1335,7 +1338,7 @@ void Scene9750::postInit(SceneObjectList *OwnerList) { /*-------------------------------------------------------------------------- - * Scene 9850 + * Scene 9850 - Castle: Dressing room * *--------------------------------------------------------------------------*/ void Scene9850::Object6::doAction(int action) { @@ -1639,7 +1642,7 @@ void Scene9850::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9900 + * Scene 9900 - Ending * *--------------------------------------------------------------------------*/ void Scene9900::strAction1::signal() { @@ -1780,6 +1783,15 @@ void Scene9900::strAction2::dispatch() { Action::dispatch(); } +void Scene9900::strAction2::synchronize(Serializer &s) { + Action::synchronize(s); + if (s.getVersion() >= 3) { + s.syncAsSint16LE(_lineNum); + s.syncAsSint16LE(_txtArray1Index); + s.syncAsSint16LE(_var3); + } +} + void Scene9900::strAction3::signal() { const byte mask3[3] = {0xff, 0, 0}; const byte mask4[3] = {0, 0, 0}; @@ -1985,7 +1997,7 @@ void Scene9900::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 9999 + * Scene 9999 - Space travel * *--------------------------------------------------------------------------*/ diff --git a/engines/tsage/ringworld_scenes10.h b/engines/tsage/ringworld_scenes10.h index 93987aa64b..aa41555718 100644 --- a/engines/tsage/ringworld_scenes10.h +++ b/engines/tsage/ringworld_scenes10.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_RINGWORLD_SCENES10_H @@ -241,6 +238,7 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); virtual void dispatch(); + virtual void synchronize(Serializer &s); }; class Scene9450 : public Scene2 { @@ -471,6 +469,7 @@ class Scene9900 : public Scene { virtual void signal(); virtual void dispatch(); + virtual void synchronize(Serializer &s); }; class strAction3 : public Action { diff --git a/engines/tsage/ringworld_scenes2.cpp b/engines/tsage/ringworld_scenes2.cpp index 6a8db81adf..4378eac724 100644 --- a/engines/tsage/ringworld_scenes2.cpp +++ b/engines/tsage/ringworld_scenes2.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/config-manager.h" @@ -113,6 +110,8 @@ void Scene1000::Action3::signal() { setDelay(240); break; case 5: { + _globals->_player.enableControl(); + const char *SEEN_INTRO = "seen_intro"; if (!ConfMan.hasKey(SEEN_INTRO) || !ConfMan.getBool(SEEN_INTRO)) { // First time being played, so show the introduction @@ -478,13 +477,14 @@ void Scene1001::Action1::signal() { case 19: { _globals->_soundHandler.startSound(91); byte adjustData[4] = {0xff, 0xff, 0xff, 0}; - _globals->_scenePalette.fade(adjustData, true, 0); + _globals->_scenePalette.fade(adjustData, false, 0); scene->_object1._strip = 7; scene->_object1._frame = 1; scene->_object1.setPosition(Common::Point(314, 112)); scene->_object1.addMover(NULL); setDelay(2); + break; } case 20: _globals->_scenePalette.loadPalette(16); diff --git a/engines/tsage/ringworld_scenes2.h b/engines/tsage/ringworld_scenes2.h index 75843d3570..7731b45ae8 100644 --- a/engines/tsage/ringworld_scenes2.h +++ b/engines/tsage/ringworld_scenes2.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_RINGWORLD_SCENES2_H diff --git a/engines/tsage/ringworld_scenes3.cpp b/engines/tsage/ringworld_scenes3.cpp index f788f9a28b..a19f15eca6 100644 --- a/engines/tsage/ringworld_scenes3.cpp +++ b/engines/tsage/ringworld_scenes3.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/config-manager.h" @@ -491,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: { @@ -634,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); @@ -658,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++) { @@ -1150,6 +1148,7 @@ void Scene2100::Action14::signal() { case 12: scene->_object3.setStrip(2); setDelay(30); + break; case 13: scene->_object3.fixPriority(1); scene->_soundHandler.startSound(162); @@ -1403,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) { @@ -1410,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; @@ -1473,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); @@ -1499,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); @@ -1536,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) { @@ -1662,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); @@ -1685,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: @@ -1750,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; @@ -1820,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); @@ -1854,7 +1856,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _globals->_player.fixPriority(152); _globals->_player.setStrip(2); - _field1800 = 1; + _sitFl = 1; setAction(&_action16); } break; @@ -1928,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: @@ -1957,6 +1959,12 @@ void Scene2100::signal() { } } +void Scene2100::synchronize(Serializer &s) { + Scene::synchronize(s); + if (s.getVersion() >= 3) + s.syncAsSint16LE(_sitFl); +} + /*-------------------------------------------------------------------------- * Scene 2120 - Encyclopedia * @@ -2163,12 +2171,19 @@ void Scene2120::Action1::dispatch() { /*--------------------------------------------------------------------------*/ +Scene2120::Scene2120(): Scene() { + _listRect = Rect(18, 48, 260, 177); + _dbMode = 0; + _prevDbMode = 0; + _visageVisable = false; + _subjectIndex = 0; +} + void Scene2120::postInit(SceneObjectList *OwnerList) { loadScene(2120); setZoomPercents(0, 100, 200, 100); _globals->_player.disableControl(); - _listRect = Rect(18, 48, 260, 177); _subjectButton.setBounds(Rect(266, 13, 320, 56)); _nextPageButton.setBounds(Rect(266, 56, 320, 98)); _previousPageButton.setBounds(Rect(266, 98, 320, 140)); @@ -2185,11 +2200,6 @@ void Scene2120::postInit(SceneObjectList *OwnerList) { _arrowHotspot._frame = 1; _arrowHotspot.setPosition(Common::Point(400, 200)); - _dbMode = 0; - _prevDbMode = 0; - _visageVisable = false; - _subjectIndex = 0; - setAction(&_action1); _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds); _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160; @@ -2471,6 +2481,17 @@ Scene2150::Scene2150() : _hotspot8(16, CURSOR_LOOK, 2150, 8, LIST_END), _hotspot9(0, CURSOR_LOOK, 2150, 9, CURSOR_USE, 2150, 13, LIST_END), _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) { @@ -2484,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); @@ -2521,9 +2542,6 @@ void Scene2150::postInit(SceneObjectList *OwnerList) { _hotspot10.setStrip(5); _hotspot10.setPosition(Common::Point(59, 56)); - _rect1 = Rect(260, 70, 270, 77); - _rect2 = Rect(222, 142, 252, 150); - _globals->_player.postInit(); _globals->_player.setVisage(_globals->getFlag(13) ? 2170 : 0); _globals->_player.animate(ANIM_MODE_1, NULL); @@ -2539,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); @@ -4216,7 +4225,7 @@ void Scene2280::Hotspot18::doAction(int action) { /*--------------------------------------------------------------------------*/ Scene2280::Scene2280() : - _hotspot3(0, CURSOR_LOOK, 2280, 30, CURSOR_USE, 31, 0, LIST_END), + _hotspot3(0, CURSOR_LOOK, 2280, 30, CURSOR_USE, 2280, 31, LIST_END), _hotspot5(0, CURSOR_LOOK, 2280, 35, CURSOR_USE, 2280, 36, LIST_END), _hotspot6(0, CURSOR_LOOK, 2280, 19, CURSOR_USE, 2280, 20, LIST_END), _hotspot9(0, CURSOR_LOOK, 2280, 5, CURSOR_USE, 2280, 6, LIST_END), @@ -4366,6 +4375,7 @@ void Scene2280::synchronize(Serializer &s) { *--------------------------------------------------------------------------*/ void Scene2300::Action1::signal() { + // Quinn and Seeker Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -4436,6 +4446,7 @@ void Scene2300::Action1::signal() { break; case 8: _globals->_game->endGame(2300, 0); + remove(); break; case 9: if (scene->_hotspot5._mover) @@ -4508,6 +4519,7 @@ void Scene2300::Action1::signal() { } void Scene2300::Action2::signal() { + // Miranda tearing cables Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -4574,6 +4586,7 @@ void Scene2300::Action2::signal() { } void Scene2300::Action3::signal() { + // Stunned Miranda Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -4626,6 +4639,7 @@ void Scene2300::Action3::signal() { } void Scene2300::Action4::signal() { + // Ennemies coming Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -4664,6 +4678,7 @@ void Scene2300::Action4::signal() { /*--------------------------------------------------------------------------*/ void Scene2300::Hotspot5::doAction(int action) { + // Ennemies Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene; switch (action) { @@ -4686,6 +4701,7 @@ void Scene2300::Hotspot5::doAction(int action) { } void Scene2300::Hotspot7::doAction(int action) { + // Miranda Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene; switch (action) { @@ -4851,6 +4867,14 @@ Scene2310::Scene2310() { _pageList[18].set(18, 2, 3, 0, 1, 4); _pageList[19].set(19, 3, 0, 1, 4, 2); _pageList[20].set(20, 4, 0, 3, 1, 2); + + _rectList[0].set(135, 70, 151, 140); + _rectList[1].set(151, 70, 167, 140); + _rectList[2].set(167, 70, 183, 140); + _rectList[3].set(183, 70, 199, 140); + _rectList[4].set(199, 70, 215, 140); + + _wireIndex = 5; } void Scene2310::postInit(SceneObjectList *OwnerList) { @@ -4867,16 +4891,9 @@ void Scene2310::postInit(SceneObjectList *OwnerList) { _wireList[idx].setPosition(pointList[idx]); } - _rectList[0].set(135, 70, 151, 140); - _rectList[1].set(151, 70, 167, 140); - _rectList[2].set(167, 70, 183, 140); - _rectList[3].set(183, 70, 199, 140); - _rectList[4].set(199, 70, 215, 140); - _globals->_player.disableControl(); _globals->_events.setCursor(CURSOR_WALK); - _wireIndex = 5; if (_vm->getFeatures() & GF_CD) _pageIndex = _globals->_randomSource.getRandomNumber(14) + 2; else @@ -5156,6 +5173,7 @@ void Scene2320::Action3::signal() { } void Scene2320::Action4::signal() { + // Fly Cycle actions Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -5222,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)) { @@ -5283,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); @@ -5582,6 +5603,7 @@ void Scene2320::Hotspot8::doAction(int action) { } void Scene2320::Hotspot10::doAction(int action) { + // Seeker Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene; switch (action) { @@ -5675,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) { @@ -5727,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) { @@ -5755,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) { @@ -5807,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); @@ -5891,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 a25bf8834b..cc237a1f91 100644 --- a/engines/tsage/ringworld_scenes3.h +++ b/engines/tsage/ringworld_scenes3.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_RINGWORLD_SCENES3_H @@ -281,13 +278,14 @@ public: Action15 _action15; Action16 _action16; Action17 _action17; - int _field1800; + int _sitFl; SceneArea _area1, _area2, _area3, _area4; Scene2100(); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void stripCallback(int v); virtual void signal(); + virtual void synchronize(Serializer &s); }; class Scene2120 : public Scene { @@ -323,6 +321,7 @@ public: int _subjectIndex; int _lineOffset; + Scene2120(); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void synchronize(Serializer &s); }; diff --git a/engines/tsage/ringworld_scenes4.cpp b/engines/tsage/ringworld_scenes4.cpp index c42b7819f2..883da9b5b1 100644 --- a/engines/tsage/ringworld_scenes4.cpp +++ b/engines/tsage/ringworld_scenes4.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/config-manager.h" diff --git a/engines/tsage/ringworld_scenes4.h b/engines/tsage/ringworld_scenes4.h index 53ea7be491..389c67b83a 100644 --- a/engines/tsage/ringworld_scenes4.h +++ b/engines/tsage/ringworld_scenes4.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_RINGWORLD_SCENES4_H diff --git a/engines/tsage/ringworld_scenes5.cpp b/engines/tsage/ringworld_scenes5.cpp index dd9c33f0e5..8cdb0a46fb 100644 --- a/engines/tsage/ringworld_scenes5.cpp +++ b/engines/tsage/ringworld_scenes5.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/config-manager.h" @@ -325,6 +322,7 @@ void Scene4000::Action7::signal() { } void Scene4000::Action8::signal() { + // Climb down right Chimney using a rope Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -338,7 +336,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); @@ -988,7 +986,6 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_player.enableControl(); if (RING_INVENTORY._ladder._sceneNumber != 4000) { - _hotspot8.postInit(); _hotspot8.setVisage(4017); _hotspot8.animate(ANIM_MODE_1, NULL); _hotspot8.setPosition(Common::Point(199, 188)); @@ -1008,8 +1005,9 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _olo.setObjectWrapper(new SceneObjectWrapper()); _olo.setPosition(Common::Point(219, 150)); + _sceneMode = 4010; _globals->_player.disableControl(); - setAction(&_sequenceManager1, this, 4010, &_globals->_player, NULL); + setAction(&_sequenceManager1, this, 4010, &_globals->_player, &_olo, NULL); } if (_globals->_stripNum == 4000) { @@ -1136,6 +1134,10 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { void Scene4000::signal() { switch (_sceneMode) { + case 4010: + _globals->setFlag(38); + _olo.remove(); + // Deliberate fall-through case 4001: _globals->_player.enableControl(); break; @@ -1168,10 +1170,6 @@ void Scene4000::signal() { case 4009: _globals->_sceneManager.changeScene(2200); break; - case 4010: - _globals->setFlag(38); - _olo.remove(); - break; case 4012: _globals->_player.checkAngle(&_theTech); _globals->_sceneManager.changeScene(4025); @@ -1461,7 +1459,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) { @@ -1830,10 +1828,10 @@ Scene4045::Scene4045() : _hotspot7(9, CURSOR_LOOK, 4045, 0, CURSOR_USE, 4045, 15, LIST_END), _hotspot8(10, CURSOR_LOOK, 4045, 2, LIST_END), _hotspot9(11, CURSOR_LOOK, 4045, 3, CURSOR_USE, 4045, 15, LIST_END), - _hotspot10(12, CURSOR_LOOK, 4045, 4, CURSOR_USE, 4045, 19, LIST_END), + _hotspot10(12, CURSOR_LOOK, 4045, 4, CURSOR_USE, 4100, 19, LIST_END), _hotspot11(13, CURSOR_LOOK, 4045, 6, CURSOR_USE, 4045, 15, LIST_END), - _hotspot12(14, CURSOR_LOOK, 4045, 7, CURSOR_USE, 4045, 29, LIST_END), - _hotspot13(15, CURSOR_LOOK, 4045, 8, CURSOR_USE, 4045, 19, LIST_END), + _hotspot12(14, CURSOR_LOOK, 4045, 7, CURSOR_USE, 4150, 29, LIST_END), + _hotspot13(15, CURSOR_LOOK, 4045, 8, CURSOR_USE, 4100, 19, LIST_END), _hotspot14(0, CURSOR_LOOK, 4045, 10, LIST_END) { _hotspot14.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); @@ -2001,7 +1999,7 @@ void Scene4045::dispatch() { } /*-------------------------------------------------------------------------- - * Scene 4000 - Village - Temple + * Scene 4050 - Village - Outside * *--------------------------------------------------------------------------*/ @@ -2715,6 +2713,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)); @@ -2981,7 +2983,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), @@ -3091,6 +3093,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_scenes5.h b/engines/tsage/ringworld_scenes5.h index 6c44395f9c..a2991c7283 100644 --- a/engines/tsage/ringworld_scenes5.h +++ b/engines/tsage/ringworld_scenes5.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_RINGWORLD_SCENES5_H @@ -300,8 +297,8 @@ public: DisplayHotspot _hotspot7, _hotspot8, _hotspot9, _hotspot10; DisplayHotspot _hotspot11, _hotspot12, _hotspot13, _hotspot14; Action1 _action1; - Action _action2; - Action _action3; + Action2 _action2; + Action3 _action3; Scene4045(); virtual void postInit(SceneObjectList *OwnerList = NULL); diff --git a/engines/tsage/ringworld_scenes6.cpp b/engines/tsage/ringworld_scenes6.cpp index 973104a952..6c4b62ccd7 100644 --- a/engines/tsage/ringworld_scenes6.cpp +++ b/engines/tsage/ringworld_scenes6.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "tsage/ringworld_scenes6.h" @@ -135,6 +132,7 @@ void Scene5000::Action2::signal() { ADD_MOVER(_globals->_player, 213, 98); break; case 4: + _globals->_player.fixPriority(20); ADD_MOVER(_globals->_player, 215, 115); break; case 5: @@ -218,7 +216,7 @@ void Scene5000::Action3::signal() { break; case 4: scene->_hotspot7.fixPriority(19); - ADD_MOVER(scene->_hotspot7, 213, 98); + ADD_MOVER(scene->_hotspot7, 215, 115); break; case 5: scene->_hotspot7.changeZoom(46); @@ -714,6 +712,7 @@ void Scene5100::Action2::signal() { } void Scene5100::Action3::signal() { + // Quinns shots flesheater Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -748,7 +747,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; @@ -809,6 +808,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++) { @@ -945,6 +945,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) { @@ -1390,8 +1391,7 @@ void Scene5100::dispatch() { if (_globals->getFlag(61) && !_globals->getFlag(62) && ((_globals->_player._position.x - _hotspot2._position.x) < 160) && - (_globals->_sceneManager._previousScene != 5200) && - (_globals->_sceneManager._previousScene != 5150)) { + (_globals->_sceneManager._previousScene != 5200) && (_sceneMode != 5150)) { setAction(NULL); _sceneMode = 5150; _soundHandler.startSound(208); @@ -1747,6 +1747,7 @@ void Scene5200::dispatch() { *--------------------------------------------------------------------------*/ void Scene5300::Action1::signal() { + // Seeker waking up Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -1780,7 +1781,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; @@ -1858,8 +1860,8 @@ void Scene5300::Hotspot1::doAction(int action) { break; } } - void Scene5300::Hotspot2::doAction(int action) { + // Seeker Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene; switch (action) { @@ -1886,11 +1888,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; @@ -1927,6 +1935,7 @@ void Scene5300::Hotspot2::doAction(int action) { } void Scene5300::Hotspot5::doAction(int action) { + // Sharp bone Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene; switch (action) { @@ -2071,6 +2080,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); @@ -2178,7 +2188,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_scenes6.h b/engines/tsage/ringworld_scenes6.h index 0d81bb3b78..6ac73d4bff 100644 --- a/engines/tsage/ringworld_scenes6.h +++ b/engines/tsage/ringworld_scenes6.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_RINGWORLD_SCENES6_H diff --git a/engines/tsage/ringworld_scenes8.cpp b/engines/tsage/ringworld_scenes8.cpp index 43bff50b47..934c7494fa 100644 --- a/engines/tsage/ringworld_scenes8.cpp +++ b/engines/tsage/ringworld_scenes8.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "graphics/cursorman.h" @@ -37,12 +34,21 @@ void NamedHotspotMult::synchronize(Serializer &s) { s.syncAsSint16LE(_lookLineNum); } +void SceneObject7700::synchronize(Serializer &s) { + SceneObject::synchronize(s); + if (s.getVersion() >= 3) { + s.syncAsSint16LE(_lookLineNum); + s.syncAsSint16LE(_defltLineNum); + } +} + /*-------------------------------------------------------------------------- - * 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++) { @@ -114,12 +120,13 @@ void Scene7000::Action3::dispatch() { Action::dispatch(); if (_actionIndex == 4) - scene->_object4.setPosition(scene->_object3._position); + scene->_object4.setPosition(Common::Point(scene->_object3._position.x, scene->_object3._position.y + 15)); } /*--------------------------------------------------------------------------*/ void Scene7000::Action3::signal() { + // Lander is landing Scene7000 *scene = (Scene7000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -255,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(); @@ -356,6 +364,7 @@ void Scene7000::Hotspot1::doAction(int action) { /*--------------------------------------------------------------------------*/ void Scene7000::Object1::doAction(int action) { + // Skeenar Scene7000 *scene = (Scene7000 *)_globals->_sceneManager._scene; switch (action) { @@ -434,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; @@ -647,7 +656,7 @@ void Scene7000::signal() { /*-------------------------------------------------------------------------- - * Scene 7100 + * Scene 7100 - Underwater: swimming * *--------------------------------------------------------------------------*/ @@ -1131,7 +1140,7 @@ void Scene7100::postInit(SceneObjectList *OwnerList) { _globals->_soundHandler.startSound(270); } /*-------------------------------------------------------------------------- - * Scene 7200 + * Scene 7200 - Underwater: Entering the cave * *--------------------------------------------------------------------------*/ @@ -1297,7 +1306,7 @@ void Scene7200::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 7300 + * Scene 7300 - Underwater: Lord Poria * *--------------------------------------------------------------------------*/ @@ -1492,7 +1501,7 @@ void Scene7300::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 7600 + * Scene 7600 - Floating Buildings: Outside * *--------------------------------------------------------------------------*/ @@ -1597,7 +1606,7 @@ void Scene7600::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 7700 + * Scene 7700 - Floating Buildings: In the lab * *--------------------------------------------------------------------------*/ @@ -2523,4 +2532,13 @@ Scene7700::Scene7700() { _prof._state = 0; } +void Scene7700::synchronize(Serializer &s) { + Scene::synchronize(s); + if (s.getVersion() >= 3) { + s.syncAsSint16LE(_field977); + s.syncAsSint16LE(_field979); + s.syncAsSint16LE(_field97B); + } +} + } // End of namespace tSage diff --git a/engines/tsage/ringworld_scenes8.h b/engines/tsage/ringworld_scenes8.h index 713520c6a0..8b183e895f 100644 --- a/engines/tsage/ringworld_scenes8.h +++ b/engines/tsage/ringworld_scenes8.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_RINGWORLD_SCENES8_H @@ -48,11 +45,7 @@ class SceneObject7700 : public SceneObjectExt { public: int _lookLineNum, _defltLineNum; - virtual void synchronize(Serializer &s) { - SceneObject::synchronize(s); - s.syncAsSint16LE(_lookLineNum); - s.syncAsSint16LE(_defltLineNum); - } + virtual void synchronize(Serializer &s); virtual Common::String getClassName() { return "SceneObject7700"; } }; @@ -489,6 +482,7 @@ public: virtual void signal(); virtual void process(Event &event); virtual void dispatch(); + virtual void synchronize(Serializer &s); }; } // End of namespace tSage diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp index a0091bfd6a..56df32146a 100644 --- a/engines/tsage/saveload.cpp +++ b/engines/tsage/saveload.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/savefile.h" @@ -67,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); } @@ -211,6 +206,7 @@ Common::Error Saver::restore(int slot) { // Final post-restore notifications _macroRestoreFlag = false; _loadNotifiers.notify(false); + _globals->_events.setCursor(_globals->_player._uiEnabled ? CURSOR_WALK : CURSOR_NONE); return Common::kNoError; } diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h index cf7d087e6e..51b7696590 100644 --- a/engines/tsage/saveload.h +++ b/engines/tsage/saveload.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_SAVELOAD_H @@ -36,7 +33,7 @@ namespace tSage { typedef void (*SaveNotifierFn)(bool postFlag); -#define TSAGE_SAVEGAME_VERSION 2 +#define TSAGE_SAVEGAME_VERSION 3 class SavedObject; @@ -118,7 +115,7 @@ template<typename T> class SynchronizedList : public Common::List<T> { public: void synchronize(Serializer &s) { - int entryCount; + int entryCount = 0; if (s.isLoading()) { this->clear(); diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index f554d546f6..4625661b62 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "tsage/scenes.h" @@ -130,7 +127,7 @@ void SceneManager::sceneChange() { } Scene *SceneManager::getNewScene() { - return SceneFactory::createScene(_nextSceneNumber); + return _globals->_game->createScene(_nextSceneNumber); } void SceneManager::fadeInIfNecessary() { @@ -230,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); @@ -322,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; @@ -461,36 +463,54 @@ 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) _zoomPercents[yEnd++] = minPercent; } +/*--------------------------------------------------------------------------*/ + +void Game::execute() { + // Main game loop + bool activeFlag = false; + do { + // Process all currently atcive game handlers + activeFlag = false; + for (SynchronizedList<GameHandler *>::iterator i = _handlers.begin(); i != _handlers.end(); ++i) { + GameHandler *gh = *i; + if (gh->_lockCtr.getCtr() == 0) { + gh->execute(); + activeFlag = true; + } + } + } while (activeFlag && !_vm->getEventManager()->shouldQuit()); +} + } // End of namespace tSage diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h index 11637de1a7..b3c009c4fe 100644 --- a/engines/tsage/scenes.h +++ b/engines/tsage/scenes.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_SCENES_H @@ -111,6 +108,30 @@ public: static void loadNotifier(bool postFlag); }; +class Game { +protected: + SynchronizedList<GameHandler *> _handlers; + + static bool notLockedFn(GameHandler *g); + virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {} +public: + virtual ~Game() {} + + void addHandler(GameHandler *entry) { _handlers.push_back(entry); } + void removeHandler(GameHandler *entry) { _handlers.remove(entry); } + + void execute(); + virtual void start() = 0; + virtual void restart() {} + virtual void restartGame() {} + virtual void saveGame() {} + virtual void restoreGame() {} + virtual void quitGame() {} + virtual void endGame(int resNum, int lineNum) {} + virtual Scene *createScene(int sceneNumber) = 0; + virtual void processEvent(Event &event) {} +}; + } // End of namespace tSage #endif diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index 9d50316baf..defec1cebd 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "tsage/core.h" diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h index 45815de69f..03ae77b703 100644 --- a/engines/tsage/sound.h +++ b/engines/tsage/sound.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_SOUND_H diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp index bc85718035..9f36268ce3 100644 --- a/engines/tsage/staticres.cpp +++ b/engines/tsage/staticres.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "tsage/staticres.h" @@ -115,6 +112,10 @@ const char *SCENE6100_VERY_WELL = "Very well. I will retrieve the stasis box and Wait for it's return in the lander bay."; const char *DEMO_HELP_MSG = " Help...\rF2 - Sound Options\rF3 - Exit demo\r\rPress ENTER\rto continue"; -const char *DEMO_PAUSED_MSG = " demo is paused"; +const char *DEMO_PAUSED_MSG = "Ringworld\x14 demo is paused"; +const char *DEMO_EXIT_MSG = "Press ENTER to resume the Ringworld\x14 demo. Press ESC to exit"; +const char *EXIT_BTN_STRING = "Exit"; +const char *DEMO_BTN_STRING = "Demo"; +const char *DEMO_RESUME_BTN_STRING = "Resume"; } // End of namespace tSage diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h index 0db349f8a7..fa93511779 100644 --- a/engines/tsage/staticres.h +++ b/engines/tsage/staticres.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_STATICRES_H @@ -82,6 +79,12 @@ extern const char *SCENE6100_VERY_WELL; // Demo messages extern const char *DEMO_HELP_MSG; extern const char *DEMO_PAUSED_MSG; +extern const char *DEMO_HELP_MSG; +extern const char *DEMO_PAUSED_MSG; +extern const char *DEMO_EXIT_MSG; +extern const char *EXIT_BTN_STRING; +extern const char *DEMO_BTN_STRING; +extern const char *DEMO_RESUME_BTN_STRING; } // End of namespace tSage diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp index 8813fc7e45..6fae9785c0 100644 --- a/engines/tsage/tsage.cpp +++ b/engines/tsage/tsage.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/debug-channels.h" @@ -63,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 @@ -71,16 +68,22 @@ void TSageEngine::initialise() { if (_vm->getFeatures() & GF_DEMO) { // Add the single library file associated with the demo _resourceManager->addLib(getPrimaryFilename()); - } else { + } else if (_vm->getGameID() == GType_Ringworld) { _resourceManager->addLib("RING.RLB"); _resourceManager->addLib("TSAGE.RLB"); + } else if (_vm->getGameID() == GType_BlueForce) { + _resourceManager->addLib("BLUE.RLB"); + if (_vm->getFeatures() & GF_FLOPPY) { + _resourceManager->addLib("FILES.RLB"); + _resourceManager->addLib("TSAGE.RLB"); + } } _globals = new Globals(); _globals->gfxManager().setDefaults(); } -void TSageEngine::deinitialise() { +void TSageEngine::deinitialize() { delete _globals; delete _resourceManager; delete _saver; @@ -88,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; } diff --git a/engines/tsage/tsage.h b/engines/tsage/tsage.h index 06c66d8f42..e3d37257cd 100644 --- a/engines/tsage/tsage.h +++ b/engines/tsage/tsage.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef TSAGE_H @@ -89,8 +86,8 @@ public: virtual Common::Error saveGameState(int slot, const char *desc); Common::String generateSaveName(int slot); - void initialise(); - void deinitialise(); + void initialize(); + void deinitialize(); }; extern TSageEngine *_vm; |