aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'engines/zvision/scripting')
-rw-r--r--engines/zvision/scripting/effects/music_effect.cpp3
-rw-r--r--engines/zvision/scripting/script_manager.cpp7
-rw-r--r--engines/zvision/scripting/script_manager.h22
3 files changed, 26 insertions, 6 deletions
diff --git a/engines/zvision/scripting/effects/music_effect.cpp b/engines/zvision/scripting/effects/music_effect.cpp
index 2e2084783d..ad3c0f6d22 100644
--- a/engines/zvision/scripting/effects/music_effect.cpp
+++ b/engines/zvision/scripting/effects/music_effect.cpp
@@ -227,8 +227,7 @@ bool PanTrackNode::process(uint32 deltaTimeInMillis) {
int volumeCorrection = 2;
if (_engine->getGameId() == GID_GRANDINQUISITOR) {
- Location loc = scriptManager->getCurrentLocation();
- if (loc.world == 'd' && loc.room == 'c' && loc.node == '1' && loc.view == '0')
+ if (scriptManager->getCurrentLocation() == "dc10")
volumeCorrection = 5;
}
diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp
index 71966b3125..70eaab2a0a 100644
--- a/engines/zvision/scripting/script_manager.cpp
+++ b/engines/zvision/scripting/script_manager.cpp
@@ -72,8 +72,7 @@ void ScriptManager::initialize() {
}
void ScriptManager::update(uint deltaTimeMillis) {
- if (_currentLocation.node != _nextLocation.node || _currentLocation.room != _nextLocation.room ||
- _currentLocation.view != _nextLocation.view || _currentLocation.world != _nextLocation.world) {
+ if (_currentLocation != _nextLocation) {
ChangeLocationReal(false);
}
@@ -543,7 +542,7 @@ void ScriptManager::changeLocation(char _world, char _room, char _node, char _vi
_nextLocation.view = _view;
_nextLocation.offset = offset;
// If next location is 0000, return to the previous location.
- if (_nextLocation.world == '0' && _nextLocation.room == '0' && _nextLocation.node == '0' && _nextLocation.view == '0') {
+ if (_nextLocation == "0000") {
if (getStateValue(StateKey_World) != 'g' || getStateValue(StateKey_Room) != 'j') {
_nextLocation.world = getStateValue(StateKey_LastWorld);
_nextLocation.room = getStateValue(StateKey_LastRoom);
@@ -680,7 +679,7 @@ void ScriptManager::ChangeLocationReal(bool isLoading) {
// Change the background position
_engine->getRenderManager()->setBackgroundPosition(_nextLocation.offset);
- if (_currentLocation.world == 0 && _currentLocation.room == 0 && _currentLocation.node == 0 && _currentLocation.view == 0) {
+ if (_currentLocation == "0000") {
_currentLocation = _nextLocation;
execScope(world);
execScope(room);
diff --git a/engines/zvision/scripting/script_manager.h b/engines/zvision/scripting/script_manager.h
index d8e3721d43..7c276bf917 100644
--- a/engines/zvision/scripting/script_manager.h
+++ b/engines/zvision/scripting/script_manager.h
@@ -113,6 +113,28 @@ struct Location {
uint32 offset;
};
+inline bool operator==(const Location& lhs, const Location& rhs) {
+ return (
+ lhs.world == rhs.world &&
+ lhs.room == rhs.room &&
+ lhs.node == rhs.node &&
+ lhs.view == rhs.view
+ );
+}
+
+inline bool operator==(const Location& lhs, const char* rhs) {
+ Common::String lhsStr = Common::String::format("%c%c%c%c", lhs.world, lhs.room, lhs.node, lhs.view);
+ return lhsStr == rhs;
+}
+
+inline bool operator!=(const Location& lhs, const Location& rhs) {
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const Location& lhs, const char* rhs) {
+ return !(lhs == rhs);
+}
+
typedef Common::List<Puzzle *> PuzzleList;
typedef Common::Queue<Puzzle *> PuzzleQueue;
typedef Common::List<Control *> ControlList;