[Scummvm-cvs-logs] SF.net SVN: scummvm: [33021] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun Jul 13 05:30:15 CEST 2008


Revision: 33021
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33021&view=rev
Author:   peres001
Date:     2008-07-12 20:30:14 -0700 (Sat, 12 Jul 2008)

Log Message:
-----------
Properly implemented the OFF command. The new rendering order for graphics let this mistake finally surface.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/exec.h
    scummvm/trunk/engines/parallaction/exec_ns.cpp

Modified: scummvm/trunk/engines/parallaction/exec.h
===================================================================
--- scummvm/trunk/engines/parallaction/exec.h	2008-07-13 02:37:47 UTC (rev 33020)
+++ scummvm/trunk/engines/parallaction/exec.h	2008-07-13 03:30:14 UTC (rev 33021)
@@ -68,6 +68,8 @@
 	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);

Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-07-13 02:37:47 UTC (rev 33020)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-07-13 03:30:14 UTC (rev 33021)
@@ -254,27 +254,34 @@
 	}
 }
 
+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);
+	}
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list