[Scummvm-cvs-logs] scummvm master -> ee4699a49557ab47a4c6660ce97e968676bb5f8b

lordhoto lordhoto at gmail.com
Mon Apr 11 00:22:30 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:
ee4699a495 KYRA: Get rid of non-const static variables in HoF.


Commit: ee4699a49557ab47a4c6660ce97e968676bb5f8b
    https://github.com/scummvm/scummvm/commit/ee4699a49557ab47a4c6660ce97e968676bb5f8b
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-04-10T15:21:18-07:00

Commit Message:
KYRA: Get rid of non-const static variables in HoF.

Changed paths:
    engines/kyra/kyra_hof.cpp
    engines/kyra/kyra_hof.h



diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index 990e55b..4fef760 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -87,7 +87,9 @@ KyraEngine_HoF::KyraEngine_HoF(OSystem *system, const GameFlags &flags) : KyraEn
 	_pathfinderFlag = 0;
 	_mouseX = _mouseY = 0;
 
+	_nextIdleAnim = 0;
 	_lastIdleScript = -1;
+	_useSceneIdleAnim = false;
 
 	_currentTalkSections.STATim = 0;
 	_currentTalkSections.TLKTim = 0;
@@ -145,6 +147,11 @@ KyraEngine_HoF::KyraEngine_HoF(OSystem *system, const GameFlags &flags) : KyraEn
 	_menu = 0;
 	_chatIsNote = false;
 	memset(&_npcScriptData, 0, sizeof(_npcScriptData));
+
+	_setCharPalFinal = false;
+	_useCharPal = false;
+
+	memset(_characterFacingCountTable, 0, sizeof(_characterFacingCountTable));
 }
 
 KyraEngine_HoF::~KyraEngine_HoF() {
@@ -1135,8 +1142,6 @@ void KyraEngine_HoF::restorePage0() {
 }
 
 void KyraEngine_HoF::updateCharPal(int unk1) {
-	static bool unkVar1 = false;
-
 	if (!_useCharPal)
 		return;
 
@@ -1152,12 +1157,12 @@ void KyraEngine_HoF::updateCharPal(int unk1) {
 			++src;
 		}
 		_screen->setScreenPalette(_screen->getPalette(0));
-		unkVar1 = true;
+		_setCharPalFinal = true;
 		_charPalEntry = palEntry;
-	} else if (unkVar1 || !unk1) {
+	} else if (_setCharPalFinal || !unk1) {
 		_screen->getPalette(0).copy(_scenePal, palEntry << 4, 16, 112);
 		_screen->setScreenPalette(_screen->getPalette(0));
-		unkVar1 = false;
+		_setCharPalFinal = false;
 	}
 }
 
@@ -1275,7 +1280,6 @@ int KyraEngine_HoF::getCharacterWalkspeed() const {
 }
 
 void KyraEngine_HoF::updateCharAnimFrame(int charId, int *table) {
-	static int unkTable1[] = { 0, 0 };
 	static const int unkTable2[] = { 17, 0 };
 	static const int unkTable3[] = { 10, 0 };
 	static const int unkTable4[] = { 24, 0 };
@@ -1297,20 +1301,20 @@ void KyraEngine_HoF::updateCharAnimFrame(int charId, int *table) {
 	}
 
 	if (!facing) {
-		++unkTable1[charId];
+		++_characterFacingCountTable[charId];
 	} else if (facing == 4) {
-		++unkTable1[charId+1];
+		++_characterFacingCountTable[charId+1];
 	} else if (facing == 7 || facing == 1 || facing == 5 || facing == 3) {
 		if (facing == 7 || facing == 1) {
-			if (unkTable1[charId] > 2)
+			if (_characterFacingCountTable[charId] > 2)
 				facing = 0;
 		} else {
-			if (unkTable1[charId+1] > 2)
+			if (_characterFacingCountTable[charId+1] > 2)
 				facing = 4;
 		}
 
-		unkTable1[charId] = 0;
-		unkTable1[charId+1] = 0;
+		_characterFacingCountTable[charId] = 0;
+		_characterFacingCountTable[charId+1] = 0;
 	}
 
 	if (facing == 0) {
@@ -1393,12 +1397,11 @@ void KyraEngine_HoF::showIdleAnim() {
 	if (queryGameFlag(0x159) && _flags.isTalkie)
 		return;
 
-	static bool scriptAnimation = false;
-	if (!scriptAnimation && _flags.isTalkie) {
-		scriptAnimation = true;
+	if (!_useSceneIdleAnim && _flags.isTalkie) {
+		_useSceneIdleAnim = true;
 		randomSceneChat();
 	} else {
-		scriptAnimation = false;
+		_useSceneIdleAnim = false;
 		if (_characterShapeFile > 8)
 			return;
 
diff --git a/engines/kyra/kyra_hof.h b/engines/kyra/kyra_hof.h
index b862a89..3040107 100644
--- a/engines/kyra/kyra_hof.h
+++ b/engines/kyra/kyra_hof.h
@@ -574,11 +574,14 @@ protected:
 
 	// character
 	bool _useCharPal;
+	bool _setCharPalFinal;
 	int _charPalEntry;
 	uint8 _charPalTable[16];
 	void updateCharPal(int unk1);
 	void setCharPalEntry(int entry, int value);
 
+	int _characterFacingCountTable[2];
+
 	int getCharacterWalkspeed() const;
 	void updateCharAnimFrame(int num, int *table);
 
@@ -681,6 +684,7 @@ protected:
 
 	uint32 _nextIdleAnim;
 	int _lastIdleScript;
+	bool _useSceneIdleAnim;
 
 	void setNextIdleAnimTimer();
 	void showIdleAnim();






More information about the Scummvm-git-logs mailing list