aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorColin Snover2016-09-26 19:28:51 -0500
committerColin Snover2016-09-29 19:39:16 -0500
commit6290f1e5fcc241441230912c4762828500988dab (patch)
tree0c763293504b076fc1ffdc1ae83043449facc00e /engines/sci/engine
parent8cb994b80125fbb02a1c2d35781e96e194a56ed1 (diff)
downloadscummvm-rg350-6290f1e5fcc241441230912c4762828500988dab.tar.gz
scummvm-rg350-6290f1e5fcc241441230912c4762828500988dab.tar.bz2
scummvm-rg350-6290f1e5fcc241441230912c4762828500988dab.zip
SCI: Add prefix to global variable constants
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kscripts.cpp4
-rw-r--r--engines/sci/engine/savegame.cpp6
-rw-r--r--engines/sci/engine/state.cpp4
-rw-r--r--engines/sci/engine/vm.cpp6
-rw-r--r--engines/sci/engine/vm.h26
5 files changed, 22 insertions, 24 deletions
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index 749af67580..0e29ccf783 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -238,8 +238,8 @@ reg_t kScriptID(EngineState *s, int argc, reg_t *argv) {
// initialized to 0, whereas it's 6 in other versions. Thus, we assign it
// to 6 here, fixing the speed of the introduction. Refer to bug #3102071.
if (g_sci->getGameId() == GID_PQ2 && script == 200 &&
- s->variables[VAR_GLOBAL][kSpeed].isNull()) {
- s->variables[VAR_GLOBAL][kSpeed] = make_reg(0, 6);
+ s->variables[VAR_GLOBAL][kGlobalVarSpeed].isNull()) {
+ s->variables[VAR_GLOBAL][kGlobalVarSpeed] = make_reg(0, 6);
}
return make_reg(scriptSeg, address);
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index d50df94f4b..36c35e47ea 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -337,12 +337,12 @@ static void sync_SavegameMetadata(Common::Serializer &s, SavegameMetadata &obj)
if (s.isSaving()) {
const reg_t *globals = g_sci->getEngineState()->variables[VAR_GLOBAL];
if (g_sci->getGameId() == GID_SHIVERS) {
- obj.lowScore = globals[kScore].toUint16();
- obj.highScore = globals[kShivers1Score].toUint16();
+ obj.lowScore = globals[kGlobalVarScore].toUint16();
+ obj.highScore = globals[kGlobalVarShivers1Score].toUint16();
obj.avatarId = 0;
} else if (g_sci->getGameId() == GID_MOTHERGOOSEHIRES) {
obj.lowScore = obj.highScore = 0;
- obj.avatarId = readSelectorValue(g_sci->getEngineState()->_segMan, globals[kEgo], SELECTOR(view));
+ obj.avatarId = readSelectorValue(g_sci->getEngineState()->_segMan, globals[kGlobalVarEgo], SELECTOR(view));
} else {
obj.lowScore = obj.highScore = obj.avatarId = 0;
}
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 5d4eba7c95..cec402da7d 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -159,11 +159,11 @@ void EngineState::initGlobals() {
}
uint16 EngineState::currentRoomNumber() const {
- return variables[VAR_GLOBAL][kNewRoomNo].toUint16();
+ return variables[VAR_GLOBAL][kGlobalVarNewRoomNo].toUint16();
}
void EngineState::setRoomNumber(uint16 roomNumber) {
- variables[VAR_GLOBAL][kNewRoomNo] = make_reg(0, roomNumber);
+ variables[VAR_GLOBAL][kGlobalVarNewRoomNo] = make_reg(0, roomNumber);
}
void EngineState::shrinkStackToBase() {
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 7c7f75c180..c0334f52ad 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -179,7 +179,7 @@ static void write_var(EngineState *s, int type, int index, reg_t value) {
// stopGroop object, which points to ego, to the new ego object. If this is not
// done, ego's movement will not be updated properly, so the result is
// unpredictable (for example in LSL5, Patti spins around instead of walking).
- if (index == kEgo && type == VAR_GLOBAL && getSciVersion() > SCI_VERSION_0_EARLY) {
+ if (index == kGlobalVarEgo && type == VAR_GLOBAL && getSciVersion() > SCI_VERSION_0_EARLY) {
reg_t stopGroopPos = s->_segMan->findObjectByName("stopGroop");
if (!stopGroopPos.isNull()) { // does the game have a stopGroop object?
// Find the "client" member variable of the stopGroop object, and update it
@@ -200,9 +200,9 @@ static void write_var(EngineState *s, int type, int index, reg_t value) {
s->variables[type][index] = value;
- if (type == VAR_GLOBAL && index == kMessageType) {
+ if (type == VAR_GLOBAL && index == kGlobalVarMessageType) {
// The game is trying to change its speech/subtitle settings
- if (!g_sci->getEngineState()->_syncedAudioOptions || s->variables[VAR_GLOBAL][kQuit] == TRUE_REG) {
+ if (!g_sci->getEngineState()->_syncedAudioOptions || s->variables[VAR_GLOBAL][kGlobalVarQuit] == TRUE_REG) {
// ScummVM audio options haven't been applied yet, so apply them.
// We also force the ScummVM audio options when loading a game from
// the launcher.
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index 31433555e4..a4ac16ea32 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -137,20 +137,18 @@ enum {
};
enum GlobalVar {
- kEgo = 0,
- kGame = 1,
- kCurrentRoom = 2,
- kSpeed = 3, // SCI16
- kDefaultPlane = 3, // SCI32
- kQuit = 4,
- kPlanes = 10, // SCI32
- kCurrentRoomNo = 11,
- kPreviousRoomNo = 12,
- kNewRoomNo = 13,
- kScore = 15,
- kFastCast = 84, // SCI16
- kMessageType = 90,
- kShivers1Score = 349
+ kGlobalVarEgo = 0,
+ kGlobalVarCurrentRoom = 2,
+ kGlobalVarSpeed = 3, // SCI16
+ kGlobalVarQuit = 4,
+ kGlobalVarPlanes = 10, // SCI32
+ kGlobalVarCurrentRoomNo = 11,
+ kGlobalVarPreviousRoomNo = 12,
+ kGlobalVarNewRoomNo = 13,
+ kGlobalVarScore = 15,
+ kGlobalVarFastCast = 84, // SCI16
+ kGlobalVarMessageType = 90,
+ kGlobalVarShivers1Score = 349
};
/** Number of kernel calls in between gcs; should be < 50000 */