[Scummvm-git-logs] scummvm master -> 02a1552efea49bc9754eff0ae72a2dd8cdf21bb1
sev-
sev at scummvm.org
Mon Aug 24 12:15:28 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
496484b94b ZVISION: Do not terminate scripts when they change location
022a65ee52 ZVISION: Delay location changes one cycle
02a1552efe ZVISION: Implement indirect addressing in add()
Commit: 496484b94bd5ad57f7a745b6246c912d7cc719e5
https://github.com/scummvm/scummvm/commit/496484b94bd5ad57f7a745b6246c912d7cc719e5
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2020-08-24T14:15:23+02:00
Commit Message:
ZVISION: Do not terminate scripts when they change location
It was pointed out on the GOG forum that you can't get a perfect score
in Zork: Grand Inquisitor. Once case I've found that looks like it
should award points, but doesn't, is the Spell Checker (tp4g.scr). It
turns out that the script doesn't award the points until after it has
changed your location, and ScummVM interprets the location change as a
signal that the script has ended. With this change, the script continues
until it finishes on its own.
As far as I can see, this is how ScummVM has always done it. I don't
think the original Z-Engine project did, though.
If this was the only such case, I would feel much more comfortable about
making this change. As it is, I'm a bit nervous about it. One other
positive difference is that with the change, you get to keep the sword
and rope after entering the monastery (um1e.scr). Without it, they are
lost but apparently no longer needed?
Changed paths:
engines/zvision/scripting/actions.cpp
diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp
index 6e02123ee9..2bf6ed83bb 100644
--- a/engines/zvision/scripting/actions.cpp
+++ b/engines/zvision/scripting/actions.cpp
@@ -130,10 +130,9 @@ ActionChangeLocation::ActionChangeLocation(ZVision *engine, int32 slotKey, const
}
bool ActionChangeLocation::execute() {
- // We can't directly call ScriptManager::ChangeLocationIntern() because doing so clears all the Puzzles, and thus would corrupt the current puzzle checking
+ // We can't directly call ScriptManager::ChangeLocationReal() because doing so clears all the Puzzles, and thus would corrupt the current puzzle checking
_scriptManager->changeLocation(_world, _room, _node, _view, _offset);
- // Tell the puzzle system to stop checking any more puzzles
- return false;
+ return true;
}
//////////////////////////////////////////////////////////////////////////////
Commit: 022a65ee528538dd0f8937baa896ba24c7c0c377
https://github.com/scummvm/scummvm/commit/022a65ee528538dd0f8937baa896ba24c7c0c377
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2020-08-24T14:15:23+02:00
Commit Message:
ZVISION: Delay location changes one cycle
Since the script that triggers a location change can also trigger other
scripts, wait one cycle before actually changing the location to give
them time to run. This fixes a couple more missing points. I've verified
that this does not cause any obvious regressions in ZGI. I'll try
Nemesis when all is done, to see if any of the fixes needs to be for ZGI
and ZGI only.
Changed paths:
engines/zvision/scripting/script_manager.cpp
engines/zvision/scripting/script_manager.h
diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp
index 16423dc04d..e65db9172c 100644
--- a/engines/zvision/scripting/script_manager.cpp
+++ b/engines/zvision/scripting/script_manager.cpp
@@ -65,6 +65,8 @@ void ScriptManager::initialize() {
_currentLocation.room = 0;
_currentLocation.view = 0;
+ _changeLocationDelayCycles = 0;
+
parseScrFile("universe.scr", universe);
changeLocation('g', 'a', 'r', 'y', 0);
@@ -73,7 +75,17 @@ void ScriptManager::initialize() {
void ScriptManager::update(uint deltaTimeMillis) {
if (_currentLocation != _nextLocation) {
- ChangeLocationReal(false);
+ // The location is changing. The script that did that may have
+ // triggered other scripts, so give them all one extra cycle to
+ // run. This fixes some missing scoring in ZGI, and quite
+ // possibly other minor glitches as well.
+ //
+ // Another idea would be to change if there are pending scripts
+ // in the exec queues, but that could cause this to hang
+ // indefinitely.
+ if (_changeLocationDelayCycles-- <= 0) {
+ ChangeLocationReal(false);
+ }
}
updateNodes(deltaTimeMillis);
@@ -538,6 +550,8 @@ void ScriptManager::changeLocation(const Location &_newLocation) {
}
void ScriptManager::changeLocation(char _world, char _room, char _node, char _view, uint32 offset) {
+ _changeLocationDelayCycles = 1;
+
_nextLocation.world = _world;
_nextLocation.room = _room;
_nextLocation.node = _node;
diff --git a/engines/zvision/scripting/script_manager.h b/engines/zvision/scripting/script_manager.h
index 66465d2293..34ad7dc6f8 100644
--- a/engines/zvision/scripting/script_manager.h
+++ b/engines/zvision/scripting/script_manager.h
@@ -194,6 +194,7 @@ private:
Location _currentLocation;
Location _nextLocation;
+ int _changeLocationDelayCycles;
uint32 _currentlyFocusedControl;
Commit: 02a1552efea49bc9754eff0ae72a2dd8cdf21bb1
https://github.com/scummvm/scummvm/commit/02a1552efea49bc9754eff0ae72a2dd8cdf21bb1
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2020-08-24T14:15:23+02:00
Commit Message:
ZVISION: Implement indirect addressing in add()
Some ZGI scripts use action:add(14999, [...]) to add to the score.
Without this, it would always add 0 instead. This affected the puzzles
where you use the snapdragon and where you open the first time tunnel.
Changed paths:
engines/zvision/scripting/actions.cpp
engines/zvision/scripting/actions.h
diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp
index 2bf6ed83bb..4dfb7ecd25 100644
--- a/engines/zvision/scripting/actions.cpp
+++ b/engines/zvision/scripting/actions.cpp
@@ -60,13 +60,15 @@ ResultAction::ResultAction(ZVision *engine, int32 slotKey) :
ActionAdd::ActionAdd(ZVision *engine, int32 slotKey, const Common::String &line) :
ResultAction(engine, slotKey) {
_key = 0;
- _value = 0;
- sscanf(line.c_str(), "%u,%d", &_key, &_value);
+ char buf[64];
+ memset(buf, 0, 64);
+ sscanf(line.c_str(), "%u,%s", &_key, buf);
+ _value = new ValueSlot(_scriptManager, buf);
}
bool ActionAdd::execute() {
- _scriptManager->setStateValue(_key, _scriptManager->getStateValue(_key) + _value);
+ _scriptManager->setStateValue(_key, _scriptManager->getStateValue(_key) + _value->getValue());
return true;
}
diff --git a/engines/zvision/scripting/actions.h b/engines/zvision/scripting/actions.h
index fedf388711..5f34428989 100644
--- a/engines/zvision/scripting/actions.h
+++ b/engines/zvision/scripting/actions.h
@@ -63,7 +63,7 @@ public:
private:
uint32 _key;
- int _value;
+ ValueSlot *_value;
};
class ActionAssign : public ResultAction {
More information about the Scummvm-git-logs
mailing list