SAGA: fix SAGA_DEBUG; fix IHNM cutaway typo

svn-id: r53781
This commit is contained in:
Andrew Kurushin 2010-10-24 22:40:37 +00:00
parent 0f1ae79ac4
commit 599094d3a0
4 changed files with 22 additions and 21 deletions

View File

@ -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");
}

View File

@ -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();
}
}

View File

@ -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

View File

@ -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