[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.309,1.310 saveload.h,1.44,1.45 saveload.cpp,1.179,1.180

Max Horn fingolfin at users.sourceforge.net
Thu Oct 7 14:24:21 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2474

Modified Files:
	actor.cpp saveload.h saveload.cpp 
Log Message:
Another attempt at a fix for bug #1032964 (INDY3-VGA: actors walking in wrong places), by making sure all actor walkdata is saved

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.309
retrieving revision 1.310
diff -u -d -r1.309 -r1.310
--- actor.cpp	5 Oct 2004 14:05:23 -0000	1.309
+++ actor.cpp	7 Oct 2004 21:23:29 -0000	1.310
@@ -46,31 +46,36 @@
 
 Actor::Actor() {
 	assert(_vm != 0);
-	_offsX = _offsY = 0;
-	top = bottom = 0;
 	number = 0;
-	needRedraw = needBgReset = costumeNeedsInit = visible = false;
-	flip = false;
-	speedx = 8;
-	speedy = 2;
-	frame = 0;
-	_walkbox = 0;
-	animProgress = 0;
-	skipLimb = false;
-	drawToBackBuf = false;
-	memset(animVariable, 0, sizeof(animVariable));
-	memset(palette, 0, sizeof(palette));
-	memset(sound, 0, sizeof(sound));
-	memset(&cost, 0, sizeof(CostumeData));
-	memset(&walkdata, 0, sizeof(ActorWalkData));
-	walkdata.point3.x = 32000;
-	walkScript = 0;
-	memset(talkQueue, 0, sizeof(talkQueue));
 
-	initActor(1);
+	initActor(-1);
 }
 
 void Actor::initActor(int mode) {
+	if (mode == -1) {
+		_offsX = _offsY = 0;
+		top = bottom = 0;
+		needRedraw = needBgReset = costumeNeedsInit = visible = false;
+		flip = false;
+		speedx = 8;
+		speedy = 2;
+		frame = 0;
+		_walkbox = 0;
+		animProgress = 0;
+		skipLimb = false;
+		drawToBackBuf = false;
+		memset(animVariable, 0, sizeof(animVariable));
+		memset(palette, 0, sizeof(palette));
+		memset(sound, 0, sizeof(sound));
+		memset(&cost, 0, sizeof(CostumeData));
+		memset(&walkdata, 0, sizeof(ActorWalkData));
+		walkdata.point3.x = 32000;
+		walkScript = 0;
+		memset(talkQueue, 0, sizeof(talkQueue));
+		
+		mode = 1;
+	}
+
 	if (mode == 1) {
 		costume = 0;
 		room = 0;
@@ -2055,6 +2060,9 @@
 		MKLINE(Actor, walkdata.deltaYFactor, sleInt32, VER(8)),
 		MKLINE(Actor, walkdata.xfrac, sleUint16, VER(8)),
 		MKLINE(Actor, walkdata.yfrac, sleUint16, VER(8)),
+
+		MKLINE(Actor, walkdata.point3.x, sleUint16, VER(42)),
+		MKLINE(Actor, walkdata.point3.y, sleUint16, VER(42)),
 	
 		MKARRAY(Actor, cost.active[0], sleByte, 16, VER(8)),
 		MKLINE(Actor, cost.stopped, sleUint16, VER(8)),

Index: saveload.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- saveload.h	2 Oct 2004 10:58:15 -0000	1.44
+++ saveload.h	7 Oct 2004 21:23:29 -0000	1.45
@@ -32,7 +32,7 @@
 // Can be useful for other ports too :)
 
 #define VER(x) x
-#define CURRENT_VER 41
+#define CURRENT_VER 42
 
 // To work around a warning in GCC 3.2 (and 3.1 ?) regarding non-POD types,
 // we use a small trick: instead of 0 we use 42. Why? Well, it seems newer GCC

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -d -r1.179 -r1.180
--- saveload.cpp	3 Oct 2004 10:02:32 -0000	1.179
+++ saveload.cpp	7 Oct 2004 21:23:29 -0000	1.180
@@ -707,6 +707,13 @@
 		_system->warpMouse(_mouse.x, _mouse.y);
 	}
 
+	if (s->isLoading()) {
+		// Not all actor data is saved; so when loading, we first reset
+		// all actors, to ensure completely reproducible behaviour (else,
+		// some not saved value in the actor class can cause odd things)
+		for (i = 0; i < _numActors; i++)
+			_actors[i].initActor(-1);
+	}
 	s->saveLoadArrayOf(_actors, _numActors, sizeof(_actors[0]), actorEntries);
 	s->saveLoadEntries(_sound, soundEntries);
 





More information about the Scummvm-git-logs mailing list