[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.93,1.94 script.cpp,1.48,1.49 sfuncs.cpp,1.78,1.79

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Sun Jan 16 23:22:05 CET 2005


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16580

Modified Files:
	actor.cpp script.cpp sfuncs.cpp 
Log Message:
Initialize a few variables to fix Valgrind warnings. (I'm hoping they were
the reason the ITE intro crashed for me.) I still get read warnings in
Sprite::decodeRLEBuffer() though.

Also added a couple of hacks to keep the IHNM intro alive. Once we support
IHNM actors, we'll be able to remove them.


Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- actor.cpp	16 Jan 2005 20:30:57 -0000	1.93
+++ actor.cpp	17 Jan 2005 07:21:08 -0000	1.94
@@ -138,10 +138,6 @@
 	debug(9, "Actor::Actor()");
 	
 	_actors = NULL;
-	if (_vm->getGameType() == GType_IHNM) {
-		warning("Actors aren't implemented for IHNM yet");
-		return;
-	}
 
 #ifdef ACTOR_DEBUG
 	_debugPoints = NULL;
@@ -156,7 +152,6 @@
 	_pathDirectionListCount = 0;
 	_pathDirectionListAlloced = 0;
 		
-
 	_centerActor = _protagonist = NULL;
 	_lastTickMsec = 0;
 
@@ -165,25 +160,28 @@
 
 	_pathCell = (int8*) malloc(_yCellCount * _xCellCount * sizeof(*_pathCell));
 	
-
 	_pathRect.left = 0;
 	_pathRect.right = _vm->getDisplayWidth();
 	_pathRect.top = _vm->getDisplayInfo().pathStartY;
 	_pathRect.bottom = _vm->getSceneHeight();
 
-	// Get actor resource file context
-	_actorContext = _vm->getFileContext(GAME_RESOURCEFILE, 0);
-	if (_actorContext == NULL) {
-		error("Actor::Actor(): Couldn't load actor module resource context.");
-	}
+	if (_vm->getGameType() == GType_ITE) {
+		// Get actor resource file context
+		_actorContext = _vm->getFileContext(GAME_RESOURCEFILE, 0);
+		if (_actorContext == NULL) {
+			error("Actor::Actor(): Couldn't load actor module resource context.");
+		}
 	
-	result = RSC_LoadResource(_actorContext, RID_ITE_ACTOR_NAMES, &stringsPointer, &stringsLength); // fixme: IHNM
-	if ((result != SUCCESS) || (stringsLength == 0)) {
-		error("Error loading strings list resource");
-	}
+		result = RSC_LoadResource(_actorContext, RID_ITE_ACTOR_NAMES, &stringsPointer, &stringsLength); // fixme: IHNM
+		if ((result != SUCCESS) || (stringsLength == 0)) {
+			error("Error loading strings list resource");
+		}
 	
-	_vm->loadStrings(_actorsStrings, stringsPointer, stringsLength);
-	RSC_FreeResource(stringsPointer);
+		_vm->loadStrings(_actorsStrings, stringsPointer, stringsLength);
+		RSC_FreeResource(stringsPointer);
+	} else {
+		// TODO
+	}
 
 	if (_vm->getGameType() == GType_ITE) {
 		_actorsCount = ITE_ACTORCOUNT;
@@ -217,6 +215,15 @@
 				warning("Disabling actorId=%d index=%d", actor->actorId, actor->index);
 			} 
 		}
+	} else {
+		// TODO.
+		static ActorData dummyActor;
+
+		dummyActor.frames = NULL;
+		dummyActor.walkStepsPoints = NULL;
+
+		_protagonist = &dummyActor;
+		_actorsCount = 0;
 	}
 }
 
@@ -1421,6 +1428,11 @@
 	ActorData *actor;
 	int i;
 
+	if (_vm->getGameType() == GType_IHNM) {
+		warning("Actors aren't implemented for IHNM yet");
+		return;
+	}
+
 	actor = getActor(actorId);
 	for (i = 0; i < stringsCount; i++) {
 		_activeSpeech.strings[i] = strings[i];
@@ -1462,6 +1474,11 @@
 void Actor::simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, int speechFlags) {
 	int i;
 	
+	if (_vm->getGameType() == GType_IHNM) {
+		warning("Actors aren't implemented for IHNM yet");
+		return;
+	}
+
 	for (i = 0; i < actorIdsCount; i++) {
 		ActorData *actor;
 

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- script.cpp	15 Jan 2005 23:46:43 -0000	1.48
+++ script.cpp	17 Jan 2005 07:21:08 -0000	1.49
@@ -63,6 +63,9 @@
 	_abortEnabled = true;
 	_skipSpeeches = false;
 
+	_firstObjectSet = false;
+	_secondObjectNeeded = false;
+	_pendingVerb = kVerbNone;
 	_currentVerb = kVerbNone;
 	_stickyVerb = kVerbWalkTo;
 	_leftButtonVerb = kVerbNone;

Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- sfuncs.cpp	16 Jan 2005 17:06:40 -0000	1.78
+++ sfuncs.cpp	17 Jan 2005 07:21:08 -0000	1.79
@@ -934,6 +934,11 @@
 	debug(1, "sfPlaceActor(%d, %d, %d, %d, %d, %d)", actorId, actorLocation.x, 
 		  actorLocation.y, actorDirection, frameType, frameOffset);
 
+	if (_vm->getGameType() == GType_IHNM) {
+		warning("Actors aren't implemented for IHNM yet");
+		return SUCCESS;
+	}
+
 	actor = _vm->_actor->getActor(actorId);
 	actor->location.x = actorLocation.x;
 	actor->location.y = actorLocation.y;





More information about the Scummvm-git-logs mailing list