[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.163,1.164 actor.h,1.88,1.89 ihnm_introproc.cpp,1.49,1.50 ite_introproc.cpp,1.64,1.65 rscfile.cpp,1.33,1.34 scene.cpp,1.138,1.139 scene.h,1.71,1.72

Andrew Kurushin h00ligan at users.sourceforge.net
Sat Aug 6 11:29:20 CEST 2005


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

Modified Files:
	actor.cpp actor.h ihnm_introproc.cpp ite_introproc.cpp 
	rscfile.cpp scene.cpp scene.h 
Log Message:
ihnm actors list WIP

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -d -r1.163 -r1.164
--- actor.cpp	6 Aug 2005 14:26:58 -0000	1.163
+++ actor.cpp	6 Aug 2005 18:28:42 -0000	1.164
@@ -206,12 +206,13 @@
 	_pathRect.top = _vm->getDisplayInfo().pathStartY;
 	_pathRect.bottom = _vm->getSceneHeight();
 
+	// Get actor resource file context
+	_actorContext = _vm->_resource->getContext(GAME_RESOURCEFILE);
+	if (_actorContext == NULL) {
+		error("Actor::Actor() resource context not found");
+	}
+
 	if (_vm->getGameType() == GType_ITE) {
-		// Get actor resource file context
-		_actorContext = _vm->_resource->getContext(GAME_RESOURCEFILE);
-		if (_actorContext == NULL) {
-			error("Actor::Actor() resource context not found");
-		}
 
 		_vm->_resource->loadResource(_actorContext, _vm->getResourceDescription()->actorsStringsResourceId, stringsPointer, stringsLength);
 
@@ -281,7 +282,6 @@
 
 Actor::~Actor() {
 	int i;
-	ActorData *actor;
 	ObjectData *obj;
 
 	debug(9, "Actor::~Actor()");
@@ -296,11 +296,8 @@
 	free(_pathCell);
 	_actorsStrings.freeMem();
 	//release resources
-	for (i = 0; i < _actorsCount; i++) {
-		actor = _actors[i];
-		delete actor;
-	}
-	free(_actors);
+	freeList();
+
 	for (i = 0; i < _objsCount; i++) {
 		obj = _objs[i];
 		delete obj;
@@ -372,8 +369,89 @@
 	return true;
 }
 
-void Actor::loadList(int actorsEntrance, int actorCount, int actorsResourceID,
-					 int protagStatesCount, int protagStatesResourceID) {
+void Actor::freeList() {
+	int i;
+	ActorData *actor;
+	for (i = 0; i < _actorsCount; i++) {
+		actor = _actors[i];
+		delete actor;
+	}
+	free(_actors);
+	_actors = NULL;
+	_actorsCount = 0;
+}
+
+void Actor::loadList(int actorsEntrance, int actorCount, int actorsResourceID, int protagStatesCount, int protagStatesResourceID) {
+	int i;
+	ActorData *actor;
+	byte* actorListData;
+	size_t actorListLength;
+	freeList();
+	
+	_vm->_resource->loadResource(_actorContext, actorsResourceID, actorListData, actorListLength);
+		
+	MemoryReadStream actorS(actorListData, actorListLength);
+	_actorsCount = actorListLength / ACTOR_INHM_SIZE;
+	
+	_actors = (ActorData **)malloc(_actorsCount * sizeof(*_actors));
+	for (i = 0; i < _actorsCount; i++) {
+		actor = _actors[i] = new ActorData();
+		actor->id = actorIndexToId(i);
+		actor->index = i;
+		debug(9, "init actor id=%d index=%d", actor->id, actor->index);
+		actorS.readUint32LE(); //next displayed	
+		actorS.readByte(); //type
+		actor->flags = actorS.readByte();
+		actor->nameIndex = actorS.readUint16LE();
+		actor->sceneNumber = actorS.readUint32LE();
+		actor->location.fromStream(actorS);
+		actor->screenPosition.x = actorS.readUint16LE();
+		actor->screenPosition.y = actorS.readUint16LE();
+		actor->screenScale = actorS.readUint16LE();
+		actor->screenDepth = actorS.readUint16LE();
+		actor->frameListResourceId = actorS.readUint32LE();
+		actor->spriteListResourceId = actorS.readUint32LE();
+		actor->scriptEntrypointNumber = actorS.readUint32LE();
+		actorS.readByte();
+		actorS.readByte();
+		actorS.readByte();
+		actorS.readByte();
+		actorS.readUint16LE(); //LEFT
+		actorS.readUint16LE(); //RIGHT
+		actorS.readUint16LE(); //TOP
+		actorS.readUint16LE(); //BOTTOM
+		actor->speechColor = actorS.readByte();
+		actor->currentAction = actorS.readByte();
+		actor->facingDirection = actorS.readByte();
+		actor->actionDirection = actorS.readByte();
+		actor->actionCycle = actorS.readUint16LE();
+		actor->frameNumber = actorS.readUint16LE();
+		actor->finalTarget.fromStream(actorS);
+		actor->partialTarget.fromStream(actorS);
+		actorS.readUint16LE(); //movement speed
+		actorS.seek(128, SEEK_CUR);
+		actorS.readByte();//walkStepIndex
+		actorS.readByte();//walkStepCount
+		actorS.readUint32LE(); //sprites
+		actorS.readUint32LE(); //frames
+		actorS.readUint32LE(); //last zone
+		actor->targetObject = actorS.readUint16LE();
+		actor->actorFlags = actorS.readUint16LE();
+		actorS.readUint32LE(); //next in scene
+		actorS.seek(6, SEEK_CUR); //action vars
+	}
+	free(actorListData);
+
+	for (i = 0; i < _actorsCount; i++) {
+		actor = _actors[i];
+		if (actor->flags & kExtended) {
+			actor->disabled = !loadActorResources(actor);
+			if (actor->disabled) {
+				warning("Disabling actor Id=%d index=%d", actor->id, actor->index);
+			}
+		}
+	}
+//TODO: protagonist stuff
 }
 
 void Actor::takeExit(uint16 actorId, const HitZone *hitZone) {

Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.h,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- actor.h	6 Aug 2005 14:26:58 -0000	1.88
+++ actor.h	6 Aug 2005 18:28:42 -0000	1.89
@@ -72,6 +72,8 @@
 
 #define PATH_NODE_EMPTY -1
 
+#define ACTOR_INHM_SIZE 228
+
 enum ActorActions {
 	kActionWait = 0,
 	kActionWalkToPoint = 1,
@@ -227,6 +229,11 @@
 		screenPoint.x = x / ACTOR_LMULT;
 		screenPoint.y = y / ACTOR_LMULT - z;
 	}
+	void fromStream(Common::MemoryReadStream &stream) {
+		x = stream.readUint16LE();
+		y = stream.readUint16LE();
+		z = stream.readUint16LE();
+	}
 };
 
 class CommonObjectData {
@@ -247,7 +254,7 @@
 	Point screenPosition;		// screen coordinates
 	int32 screenDepth;			//
 	int32 screenScale;			//
-
+	
 	void saveState(Common::OutSaveFile *out) {
 		out->writeUint16LE(flags);
 		out->writeSint32LE(nameIndex);
@@ -572,6 +579,7 @@
 	void setProtagState(int state);
 	int getProtagState() { return _protagState; }
 
+	void freeList();
 	void loadList(int actorsEntrance, int actorCount, int actorsResourceID,
 				  int protagStatesCount, int protagStatesResourceID);
 

Index: ihnm_introproc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/ihnm_introproc.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- ihnm_introproc.cpp	6 Aug 2005 12:20:09 -0000	1.49
+++ ihnm_introproc.cpp	6 Aug 2005 18:28:42 -0000	1.50
@@ -80,10 +80,10 @@
 };
 
 LoadSceneParams IHNM_IntroList[] = {
-	{0, kLoadByDescription, &IHNM_IntroMovie1Desc, Scene::SC_IHNMIntroMovieProc1, false, kTransitionNoFade, 0, -1},
-	{0, kLoadByDescription, &IHNM_IntroMovie2Desc, Scene::SC_IHNMIntroMovieProc2, false, kTransitionNoFade, 0, -1},
-	{0, kLoadByDescription, &IHNM_IntroMovie3Desc, Scene::SC_IHNMIntroMovieProc3, false, kTransitionNoFade, 0, -1},
-	{0, kLoadByDescription, &IHNM_IntroMovie4Desc, Scene::SC_IHNMHateProc, false, kTransitionNoFade, 0, -1}
+	{0, kLoadByDescription, &IHNM_IntroMovie1Desc, Scene::SC_IHNMIntroMovieProc1, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{0, kLoadByDescription, &IHNM_IntroMovie2Desc, Scene::SC_IHNMIntroMovieProc2, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{0, kLoadByDescription, &IHNM_IntroMovie3Desc, Scene::SC_IHNMIntroMovieProc3, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{0, kLoadByDescription, &IHNM_IntroMovie4Desc, Scene::SC_IHNMHateProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE}
 };
 
 int Scene::IHNMStartProc() {
@@ -105,7 +105,7 @@
 	firstScene.sceneProc = NULL;
 	firstScene.transitionType = kTransitionFade;
 	firstScene.actorsEntrance = 0;
-	firstScene.chapter = 0;
+	firstScene.chapter = -1;
 
 	_vm->_scene->queueScene(&firstScene);
 

Index: ite_introproc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/ite_introproc.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- ite_introproc.cpp	6 Aug 2005 12:20:09 -0000	1.64
+++ ite_introproc.cpp	6 Aug 2005 18:28:42 -0000	1.65
@@ -45,15 +45,15 @@
 using Common::DE_DEU;
 
 LoadSceneParams ITE_IntroList[] = {
-	{RID_ITE_INTRO_ANIM_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroAnimProc, false, kTransitionNoFade, 0, -1},
-	{RID_ITE_CAVE_SCENE_1, kLoadByResourceId, NULL, Scene::SC_ITEIntroCave1Proc, false, kTransitionFade, 0, -1},
-	{RID_ITE_CAVE_SCENE_2, kLoadByResourceId, NULL, Scene::SC_ITEIntroCave2Proc, false, kTransitionNoFade, 0, -1},
-	{RID_ITE_CAVE_SCENE_3, kLoadByResourceId, NULL, Scene::SC_ITEIntroCave3Proc, false, kTransitionNoFade, 0, -1},
-	{RID_ITE_CAVE_SCENE_4, kLoadByResourceId, NULL, Scene::SC_ITEIntroCave4Proc, false, kTransitionNoFade, 0, -1},
-	{RID_ITE_VALLEY_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroValleyProc, false, kTransitionFade, 0, -1},
-	{RID_ITE_TREEHOUSE_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroTreeHouseProc, false, kTransitionNoFade, 0, -1},
-	{RID_ITE_FAIREPATH_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroFairePathProc, false, kTransitionNoFade, 0, -1},
-	{RID_ITE_FAIRETENT_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroFaireTentProc, false, kTransitionNoFade, 0, -1}
+	{RID_ITE_INTRO_ANIM_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroAnimProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_CAVE_SCENE_1, kLoadByResourceId, NULL, Scene::SC_ITEIntroCave1Proc, false, kTransitionFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_CAVE_SCENE_2, kLoadByResourceId, NULL, Scene::SC_ITEIntroCave2Proc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_CAVE_SCENE_3, kLoadByResourceId, NULL, Scene::SC_ITEIntroCave3Proc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_CAVE_SCENE_4, kLoadByResourceId, NULL, Scene::SC_ITEIntroCave4Proc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_VALLEY_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroValleyProc, false, kTransitionFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_TREEHOUSE_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroTreeHouseProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_FAIREPATH_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroFairePathProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_FAIRETENT_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroFaireTentProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE}
 };
 
 int Scene::ITEStartProc() {

Index: rscfile.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/rscfile.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- rscfile.cpp	6 Aug 2005 16:05:13 -0000	1.33
+++ rscfile.cpp	6 Aug 2005 18:28:42 -0000	1.34
@@ -447,6 +447,9 @@
 	_vm->_resource->loadResource(resourceContext, metaResourceTable[chapter],
 								 resourcePointer, resourceLength);
 
+	if (resourceLength == 0) {
+		error("Resource::loadGlobalResources wrong resource");
+	}
 	MemoryReadStream metaS(resourcePointer, resourceLength);
 
 	_metaResource.sceneIndex = metaS.readSint16LE();

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- scene.cpp	6 Aug 2005 14:26:59 -0000	1.138
+++ scene.cpp	6 Aug 2005 18:28:42 -0000	1.139
@@ -596,8 +596,8 @@
 	EVENT event;
 	EVENT *q_event;
 	static PalEntry current_pal[PAL_ENTRIES];
-
-	if (loadSceneParams->chapter != -1) {
+	
+	if ((_vm->getGameType() == GType_IHNM) && (loadSceneParams->chapter != NO_CHAPTER_CHANGE)) {
 		if (loadSceneParams->loadFlag != kLoadBySceneNumber) {
 			error("loadScene wrong usage");
 		}

Index: scene.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.h,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- scene.h	6 Aug 2005 14:26:59 -0000	1.71
+++ scene.h	6 Aug 2005 18:28:43 -0000	1.72
@@ -34,6 +34,8 @@
 
 #define SCENE_DOORS_MAX 16
 
+#define NO_CHAPTER_CHANGE -2
+
 class ObjectMap;
 
 struct EVENT;
@@ -248,7 +250,7 @@
 	void clearSceneQueue(void) {
 		_sceneQueue.clear();
 	}
-	void changeScene(int16 sceneNumber, int actorsEntrance, SceneTransitionType transitionType, int chapter = -1);
+	void changeScene(int16 sceneNumber, int actorsEntrance, SceneTransitionType transitionType, int chapter = NO_CHAPTER_CHANGE);
 	void freeCutawayList();
 
 	bool isSceneLoaded() const { return _sceneLoaded; }





More information about the Scummvm-git-logs mailing list