diff options
author | David Eriksson | 2003-10-02 19:20:00 +0000 |
---|---|---|
committer | David Eriksson | 2003-10-02 19:20:00 +0000 |
commit | 6d29d07cabafdfef5bc10214a04ca87601403bbf (patch) | |
tree | 33c4e9e4b3ea1bfade41b98489b6d627b781fad9 /queen | |
parent | 0e645f88ae1586dbac2bf0855fd0fda1f8f11eeb (diff) | |
download | scummvm-rg350-6d29d07cabafdfef5bc10214a04ca87601403bbf.tar.gz scummvm-rg350-6d29d07cabafdfef5bc10214a04ca87601403bbf.tar.bz2 scummvm-rg350-6d29d07cabafdfef5bc10214a04ca87601403bbf.zip |
Fix bugs, add warnings.
svn-id: r10545
Diffstat (limited to 'queen')
-rw-r--r-- | queen/logic.cpp | 33 | ||||
-rw-r--r-- | queen/logic.h | 2 |
2 files changed, 25 insertions, 10 deletions
diff --git a/queen/logic.cpp b/queen/logic.cpp index 24390c32d6..f83432e9dc 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -21,7 +21,8 @@ #include "queen/logic.h" -QueenLogic::QueenLogic(QueenResource *resource) : _resource(resource) { +QueenLogic::QueenLogic(QueenResource *resource) + : _resource(resource), _maxStaticFrame(0), _maxAnimatedFrame(0) { _jas = _resource->loadFile("QUEEN.JAS", 20); initialise(); @@ -61,21 +62,21 @@ void QueenLogic::initialise() { _objectData[0].state = 0; _objectData[0].image = 0; for (i = 1; i < (_numObjects + 1); i++) { - _objectData[0].name = READ_BE_UINT16(ptr); + _objectData[i].name = (int16)READ_BE_UINT16(ptr); ptr += 2; - _objectData[0].x = READ_BE_UINT16(ptr); + _objectData[i].x = READ_BE_UINT16(ptr); ptr += 2; - _objectData[0].y = READ_BE_UINT16(ptr); + _objectData[i].y = READ_BE_UINT16(ptr); ptr += 2; - _objectData[0].description = READ_BE_UINT16(ptr); + _objectData[i].description = READ_BE_UINT16(ptr); ptr += 2; - _objectData[0].entryObj = (int16)READ_BE_UINT16(ptr); + _objectData[i].entryObj = (int16)READ_BE_UINT16(ptr); ptr += 2; - _objectData[0].room = READ_BE_UINT16(ptr); + _objectData[i].room = READ_BE_UINT16(ptr); ptr += 2; - _objectData[0].state = (int16)READ_BE_UINT16(ptr); + _objectData[i].state = (int16)READ_BE_UINT16(ptr); ptr += 2; - _objectData[0].image = (int16)READ_BE_UINT16(ptr); + _objectData[i].image = (int16)READ_BE_UINT16(ptr); ptr += 2; } #else @@ -234,7 +235,17 @@ uint16 QueenLogic::findBob(uint16 obj) { uint16 bobnum = 0; uint16 bobtype = 0; // 1 for animated, 0 for static + if (obj > _numObjects) { + debug(0, "Object index (%i) > _numObjects (%i)", obj, _numObjects); + abort(); + } + uint16 room = _objectData[obj].room; + + if (room >= _numRooms) { + warning("room (%i) > _numRooms (%i)", room, _numRooms); + } + int16 img = _objectData[obj].image; if(img != 0) { if(img == -3 || img == -4) { @@ -279,6 +290,10 @@ uint16 QueenLogic::findBob(uint16 obj) { if(img > 5000) { img -= 5000; } + + if (img >= _numGraphics) + warning("img (%i) >= _numGraphics (%i)", img, _numGraphics); + if(_graphicData[img].lastFrame != 0) { ++idxAnimated; } diff --git a/queen/logic.h b/queen/logic.h index a2d8b6fef9..547dcc0563 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -32,7 +32,7 @@ struct GraphicData { }; struct ObjectData { - uint16 name; + int16 name; uint16 x; uint16 y; uint16 description; |