diff options
author | Andrew Kurushin | 2010-10-24 22:40:37 +0000 |
---|---|---|
committer | Andrew Kurushin | 2010-10-24 22:40:37 +0000 |
commit | 599094d3a086db31a4988b27b480399beb51dafd (patch) | |
tree | 8d9102ec7961216ed357b2dae6214c55e5dca014 /engines/saga | |
parent | 0f1ae79ac476c7871e91e4e5c01e2bc752c93777 (diff) | |
download | scummvm-rg350-599094d3a086db31a4988b27b480399beb51dafd.tar.gz scummvm-rg350-599094d3a086db31a4988b27b480399beb51dafd.tar.bz2 scummvm-rg350-599094d3a086db31a4988b27b480399beb51dafd.zip |
SAGA: fix SAGA_DEBUG; fix IHNM cutaway typo
svn-id: r53781
Diffstat (limited to 'engines/saga')
-rw-r--r-- | engines/saga/introproc_ihnm.cpp | 2 | ||||
-rw-r--r-- | engines/saga/objectmap.cpp | 20 | ||||
-rw-r--r-- | engines/saga/objectmap.h | 6 | ||||
-rw-r--r-- | engines/saga/scene.cpp | 15 |
4 files changed, 22 insertions, 21 deletions
diff --git a/engines/saga/introproc_ihnm.cpp b/engines/saga/introproc_ihnm.cpp index cf3dd5cb4c..2053c7158f 100644 --- a/engines/saga/introproc_ihnm.cpp +++ b/engines/saga/introproc_ihnm.cpp @@ -133,7 +133,7 @@ void Scene::IHNMLoadCutaways() { else _vm->_resource->loadResource(resourceContext, RID_IHNMDEMO_INTRO_CUTAWAYS, resourceData); - if (resourceData.empty() == 0) { + if (resourceData.empty()) { error("Scene::IHNMStartProc() Can't load cutaway list"); } diff --git a/engines/saga/objectmap.cpp b/engines/saga/objectmap.cpp index 4d7b78f7f6..61d90cda69 100644 --- a/engines/saga/objectmap.cpp +++ b/engines/saga/objectmap.cpp @@ -164,7 +164,6 @@ void HitZone::draw(SagaEngine *vm, int color) { // Loads an object map resource ( objects ( clickareas ( points ) ) ) void ObjectMap::load(const ByteArray &resourceData) { - uint i; if (!_hitZoneList.empty()) { error("ObjectMap::load _hitZoneList not empty"); @@ -182,8 +181,9 @@ void ObjectMap::load(const ByteArray &resourceData) { _hitZoneList.resize(readS.readUint16()); - for (i = 0; i < _hitZoneList.size(); i++) { - _hitZoneList[i].load(_vm, &readS, i, _vm->_scene->currentSceneNumber()); + int idx = 0; + for (HitZoneArray::iterator i = _hitZoneList.begin(); i != _hitZoneList.end(); ++i) { + i->load(_vm, &readS, idx++, _vm->_scene->currentSceneNumber()); } } @@ -193,8 +193,7 @@ void ObjectMap::clear() { #ifdef SAGA_DEBUG void ObjectMap::draw(const Point& testPoint, int color, int color2) { - uint i; - uint hitZoneIndex; + int hitZoneIndex; char txtBuf[32]; Point pickPoint; Point textPoint; @@ -209,8 +208,8 @@ void ObjectMap::draw(const Point& testPoint, int color, int color2) { hitZoneIndex = hitTest(pickPoint); - for (i = 0; i < _hitZoneList.size(); i++) { - _hitZoneList[i].draw(_vm, (hitZoneIndex == i) ? color2 : color); + for (HitZoneArray::iterator i = _hitZoneList.begin(); i != _hitZoneList.end(); ++i) { + i->draw(_vm, (hitZoneIndex == i->getIndex()) ? color2 : color); } if (hitZoneIndex != -1) { @@ -223,12 +222,11 @@ void ObjectMap::draw(const Point& testPoint, int color, int color2) { #endif int ObjectMap::hitTest(const Point& testPoint) { - uint i; // Loop through all scene objects - for (i = 0; i < _hitZoneList.size(); i++) { - if (_hitZoneList[i].hitTest(testPoint)) { - return i; + for (HitZoneArray::iterator i = _hitZoneList.begin(); i != _hitZoneList.end(); ++i) { + if (i->hitTest(testPoint)) { + return i->getIndex(); } } diff --git a/engines/saga/objectmap.h b/engines/saga/objectmap.h index 264e197196..446afd478e 100644 --- a/engines/saga/objectmap.h +++ b/engines/saga/objectmap.h @@ -38,6 +38,9 @@ private: public: void load(SagaEngine *vm, MemoryReadStreamEndian *readStream, int index, int sceneNumber); + int getIndex() const { + return _index; + } int getNameIndex() const { return _nameIndex; } @@ -87,6 +90,7 @@ private: ClickAreas _clickAreas; }; +typedef Common::Array<HitZone> HitZoneArray; class ObjectMap { public: @@ -110,7 +114,7 @@ public: private: SagaEngine *_vm; - Common::Array<HitZone> _hitZoneList; + HitZoneArray _hitZoneList; }; } // End of namespace Saga diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp index 6631918b4c..d40a0dbd8b 100644 --- a/engines/saga/scene.cpp +++ b/engines/saga/scene.cpp @@ -175,7 +175,6 @@ Scene::Scene(SagaEngine *vm) : _vm(vm) { #define DUMP_SCENES_LEVEL 10 if (DUMP_SCENES_LEVEL <= gDebugLevel) { - uint j; int backUpDebugLevel = gDebugLevel; SAGAResourceTypes *types; int typesCount; @@ -189,16 +188,16 @@ Scene::Scene(SagaEngine *vm) : _vm(vm) { loadSceneResourceList(_sceneDescription.resourceListResourceId); gDebugLevel = backUpDebugLevel; debug(DUMP_SCENES_LEVEL, "Dump Scene: number %i, descriptor resourceId %i, resourceList resourceId %i", i, _sceneLUT[i], _sceneDescription.resourceListResourceId); - debug(DUMP_SCENES_LEVEL, "\tresourceListCount %i", (int)_resourceListCount); - for (j = 0; j < _resourceListCount; j++) { - if (_resourceList[j].resourceType >= typesCount) { - error("wrong resource type %i", _resourceList[j].resourceType); + debug(DUMP_SCENES_LEVEL, "\tresourceListCount %i", (int)_resourceList.size()); + for (SceneResourceDataArray::iterator j = _resourceList.begin(); j != _resourceList.end(); ++j) { + if (j->resourceType >= typesCount) { + error("wrong resource type %i", j->resourceType); } - resType = types[_resourceList[j].resourceType]; + resType = types[j->resourceType]; - debug(DUMP_SCENES_LEVEL, "\t%s resourceId %i", SAGAResourceTypesString[resType], _resourceList[j].resourceId); + debug(DUMP_SCENES_LEVEL, "\t%s resourceId %i", SAGAResourceTypesString[resType], j->resourceId); } - free(_resourceList); + _resourceList.clear(); } } #endif |