[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.95,1.96 interface.cpp,1.66,1.67 objectmap.cpp,1.34,1.35 objectmap.h,1.18,1.19 render.cpp,1.49,1.50 saga.cpp,1.93,1.94 saga.h,1.77,1.78 scene.cpp,1.85,1.86 scene.h,1.42,1.43 sthread.cpp,1.61,1.62
Andrew Kurushin
h00ligan at users.sourceforge.net
Tue Jan 18 03:57:00 CET 2005
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/saga interface.cpp,1.65,1.66 interface.h,1.32,1.33 saga.cpp,1.92,1.93
- Next message: [Scummvm-cvs-logs] CVS: scummvm/saga module.mk,1.21,1.22 scene.h,1.43,1.44 xref.txt,1.18,1.19 actionmap.cpp,1.36,NONE actionmap.h,1.18,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13367
Modified Files:
actor.cpp interface.cpp objectmap.cpp objectmap.h render.cpp
saga.cpp saga.h scene.cpp scene.h sthread.cpp
Log Message:
- merged ActionMap and ObjectMap
- remove ActionMap.h & ActionMap.cpp
- ObjectMap names move to Scene::_sceneStrings as in original engine
- fix wrong StringsTable::stringsCount calculation
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- actor.cpp 17 Jan 2005 14:57:28 -0000 1.95
+++ actor.cpp 18 Jan 2005 11:55:30 -0000 1.96
@@ -33,13 +33,13 @@
#include "saga/text.h"
#include "saga/sound.h"
#include "saga/scene.h"
-#include "saga/actionmap.h"
#include "saga/actor.h"
#include "saga/actordata.h"
#include "saga/stream.h"
#include "saga/interface.h"
#include "saga/events.h"
+#include "saga/objectmap.h"
#include "common/config-manager.h"
namespace Saga {
@@ -505,7 +505,7 @@
assert(_protagonist);
if (actorsEntrance >= 0) {
- sceneEntry = _vm->_scene->_entryList->getEntry(actorsEntrance);
+ sceneEntry = _vm->_scene->_entryList.getEntry(actorsEntrance);
// tiled stuff
if (_vm->_scene->getFlags() & kSceneFlagISO) {
//todo: it
Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- interface.cpp 18 Jan 2005 10:45:36 -0000 1.66
+++ interface.cpp 18 Jan 2005 11:55:30 -0000 1.67
@@ -497,7 +497,7 @@
return SUCCESS;
}
- object_flags = _vm->_scene->_objectMap->getFlags(objectNum);
+// object_flags = _vm->_scene->_objectMap->getFlags(objectNum);
if (object_flags & kHitZoneExit) { // FIXME. This is wrong
/* if ((script_num = _vm->_scene->_objectMap->getEPNum(objectNum)) != -1) {
@@ -746,6 +746,7 @@
_converseText[i].text = NULL;
converseClear();
}
+
void Interface::converseClear(void) {
for (int i = 0; i < CONVERSE_MAX_TEXTS; i++) {
if (_converseText[i].text)
Index: objectmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- objectmap.cpp 15 Jan 2005 20:12:48 -0000 1.34
+++ objectmap.cpp 18 Jan 2005 11:55:31 -0000 1.35
@@ -133,307 +133,75 @@
}
-// Initializes the object map module, creates module allocation context
-ObjectMap::ObjectMap(SagaEngine *vm) : _vm(vm) {
- _objectsLoaded = false;
- _namesLoaded = false;
- _nNames = 0;
-}
-
-// Shuts down the object map module, destroys module allocation context
-ObjectMap::~ObjectMap() {
- freeMem();
- freeNames();
-}
-
// Loads an object map resource ( objects ( clickareas ( points ) ) )
-int ObjectMap::load(const byte *om_res, size_t om_res_len) {
- OBJECTMAP_ENTRY *object_map;
- CLICKAREA *clickarea;
- Point *point;
-
- int i, k, m;
-
- MemoryReadStreamEndian readS(om_res, om_res_len, IS_BIG_ENDIAN);
-
- if (_objectsLoaded) {
- freeMem();
- }
-
- // Obtain object count N and allocate space for N objects
- _nObjects = readS.readUint16();
-
- _objectMaps = (OBJECTMAP_ENTRY *)malloc(_nObjects * sizeof(*_objectMaps));
-
- if (_objectMaps == NULL) {
- warning("Error: Memory allocation failed");
- return MEM;
- }
-
- // Load all N objects
- for (i = 0; i < _nObjects; i++) {
- object_map = &_objectMaps[i];
- object_map->flags = readS.readByte();
- object_map->nClickareas = readS.readByte();
- object_map->defaultVerb = readS.readByte();
- readS.readByte();
- object_map->objectNum = readS.readUint16();
- object_map->scriptNum = readS.readUint16();
- object_map->clickareas = (CLICKAREA *)malloc(object_map->nClickareas * sizeof(*(object_map->clickareas)));
-
- if (object_map->clickareas == NULL) {
- warning("Error: Memory allocation failed");
- return MEM;
- }
-
- // Load all clickareas for this object
- for (k = 0; k < object_map->nClickareas; k++) {
- clickarea = &object_map->clickareas[k];
- clickarea->n_points = readS.readUint16LE();
- assert(clickarea->n_points != 0);
-
- clickarea->points = (Point *)malloc(clickarea->n_points * sizeof(*(clickarea->points)));
- if (clickarea->points == NULL) {
- warning("Error: Memory allocation failed");
- return MEM;
- }
-
- // Load all points for this clickarea
- for (m = 0; m < clickarea->n_points; m++) {
- point = &clickarea->points[m];
- point->x = readS.readSint16();
- point->y = readS.readSint16();
- }
- debug(2, "ObjectMap::load(): Read %d points for clickarea %d in object %d.",
- clickarea->n_points, k, object_map->objectNum);
- }
- }
-
- _objectsLoaded = true;
-
- return SUCCESS;
-}
-
-// Frees all storage allocated for the current object map data
-int ObjectMap::freeMem() {
- OBJECTMAP_ENTRY *object_map;
- CLICKAREA *clickarea;
-
- int i, k;
-
- if (!_objectsLoaded) {
- return FAILURE;
- }
-
- for (i = 0; i < _nObjects; i++) {
- object_map = &_objectMaps[i];
- for (k = 0; k < object_map->nClickareas; k++) {
- clickarea = &object_map->clickareas[k];
- free(clickarea->points);
- }
- free(object_map->clickareas);
- }
-
- if (_nObjects) {
- free(_objectMaps);
- }
-
- _objectsLoaded = false;
-
- return SUCCESS;
-}
-
-// Loads an object name list resource
-int ObjectMap::loadNames(const unsigned char *onl_res, size_t onl_res_len) {
- int table_len;
- int n_names;
- size_t name_offset;
-
+void ObjectMap::load(const byte *resourcePointer, size_t resourceLength) {
int i;
- MemoryReadStreamEndian readS(onl_res, onl_res_len, IS_BIG_ENDIAN);
-
- if (_namesLoaded) {
- freeNames();
- }
-
- table_len = readS.readUint16();
-
- n_names = table_len / 2 - 2;
- _nNames = n_names;
-
- debug(2, "ObjectMap::loadNames: Loading %d object names.", n_names);
- _names = (const char **)malloc(n_names * sizeof(*_names));
-
- if (_names == NULL) {
- warning("Error: Memory allocation failed");
- return MEM;
+ if (resourceLength < 4) {
+ error("ObjectMap::load wrong resourceLength");
}
- for (i = 0; i < n_names; i++) {
- name_offset = readS.readUint16();
- _names[i] = (const char *)(onl_res + name_offset);
+ MemoryReadStreamEndian readS(resourcePointer, resourceLength, IS_BIG_ENDIAN);
- debug(3, "Loaded object name string: %s", _names[i]);
+ _hitZoneListCount = readS.readSint16();
+ if (_hitZoneListCount < 0) {
+ error("ObjectMap::load _hitZoneListCount < 0");
}
- _namesLoaded = true;
-
- return SUCCESS;
-}
+ if (_hitZoneList)
+ error("ObjectMap::load _hitZoneList != NULL");
-// Frees all storage allocated for the current object name list data
-int ObjectMap::freeNames() {
- if (!_namesLoaded) {
- return FAILURE;
+ _hitZoneList = (HitZone **) malloc(_hitZoneListCount * sizeof(HitZone *));
+ if (_hitZoneList == NULL) {
+ error("ObjectMap::load Memory allocation failure");
}
- if (_nNames) {
- free(_names);
+ for (i = 0; i < _hitZoneListCount; i++) {
+ _hitZoneList[i] = new HitZone(&readS);
}
-
- _namesLoaded = false;
- return SUCCESS;
}
-// If 'object' is a valid object number in the currently loaded object
-// name list resource, the funciton sets '*name' to the descriptive string
-// corresponding to 'object' and returns SUCCESS. Otherwise it returns
-// FAILURE.
-const char *ObjectMap::getName(int object) {
- assert(_namesLoaded);
- assert((object > 0) && (object <= _nNames));
-
- return _names[object - 1];
-}
-
-const uint16 ObjectMap::getFlags(int object) {
+void ObjectMap::freeMem() {
int i;
- assert(_namesLoaded);
- assert((object > 0) && (object <= _nNames));
-
- for (i = 0; i < _nObjects; i++) {
- if (_objectMaps[i].objectNum == object) {
- return _objectMaps[i].flags;
+ if (_hitZoneList) {
+ for (i = 0; i < _hitZoneListCount; i++) {
+ delete _hitZoneList[i];
}
- }
-
- return 0;
-}
-
-
-// If 'object' is a valid object number in the currently loaded object
-// name list resource, the funciton sets '*ep_num' to the entrypoint number
-// corresponding to 'object' and returns SUCCESS. Otherwise, it returns
-// FAILURE.
-const int ObjectMap::getEPNum(int object) {
- int i;
-
- assert(_namesLoaded);
-
- if ((object < 0) || (object > (_nObjects + 1)))
- return -1;
- for (i = 0; i < _nObjects; i++)
- if (_objectMaps[i].objectNum == object)
- return _objectMaps[i].scriptNum;
-
- return -1;
+ free(_hitZoneList);
+ _hitZoneList = NULL;
+ }
}
-// Uses Gfx::drawLine to display all clickareas for each object in the
-// currently loaded object map resource.
-int ObjectMap::draw(SURFACE *ds, const Point& imousePt, int color, int color2) {
- OBJECTMAP_ENTRY *object_map;
- CLICKAREA *clickarea;
-
- char txt_buf[32];
-
- int draw_color = color;
- int draw_txt = 0;
- bool hitObject = false;
- int objectNum = 0;
- int i, k;
+void ObjectMap::draw(SURFACE *ds, const Point& testPoint, int color, int color2) {
+ int i;
+ int hitZoneIndex;
+ char txtBuf[32];
- if (!_objectsLoaded) {
- return FAILURE;
- }
+ hitZoneIndex = hitTest(testPoint);
- if ((objectNum = hitTest(imousePt)) != -1) {
- hitObject = true;
+ for (i = 0; i < _hitZoneListCount; i++) {
+ _hitZoneList[i]->draw(ds, (hitZoneIndex == i) ? color2 : color);
}
- for (i = 0; i < _nObjects; i++) {
- draw_color = color;
- if (hitObject && (objectNum == _objectMaps[i].objectNum)) {
- snprintf(txt_buf, sizeof(txt_buf), "obj %d: v %d, f %X",
- _objectMaps[i].objectNum,
- _objectMaps[i].defaultVerb,
- _objectMaps[i].flags);
- draw_txt = 1;
- draw_color = color2;
- }
-
- object_map = &_objectMaps[i];
-
- for (k = 0; k < object_map->nClickareas; k++) {
- clickarea = &object_map->clickareas[k];
- if (clickarea->n_points == 2) {
- // 2 points represent a box
- drawFrame(ds, &clickarea->points[0], &clickarea->points[1], draw_color);
- } else if (clickarea->n_points > 2) {
- // Otherwise draw a polyline
- drawPolyLine(ds, clickarea->points, clickarea->n_points, draw_color);
- }
- }
- }
+ if (hitZoneIndex != -1) {
+ snprintf(txtBuf, sizeof(txtBuf), "hitZone %d", hitZoneIndex);
+ _vm->_font->draw(SMALL_FONT_ID, ds, txtBuf, 0, 2, 2,
+ _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
- if (draw_txt) {
- _vm->_font->draw(SMALL_FONT_ID, ds, txt_buf, 0, 2, 2,
- _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
}
-
- return SUCCESS;
}
-int ObjectMap::hitTest(const Point& imousePt) {
- Point imouse;
- OBJECTMAP_ENTRY *object_map;
- CLICKAREA *clickarea;
- Point *points;
- int n_points;
-
- int i, k;
-
- imouse.x = imousePt.x;
- imouse.y = imousePt.y;
+int ObjectMap::hitTest(const Point& testPoint) {
+ int i;
// Loop through all scene objects
- for (i = 0; i < _nObjects; i++) {
- object_map = &_objectMaps[i];
-
- // Hit-test all clickareas for this object
- for (k = 0; k < object_map->nClickareas; k++) {
- clickarea = &object_map->clickareas[k];
- n_points = clickarea->n_points;
- points = clickarea->points;
-
- if (n_points == 2) {
- // Hit-test a box region
- if ((imouse.x > points[0].x) && (imouse.x <= points[1].x) &&
- (imouse.y > points[0].y) &&
- (imouse.y <= points[1].y)) {
- return object_map->objectNum;
- }
- } else if (n_points > 2) {
- // Hit-test a polygon
- if (hitTestPoly(points, n_points, imouse)) {
- return object_map->objectNum;
- }
- }
+ for (i = 0; i < _hitZoneListCount; i++) {
+ if (_hitZoneList[i]->hitTest(testPoint)) {
+ return i;
}
}
@@ -441,21 +209,7 @@
}
void ObjectMap::cmdInfo(void) {
- int i;
-
- _vm->_console->DebugPrintf("%d objects loaded.\n", _nObjects);
-
- for (i = 0; i < _nObjects; i++) {
- _vm->_console->DebugPrintf("%s:\n", _names[i]);
- _vm->_console->DebugPrintf("%d. verb: %d, flags: %X, name_i: %d, scr_n: %d, ca_ct: %d\n", i,
- _objectMaps[i].defaultVerb,
- _objectMaps[i].flags,
- _objectMaps[i].objectNum,
- _objectMaps[i].scriptNum,
- _objectMaps[i].nClickareas);
- }
-
- return;
+ _vm->_console->DebugPrintf("%d zone(s) loaded.\n\n", _hitZoneListCount);
}
} // End of namespace Saga
Index: objectmap.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- objectmap.h 15 Jan 2005 23:46:43 -0000 1.18
+++ objectmap.h 18 Jan 2005 11:55:31 -0000 1.19
@@ -73,42 +73,35 @@
};
-struct OBJECTMAP_ENTRY {
- byte flags;
- byte defaultVerb;
+class ObjectMap {
+public:
+ ObjectMap(SagaEngine *vm) : _vm(vm) {
+ _hitZoneList = NULL;
+ _hitZoneListCount = 0;
- int objectNum;
- int scriptNum;
+ }
+ ~ObjectMap(void) {
+ freeMem();
+ }
+ void load(const byte *resourcePointer, size_t resourceLength);
+ void freeMem(void);
- int nClickareas;
- CLICKAREA *clickareas;
-};
+ void draw(SURFACE *drawSurface, const Point& testPoint, int color, int color2);
+ int hitTest(const Point& testPoint);
+ const HitZone * getHitZone(int index) const {
+ if ((index < 0) || (index >= _hitZoneListCount)) {
+ error("ObjectMap::getHitZone wrong index 0x%X", index);
+ }
+ return _hitZoneList[index];
+ }
-class ObjectMap{
-public:
- ObjectMap(SagaEngine *vm);
- ~ObjectMap(void);
- int load(const byte *om_res, size_t om_res_len);
- int freeMem(void);
- int loadNames(const byte *onl_res, size_t onl_res_len);
- int freeNames();
- const char *getName(int object);
- const uint16 getFlags(int object);
- const int getEPNum(int object);
- int draw(SURFACE *draw_surface, const Point& imousePt, int color, int color2);
- int hitTest(const Point& imousePt);
void cmdInfo(void);
private:
-
- bool _objectsLoaded;
- int _nObjects;
- OBJECTMAP_ENTRY *_objectMaps;
-
- bool _namesLoaded;
- int _nNames;
- const char **_names;
SagaEngine *_vm;
+
+ int _hitZoneListCount;
+ HitZone **_hitZoneList;
};
} // End of namespace Saga
Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- render.cpp 10 Jan 2005 22:05:40 -0000 1.49
+++ render.cpp 18 Jan 2005 11:55:31 -0000 1.50
@@ -31,7 +31,6 @@
#include "saga/scene.h"
#include "saga/text.h"
-#include "saga/actionmap.h"
#include "saga/objectmap.h"
#include "saga/render.h"
@@ -129,7 +128,7 @@
if (_vm->_scene->_objectMap)
_vm->_scene->_objectMap->draw(backbuf_surface, mouse_pt, _vm->_gfx->getWhite(), _vm->_gfx->getBlack());
if (_vm->_scene->_actionMap)
- _vm->_scene->_actionMap->draw(backbuf_surface, _vm->_gfx->matchColor(RGB_RED));
+ _vm->_scene->_actionMap->draw(backbuf_surface, mouse_pt, _vm->_gfx->matchColor(RGB_RED), _vm->_gfx->getBlack());
}
// Draw queued actors
Index: saga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.cpp,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- saga.cpp 18 Jan 2005 10:45:36 -0000 1.93
+++ saga.cpp 18 Jan 2005 11:55:31 -0000 1.94
@@ -330,7 +330,7 @@
error("Invalid string offset");
}
- stringsCount = offset / 2;
+ stringsCount = offset / 2 - 2;
stringsTable.stringsCount = stringsCount;
stringsTable.strings = (const char **)malloc(stringsCount * sizeof(const char *));
@@ -345,6 +345,7 @@
error("invalid string offset");
}
stringsTable.strings[i] = (const char *)stringsTable.stringsPointer + offset;
+ debug(9, "string[%i]=%s", i, stringsTable.strings[i]);
}
}
Index: saga.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.h,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- saga.h 17 Jan 2005 18:48:58 -0000 1.77
+++ saga.h 18 Jan 2005 11:55:31 -0000 1.78
@@ -209,6 +209,9 @@
StringsTable() {
memset(this, 0, sizeof(*this));
}
+ ~StringsTable() {
+ freeMem();
+ }
};
struct CLICKAREA {
Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- scene.cpp 17 Jan 2005 18:48:58 -0000 1.85
+++ scene.cpp 18 Jan 2005 11:55:31 -0000 1.86
@@ -29,7 +29,6 @@
#include "saga/console.h"
#include "saga/interface.h"
#include "saga/events.h"
-#include "saga/actionmap.h"
#include "saga/isomap.h"
#include "saga/objectmap.h"
#include "saga/palanim.h"
@@ -115,9 +114,8 @@
_resList = NULL;
_animEntries = 0;
_sceneProc = NULL;
- _objectMap = NULL;
- _actionMap = new ActionMap(_vm);
- _entryList = new SceneEntryList(_vm);
+ _objectMap = new ObjectMap(_vm);
+ _actionMap = new ObjectMap(_vm);
memset(&_bg, 0, sizeof(_bg));
memset(&_bgMask, 0, sizeof(_bgMask));
@@ -128,7 +126,6 @@
if (_initialized) {
endScene();
delete _actionMap;
- delete _entryList;
free(_sceneLUT);
}
}
@@ -752,8 +749,6 @@
const byte *pal_p;
int i;
- _objectMap = new ObjectMap(_vm);
-
// Process the scene resource list
for (i = 0; i < _resListEntries; i++) {
res_data = _resList[i].res_data;
@@ -795,17 +790,13 @@
&_bgMask.buf_len, &_bgMask.w, &_bgMask.h);
debug(0, "BACKGROUND MASK width=%d height=%d length=%d", _bgMask.w, _bgMask.h, _bgMask.buf_len);
break;
- case SAGA_OBJECT_NAME_LIST:
- debug(0, "Loading object name list resource...");
- _objectMap->loadNames(_resList[i].res_data, _resList[i].res_data_len);
+ case SAGA_SCENE_NAME_LIST:
+ debug(0, "Loading scene name list resource...");
+ _vm->loadStrings(_sceneStrings, _resList[i].res_data, _resList[i].res_data_len);
break;
case SAGA_OBJECT_MAP:
debug(0, "Loading object map resource...");
- if (_objectMap->load(res_data,
- res_data_len) != SUCCESS) {
- warning("Scene::ProcessSceneResources(): Error loading object map resource");
- return FAILURE;
- }
+ _objectMap->load(res_data, res_data_len);
break;
case SAGA_ACTION_MAP:
debug(0, "Loading action map resource...");
@@ -881,7 +872,7 @@
break;
case SAGA_ENTRY:
debug(0, "Loading entry list resource...");
- _entryList->load(res_data, res_data_len);
+ loadSceneEntryList(res_data, res_data_len);
break;
case SAGA_FACES:
_vm->_interface->loadScenePortraits(_resList[i].res_number);
@@ -957,11 +948,11 @@
_vm->_anim->reset();
_vm->_palanim->freePalAnim();
- delete _objectMap;
-
- _objectMap = NULL;
+
+ _objectMap->freeMem();
_actionMap->freeMem();
- _entryList->freeMem();
+ _entryList.freeMem();
+ _sceneStrings.freeMem();
_animList.clear();
@@ -1112,27 +1103,27 @@
return 0;
}
-void SceneEntryList::load(const byte* resourcePointer, size_t resourceLength) {
+void Scene::loadSceneEntryList(const byte* resourcePointer, size_t resourceLength) {
int i;
-
- _entryListCount = resourceLength / 8;
+
+ _entryList.entryListCount = resourceLength / 8;
MemoryReadStreamEndian readS(resourcePointer, resourceLength, IS_BIG_ENDIAN);
- if (_entryList)
- error("SceneEntryList::load _entryList != NULL");
+ if (_entryList.entryList)
+ error("Scene::loadSceneEntryList entryList != NULL");
- _entryList = (SceneEntry *) malloc(_entryListCount * sizeof(*_entryList));
- if (_entryList == NULL) {
- error("SceneEntryList::load Memory allocation failure");
+ _entryList.entryList = (SceneEntry *) malloc(_entryList.entryListCount * sizeof(*_entryList.entryList));
+ if (_entryList.entryList == NULL) {
+ error("Scene::loadSceneEntryList 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();
+ for (i = 0; i < _entryList.entryListCount; i++) {
+ _entryList.entryList[i].location.x = readS.readSint16();
+ _entryList.entryList[i].location.y = readS.readSint16();
+ _entryList.entryList[i].location.z = readS.readSint16();
+ _entryList.entryList[i].facing = readS.readUint16();
}
}
Index: scene.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- scene.h 16 Jan 2005 19:06:04 -0000 1.42
+++ scene.h 18 Jan 2005 11:55:31 -0000 1.43
@@ -76,7 +76,7 @@
enum SAGA_RESOURCE_TYPES {
SAGA_BG_IMAGE = 2,
SAGA_BG_MASK = 3,
- SAGA_OBJECT_NAME_LIST = 5,
+ SAGA_SCENE_NAME_LIST = 5,
SAGA_OBJECT_MAP = 6,
SAGA_ACTION_MAP = 7,
SAGA_ISO_TILESET = 8,
@@ -123,29 +123,22 @@
int facing;
};
-class SceneEntryList {
-private:
- SagaEngine *_vm;
- SceneEntry *_entryList;
- int _entryListCount;
-public:
- int getEntryListCount() const { return _entryListCount; }
+struct SceneEntryList {
+ SceneEntry *entryList;
+ int entryListCount;
+
const SceneEntry * getEntry(int index) {
- if ((index < 0) || (index >= _entryListCount)) {
+ if ((index < 0) || (index >= entryListCount)) {
error("SceneEntryList::getEntry wrong index");
}
- return &_entryList[index];
+ return &entryList[index];
}
- void load(const byte* resourcePointer, size_t resourceLength);
-
void freeMem() {
- free(_entryList);
- _entryList = NULL;
- _entryListCount = 0;
+ free(entryList);
+ memset(this, 0, sizeof(*this));
}
- SceneEntryList(SagaEngine *vm): _vm(vm) {
- _entryList = NULL;
- _entryListCount = 0;
+ SceneEntryList() {
+ memset(this, 0, sizeof(*this));
}
~SceneEntryList() {
freeMem();
@@ -272,6 +265,7 @@
int loadScene(int scene, int load_flag, SCENE_PROC scene_proc, SceneDescription *, int fadeIn, int actorsEntrance);
int loadSceneDescriptor(uint32 res_number);
int loadSceneResourceList(uint32 res_number);
+ void loadSceneEntryList(const byte* resourcePointer, size_t resourceLength);
int processSceneResources();
private:
@@ -298,15 +292,17 @@
TEXTLIST *_textList;
SCENE_IMAGE _bg;
SCENE_IMAGE _bgMask;
+
+ StringsTable _sceneStrings;
int _sceneDoors[SCENE_DOORS_MAX];
static int SC_defaultScene(int param, SCENE_INFO *scene_info, void *refCon);
int defaultScene(int param, SCENE_INFO *scene_info);
public:
- ActionMap *_actionMap;
+ ObjectMap *_actionMap;
ObjectMap *_objectMap;
- SceneEntryList *_entryList;
+ SceneEntryList _entryList;
private:
int IHNMStartProc();
Index: sthread.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sthread.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- sthread.cpp 17 Jan 2005 20:17:06 -0000 1.61
+++ sthread.cpp 18 Jan 2005 11:55:31 -0000 1.62
@@ -509,7 +509,7 @@
// (NEG) Negate stack by 2's complement
case 0x25:
data = thread->pop();
- thread->push(-data);
+ thread->push(-(int)data);
break;
// (TSTZ) Test for zero
case 0x26:
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/saga interface.cpp,1.65,1.66 interface.h,1.32,1.33 saga.cpp,1.92,1.93
- Next message: [Scummvm-cvs-logs] CVS: scummvm/saga module.mk,1.21,1.22 scene.h,1.43,1.44 xref.txt,1.18,1.19 actionmap.cpp,1.36,NONE actionmap.h,1.18,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list