aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2008-07-13 03:30:14 +0000
committerNicola Mettifogo2008-07-13 03:30:14 +0000
commit9c2d96530be10b2f8badb500330f744bd6cdc937 (patch)
tree129223b4efe0ec44f9a1421c5f8a67541a0de3b1
parent5de579930d9ff33c2e7eeb1c267d3ef61227e558 (diff)
downloadscummvm-rg350-9c2d96530be10b2f8badb500330f744bd6cdc937.tar.gz
scummvm-rg350-9c2d96530be10b2f8badb500330f744bd6cdc937.tar.bz2
scummvm-rg350-9c2d96530be10b2f8badb500330f744bd6cdc937.zip
Properly implemented the OFF command. The new rendering order for graphics let this mistake finally surface.
svn-id: r33021
-rw-r--r--engines/parallaction/exec.h2
-rw-r--r--engines/parallaction/exec_ns.cpp27
2 files changed, 19 insertions, 10 deletions
diff --git a/engines/parallaction/exec.h b/engines/parallaction/exec.h
index f41ce52302..887d6be526 100644
--- a/engines/parallaction/exec.h
+++ b/engines/parallaction/exec.h
@@ -68,6 +68,8 @@ class CommandExec_ns : public CommandExec {
Parallaction_ns *_vm;
protected:
+ void updateGetZone(ZonePtr z, bool visible);
+
DECLARE_UNQUALIFIED_COMMAND_OPCODE(invalid);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(set);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(clear);
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp
index 9a93197f04..4ee0aca6c1 100644
--- a/engines/parallaction/exec_ns.cpp
+++ b/engines/parallaction/exec_ns.cpp
@@ -254,27 +254,34 @@ DECLARE_COMMAND_OPCODE(close) {
}
}
+void CommandExec_ns::updateGetZone(ZonePtr z, bool visible) {
+ if (!z) {
+ return;
+ }
+
+ if ((z->_type & 0xFFFF) == kZoneGet) {
+ _vm->_gfx->showGfxObj(z->u.get->gfxobj, visible);
+ }
+}
DECLARE_COMMAND_OPCODE(on) {
ZonePtr z = _ctxt.cmd->u._zone;
- // WORKAROUND: the original DOS-based engine didn't check u->_zone before dereferencing
- // the pointer to get structure members, thus leading to crashes in systems with memory
- // protection.
- // As a side note, the overwritten address is the 5th entry in the DOS interrupt table
- // (print screen handler): this suggests that a system would hang when the print screen
- // key is pressed after playing Nippon Safes, provided that this code path is taken.
+
if (z) {
z->_flags &= ~kFlagsRemove;
z->_flags |= kFlagsActive;
- if ((z->_type & 0xFFFF) == kZoneGet) {
- _vm->_gfx->showGfxObj(z->u.get->gfxobj, true);
- }
+ updateGetZone(z, true);
}
}
DECLARE_COMMAND_OPCODE(off) {
- _ctxt.cmd->u._zone->_flags |= kFlagsRemove;
+ ZonePtr z = _ctxt.cmd->u._zone;
+
+ if (z) {
+ _ctxt.cmd->u._zone->_flags |= kFlagsRemove;
+ updateGetZone(z, false);
+ }
}