[Scummvm-cvs-logs] scummvm master -> 25513893044032b2595992936e1e6011889197fd

wjp wjp at usecode.org
Wed Jun 22 00:03:20 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2551389304 DREAMWEB: Fix bug in tasmrecover causing load/save mixup


Commit: 25513893044032b2595992936e1e6011889197fd
    https://github.com/scummvm/scummvm/commit/25513893044032b2595992936e1e6011889197fd
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-06-21T15:00:56-07:00

Commit Message:
DREAMWEB: Fix bug in tasmrecover causing load/save mixup

This is a regression from c1b9adb6912 and (my commit) 287c23f1263c.

It is not safe to remove opcodes from proc.stmts since labels
are sometimes referenced by their offset in the list. So, instead
they are now replaced by op._nop.

This fixes kLoadingorsave not being set in doload(), which was
visible when going to the load game menu from the startup menu.

Changed paths:
    devtools/tasmrecover/tasm/proc.py
    engines/dreamweb/dreamgen.cpp
    engines/dreamweb/dreamgen.h



diff --git a/devtools/tasmrecover/tasm/proc.py b/devtools/tasmrecover/tasm/proc.py
index c127c40..ed7053d 100644
--- a/devtools/tasmrecover/tasm/proc.py
+++ b/devtools/tasmrecover/tasm/proc.py
@@ -23,9 +23,9 @@ class proc:
 			self.labels.remove(label)
 		except:
 			pass
-		for l in self.stmts:
-			if isinstance(l, op.label) and l.name == label:
-				self.stmts.remove(l)
+		for i in xrange(len(self.stmts)):
+			if isinstance(self.stmts[i], op.label) and self.stmts[i].name == label:
+				self.stmts[i] = op._nop(None)
 				return
 	
 	def optimize_sequence(self, cls):
@@ -48,7 +48,8 @@ class proc:
 			n = j - i
 			if n > 1:
 				print "Eliminate consequtive storage instructions at %u-%u" %(i, j)
-				del stmts[i + 1:j]
+				for k in range(i+1,j):
+					stmts[k] = op._nop(None)
 				stmts[i].repeat = n
 			else:
 				i = j
@@ -63,7 +64,7 @@ class proc:
 			if isinstance(stmts[i + 1], cls):
 				stmts[i + 1].repeat = 'cx'
 				stmts[i + 1].clear_cx = True
-				del stmts[i]
+				stmts[i] = op._nop(None)
 			i += 1
 		return
 	
@@ -78,7 +79,7 @@ class proc:
 			if not isinstance(self.stmts[i], op.label):
 				continue
 			j = i
-			while j < len(self.stmts) and isinstance(self.stmts[j], op.label):
+			while j < len(self.stmts) and isinstance(self.stmts[j], (op.label, op._nop)):
 				j += 1
 			if j == len(self.stmts) or isinstance(self.stmts[j], op._ret):
 				print "Return label: %s" % (self.stmts[i].name,)
@@ -121,18 +122,14 @@ class proc:
 				print self.labels
 				self.remove_label(s.name)
 
-		#removing duplicate rets
-		i = 0
-		while i < len(self.stmts)-1:
-			if isinstance(self.stmts[i], op._ret) and isinstance(self.stmts[i+1], op._ret):
-				del self.stmts[i]
-			else:
-				i += 1
-
-		#removing last ret
-		while len(self.stmts) > 0 and isinstance(self.stmts[-1], op._ret) and (len(self.stmts) < 2 or not isinstance(self.stmts[-2], op.label)):
-			print "stripping last ret"
-			self.stmts.pop()
+		#removing duplicate rets and rets at end
+		for i in xrange(len(self.stmts)):
+			if isinstance(self.stmts[i], op._ret):
+				j = i+1
+				while j < len(self.stmts) and isinstance(self.stmts[j], op._nop):
+					j += 1
+				if j == len(self.stmts) or isinstance(self.stmts[j], op._ret):
+					self.stmts[i] = op._nop(None)
 
 		self.optimize_sequence(op._stosb);
 		self.optimize_sequence(op._stosw);
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 9349436..da0d71f 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -13226,7 +13226,7 @@ void DreamGenContext::useaxe() {
 	return;
 notinpool:
 	showfirstuse();
-/*continuing to unbounded code: axeondoor from useelvdoor:19-29*/
+/*continuing to unbounded code: axeondoor from useelvdoor:19-30*/
 axeondoor:
 	al = 15;
 	cx = 300;
@@ -16886,6 +16886,7 @@ alreadynewgame:
 
 void DreamGenContext::doload() {
 	STACK_CHECK;
+	data.byte(kLoadingorsave) = 1;
 	showopbox();
 	showloadops();
 	data.byte(kCurrentslot) = 0;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 2d05f9c..b012663 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -600,6 +600,7 @@ public:
 	void clearbuffers();
 	void neterror();
 	void storeit();
+	void lockeddoorway();
 	void isitworn();
 	void putundertimed();
 	void dumpmap();
@@ -954,8 +955,9 @@ public:
 	void showmonk();
 	void diarykeyn();
 	void set16colpalette();
-	void sparky();
+	void convicons();
 	void interviewer();
+	void sparky();
 	void purgeanitem();
 	void madman();
 	void createpanel();
@@ -1250,14 +1252,12 @@ public:
 	void usechurchgate();
 	void monkandryan();
 	void allocatebuffers();
-	void convicons();
 	void swapwithinv();
 	void usecontrol();
 	void buttonseven();
 	void redrawmainscrn();
 	void finishedwalking();
 	void findallryan();
-	void lockeddoorway();
 	void channel0tran();
 	void buttonpress();
 	void parseblaster();






More information about the Scummvm-git-logs mailing list