[Scummvm-cvs-logs] SF.net SVN: scummvm: [24923] scummvm/trunk/engines/scumm

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Dec 25 16:37:21 CET 2006


Revision: 24923
          http://scummvm.svn.sourceforge.net/scummvm/?rev=24923&view=rev
Author:   fingolfin
Date:     2006-12-25 07:37:20 -0800 (Mon, 25 Dec 2006)

Log Message:
-----------
SCUMM: Added ActorC64 subclass of Actor, and added a note stating that _miscflags isn't currently stored (possibly breaking C64 save states). Also reordered some HE specific code

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/actor.cpp
    scummvm/trunk/engines/scumm/actor.h
    scummvm/trunk/engines/scumm/script_c64.cpp
    scummvm/trunk/engines/scumm/scumm.cpp

Modified: scummvm/trunk/engines/scumm/actor.cpp
===================================================================
--- scummvm/trunk/engines/scumm/actor.cpp	2006-12-25 15:03:36 UTC (rev 24922)
+++ scummvm/trunk/engines/scumm/actor.cpp	2006-12-25 15:37:20 UTC (rev 24923)
@@ -51,25 +51,49 @@
 	}
 }
 
-Actor::Actor() {
+Actor::Actor(int id) {
 	assert(_vm != 0);
-	_number = 0;
+	_number = id;
 
 	initActor(-1);
 }
 
 void Actor::initActor(int mode) {
+	// begin HE specific
 	if (mode == -1) {
+		_heSkipLimbs = false;
+		memset(_heTalkQueue, 0, sizeof(_heTalkQueue));
+	}
+
+	if (mode == 1 || mode == -1) {
+		_heCondMask = 1;
+		_heNoTalkAnimation = 0;
+		_heSkipLimbs = false;
+	} else if (mode == 2) {
+		_heCondMask = 1;
+		_heSkipLimbs = false;
+	}
+
+	_heXmapNum = 0;
+	_hePaletteNum = 0;
+	_heFlags = 0;
+	_heTalking = false;
+	// end HE specific
+	
+
+	if (mode == -1) {
 		_offsX = _offsY = 0;
 		_top = _bottom = 0;
-		_needRedraw = _needBgReset = _costumeNeedsInit = _visible = false;
+		_needRedraw = false;
+		_needBgReset = false;
+		_costumeNeedsInit = false;
+		_visible = false;
 		_flip = false;
 		_speedx = 8;
 		_speedy = 2;
 		_frame = 0;
 		_walkbox = 0;
 		_animProgress = 0;
-		_heSkipLimbs = false;
 		_drawToBackBuf = false;
 		memset(_animVariable, 0, sizeof(_animVariable));
 		memset(_palette, 0, sizeof(_palette));
@@ -78,27 +102,18 @@
 		memset(&_walkdata, 0, sizeof(ActorWalkData));
 		_walkdata.point3.x = 32000;
 		_walkScript = 0;
-		memset(_heTalkQueue, 0, sizeof(_heTalkQueue));
-		_miscflags = 0;
-
-		mode = 1;
 	}
 
-	if (mode == 1) {
+	if (mode == 1 || mode == -1) {
 		_costume = 0;
 		_room = 0;
 		_pos.x = 0;
 		_pos.y = 0;
 		_facing = 180;
-		_heCondMask = 1;
-		_heNoTalkAnimation = 0;
 		if (_vm->_game.version >= 7)
 			_visible = false;
-		_heSkipLimbs = false;
 	} else if (mode == 2) {
 		_facing = 180;
-		_heCondMask = 1;
-		_heSkipLimbs = false;
 	}
 	_elevation = 0;
 	_width = 24;
@@ -110,12 +125,11 @@
 	memset(_sound, 0, sizeof(_sound));
 	_targetFacing = _facing;
 
-	stopActorMoving();
-
-	_heXmapNum = 0;
 	_shadowMode = 0;
 	_layer = 0;
 
+	stopActorMoving();
+
 	setActorWalkSpeed(8, 2);
 	_animSpeed = 0;
 	if (_vm->_game.version >= 6)
@@ -146,15 +160,12 @@
 		_talkStopFrame = 5;
 	}
 
-	_heTalking = false;
 	_walkScript = 0;
 	_talkScript = 0;
 
 	_clipOverride = _vm->_actorClipOverride;
 
 	_auxBlock.reset();
-	_hePaletteNum = 0;
-	_heFlags = 0;
 
 	_vm->_classData[_number] = (_vm->_game.version >= 7) ? _vm->_classData[0] : 0;
 }

Modified: scummvm/trunk/engines/scumm/actor.h
===================================================================
--- scummvm/trunk/engines/scumm/actor.h	2006-12-25 15:03:36 UTC (rev 24922)
+++ scummvm/trunk/engines/scumm/actor.h	2006-12-25 15:37:20 UTC (rev 24923)
@@ -127,9 +127,6 @@
 	uint16 _sound[32];
 	CostumeData _cost;
 
-	/* C64 maniac specific */
-	byte _miscflags;
-
 	/* HE specific */
 	bool _heNoTalkAnimation;
 	bool _heSkipLimbs;
@@ -179,13 +176,14 @@
 
 public:
 
-	Actor();
+	Actor(int id);
+	virtual ~Actor() {}
 
 //protected:
 	void hideActor();
 	void showActor();
 
-	void initActor(int mode);
+	virtual void initActor(int mode);
 
 	void putActor() {
 		putActor(_pos.x, _pos.y, _room);
@@ -320,6 +318,24 @@
 	void findPathTowardsOld(byte box, byte box2, byte box3, Common::Point &p2, Common::Point &p3);
 };
 
+class ActorC64 : public Actor {
+public:
+	// FIXME: This flag is never saved, which might lead to broken save states.
+	byte _miscflags;
+
+public:
+	ActorC64(int id) : Actor(id) {}
+	virtual void initActor(int mode) {
+		if (mode == -1) {
+			_miscflags = 0;
+		}
+	}
+
+protected:
+	
+};
+
+
 } // End of namespace Scumm
 
 #endif

Modified: scummvm/trunk/engines/scumm/script_c64.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_c64.cpp	2006-12-25 15:03:36 UTC (rev 24922)
+++ scummvm/trunk/engines/scumm/script_c64.cpp	2006-12-25 15:37:20 UTC (rev 24923)
@@ -791,7 +791,7 @@
 	byte mask = getVarOrDirectByte(PARAM_2);
 	byte mod = getVarOrDirectByte(PARAM_3);
 
-	Actor *a = derefActor(act, "o_setActorBitVar");
+	ActorC64 *a = (ActorC64 *)derefActor(act, "o_setActorBitVar");
 	if (mod)
 		a->_miscflags |= mask;
 	else
@@ -805,7 +805,7 @@
 	byte act = getVarOrDirectByte(PARAM_1);
 	byte mask = getVarOrDirectByte(PARAM_2);
 
-	Actor *a = derefActor(act, "o_getActorBitVar");
+	ActorC64 *a = (ActorC64 *)derefActor(act, "o_getActorBitVar");
 	setResult((a->_miscflags & mask) ? 1 : 0);
 
 	debug(0, "o_getActorBitVar(%d, %d, %d)", act, mask, (a->_miscflags & mask));

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2006-12-25 15:03:36 UTC (rev 24922)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2006-12-25 15:37:20 UTC (rev 24923)
@@ -1246,8 +1246,10 @@
 	_actors = new Actor * [_numActors];
 	_sortedActors = new Actor * [_numActors];
 	for (i = 0; i < _numActors; ++i) {
-		_actors[i] = new Actor();
-		_actors[i]->_number = i;
+		if (_game.version == 0)
+			_actors[i] = new ActorC64(i);
+		else
+			_actors[i] = new Actor(i);
 		_actors[i]->initActor(1);
 
 		// this is from IDB


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