From 233e33cf78d96dcc127715d7a544c403232fa1b4 Mon Sep 17 00:00:00 2001 From: David Eriksson Date: Wed, 15 Oct 2003 10:01:54 +0000 Subject: - Use Logic::roomRefreshObject() in Cutaway - Fix tiny bugs in Logic::roomRefreshObject() svn-id: r10812 --- queen/cutaway.cpp | 19 +++++++++---------- queen/cutaway.h | 2 +- queen/logic.cpp | 15 ++++++++++----- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp index febcbc1073..74c6fd4086 100644 --- a/queen/cutaway.cpp +++ b/queen/cutaway.cpp @@ -227,8 +227,10 @@ byte *Cutaway::getCutawayObject(byte *ptr, CutawayObject &object) error("Wrong number of values read"); // Make ugly reuse of data less ugly - if (object.limitBobX1 < 0) + if (object.limitBobX1 < 0) { object.song = -object.limitBobX1; + object.limitBobX1 = 0; + } else object.song = 0; @@ -244,9 +246,9 @@ void Cutaway::dumpCutawayObject(int index, CutawayObject &object) switch (object.objectNumber) { case -1: objectNumberStr = "MESSAGE"; break; case 0: objectNumberStr = "Joe"; break; - case 196: objectNumberStr = "Chef"; break; - case 548: objectNumberStr = "Anderson"; break; - default: objectNumberStr = "unknown"; break; + default: + objectNumberStr = _logic->objectName(_logic->objectData(object.objectNumber)->name); + break; } debug(0, "objectNumber = %i (%s)", object.objectNumber, objectNumberStr); @@ -455,8 +457,7 @@ Cutaway::ObjectType Cutaway::getObjectType(CutawayObject &object) { objectData->name = abs(objectData->name); } - // XXX REDISP_OBJECT(OBJECT); - debug(0, "REDISP_OBJECT needed for object %i", object.objectNumber); + _logic->roomRefreshObject(object.objectNumber); // Skip doing any anim stuff objectType = OBJECT_TYPE_NO_ANIMATION; @@ -1002,15 +1003,13 @@ void Cutaway::updateGameState() { objectData->name = abs(objectData->name); if (fromObject > 0) objectCopy(fromObject, objectIndex); - // XXX REDISP_OBJECT(objectIndex); - debug(0, "REDISP_OBJECT needed for object %i", objectIndex); + _logic->roomRefreshObject(objectIndex); } else if (objectIndex < 0) { // Hide the object objectIndex = -objectIndex; ObjectData *objectData = _logic->objectData(objectIndex); objectData->name = -abs(objectData->name); - // XXX REDISP_OBJECT(objectIndex); - debug(0, "REDISP_OBJECT needed for object %i", objectIndex); + _logic->roomRefreshObject(objectIndex); } if (areaIndex > 0) { diff --git a/queen/cutaway.h b/queen/cutaway.h index e4faf5a5ae..11b8c17a03 100644 --- a/queen/cutaway.h +++ b/queen/cutaway.h @@ -263,7 +263,7 @@ class Cutaway { static byte *getCutawayObject(byte *ptr, CutawayObject &object); //! Dump a CutawayObject with debug() - static void dumpCutawayObject(int index, CutawayObject &object); + void dumpCutawayObject(int index, CutawayObject &object); //! Dump CutawayAnum data with debug() static void dumpCutawayAnim(CutawayAnim &anim); diff --git a/queen/logic.cpp b/queen/logic.cpp index ac29bdcd77..4880170224 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -968,7 +968,7 @@ void Logic::roomSetupObjects() { uint16 Logic::roomRefreshObject(uint16 obj) { - warning("Logic::roomSetupObjects() not fully implemented"); + warning("Logic::roomRefreshObject() not fully implemented"); uint16 curImage = _numFrames; ObjectData *pod = &_objectData[obj]; @@ -978,7 +978,8 @@ uint16 Logic::roomRefreshObject(uint16 obj) { // check the object is in the current room if (pod->room != _currentRoom) { - warning("Logic::roomRefreshObject() - Trying to display an object that is not in room"); + warning("Logic::roomRefreshObject() - Trying to display an object (%i=%s) that is not in room (object room=%i, current room=%i)", + obj, _objName[obj], pod->room, _currentRoom); return curImage; } @@ -1020,8 +1021,12 @@ uint16 Logic::roomRefreshObject(uint16 obj) { // find frame used for object curImage = findFrame(obj); - if (pod->image > 5000) { - GraphicData *pgd = &_graphicData[pod->image - 5000]; + int image = pod->image; + if (pod->image > 5000) + image -= 5000; + + + GraphicData *pgd = &_graphicData[image]; bool rebound = false; int16 lastFrame = pgd->lastFrame; if (lastFrame < 0) { @@ -1061,7 +1066,7 @@ uint16 Logic::roomRefreshObject(uint16 obj) { pbs->y = pgd->y; pbs->frameNum = curImage; } - } + return curImage; } -- cgit v1.2.3