diff options
40 files changed, 1022 insertions, 622 deletions
diff --git a/backends/platform/webos/webos.mk b/backends/platform/webos/webos.mk index 885c9eb90e..22df5622ee 100644 --- a/backends/platform/webos/webos.mk +++ b/backends/platform/webos/webos.mk @@ -1,23 +1,70 @@ # WebOS specific build targets +# ============================================================================ +# +# Run "make webosrelease" to create a release package to be uploaded to the +# Palm app catalog. +# +# Run "make webosbeta" to create a beta package to be uploaded to the Palm +# Beta app catalog. +# +# Before calling these targets the ScummVM source must be configured for a +# WebOS build. See +# http://wiki.scummvm.org/index.php/Compiling_ScummVM/WebOS for details. +# +# VER_PACKAGE must be set to a number which is higher than the currently +# used package version in the app catalog. So when creating an updated +# package for ScummVM 1.3.9 and the current ScummVM package in the app +# catalog is version 1.3.0902 then you must specify VER_PACKAGE=3 to create +# the ScummVM package with version 1.3.0903. Yeah, I know that's ugly but +# WebOS package version numbers are restricted to three numeric components. +# +# As long as Palm doesn't support Team-maintained apps the uploaded packages +# MUST NOT be packaged with the default "org.scummvm" base id. Instead apps +# must be uploaded with a user-specific base id. A good practice is using +# the github user as base id: com.github.<username>. It is also necessary +# to use a user-specific app name when submitting the created package to the +# Palm app catalog. Use "ScummVM (<username>)" instead of "ScummVM" and +# "ScummVM Beta (<username>)" instead of "ScummVM Beta". PATH_DIST = $(srcdir)/dists/webos PATH_MOJO = $(PATH_DIST)/mojo +BASE_APP_ID = org.scummvm +APP_ID = $(BASE_APP_ID).scummvm +BETA_APP_ID = $(APP_ID)-beta +APP_VERSION = $(shell printf "%d.%d.%02d%02d" $(VER_MAJOR) $(VER_MINOR) $(VER_PATCH) $(VER_PACKAGE)) +STAGING_DIR=STAGING/$(APP_ID) -STAGING_DIR=STAGING/org.scummvm.scummvm +webosprepare: all + $(QUIET)if [ "$(VER_PACKAGE)" = "" ]; \ + then \ + echo "ERROR: VER_PACKAGE is not set"; \ + echo "Example: export VER_PACKAGE=1"; \ + exit 1; \ + fi + $(QUIET)$(RM_REC) $(STAGING_DIR) + $(QUIET)$(MKDIR) $(STAGING_DIR) + $(QUIET)$(MKDIR) $(STAGING_DIR)/bin + $(QUIET)$(MKDIR) $(STAGING_DIR)/lib + $(QUIET)$(MKDIR) $(STAGING_DIR)/share/scummvm + $(QUIET)$(CP) $(PATH_MOJO)/* $(STAGING_DIR) + $(QUIET)$(CP) gui/themes/translations.dat $(STAGING_DIR)/share/scummvm + $(QUIET)$(CP) gui/themes/scummmodern.zip $(STAGING_DIR)/share/scummvm + $(QUIET)$(CP) scummvm $(STAGING_DIR)/bin + $(QUIET)$(STRIP) $(STAGING_DIR)/bin/scummvm + $(QUIET)sed -i s/'APP_VERSION'/'$(APP_VERSION)'/ $(STAGING_DIR)/appinfo.json -webosrelease: - rm -rf $(STAGING_DIR) - rm -f *.ipk - mkdir -p $(STAGING_DIR) - mkdir -p $(STAGING_DIR)/bin - mkdir -p $(STAGING_DIR)/lib - mkdir -p $(STAGING_DIR)/share/scummvm - cp -f $(PATH_MOJO)/* $(STAGING_DIR) - cp -f gui/themes/translations.dat $(STAGING_DIR)/share/scummvm - cp -f gui/themes/scummmodern.zip $(STAGING_DIR)/share/scummvm - cp -f scummvm $(STAGING_DIR)/bin - $(STRIP) $(STAGING_DIR)/bin/scummvm - $(WEBOS_SDK)/bin/palm-package $(STAGING_DIR) - rm -rf STAGING +webosrelease: webosprepare + $(QUIET)$(RM) $(APP_ID)_*.ipk + $(QUIET)sed -i s/'APP_ID'/'$(APP_ID)'/ $(STAGING_DIR)/appinfo.json + $(QUIET)sed -i s/'APP_TITLE'/'ScummVM'/ $(STAGING_DIR)/appinfo.json + $(QUIET)$(WEBOS_SDK)/bin/palm-package --use-v1-format $(STAGING_DIR) + $(QUIET)$(RM_REC) STAGING -.PHONY: webosrelease +webosbeta: webosprepare + $(QUIET)$(RM) $(BETA_APP_ID)_*.ipk + $(QUIET)sed -i s/'APP_ID'/'$(BETA_APP_ID)'/ $(STAGING_DIR)/appinfo.json + $(QUIET)sed -i s/'APP_TITLE'/'ScummVM Beta'/ $(STAGING_DIR)/appinfo.json + $(QUIET)$(WEBOS_SDK)/bin/palm-package --use-v1-format $(STAGING_DIR) + $(QUIET)$(RM_REC) STAGING + +.PHONY: webosrelease webosbeta diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 7c482d3057..bb2141b110 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -262,7 +262,7 @@ void registerDefaults() { #define DO_OPTION_INT(shortCmd, longCmd) \ DO_OPTION(shortCmd, longCmd) \ char *endptr = 0; \ - int intValue; intValue = (int)strtol(option, &endptr, 0); \ + strtol(option, &endptr, 0); \ if (endptr == NULL || *endptr != 0) usage("--%s: Invalid number '%s'", longCmd, option); // Use this for boolean options; this distinguishes between "-x" and "-X", diff --git a/dists/webos/mojo/appinfo.json b/dists/webos/mojo/appinfo.json index 00762c9410..b3163a4e95 100644 --- a/dists/webos/mojo/appinfo.json +++ b/dists/webos/mojo/appinfo.json @@ -1,10 +1,10 @@ { - "id": "org.scummvm.scummvm", - "version": "1.3.0001", + "id": "APP_ID", + "version": "APP_VERSION", "vendor": "ScummVM Team", "type": "pdk", "main": "start", - "title": "ScummVM", + "title": "APP_TITLE", "icon": "icon.png", "requiredMemory": 64 } diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp index 9b58f8bd5a..8c7d3b0824 100644 --- a/engines/groovie/script.cpp +++ b/engines/groovie/script.cpp @@ -39,6 +39,8 @@ #include "common/EventRecorder.h" #include "common/macresman.h" +#include "gui/message.h" + #define NUM_OPCODES 90 namespace Groovie { @@ -411,6 +413,13 @@ void Script::savegame(uint slot) { char newchar; Common::OutSaveFile *file = SaveLoad::openForSaving(ConfMan.getActiveDomainName(), slot); + if (!file) { + debugC(9, kGroovieDebugScript, "Save file pointer is null"); + GUI::MessageDialog dialog("Failed to save game", "OK"); + dialog.runModal(); + return; + } + // Saving the variables. It is endian safe because they're byte variables file->write(_variables, 0x400); delete file; diff --git a/engines/hugo/dialogs.cpp b/engines/hugo/dialogs.cpp index 096cea8a72..50fcfa27db 100644 --- a/engines/hugo/dialogs.cpp +++ b/engines/hugo/dialogs.cpp @@ -165,7 +165,8 @@ void TopMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 d switch (command) { case kCmdWhat: close(); - _vm->_file->instructions(); + _vm->getGameStatus().helpFl = true; + break; case kCmdMusic: _vm->_sound->toggleMusic(); diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index 32247be2da..7a42ca2ebe 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -298,6 +298,10 @@ Common::Error HugoEngine::run() { break; } } + if (_status.helpFl) { + _status.helpFl = false; + _file->instructions(); + } _mouse->mouseHandler(); // Mouse activity - adds to display list _screen->displayList(kDisplayDisplay); // Blit the display list to screen @@ -323,9 +327,6 @@ void HugoEngine::initMachine() { */ void HugoEngine::runMachine() { status_t &gameStatus = getGameStatus(); - // Don't process if we're in a textbox - if (gameStatus.textBoxFl) - return; // Don't process if gameover if (gameStatus.gameOverFl) @@ -531,13 +532,13 @@ void HugoEngine::initStatus() { debugC(1, kDebugEngine, "initStatus"); _status.storyModeFl = false; // Not in story mode _status.gameOverFl = false; // Hero not knobbled yet - _status.textBoxFl = false; // Not processing a text box _status.lookFl = false; // Toolbar "look" button _status.recallFl = false; // Toolbar "recall" button _status.newScreenFl = false; // Screen not just loaded _status.godModeFl = false; // No special cheats allowed _status.doQuitFl = false; _status.skipIntroFl = false; + _status.helpFl = false; // Initialize every start of new game _status.tick = 0; // Tick count @@ -554,6 +555,7 @@ void HugoEngine::initStatus() { // _status.screenWidth = 0; // Desktop screen width // _status.saveTick = 0; // Time of last save // _status.saveSlot = 0; // Slot to save/restore game +// _status.textBoxFl = false; // Not processing a text box } /** diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h index 0a8325f439..b2d241f241 100644 --- a/engines/hugo/hugo.h +++ b/engines/hugo/hugo.h @@ -176,13 +176,13 @@ struct HugoGameDescription; struct status_t { // Game status (not saved) bool storyModeFl; // Game is telling story - no commands bool gameOverFl; // Game is over - hero knobbled - bool textBoxFl; // Game is (halted) in text box bool lookFl; // Toolbar "look" button pressed bool recallFl; // Toolbar "recall" button pressed bool newScreenFl; // New screen just loaded in dib_a bool godModeFl; // Allow DEBUG features in live version bool doQuitFl; bool skipIntroFl; + bool helpFl; uint32 tick; // Current time in ticks vstate_t viewState; // View state machine int16 song; // Current song @@ -194,6 +194,7 @@ struct status_t { // Game status (not saved) // bool helpFl; // Calling WinHelp (don't disable music) // bool mmtimeFl; // Multimedia timer supported // bool demoFl; // Game is in demo mode +// bool textBoxFl; // Game is (halted) in text box // int16 screenWidth; // Desktop screen width // int16 saveSlot; // Current slot to save/restore game // int16 cx, cy; // Cursor position (dib coords) diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index 9cfdd1a41d..19cd4a333c 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -340,7 +340,7 @@ void Parser::keyHandler(Common::Event event) { break; case Common::KEYCODE_F1: // User Help (DOS) if (_checkDoubleF1Fl) - _vm->_file->instructions(); + gameStatus.helpFl = true; else _vm->_screen->userHelp(); _checkDoubleF1Fl = !_checkDoubleF1Fl; diff --git a/engines/hugo/parser_v2d.cpp b/engines/hugo/parser_v2d.cpp index d6f2adfedc..19570eb44c 100644 --- a/engines/hugo/parser_v2d.cpp +++ b/engines/hugo/parser_v2d.cpp @@ -121,7 +121,6 @@ void Parser_v2d::lineHandler() { // SAVE/RESTORE if (!strcmp("save", _vm->_line)) { - _vm->_config.soundFl = false; if (gameStatus.gameOverFl) _vm->gameOverMsg(); else @@ -130,7 +129,6 @@ void Parser_v2d::lineHandler() { } if (!strcmp("restore", _vm->_line)) { - _vm->_config.soundFl = false; _vm->_file->restoreGame(-1); return; } diff --git a/engines/hugo/parser_v3d.cpp b/engines/hugo/parser_v3d.cpp index f08d472240..e5575ab8b7 100644 --- a/engines/hugo/parser_v3d.cpp +++ b/engines/hugo/parser_v3d.cpp @@ -123,7 +123,6 @@ void Parser_v3d::lineHandler() { // SAVE/RESTORE if (!strcmp("save", _vm->_line)) { - _vm->_config.soundFl = false; if (gameStatus.gameOverFl) _vm->gameOverMsg(); else @@ -132,7 +131,6 @@ void Parser_v3d::lineHandler() { } if (!strcmp("restore", _vm->_line)) { - _vm->_config.soundFl = false; _vm->_file->restoreGame(-1); return; } diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 57c5c48975..be072c37f8 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -244,6 +244,7 @@ void SequenceManager::signal() { } case 28: _objectIndex = getNextValue(); + assert((_objectIndex >= 0) && (_objectIndex < 6)); _sceneObject = _objectList[_objectIndex]; assert(_sceneObject); break; @@ -272,14 +273,15 @@ void SequenceManager::signal() { case 34: { v1 = getNextValue(); v2 = getNextValue(); - int objIndex1 = getNextValue(); - int objIndex2 = getNextValue(); - int objIndex3 = getNextValue(); - int objIndex4 = getNextValue(); - int objIndex5 = getNextValue(); + int objIndex1 = getNextValue() - 1; + int objIndex2 = getNextValue() - 1; + int objIndex3 = getNextValue() - 1; + int objIndex4 = getNextValue() - 1; + int objIndex5 = getNextValue() - 1; + int objIndex6 = getNextValue() - 1; setAction(globalManager(), v2 ? this : NULL, v1, _objectList[objIndex1], _objectList[objIndex2], - _objectList[objIndex3], _objectList[objIndex4], _objectList[objIndex5]); + _objectList[objIndex3], _objectList[objIndex4], _objectList[objIndex5], _objectList[objIndex6], NULL); break; } default: @@ -304,7 +306,7 @@ void SequenceManager::attached(EventHandler *newOwner, EventHandler *fmt, va_lis // Get the sequence number to use _resNum = va_arg(va, int); - byte *seqData = _vm->_dataManager->getResource(RES_SEQUENCE, _resNum, 0); + byte *seqData = _resourceManager->getResource(RES_SEQUENCE, _resNum, 0); uint seqSize = _vm->_memoryManager.getSize(seqData); _sequenceData.resize(seqSize); @@ -340,7 +342,7 @@ void SequenceManager::setMessage(int resNum, int lineNum, int color, const Commo _sceneText._width = width; // Get the display message - Common::String msg = _vm->_dataManager->getMessage(resNum, lineNum); + Common::String msg = _resourceManager->getMessage(resNum, lineNum); // Get the needed rect, and move it to the desired position Rect textRect; @@ -560,7 +562,7 @@ void StripManager::reset() { void StripManager::load() { // Get the script - byte *script = _vm->_dataManager->getResource(RES_STRIP, _stripNum, 2); + byte *script = _resourceManager->getResource(RES_STRIP, _stripNum, 2); uint scriptSize = _vm->_memoryManager.getSize(script); _script.resize(scriptSize); @@ -569,7 +571,7 @@ void StripManager::load() { DEALLOCATE(script); // Get the object list - byte *obj44List = _vm->_dataManager->getResource(RES_STRIP, _stripNum, 1); + byte *obj44List = _resourceManager->getResource(RES_STRIP, _stripNum, 1); int dataSize = _vm->_memoryManager.getSize(obj44List); assert((dataSize % 0x44) == 0); diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 1b38599df1..776e449c87 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -24,10 +24,7 @@ */ #include "common/system.h" -#include "common/config-manager.h" -#include "common/translation.h" #include "engines/engine.h" -#include "gui/saveload.h" #include "tsage/tsage.h" #include "tsage/core.h" #include "tsage/dialogs.h" @@ -51,7 +48,7 @@ InvObject::InvObject(int sceneNumber, int rlbNum, int cursorNum, CursorType curs // Decode the image for the inventory item to get it's display bounds uint size; - byte *imgData = _vm->_dataManager->getSubResource(_displayResNum, _rlbNum, _cursorNum, &size); + byte *imgData = _resourceManager->getSubResource(_displayResNum, _rlbNum, _cursorNum, &size); GfxSurface s = surfaceFromRes(imgData); _bounds = s.getBounds(); @@ -71,76 +68,7 @@ void InvObject::setCursor() { /*--------------------------------------------------------------------------*/ -InvObjectList::InvObjectList() : - _stunner(2280, 1, 2, OBJECT_STUNNER, "This is your stunner."), - _scanner(1, 1, 3, OBJECT_SCANNER, "A combination scanner comm unit."), - _stasisBox(5200, 1, 4, OBJECT_STASIS_BOX, "A stasis box."), - _infoDisk(40, 1, 1, OBJECT_INFODISK, "The infodisk you took from the assassin."), - _stasisNegator(0, 2, 2, OBJECT_STASIS_NEGATOR, "The stasis field negator."), - _keyDevice(4250, 1, 6, OBJECT_KEY_DEVICE, "A magnetic key device."), - _medkit(2280, 1, 7, OBJECT_MEDKIT, "Your medkit."), - _ladder(4100, 1, 8, OBJECT_LADDER, "The chief's ladder."), - _rope(4150, 1, 9, OBJECT_ROPE, "The chief's rope."), - _key(7700, 1, 11, OBJECT_KEY, "A key."), - _translator(7700, 1, 13, OBJECT_TRANSLATOR, "The dolphin translator box."), - _ale(2150, 1, 10, OBJECT_ALE, "A bottle of ale."), - _paper(7700, 1, 12, OBJECT_PAPER, "A slip of paper with the numbers 2,4, and 3 written on it."), - _waldos(0, 1, 14, OBJECT_WALDOS, "A pair of waldos from the ruined probe."), - _stasisBox2(8100, 1, 4, OBJECT_STASIS_BOX2, "A stasis box."), - _ring(8100, 2, 5, OBJECT_RING, "This is a signet ring sent to you by Louis Wu."), - _cloak(9850, 2, 6, OBJECT_CLOAK, "A fine silk cloak."), - _tunic(9450, 2, 7, OBJECT_TUNIC, "The patriarch's soiled tunic."), - _candle(9500, 2, 8, OBJECT_CANDLE, "A tallow candle."), - _straw(9400, 2, 9, OBJECT_STRAW, "Clean, dry straw."), - _scimitar(9850, 1, 18, OBJECT_SCIMITAR, "A scimitar from the Patriarch's closet."), - _sword(9850, 1, 17, OBJECT_SWORD, "A short sword from the Patriarch's closet."), - _helmet(9500, 2, 4, OBJECT_HELMET, "Some type of helmet."), - _items(4300, 2, 10, OBJECT_ITEMS, "Two interesting items from the Tnuctipun vessel."), - _concentrator(4300, 2, 11, OBJECT_CONCENTRATOR, "The Tnuctipun anti-matter concentrator contained in a stasis field."), - _nullifier(5200, 2, 12, OBJECT_NULLIFIER, "A purported neural wave nullifier."), - _peg(4045, 2, 16, OBJECT_PEG, "A peg with a symbol."), - _vial(5100, 2, 17, OBJECT_VIAL, "A vial of the bat creatures anti-pheromone drug."), - _jacket(9850, 3, 1, OBJECT_JACKET, "A natty padded jacket."), - _tunic2(9850, 3, 2, OBJECT_TUNIC2, "A very hairy tunic."), - _bone(5300, 3, 5, OBJECT_BONE, "A very sharp bone."), - _jar(7700, 3, 4, OBJECT_JAR, "An jar filled with a green substance."), - _emptyJar(7700, 3, 3, OBJECT_EMPTY_JAR, "An empty jar.") { - - // Add the items to the list - _itemList.push_back(&_stunner); - _itemList.push_back(&_scanner); - _itemList.push_back(&_stasisBox); - _itemList.push_back(&_infoDisk); - _itemList.push_back(&_stasisNegator); - _itemList.push_back(&_keyDevice); - _itemList.push_back(&_medkit); - _itemList.push_back(&_ladder); - _itemList.push_back(&_rope); - _itemList.push_back(&_key); - _itemList.push_back(&_translator); - _itemList.push_back(&_ale); - _itemList.push_back(&_paper); - _itemList.push_back(&_waldos); - _itemList.push_back(&_stasisBox2); - _itemList.push_back(&_ring); - _itemList.push_back(&_cloak); - _itemList.push_back(&_tunic); - _itemList.push_back(&_candle); - _itemList.push_back(&_straw); - _itemList.push_back(&_scimitar); - _itemList.push_back(&_sword); - _itemList.push_back(&_helmet); - _itemList.push_back(&_items); - _itemList.push_back(&_concentrator); - _itemList.push_back(&_nullifier); - _itemList.push_back(&_peg); - _itemList.push_back(&_vial); - _itemList.push_back(&_jacket); - _itemList.push_back(&_tunic2); - _itemList.push_back(&_bone); - _itemList.push_back(&_jar); - _itemList.push_back(&_emptyJar); - +InvObjectList::InvObjectList() { _selectedItem = NULL; } @@ -1240,7 +1168,7 @@ ScenePalette::ScenePalette(int paletteNum) { } bool ScenePalette::loadPalette(int paletteNum) { - byte *palData = _vm->_dataManager->getResource(RES_PALETTE, paletteNum, 0, true); + byte *palData = _resourceManager->getResource(RES_PALETTE, paletteNum, 0, true); if (!palData) return false; @@ -1481,7 +1409,7 @@ bool SceneItem::contains(const Common::Point &pt) { } void SceneItem::display(int resNum, int lineNum, ...) { - Common::String msg = !resNum ? Common::String() : _vm->_dataManager->getMessage(resNum, lineNum); + Common::String msg = !resNum ? Common::String() : _resourceManager->getMessage(resNum, lineNum); if (_globals->_sceneObjects->contains(&_globals->_sceneText)) { _globals->_sceneText.remove(); @@ -2646,7 +2574,7 @@ void Visage::setVisage(int resNum, int rlbNum) { _resNum = resNum; _rlbNum = rlbNum; DEALLOCATE(_data); - _data = _vm->_dataManager->getResource(RES_VISAGE, resNum, rlbNum); + _data = _resourceManager->getResource(RES_VISAGE, resNum, rlbNum); assert(_data); } } @@ -2736,7 +2664,7 @@ void Player::synchronise(Serialiser &s) { Region::Region(int resNum, int rlbNum, ResourceType ctlType) { _regionId = rlbNum; - byte *regionData = _vm->_dataManager->getResource(ctlType, resNum, rlbNum); + byte *regionData = _resourceManager->getResource(ctlType, resNum, rlbNum); assert(regionData); // Set the region bounds @@ -2948,7 +2876,7 @@ void Region::uniteRect(const Rect &rect) { void SceneRegions::load(int sceneNum) { clear(); - byte *regionData = _vm->_dataManager->getResource(RES_CONTROL, sceneNum, 9999, true); + byte *regionData = _resourceManager->getResource(RES_CONTROL, sceneNum, 9999, true); if (regionData) { int regionCount = READ_LE_UINT16(regionData); @@ -3212,7 +3140,7 @@ void WalkRegions::load(int sceneNum) { clear(); _resNum = sceneNum; - byte *regionData = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 1, true); + byte *regionData = _resourceManager->getResource(RES_WALKRGNS, sceneNum, 1, true); if (!regionData) { // No data, so return _resNum = -1; @@ -3223,7 +3151,7 @@ void WalkRegions::load(int sceneNum) { int dataSize; // Load the field 18 list - dataP = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 2); + dataP = _resourceManager->getResource(RES_WALKRGNS, sceneNum, 2); dataSize = _vm->_memoryManager.getSize(dataP); assert(dataSize % 10 == 0); @@ -3237,7 +3165,7 @@ void WalkRegions::load(int sceneNum) { DEALLOCATE(dataP); // Load the idx list - dataP = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 3); + dataP = _resourceManager->getResource(RES_WALKRGNS, sceneNum, 3); dataSize = _vm->_memoryManager.getSize(dataP); assert(dataSize % 2 == 0); @@ -3248,7 +3176,7 @@ void WalkRegions::load(int sceneNum) { DEALLOCATE(dataP); // Load the secondary idx list - dataP = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 4); + dataP = _resourceManager->getResource(RES_WALKRGNS, sceneNum, 4); dataSize = _vm->_memoryManager.getSize(dataP); assert(dataSize % 2 == 0); @@ -3259,7 +3187,7 @@ void WalkRegions::load(int sceneNum) { DEALLOCATE(dataP); // Handle the loading of the actual regions themselves - dataP = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 5); + dataP = _resourceManager->getResource(RES_WALKRGNS, sceneNum, 5); byte *pWalkRegion = regionData + 16; byte *srcP = dataP; @@ -3305,7 +3233,7 @@ void ScenePriorities::load(int resNum) { _resNum = resNum; clear(); - byte *regionData = _vm->_dataManager->getResource(RES_PRIORITY, resNum, 9999, true); + byte *regionData = _resourceManager->getResource(RES_PRIORITY, resNum, 9999, true); if (regionData) { int regionCount = READ_LE_UINT16(regionData); @@ -3376,7 +3304,7 @@ GameHandler::GameHandler() : EventHandler() { GameHandler::~GameHandler() { if (_globals) - _globals->_game.removeHandler(this); + _globals->_game->removeHandler(this); } void GameHandler::execute() { @@ -3402,7 +3330,7 @@ SceneHandler::SceneHandler() { void SceneHandler::registerHandler() { postInit(); - _globals->_game.addHandler(this); + _globals->_game->addHandler(this); } void SceneHandler::postInit(SceneObjectList *OwnerList) { @@ -3414,21 +3342,7 @@ void SceneHandler::postInit(SceneObjectList *OwnerList) { // TODO: Bunch of other scene related setup goes here _globals->_soundManager.postInit(); - // Set some default flags and cursor - _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; - - // Set the object's that will be in the player's inventory by default - _globals->_inventory._stunner._sceneNumber = 1; - _globals->_inventory._scanner._sceneNumber = 1; - _globals->_inventory._ring._sceneNumber = 1; - - // Switch to the title screen - _globals->_sceneManager.setNewScene(1000); + _globals->_game->start(); } void SceneHandler::process(Event &event) { @@ -3452,19 +3366,19 @@ void SceneHandler::process(Event &event) { case Common::KEYCODE_F3: // F3 - Quit - _globals->_game.quitGame(); + _globals->_game->quitGame(); event.handled = false; break; case Common::KEYCODE_F4: // F4 - Restart - _globals->_game.restartGame(); + _globals->_game->restartGame(); _globals->_events.setCursorFromFlag(); break; case Common::KEYCODE_F7: // F7 - Restore - _globals->_game.restoreGame(); + _globals->_game->restoreGame(); _globals->_events.setCursorFromFlag(); break; @@ -3501,7 +3415,7 @@ void SceneHandler::process(Event &event) { // Separate check for F5 - Save key if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_F5)) { // F5 - Save - _globals->_game.saveGame(); + _globals->_game->saveGame(); event.handled = true; _globals->_events.setCursorFromFlag(); } @@ -3618,130 +3532,4 @@ void Game::execute() { } while (activeFlag && !_vm->getEventManager()->shouldQuit()); } -void Game::restartGame() { - if (MessageDialog::show(RESTART_MSG, CANCEL_BTN_STRING, RESTART_BTN_STRING) == 1) - _globals->_game.restart(); -} - -void Game::saveGame() { - if (_globals->getFlag(50)) - MessageDialog::show(SAVING_NOT_ALLOWED_MSG, OK_BTN_STRING); - else { - // Show the save dialog - handleSaveLoad(true, _globals->_sceneHandler._saveGameSlot, _globals->_sceneHandler._saveName); - } -} - -void Game::restoreGame() { - if (_globals->getFlag(50)) - MessageDialog::show(RESTORING_NOT_ALLOWED_MSG, OK_BTN_STRING); - else { - // Show the load dialog - handleSaveLoad(false, _globals->_sceneHandler._loadGameSlot, _globals->_sceneHandler._saveName); - } -} - -void Game::quitGame() { - if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1) - _vm->quitGame(); -} - -void Game::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) { - const EnginePlugin *plugin = 0; - EngineMan.findGame(_vm->getGameId(), &plugin); - GUI::SaveLoadChooser *dialog; - if (saveFlag) - dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save")); - else - dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load")); - - dialog->setSaveMode(saveFlag); - - saveSlot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); - saveName = dialog->getResultString(); - - delete dialog; -} - -void Game::restart() { - _globals->_scenePalette.clearListeners(); - _globals->_soundHandler.proc3(); - - // Reset the flags - _globals->reset(); - _globals->setFlag(34); - - // Clear save/load slots - _globals->_sceneHandler._saveGameSlot = -1; - _globals->_sceneHandler._loadGameSlot = -1; - - _globals->_stripNum = 0; - _globals->_events.setCursor(CURSOR_WALK); - - // Reset item properties - _globals->_inventory._stunner._sceneNumber = 1; - _globals->_inventory._scanner._sceneNumber = 1; - _globals->_inventory._stasisBox._sceneNumber = 5200; - _globals->_inventory._infoDisk._sceneNumber = 40; - _globals->_inventory._stasisNegator._sceneNumber = 0; - _globals->_inventory._keyDevice._sceneNumber = 0; - _globals->_inventory._medkit._sceneNumber = 2280; - _globals->_inventory._ladder._sceneNumber = 4100; - _globals->_inventory._rope._sceneNumber = 4150; - _globals->_inventory._key._sceneNumber = 7700; - _globals->_inventory._translator._sceneNumber = 2150; - _globals->_inventory._paper._sceneNumber = 7700; - _globals->_inventory._waldos._sceneNumber = 0; - _globals->_inventory._ring._sceneNumber = 1; - _globals->_inventory._stasisBox2._sceneNumber = 8100; - _globals->_inventory._cloak._sceneNumber = 9850; - _globals->_inventory._tunic._sceneNumber = 9450; - _globals->_inventory._candle._sceneNumber = 9500; - _globals->_inventory._straw._sceneNumber = 9400; - _globals->_inventory._scimitar._sceneNumber = 9850; - _globals->_inventory._sword._sceneNumber = 9850; - _globals->_inventory._helmet._sceneNumber = 9500; - _globals->_inventory._items._sceneNumber = 4300; - _globals->_inventory._concentrator._sceneNumber = 4300; - _globals->_inventory._nullifier._sceneNumber = 4300; - _globals->_inventory._peg._sceneNumber = 4045; - _globals->_inventory._vial._sceneNumber = 5100; - _globals->_inventory._jacket._sceneNumber = 9850; - _globals->_inventory._tunic2._sceneNumber = 9850; - _globals->_inventory._bone._sceneNumber = 5300; - _globals->_inventory._jar._sceneNumber = 7700; - _globals->_inventory._emptyJar._sceneNumber = 7700; - _globals->_inventory._selectedItem = NULL; - - // Change to the first game scene - _globals->_sceneManager.changeScene(30); -} - -void Game::endGame(int resNum, int lineNum) { - _globals->_events.setCursor(CURSOR_WALK); - Common::String msg = _vm->_dataManager->getMessage(resNum, lineNum); - bool savesExist = _saver->savegamesExist(); - - if (!savesExist) { - // No savegames exist, so prompt the user to restart or quit - if (MessageDialog::show(msg, QUIT_BTN_STRING, RESTART_BTN_STRING) == 0) - _vm->quitGame(); - else - restart(); - } else { - // Savegames exist, so prompt for Restore/Restart - bool breakFlag; - do { - if (MessageDialog::show(msg, RESTART_BTN_STRING, RESTORE_BTN_STRING) == 0) { - breakFlag = true; - } else { - handleSaveLoad(false, _globals->_sceneHandler._loadGameSlot, _globals->_sceneHandler._saveName); - breakFlag = _globals->_sceneHandler._loadGameSlot > 0; - } - } while (!breakFlag); - } - - _globals->_events.setCursorFromFlag(); -} - } // End of namespace tSage diff --git a/engines/tsage/core.h b/engines/tsage/core.h index c18984fd45..85f4b420c1 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -73,43 +73,9 @@ public: class InvObjectList : public SavedObject { public: - InvObject _stunner; - InvObject _scanner; - InvObject _stasisBox; - InvObject _infoDisk; - InvObject _stasisNegator; - InvObject _keyDevice; - InvObject _medkit; - InvObject _ladder; - InvObject _rope; - InvObject _key; - InvObject _translator; - InvObject _ale; - InvObject _paper; - InvObject _waldos; - InvObject _stasisBox2; - InvObject _ring; - InvObject _cloak; - InvObject _tunic; - InvObject _candle; - InvObject _straw; - InvObject _scimitar; - InvObject _sword; - InvObject _helmet; - InvObject _items; - InvObject _concentrator; - InvObject _nullifier; - InvObject _peg; - InvObject _vial; - InvObject _jacket; - InvObject _tunic2; - InvObject _bone; - InvObject _jar; - InvObject _emptyJar; - SynchronisedList<InvObject *> _itemList; InvObject *_selectedItem; -public: + InvObjectList(); virtual Common::String getClassName() { return "InvObjectList"; } @@ -942,22 +908,25 @@ public: /*--------------------------------------------------------------------------*/ class Game { -private: +protected: SynchronisedList<GameHandler *> _handlers; static bool notLockedFn(GameHandler *g); - void restart(); - void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName); + 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(); - void restartGame(); - void saveGame(); - void restoreGame(); - void quitGame(); - void endGame(int resNum, int lineNum); + 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 diff --git a/engines/tsage/debugger.cpp b/engines/tsage/debugger.cpp index ad4e76f61c..e8f0215e0e 100644 --- a/engines/tsage/debugger.cpp +++ b/engines/tsage/debugger.cpp @@ -28,7 +28,7 @@ #include "common/endian.h" #include "tsage/globals.h" #include "tsage/graphics.h" - +#include "tsage/ringworld_logic.h" namespace tSage { @@ -276,103 +276,103 @@ bool Debugger::Cmd_MoveObject(int argc, const char **argv) { switch (objNum) { case OBJECT_STUNNER: - _globals->_inventory._stunner._sceneNumber = sceneNum; + RING_INVENTORY._stunner._sceneNumber = sceneNum; break; case OBJECT_SCANNER: - _globals->_inventory._scanner._sceneNumber = sceneNum; + RING_INVENTORY._scanner._sceneNumber = sceneNum; break; case OBJECT_STASIS_BOX: - _globals->_inventory._stasisBox._sceneNumber = sceneNum; + RING_INVENTORY._stasisBox._sceneNumber = sceneNum; break; case OBJECT_INFODISK: - _globals->_inventory._infoDisk._sceneNumber = sceneNum; + RING_INVENTORY._infoDisk._sceneNumber = sceneNum; break; case OBJECT_STASIS_NEGATOR: - _globals->_inventory._stasisNegator._sceneNumber = sceneNum; + RING_INVENTORY._stasisNegator._sceneNumber = sceneNum; break; case OBJECT_KEY_DEVICE: - _globals->_inventory._keyDevice._sceneNumber = sceneNum; + RING_INVENTORY._keyDevice._sceneNumber = sceneNum; break; case OBJECT_MEDKIT: - _globals->_inventory._medkit._sceneNumber = sceneNum; + RING_INVENTORY._medkit._sceneNumber = sceneNum; break; case OBJECT_LADDER: - _globals->_inventory._ladder._sceneNumber = sceneNum; + RING_INVENTORY._ladder._sceneNumber = sceneNum; break; case OBJECT_ROPE: - _globals->_inventory._rope._sceneNumber = sceneNum; + RING_INVENTORY._rope._sceneNumber = sceneNum; break; case OBJECT_KEY: - _globals->_inventory._key._sceneNumber = sceneNum; + RING_INVENTORY._key._sceneNumber = sceneNum; break; case OBJECT_TRANSLATOR: - _globals->_inventory._translator._sceneNumber = sceneNum; + RING_INVENTORY._translator._sceneNumber = sceneNum; break; case OBJECT_ALE: - _globals->_inventory._ale._sceneNumber = sceneNum; + RING_INVENTORY._ale._sceneNumber = sceneNum; break; case OBJECT_PAPER: - _globals->_inventory._paper._sceneNumber = sceneNum; + RING_INVENTORY._paper._sceneNumber = sceneNum; break; case OBJECT_WALDOS: - _globals->_inventory._waldos._sceneNumber = sceneNum; + RING_INVENTORY._waldos._sceneNumber = sceneNum; break; case OBJECT_STASIS_BOX2: - _globals->_inventory._stasisBox2._sceneNumber = sceneNum; + RING_INVENTORY._stasisBox2._sceneNumber = sceneNum; break; case OBJECT_RING: - _globals->_inventory._ring._sceneNumber = sceneNum; + RING_INVENTORY._ring._sceneNumber = sceneNum; break; case OBJECT_CLOAK: - _globals->_inventory._cloak._sceneNumber = sceneNum; + RING_INVENTORY._cloak._sceneNumber = sceneNum; break; case OBJECT_TUNIC: - _globals->_inventory._tunic._sceneNumber = sceneNum; + RING_INVENTORY._tunic._sceneNumber = sceneNum; break; case OBJECT_CANDLE: - _globals->_inventory._candle._sceneNumber = sceneNum; + RING_INVENTORY._candle._sceneNumber = sceneNum; break; case OBJECT_STRAW: - _globals->_inventory._straw._sceneNumber = sceneNum; + RING_INVENTORY._straw._sceneNumber = sceneNum; break; case OBJECT_SCIMITAR: - _globals->_inventory._scimitar._sceneNumber = sceneNum; + RING_INVENTORY._scimitar._sceneNumber = sceneNum; break; case OBJECT_SWORD: - _globals->_inventory._sword._sceneNumber = sceneNum; + RING_INVENTORY._sword._sceneNumber = sceneNum; break; case OBJECT_HELMET: - _globals->_inventory._helmet._sceneNumber = sceneNum; + RING_INVENTORY._helmet._sceneNumber = sceneNum; break; case OBJECT_ITEMS: - _globals->_inventory._items._sceneNumber = sceneNum; + RING_INVENTORY._items._sceneNumber = sceneNum; break; case OBJECT_CONCENTRATOR: - _globals->_inventory._concentrator._sceneNumber = sceneNum; + RING_INVENTORY._concentrator._sceneNumber = sceneNum; break; case OBJECT_NULLIFIER: - _globals->_inventory._nullifier._sceneNumber = sceneNum; + RING_INVENTORY._nullifier._sceneNumber = sceneNum; break; case OBJECT_PEG: - _globals->_inventory._peg._sceneNumber = sceneNum; + RING_INVENTORY._peg._sceneNumber = sceneNum; break; case OBJECT_VIAL: - _globals->_inventory._vial._sceneNumber = sceneNum; + RING_INVENTORY._vial._sceneNumber = sceneNum; break; case OBJECT_JACKET: - _globals->_inventory._jacket._sceneNumber = sceneNum; + RING_INVENTORY._jacket._sceneNumber = sceneNum; break; case OBJECT_TUNIC2: - _globals->_inventory._tunic2._sceneNumber = sceneNum; + RING_INVENTORY._tunic2._sceneNumber = sceneNum; break; case OBJECT_BONE: - _globals->_inventory._bone._sceneNumber = sceneNum; + RING_INVENTORY._bone._sceneNumber = sceneNum; break; case OBJECT_EMPTY_JAR: - _globals->_inventory._emptyJar._sceneNumber = sceneNum; + RING_INVENTORY._emptyJar._sceneNumber = sceneNum; break; case OBJECT_JAR: - _globals->_inventory._jar._sceneNumber = sceneNum; + RING_INVENTORY._jar._sceneNumber = sceneNum; break; default: DebugPrintf("Invlid object Id %s\n", argv[1]); @@ -385,7 +385,7 @@ bool Debugger::Cmd_MoveObject(int argc, const char **argv) { * Give a specified item to the player */ bool Debugger::Cmd_Item(int argc, const char **argv) { - _globals->_inventory._infoDisk._sceneNumber = 1; + RING_INVENTORY._infoDisk._sceneNumber = 1; return true; } diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp index 371166d782..5d34037b7b 100644 --- a/engines/tsage/detection.cpp +++ b/engines/tsage/detection.cpp @@ -54,6 +54,10 @@ uint32 TSageEngine::getFeatures() const { return _gameDescription->features; } +Common::String TSageEngine::getPrimaryFilename() const { + return Common::String(_gameDescription->desc.filesDescriptions[0].fileName); +} + } // End of namespace tSage static const PlainGameDescriptor tSageGameTitles[] = { diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h index f932c62367..df3814dd73 100644 --- a/engines/tsage/detection_tables.h +++ b/engines/tsage/detection_tables.h @@ -69,6 +69,34 @@ static const tSageGameDescription gameDescriptions[] = { GType_Ringworld, GF_FLOPPY }, + // Ringworld English Floppy Demo version + { + { + "ring", + "Floppy Demo", + AD_ENTRY1s("demoring.rlb", "9ecf48e088a0d475778fab480b3dbdd0", 832206), + Common::EN_ANY, + Common::kPlatformPC, + ADGF_DEMO, + Common::GUIO_NONE + }, + GType_Ringworld, + GF_FLOPPY | GF_DEMO + }, + // Ringworld English Floppy Demo Alt version + { + { + "ring", + "Floppy Demo", + AD_ENTRY1s("tsage.rlb", "bf4e8525d0cab84b08b57126092eeacd", 833453), + Common::EN_ANY, + Common::kPlatformPC, + ADGF_DEMO, + Common::GUIO_NONE + }, + GType_Ringworld, + GF_FLOPPY | GF_DEMO + }, // Blue Force { diff --git a/engines/tsage/dialogs.cpp b/engines/tsage/dialogs.cpp index 688f266133..ba3a11f619 100644 --- a/engines/tsage/dialogs.cpp +++ b/engines/tsage/dialogs.cpp @@ -31,6 +31,7 @@ #include "tsage/core.h" #include "tsage/staticres.h" #include "tsage/globals.h" +#include "tsage/ringworld_logic.h" namespace tSage { @@ -139,7 +140,7 @@ void RightClickButton::highlight() { _savedButton = Surface_getArea(_globals->gfxManager().getSurface(), _bounds); uint size; - byte *imgData = _vm->_dataManager->getSubResource(7, 2, _buttonIndex, &size); + byte *imgData = _resourceManager->getSubResource(7, 2, _buttonIndex, &size); GfxSurface btnSelected = surfaceFromRes(imgData); _globals->gfxManager().copyFrom(btnSelected, _bounds.left, _bounds.top); @@ -383,7 +384,7 @@ void InventoryDialog::show() { // Determine how many items are in the player's inventory int itemCount = 0; SynchronisedList<InvObject *>::iterator i; - for (i = _globals->_inventory._itemList.begin(); i != _globals->_inventory._itemList.end(); ++i) { + for (i = RING_INVENTORY._itemList.begin(); i != RING_INVENTORY._itemList.end(); ++i) { if ((*i)->inInventory()) ++itemCount; } @@ -404,7 +405,7 @@ InventoryDialog::InventoryDialog() { int imgWidth = 0, imgHeight = 0; SynchronisedList<InvObject *>::iterator i; - for (i = _globals->_inventory._itemList.begin(); i != _globals->_inventory._itemList.end(); ++i) { + for (i = RING_INVENTORY._itemList.begin(); i != RING_INVENTORY._itemList.end(); ++i) { InvObject *invObject = *i; if (invObject->inInventory()) { // Get the image for the item @@ -459,8 +460,8 @@ InventoryDialog::InventoryDialog() { } void InventoryDialog::execute() { - if ((_globals->_inventory._selectedItem) && _globals->_inventory._selectedItem->inInventory()) - _globals->_inventory._selectedItem->setCursor(); + if ((RING_INVENTORY._selectedItem) && RING_INVENTORY._selectedItem->inInventory()) + RING_INVENTORY._selectedItem->setCursor(); GfxElement *hiliteObj; bool lookFlag = false; @@ -519,7 +520,7 @@ void InventoryDialog::execute() { if (lookFlag) { _globals->_screenSurface.displayText(invObject->_description); } else { - _globals->_inventory._selectedItem = invObject; + RING_INVENTORY._selectedItem = invObject; invObject->setCursor(); } } @@ -543,15 +544,15 @@ void OptionsDialog::show() { } } else if (btn == &dlg->_btnRestart) { // Restart game - _globals->_game.restartGame(); + _globals->_game->restartGame(); } else if (btn == &dlg->_btnSound) { // Sound dialog } else if (btn == &dlg->_btnSave) { // Save button - _globals->_game.saveGame(); + _globals->_game->saveGame(); } else if (btn == &dlg->_btnRestore) { // Restore button - _globals->_game.restoreGame(); + _globals->_game->restoreGame(); } dlg->remove(); diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index 83cafcaac5..a92cbb9df9 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -159,25 +159,25 @@ void EventsClass::setCursor(CursorType cursorType) { switch (cursorType) { case CURSOR_CROSSHAIRS: // Crosshairs cursor - cursor = _vm->_dataManager->getSubResource(4, 1, 6, &size); + cursor = _resourceManager->getSubResource(4, 1, 6, &size); _globals->setFlag(122); break; case CURSOR_LOOK: // Look cursor - cursor = _vm->_dataManager->getSubResource(4, 1, 5, &size); + cursor = _resourceManager->getSubResource(4, 1, 5, &size); _currentCursor = CURSOR_LOOK; break; case CURSOR_USE: // Use cursor - cursor = _vm->_dataManager->getSubResource(4, 1, 4, &size); + cursor = _resourceManager->getSubResource(4, 1, 4, &size); _currentCursor = CURSOR_USE; break; case CURSOR_TALK: // Talk cursor - cursor = _vm->_dataManager->getSubResource(4, 1, 3, &size); + cursor = _resourceManager->getSubResource(4, 1, 3, &size); _currentCursor = CURSOR_TALK; break; diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 7f41ab0978..00444f3672 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -24,10 +24,13 @@ */ #include "tsage/globals.h" +#include "tsage/tsage.h" +#include "tsage/ringworld_logic.h" namespace tSage { Globals *_globals = NULL; +ResourceManager *_resourceManager = NULL; /*--------------------------------------------------------------------------*/ @@ -51,7 +54,7 @@ Globals::Globals() : _gfxManagerInstance(_screenSurface) { reset(); _stripNum = 0; - _gfxFontNumber = 50; + _gfxFontNumber = (_vm->getFeatures() & GF_DEMO) ? 0 : 50; _gfxColors.background = 53; _gfxColors.foreground = 18; _fontColors.background = 51; @@ -66,6 +69,16 @@ Globals::Globals() : _prevSceneOffset = Common::Point(-1, -1); _sceneListeners.push_back(&_soundHandler); _sceneListeners.push_back(&_sequenceManager._soundHandler); + + _scrollFollower = NULL; + _inventory = NULL; + + if (!(_vm->getFeatures() & GF_DEMO)) { + _inventory = new RingworldInvObjectList(); + _game = new RingworldGame(); + } else { + _game = new RingworldDemoGame(); + } } Globals::~Globals() { diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 6fe8e6295a..9e9ddd58d7 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -41,7 +41,7 @@ public: GfxManager _gfxManagerInstance; Common::List<GfxManager *> _gfxManagers; SceneHandler _sceneHandler; - Game _game; + Game *_game; EventsClass _events; SceneManager _sceneManager; ScenePalette _scenePalette; @@ -61,7 +61,7 @@ public: bool _flags[256]; Player _player; SoundHandler _soundHandler; - InvObjectList _inventory; + InvObjectList *_inventory; Region _paneRegions[2]; int _paneRefreshFlag[2]; Common::Point _sceneOffset; @@ -95,6 +95,10 @@ public: extern Globals *_globals; +// Note: Currently this can't be part of the _globals structure, since it needs to be constructed +// prior to many of the fields in Globals execute their constructors +extern ResourceManager *_resourceManager; + } // End of namespace tSage #endif diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 77316d2d7d..f9f9e4b4ca 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -122,7 +122,7 @@ GfxSurface surfaceFromRes(const byte *imgData) { GfxSurface surfaceFromRes(int resNum, int rlbNum, int subNum) { uint size; - byte *imgData = _vm->_dataManager->getSubResource(resNum, rlbNum, subNum, &size); + byte *imgData = _resourceManager->getSubResource(resNum, rlbNum, subNum, &size); GfxSurface surface = surfaceFromRes(imgData); DEALLOCATE(imgData); @@ -390,7 +390,7 @@ void GfxSurface::loadScreenSection(Graphics::Surface &dest, int xHalf, int yHalf if (xSection < xHalfCount && ySection < yHalfCount) { int rlbNum = xSection * yHalfCount + ySection; - byte *data = _vm->_dataManager->getResource(RES_BITMAP, screenNum, rlbNum); + byte *data = _resourceManager->getResource(RES_BITMAP, screenNum, rlbNum); for (int y = 0; y < updateRect.height(); ++y) { byte *pSrc = data + y * 160; @@ -713,7 +713,7 @@ void GfxImage::setDefaults() { // Decode the image uint size; - byte *imgData = _vm->_dataManager->getSubResource(_resNum, _rlbNum, _cursorNum, &size); + byte *imgData = _resourceManager->getSubResource(_resNum, _rlbNum, _cursorNum, &size); _surface = surfaceFromRes(imgData); DEALLOCATE(imgData); @@ -1074,7 +1074,7 @@ void GfxManager::setDialogPalette() { // Get the main palette information byte palData[256 * 3]; uint count, start; - _vm->_dataManager->getPalette(0, &palData[0], &start, &count); + _resourceManager->getPalette(0, &palData[0], &start, &count); g_system->getPaletteManager()->setPalette(&palData[0], start, count); // Miscellaneous @@ -1109,7 +1109,7 @@ int GfxManager::getAngle(const Common::Point &p1, const Common::Point &p2) { GfxFont::GfxFont() { - _fontNumber = 50; + _fontNumber = (_vm->getFeatures() & GF_DEMO) ? 0 : 50; _numChars = 0; _bpp = 0; _fontData = NULL; @@ -1133,9 +1133,9 @@ void GfxFont::setFontNumber(uint32 fontNumber) { _fontNumber = fontNumber; - _fontData = _vm->_tSageManager->getResource(RES_FONT, _fontNumber, 0, true); + _fontData = _resourceManager->getResource(RES_FONT, _fontNumber, 0, true); if (!_fontData) - _fontData = _vm->_dataManager->getResource(RES_FONT, _fontNumber, 0); + _fontData = _resourceManager->getResource(RES_FONT, _fontNumber, 0); _numChars = READ_LE_UINT16(_fontData + 4); _fontSize.y = READ_LE_UINT16(_fontData + 6); diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk index 41a868195b..2f9194a9ba 100644 --- a/engines/tsage/module.mk +++ b/engines/tsage/module.mk @@ -10,6 +10,7 @@ MODULE_OBJS := \ globals.o \ graphics.o \ resources.o \ + ringworld_demo.o \ ringworld_logic.o \ ringworld_scenes1.o \ ringworld_scenes2.o \ diff --git a/engines/tsage/resources.cpp b/engines/tsage/resources.cpp index 21397f238a..5320a573b2 100644 --- a/engines/tsage/resources.cpp +++ b/engines/tsage/resources.cpp @@ -29,6 +29,7 @@ #include "common/stack.h" #include "common/util.h" #include "tsage/resources.h" +#include "tsage/tsage.h" namespace tSage { @@ -134,7 +135,7 @@ uint16 BitReader::readToken() { /*-------------------------------------------------------------------------*/ -RlbManager::RlbManager(MemoryManager &memManager, const Common::String filename) : +TLib::TLib(MemoryManager &memManager, const Common::String &filename) : _memoryManager(memManager) { // If the resource strings list isn't yet loaded, load them @@ -154,11 +155,11 @@ RlbManager::RlbManager(MemoryManager &memManager, const Common::String filename) loadIndex(); } -RlbManager::~RlbManager() { +TLib::~TLib() { _resStrings.clear(); } -void RlbManager::loadSection(uint32 fileOffset) { +void TLib::loadSection(uint32 fileOffset) { _resources.clear(); _file.seek(fileOffset); _sections.fileOffset = fileOffset; @@ -197,7 +198,7 @@ struct DecodeReference { /** * Gets a resource from the currently loaded section */ -byte *RlbManager::getResource(uint16 id, bool suppressErrors) { +byte *TLib::getResource(uint16 id, bool suppressErrors) { // Scan for an entry for the given Id ResourceEntry *re= NULL; ResourceList::iterator i; @@ -307,7 +308,7 @@ byte *RlbManager::getResource(uint16 id, bool suppressErrors) { /** * Finds the correct section and loads the specified resource within it */ -byte *RlbManager::getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors) { +byte *TLib::getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors) { SectionList::iterator i = _sections.begin(); while ((i != _sections.end()) && ((*i).resType != resType || (*i).resNum != resNum)) ++i; @@ -322,7 +323,7 @@ byte *RlbManager::getResource(ResourceType resType, uint16 resNum, uint16 rlbNum return getResource(rlbNum, suppressErrors); } -void RlbManager::loadIndex() { +void TLib::loadIndex() { uint16 resNum, configId, fileOffset; // Load the root resources section @@ -356,10 +357,11 @@ void RlbManager::loadIndex() { * * @paletteNum Specefies the palette number */ -void RlbManager::getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries) { +bool TLib::getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries) { // Get the specified palette - byte *dataIn = getResource(RES_PALETTE, 0, paletteNum); - assert(dataIn); + byte *dataIn = getResource(RES_PALETTE, 0, paletteNum, true); + if (!dataIn) + return false; *startNum = READ_LE_UINT16(dataIn); *numEntries = READ_LE_UINT16(dataIn + 2); @@ -369,12 +371,18 @@ void RlbManager::getPalette(int paletteNum, byte *palData, uint *startNum, uint Common::copy(&dataIn[6], &dataIn[6 + *numEntries * 3], palData); _memoryManager.deallocate(dataIn); + return true; } -byte *RlbManager::getSubResource(int resNum, int rlbNum, int index, uint *size) { +byte *TLib::getSubResource(int resNum, int rlbNum, int index, uint *size, bool suppressErrors) { // Get the specified image set byte *dataIn = getResource(RES_VISAGE, resNum, rlbNum); - assert(dataIn); + if (!dataIn) { + if (suppressErrors) + return NULL; + + error("Unknown sub resource %d/%d index %d", resNum, rlbNum, index); + } int numEntries = READ_LE_UINT16(dataIn); uint32 entryOffset = READ_LE_UINT32(dataIn + 2 + (index - 1) * 4); @@ -393,9 +401,14 @@ byte *RlbManager::getSubResource(int resNum, int rlbNum, int index, uint *size) /** * Retrieves a given message resource, and returns the specified message number */ -Common::String RlbManager::getMessage(int resNum, int lineNum) { +Common::String TLib::getMessage(int resNum, int lineNum, bool suppressErrors) { byte *msgData = getResource(RES_MESSAGE, resNum, 0); - assert(msgData); + if (!msgData) { + if (suppressErrors) + return Common::String(); + + error("Unknown message %d line %d", resNum, lineNum); + } const char *srcP = (const char *)msgData; while (lineNum-- > 0) @@ -406,4 +419,81 @@ Common::String RlbManager::getMessage(int resNum, int lineNum) { return result; } +/*--------------------------------------------------------------------------*/ + +ResourceManager::~ResourceManager() { + for (uint idx = 0; idx < _libList.size(); ++idx) + delete _libList[idx]; +} + +void ResourceManager::addLib(const Common::String &libName) { + assert(_libList.size() < 5); + + _libList.push_back(new TLib(_vm->_memoryManager, libName)); +} + +byte *ResourceManager::getResource(uint16 id, bool suppressErrors) { + byte *result = NULL; + for (uint idx = 0; idx < _libList.size(); ++idx) { + result = _libList[idx]->getResource(id, true); + if (result) + return result; + } + + if (!result && !suppressErrors) + error("Could not find resource Id #%d", id); + return NULL; +} + +byte *ResourceManager::getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors) { + byte *result = NULL; + for (uint idx = 0; idx < _libList.size(); ++idx) { + result = _libList[idx]->getResource(resType, resNum, rlbNum, true); + if (result) + return result; + } + + if (!result && !suppressErrors) + error("Unknown resource type %d num %d", resType, resNum); + return NULL; +} + +void ResourceManager::getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries, bool suppressErrors) { + for (uint idx = 0; idx < _libList.size(); ++idx) { + if (_libList[idx]->getPalette(paletteNum, palData, startNum, numEntries)) + return; + } + + if (!suppressErrors) + error("Unknown palette resource %d", paletteNum); + *numEntries = 0; +} + +byte *ResourceManager::getSubResource(int resNum, int rlbNum, int index, uint *size, bool suppressErrors) { + byte *result = NULL; + for (uint idx = 0; idx < _libList.size(); ++idx) { + result = _libList[idx]->getSubResource(resNum, rlbNum, index, size, true); + if (result) + return result; + } + + if (!result && !suppressErrors) + error("Unknown resource %d/%d index %d", resNum, rlbNum, index); + return NULL; +} + +Common::String ResourceManager::getMessage(int resNum, int lineNum, bool suppressErrors) { + Common::String result; + + for (uint idx = 0; idx < _libList.size(); ++idx) { + result = _libList[idx]->getMessage(resNum, lineNum, true); + if (!result.empty()) + return result; + } + + if (!suppressErrors) + error("Unknown message %d line %d", resNum, lineNum); + return result; +} + } // end of namespace tSage diff --git a/engines/tsage/resources.h b/engines/tsage/resources.h index 2cf5069d36..b33cc37266 100644 --- a/engines/tsage/resources.h +++ b/engines/tsage/resources.h @@ -27,6 +27,7 @@ #define RING_RESOURCES_H #include "common/scummsys.h" +#include "common/array.h" #include "common/file.h" #include "common/list.h" #include "common/str.h" @@ -138,7 +139,7 @@ public: int numBits; }; -class RlbManager { +class TLib { private: Common::StringArray _resStrings; MemoryManager &_memoryManager; @@ -150,14 +151,29 @@ private: void loadSection(uint32 fileOffset); void loadIndex(); public: - RlbManager(MemoryManager &memManager, const Common::String filename); - ~RlbManager(); + TLib(MemoryManager &memManager, const Common::String &filename); + ~TLib(); byte *getResource(uint16 id, bool suppressErrors = false); byte *getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors = false); - void getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries); - byte *getSubResource(int resNum, int rlbNum, int index, uint *size); - Common::String getMessage(int resNum, int lineNum); + bool getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries); + byte *getSubResource(int resNum, int rlbNum, int index, uint *size, bool suppressErrors = false); + Common::String getMessage(int resNum, int lineNum, bool suppressErrors = false); +}; + +class ResourceManager { +private: + Common::Array<TLib *> _libList; +public: + ~ResourceManager(); + + void addLib(const Common::String &libName); + + byte *getResource(uint16 id, bool suppressErrors = false); + byte *getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors = false); + void getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries, bool suppressErrors = false); + byte *getSubResource(int resNum, int rlbNum, int index, uint *size, bool suppressErrors = false); + Common::String getMessage(int resNum, int lineNum, bool suppressErrors = false); }; diff --git a/engines/tsage/ringworld_demo.cpp b/engines/tsage/ringworld_demo.cpp new file mode 100644 index 0000000000..29438c0347 --- /dev/null +++ b/engines/tsage/ringworld_demo.cpp @@ -0,0 +1,58 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#include "tsage/ringworld_demo.h" +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/staticres.h" + +namespace tSage { + +/*-------------------------------------------------------------------------- + * Ringworld Demo scene + * + *--------------------------------------------------------------------------*/ + +void RingworldDemoScene::postInit(SceneObjectList *OwnerList) { + signal(); +} + +void RingworldDemoScene::signal() { + _soundHandler.startSound(4); + _actor1.postInit(); + _actor2.postInit(); + _actor3.postInit(); + _actor4.postInit(); + _actor5.postInit(); + _actor6.postInit(); + + setAction(&_sequenceManager, this, 22, &_actor1, &_actor2, &_actor3, &_actor4, &_actor5, &_actor6, NULL); +} + +void RingworldDemoScene::process(Event &event) { + +} + +} // End of namespace tSage diff --git a/engines/tsage/ringworld_demo.h b/engines/tsage/ringworld_demo.h new file mode 100644 index 0000000000..63ffe56555 --- /dev/null +++ b/engines/tsage/ringworld_demo.h @@ -0,0 +1,52 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#ifndef TSAGE_RINGWORLD_DEMO_H +#define TSAGE_RINGWORLD_DEMO_H + +#include "common/scummsys.h" +#include "tsage/events.h" +#include "tsage/core.h" +#include "tsage/scenes.h" +#include "tsage/globals.h" + +namespace tSage { + + +class RingworldDemoScene: public Scene { +public: + SequenceManager _sequenceManager; + SceneObject _actor1, _actor2, _actor3; + SceneObject _actor4, _actor5, _actor6; + SoundHandler _soundHandler; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void process(Event &event); + virtual void signal(); +}; + +} // End of namespace tSage + +#endif diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp index 6c3a40af48..0a2220c690 100644 --- a/engines/tsage/ringworld_logic.cpp +++ b/engines/tsage/ringworld_logic.cpp @@ -23,10 +23,14 @@ * */ +#include "common/config-manager.h" +#include "common/translation.h" +#include "gui/saveload.h" #include "tsage/ringworld_logic.h" #include "tsage/scenes.h" #include "tsage/tsage.h" #include "tsage/staticres.h" +#include "tsage/ringworld_demo.h" #include "tsage/ringworld_scenes1.h" #include "tsage/ringworld_scenes2.h" #include "tsage/ringworld_scenes3.h" @@ -39,6 +43,9 @@ namespace tSage { Scene *SceneFactory::createScene(int sceneNumber) { + if (_vm->getFeatures() & GF_DEMO) + return new RingworldDemoScene(); + switch (sceneNumber) { /* Scene group 1 */ // Kziniti Palace (Introduction) @@ -1174,4 +1181,235 @@ void SpeakerBatR::setText(const Common::String &msg) { Speaker::setText(msg); } +/*--------------------------------------------------------------------------*/ + +RingworldInvObjectList::RingworldInvObjectList() : + _stunner(2280, 1, 2, OBJECT_STUNNER, "This is your stunner."), + _scanner(1, 1, 3, OBJECT_SCANNER, "A combination scanner comm unit."), + _stasisBox(5200, 1, 4, OBJECT_STASIS_BOX, "A stasis box."), + _infoDisk(40, 1, 1, OBJECT_INFODISK, "The infodisk you took from the assassin."), + _stasisNegator(0, 2, 2, OBJECT_STASIS_NEGATOR, "The stasis field negator."), + _keyDevice(4250, 1, 6, OBJECT_KEY_DEVICE, "A magnetic key device."), + _medkit(2280, 1, 7, OBJECT_MEDKIT, "Your medkit."), + _ladder(4100, 1, 8, OBJECT_LADDER, "The chief's ladder."), + _rope(4150, 1, 9, OBJECT_ROPE, "The chief's rope."), + _key(7700, 1, 11, OBJECT_KEY, "A key."), + _translator(7700, 1, 13, OBJECT_TRANSLATOR, "The dolphin translator box."), + _ale(2150, 1, 10, OBJECT_ALE, "A bottle of ale."), + _paper(7700, 1, 12, OBJECT_PAPER, "A slip of paper with the numbers 2,4, and 3 written on it."), + _waldos(0, 1, 14, OBJECT_WALDOS, "A pair of waldos from the ruined probe."), + _stasisBox2(8100, 1, 4, OBJECT_STASIS_BOX2, "A stasis box."), + _ring(8100, 2, 5, OBJECT_RING, "This is a signet ring sent to you by Louis Wu."), + _cloak(9850, 2, 6, OBJECT_CLOAK, "A fine silk cloak."), + _tunic(9450, 2, 7, OBJECT_TUNIC, "The patriarch's soiled tunic."), + _candle(9500, 2, 8, OBJECT_CANDLE, "A tallow candle."), + _straw(9400, 2, 9, OBJECT_STRAW, "Clean, dry straw."), + _scimitar(9850, 1, 18, OBJECT_SCIMITAR, "A scimitar from the Patriarch's closet."), + _sword(9850, 1, 17, OBJECT_SWORD, "A short sword from the Patriarch's closet."), + _helmet(9500, 2, 4, OBJECT_HELMET, "Some type of helmet."), + _items(4300, 2, 10, OBJECT_ITEMS, "Two interesting items from the Tnuctipun vessel."), + _concentrator(4300, 2, 11, OBJECT_CONCENTRATOR, "The Tnuctipun anti-matter concentrator contained in a stasis field."), + _nullifier(5200, 2, 12, OBJECT_NULLIFIER, "A purported neural wave nullifier."), + _peg(4045, 2, 16, OBJECT_PEG, "A peg with a symbol."), + _vial(5100, 2, 17, OBJECT_VIAL, "A vial of the bat creatures anti-pheromone drug."), + _jacket(9850, 3, 1, OBJECT_JACKET, "A natty padded jacket."), + _tunic2(9850, 3, 2, OBJECT_TUNIC2, "A very hairy tunic."), + _bone(5300, 3, 5, OBJECT_BONE, "A very sharp bone."), + _jar(7700, 3, 4, OBJECT_JAR, "An jar filled with a green substance."), + _emptyJar(7700, 3, 3, OBJECT_EMPTY_JAR, "An empty jar.") { + + // Add the items to the list + _itemList.push_back(&_stunner); + _itemList.push_back(&_scanner); + _itemList.push_back(&_stasisBox); + _itemList.push_back(&_infoDisk); + _itemList.push_back(&_stasisNegator); + _itemList.push_back(&_keyDevice); + _itemList.push_back(&_medkit); + _itemList.push_back(&_ladder); + _itemList.push_back(&_rope); + _itemList.push_back(&_key); + _itemList.push_back(&_translator); + _itemList.push_back(&_ale); + _itemList.push_back(&_paper); + _itemList.push_back(&_waldos); + _itemList.push_back(&_stasisBox2); + _itemList.push_back(&_ring); + _itemList.push_back(&_cloak); + _itemList.push_back(&_tunic); + _itemList.push_back(&_candle); + _itemList.push_back(&_straw); + _itemList.push_back(&_scimitar); + _itemList.push_back(&_sword); + _itemList.push_back(&_helmet); + _itemList.push_back(&_items); + _itemList.push_back(&_concentrator); + _itemList.push_back(&_nullifier); + _itemList.push_back(&_peg); + _itemList.push_back(&_vial); + _itemList.push_back(&_jacket); + _itemList.push_back(&_tunic2); + _itemList.push_back(&_bone); + _itemList.push_back(&_jar); + _itemList.push_back(&_emptyJar); + + _selectedItem = NULL; +} + +/*--------------------------------------------------------------------------*/ + +void RingworldGame::restartGame() { + if (MessageDialog::show(RESTART_MSG, CANCEL_BTN_STRING, RESTART_BTN_STRING) == 1) + _globals->_game->restart(); +} + +void RingworldGame::saveGame() { + if (_globals->getFlag(50)) + MessageDialog::show(SAVING_NOT_ALLOWED_MSG, OK_BTN_STRING); + else { + // Show the save dialog + handleSaveLoad(true, _globals->_sceneHandler._saveGameSlot, _globals->_sceneHandler._saveName); + } +} + +void RingworldGame::restoreGame() { + if (_globals->getFlag(50)) + MessageDialog::show(RESTORING_NOT_ALLOWED_MSG, OK_BTN_STRING); + else { + // Show the load dialog + handleSaveLoad(false, _globals->_sceneHandler._loadGameSlot, _globals->_sceneHandler._saveName); + } +} + +void RingworldGame::quitGame() { + if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1) + _vm->quitGame(); +} + +void RingworldGame::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) { + const EnginePlugin *plugin = 0; + EngineMan.findGame(_vm->getGameId(), &plugin); + GUI::SaveLoadChooser *dialog; + if (saveFlag) + dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save")); + else + dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load")); + + dialog->setSaveMode(saveFlag); + + saveSlot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); + saveName = dialog->getResultString(); + + delete dialog; +} + +void RingworldGame::start() { + // Set some default flags and cursor + _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; + + // Set the object's that will be in the player's inventory by default + RING_INVENTORY._stunner._sceneNumber = 1; + RING_INVENTORY._scanner._sceneNumber = 1; + RING_INVENTORY._ring._sceneNumber = 1; + + // Switch to the title screen + _globals->_sceneManager.setNewScene(1000); +} + +void RingworldGame::restart() { + _globals->_scenePalette.clearListeners(); + _globals->_soundHandler.proc3(); + + // Reset the flags + _globals->reset(); + _globals->setFlag(34); + + // Clear save/load slots + _globals->_sceneHandler._saveGameSlot = -1; + _globals->_sceneHandler._loadGameSlot = -1; + + _globals->_stripNum = 0; + _globals->_events.setCursor(CURSOR_WALK); + + // Reset item properties + RING_INVENTORY._stunner._sceneNumber = 1; + RING_INVENTORY._scanner._sceneNumber = 1; + RING_INVENTORY._stasisBox._sceneNumber = 5200; + RING_INVENTORY._infoDisk._sceneNumber = 40; + RING_INVENTORY._stasisNegator._sceneNumber = 0; + RING_INVENTORY._keyDevice._sceneNumber = 0; + RING_INVENTORY._medkit._sceneNumber = 2280; + RING_INVENTORY._ladder._sceneNumber = 4100; + RING_INVENTORY._rope._sceneNumber = 4150; + RING_INVENTORY._key._sceneNumber = 7700; + RING_INVENTORY._translator._sceneNumber = 2150; + RING_INVENTORY._paper._sceneNumber = 7700; + RING_INVENTORY._waldos._sceneNumber = 0; + RING_INVENTORY._ring._sceneNumber = 1; + RING_INVENTORY._stasisBox2._sceneNumber = 8100; + RING_INVENTORY._cloak._sceneNumber = 9850; + RING_INVENTORY._tunic._sceneNumber = 9450; + RING_INVENTORY._candle._sceneNumber = 9500; + RING_INVENTORY._straw._sceneNumber = 9400; + RING_INVENTORY._scimitar._sceneNumber = 9850; + RING_INVENTORY._sword._sceneNumber = 9850; + RING_INVENTORY._helmet._sceneNumber = 9500; + RING_INVENTORY._items._sceneNumber = 4300; + RING_INVENTORY._concentrator._sceneNumber = 4300; + RING_INVENTORY._nullifier._sceneNumber = 4300; + RING_INVENTORY._peg._sceneNumber = 4045; + RING_INVENTORY._vial._sceneNumber = 5100; + RING_INVENTORY._jacket._sceneNumber = 9850; + RING_INVENTORY._tunic2._sceneNumber = 9850; + RING_INVENTORY._bone._sceneNumber = 5300; + RING_INVENTORY._jar._sceneNumber = 7700; + RING_INVENTORY._emptyJar._sceneNumber = 7700; + RING_INVENTORY._selectedItem = NULL; + + // Change to the first game scene + _globals->_sceneManager.changeScene(30); +} + +void RingworldGame::endGame(int resNum, int lineNum) { + _globals->_events.setCursor(CURSOR_WALK); + Common::String msg = _resourceManager->getMessage(resNum, lineNum); + bool savesExist = _saver->savegamesExist(); + + if (!savesExist) { + // No savegames exist, so prompt the user to restart or quit + if (MessageDialog::show(msg, QUIT_BTN_STRING, RESTART_BTN_STRING) == 0) + _vm->quitGame(); + else + restart(); + } else { + // Savegames exist, so prompt for Restore/Restart + bool breakFlag; + do { + if (MessageDialog::show(msg, RESTART_BTN_STRING, RESTORE_BTN_STRING) == 0) { + breakFlag = true; + } else { + handleSaveLoad(false, _globals->_sceneHandler._loadGameSlot, _globals->_sceneHandler._saveName); + breakFlag = _globals->_sceneHandler._loadGameSlot > 0; + } + } while (!breakFlag); + } + + _globals->_events.setCursorFromFlag(); +} + +/*--------------------------------------------------------------------------*/ + +void RingworldDemoGame::start() { + // Start the demo's single scene + _globals->_sceneManager.changeScene(1); +} + +void RingworldDemoGame::restart() { +} + } // End of namespace tSage diff --git a/engines/tsage/ringworld_logic.h b/engines/tsage/ringworld_logic.h index 66c7bff912..eb395d59b8 100644 --- a/engines/tsage/ringworld_logic.h +++ b/engines/tsage/ringworld_logic.h @@ -397,6 +397,77 @@ public: virtual void setText(const Common::String &msg); }; +/*--------------------------------------------------------------------------*/ + +class RingworldInvObjectList : public InvObjectList { +public: + InvObject _stunner; + InvObject _scanner; + InvObject _stasisBox; + InvObject _infoDisk; + InvObject _stasisNegator; + InvObject _keyDevice; + InvObject _medkit; + InvObject _ladder; + InvObject _rope; + InvObject _key; + InvObject _translator; + InvObject _ale; + InvObject _paper; + InvObject _waldos; + InvObject _stasisBox2; + InvObject _ring; + InvObject _cloak; + InvObject _tunic; + InvObject _candle; + InvObject _straw; + InvObject _scimitar; + InvObject _sword; + InvObject _helmet; + InvObject _items; + InvObject _concentrator; + InvObject _nullifier; + InvObject _peg; + InvObject _vial; + InvObject _jacket; + InvObject _tunic2; + InvObject _bone; + InvObject _jar; + InvObject _emptyJar; +public: + RingworldInvObjectList(); + + virtual Common::String getClassName() { return "RingworldInvObjectList"; } +}; + +#define RING_INVENTORY (*((RingworldInvObjectList *)_globals->_inventory)) + +class RingworldGame: public Game { +protected: + virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName); +public: + virtual void start(); + virtual void restart(); + virtual void restartGame(); + virtual void saveGame(); + 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) {} +}; + + } // End of namespace tSage #endif diff --git a/engines/tsage/ringworld_scenes1.cpp b/engines/tsage/ringworld_scenes1.cpp index 506d8bd36d..6fd12ce040 100644 --- a/engines/tsage/ringworld_scenes1.cpp +++ b/engines/tsage/ringworld_scenes1.cpp @@ -512,7 +512,7 @@ void Scene20::Action4::signal() { scene->_sound.startSound(77, this, 127); break; case 8: - _globals->_game.endGame(20, 0); + _globals->_game->endGame(20, 0); break; default: break; @@ -844,7 +844,7 @@ void Scene30::KzinObject::doAction(int action) { display2(30, 11); break; case OBJECT_RING: - _globals->_inventory._ring._sceneNumber = 30; + RING_INVENTORY._ring._sceneNumber = 30; scene->setAction(&scene->_ringAction); break; case CURSOR_LOOK: @@ -1063,7 +1063,7 @@ void Scene40::Action1::signal() { _globals->_soundHandler.startSound(77, this); break; case 17: - _globals->_game.endGame(40, 20); + _globals->_game->endGame(40, 20); remove(); break; } @@ -1107,7 +1107,7 @@ void Scene40::Action2::signal() { scene->_assassin._frame = 1; scene->_assassin.animate(ANIM_MODE_5, this); scene->_soundHandler.startSound(29); - _globals->_inventory._infoDisk._sceneNumber = 40; + RING_INVENTORY._infoDisk._sceneNumber = 40; break; case 4: _globals->_player.animate(ANIM_MODE_6, this); @@ -1174,7 +1174,7 @@ void Scene40::Action3::signal() { case 2: scene->_assassin.setStrip(2); scene->_assassin.setFrame(1); - _globals->_inventory._infoDisk._sceneNumber = 1; + RING_INVENTORY._infoDisk._sceneNumber = 1; _globals->_player.animate(ANIM_MODE_6, this); break; case 3: @@ -1328,7 +1328,7 @@ void Scene40::Action8::signal() { _globals->_soundHandler.startSound(77, this); break; case 4: - _globals->_game.endGame(40, 45); + _globals->_game->endGame(40, 45); remove(); break; } @@ -1378,12 +1378,12 @@ void Scene40::Assassin::doAction(int action) { if (scene->_assassin._visage != 44) SceneItem::display2(40, 13); else - SceneItem::display2(40, (_globals->_inventory._infoDisk._sceneNumber == 1) ? 19 : 14); + SceneItem::display2(40, (RING_INVENTORY._infoDisk._sceneNumber == 1) ? 19 : 14); break; case CURSOR_USE: if (scene->_assassin._visage != 44) SceneItem::display2(40, 15); - else if (_globals->_inventory._infoDisk._sceneNumber == 1) + else if (RING_INVENTORY._infoDisk._sceneNumber == 1) SceneItem::display2(40, 19); else { _globals->_player.disableControl(); @@ -1534,7 +1534,7 @@ void Scene40::postInit(SceneObjectList *OwnerList) { _assassin.setPosition(Common::Point(230, 187)); _assassin.setAction(&_action8); - if (_globals->_inventory._infoDisk._sceneNumber == 40) { + if (RING_INVENTORY._infoDisk._sceneNumber == 40) { _assassin.setStrip(1); _assassin.setFrame(_assassin.getFrameCount()); } else { @@ -1952,7 +1952,7 @@ void Scene60::Action1::signal() { break; case 9: _globals->_player._uiEnabled = false; - _globals->_inventory._infoDisk._sceneNumber = 1; + RING_INVENTORY._infoDisk._sceneNumber = 1; if (_globals->_sceneObjects->contains(&scene->_message)) scene->_message.remove(); @@ -2226,7 +2226,7 @@ void Scene60::Item1::doAction(int action) { switch (action) { case OBJECT_INFODISK: - _globals->_inventory._infoDisk._sceneNumber = 60; + RING_INVENTORY._infoDisk._sceneNumber = 60; _globals->setFlag(!_globals->_stripNum ? 118 : 121); scene->_sceneMode = 0; scene->setAction(&scene->_action1); @@ -2235,7 +2235,7 @@ void Scene60::Item1::doAction(int action) { SceneItem::display2(60, 10); break; case CURSOR_USE: - if (_globals->_inventory._infoDisk._sceneNumber == 60) { + if (RING_INVENTORY._infoDisk._sceneNumber == 60) { if (_globals->getFlag(118) && !_globals->_stripNum) { _globals->clearFlag(118); scene->setAction(&scene->_action1); @@ -2248,7 +2248,7 @@ void Scene60::Item1::doAction(int action) { scene->_action1.setActionIndex(9); scene->_action1.setDelay(1); } - } else if (_globals->_inventory._infoDisk._sceneNumber == 1) { + } else if (RING_INVENTORY._infoDisk._sceneNumber == 1) { scene->_sceneMode = 0; setAction(&scene->_sequenceManager, scene, 62, NULL); } else { @@ -2674,7 +2674,7 @@ void Scene90::signal() { break; case 92: _globals->_scenePalette.clearListeners(); - _globals->_game.endGame(90, 6); + _globals->_game->endGame(90, 6); break; case 96: _globals->_player.enableControl(); diff --git a/engines/tsage/ringworld_scenes10.cpp b/engines/tsage/ringworld_scenes10.cpp index 5e0cabde6a..0035f104c9 100644 --- a/engines/tsage/ringworld_scenes10.cpp +++ b/engines/tsage/ringworld_scenes10.cpp @@ -429,7 +429,7 @@ void Scene9200::postInit(SceneObjectList *OwnerList) { switch (_globals->_sceneManager._previousScene) { case 9500: if (_globals->getFlag(85)) { - if (_globals->_inventory._helmet._sceneNumber == 1) { + if (RING_INVENTORY._helmet._sceneNumber == 1) { _globals->setFlag(86); _sceneState = 9210; setAction(&_sequenceManager, this, 9210, &_globals->_player, &_object2, &_object3, 0); @@ -438,7 +438,7 @@ void Scene9200::postInit(SceneObjectList *OwnerList) { setAction(&_sequenceManager, this, 9212, &_globals->_player, &_object2, &_object3, 0); } } else { - if (_globals->_inventory._helmet._sceneNumber == 1) { + if (RING_INVENTORY._helmet._sceneNumber == 1) { _sceneState = 9211; setAction(&_sequenceManager, this, 9211, &_globals->_player, &_object2, &_object3, 0); } else { @@ -711,7 +711,7 @@ Scene9400::Scene9400() { void Scene9400::SceneHotspot7::doAction(int action) { Scene9400 *scene = (Scene9400 *)_globals->_sceneManager._scene; - if ((action == CURSOR_USE) && (_globals->_inventory._straw._sceneNumber != 1)) { + if ((action == CURSOR_USE) && (RING_INVENTORY._straw._sceneNumber != 1)) { scene->_sceneState = 1; scene->setAction(&scene->_sequenceManager, scene, 9408, &_globals->_player, 0); } else { @@ -869,13 +869,13 @@ void Scene9450::Hotspot3::doAction(int action) { break; case CURSOR_USE: case CURSOR_TALK: - if (_globals->_inventory._tunic._sceneNumber == 9450) { + if (RING_INVENTORY._tunic._sceneNumber == 9450) { if (scene->_object2._action) scene->_object2._action->remove(); scene->_sceneMode = 9459; _globals->_player.disableControl(); setAction(&scene->_sequenceManager1, scene, 9459, &scene->_object2, &scene->_object1, &scene->_object3, &_globals->_player, 0); - } else if ((_globals->_inventory._cloak._sceneNumber != 1) && (_globals->_inventory._jacket._sceneNumber != 1) && (_globals->_inventory._tunic2._sceneNumber != 1)) { + } else if ((RING_INVENTORY._cloak._sceneNumber != 1) && (RING_INVENTORY._jacket._sceneNumber != 1) && (RING_INVENTORY._tunic2._sceneNumber != 1)) { SceneItem::display(9450, 38, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); } else { scene->_sceneMode = 9460; @@ -962,7 +962,7 @@ void Scene9450::postInit(SceneObjectList *OwnerList) { setAction(&_sequenceManager1, this, 9451, &_globals->_player, 0); if (_globals->getFlag(87)) { - if (_globals->_inventory._tunic._sceneNumber == 1) { + if (RING_INVENTORY._tunic._sceneNumber == 1) { _object2.signal(); } else { _object2.setPosition(Common::Point(184, 144), 0); @@ -977,7 +977,7 @@ void Scene9450::postInit(SceneObjectList *OwnerList) { _object3.setAction(&_sequenceManager2, 0, 9455, &_object2, &_object1, 0); } - if (_globals->_inventory._tunic._sceneNumber != 1) + if (RING_INVENTORY._tunic._sceneNumber != 1) _hotspot1.setup(123, 139, 138, 170, 9450, 37, -1); _hotspot2.setup(153, 102, 176, 141, 9450, 39, 40); @@ -1007,7 +1007,7 @@ void Scene9500::Hotspot1::doAction(int action) { if (action == OBJECT_SWORD) { scene->_sceneMode = 9510; _globals->setFlag(92); - _globals->_inventory._sword._sceneNumber = 9500; + RING_INVENTORY._sword._sceneNumber = 9500; _globals->_player.disableControl(); _globals->_sceneItems.remove(this); scene->_hotspot2.setup(87, 294, 104, 314, 9400, 17, -1); @@ -1033,7 +1033,7 @@ void Scene9500::Hotspot2::doAction(int action) { void Scene9500::Hotspot3::doAction(int action) { Scene9500 *scene = (Scene9500 *)_globals->_sceneManager._scene; - if ((action == CURSOR_USE) && (_globals->_inventory._candle._sceneNumber != 1)){ + if ((action == CURSOR_USE) && (RING_INVENTORY._candle._sceneNumber != 1)){ scene->_sceneMode = 9505; _globals->_player.disableControl(); _globals->_sceneItems.remove(this); @@ -1048,12 +1048,12 @@ void Scene9500::Hotspot4::doAction(int action) { if (action == OBJECT_CANDLE) { _globals->_player.disableControl(); - if (_globals->_inventory._straw._sceneNumber == 9500) { + if (RING_INVENTORY._straw._sceneNumber == 9500) { scene->_sceneMode = 9506; _globals->_sceneItems.remove(&scene->_hotspot5); _globals->_sceneItems.remove(this); scene->setAction(&scene->_sequenceManager, scene, 9506, &_globals->_player, &scene->_object3, 0); - _globals->_inventory._candle._sceneNumber = 9850; + RING_INVENTORY._candle._sceneNumber = 9850; } else { scene->_sceneMode = 9507; scene->setAction(&scene->_sequenceManager, scene, 9507, &_globals->_player, &scene->_object3, 0); @@ -1061,7 +1061,7 @@ void Scene9500::Hotspot4::doAction(int action) { } else if (action == OBJECT_STRAW) { scene->_sceneMode = 9512; _globals->_player.disableControl(); - _globals->_inventory._straw._sceneNumber = 9500; + RING_INVENTORY._straw._sceneNumber = 9500; scene->setAction(&scene->_sequenceManager, scene, 9512, &_globals->_player, &scene->_object3, 0); } else { NamedHotspot::doAction(action); @@ -1135,14 +1135,14 @@ void Scene9500::postInit(SceneObjectList *OwnerList) { _candle.setStrip(1); _candle.animate(ANIM_MODE_2); _candle.setPosition(Common::Point(30, 105), 0); - if (_globals->_inventory._candle._sceneNumber != 9500) + if (RING_INVENTORY._candle._sceneNumber != 9500) _candle.setStrip(2); _object3.postInit(0); _object3.hide(); _object3.setPriority2(150); _object3.setPosition(Common::Point(166, 133)); - if (_globals->_inventory._straw._sceneNumber == 9500) { + if (RING_INVENTORY._straw._sceneNumber == 9500) { _object3.show(); _object3.setVisage(5); _object3._strip = 2; @@ -1165,7 +1165,7 @@ void Scene9500::postInit(SceneObjectList *OwnerList) { _object2.setFrame(_object2.getFrameCount()); _object2.setPosition(Common::Point(303, 130)); _object2.setPriority2(132); - if (_globals->_inventory._helmet._sceneNumber == 1) { + if (RING_INVENTORY._helmet._sceneNumber == 1) { _hotspot2.setup(87, 294, 104, 314, 9400, 17, -1); } else { _object2.setStrip(2); @@ -1203,10 +1203,10 @@ void Scene9500::postInit(SceneObjectList *OwnerList) { if ((_globals->_sceneManager._previousScene == 9200) || (_globals->_sceneManager._previousScene != 9850)) { _sceneMode = 0; - if (_globals->_inventory._helmet._sceneNumber != 1) { + if (RING_INVENTORY._helmet._sceneNumber != 1) { setAction(&_sequenceManager, this, 9501, &_globals->_player, &_candle, 0); } else { - _globals->_inventory._helmet._sceneNumber = 9500; + RING_INVENTORY._helmet._sceneNumber = 9500; _hotspot2.setup(87, 294, 104, 314, 9400, 17, -1); setAction(&_sequenceManager, this, 9513, &_globals->_player, &_object2, 0); } @@ -1248,7 +1248,7 @@ void Scene9700::process(Event &event) { _globals->_sceneManager.changeScene(9200); } else if (_globals->_events._currentCursor == OBJECT_SCANNER) { event.handled = true; - if (_globals->_inventory._helmet._sceneNumber == 1) { + if (RING_INVENTORY._helmet._sceneNumber == 1) { _globals->_player.disableControl(); _sceneMode = 9704; setAction(&_sequenceManager, this, 9704, &_globals->_player, &_object1, 0); @@ -1332,7 +1332,7 @@ void Scene9850::Object6::doAction(int action) { if (action == CURSOR_LOOK) { SceneItem::display(9850, 27, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); } else if (action == CURSOR_USE) { - _globals->_inventory._scimitar._sceneNumber = 1; + RING_INVENTORY._scimitar._sceneNumber = 1; hide(); } else { SceneHotspot::doAction(action); @@ -1344,7 +1344,7 @@ void Scene9850::Object7::doAction(int action) { if (action == CURSOR_LOOK) { SceneItem::display(9850, 28, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); } else if (action == CURSOR_USE) { - _globals->_inventory._sword._sceneNumber = 1; + RING_INVENTORY._sword._sceneNumber = 1; hide(); } else { SceneHotspot::doAction(action); @@ -1357,18 +1357,18 @@ void Scene9850::Hotspot12::doAction(int action) { Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene; if (action == CURSOR_USE) { - if (_globals->_inventory._tunic2._sceneNumber != 1) { - _globals->_inventory._tunic2._sceneNumber = 1; + if (RING_INVENTORY._tunic2._sceneNumber != 1) { + RING_INVENTORY._tunic2._sceneNumber = 1; _globals->_player.disableControl(); scene->_sceneMode = 9858; setAction(&scene->_sequenceManager, scene, 9858, &_globals->_player, &scene->_objTunic2, 0); } else { - _globals->_inventory._tunic2._sceneNumber = 9850; + RING_INVENTORY._tunic2._sceneNumber = 9850; _globals->_player.disableControl(); scene->_sceneMode = 9861; setAction(&scene->_sequenceManager, scene, 9861, &_globals->_player, &scene->_objTunic2, 0); } - } else if ((action != CURSOR_LOOK) || (_globals->_inventory._tunic2._sceneNumber != 1)) { + } else if ((action != CURSOR_LOOK) || (RING_INVENTORY._tunic2._sceneNumber != 1)) { NamedHotspot::doAction(action); } else { SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); @@ -1379,18 +1379,18 @@ void Scene9850::Hotspot14::doAction(int action) { Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene; if (action == CURSOR_USE) { - if (_globals->_inventory._jacket._sceneNumber != 1) { - _globals->_inventory._jacket._sceneNumber = 1; + if (RING_INVENTORY._jacket._sceneNumber != 1) { + RING_INVENTORY._jacket._sceneNumber = 1; _globals->_player.disableControl(); scene->_sceneMode = 9857; setAction(&scene->_sequenceManager, scene, 9857, &_globals->_player, &scene->_objJacket, 0); } else { - _globals->_inventory._jacket._sceneNumber = 9850; + RING_INVENTORY._jacket._sceneNumber = 9850; _globals->_player.disableControl(); scene->_sceneMode = 9860; setAction(&scene->_sequenceManager, scene, 9860, &_globals->_player, &scene->_objJacket, 0); } - } else if ((action != CURSOR_LOOK) || (_globals->_inventory._jacket._sceneNumber != 1)) { + } else if ((action != CURSOR_LOOK) || (RING_INVENTORY._jacket._sceneNumber != 1)) { NamedHotspot::doAction(action); } else { SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); @@ -1401,18 +1401,18 @@ void Scene9850::Hotspot16::doAction(int action) { Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene; if (action == CURSOR_USE) { - if (_globals->_inventory._cloak._sceneNumber != 1) { - _globals->_inventory._cloak._sceneNumber = 1; + if (RING_INVENTORY._cloak._sceneNumber != 1) { + RING_INVENTORY._cloak._sceneNumber = 1; _globals->_player.disableControl(); scene->_sceneMode = 9862; setAction(&scene->_sequenceManager, scene, 9862, &_globals->_player, &scene->_objCloak, 0); } else { - _globals->_inventory._cloak._sceneNumber = 9850; + RING_INVENTORY._cloak._sceneNumber = 9850; _globals->_player.disableControl(); scene->_sceneMode = 9859; setAction(&scene->_sequenceManager, scene, 9859, &_globals->_player, &scene->_objCloak, 0); } - } else if ((action != CURSOR_LOOK) || (_globals->_inventory._cloak._sceneNumber != 1)) { + } else if ((action != CURSOR_LOOK) || (RING_INVENTORY._cloak._sceneNumber != 1)) { NamedHotspot::doAction(action); } else { SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); @@ -1462,9 +1462,9 @@ void Scene9850::Hotspot20::doAction(int action) { if (action == CURSOR_USE) { _globals->_player.disableControl(); if (scene->_objSword._state == 0) { - if (_globals->_inventory._scimitar._sceneNumber == 9850) + if (RING_INVENTORY._scimitar._sceneNumber == 9850) scene->_objScimitar.show(); - if (_globals->_inventory._sword._sceneNumber == 9850) + if (RING_INVENTORY._sword._sceneNumber == 9850) scene->_objSword.show(); scene->_sceneMode = 11; setAction(&scene->_sequenceManager, scene, 9853, &_globals->_player, &scene->_objDoor, &scene->_objLever, 0); @@ -1482,9 +1482,9 @@ void Scene9850::signal() { switch (_sceneMode ++) { case 10: // Hidden closet closed - if (_globals->_inventory._scimitar._sceneNumber == 9850) + if (RING_INVENTORY._scimitar._sceneNumber == 9850) _objScimitar.hide(); - if (_globals->_inventory._sword._sceneNumber == 9850) + if (RING_INVENTORY._sword._sceneNumber == 9850) _objSword.hide(); _globals->_sceneItems.remove(&_objScimitar); _globals->_sceneItems.remove(&_objSword); @@ -1493,9 +1493,9 @@ void Scene9850::signal() { break; case 11: // Hidden closet opened - if (_globals->_inventory._scimitar._sceneNumber == 9850) + if (RING_INVENTORY._scimitar._sceneNumber == 9850) _globals->_sceneItems.addItems(&_objScimitar, NULL); - if (_globals->_inventory._sword._sceneNumber == 9850) + if (RING_INVENTORY._sword._sceneNumber == 9850) _globals->_sceneItems.addItems(&_objSword, NULL); _globals->_sceneItems.remove(&_hotspot19); _globals->_player.enableControl(); @@ -1559,7 +1559,7 @@ void Scene9850::postInit(SceneObjectList *OwnerList) { _objCloak.setFrame(1); _objCloak.setPriority2(90); _objCloak.setPosition(Common::Point(157, 81), 0); - if (_globals->_inventory._cloak._sceneNumber != 9850) + if (RING_INVENTORY._cloak._sceneNumber != 9850) _objCloak.hide(); _objJacket.postInit(); @@ -1568,7 +1568,7 @@ void Scene9850::postInit(SceneObjectList *OwnerList) { _objJacket.setFrame(2); _objJacket.setPriority2(90); _objJacket.setPosition(Common::Point(201, 84)); - if (_globals->_inventory._jacket._sceneNumber != 9850) + if (RING_INVENTORY._jacket._sceneNumber != 9850) _objJacket.hide(); _objTunic2.postInit(); @@ -1577,10 +1577,10 @@ void Scene9850::postInit(SceneObjectList *OwnerList) { _objTunic2.setFrame(3); _objTunic2.setPriority2(90); _objTunic2.setPosition(Common::Point(295, 90)); - if (_globals->_inventory._tunic2._sceneNumber != 9850) + if (RING_INVENTORY._tunic2._sceneNumber != 9850) _objTunic2.hide(); - if (_globals->_inventory._scimitar._sceneNumber == 9850) { + if (RING_INVENTORY._scimitar._sceneNumber == 9850) { _objScimitar.postInit(); _objScimitar.setVisage(9850); _objScimitar.setStrip(2); @@ -1590,7 +1590,7 @@ void Scene9850::postInit(SceneObjectList *OwnerList) { _objScimitar.hide(); } - if (_globals->_inventory._sword._sceneNumber == 9850) { + if (RING_INVENTORY._sword._sceneNumber == 9850) { _objSword.postInit(); _objSword.setVisage(9850); _objSword.setStrip(3); @@ -1684,7 +1684,7 @@ void Scene9900::strAction2::signal() { _var3 = 0; // No break on purpose case 1: { - Common::String msg = _vm->_dataManager->getMessage(8030, _lineNum++); + Common::String msg = _resourceManager->getMessage(8030, _lineNum++); if (!msg.compareTo("LASTCREDIT")) { if (_var3 == 0) { // Not used? @@ -1721,7 +1721,7 @@ void Scene9900::strAction2::signal() { _txtArray2[_txtArray1Index]._fontNumber = 2; _txtArray2[_txtArray1Index]._color1 = 23; - msg = _vm->_dataManager->getMessage(8030, _lineNum++); + msg = _resourceManager->getMessage(8030, _lineNum++); _txtArray2[_txtArray1Index].setup(msg); _txtArray2[_txtArray1Index]._field7A = 20; _txtArray2[_txtArray1Index]._moveDiff.y = 2; @@ -1789,7 +1789,7 @@ void Scene9900::strAction3::signal() { _globals->_scenePalette.addFader(_palette2._palette, 256, 5, this); break; case 4: - _globals->_game.endGame(9900, 61); + _globals->_game->endGame(9900, 61); remove(); default: break; @@ -1842,7 +1842,7 @@ void Scene9900::signal() { break; case 162: warning("TBC: shutdown();"); - _globals->_game.quitGame(); + _globals->_game->quitGame(); break; case 9901: _globals->_player.disableControl(); @@ -1933,7 +1933,7 @@ void Scene9900::process(Event &event) { if (_sceneMode != 9906) { if ((event.eventType == EVENT_BUTTON_DOWN) && (_globals->_events.getCursor() == OBJECT_ITEMS)) { _object8._state = 1; - _globals->_inventory._items._sceneNumber = 9900; + RING_INVENTORY._items._sceneNumber = 9900; _globals->_events.setCursor(CURSOR_USE); } } @@ -1960,10 +1960,10 @@ void Scene9900::postInit(SceneObjectList *OwnerList) { _object8._state = 0; - _globals->_inventory._concentrator._sceneNumber = 9900; - _globals->_inventory._items._rlbNum = 3; - _globals->_inventory._items._cursorNum = 6; - _globals->_inventory._items._description = Common::String("One of the items from the stasis ship. The other is on the Lance's bridge."); + RING_INVENTORY._concentrator._sceneNumber = 9900; + RING_INVENTORY._items._rlbNum = 3; + RING_INVENTORY._items._cursorNum = 6; + RING_INVENTORY._items._description = Common::String("One of the items from the stasis ship. The other is on the Lance's bridge."); _stripManager.addSpeaker(&_speakerMR); _globals->_player.disableControl(); diff --git a/engines/tsage/ringworld_scenes3.cpp b/engines/tsage/ringworld_scenes3.cpp index 6205571f34..4ed2d98662 100644 --- a/engines/tsage/ringworld_scenes3.cpp +++ b/engines/tsage/ringworld_scenes3.cpp @@ -752,10 +752,10 @@ void Scene2100::Action8::signal() { } case 3: _globals->_player.checkAngle(&scene->_object3); - scene->_stripManager.start((_globals->_inventory._translator._sceneNumber == 1) ? 7720 : 7710, this); + scene->_stripManager.start((RING_INVENTORY._translator._sceneNumber == 1) ? 7720 : 7710, this); break; case 4: - if (_globals->_inventory._translator._sceneNumber != 1) + if (RING_INVENTORY._translator._sceneNumber != 1) _globals->_sceneManager.changeScene(7600); else { _globals->setFlag(24); @@ -1311,7 +1311,7 @@ void Scene2100::Action17::signal() { scene->_stripManager.start(7072, this); break; case 8: - _globals->_inventory._stasisNegator._sceneNumber = 1; + RING_INVENTORY._stasisNegator._sceneNumber = 1; _globals->_sceneManager.changeScene(9100); remove(); break; @@ -1814,14 +1814,14 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _object4.setPosition(Common::Point(160, 199)); _object4.hide(); - _globals->_inventory._stasisBox._sceneNumber = 0; + RING_INVENTORY._stasisBox._sceneNumber = 0; setAction(&_action9); break; case 7000: _globals->_soundHandler.startSound(160); _globals->_soundHandler.proc5(true); - if (_globals->_inventory._stasisBox2._sceneNumber == 1) { + if (RING_INVENTORY._stasisBox2._sceneNumber == 1) { _globals->_player.setPriority2(1); _globals->_player.setPosition(Common::Point(157, 56)); @@ -2318,7 +2318,7 @@ void Scene2150::Action2::signal() { break; case 3: _globals->_events.setCursor(CURSOR_WALK); - scene->_stripManager.start((_globals->_inventory._ale._sceneNumber == 2150) ? 2151 : 2152, this); + scene->_stripManager.start((RING_INVENTORY._ale._sceneNumber == 2150) ? 2151 : 2152, this); break; case 4: scene->_hotspot14.postInit(); @@ -2328,7 +2328,7 @@ void Scene2150::Action2::signal() { if (scene->_stripManager._field2E8 == 15) { scene->_hotspot14.setFrame(5); - _globals->_inventory._ale._sceneNumber = 1; + RING_INVENTORY._ale._sceneNumber = 1; } else { scene->_hotspot14.setFrame(scene->_stripManager._field2E8 - 5); } @@ -2948,7 +2948,7 @@ void Scene2200::postInit(SceneObjectList *OwnerList) { break; case 2310: default: - _globals->_inventory._infoDisk._sceneNumber = 1; + RING_INVENTORY._infoDisk._sceneNumber = 1; _hotspot3.postInit(); _hotspot3.setVisage(2215); @@ -3925,11 +3925,11 @@ void Scene2280::Action4::signal() { switch (_state) { case 1: scene->_hotspot18.remove(); - _globals->_inventory._scanner._sceneNumber = 1; + RING_INVENTORY._scanner._sceneNumber = 1; break; case 6: scene->_hotspot17.remove(); - _globals->_inventory._medkit._sceneNumber = 1; + RING_INVENTORY._medkit._sceneNumber = 1; break; case 50: scene->_hotspot17.postInit(); @@ -3941,7 +3941,7 @@ void Scene2280::Action4::signal() { scene->_hotspot17.changeZoom(100); scene->_hotspot17.setPriority2(1); - _globals->_inventory._medkit._sceneNumber = 2280; + RING_INVENTORY._medkit._sceneNumber = 2280; _globals->_sceneItems.push_front(&scene->_hotspot17); break; case 51: @@ -3954,7 +3954,7 @@ void Scene2280::Action4::signal() { scene->_hotspot18.changeZoom(100); scene->_hotspot18.setPriority2(1); - _globals->_inventory._scanner._sceneNumber = 2280; + RING_INVENTORY._scanner._sceneNumber = 2280; _globals->_sceneItems.push_front(&scene->_hotspot18); break; } @@ -4223,7 +4223,7 @@ void Scene2280::postInit(SceneObjectList *OwnerList) { _hotspot16.setPosition(Common::Point(208, 90)); _hotspot16.setPriority2(80); - if (_globals->_inventory._medkit._sceneNumber == 2280) { + if (RING_INVENTORY._medkit._sceneNumber == 2280) { _hotspot17.postInit(); _hotspot17.setVisage(2161); _hotspot17._strip = 2; @@ -4233,7 +4233,7 @@ void Scene2280::postInit(SceneObjectList *OwnerList) { _globals->_sceneItems.push_back(&_hotspot17); } - if (_globals->_inventory._scanner._sceneNumber == 2280) { + if (RING_INVENTORY._scanner._sceneNumber == 2280) { _hotspot18.postInit(); _hotspot18.setVisage(2161); _hotspot18._strip = 2; @@ -4422,7 +4422,7 @@ void Scene2300::Action1::signal() { _globals->_soundHandler.startSound(77, this); break; case 8: - _globals->_game.endGame(2300, 0); + _globals->_game->endGame(2300, 0); break; case 9: if (scene->_hotspot5._mover) @@ -4711,8 +4711,8 @@ void Scene2300::postInit(SceneObjectList *OwnerList) { _stripManager.addSpeaker(&_speakerQText); _stripManager.addSpeaker(&_speakerSText); - _globals->_inventory._stunner._sceneNumber = 1; - _globals->_inventory._infoDisk._sceneNumber = 1; + RING_INVENTORY._stunner._sceneNumber = 1; + RING_INVENTORY._infoDisk._sceneNumber = 1; _hotspot8.postInit(); _hotspot8.setVisage(2301); @@ -4874,7 +4874,7 @@ void Scene2310::postInit(SceneObjectList *OwnerList) { void Scene2310::signal() { switch (_sceneMode++) { case 0: { - Common::String fmtString = _vm->_dataManager->getMessage(2300, 22); + Common::String fmtString = _resourceManager->getMessage(2300, 22); Common::String msg = Common::String::format(fmtString.c_str(), _pageList[_pageIndex]._pageNumber); _sceneText._width = 280; @@ -4887,7 +4887,7 @@ void Scene2310::signal() { break; } case 1: { - Common::String msg = _vm->_dataManager->getMessage(2300, 23); + Common::String msg = _resourceManager->getMessage(2300, 23); _sceneText.setup(msg); _sceneText.setPriority2(255); _sceneText.setPosition(Common::Point(30, 170)); @@ -5333,7 +5333,7 @@ void Scene2320::Action5::signal() { _globals->_sceneManager.changeScene(7000); else if (_globals->getFlag(59)) _globals->_sceneManager.changeScene(5000); - else if (!_globals->getFlag(43) || (_globals->_inventory._ale._sceneNumber != 1)) + else if (!_globals->getFlag(43) || (RING_INVENTORY._ale._sceneNumber != 1)) setDelay(10); else { scene->_hotspot11.setAction(NULL); @@ -5477,7 +5477,7 @@ void Scene2320::Action7::signal() { break; case 12: _globals->_player.enableControl(); - _globals->_inventory._stasisBox._sceneNumber = 2320; + RING_INVENTORY._stasisBox._sceneNumber = 2320; break; } } @@ -5507,7 +5507,7 @@ void Scene2320::Action8::signal() { _globals->_player.enableControl(); break; case 5: - _globals->_inventory._stasisBox._sceneNumber = 2320; + RING_INVENTORY._stasisBox._sceneNumber = 2320; scene->_sceneMode = 2326; scene->_speakerGameText.setTextPos(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + 30, 10)); scene->setAction(&scene->_sequenceManager1, scene, 2326, &_globals->_player, &scene->_hotspot11, NULL); @@ -5622,12 +5622,12 @@ void Scene2320::Hotspot11::doAction(int action) { } else { scene->_sceneMode = 2329; - if (_globals->_inventory._ale._sceneNumber == 1) { + if (RING_INVENTORY._ale._sceneNumber == 1) { scene->setAction(&scene->_sequenceManager1, scene, 2329, NULL); } else if (!_globals->getFlag(110)) { _globals->setFlag(110); scene->setAction(&scene->_sequenceManager1, scene, 2330, NULL); - } else if (_globals->_inventory._peg._sceneNumber != 1) { + } else if (RING_INVENTORY._peg._sceneNumber != 1) { scene->setAction(&scene->_sequenceManager1, scene, 2331, NULL); } else if (!_state) { ++_state; @@ -5683,7 +5683,7 @@ void Scene2320::Hotspot14::doAction(int action) { scene->_hotspot8.hide(); _globals->_sceneItems.push_front(&scene->_hotspot8); - _globals->_inventory._waldos._sceneNumber = 2320; + RING_INVENTORY._waldos._sceneNumber = 2320; scene->_hotspot9.postInit(); scene->_hotspot9.setVisage(2345); @@ -5705,7 +5705,7 @@ void Scene2320::Hotspot14::doAction(int action) { SceneItem::display2(2320, 24); } else if (!_globals->getFlag(76)) { SceneItem::display2(2320, 28); - } else if (!_globals->_inventory._waldos._sceneNumber) { + } else if (!RING_INVENTORY._waldos._sceneNumber) { SceneItem::display2(2320, 27); } else { SceneItem::display2(2320, 29); @@ -5787,7 +5787,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { _hotspot12.animate(ANIM_MODE_8, 0, NULL); _hotspot12.setPosition(Common::Point(412, 46)); - if (_globals->_inventory._waldos._sceneNumber == 2320) { + if (RING_INVENTORY._waldos._sceneNumber == 2320) { _hotspot8.postInit(); _hotspot8.setVisage(2345); _hotspot8.setStrip(5); @@ -6022,13 +6022,13 @@ void Scene2320::signal() { break; case 2326: _globals->clearFlag(70); - _globals->_inventory._nullifier._sceneNumber = 1; + RING_INVENTORY._nullifier._sceneNumber = 1; _globals->_stripNum = 2321; _globals->_sceneManager.changeScene(2100); break; case 2336: _globals->setFlag(77); - _globals->_inventory._waldos._sceneNumber = 1; + RING_INVENTORY._waldos._sceneNumber = 1; _hotspot8.remove(); break; case 5000: diff --git a/engines/tsage/ringworld_scenes5.cpp b/engines/tsage/ringworld_scenes5.cpp index a72396c26c..910a35e492 100644 --- a/engines/tsage/ringworld_scenes5.cpp +++ b/engines/tsage/ringworld_scenes5.cpp @@ -52,7 +52,7 @@ void Scene4000::Action1::signal() { NpcMover *mover = new NpcMover(); scene->_hotspot5.addMover(mover, &pt, this); - _globals->_inventory._ale._sceneNumber = 0; + RING_INVENTORY._ale._sceneNumber = 0; _globals->clearFlag(42); _globals->clearFlag(36); _globals->clearFlag(43); @@ -222,7 +222,7 @@ void Scene4000::Action4::signal() { scene->_rope.setFrame(3); scene->_rope.setPosition(Common::Point(268, 44)); - _globals->_inventory._rope._sceneNumber = 4000; + RING_INVENTORY._rope._sceneNumber = 4000; _globals->_events.setCursor(CURSOR_USE); _globals->_player.animate(ANIM_MODE_6, this); break; @@ -292,7 +292,7 @@ void Scene4000::Action6::signal() { if (!_globals->getFlag(36)) ADD_PLAYER_MOVER_NULL(scene->_miranda, 280, 150); - _globals->_inventory._ale._sceneNumber = 4100; + RING_INVENTORY._ale._sceneNumber = 4100; break; case 5: _globals->_sceneManager.changeScene(4100); @@ -359,7 +359,7 @@ void Scene4000::Action8::signal() { _globals->_soundHandler.startSound(77, this); break; case 5: - _globals->_game.endGame(4000, 15); + _globals->_game->endGame(4000, 15); remove(); break; } @@ -552,7 +552,7 @@ void Scene4000::Hotspot8::doAction(int action) { SceneItem::display2(4000, 25); break; case CURSOR_TALK: - if (_globals->_inventory._peg._sceneNumber == 1) + if (RING_INVENTORY._peg._sceneNumber == 1) SceneItem::display2(4000, 34); else { switch (_ctr) { @@ -837,7 +837,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _smoke2.setPosition(Common::Point(299, 59)); _smoke2.animate(ANIM_MODE_2, NULL); - if (_globals->_inventory._ladder._sceneNumber != 4000) { + if (RING_INVENTORY._ladder._sceneNumber != 4000) { // if ladder is not in the scene, activate the hotspot on the wall _hotspot8.postInit(); _hotspot8.setVisage(4018); @@ -891,7 +891,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { case 2320: _globals->_soundHandler.startSound(155); - if (_globals->_inventory._ale._sceneNumber == 1) { + if (RING_INVENTORY._ale._sceneNumber == 1) { _guardRock.postInit(); _guardRock.setVisage(4001); _guardRock.animate(ANIM_MODE_1, NULL); @@ -934,7 +934,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { break; case 4025: - if (_globals->_inventory._ladder._sceneNumber == 4000) + if (RING_INVENTORY._ladder._sceneNumber == 4000) _hotspot8.remove(); _globals->_player.setPosition(Common::Point(260, 185)); @@ -989,7 +989,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { case 4045: _globals->_player.enableControl(); - if (_globals->_inventory._ladder._sceneNumber != 4000) { + if (RING_INVENTORY._ladder._sceneNumber != 4000) { _hotspot8.postInit(); _hotspot8.setVisage(4017); _hotspot8.animate(ANIM_MODE_1, NULL); @@ -1046,7 +1046,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_player.enableControl(); } - if (_globals->_inventory._ladder._sceneNumber != 4000) + if (RING_INVENTORY._ladder._sceneNumber != 4000) _hotspot8.remove(); break; @@ -1054,7 +1054,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_player.enableControl(); _globals->_player.setPosition(Common::Point(270, 155)); - if (_globals->getFlag(42) && (_globals->_inventory._ladder._sceneNumber != 4000)) { + if (_globals->getFlag(42) && (RING_INVENTORY._ladder._sceneNumber != 4000)) { _hotspot8.setVisage(4017); _hotspot8.animate(ANIM_MODE_1, NULL); _hotspot8.setPosition(Common::Point(244, 151)); @@ -1087,8 +1087,8 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _guardRock.setPosition(Common::Point(255, 153)); setAction(&_action11); - _globals->_inventory._ladder._sceneNumber = 4100; - _globals->_inventory._rope._sceneNumber = 4150; + RING_INVENTORY._ladder._sceneNumber = 4100; + RING_INVENTORY._rope._sceneNumber = 4150; _soundHandler1.startSound(156); @@ -1114,7 +1114,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { break; } - if (_globals->_inventory._ladder._sceneNumber == 4000) { + if (RING_INVENTORY._ladder._sceneNumber == 4000) { _ladder.postInit(); _ladder.setVisage(4000); _ladder.setStrip(5); @@ -1123,7 +1123,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_sceneItems.push_back(&_ladder); } - if (_globals->_inventory._rope._sceneNumber == 4000) { + if (RING_INVENTORY._rope._sceneNumber == 4000) { _rope.postInit(); _rope.setVisage(4000); _rope.setStrip(7); @@ -1149,7 +1149,7 @@ void Scene4000::signal() { setAction(&_sequenceManager1, this, 4014, &_globals->_player, &_hotspot5, NULL); break; case 4004: - _globals->_inventory._ladder._sceneNumber = 4000; + RING_INVENTORY._ladder._sceneNumber = 4000; // Deliberate fall-through case 4007: _globals->_player._uiEnabled = true; @@ -1226,7 +1226,7 @@ void Scene4000::dispatch() { } if (!_action) { - if ((_globals->_inventory._peg._sceneNumber == 1) && _globals->getFlag(34) && + if ((RING_INVENTORY._peg._sceneNumber == 1) && _globals->getFlag(34) && _globals->getFlag(37) && !_globals->getFlag(40)) { _globals->_player.disableControl(); _soundHandler1.startSound(177); @@ -1444,7 +1444,7 @@ void Scene4025::Hole::doAction(int action) { if (!scene->_pegPtr2) { _globals->_player.disableControl(); _globals->_events.setCursor(CURSOR_USE); - _globals->_inventory._peg._sceneNumber = 4025; + RING_INVENTORY._peg._sceneNumber = 4025; scene->_pegPtr = &scene->_peg5; scene->_holePtr = this; @@ -1627,8 +1627,8 @@ void Scene4025::process(Event &event) { Scene::process(event); if (_gfxButton.process(event)) { - if (_globals->_inventory._peg._sceneNumber == 4025) - _globals->_inventory._peg._sceneNumber = 1; + if (RING_INVENTORY._peg._sceneNumber == 4025) + RING_INVENTORY._peg._sceneNumber = 1; _globals->_sceneManager.changeScene(4000); } @@ -1805,7 +1805,7 @@ void Scene4045::Necklace::doAction(int action) { case CURSOR_USE: if (_globals->_player._position.y < 135) { SceneItem::display2(4045, 16); - _globals->_inventory._peg._sceneNumber = 1; + RING_INVENTORY._peg._sceneNumber = 1; _globals->_events.setCursor(CURSOR_WALK); remove(); } else { @@ -1884,7 +1884,7 @@ void Scene4045::postInit(SceneObjectList *OwnerList) { _olloFace.setPosition(Common::Point(177, 40)); - if (_globals->_inventory._peg._sceneNumber == 4045) { + if (RING_INVENTORY._peg._sceneNumber == 4045) { _necklace.postInit(); _necklace.setVisage(4045); _necklace.setStrip(2); @@ -1917,7 +1917,7 @@ void Scene4045::postInit(SceneObjectList *OwnerList) { _olloFace.setPosition(Common::Point(177, 40)); - if (_globals->_inventory._peg._sceneNumber == 4045) { + if (RING_INVENTORY._peg._sceneNumber == 4045) { _necklace.postInit(); _necklace.setVisage(4045); _necklace.setStrip(2); @@ -2451,15 +2451,15 @@ void Scene4100::Action5::signal() { ADD_PLAYER_MOVER(58, 151); break; case 1: - if (_globals->_inventory._ladder._sceneNumber == 4100) { - _globals->_inventory._ladder._sceneNumber = 1; + if (RING_INVENTORY._ladder._sceneNumber == 4100) { + RING_INVENTORY._ladder._sceneNumber = 1; scene->_ladder.remove(); } else { scene->_ladder.postInit(); scene->_ladder.setVisage(4101); scene->_ladder.setPosition(Common::Point(49, 144)); - _globals->_inventory._ladder._sceneNumber = 4100; + RING_INVENTORY._ladder._sceneNumber = 4100; _globals->_sceneItems.push_front(&scene->_ladder); } @@ -2506,7 +2506,7 @@ void Scene4100::Hotspot1::doAction(int action) { SceneItem::display2(4100, 22); break; case CURSOR_TALK: - if (_globals->_inventory._peg._sceneNumber == 1) { + if (RING_INVENTORY._peg._sceneNumber == 1) { _globals->_player.disableControl(); scene->_sceneMode = 4109; scene->setAction(&scene->_sequenceManager, scene, 4109, NULL); @@ -2670,7 +2670,7 @@ void Scene4100::postInit(SceneObjectList *OwnerList) { _globals->_sceneItems.push_back(&_miranda); } - if (_globals->_inventory._ladder._sceneNumber == 4100) { + if (RING_INVENTORY._ladder._sceneNumber == 4100) { _ladder.postInit(); _ladder.setVisage(4101); _ladder.setPosition(Common::Point(49, 144)); @@ -2710,7 +2710,7 @@ void Scene4100::postInit(SceneObjectList *OwnerList) { _globals->_player.setPosition(Common::Point(252, 139)); _globals->_player.setStrip(2); } else { - if ((_globals->_inventory._ale._sceneNumber == 4100) && !_globals->getFlag(42)) { + if ((RING_INVENTORY._ale._sceneNumber == 4100) && !_globals->getFlag(42)) { _globals->_player.disableControl(); setAction(&_action3); } @@ -2884,15 +2884,15 @@ void Scene4150::Action3::signal() { case 1: _globals->_player.checkAngle(&scene->_hotspot3); - if (_globals->_inventory._rope._sceneNumber == 1) { + if (RING_INVENTORY._rope._sceneNumber == 1) { scene->_hotspot3.postInit(); scene->_hotspot3.setVisage(4150); scene->_hotspot3.setPosition(Common::Point(175, 70)); - _globals->_inventory._rope._sceneNumber = 4150; + RING_INVENTORY._rope._sceneNumber = 4150; _globals->_sceneItems.push_front(&scene->_hotspot3); } else { - _globals->_inventory._rope._sceneNumber = 1; + RING_INVENTORY._rope._sceneNumber = 1; scene->_hotspot3.remove(); } @@ -3026,7 +3026,7 @@ void Scene4150::postInit(SceneObjectList *OwnerList) { _globals->setFlag(44); } - if (_globals->_inventory._rope._sceneNumber == 4150) { + if (RING_INVENTORY._rope._sceneNumber == 4150) { _hotspot3.postInit(); _hotspot3.setVisage(4150); _hotspot3.setPosition(Common::Point(175, 70)); @@ -3213,7 +3213,7 @@ void Scene4250::Action4::signal() { break; case 1: _globals->_player.addMover(NULL); - scene->_stripManager.start((_globals->_inventory._helmet._sceneNumber == 4250) ? 4259 : 4256, this); + scene->_stripManager.start((RING_INVENTORY._helmet._sceneNumber == 4250) ? 4259 : 4256, this); break; case 2: ADD_PLAYER_MOVER(_globals->_player._position.x + 5, _globals->_player._position.y); @@ -3262,7 +3262,7 @@ void Scene4250::Hotspot1::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 19 : 14); + SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 19 : 14); break; case CURSOR_TALK: _globals->_player.disableControl(); @@ -3270,7 +3270,7 @@ void Scene4250::Hotspot1::doAction(int action) { scene->setAction(&scene->_action3); } else { scene->_sceneMode = 4260; - if (_globals->_inventory._helmet._sceneNumber == 4250) { + if (RING_INVENTORY._helmet._sceneNumber == 4250) { scene->_sceneMode = 4265; scene->setAction(&scene->_sequenceManager, scene, 4265, this, NULL); } else { @@ -3280,13 +3280,13 @@ void Scene4250::Hotspot1::doAction(int action) { } break; case OBJECT_SCANNER: - if (_globals->_inventory._helmet._sceneNumber == 4250) + if (RING_INVENTORY._helmet._sceneNumber == 4250) SceneItem::display2(4250, 21); else SceneHotspot::doAction(action); break; case OBJECT_STUNNER: - if (_globals->_inventory._helmet._sceneNumber == 4250) + if (RING_INVENTORY._helmet._sceneNumber == 4250) SceneItem::display2(4250, 22); else SceneHotspot::doAction(action); @@ -3331,16 +3331,16 @@ void Scene4250::Hotspot4::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 18 : 5); + SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 18 : 5); break; case OBJECT_SCANNER: - if (_globals->_inventory._helmet._sceneNumber == 4250) + if (RING_INVENTORY._helmet._sceneNumber == 4250) SceneItem::display2(4250, 21); else SceneHotspot::doAction(action); break; case OBJECT_STUNNER: - if (_globals->_inventory._helmet._sceneNumber == 4250) + if (RING_INVENTORY._helmet._sceneNumber == 4250) SceneItem::display2(4250, 22); else SceneHotspot::doAction(action); @@ -3353,12 +3353,12 @@ void Scene4250::Hotspot4::doAction(int action) { } else { scene->_sceneMode = 4254; - if (_globals->_inventory._helmet._sceneNumber == 4250) { + if (RING_INVENTORY._helmet._sceneNumber == 4250) { scene->_sceneMode = 4266; scene->setAction(&scene->_sequenceManager, scene, 4266, this, NULL); } else { scene->setAction(&scene->_sequenceManager, scene, - (_globals->_inventory._concentrator._sceneNumber == 1) ? 4255 : 4254, NULL); + (RING_INVENTORY._concentrator._sceneNumber == 1) ? 4255 : 4254, NULL); } } break; @@ -3373,20 +3373,20 @@ void Scene4250::Hotspot6::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 7 : 6); + SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 7 : 6); break; case OBJECT_SCANNER: - SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 1 : 2); + SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 1 : 2); break; case OBJECT_STUNNER: - SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 20 : 3); + SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 20 : 3); break; case OBJECT_HELMET: _globals->_soundHandler.startSound(354); _globals->_player.disableControl(); - _globals->_inventory._helmet._sceneNumber = 4250; + RING_INVENTORY._helmet._sceneNumber = 4250; - if (_globals->_inventory._concentrator._sceneNumber == 1) { + if (RING_INVENTORY._concentrator._sceneNumber == 1) { if (_globals->getFlag(115)) { scene->_sceneMode = 4269; scene->setAction(&scene->_sequenceManager, scene, 4269, this, NULL); @@ -3395,10 +3395,10 @@ void Scene4250::Hotspot6::doAction(int action) { _globals->_events.setCursor(CURSOR_WALK); scene->setAction(&scene->_sequenceManager, scene, 4256, this, NULL); } - } else if (_globals->_inventory._keyDevice._sceneNumber == 1) { + } else if (RING_INVENTORY._keyDevice._sceneNumber == 1) { scene->_sceneMode = 4267; scene->setAction(&scene->_sequenceManager, scene, 4267, this, NULL); - } else if (_globals->_inventory._keyDevice._sceneNumber == 4300) { + } else if (RING_INVENTORY._keyDevice._sceneNumber == 4300) { scene->_sceneMode = 4268; scene->setAction(&scene->_sequenceManager, scene, 4268, this, NULL); } else { @@ -3409,10 +3409,10 @@ void Scene4250::Hotspot6::doAction(int action) { } break; case OBJECT_NULLIFIER: - if (_globals->_inventory._helmet._sceneNumber == 4250) { + if (RING_INVENTORY._helmet._sceneNumber == 4250) { _globals->_soundHandler.startSound(353); _globals->_player.disableControl(); - _globals->_inventory._helmet._sceneNumber = 1; + RING_INVENTORY._helmet._sceneNumber = 1; scene->_sceneMode = 4257; scene->setAction(&scene->_sequenceManager, scene, 4257, &_globals->_player, this, NULL); @@ -3421,7 +3421,7 @@ void Scene4250::Hotspot6::doAction(int action) { } break; case CURSOR_TALK: - if (_globals->_inventory._helmet._sceneNumber == 4250) + if (RING_INVENTORY._helmet._sceneNumber == 4250) doAction(OBJECT_HELMET); else { _globals->_player.disableControl(); @@ -3430,11 +3430,11 @@ void Scene4250::Hotspot6::doAction(int action) { } break; case CURSOR_USE: - if (_globals->_inventory._helmet._sceneNumber == 4250) + if (RING_INVENTORY._helmet._sceneNumber == 4250) doAction(OBJECT_HELMET); else { _globals->_player.disableControl(); - if ((_globals->_inventory._items._sceneNumber != 1) || (_globals->_inventory._concentrator._sceneNumber != 1)) { + if ((RING_INVENTORY._items._sceneNumber != 1) || (RING_INVENTORY._concentrator._sceneNumber != 1)) { scene->_sceneMode = 4258; scene->setAction(&scene->_sequenceManager, scene, 4258, this, NULL); } else { @@ -3473,7 +3473,7 @@ void Scene4250::Hotspot8::doAction(int action) { _globals->_player.disableControl(); scene->_sceneMode = 4270; scene->setAction(&scene->_sequenceManager, scene, - (_globals->_inventory._helmet._sceneNumber == 4250) ? 4270 : 4271, NULL); + (RING_INVENTORY._helmet._sceneNumber == 4250) ? 4270 : 4271, NULL); break; default: SceneHotspot::doAction(action); @@ -3555,7 +3555,7 @@ void Scene4250::postInit(tSage::SceneObjectList *OwnerList) { _hotspot6.setPriority2(70); _hotspot6.setPosition(Common::Point(261, 175)); - if (_globals->_inventory._helmet._sceneNumber == 4250) { + if (RING_INVENTORY._helmet._sceneNumber == 4250) { _hotspot6.setStrip(6); _hotspot6.setFrame(_hotspot6.getFrameCount()); } @@ -3658,7 +3658,7 @@ void Scene4250::signal() { _globals->_sceneManager.changeScene(9900); break; case 4261: - _globals->_inventory._keyDevice._sceneNumber = 1; + RING_INVENTORY._keyDevice._sceneNumber = 1; _globals->_player.enableControl(); break; } @@ -3804,7 +3804,7 @@ void Scene4300::Hotspot8::doAction(int action) { SceneItem::display2(4300, 19); break; case OBJECT_KEY_DEVICE: - _globals->_inventory._keyDevice._sceneNumber = 4300; + RING_INVENTORY._keyDevice._sceneNumber = 4300; _globals->_scenePalette.addRotation(240, 254, -1); animate(ANIM_MODE_5, NULL); @@ -3820,15 +3820,15 @@ void Scene4300::Hotspot8::doAction(int action) { void Scene4300::Hotspot9::doAction(int action) { switch (action) { case CURSOR_LOOK: - if ((_globals->_inventory._stasisBox2._sceneNumber == 4300) || - (_globals->_inventory._concentrator._sceneNumber == 1)) + if ((RING_INVENTORY._stasisBox2._sceneNumber == 4300) || + (RING_INVENTORY._concentrator._sceneNumber == 1)) SceneItem::display2(4300, 7); else SceneItem::display2(4300, 1); break; case CURSOR_USE: - if ((_globals->_inventory._stasisBox2._sceneNumber == 4300) || - (_globals->_inventory._concentrator._sceneNumber == 1)) + if ((RING_INVENTORY._stasisBox2._sceneNumber == 4300) || + (RING_INVENTORY._concentrator._sceneNumber == 1)) SceneItem::display2(4300, 7); else SceneItem::display2(4300, 3); @@ -3837,8 +3837,8 @@ void Scene4300::Hotspot9::doAction(int action) { SceneItem::display2(4300, 24); break; case OBJECT_SCANNER: - if ((_globals->_inventory._stasisBox2._sceneNumber == 4300) || - (_globals->_inventory._concentrator._sceneNumber != 1)) + if ((RING_INVENTORY._stasisBox2._sceneNumber == 4300) || + (RING_INVENTORY._concentrator._sceneNumber != 1)) SceneItem::display2(4300, 22); else SceneItem::display2(4300, 23); @@ -3884,8 +3884,8 @@ void Scene4300::Hotspot15::signal() { scene->_soundHandler2.startSound(345); _strip = (_globals->_randomSource.getRandomNumber(6) < 2) ? 2 : 1; - if ((_globals->_inventory._stasisBox2._sceneNumber == 4300) || - (_globals->_inventory._concentrator._sceneNumber == 1)) { + if ((RING_INVENTORY._stasisBox2._sceneNumber == 4300) || + (RING_INVENTORY._concentrator._sceneNumber == 1)) { setStrip(1); setFrame(1); animate(ANIM_MODE_NONE, NULL); @@ -3902,8 +3902,8 @@ void Scene4300::Hotspot16::doAction(int action) { SceneItem::display2(4300, 8); break; case CURSOR_USE: - if ((_globals->_inventory._stasisBox2._sceneNumber != 4300) && - (_globals->_inventory._concentrator._sceneNumber != 4300)) { + if ((RING_INVENTORY._stasisBox2._sceneNumber != 4300) && + (RING_INVENTORY._concentrator._sceneNumber != 4300)) { SceneItem::display2(4300, 16); } else { scene->_sceneMode = 4302; @@ -3927,17 +3927,17 @@ void Scene4300::Hotspot17::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display2(4300, (_globals->_inventory._stasisBox2._sceneNumber == 4300) ? 17 : 11); + SceneItem::display2(4300, (RING_INVENTORY._stasisBox2._sceneNumber == 4300) ? 17 : 11); break; case CURSOR_USE: - if (_globals->_inventory._stasisBox2._sceneNumber != 4300) + if (RING_INVENTORY._stasisBox2._sceneNumber != 4300) SceneItem::display2(4300, 13); else { _globals->_scenePalette.clearListeners(); remove(); SceneItem::display2(4300, 12); - _globals->_inventory._concentrator._sceneNumber = 1; + RING_INVENTORY._concentrator._sceneNumber = 1; } break; case OBJECT_SCANNER: @@ -3968,8 +3968,8 @@ void Scene4300::Hotspot19::doAction(int action) { SceneItem::display2(4300, 24); break; case CURSOR_USE: - if ((_globals->_inventory._stasisBox2._sceneNumber != 4300) && - (_globals->_inventory._concentrator._sceneNumber != 4300)) + if ((RING_INVENTORY._stasisBox2._sceneNumber != 4300) && + (RING_INVENTORY._concentrator._sceneNumber != 4300)) SceneItem::display2(4300, 10); else SceneItem::display2(4300, 29); @@ -4019,14 +4019,14 @@ void Scene4300::postInit(SceneObjectList *OwnerList) { _globals->_sceneItems.push_back(&_hotspot8); } - if (_globals->_inventory._concentrator._sceneNumber == 4300) { + if (RING_INVENTORY._concentrator._sceneNumber == 4300) { _hotspot17.postInit(); _hotspot17.setVisage(4300); _hotspot17.setStrip(6); _hotspot17.setPriority2(1); _hotspot17.setPosition(Common::Point(200, 69)); - if (_globals->_inventory._stasisBox2._sceneNumber == 4300) + if (RING_INVENTORY._stasisBox2._sceneNumber == 4300) _hotspot17.setFrame(_hotspot17.getFrameCount()); _globals->_sceneItems.push_back(&_hotspot17); @@ -4056,7 +4056,7 @@ void Scene4300::postInit(SceneObjectList *OwnerList) { _hotspot13.animate(ANIM_MODE_8, 0, NULL); } - if (_globals->_inventory._items._sceneNumber == 4300) { + if (RING_INVENTORY._items._sceneNumber == 4300) { _hotspot16.postInit(); _hotspot16.setVisage(4300); _hotspot16.setPosition(Common::Point(169, 141)); @@ -4137,12 +4137,12 @@ void Scene4300::remove() { void Scene4300::signal() { switch (_sceneMode) { case 4302: - _globals->_inventory._items._sceneNumber = 1; + RING_INVENTORY._items._sceneNumber = 1; _hotspot16.remove(); _globals->_player.enableControl(); break; case 4303: - _globals->_inventory._stasisBox2._sceneNumber = 4300; + RING_INVENTORY._stasisBox2._sceneNumber = 4300; _hotspot15.setStrip(1); _hotspot15.setFrame(1); _hotspot15.animate(ANIM_MODE_NONE, NULL); @@ -4372,7 +4372,7 @@ void Scene4301::postInit(SceneObjectList *OwnerList) { setZoomPercents(0, 100, 200, 100); _field68E = false; - _globals->_inventory._stasisBox2._sceneNumber = 1; + RING_INVENTORY._stasisBox2._sceneNumber = 1; _hotspot4.setup(76, 97, 102, 127, 4300, 5, 6); _hotspot1.postInit(); diff --git a/engines/tsage/ringworld_scenes6.cpp b/engines/tsage/ringworld_scenes6.cpp index 5fdb09732a..54ae7eaaf4 100644 --- a/engines/tsage/ringworld_scenes6.cpp +++ b/engines/tsage/ringworld_scenes6.cpp @@ -384,7 +384,7 @@ void Scene5000::Hotspot7::doAction(int action) { SceneItem::display2(5000, 12); break; case CURSOR_TALK: - setAction(&scene->_action6); + scene->setAction(&scene->_action6); break; default: SceneHotspot::doAction(action); @@ -403,7 +403,7 @@ void Scene5000::Hotspot8::doAction(int action) { SceneItem::display2(5000, 14); break; case OBJECT_SCANNER: - setAction(&scene->_action5); + scene->setAction(&scene->_action5); break; default: SceneHotspot::doAction(action); @@ -1158,7 +1158,7 @@ void Scene5100::postInit(SceneObjectList *OwnerList) { } } - if (_globals->getFlag(60) && (_globals->_inventory._stasisBox._sceneNumber == 1) && + if (_globals->getFlag(60) && (RING_INVENTORY._stasisBox._sceneNumber == 1) && _globals->getFlag(107) && _globals->getFlag(67)) { _hotspot8.postInit(); _hotspot8.setVisage(2806); @@ -1256,7 +1256,7 @@ void Scene5100::postInit(SceneObjectList *OwnerList) { _hotspot6.setStrip(6); _hotspot6.setFrame(1); _globals->_sceneItems.push_back(&_hotspot6); - } else if (_globals->_inventory._vial._sceneNumber != 5100) { + } else if (RING_INVENTORY._vial._sceneNumber != 5100) { _hotspot6.postInit(); _hotspot6.setVisage(5362); _hotspot6.setPosition(Common::Point(1152, 70)); @@ -1312,7 +1312,7 @@ void Scene5100::signal() { case 5108: if (!_globals->getFlag(60)) _globals->_player.enableControl(); - else if (_globals->_inventory._stasisBox._sceneNumber == 1) + else if (RING_INVENTORY._stasisBox._sceneNumber == 1) setAction(&_action2); else setAction(&_action5); @@ -1329,7 +1329,7 @@ void Scene5100::signal() { _globals->_player.setPriority2(-1); _globals->_player.animate(ANIM_MODE_1, NULL); - if ((_globals->_inventory._vial._sceneNumber != 5100) && !_globals->getFlag(108)) { + if ((RING_INVENTORY._vial._sceneNumber != 5100) && !_globals->getFlag(108)) { _globals->setFlag(108); _sceneMode = 5130; _globals->_player.disableControl(); @@ -1344,7 +1344,7 @@ void Scene5100::signal() { break; case 5116: _globals->setFlag(105); - _globals->_inventory._bone._sceneNumber = 0; + RING_INVENTORY._bone._sceneNumber = 0; _globals->_player.setObjectWrapper(new SceneObjectWrapper()); _globals->_player.setVisage(0); @@ -1388,7 +1388,7 @@ void Scene5100::dispatch() { _sceneMode = 5150; _soundHandler.startSound(208); - if (_globals->_inventory._vial._sceneNumber == 5100) { + if (RING_INVENTORY._vial._sceneNumber == 5100) { _globals->_player.addMover(NULL); _globals->_player.disableControl(); SceneItem::display2(5100, 39); @@ -1462,7 +1462,7 @@ void Scene5200::Action2::signal() { scene->_soundHandler.proc3(); scene->_hotspot14.remove(); - _globals->_inventory._stasisBox._sceneNumber = 1; + RING_INVENTORY._stasisBox._sceneNumber = 1; _globals->_player.animate(ANIM_MODE_5, this); break; case 3: @@ -1611,7 +1611,7 @@ void Scene5200::postInit(SceneObjectList *OwnerList) { _speakerFLText._textPos.x = 160; _speakerQText._textPos.x = 20; - if (_globals->_inventory._stasisBox._sceneNumber == 5200) { + if (RING_INVENTORY._stasisBox._sceneNumber == 5200) { _soundHandler.startSound(216); _soundHandler.proc5(true); @@ -1762,7 +1762,7 @@ void Scene5300::Action1::signal() { scene->_stripManager.start(5316, this); break; case 5: - if (!_globals->getFlag(106) || !_globals->getFlag(107) || (_globals->_inventory._stasisBox._sceneNumber != 1)) { + if (!_globals->getFlag(106) || !_globals->getFlag(107) || (RING_INVENTORY._stasisBox._sceneNumber != 1)) { _globals->_player.enableControl(); remove(); } else { @@ -1793,7 +1793,7 @@ void Scene5300::Action2::signal() { scene->_stripManager.start(5328, this); break; case 2: - if (_globals->_inventory._stasisBox._sceneNumber == 1) { + if (RING_INVENTORY._stasisBox._sceneNumber == 1) { _globals->_stripNum = 5303; setDelay(5); } else { @@ -1871,7 +1871,7 @@ void Scene5300::Hotspot2::doAction(int action) { } else { _globals->_player.disableControl(); - if (_globals->_inventory._stasisBox._sceneNumber != 1) { + if (RING_INVENTORY._stasisBox._sceneNumber != 1) { scene->setAction(&scene->_sequenceManager, scene, 5316, NULL); } else { _globals->setFlag(60); @@ -1898,7 +1898,7 @@ void Scene5300::Hotspot2::doAction(int action) { if (_globals->getFlag(107)) { SceneItem::display2(5300, 8); } else { - _globals->_inventory._vial._sceneNumber = 5300; + RING_INVENTORY._vial._sceneNumber = 5300; _globals->setFlag(107); _globals->_player.disableControl(); scene->_sceneMode = 5304; @@ -1920,7 +1920,7 @@ void Scene5300::Hotspot5::doAction(int action) { SceneItem::display2(5300, 27); break; case CURSOR_USE: - _globals->_inventory._bone._sceneNumber = 1; + RING_INVENTORY._bone._sceneNumber = 1; _globals->_player.disableControl(); scene->_sceneMode = 5309; @@ -1937,20 +1937,20 @@ void Scene5300::Hotspot6::doAction(int action) { switch (action) { case CURSOR_LOOK: - if (!_globals->getFlag(105) || (_globals->_inventory._vial._sceneNumber == 1)) + if (!_globals->getFlag(105) || (RING_INVENTORY._vial._sceneNumber == 1)) SceneItem::display2(5300, 4); else SceneItem::display2(5300, 26); break; case CURSOR_USE: - if (!_globals->getFlag(105) || (_globals->_inventory._vial._sceneNumber != 5100)) { + if (!_globals->getFlag(105) || (RING_INVENTORY._vial._sceneNumber != 5100)) { _globals->_player.disableControl(); scene->_sceneMode = 5301; scene->setAction(&scene->_sequenceManager, scene, 5301, &_globals->_player, NULL); } else { _globals->_player.disableControl(); scene->_sceneMode = 5307; - _globals->_inventory._vial._sceneNumber = 1; + RING_INVENTORY._vial._sceneNumber = 1; scene->setAction(&scene->_sequenceManager, scene, 5307, &scene->_hotspot1, &_globals->_player, &scene->_hotspot4, NULL); @@ -2091,7 +2091,7 @@ void Scene5300::postInit(SceneObjectList *OwnerList) { } _field1B0A = 1; - if (_globals->_inventory._bone._sceneNumber == 5300) { + if (RING_INVENTORY._bone._sceneNumber == 5300) { _hotspot5.postInit(); _hotspot5.setVisage(5301); _hotspot5.setStrip(2); @@ -2143,7 +2143,7 @@ void Scene5300::signal() { _globals->clearFlag(67); _globals->_player.setStrip2(-1); - if ((_globals->_inventory._vial._sceneNumber == 1) || (_globals->_inventory._vial._sceneNumber == 5300)) + if ((RING_INVENTORY._vial._sceneNumber == 1) || (RING_INVENTORY._vial._sceneNumber == 5300)) _stripManager.start(5303, this); else _stripManager.start(5302, this); diff --git a/engines/tsage/ringworld_scenes8.cpp b/engines/tsage/ringworld_scenes8.cpp index 35db3cd387..651f8f73c5 100644 --- a/engines/tsage/ringworld_scenes8.cpp +++ b/engines/tsage/ringworld_scenes8.cpp @@ -353,9 +353,9 @@ void Scene7000::Object1::doAction(int action) { switch (action) { case OBJECT_TRANSLATOR: _globals->_player.disableControl(); - _globals->_inventory._translator._sceneNumber = 7000; - if (_globals->_inventory._waldos._sceneNumber == 7000) { - if (_globals->_inventory._jar._sceneNumber == 7000) { + RING_INVENTORY._translator._sceneNumber = 7000; + if (RING_INVENTORY._waldos._sceneNumber == 7000) { + if (RING_INVENTORY._jar._sceneNumber == 7000) { scene->_sceneMode = 7012; scene->setAction(&scene->_sequenceManager, scene, 7010, &_globals->_player, &scene->_object1, 0, 0); } else { @@ -363,7 +363,7 @@ void Scene7000::Object1::doAction(int action) { scene->setAction(&scene->_sequenceManager, scene, 7017, &_globals->_player, 0, 0); } } else { - if (_globals->_inventory._jar._sceneNumber == 7000) { + if (RING_INVENTORY._jar._sceneNumber == 7000) { scene->_sceneMode = 7011; scene->setAction(&scene->_sequenceManager, scene, 7010, &_globals->_player, &scene->_object1, 0, 0); } else { @@ -374,9 +374,9 @@ void Scene7000::Object1::doAction(int action) { break; case OBJECT_WALDOS: _globals->_player.disableControl(); - _globals->_inventory._waldos._sceneNumber = 7000; - if (_globals->_inventory._translator._sceneNumber == 7000) { - if (_globals->_inventory._jar._sceneNumber == 7000) { + RING_INVENTORY._waldos._sceneNumber = 7000; + if (RING_INVENTORY._translator._sceneNumber == 7000) { + if (RING_INVENTORY._jar._sceneNumber == 7000) { scene->_sceneMode = 7015; scene->setAction(&scene->_sequenceManager, scene, 7015, &_globals->_player, 0, 0); } else { @@ -390,9 +390,9 @@ void Scene7000::Object1::doAction(int action) { break; case OBJECT_JAR: _globals->_player.disableControl(); - _globals->_inventory._jar._sceneNumber = 7000; - if (_globals->_inventory._translator._sceneNumber == 7000) { - if (_globals->_inventory._waldos._sceneNumber == 7000) { + RING_INVENTORY._jar._sceneNumber = 7000; + if (RING_INVENTORY._translator._sceneNumber == 7000) { + if (RING_INVENTORY._waldos._sceneNumber == 7000) { scene->_sceneMode = 7007; scene->setAction(&scene->_sequenceManager, scene, 7007, &_globals->_player, &scene->_object1, 0, 0); } else { @@ -412,7 +412,7 @@ void Scene7000::Object1::doAction(int action) { break; case CURSOR_USE: if (_globals->getFlag(81)) { - _globals->_inventory._stasisBox._sceneNumber = 1; + RING_INVENTORY._stasisBox._sceneNumber = 1; _globals->_player.disableControl(); scene->setAction(&scene->_action5); } else { @@ -421,7 +421,7 @@ void Scene7000::Object1::doAction(int action) { break; case CURSOR_TALK: if (_globals->getFlag(81)) { - _globals->_inventory._stasisBox._sceneNumber = 1; + RING_INVENTORY._stasisBox._sceneNumber = 1; _globals->_player.disableControl(); scene->setAction(&scene->_action5); } else if (_globals->getFlag(52)) { @@ -1316,7 +1316,7 @@ void Scene7300::Action1::signal() { _globals->_player.setStrip(3); _globals->_player._numFrames = 5; _globals->_player.animate(ANIM_MODE_2, this); - if (_globals->_inventory._translator._sceneNumber == 1) + if (RING_INVENTORY._translator._sceneNumber == 1) scene->_stripManager.start(7310, this); else scene->_stripManager.start(7305, this); @@ -1755,10 +1755,10 @@ void Scene7700::SceneHotspot3::doAction(int action) { switch (action) { case OBJECT_KEY: SceneItem::display(7702, 3, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); - _globals->_inventory._key._sceneNumber = 7700; + RING_INVENTORY._key._sceneNumber = 7700; break; case CURSOR_LOOK: - if (_globals->_inventory._key._sceneNumber == 7700) + if (RING_INVENTORY._key._sceneNumber == 7700) scene->setAction(&scene->_action4, 0); else SceneItem::display(7700, 53, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); @@ -1767,7 +1767,7 @@ void Scene7700::SceneHotspot3::doAction(int action) { if (!_globals->getFlag(78)) { scene->_sceneMode = 7712; scene->setAction(&scene->_sequenceManager, scene, 7715, 0); - } else if (_globals->_inventory._key._sceneNumber == 7700) { + } else if (RING_INVENTORY._key._sceneNumber == 7700) { _globals->_player.disableControl(); scene->_sceneMode = 7705; scene->setAction(&scene->_sequenceManager, scene, 7705, &_globals->_player, 0); @@ -1809,7 +1809,7 @@ void Scene7700::SceneHotspot5::doAction(int action) { break; case CURSOR_USE: if (_globals->getFlag(78)) { - if (_globals->_inventory._paper._sceneNumber == 7700) { + if (RING_INVENTORY._paper._sceneNumber == 7700) { _globals->_player.disableControl(); scene->_sceneMode = 7708; scene->setAction(&scene->_sequenceManager, scene, 7708, &_globals->_player, 0); @@ -2156,8 +2156,8 @@ void Scene7700::Object11::doAction(int action) { } break; case OBJECT_EMPTY_JAR: - _globals->_inventory._emptyJar._sceneNumber = 0; - _globals->_inventory._jar._sceneNumber = 1; + RING_INVENTORY._emptyJar._sceneNumber = 0; + RING_INVENTORY._jar._sceneNumber = 1; _globals->_player.disableControl(); scene->_sceneMode = 7710; scene->setAction(&scene->_sequenceManager, scene, 7710, &_globals->_player, NULL); @@ -2217,7 +2217,7 @@ void Scene7700::signal() { break; case 7705: case 7708: - _globals->_inventory._key._sceneNumber = 1; + RING_INVENTORY._key._sceneNumber = 1; _globals->_player.enableControl(); break; case 7709: @@ -2229,7 +2229,7 @@ void Scene7700::signal() { break; case 7713: _emptyJar.remove(); - _globals->_inventory._emptyJar._sceneNumber = 1; + RING_INVENTORY._emptyJar._sceneNumber = 1; break; default: break; @@ -2387,7 +2387,7 @@ void Scene7700::postInit(SceneObjectList *OwnerList) { if (_globals->getFlag(49)) _cork.setFrame(_cork.getFrameCount()); - if (_globals->_inventory._emptyJar._sceneNumber == 7700) { + if (RING_INVENTORY._emptyJar._sceneNumber == 7700) { _emptyJar.postInit(); _emptyJar.setVisage(7700); _emptyJar.setStrip(8); diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 8454c7ebd4..e316a601fb 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -292,7 +292,7 @@ void Scene::loadSceneData(int sceneNum) { _globals->_sceneManager._scene->_activeScreenNumber = sceneNum; // Get the basic scene size - byte *data = _vm->_dataManager->getResource(RES_BITMAP, sceneNum, 9999); + byte *data = _resourceManager->getResource(RES_BITMAP, sceneNum, 9999); _backgroundBounds = Rect(0, 0, READ_LE_UINT16(data), READ_LE_UINT16(data + 2)); _globals->_sceneManager._scene->_sceneBounds.contain(_backgroundBounds); DEALLOCATE(data); diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp index 9d5d7223cb..16756f59fa 100644 --- a/engines/tsage/tsage.cpp +++ b/engines/tsage/tsage.cpp @@ -46,7 +46,6 @@ TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc) _vm = this; DebugMan.addDebugChannel(kRingDebugScripts, "scripts", "Scripts debugging"); _debugger = new Debugger(); - _dataManager = NULL; } Common::Error TSageEngine::init() { @@ -69,19 +68,26 @@ bool TSageEngine::hasFeature(EngineFeature f) const { } void TSageEngine::initialise() { - _tSageManager = new RlbManager(_memoryManager, "tsage.rlb"); - _dataManager = new RlbManager(_memoryManager, "ring.rlb"); - _saver = new Saver(); + + // Set up the resource manager + _resourceManager = new ResourceManager(); + if (_vm->getFeatures() & GF_DEMO) { + // Add the single library file associated with the demo + _resourceManager->addLib(getPrimaryFilename()); + } else { + _resourceManager->addLib("RING.RLB"); + _resourceManager->addLib("TSAGE.RLB"); + } + _globals = new Globals(); _globals->gfxManager().setDefaults(); } void TSageEngine::deinitialise() { delete _globals; + delete _resourceManager; delete _saver; - delete _tSageManager; - delete _dataManager; } Common::Error TSageEngine::run() { @@ -91,7 +97,7 @@ Common::Error TSageEngine::run() { _globals->_events.showCursor(); _globals->_sceneHandler.registerHandler(); - _globals->_game.execute(); + _globals->_game->execute(); deinitialise(); return Common::kNoError; diff --git a/engines/tsage/tsage.h b/engines/tsage/tsage.h index 25a99f094b..e5b92e09d0 100644 --- a/engines/tsage/tsage.h +++ b/engines/tsage/tsage.h @@ -74,12 +74,11 @@ public: MemoryManager _memoryManager; Debugger *_debugger; - RlbManager *_tSageManager; - RlbManager *_dataManager; const char *getGameId() const; uint32 getGameID() const; uint32 getFeatures() const; + Common::String getPrimaryFilename() const; virtual Common::Error init(); virtual Common::Error run(); diff --git a/graphics/png.h b/graphics/png.h index 70f2e4ba27..00c084da8e 100644 --- a/graphics/png.h +++ b/graphics/png.h @@ -121,9 +121,13 @@ public: * * Note that the palette's format is RGBA. */ - void getPalette(byte *palette, uint16 &entries) { + void getPalette(byte *&palette, uint16 &entries) { if (_header.colorType != kIndexed) error("Palette requested for a non-indexed PNG"); + // TODO: It might be that this should really return a copy of the + // palette, but since the implementation was like this I changed + // the palette pointer to be a reference instead of a value copy. + // Someone should check this code and verify this is as intended. palette = _palette; entries = _paletteEntries; } diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip Binary files differindex 77951475e6..1e44442933 100644 --- a/gui/themes/scummmodern.zip +++ b/gui/themes/scummmodern.zip diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index 32d6d19d1a..c0433ceb9a 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -128,7 +128,7 @@ /> <space /> <widget name = 'Version' - width = '247' + width = '310' height = 'Globals.Line.Height' textalign = 'center' /> |