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

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sat Mar 15 15:40:00 CET 2008


Revision: 31129
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31129&view=rev
Author:   athrxx
Date:     2008-03-15 07:40:00 -0700 (Sat, 15 Mar 2008)

Log Message:
-----------
- implement opcode 127 (entering the color code for the skull in the rat cave now works)
- minor bug fix for mouse cursor (which sometimes would show when it shouldn't)

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/kyra_v2.cpp
    scummvm/trunk/engines/kyra/kyra_v2.h
    scummvm/trunk/engines/kyra/script_v2.cpp

Modified: scummvm/trunk/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-03-15 11:44:36 UTC (rev 31128)
+++ scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-03-15 14:40:00 UTC (rev 31129)
@@ -102,6 +102,7 @@
 	_colorCodeFlag1 = 0;
 	_colorCodeFlag2 = -1;
 	_scriptCountDown = 0;
+	memset(_inputColorCode, 0, 7);
 
 	_gamePlayBuffer = 0;
 	_unkBuf500Bytes = 0;
@@ -699,14 +700,14 @@
 		yOffset = 9;
 	}
 
-	if (type != 0 && _handItemSet != type) {
+	if (type != 0 && _handItemSet != type && _screen->isMouseVisible()) {
 		_mouseState = _handItemSet = type;
 		_screen->hideMouse();
 		_screen->setMouseCursor(xOffset, yOffset, getShapePtr(shapeIndex));
 		_screen->showMouse();
 	}
 
-	if (type == 0 && _handItemSet != _itemInHand) {
+	if (type == 0 && _handItemSet != _itemInHand && _screen->isMouseVisible()) {
 		if ((mouse.y > 145) || (mouse.x > 6 && mouse.x < 312 && mouse.y > 6 && mouse.y < 135)) {
 			_mouseState = 0;
 			_handItemSet = _itemInHand;
@@ -2224,7 +2225,7 @@
 		Opcode(o2_getCountDown),
 		Opcode(o2_dummy),
 		Opcode(o2_dummy),
-		OpcodeUnImpl(),
+		Opcode(o2_pressColorKey),
 		// 0x80
 		Opcode(o2_objectChat),
 		OpcodeUnImpl(),

Modified: scummvm/trunk/engines/kyra/kyra_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.h	2008-03-15 11:44:36 UTC (rev 31128)
+++ scummvm/trunk/engines/kyra/kyra_v2.h	2008-03-15 14:40:00 UTC (rev 31129)
@@ -993,6 +993,7 @@
 	int o2_addCauldronStateTableEntry(ScriptState *script);
 	int o2_setCountDown(ScriptState *script);
 	int o2_getCountDown(ScriptState *script);
+	int o2_pressColorKey(ScriptState *script);
 	int o2_objectChat(ScriptState *script);
 	int o2_getColorCodeFlag1(ScriptState *script);
 	int o2_setColorCodeFlag1(ScriptState *script);
@@ -1120,7 +1121,8 @@
 	// color code related vars
 	int _colorCodeFlag1;
 	int _colorCodeFlag2;
-	uint8 _colorCode[7];
+	uint8 _presetColorCode[7];
+	uint8 _inputColorCode[7];
 	uint32 _scriptCountDown;
 };
 

Modified: scummvm/trunk/engines/kyra/script_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_v2.cpp	2008-03-15 11:44:36 UTC (rev 31128)
+++ scummvm/trunk/engines/kyra/script_v2.cpp	2008-03-15 14:40:00 UTC (rev 31129)
@@ -720,6 +720,18 @@
 	return (time > _scriptCountDown) ? 0 : (_scriptCountDown - time) / _tickLength;
 }
 
+int KyraEngine_v2::o2_pressColorKey(ScriptState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "o2_pressColorKey(%p) (%d)", (const void *)script, stackPos(0));
+	for (int i = 6; i; i--)
+		_inputColorCode[i] = _inputColorCode[i - 1];
+	_inputColorCode[0] = stackPos(0) & 0xff;
+	for (int i = 0; i < 7; i++) {
+		if (_presetColorCode[i] != _inputColorCode[6 - i])
+			return 0;
+	}
+	return 1;
+}
+
 int KyraEngine_v2::o2_objectChat(ScriptState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "o2_objectChat(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1));
 	if (_flags.isTalkie)
@@ -753,12 +765,12 @@
 
 int KyraEngine_v2::o2_getColorCodeValue(ScriptState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "o2_getColorCodeValue(%p) (%d)", (const void *)script, stackPos(0));
-	return _colorCode[stackPos(0)];
+	return _presetColorCode[stackPos(0)];
 }
 
 int KyraEngine_v2::o2_setColorCodeValue(ScriptState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "o2_setColorCodeValue(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
-	_colorCode[stackPos(0)] = stackPos(1) & 0xff;
+	_presetColorCode[stackPos(0)] = stackPos(1) & 0xff;
 	return stackPos(1) & 0xff;
 }
 


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