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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Sep 25 12:11:06 CEST 2008


Revision: 34648
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34648&view=rev
Author:   fingolfin
Date:     2008-09-25 10:11:06 +0000 (Thu, 25 Sep 2008)

Log Message:
-----------
SCUMM: Moved more stuf from class Actor to ActorHE

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/actor.cpp
    scummvm/trunk/engines/scumm/actor.h
    scummvm/trunk/engines/scumm/akos.cpp
    scummvm/trunk/engines/scumm/he/intern_he.h
    scummvm/trunk/engines/scumm/he/script_v71he.cpp
    scummvm/trunk/engines/scumm/he/script_v90he.cpp

Modified: scummvm/trunk/engines/scumm/actor.cpp
===================================================================
--- scummvm/trunk/engines/scumm/actor.cpp	2008-09-25 08:19:51 UTC (rev 34647)
+++ scummvm/trunk/engines/scumm/actor.cpp	2008-09-25 10:11:06 UTC (rev 34648)
@@ -881,9 +881,9 @@
 		_vm->stopTalk();
 	}
 
-	// WORKAROUND: The green transparency of the tank in the Hall of Oddities is
-	// is positioned one pixel too far to the left. This appears to be a
-	// bug in the original game as well.
+	// WORKAROUND: The green transparency of the tank in the Hall of Oddities
+	// is positioned one pixel too far to the left. This appears to be a bug
+	// in the original game as well.
 	if (_vm->_game.id == GID_SAMNMAX && newRoom == 16 && _number == 5 && dstX == 235 && dstY == 236)
 		dstX++;
 
@@ -906,7 +906,7 @@
 		} else {
 #ifdef ENABLE_HE
 			if (_vm->_game.heversion >= 71)
-				((ScummEngine_v71he *)_vm)->queueAuxBlock(this);
+				((ScummEngine_v71he *)_vm)->queueAuxBlock((ActorHE *)this);
 #endif
 			hideActor();
 		}
@@ -1210,6 +1210,10 @@
 	_cost.soundCounter = 0;
 	_needRedraw = false;
 	_needBgReset = true;
+}
+
+void ActorHE::hideActor() {
+	Actor::hideActor();
 	_auxBlock.reset();
 }
 
@@ -1633,13 +1637,15 @@
 
 		if (isInCurrentRoom() && _costume != 0) {
 			_animProgress = 0;
+			_needRedraw = true;
 			_cost.animCounter = 0;
-			_needRedraw = true;
 			// V1 - V2 games don't seem to need a _cost.reset() at this point.
 			// Causes Zak to lose his body in several scenes, see bug #771508
 			if (_vm->_game.version >= 3 && f == _initFrame) {
 				_cost.reset();
-				_auxBlock.reset();
+				if (_vm->_game.heversion != 0) {
+				((ActorHE *)this)->_auxBlock.reset();
+				}
 			}
 			_vm->_costumeLoader->costumeDecodeData(this, f, (uint) - 1);
 			_frame = f;
@@ -1780,7 +1786,7 @@
 		clearGfxUsageBit(strip, USAGE_BIT_DIRTY);
 		clearGfxUsageBit(strip, USAGE_BIT_RESTORED);
 		for (j = 1; j < _numActors; j++) {
-			if (_actors[j]->_heFlags & 1)
+			if (_game.heversion != 0 && ((ActorHE *)_actors[j])->_heFlags & 1)
 				continue;
 
 			if (testGfxUsageBit(strip, j) &&
@@ -1958,7 +1964,8 @@
 				stopTalk();
 			}
 			setTalkingActor(a->_number);
-			a->_heTalking = true;
+			if (_game.heversion != 0)
+				((ActorHE *)a)->_heTalking = true;
 			if (!_string[0].no_talk_anim) {
 				a->runActorTalkScript(a->_talkStartFrame);
 				_useTalkAnims = true;
@@ -2031,7 +2038,8 @@
 		}
 		if (_game.version <= 7 && _game.heversion == 0)
 			setTalkingActor(0xFF);
-		a->_heTalking = false;
+		if (_game.heversion != 0)
+			((ActorHE *)a)->_heTalking = false;
 	}
 
 	if (_game.id == GID_DIG || _game.id == GID_CMI) {
@@ -2057,9 +2065,7 @@
 #pragma mark -
 
 
-void Actor::setActorCostume(int c) {
-	int i;
-
+void ActorHE::setActorCostume(int c) {
 	if (_vm->_game.heversion >= 61 && (c == -1  || c == -2)) {
 		_heSkipLimbs = (c == -1);
 		_needRedraw = true;
@@ -2071,27 +2077,43 @@
 	if (_vm->_game.heversion == 61)
 		c &= 0xff;
 
-	_costumeNeedsInit = true;
-
 	if (_vm->_game.features & GF_NEW_COSTUMES) {
-		memset(_animVariable, 0, sizeof(_animVariable));
-
 #ifdef ENABLE_HE
 		if (_vm->_game.heversion >= 71)
 			((ScummEngine_v71he *)_vm)->queueAuxBlock(this);
 #endif
+		_auxBlock.reset();
+		if (_visible) {
+			if (_vm->_game.heversion >= 60)
+				_needRedraw = true;
+		}
+	}
 
+	Actor::setActorCostume(c);
+
+	if (_vm->_game.heversion >= 71 && _vm->getTalkingActor() == _number) {
+		if (_vm->_game.heversion <= 95 || (_vm->_game.heversion >= 98 && _vm->VAR(_vm->VAR_SKIP_RESET_TALK_ACTOR) == 0)) {
+			_vm->setTalkingActor(0);
+		}
+	}
+}
+
+void Actor::setActorCostume(int c) {
+	int i;
+
+	_costumeNeedsInit = true;
+
+	if (_vm->_game.features & GF_NEW_COSTUMES) {
+		memset(_animVariable, 0, sizeof(_animVariable));
+
 		_costume = c;
 		_cost.reset();
-		_auxBlock.reset();
 
 		if (_visible) {
 			if (_costume) {
 				_vm->ensureResourceLoaded(rtCostume, _costume);
 			}
 			startAnimActor(_initFrame);
-			if (_vm->_game.heversion >= 60)
-				_needRedraw = true;
 		}
 	} else {
 		if (_visible) {
@@ -2126,12 +2148,6 @@
 		for (i = 0; i < 32; i++)
 			_palette[i] = 0xFF;
 	}
-
-	if (_vm->_game.heversion >= 71 && _vm->getTalkingActor() == _number) {
-		if (_vm->_game.heversion <= 95 || (_vm->_game.heversion >= 98 && _vm->VAR(_vm->VAR_SKIP_RESET_TALK_ACTOR) == 0)) {
-			_vm->setTalkingActor(0);
-		}
-	}
 }
 
 static const char* v0ActorNames[7] = {
@@ -2267,7 +2283,7 @@
 	return _vm->VAR(42) <= _number && _number <= _vm->VAR(43);
 }
 
-void Actor::setHEFlag(int bit, int set) {
+void ActorHE::setHEFlag(int bit, int set) {
 	// Note that condition is inverted
 	if (!set) {
 		_heFlags |= bit;
@@ -2276,7 +2292,7 @@
 	}
 }
 
-void Actor::setUserCondition(int slot, int set) {
+void ActorHE::setUserCondition(int slot, int set) {
 	const int condMaskCode = (_vm->_game.heversion >= 85) ? 0x1FFF : 0x3FF;
 	assertRange(1, slot, 32, "setUserCondition: Condition");
 	if (set == 0) {
@@ -2291,12 +2307,12 @@
 	}
 }
 
-bool Actor::isUserConditionSet(int slot) const {
+bool ActorHE::isUserConditionSet(int slot) const {
 	assertRange(1, slot, 32, "isUserConditionSet: Condition");
 	return (_heCondMask & (1 << (slot + 0xF))) != 0;
 }
 
-void Actor::setTalkCondition(int slot) {
+void ActorHE::setTalkCondition(int slot) {
 	const int condMaskCode = (_vm->_game.heversion >= 85) ? 0x1FFF : 0x3FF;
 	assertRange(1, slot, 32, "setTalkCondition: Condition");
 	_heCondMask = (_heCondMask & ~condMaskCode) | 1;
@@ -2310,7 +2326,7 @@
 	}
 }
 
-bool Actor::isTalkConditionSet(int slot) const {
+bool ActorHE::isTalkConditionSet(int slot) const {
 	assertRange(1, slot, 32, "isTalkConditionSet: Condition");
 	return (_heCondMask & (1 << (slot - 1))) != 0;
 }
@@ -2400,7 +2416,7 @@
 	_auxEntriesNum = 0;
 }
 
-void ScummEngine_v71he::queueAuxBlock(Actor *a) {
+void ScummEngine_v71he::queueAuxBlock(ActorHE *a) {
 	if (!a->_auxBlock.visible)
 		return;
 

Modified: scummvm/trunk/engines/scumm/actor.h
===================================================================
--- scummvm/trunk/engines/scumm/actor.h	2008-09-25 08:19:51 UTC (rev 34647)
+++ scummvm/trunk/engines/scumm/actor.h	2008-09-25 10:11:06 UTC (rev 34648)
@@ -61,6 +61,7 @@
 	uint16 end[16];
 	uint16 frame[16];
 
+	/* HE specific */
 	uint16 heJumpOffsetTable[16];
 	uint16 heJumpCountTable[16];
 	uint32 heCondMaskTable[16];
@@ -133,28 +134,12 @@
 	CostumeData _cost;
 
 	/* HE specific */
-
-	/** This rect is used to clip actor drawing. */
-	Common::Rect _clipOverride;
-
 	int _heOffsX, _heOffsY;
-	bool _heNoTalkAnimation;
 	bool _heSkipLimbs;
-	bool _heTalking;
 	uint32 _heCondMask;
 	uint32 _hePaletteNum;
 	uint32 _heXmapNum;
-	byte _heFlags;
 
-	AuxBlock _auxBlock;
-
-	struct {
-		int16 posX;
-		int16 posY;
-		int16 color;
-		byte sentence[128];
-	} _heTalkQueue[16];
-
 protected:
 	struct ActorWalkData {
 		Common::Point dest;           // Final destination point
@@ -188,7 +173,7 @@
 	virtual ~Actor() {}
 
 //protected:
-	void hideActor();
+	virtual void hideActor();
 	void showActor();
 
 	virtual void initActor(int mode);
@@ -227,7 +212,7 @@
 	void drawActorCostume(bool hitTestMode = false);
 	virtual void prepareDrawActorCostume(BaseCostumeRenderer *bcr);
 	void animateCostume();
-	void setActorCostume(int c);
+	virtual void setActorCostume(int c);
 
 	void animateLimb(int limb, int f);
 
@@ -318,14 +303,6 @@
 
 	void classChanged(int cls, bool value);
 
-	void setHEFlag(int bit, int set);
-
-	void setUserCondition(int slot, int set);
-	bool isUserConditionSet(int slot) const;
-
-	void setTalkCondition(int slot);
-	bool isTalkConditionSet(int slot) const;
-
 	// Used by the save/load system:
 	void saveLoadWithSerializer(Serializer *ser);
 
@@ -342,10 +319,39 @@
 	ActorHE(ScummEngine *scumm, int id) : Actor(scumm, id) {}
 
 	virtual void initActor(int mode);
+
+	virtual void hideActor();
+
 	void drawActorToBackBuf(int x, int y);
 
-protected:
+	void setHEFlag(int bit, int set);
+
+	void setUserCondition(int slot, int set);
+	bool isUserConditionSet(int slot) const;
+
+	void setTalkCondition(int slot);
+	bool isTalkConditionSet(int slot) const;
+
+public:
+	/** This rect is used to clip actor drawing. */
+	Common::Rect _clipOverride;
+
+	bool _heNoTalkAnimation;
+	bool _heTalking;
+	byte _heFlags;
+
+	AuxBlock _auxBlock;
+
+	struct {
+		int16 posX;
+		int16 posY;
+		int16 color;
+		byte sentence[128];
+	} _heTalkQueue[16];
+
+
 	virtual void prepareDrawActorCostume(BaseCostumeRenderer *bcr);
+	virtual void setActorCostume(int c);
 };
 
 class Actor_v3 : public Actor {

Modified: scummvm/trunk/engines/scumm/akos.cpp
===================================================================
--- scummvm/trunk/engines/scumm/akos.cpp	2008-09-25 08:19:51 UTC (rev 34647)
+++ scummvm/trunk/engines/scumm/akos.cpp	2008-09-25 10:11:06 UTC (rev 34648)
@@ -1664,28 +1664,28 @@
 			akos_queCommand(9, a, a->_sound[a->getAnimVar(GB(2))], 0);
 			continue;
 		case AKC_C045:
-			a->setUserCondition(GB(3), a->getAnimVar(GB(4)));
+			((ActorHE *)a)->setUserCondition(GB(3), a->getAnimVar(GB(4)));
 			continue;
 		case AKC_C046:
-			a->setAnimVar(GB(4), a->isUserConditionSet(GB(3)));
+			a->setAnimVar(GB(4), ((ActorHE *)a)->isUserConditionSet(GB(3)));
 			continue;
 		case AKC_C047:
-			a->setTalkCondition(GB(3));
+			((ActorHE *)a)->setTalkCondition(GB(3));
 			continue;
 		case AKC_C048:
-			a->setAnimVar(GB(4), a->isTalkConditionSet(GB(3)));
+			a->setAnimVar(GB(4), ((ActorHE *)a)->isTalkConditionSet(GB(3)));
 			continue;
 		case AKC_C0A0:
 			akos_queCommand(8, a, GB(2), 0);
 			continue;
 		case AKC_C0A1:
-			if (a->_heTalking != 0) {
+			if (((ActorHE *)a)->_heTalking != 0) {
 				curpos = GUW(2);
 				break;
 			}
 			continue;
 		case AKC_C0A2:
-			if (a->_heTalking == 0) {
+			if (((ActorHE *)a)->_heTalking == 0) {
 				curpos = GUW(2);
 				break;
 			}
@@ -1775,13 +1775,13 @@
 		case 8:
 			_actorToPrintStrFor = a->_number;
 
-			a->_talkPosX = a->_heTalkQueue[param_1].posX;
-			a->_talkPosY = a->_heTalkQueue[param_1].posY;
-			a->_talkColor = a->_heTalkQueue[param_1].color;
+			a->_talkPosX = ((ActorHE *)a)->_heTalkQueue[param_1].posX;
+			a->_talkPosY = ((ActorHE *)a)->_heTalkQueue[param_1].posY;
+			a->_talkColor = ((ActorHE *)a)->_heTalkQueue[param_1].color;
 
 			_string[0].loadDefault();
 			_string[0].color = a->_talkColor;
-			actorTalk(a->_heTalkQueue[param_1].sentence);
+			actorTalk(((ActorHE *)a)->_heTalkQueue[param_1].sentence);
 
 			break;
 		case 9:

Modified: scummvm/trunk/engines/scumm/he/intern_he.h
===================================================================
--- scummvm/trunk/engines/scumm/he/intern_he.h	2008-09-25 08:19:51 UTC (rev 34647)
+++ scummvm/trunk/engines/scumm/he/intern_he.h	2008-09-25 10:11:06 UTC (rev 34648)
@@ -39,6 +39,7 @@
 
 namespace Scumm {
 
+class ActorHE;
 class ResExtractor;
 #ifdef ENABLE_HE
 class LogicHE;
@@ -243,7 +244,7 @@
 	AuxEntry _auxEntries[16];
 	uint16 _auxEntriesNum;
 
-	void queueAuxBlock(Actor *a);
+	void queueAuxBlock(ActorHE *a);
 	void queueAuxEntry(int actorNum, int subIndex);
 
 	void remapHEPalette(const uint8 *src, uint8 *dst);

Modified: scummvm/trunk/engines/scumm/he/script_v71he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v71he.cpp	2008-09-25 08:19:51 UTC (rev 34647)
+++ scummvm/trunk/engines/scumm/he/script_v71he.cpp	2008-09-25 10:11:06 UTC (rev 34648)
@@ -498,7 +498,7 @@
 void ScummEngine_v71he::o71_kernelSetFunctions() {
 	int args[29];
 	int num;
-	Actor *a;
+	ActorHE *a;
 
 	num = getStackList(args, ARRAYSIZE(args));
 
@@ -509,7 +509,7 @@
 		virtScreenLoad(args[1], args[2], args[3], args[4], args[5]);
 		break;
 	case 20: // HE72+
-		a = derefActor(args[1], "o71_kernelSetFunctions: 20");
+		a = (ActorHE *)derefActor(args[1], "o71_kernelSetFunctions: 20");
 		((ScummEngine_v71he *)this)->queueAuxBlock(a);
 		break;
 	case 21:
@@ -531,14 +531,14 @@
 		redrawAllActors();
 		break;
 	case 26:
-		a = derefActor(args[1], "o71_kernelSetFunctions: 26");
+		a = (ActorHE *)derefActor(args[1], "o71_kernelSetFunctions: 26");
 		a->_auxBlock.r.left = 0;
 		a->_auxBlock.r.right = -1;
 		a->_auxBlock.r.top = 0;
 		a->_auxBlock.r.bottom = -2;
 		break;
 	case 30:
-		a = derefActor(args[1], "o71_kernelSetFunctions: 30");
+		a = (ActorHE *)derefActor(args[1], "o71_kernelSetFunctions: 30");
 		a->_clipOverride.bottom = args[2];
 		break;
 	case 42:

Modified: scummvm/trunk/engines/scumm/he/script_v90he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v90he.cpp	2008-09-25 08:19:51 UTC (rev 34647)
+++ scummvm/trunk/engines/scumm/he/script_v90he.cpp	2008-09-25 10:11:06 UTC (rev 34648)
@@ -1615,13 +1615,13 @@
 }
 
 void ScummEngine_v90he::o90_getActorData() {
-	Actor *a;
+	ActorHE *a;
 
 	int subOp = pop();
 	int val = pop();
 	int act = pop();
 
-	a = derefActor(act, "o90_getActorData");
+	a = (ActorHE *)derefActor(act, "o90_getActorData");
 
 	switch (subOp) {
 	case 1:
@@ -2568,13 +2568,13 @@
 void ScummEngine_v90he::o90_kernelSetFunctions() {
 	int args[29];
 	int num, tmp;
-	Actor *a;
+	ActorHE *a;
 
 	num = getStackList(args, ARRAYSIZE(args));
 
 	switch (args[0]) {
 	case 20:
-		a = derefActor(args[1], "o90_kernelSetFunctions: 20");
+		a = (ActorHE *)derefActor(args[1], "o90_kernelSetFunctions: 20");
 		queueAuxBlock(a);
 		break;
 	case 21:
@@ -2616,7 +2616,7 @@
 		// Remote start script function
 		break;
 	case 1969:
-		a = derefActor(args[1], "o90_kernelSetFunctions: 1969");
+		a = (ActorHE *)derefActor(args[1], "o90_kernelSetFunctions: 1969");
 		tmp = a->_heCondMask;
 		tmp ^= args[2];
 		tmp &= 0x7FFF0000;


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