[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.91,1.92 scene.cpp,1.82,1.83 scene.h,1.41,1.42

Andrew Kurushin h00ligan at users.sourceforge.net
Sun Jan 16 11:07:00 CET 2005


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

Modified Files:
	actor.cpp scene.cpp scene.h 
Log Message:
actors entry list implemented
test: in ITE type "scene_change 130" at console

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- actor.cpp	16 Jan 2005 16:10:06 -0000	1.91
+++ actor.cpp	16 Jan 2005 19:05:49 -0000	1.92
@@ -468,6 +468,7 @@
 	Location tempLocation;
 	Location possibleLocation;
 	Point delta;
+	const SceneEntry *sceneEntry;
 	
 	if (_vm->getGameType() == GType_IHNM) {
 		warning("Actors aren't implemented for IHNM yet");
@@ -492,14 +493,20 @@
 	}
 	
 	assert(_protagonist);
-
-/* setup protagonist entry
-	// tiled stuff
-	if (_vm->_scene->getFlags() & kSceneFlagISO) {
-		//todo: it
-	} else {
+	
+	if (actorsEntrance >= 0) {
+		sceneEntry = _vm->_scene->_entryList->getEntry(actorsEntrance);
+		// tiled stuff
+		if (_vm->_scene->getFlags() & kSceneFlagISO) {
+			//todo: it
+		} else {
+			_protagonist->location.x = sceneEntry->location.x * ACTOR_LMULT;
+			_protagonist->location.y = sceneEntry->location.y * ACTOR_LMULT;
+			_protagonist->location.z = sceneEntry->location.z * ACTOR_LMULT;
+			_protagonist->facingDirection = _protagonist->actionDirection = sceneEntry->facing;
+		}
 	}
-*/
+
 	_protagonist->currentAction = kActionWait;
 
 	if (_vm->_scene->getFlags() & kSceneFlagISO) {

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- scene.cpp	15 Jan 2005 23:46:43 -0000	1.82
+++ scene.cpp	16 Jan 2005 19:06:04 -0000	1.83
@@ -117,6 +117,7 @@
 	_sceneProc = NULL;
 	_objectMap = NULL;
 	_actionMap = new ActionMap(_vm);
+	_entryList = new SceneEntryList(_vm);
 	memset(&_bg, 0, sizeof(_bg));
 	memset(&_bgMask, 0, sizeof(_bgMask));
 
@@ -127,6 +128,7 @@
 	if (_initialized) {
 		endScene();
 		delete _actionMap;
+		delete _entryList;
 		free(_sceneLUT);
 	}
 }
@@ -191,7 +193,7 @@
 	scene_qdat = queueIterator.operator->();
 	assert(scene_qdat != NULL);
 
-	loadScene(scene_qdat->scene_n, scene_qdat->load_flag, scene_qdat->scene_proc, scene_qdat->sceneDescription, scene_qdat->fadeType, 0);
+	loadScene(scene_qdat->scene_n, scene_qdat->load_flag, scene_qdat->scene_proc, scene_qdat->sceneDescription, scene_qdat->fadeType, -1);
 
 	return SUCCESS;
 }
@@ -806,7 +808,7 @@
 			}
 			break;
 		case SAGA_ACTION_MAP:
-			debug(0, "Loading exit map resource...");
+			debug(0, "Loading action map resource...");
 			_actionMap->load(res_data, res_data_len);
 			break;
 		case SAGA_ISO_TILESET:
@@ -824,8 +826,7 @@
 			break;
 		case SAGA_ISO_METAMAP:
 			if (!(_vm->_scene->getFlags() & kSceneFlagISO)) {
-				warning("Scene::ProcessSceneResources(): Isometric metamap incompatible with normal scene mode");
-				return FAILURE;
+				error("Scene::ProcessSceneResources(): Isometric metamap incompatible with normal scene mode");
 			}
 
 			debug(0, "Loading isometric metamap resource.");
@@ -837,8 +838,7 @@
 			break;
 		case SAGA_ISO_METATILESET:
 			if (!(_vm->_scene->getFlags() & kSceneFlagISO)) {
-				warning("Scene::ProcessSceneResources(): Isometric metatileset incompatible with normal scene mode");
-				return FAILURE;
+				error("Scene::ProcessSceneResources(): Isometric metatileset incompatible with normal scene mode");
 			}
 
 			debug(0, "Loading isometric metatileset resource.");
@@ -880,7 +880,8 @@
 			_vm->_palanim->loadPalAnim(_resList[i].res_data, _resList[i].res_data_len);
 			break;
 		case SAGA_ENTRY:
-			warning("Scene::ProcessSceneResources(): Loading scene entries is not implemented");
+			debug(0, "Loading entry list resource...");
+			_entryList->load(res_data, res_data_len);
 			break;
 		case SAGA_FACES:
 			_vm->_interface->loadScenePortraits(_resList[i].res_number);
@@ -960,6 +961,7 @@
 
 	_objectMap = NULL;
 	_actionMap->freeMem();
+	_entryList->freeMem();
 
 	_animList.clear();
 
@@ -1110,4 +1112,28 @@
 	return 0;
 }
 
+void SceneEntryList::load(const byte* resourcePointer, size_t resourceLength) {
+	int i;
+
+	_entryListCount = resourceLength / 8;
+
+	MemoryReadStreamEndian readS(resourcePointer, resourceLength, IS_BIG_ENDIAN);
+
+
+	if (_entryList)
+		error("SceneEntryList::load _entryList != NULL");
+
+	_entryList = (SceneEntry *) malloc(_entryListCount * sizeof(*_entryList));
+	if (_entryList == NULL) {
+		error("SceneEntryList::load Memory allocation failure");
+	}
+
+	for (i = 0; i < _entryListCount; i++) {
+		_entryList[i].location.x = readS.readSint16();
+		_entryList[i].location.y = readS.readSint16();
+		_entryList[i].location.z = readS.readSint16();
+		_entryList[i].facing = readS.readUint16();
+	}
+}
+
 } // End of namespace Saga

Index: scene.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- scene.h	15 Jan 2005 23:46:43 -0000	1.41
+++ scene.h	16 Jan 2005 19:06:04 -0000	1.42
@@ -28,6 +28,7 @@
 
 #include "saga/text.h"
 #include "saga/list.h"
+#include "saga/actor.h"
 
 namespace Saga {
 
@@ -38,6 +39,11 @@
 
 struct EVENT;
 
+enum SceneFlags {
+	kSceneFlagISO        = 1,
+	kSceneFlagShowCursor = 2
+};
+
 struct SCENE_BGINFO {
 	int bg_x;
 	int bg_y;
@@ -112,6 +118,40 @@
 	size_t resListCnt;
 };
 
+struct SceneEntry {
+	Location location;
+	int facing;
+};
+
+class SceneEntryList {
+private:
+	SagaEngine *_vm;
+	SceneEntry *_entryList;
+	int _entryListCount;
+public:
+	int getEntryListCount() const { return _entryListCount; }
+	const SceneEntry * getEntry(int index) {
+		if ((index < 0) || (index >= _entryListCount)) {
+			error("SceneEntryList::getEntry wrong index");
+		}
+		return &_entryList[index];
+	}
+	void load(const byte* resourcePointer, size_t resourceLength);
+
+	void freeMem() {
+		free(_entryList);
+		_entryList = NULL;
+		_entryListCount = 0;
+	}
+	SceneEntryList(SagaEngine *vm): _vm(vm) {
+		_entryList = NULL;
+		_entryListCount = 0;
+	}
+	~SceneEntryList() {
+		freeMem();
+	}
+};
+
 struct SCENE_IMAGE {
 	int loaded;
 	int w;
@@ -180,10 +220,6 @@
 	const char *string;
 };
 
-enum SceneFlags {
-	kSceneFlagISO        = 1,
-	kSceneFlagShowCursor = 2
-};
 
 class Scene {
  public:
@@ -270,6 +306,7 @@
  public:
 	ActionMap *_actionMap;
 	ObjectMap *_objectMap;
+	SceneEntryList *_entryList;
 
  private:
 	int IHNMStartProc();





More information about the Scummvm-git-logs mailing list