mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-25 13:42:37 +00:00
MYST3: Add RoomID enum to help working with Rooms
No behavior changes. Not all rooms were given useful names, but the most used were. More useful names for the more obscure rooms can be added later.
This commit is contained in:
parent
2f756b92e7
commit
35d89e25a6
@ -372,70 +372,70 @@ NodeWalker::~NodeWalker() {
|
||||
}
|
||||
|
||||
static const RoomData roomsXXXX[] = {
|
||||
{ 101, "XXXX" }
|
||||
{ kRoomShared, "XXXX" }
|
||||
};
|
||||
|
||||
static const RoomData roomsINTR[] = {
|
||||
{ 201, "INTR" }
|
||||
{ kRoomIntro, "INTR" }
|
||||
};
|
||||
|
||||
static const RoomData roomsTOHO[] = {
|
||||
{ 301, "TOHO" }
|
||||
{ kRoomTomahnaStart, "TOHO" }
|
||||
};
|
||||
|
||||
static const RoomData roomsTOHB[] = {
|
||||
{ 401, "TOHB" }
|
||||
{ kRoomTomahnaReturn, "TOHB" }
|
||||
};
|
||||
|
||||
static const RoomData roomsLE[] = {
|
||||
{ 501, "LEIS" },
|
||||
{ 502, "LEOS" },
|
||||
{ 503, "LEET" },
|
||||
{ 504, "LELT" },
|
||||
{ 505, "LEMT" },
|
||||
{ 506, "LEOF" }
|
||||
{ kJnaninStart, "LEIS" },
|
||||
{ kRoomLeos, "LEOS" },
|
||||
{ kRoomLeet, "LEET" },
|
||||
{ kRoomLelt, "LELT" },
|
||||
{ kRoomLemt, "LEMT" },
|
||||
{ kRoomLeof, "LEOF" }
|
||||
};
|
||||
|
||||
static const RoomData roomsLI[] = {
|
||||
{ 601, "LIDR" },
|
||||
{ 602, "LISW" },
|
||||
{ 603, "LIFO" },
|
||||
{ 604, "LISP" },
|
||||
{ 605, "LINE" }
|
||||
{ kRoomEdannaStart, "LIDR" },
|
||||
{ kRoomLisw, "LISW" },
|
||||
{ kRoomLifo, "LIFO" },
|
||||
{ kRoomLisp, "LISP" },
|
||||
{ kRoomLine, "LINE" }
|
||||
};
|
||||
|
||||
static const RoomData roomsEN[] = {
|
||||
{ 701, "ENSI" },
|
||||
{ 703, "ENPP" },
|
||||
{ 704, "ENEM" },
|
||||
{ 705, "ENLC" },
|
||||
{ 706, "ENDD" },
|
||||
{ 707, "ENCH" },
|
||||
{ 708, "ENLI" }
|
||||
{ kRoomVoltaicStart, "ENSI" },
|
||||
{ kRoomEnpp, "ENPP" },
|
||||
{ kRoomEnem, "ENEM" },
|
||||
{ kRoomEnlc, "ENLC" },
|
||||
{ kRoomEndd, "ENDD" },
|
||||
{ kRoomEnch, "ENCH" },
|
||||
{ kRoomEnli, "ENLI" }
|
||||
};
|
||||
|
||||
static const RoomData roomsNA[] = {
|
||||
{ 801, "NACH" }
|
||||
{ kRoomNarayan, "NACH" }
|
||||
};
|
||||
|
||||
static const RoomData roomsMENU[] = {
|
||||
{ 901, "MENU" },
|
||||
{ 902, "JRNL" },
|
||||
{ 903, "DEMO" },
|
||||
{ 904, "ATIX" }
|
||||
{ kRoomMenu, "MENU" },
|
||||
{ kRoomJournals, "JRNL" },
|
||||
{ kRoomDemo, "DEMO" },
|
||||
{ kRoomAtix, "ATIX" }
|
||||
};
|
||||
|
||||
static const RoomData roomsMA[] = {
|
||||
{ 1001, "MACA" },
|
||||
{ 1002, "MAIS" },
|
||||
{ 1003, "MALL" },
|
||||
{ 1004, "MASS" },
|
||||
{ 1005, "MAWW" },
|
||||
{ 1006, "MATO" }
|
||||
{ kRoomAmateriaStart, "MACA" },
|
||||
{ kRoomMais, "MAIS" },
|
||||
{ kRoomMall, "MALL" },
|
||||
{ kRoomMass, "MASS" },
|
||||
{ kRoomMaww, "MAWW" },
|
||||
{ kRoomMato, "MATO" }
|
||||
};
|
||||
|
||||
static const RoomData roomsLOGO[] = {
|
||||
{ 1101, "LOGO" }
|
||||
{ kLogo, "LOGO" }
|
||||
};
|
||||
|
||||
const AgeData Database::_ages[] = {
|
||||
@ -687,7 +687,7 @@ void Database::patchNodeScripts(const RoomData *room, Common::Array<NodePtr> &no
|
||||
}
|
||||
|
||||
bool Database::isCommonRoom(uint32 roomID, uint32 ageID) const {
|
||||
return roomID == 101 || roomID == 901 || roomID == 902;
|
||||
return roomID == kRoomShared || roomID == kRoomMenu || roomID == kRoomJournals;
|
||||
}
|
||||
|
||||
void Database::cacheRoom(uint32 roomID, uint32 ageID) {
|
||||
@ -864,7 +864,7 @@ void Database::patchLanguageMenu() {
|
||||
// op 194, runPuzzle1 ( 18 )
|
||||
// op 194, runPuzzle1 ( 19 )
|
||||
|
||||
NodePtr languageMenu = getNodeData(530, 901, 9);
|
||||
NodePtr languageMenu = getNodeData(530, kRoomMenu, 9);
|
||||
languageMenu->hotspots[5].script[1].args[1] = getGameLanguageCode();
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,9 @@
|
||||
#ifndef DATABASE_H_
|
||||
#define DATABASE_H_
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "engines/myst3/hotspot.h"
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/str.h"
|
||||
#include "common/language.h"
|
||||
#include "common/platform.h"
|
||||
@ -51,6 +52,43 @@ enum MystLanguage {
|
||||
kSpanish = 5
|
||||
};
|
||||
|
||||
enum RoomID {
|
||||
kRoomShared = 101,
|
||||
kRoomIntro = 201,
|
||||
kRoomTomahnaStart = 301,
|
||||
kRoomTomahnaReturn = 401,
|
||||
kJnaninStart = 501,
|
||||
kRoomLeos = 502,
|
||||
kRoomLeet = 503,
|
||||
kRoomLelt = 504,
|
||||
kRoomLemt = 505,
|
||||
kRoomLeof = 506,
|
||||
kRoomEdannaStart = 601,
|
||||
kRoomLisw = 602,
|
||||
kRoomLifo = 603,
|
||||
kRoomLisp = 604,
|
||||
kRoomLine = 605,
|
||||
kRoomVoltaicStart = 701,
|
||||
kRoomEnpp = 703,
|
||||
kRoomEnem = 704,
|
||||
kRoomEnlc = 705,
|
||||
kRoomEndd = 706,
|
||||
kRoomEnch = 707,
|
||||
kRoomEnli = 708,
|
||||
kRoomNarayan = 801,
|
||||
kRoomMenu = 901,
|
||||
kRoomJournals = 902,
|
||||
kRoomDemo = 903,
|
||||
kRoomAtix = 904,
|
||||
kRoomAmateriaStart = 1001,
|
||||
kRoomMais = 1002,
|
||||
kRoomMall = 1003,
|
||||
kRoomMass = 1004,
|
||||
kRoomMaww = 1005,
|
||||
kRoomMato = 1006,
|
||||
kLogo = 1101
|
||||
};
|
||||
|
||||
struct NodeData {
|
||||
int16 id;
|
||||
int16 zipBitIndex;
|
||||
|
@ -21,7 +21,9 @@
|
||||
*/
|
||||
|
||||
#include "engines/myst3/inventory.h"
|
||||
|
||||
#include "engines/myst3/cursor.h"
|
||||
#include "engines/myst3/database.h"
|
||||
#include "engines/myst3/state.h"
|
||||
|
||||
namespace Myst3 {
|
||||
@ -210,22 +212,22 @@ void Inventory::useItem(uint16 var) {
|
||||
case 277: // Atrus
|
||||
closeAllBooks();
|
||||
_vm->_state->setJournalAtrusState(2);
|
||||
openBook(9, 902, 100);
|
||||
openBook(9, kRoomJournals, 100);
|
||||
break;
|
||||
case 279: // Saavedro
|
||||
closeAllBooks();
|
||||
_vm->_state->setJournalSaavedroState(2);
|
||||
openBook(9, 902, 200);
|
||||
openBook(9, kRoomJournals, 200);
|
||||
break;
|
||||
case 480: // Tomahna
|
||||
closeAllBooks();
|
||||
_vm->_state->setBookStateTomahna(2);
|
||||
openBook(8, 801, 220);
|
||||
openBook(8, kRoomNarayan, 220);
|
||||
break;
|
||||
case 481: // Releeshahn
|
||||
closeAllBooks();
|
||||
_vm->_state->setBookStateReleeshahn(2);
|
||||
openBook(9, 902, 300);
|
||||
openBook(9, kRoomJournals, 300);
|
||||
break;
|
||||
case 345:
|
||||
_vm->dragSymbol(345, 1002);
|
||||
@ -269,7 +271,7 @@ void Inventory::addSaavedroChapter(uint16 var) {
|
||||
_vm->_state->setJournalSaavedroState(2);
|
||||
_vm->_state->setJournalSaavedroChapter(var - 285);
|
||||
_vm->_state->setJournalSaavedroPageInChapter(0);
|
||||
openBook(9, 902, 200);
|
||||
openBook(9, kRoomJournals, 200);
|
||||
}
|
||||
|
||||
void Inventory::loadFromState() {
|
||||
|
@ -309,7 +309,7 @@ Graphics::Surface *Menu::captureThumbnail() {
|
||||
}
|
||||
|
||||
void Menu::goToNode(uint16 node) {
|
||||
if (_vm->_state->getMenuSavedAge() == 0 && _vm->_state->getLocationRoom() != 901) {
|
||||
if (_vm->_state->getMenuSavedAge() == 0 && _vm->_state->getLocationRoom() != kRoomMenu) {
|
||||
// Entering menu, save current location ...
|
||||
_vm->_state->setMenuSavedAge(_vm->_state->getLocationAge());
|
||||
_vm->_state->setMenuSavedRoom(_vm->_state->getLocationRoom());
|
||||
@ -340,7 +340,7 @@ void Menu::goToNode(uint16 node) {
|
||||
}
|
||||
|
||||
_vm->_state->setLocationNextAge(9);
|
||||
_vm->_state->setLocationNextRoom(901);
|
||||
_vm->_state->setLocationNextRoom(kRoomMenu);
|
||||
_vm->goToNode(node, kTransitionNone);
|
||||
}
|
||||
|
||||
@ -396,7 +396,7 @@ uint16 Menu::dialogSaveValue() {
|
||||
Common::String Menu::getAgeLabel(GameState *gameState) {
|
||||
uint32 age = 0;
|
||||
uint32 room = gameState->getLocationRoom();
|
||||
if (room == 901)
|
||||
if (room == kRoomMenu)
|
||||
age = gameState->getMenuSavedAge();
|
||||
else
|
||||
age = gameState->getLocationAge();
|
||||
@ -445,7 +445,7 @@ void Menu::setSaveLoadSpotItem(uint16 id, SpotItemFace *spotItem) {
|
||||
}
|
||||
|
||||
bool Menu::isOpen() const {
|
||||
return _vm->_state->getLocationAge() == 9 && _vm->_state->getLocationRoom() == 901;
|
||||
return _vm->_state->getLocationAge() == 9 && _vm->_state->getLocationRoom() == kRoomMenu;
|
||||
}
|
||||
|
||||
void Menu::generateSaveThumbnail() {
|
||||
@ -681,7 +681,7 @@ void PagingMenu::draw() {
|
||||
uint16 room = _vm->_state->getLocationRoom();
|
||||
uint16 age = _vm->_state->getLocationAge();
|
||||
|
||||
if (room != 901 || !(node == 200 || node == 300))
|
||||
if (room != kRoomMenu || !(node == 200 || node == 300))
|
||||
return;
|
||||
|
||||
int16 page = _vm->_state->getMenuSaveLoadCurrentPage();
|
||||
@ -731,7 +731,7 @@ bool PagingMenu::handleInput(const Common::KeyState &e) {
|
||||
uint16 room = _vm->_state->getLocationRoom();
|
||||
uint16 item = _vm->_state->getMenuSaveLoadSelectedItem();
|
||||
|
||||
if (room != 901 || node != 300 || item != 7)
|
||||
if (room != kRoomMenu || node != 300 || item != 7)
|
||||
return false;
|
||||
|
||||
Common::String display = prepareSaveNameForDisplay(_saveName);
|
||||
@ -794,7 +794,7 @@ void AlbumMenu::draw() {
|
||||
uint16 room = _vm->_state->getLocationRoom();
|
||||
|
||||
// Load and save menus only
|
||||
if (room != 901 || !(node == 200 || node == 300))
|
||||
if (room != kRoomMenu || !(node == 200 || node == 300))
|
||||
return;
|
||||
|
||||
if (!_saveLoadAgeName.empty()) {
|
||||
@ -903,7 +903,7 @@ void AlbumMenu::loadMenuSelect() {
|
||||
uint16 room = _vm->_state->getLocationRoom();
|
||||
|
||||
// Details are only updated on the load menu
|
||||
if (room != 901 || node != 200)
|
||||
if (room != kRoomMenu || node != 200)
|
||||
return;
|
||||
|
||||
int32 selectedSave = _vm->_state->getMenuSelectedSave();
|
||||
|
@ -191,11 +191,11 @@ Common::Error Myst3Engine::run() {
|
||||
} else {
|
||||
if (getPlatform() == Common::kPlatformXbox) {
|
||||
// Play the logo videos
|
||||
loadNode(1, 1101, 11);
|
||||
loadNode(1, kLogo, 11);
|
||||
}
|
||||
|
||||
// Game init script, loads the menu
|
||||
loadNode(1, 101, 1);
|
||||
loadNode(1, kRoomShared, 1);
|
||||
}
|
||||
|
||||
while (!shouldQuit()) {
|
||||
@ -494,7 +494,7 @@ void Myst3Engine::processInput(bool interactive) {
|
||||
case Common::KEYCODE_F5:
|
||||
// Open main menu
|
||||
if (_cursor->isVisible() && interactive) {
|
||||
if (_state->getLocationRoom() != 901)
|
||||
if (_state->getLocationRoom() != kRoomMenu)
|
||||
_menu->goToNode(100);
|
||||
}
|
||||
break;
|
||||
@ -553,7 +553,7 @@ void Myst3Engine::processInput(bool interactive) {
|
||||
if (_inputEscapePressedNotConsumed && interactive) {
|
||||
_inputEscapePressedNotConsumed = false;
|
||||
if (_cursor->isVisible() && _state->hasVarMenuEscapePressed()) {
|
||||
if (_state->getLocationRoom() != 901)
|
||||
if (_state->getLocationRoom() != kRoomMenu)
|
||||
_menu->goToNode(100);
|
||||
else
|
||||
_state->setMenuEscapePressed(1);
|
||||
@ -731,7 +731,7 @@ void Myst3Engine::drawFrame(bool noSwap) {
|
||||
|
||||
if (getPlatform() == Common::kPlatformXbox) {
|
||||
// The cursor is not drawn in the Xbox version menus and journals
|
||||
cursorVisible &= !(_state->getLocationRoom() == 901 || _state->getLocationRoom() == 902);
|
||||
cursorVisible &= !(_state->getLocationRoom() == kRoomMenu || _state->getLocationRoom() == kRoomJournals);
|
||||
}
|
||||
|
||||
if (cursorVisible)
|
||||
@ -852,7 +852,7 @@ void Myst3Engine::loadNode(uint16 nodeID, uint32 roomID, uint32 ageID) {
|
||||
// WORKAROUND: In Narayan, the scripts in node NACH 9 test on var 39
|
||||
// without first reinitializing it leading to Saavedro not always giving
|
||||
// Releeshan to the player when he is trapped between both shields.
|
||||
if (nodeID == 9 && roomID == 801)
|
||||
if (nodeID == 9 && roomID == kRoomNarayan)
|
||||
_state->setVar(39, 0);
|
||||
}
|
||||
|
||||
@ -993,9 +993,9 @@ void Myst3Engine::runBackgroundSoundScriptsFromNode(uint16 nodeID, uint32 roomID
|
||||
// Stop previous music when changing room
|
||||
if (_backgroundSoundScriptLastRoomId != roomID) {
|
||||
if (_backgroundSoundScriptLastRoomId != 0
|
||||
&& _backgroundSoundScriptLastRoomId != 901
|
||||
&& _backgroundSoundScriptLastRoomId != 902
|
||||
&& roomID != 0 && roomID != 901 && roomID != 902) {
|
||||
&& _backgroundSoundScriptLastRoomId != kRoomMenu
|
||||
&& _backgroundSoundScriptLastRoomId != kRoomJournals
|
||||
&& roomID != 0 && roomID != kRoomMenu && roomID != kRoomJournals) {
|
||||
_sound->stopMusic(_state->getSoundScriptFadeOutDelay());
|
||||
|
||||
if (nodeData->backgroundSoundScripts.size() != 0) {
|
||||
@ -1486,7 +1486,7 @@ void Myst3Engine::dragItem(uint16 statusVar, uint16 movie, uint16 frame, uint16
|
||||
}
|
||||
|
||||
bool Myst3Engine::canSaveGameStateCurrently() {
|
||||
bool inMenuWithNoGameLoaded = _state->getLocationRoom() == 901 && _state->getMenuSavedAge() == 0;
|
||||
bool inMenuWithNoGameLoaded = _state->getLocationRoom() == kRoomMenu && _state->getMenuSavedAge() == 0;
|
||||
return canLoadGameStateCurrently() && !inMenuWithNoGameLoaded && _cursor->isVisible();
|
||||
}
|
||||
|
||||
|
@ -20,16 +20,18 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "engines/myst3/myst3.h"
|
||||
#include "engines/myst3/script.h"
|
||||
#include "engines/myst3/hotspot.h"
|
||||
#include "engines/myst3/state.h"
|
||||
|
||||
#include "engines/myst3/ambient.h"
|
||||
#include "engines/myst3/cursor.h"
|
||||
#include "engines/myst3/database.h"
|
||||
#include "engines/myst3/hotspot.h"
|
||||
#include "engines/myst3/inventory.h"
|
||||
#include "engines/myst3/myst3.h"
|
||||
#include "engines/myst3/puzzles.h"
|
||||
#include "engines/myst3/scene.h"
|
||||
#include "engines/myst3/sound.h"
|
||||
#include "engines/myst3/ambient.h"
|
||||
#include "engines/myst3/state.h"
|
||||
|
||||
#include "common/events.h"
|
||||
|
||||
@ -2454,7 +2456,7 @@ void Script::runScriptWithVar(Context &c, const Opcode &cmd) {
|
||||
void Script::runCommonScript(Context &c, const Opcode &cmd) {
|
||||
debugC(kDebugScript, "Opcode %d: Run common script %d", cmd.op, cmd.args[0]);
|
||||
|
||||
_vm->runScriptsFromNode(cmd.args[0], 101, 1);
|
||||
_vm->runScriptsFromNode(cmd.args[0], kRoomShared, 1);
|
||||
}
|
||||
|
||||
void Script::runCommonScriptWithVar(Context &c, const Opcode &cmd) {
|
||||
@ -2462,7 +2464,7 @@ void Script::runCommonScriptWithVar(Context &c, const Opcode &cmd) {
|
||||
|
||||
_vm->_state->setVar(26, cmd.args[1]);
|
||||
|
||||
_vm->runScriptsFromNode(cmd.args[0], 101, 1);
|
||||
_vm->runScriptsFromNode(cmd.args[0], kRoomShared, 1);
|
||||
}
|
||||
|
||||
void Script::runPuzzle1(Context &c, const Opcode &cmd) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user