[Scummvm-cvs-logs] SF.net SVN: scummvm:[39209] scummvm/trunk/engines/kyra

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sun Mar 8 03:17:14 CET 2009


Revision: 39209
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39209&view=rev
Author:   athrxx
Date:     2009-03-08 02:17:14 +0000 (Sun, 08 Mar 2009)

Log Message:
-----------
LOL: fixed bug reported by MD5 (crashes and freezes caused by calls to non-existent sub scripts)

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui_lol.cpp
    scummvm/trunk/engines/kyra/items_lol.cpp
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/lol.h
    scummvm/trunk/engines/kyra/scene_lol.cpp
    scummvm/trunk/engines/kyra/screen_lol.cpp
    scummvm/trunk/engines/kyra/screen_lol.h
    scummvm/trunk/engines/kyra/script_lol.cpp
    scummvm/trunk/engines/kyra/sprites_lol.cpp
    scummvm/trunk/engines/kyra/timer.cpp
    scummvm/trunk/engines/kyra/timer_lol.cpp

Modified: scummvm/trunk/engines/kyra/gui_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lol.cpp	2009-03-07 22:11:38 UTC (rev 39208)
+++ scummvm/trunk/engines/kyra/gui_lol.cpp	2009-03-08 02:17:14 UTC (rev 39209)
@@ -34,26 +34,26 @@
 void LoLEngine::gui_drawPlayField() {
 	_screen->loadBitmap("PLAYFLD.CPS", 3, 3, 0);
 
-	if (_screen->_drawGuiFlag & 0x4000) {
+	if (_gameFlags[15] & 0x4000) {
 		// copy compass shape
 		static const int cx[] = { 112, 152, 224 };
 		_screen->copyRegion(cx[_lang], 32, 288, 0, 32, 32, 2, 2, Screen::CR_NO_P_CHECK);
 		_compassDirection = -1;
 	}
 
-	if (_screen->_drawGuiFlag & 0x1000)
+	if (_gameFlags[15] & 0x1000)
 		// draw automap book
 		_screen->drawShape(2, _gameShapes[78], 289, 32, 0, 0);
 
 	int cp = _screen->setCurPage(2);
 
-	if (_screen->_drawGuiFlag & 0x2000) {
+	if (_gameFlags[15] & 0x2000) {
 		gui_drawScroll();
 	} else {
 		_selectedSpell = 0;
 	}
 
-	if (_screen->_drawGuiFlag & 0x800)
+	if (_gameFlags[15] & 0x800)
 		resetLampStatus();
 
 	gui_drawScene(2);
@@ -537,7 +537,7 @@
 }
 
 void LoLEngine::gui_drawCompass() {
-	if (!(_screen->_drawGuiFlag & 0x4000))
+	if (!(_gameFlags[15] & 0x4000))
 		return;
 
 	if (_compassDirection == -1) {
@@ -595,7 +595,7 @@
 	static const int16 buttonX[] = { 0x0056, 0x0128, 0x000C, 0x0021, 0x0122, 0x000C, 0x0021, 0x0036, 0x000C, 0x0021, 0x0036 };
 	static const int16 buttonY[] = { 0x00B4, 0x00B4, 0x00B4, 0x00B4, 0x0020, 0x0084, 0x0084, 0x0084, 0x0096, 0x0096, 0x0096 };
 
-	if (shapeIndex == 78 && !(_screen->_drawGuiFlag & 0x1000))
+	if (shapeIndex == 78 && !(_gameFlags[15] & 0x1000))
 		return;
 
 	if (_hideControls && _hideInventory)
@@ -808,7 +808,7 @@
 	gui_initCharacterControlButtons(29, 0);
 	gui_initCharacterControlButtons(25, 33);
 
-	if (_screen->_drawGuiFlag & 0x2000)
+	if (_gameFlags[15] & 0x2000)
 		gui_initMagicScrollButtons();
 }
 

Modified: scummvm/trunk/engines/kyra/items_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/items_lol.cpp	2009-03-07 22:11:38 UTC (rev 39208)
+++ scummvm/trunk/engines/kyra/items_lol.cpp	2009-03-08 02:17:14 UTC (rev 39209)
@@ -220,7 +220,7 @@
 
 	int mouseOffs = 0;
 
-	if (itemIndex && !(_screen->_drawGuiFlag & 0x200)) {
+	if (itemIndex && !(_gameFlags[15] & 0x200)) {
 		mouseOffs = 10;
 		if (!_hideControls || textEnabled())
 			_txt->printMessage(0, getLangString(0x403E), getLangString(_itemProperties[_itemsInPlay[itemIndex].itemPropertyIndex].nameStringId));

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-03-07 22:11:38 UTC (rev 39208)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-03-08 02:17:14 UTC (rev 39209)
@@ -150,7 +150,7 @@
 	_monsters = 0;
 	_unkGameFlag = 0;
 	_lastMouseRegion = 0;
-	_monsterUnkDir = _monsterCountUnk = _monsterShiftAlt = 0;
+	_monsterLastWalkDirection = _monsterCountUnk = _monsterShiftAlt = 0;
 	_monsterCurBlock = 0;
 	//_preSeq_X1 = _preSeq_Y1 = _preSeq_X2 = _preSeq_Y2 = 0;
 
@@ -413,7 +413,7 @@
 	_tmpData136 = new uint8[136];
 	memset(_tmpData136, 0, 136);
 
-	memset(_gameFlags, 0, 15 * sizeof(uint16));
+	memset(_gameFlags, 0, 16 * sizeof(uint16));
 	memset(_unkEMC46, 0, 16 * sizeof(uint16));
 
 	_levelFileData = 0;
@@ -568,7 +568,7 @@
 }
 
 void LoLEngine::setMouseCursorToIcon(int icon) {
-	_screen->_drawGuiFlag |= 0x200;
+	_gameFlags[15] |= 0x200;
 	int i = _itemProperties[_itemsInPlay[_itemInHand].itemPropertyIndex].shpIndex;
 	if (i == icon)
 		return;
@@ -576,7 +576,7 @@
 }
 
 void LoLEngine::setMouseCursorToItemInHand() {
-	_screen->_drawGuiFlag &= 0xFDFF;
+	_gameFlags[15] &= 0xFDFF;
 	int o = (_itemInHand == 0) ? 0 : 10;
 	_screen->setMouseCursor(o, o, getItemIconShapePtr(_itemInHand));
 }
@@ -794,10 +794,10 @@
 	if (_updateCharNum != -1 && _system->getMillis() > _updatePortraitNext)
 		updatePortraitSpeechAnim();
 
-	if (_screen->_drawGuiFlag & 0x800 || !(_updateFlags & 4))
+	if (_gameFlags[15] & 0x800 || !(_updateFlags & 4))
 		updateLampStatus();
 
-	if (_screen->_drawGuiFlag & 0x4000 && !(_updateFlags & 4) && (_compassDirection == -1 || (_currentDirection << 6) != _compassDirection || _compassUnk))
+	if (_gameFlags[15] & 0x4000 && !(_updateFlags & 4) && (_compassDirection == -1 || (_currentDirection << 6) != _compassDirection || _compassUnk))
 		updateCompass();
 
 	snd_characterSpeaking();
@@ -1156,7 +1156,7 @@
 		if (_screen->_fadeFlag != 2)
 			_screen->fadeClearSceneWindow(10);
 		gui_drawPlayField();
-		_screen->setPaletteBrightness(_screen->_currentPalette, _brightness, _lampOilStatus);
+		setPaletteBrightness(_screen->_currentPalette, _brightness, _lampOilStatus);
 		_screen->_fadeFlag = 0;
 	}
 
@@ -1189,6 +1189,28 @@
 	_fadeText = false;
 }
 
+void LoLEngine::setPaletteBrightness(uint8 *palette, int brightness, int modifier) {
+	generateBrightnessPalette(palette, _screen->getPalette(1), brightness, modifier);
+	_screen->fadePalette(_screen->getPalette(1), 5, 0);
+	_screen->_fadeFlag = 0;
+}
+
+void LoLEngine::generateBrightnessPalette(uint8 *src, uint8 *dst, int brightness, int modifier) {
+	memcpy(dst, src, 0x300);
+	_screen->loadSpecialColours(dst);
+	brightness = (8 - brightness) << 5;
+	if (modifier >= 0 && modifier < 8 && _gameFlags[15] & 0x800) {
+		brightness = 256 - ((((modifier & 0xfffe) << 5) * (256 - brightness)) >> 8);
+		if (brightness < 0)
+			brightness = 0;
+	}
+	
+	for (int i = 0; i < 384; i++) {
+		uint16 c = (dst[i] * brightness) >> 8;
+		dst[i] = c & 0xff;
+	}
+}
+
 void LoLEngine::updateWsaAnimations() {
 	if (_updateFlags & 8)
 		return;

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-03-07 22:11:38 UTC (rev 39208)
+++ scummvm/trunk/engines/kyra/lol.h	2009-03-08 02:17:14 UTC (rev 39209)
@@ -493,11 +493,12 @@
 	uint16 _currentBlock;
 	bool _sceneUpdateRequired;
 	int16 _currentBlockPropertyIndex[18];
-	uint16 _gameFlags[15];
+	uint16 _gameFlags[16];
 	uint16 _unkEMC46[16];
 
 	// emc opcode
 	int olol_drawScene(EMCState *script);
+	int olol_delay(EMCState *script);
 	int olol_setGameFlag(EMCState *script);
 	int olol_testGameFlag(EMCState *script);
 	int olol_loadLevelGraphics(EMCState *script);
@@ -522,6 +523,7 @@
 	int olol_setUnkArrayVal(EMCState *script);
 	int olol_getGlobalVar(EMCState *script);
 	int olol_setGlobalVar(EMCState *script);
+	int olol_triggerDoorSwitch(EMCState *script);
 	int olol_mapShapeToBlock(EMCState *script);
 	int olol_resetBlockShapeAssignment(EMCState *script);
 	int olol_initMonster(EMCState *script);
@@ -538,6 +540,7 @@
 	int olol_loadLangFile(EMCState *script);
 	int olol_playSoundEffect(EMCState *script);
 	int olol_stopTimScript(EMCState *script);
+	int olol_getWallFlags(EMCState *script);
 	int olol_playCharacterScriptChat(EMCState *script);
 	int olol_loadSoundFile(EMCState *script);
 	int olol_stopCharacterSpeech(EMCState *script);
@@ -598,6 +601,8 @@
 	void resetPortraitsArea();
 	void toggleSelectedCharacterFrame(bool mode);
 	void fadeText();
+	void setPaletteBrightness(uint8 *palette, int brightness, int modifier);
+	void generateBrightnessPalette(uint8 *src, uint8 *dst, int brightness, int modifier);
 	void updateWsaAnimations();
 
 	uint8 **_itemIconShapes;
@@ -971,7 +976,7 @@
 	uint8 **_monsterShapesEx;
 	uint8 _monsterUnk[3];
 	uint16 _monsterCurBlock;
-	int _monsterUnkDir;
+	int _monsterLastWalkDirection;
 	int _monsterCountUnk;
 	int _monsterShiftAlt;
 

Modified: scummvm/trunk/engines/kyra/scene_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_lol.cpp	2009-03-07 22:11:38 UTC (rev 39208)
+++ scummvm/trunk/engines/kyra/scene_lol.cpp	2009-03-08 02:17:14 UTC (rev 39209)
@@ -94,7 +94,7 @@
 
 	gui_drawPlayField();
 
-	_screen->setPaletteBrightness(_screen->_currentPalette, _brightness, _lampOilStatus);
+	setPaletteBrightness(_screen->_currentPalette, _brightness, _lampOilStatus);
 	setMouseCursorToItemInHand();
 
 	snd_playTrack(_curMusicTheme);
@@ -440,7 +440,7 @@
 		_screen->getLevelOverlay(7)[i] = i & 0xff;
 
 	_loadSuppFilesFlag = 0;
-	_screen->generateBrightnessPalette(_screen->_currentPalette, _screen->getPalette(1), _brightness, _lampOilStatus);
+	generateBrightnessPalette(_screen->_currentPalette, _screen->getPalette(1), _brightness, _lampOilStatus);
 
 	char tname[13];
 	snprintf(tname, sizeof(tname), "LEVEL%.02d.TLC", _currentLevel);
@@ -522,14 +522,14 @@
 }
 
 void LoLEngine::resetLampStatus() {
-	_screen->_drawGuiFlag |= 0x400;
+	_gameFlags[15] |= 0x400;
 	_lampOilStatus = 255;
 	updateLampStatus();
 }
 
 void LoLEngine::setLampMode(bool lampOn) {
-	_screen->_drawGuiFlag &= 0xFBFF;
-	if (!(_screen->_drawGuiFlag & 0x800) || !lampOn)
+	_gameFlags[15] &= 0xFBFF;
+	if (!(_gameFlags[15] & 0x800) || !lampOn)
 		return;
 
 	_screen->drawShape(0, _gameShapes[43], 291, 56, 0, 0);
@@ -540,20 +540,20 @@
 	uint8 newLampOilStatus = 0;
 	uint8 tmp2 = 0;
 
-	if ((_updateFlags & 4) || !(_screen->_drawGuiFlag & 0x800))
+	if ((_updateFlags & 4) || !(_gameFlags[15] & 0x800))
 		return;
 
 	if (!_brightness || !_lampStatusUnk) {
 		newLampOilStatus = 8;
 		if (newLampOilStatus != _lampOilStatus && _screen->_fadeFlag == 0)
-			_screen->setPaletteBrightness(_screen->_currentPalette, _lampOilStatus, newLampOilStatus);
+			setPaletteBrightness(_screen->_currentPalette, _lampOilStatus, newLampOilStatus);
 	} else {
 		tmp2 = (_lampStatusUnk < 100) ? _lampStatusUnk : 100;
 		newLampOilStatus = (3 - (tmp2 - 1) / 25) << 1;
 
 		if (_lampOilStatus == 255) {
 			if (_screen->_fadeFlag == 0)
-					_screen->setPaletteBrightness(_screen->_currentPalette, _brightness, newLampOilStatus);
+					setPaletteBrightness(_screen->_currentPalette, _brightness, newLampOilStatus);
 			_lampStatusTimer = _system->getMillis() + (10 + _rnd.getRandomNumberRng(1, 30)) * _tickLength;
 		} else {
 			if ((_lampOilStatus & 0xfe) == (newLampOilStatus & 0xfe)) {
@@ -565,7 +565,7 @@
 				}
 			} else {
 				if (_screen->_fadeFlag == 0)
-					_screen->setPaletteBrightness(_screen->_currentPalette, _lampOilStatus, newLampOilStatus);
+					setPaletteBrightness(_screen->_currentPalette, _lampOilStatus, newLampOilStatus);
 			}
 		}
 	}
@@ -1104,7 +1104,7 @@
 }
 
 void LoLEngine::setLF2(int block) {
-	if (!(_screen->_drawGuiFlag & 0x1000))
+	if (!(_gameFlags[15] & 0x1000))
 		return;
 	_levelBlockProperties[block].flags |= 7;
 	// TODO

Modified: scummvm/trunk/engines/kyra/screen_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.cpp	2009-03-07 22:11:38 UTC (rev 39208)
+++ scummvm/trunk/engines/kyra/screen_lol.cpp	2009-03-08 02:17:14 UTC (rev 39209)
@@ -45,7 +45,6 @@
 		_levelOverlays[i] = new uint8[256];
 	
 	_fadeFlag = 2;
-	_drawGuiFlag = 0;
 	_curDimIndex = 0;
 	_dimLineCount = 0;
 }
@@ -535,28 +534,6 @@
 	_fadeFlag = 2;
 }
 
-void Screen_LoL::setPaletteBrightness(uint8 *palette, int brightness, int modifier) {
-	generateBrightnessPalette(palette, getPalette(1), brightness, modifier);
-	fadePalette(getPalette(1), 5, 0);
-	_fadeFlag = 0;
-}
-
-void Screen_LoL::generateBrightnessPalette(uint8 *src, uint8 *dst, int brightness, int modifier) {
-	memcpy(dst, src, 0x300);
-	loadSpecialColours(dst);
-	brightness = (8 - brightness) << 5;
-	if (modifier >= 0 && modifier < 8 && _drawGuiFlag & 0x800) {
-		brightness = 256 - ((((modifier & 0xfffe) << 5) * (256 - brightness)) >> 8);
-		if (brightness < 0)
-			brightness = 0;
-	}
-	
-	for (int i = 0; i < 384; i++) {
-		uint16 c = (dst[i] * brightness) >> 8;
-		dst[i] = c & 0xff;
-	}
-}
-
 void Screen_LoL::loadSpecialColours(uint8 *destPalette) {
 	memcpy(destPalette + 0x240, _screenPalette + 0x240, 12);	
 }

Modified: scummvm/trunk/engines/kyra/screen_lol.h
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.h	2009-03-07 22:11:38 UTC (rev 39208)
+++ scummvm/trunk/engines/kyra/screen_lol.h	2009-03-08 02:17:14 UTC (rev 39209)
@@ -64,8 +64,6 @@
 
 	// palette stuff
 	void fadeToBlack(int delay=0x54, const UpdateFunctor *upFunc = 0);
-	void setPaletteBrightness(uint8 *palDst, int brightness, int modifier);
-	void generateBrightnessPalette(uint8 *palSrc, uint8 *palDst, int brightness, int modifier);
 	void loadSpecialColours(uint8 *destPalette);
 	void copyColour(int dstColourIndex, int srcColourIndex);
 	bool fadeColour(int dstColourIndex, int srcColourIndex, uint32 elapsedTime, uint32 targetTime);
@@ -80,7 +78,6 @@
 	uint8 *_paletteOverlay2;
 	uint8 *_grayOverlay;
 	int _fadeFlag;
-	int _drawGuiFlag;
 	int _dimLineCount;
 
 private:

Modified: scummvm/trunk/engines/kyra/script_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_lol.cpp	2009-03-07 22:11:38 UTC (rev 39208)
+++ scummvm/trunk/engines/kyra/script_lol.cpp	2009-03-08 02:17:14 UTC (rev 39209)
@@ -118,6 +118,12 @@
 	return 1;
 }
 
+int LoLEngine::olol_delay(EMCState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_delay(%p) (%d)", (const void *)script, stackPos(0));
+	delay(stackPos(0) * _tickLength);
+	return 1;
+}
+
 int LoLEngine::olol_setGameFlag(EMCState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_setGameFlag(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
 	if (stackPos(1))
@@ -566,6 +572,12 @@
 	return 1;
 }
 
+int LoLEngine::olol_triggerDoorSwitch(EMCState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_triggerDoorSwitch(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+	processDoorSwitch(stackPos(0)/*, (_wllWallFlags[_levelBlockProperties[stackPos(0)].walls[0]] & 8) ? 0 : 1*/, stackPos(1));
+	return 1;
+}
+
 int LoLEngine::olol_mapShapeToBlock(EMCState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_mapShapeToBlock(%p) (%d)", (const void *)script, stackPos(0));
 	return assignLevelShapes(stackPos(0));
@@ -787,6 +799,11 @@
 	return 1;
 }
 
+int LoLEngine::olol_getWallFlags(EMCState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_getWallFlags(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+	return _wllWallFlags[_levelBlockProperties[stackPos(0)].walls[stackPos(1) & 3]];
+}
+
 int LoLEngine::olol_playCharacterScriptChat(EMCState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_playCharacterScriptChat(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
 	snd_stopSpeech(1);
@@ -812,7 +829,7 @@
 	uint16 old = _brightness;
 	_brightness = stackPos(0);
 	if (stackPos(1) == 1)
-		_screen->setPaletteBrightness(_screen->_currentPalette, stackPos(0), _lampOilStatus);
+		setPaletteBrightness(_screen->_currentPalette, stackPos(0), _lampOilStatus);
 	return old;
 }
 
@@ -1014,7 +1031,7 @@
 			if (_screen->_fadeFlag != 2)
 				_screen->fadeClearSceneWindow(10);
 			gui_drawPlayField();
-			_screen->setPaletteBrightness(_screen->_currentPalette, _brightness, _lampOilStatus);
+			setPaletteBrightness(_screen->_currentPalette, _brightness, _lampOilStatus);
 			_screen->_fadeFlag = 0;
 			break;
 
@@ -1088,7 +1105,7 @@
 	// 0x04
 	OpcodeUnImpl();
 	OpcodeUnImpl();
-	OpcodeUnImpl();
+	Opcode(olol_delay);
 	Opcode(olol_setGameFlag);
 
 	// 0x08
@@ -1153,9 +1170,9 @@
 
 	// 0x30
 	Opcode(olol_setGlobalVar);
+	Opcode(olol_triggerDoorSwitch);
 	OpcodeUnImpl();
 	OpcodeUnImpl();
-	OpcodeUnImpl();
 
 	// 0x34
 	OpcodeUnImpl();
@@ -1214,8 +1231,8 @@
 	// 0x58
 	OpcodeUnImpl();
 	Opcode(olol_stopTimScript);
+	Opcode(olol_getWallFlags);
 	OpcodeUnImpl();
-	OpcodeUnImpl();
 
 	// 0x5C
 	OpcodeUnImpl();

Modified: scummvm/trunk/engines/kyra/sprites_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sprites_lol.cpp	2009-03-07 22:11:38 UTC (rev 39208)
+++ scummvm/trunk/engines/kyra/sprites_lol.cpp	2009-03-08 02:17:14 UTC (rev 39209)
@@ -306,7 +306,7 @@
 }
 
 int LoLEngine::checkBlockBeforeMonsterPlacement(int x, int y, int monsterWidth, int testFlag, int wallFlag) {
-	_monsterUnkDir = 0;
+	_monsterLastWalkDirection = 0;
 	int x2 = 0;
 	int y2 = 0;
 	int xOffs = 0;
@@ -324,7 +324,7 @@
 	if (x & 0x80) {
 		if (((x & 0xff) + monsterWidth) & 0xff00) {
 			xOffs = 1;
-			_monsterUnkDir = 2;
+			_monsterLastWalkDirection = 2;
 			x2 = x + monsterWidth;
 
 			r = checkBlockForWallsAndSufficientSpace(calcBlockIndex(x2, y), x, y, monsterWidth, testFlag, wallFlag);
@@ -340,7 +340,7 @@
 	} else {
 		if (((x & 0xff) - monsterWidth) & 0xff00) {
 			xOffs = -1;
-			_monsterUnkDir = 6;
+			_monsterLastWalkDirection = 6;
 			x2 = x - monsterWidth;
 
 			r = checkBlockForWallsAndSufficientSpace(calcBlockIndex(x2, y), x, y, monsterWidth, testFlag, wallFlag);
@@ -358,7 +358,7 @@
 	if (y & 0x80) {
 		if (((y & 0xff) + monsterWidth) & 0xff00) {
 			yOffs = 1;
-			_monsterUnkDir = 4;
+			_monsterLastWalkDirection = 4;
 			y2 = y + monsterWidth;
 
 			r = checkBlockForWallsAndSufficientSpace(calcBlockIndex(x, y2), x, y, monsterWidth, testFlag, wallFlag);
@@ -374,7 +374,7 @@
 	} else {
 		if (((y & 0xff) - monsterWidth) & 0xff00) {
 			yOffs = -1;
-			_monsterUnkDir = 0;
+			_monsterLastWalkDirection = 0;
 			y2 = y - monsterWidth;
 
 			r = checkBlockForWallsAndSufficientSpace(calcBlockIndex(x, y2), x, y, monsterWidth, testFlag, wallFlag);
@@ -944,8 +944,8 @@
 		if (walkMonsterCheckDest(monster->x, monster->y, monster, 4) != 1)
 			return;
 
-		_monsterUnkDir ^= 4;
-		setMonsterDirection(monster, _monsterUnkDir);
+		_monsterLastWalkDirection ^= 4;
+		setMonsterDirection(monster, _monsterLastWalkDirection);
 	} else {
 		setMonsterDirection(monster, s);
 		if (monster->field_25) {
@@ -961,7 +961,7 @@
 	int fx = 0;
 	int fy = 0;
 
-	walkMonsterGetNextStepCoords(monster->x, monster->y, fx, fy, (s == -1) ? _monsterUnkDir : s);
+	walkMonsterGetNextStepCoords(monster->x, monster->y, fx, fy, (s == -1) ? _monsterLastWalkDirection : s);
 	placeMonster(monster, fx, fy);
 }
 

Modified: scummvm/trunk/engines/kyra/timer.cpp
===================================================================
--- scummvm/trunk/engines/kyra/timer.cpp	2009-03-07 22:11:38 UTC (rev 39208)
+++ scummvm/trunk/engines/kyra/timer.cpp	2009-03-08 02:17:14 UTC (rev 39209)
@@ -122,9 +122,9 @@
 	_nextRun += 99999;
 
 	for (Iterator pos = _timers.begin(); pos != _timers.end(); ++pos) {
-		if (pos->enabled)
+		if (pos->enabled == 1)
 
-		if (pos->enabled && pos->countdown >= 0) {
+		if (pos->enabled == 1 && pos->countdown >= 0) {
 			if (pos->nextRun <= _system->getMillis()) {
 				if (pos->func && pos->func->isValid()) {
 					(*pos->func)(pos->id);
@@ -138,7 +138,6 @@
 			_nextRun = MIN(_nextRun, pos->nextRun);
 		}
 	}
-
 }
 
 void TimerManager::resync() {
@@ -229,10 +228,10 @@
 	
 	if (p) {
 		timer->pauseStartTime = _system->getMillis();
-		timer->enabled = 0;
+		timer->enabled ^= 2;
 	} else if (timer->pauseStartTime) {
 		int32 elapsedTime = _system->getMillis() - timer->pauseStartTime;
-		timer->enabled = 1;
+		timer->enabled ^= 2;
 		timer->lastUpdate += elapsedTime;
 		timer->nextRun += elapsedTime;
 		resync();
@@ -256,7 +255,7 @@
 
 	Iterator timer = Common::find_if(_timers.begin(), _timers.end(), TimerEqual(id));
 	if (timer != _timers.end())
-		timer->enabled = 1;
+		timer->enabled |= 1;
 	else
 		warning("TimerManager::enable: No timer %d", id);
 }
@@ -266,7 +265,7 @@
 
 	Iterator timer = Common::find_if(_timers.begin(), _timers.end(), TimerEqual(id));
 	if (timer != _timers.end())
-		timer->enabled = 0;
+		timer->enabled &= 2;
 	else
 		warning("TimerManager::disable: No timer %d", id);
 }

Modified: scummvm/trunk/engines/kyra/timer_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/timer_lol.cpp	2009-03-07 22:11:38 UTC (rev 39208)
+++ scummvm/trunk/engines/kyra/timer_lol.cpp	2009-03-08 02:17:14 UTC (rev 39209)
@@ -150,7 +150,7 @@
 }
 
 void LoLEngine::timerUpdateLampState(int timerNum) {
-	if ((_screen->_drawGuiFlag & 0x800) && (_screen->_drawGuiFlag & 0x400) && _lampStatusUnk)
+	if ((_gameFlags[15] & 0x800) && (_gameFlags[15] & 0x400) && _lampStatusUnk)
 		_lampStatusUnk--;
 }
 


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