diff options
author | Andrew Kurushin | 2005-01-18 11:55:31 +0000 |
---|---|---|
committer | Andrew Kurushin | 2005-01-18 11:55:31 +0000 |
commit | 0b4fd4adbf88b1dac138e9ef55feefc7e2fd79ca (patch) | |
tree | d971b6b369db498d1f29c763039856141e72b63d | |
parent | c9d0d4c840aac829d42bc5ec1b5b1e7f30b5a50c (diff) | |
download | scummvm-rg350-0b4fd4adbf88b1dac138e9ef55feefc7e2fd79ca.tar.gz scummvm-rg350-0b4fd4adbf88b1dac138e9ef55feefc7e2fd79ca.tar.bz2 scummvm-rg350-0b4fd4adbf88b1dac138e9ef55feefc7e2fd79ca.zip |
- merged ActionMap and ObjectMap
- remove ActionMap.h & ActionMap.cpp
- ObjectMap names move to Scene::_sceneStrings as in original engine
- fix wrong StringsTable::stringsCount calculation
svn-id: r16592
-rw-r--r-- | saga/actor.cpp | 4 | ||||
-rw-r--r-- | saga/interface.cpp | 3 | ||||
-rw-r--r-- | saga/objectmap.cpp | 322 | ||||
-rw-r--r-- | saga/objectmap.h | 53 | ||||
-rw-r--r-- | saga/render.cpp | 3 | ||||
-rw-r--r-- | saga/saga.cpp | 3 | ||||
-rw-r--r-- | saga/saga.h | 3 | ||||
-rw-r--r-- | saga/scene.cpp | 57 | ||||
-rw-r--r-- | saga/scene.h | 36 | ||||
-rw-r--r-- | saga/sthread.cpp | 2 |
10 files changed, 112 insertions, 374 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp index 9ac8b3024f..0bb8ccafda 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -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 @@ void Actor::updateActorsScene(int actorsEntrance) { 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 diff --git a/saga/interface.cpp b/saga/interface.cpp index 05493da657..8bb72e9843 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -497,7 +497,7 @@ int Interface::handlePlayfieldClick(SURFACE *ds, const Point& imousePt) { 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 @@ void Interface::converseInit(void) { _converseText[i].text = NULL; converseClear(); } + void Interface::converseClear(void) { for (int i = 0; i < CONVERSE_MAX_TEXTS; i++) { if (_converseText[i].text) diff --git a/saga/objectmap.cpp b/saga/objectmap.cpp index c8c43068db..7333ea7e18 100644 --- a/saga/objectmap.cpp +++ b/saga/objectmap.cpp @@ -133,307 +133,75 @@ void HitZone::draw(SURFACE *ds, int color) { } -// 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; + if (_hitZoneList) + error("ObjectMap::load _hitZoneList != NULL"); - return SUCCESS; -} - -// 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; +void ObjectMap::draw(SURFACE *ds, const Point& testPoint, int color, int color2) { + int i; + int hitZoneIndex; + char txtBuf[32]; - int i, k; + hitZoneIndex = hitTest(testPoint); - if (!_objectsLoaded) { - return FAILURE; + for (i = 0; i < _hitZoneListCount; i++) { + _hitZoneList[i]->draw(ds, (hitZoneIndex == i) ? color2 : color); } - if ((objectNum = hitTest(imousePt)) != -1) { - hitObject = true; - } - - 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; - } + 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); - 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 (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 @@ int ObjectMap::hitTest(const Point& imousePt) { } 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 diff --git a/saga/objectmap.h b/saga/objectmap.h index 3a856161c4..4571e77a1c 100644 --- a/saga/objectmap.h +++ b/saga/objectmap.h @@ -73,42 +73,35 @@ private: }; -struct OBJECTMAP_ENTRY { - byte flags; - byte defaultVerb; - - int objectNum; - int scriptNum; +class ObjectMap { +public: + ObjectMap(SagaEngine *vm) : _vm(vm) { + _hitZoneList = NULL; + _hitZoneListCount = 0; - int nClickareas; - CLICKAREA *clickareas; -}; + } + ~ObjectMap(void) { + freeMem(); + } + void load(const byte *resourcePointer, size_t resourceLength); + void freeMem(void); + + 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 diff --git a/saga/render.cpp b/saga/render.cpp index c3a72e779e..2446ae38e7 100644 --- a/saga/render.cpp +++ b/saga/render.cpp @@ -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 @@ int Render::drawScene() { 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 diff --git a/saga/saga.cpp b/saga/saga.cpp index 657f0fc4cd..6d06a149d7 100644 --- a/saga/saga.cpp +++ b/saga/saga.cpp @@ -330,7 +330,7 @@ void SagaEngine::loadStrings(StringsTable &stringsTable, const byte *stringsPoin 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 @@ void SagaEngine::loadStrings(StringsTable &stringsTable, const byte *stringsPoin error("invalid string offset"); } stringsTable.strings[i] = (const char *)stringsTable.stringsPointer + offset; + debug(9, "string[%i]=%s", i, stringsTable.strings[i]); } } diff --git a/saga/saga.h b/saga/saga.h index 7f17aa2e5d..b3b32aaae5 100644 --- a/saga/saga.h +++ b/saga/saga.h @@ -209,6 +209,9 @@ struct StringsTable { StringsTable() { memset(this, 0, sizeof(*this)); } + ~StringsTable() { + freeMem(); + } }; struct CLICKAREA { diff --git a/saga/scene.cpp b/saga/scene.cpp index 37ed57290b..0b5173ebd7 100644 --- a/saga/scene.cpp +++ b/saga/scene.cpp @@ -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 @@ Scene::Scene(SagaEngine *vm) : _vm(vm), _initialized(false) { _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 @@ Scene::~Scene() { if (_initialized) { endScene(); delete _actionMap; - delete _entryList; free(_sceneLUT); } } @@ -752,8 +749,6 @@ int Scene::processSceneResources() { 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 @@ int Scene::processSceneResources() { &_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 @@ int Scene::processSceneResources() { 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 @@ int Scene::endScene() { _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 @@ int Scene::defaultScene(int param, SCENE_INFO *scene_info) { 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(); } } diff --git a/saga/scene.h b/saga/scene.h index cef6d76901..c76037ae60 100644 --- a/saga/scene.h +++ b/saga/scene.h @@ -76,7 +76,7 @@ enum SCENE_PROC_PARAMS { 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 @@ struct SceneEntry { 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 @@ class Scene { 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 @@ class Scene { 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(); diff --git a/saga/sthread.cpp b/saga/sthread.cpp index cdd679ab3e..6fbc253775 100644 --- a/saga/sthread.cpp +++ b/saga/sthread.cpp @@ -509,7 +509,7 @@ void Script::runThread(ScriptThread *thread, int instr_limit) { // (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: |