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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Apr 17 13:59:20 CEST 2008


Revision: 31534
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31534&view=rev
Author:   lordhoto
Date:     2008-04-17 04:59:20 -0700 (Thu, 17 Apr 2008)

Log Message:
-----------
- minor cleanup in script.cpp
- fix for memory leak in Kyra3
- fixed enterNewSceneUnk2

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/kyra_v3.cpp
    scummvm/trunk/engines/kyra/scene_v3.cpp
    scummvm/trunk/engines/kyra/script.cpp

Modified: scummvm/trunk/engines/kyra/kyra_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v3.cpp	2008-04-17 09:32:57 UTC (rev 31533)
+++ scummvm/trunk/engines/kyra/kyra_v3.cpp	2008-04-17 11:59:20 UTC (rev 31534)
@@ -61,9 +61,9 @@
 	_sceneList = 0;
 	memset(&_mainCharacter, 0, sizeof(_mainCharacter));
 	_mainCharacter.sceneId = 9;
-	_mainCharacter.dlgIndex = 0;
 	_mainCharacter.unk4 = 0x4C;
 	_mainCharacter.facing = 5;
+	_mainCharacter.animFrame = 0x57;
 	_mainCharacter.walkspeed = 5;
 	memset(_mainCharacter.inventory, -1, sizeof(_mainCharacter.inventory));
 	_text = 0;
@@ -600,6 +600,8 @@
 
 	while (_scriptInterpreter->validScript(&state))
 		_scriptInterpreter->runScript(&state);
+
+	_scriptInterpreter->unloadScript(&data);
 }
 
 void KyraEngine_v3::openTalkFile(int file) {

Modified: scummvm/trunk/engines/kyra/scene_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_v3.cpp	2008-04-17 09:32:57 UTC (rev 31533)
+++ scummvm/trunk/engines/kyra/scene_v3.cpp	2008-04-17 11:59:20 UTC (rev 31534)
@@ -273,7 +273,7 @@
 void KyraEngine_v3::enterNewSceneUnk2(int unk1) {
 	debugC(9, kDebugLevelMain, "KyraEngine_v3::enterNewSceneUnk2(%d)", unk1);
 	_unk3 = -1;
-	if (_mainCharX == -1 && _mainCharY == -1) {
+	if (_mainCharX == -1 && _mainCharY == -1 && !unk1) {
 		_mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
 		updateCharacterAnim(0);
 		refreshAnimObjectsIfNeed();

Modified: scummvm/trunk/engines/kyra/script.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script.cpp	2008-04-17 09:32:57 UTC (rev 31533)
+++ scummvm/trunk/engines/kyra/script.cpp	2008-04-17 11:59:20 UTC (rev 31534)
@@ -212,6 +212,9 @@
 		(this->*(_commands[opcode].proc))(script);
 	}
 
+	if (!_continue)
+		script->ip = 0;
+
 	return _continue;
 }
 
@@ -317,7 +320,6 @@
 
 	default:
 		_continue = false;
-		script->ip = 0;
 		break;
 	}
 }
@@ -347,7 +349,6 @@
 	case 1:
 		if (script->sp >= 60) {
 			_continue = false;
-			script->ip = 0;
 		} else {
 			script->bp = script->stack[script->sp++];
 			script->ip = script->dataPtr->data + script->stack[script->sp++];
@@ -356,7 +357,6 @@
 
 	default:
 		_continue = false;
-		script->ip = 0;
 		break;
 	}
 }
@@ -421,6 +421,7 @@
 		break;
 
 	default:
+		warning("Unknown negation func: %d", _parameter);
 		_continue = false;
 		break;
 	}
@@ -536,18 +537,15 @@
 		break;
 	}
 
-	if (error) {
-		script->ip = 0;
+	if (error)
 		_continue = false;
-	} else {
+	else
 		script->stack[--script->sp] = ret;
-	}
 }
 
 void ScriptHelper::cmd_setRetAndJmp(ScriptState* script) {
 	if (script->sp >= 60) {
 		_continue = false;
-		script->ip = 0;
 	} else {
 		script->retValue = script->stack[script->sp++];
 		uint16 temp = script->stack[script->sp++];


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