From e19909d3e394682b1610a9b0326b449a7f288099 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Fri, 5 Dec 2003 13:56:07 +0000 Subject: cleanup, s/abs/ABS/g svn-id: r11501 --- queen/cutaway.cpp | 26 +++++++++++++------------- queen/logic.cpp | 10 +++++----- queen/logic.h | 23 +++++++++-------------- queen/talk.cpp | 4 ++-- queen/verb.h | 6 ------ 5 files changed, 29 insertions(+), 40 deletions(-) diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp index 2654703f62..b3983b0163 100644 --- a/queen/cutaway.cpp +++ b/queen/cutaway.cpp @@ -258,7 +258,7 @@ void Cutaway::dumpCutawayObject(int index, CutawayObject &object) objectNumberStr = "Joe"; break; default: if (object.objectNumber > 0) - objectNumberStr = _logic->objectName(abs(_logic->objectData(object.objectNumber)->name)); + objectNumberStr = _logic->objectName(ABS(_logic->objectData(object.objectNumber)->name)); else objectNumberStr = "Unknown!"; break; @@ -958,11 +958,11 @@ void Cutaway::changeRooms(CutawayObject &object) { if (on) { // It is needed, so ensure it's ON - objectData->name = abs(objectData->name); + objectData->name = ABS(objectData->name); } else { // Not needed, so switch off! - objectData->name = -abs(objectData->name); + objectData->name = -ABS(objectData->name); } } @@ -1035,7 +1035,7 @@ Cutaway::ObjectType Cutaway::getObjectType(CutawayObject &object) { else { // Same object, so just turn it on! ObjectData *objectData = _logic->objectData(object.objectNumber); - objectData->name = abs(objectData->name); + objectData->name = ABS(objectData->name); } _logic->roomRefreshObject(object.objectNumber); @@ -1719,7 +1719,7 @@ void Cutaway::stop() { if (fromIndex > 0) { if (fromIndex == objectIndex) { // Enable object - object->name = abs(object->name); + object->name = ABS(object->name); } else { _logic->objectCopy(fromIndex, objectIndex); @@ -1760,7 +1760,7 @@ void Cutaway::stop() { _graphics->bobClear(bobIndex); } else if (objectFrame) { - _graphics->bankUnpack(abs(frame), objectFrame, bank); + _graphics->bankUnpack(ABS(frame), objectFrame, bank); pbs->frameNum = objectFrame; if (frame < 0) pbs->xflip = true; @@ -1813,7 +1813,7 @@ void Cutaway::updateGameState() { update = true; } else { - _logic->gameState(abs(stateIndex), stateValue); + _logic->gameState(ABS(stateIndex), stateValue); update = true; } @@ -1823,7 +1823,7 @@ void Cutaway::updateGameState() { if (objectIndex > 0) { // Show the object ObjectData *objectData = _logic->objectData(objectIndex); - objectData->name = abs(objectData->name); + objectData->name = ABS(objectData->name); if (fromObject > 0) _logic->objectCopy(fromObject, objectIndex); _logic->roomRefreshObject(objectIndex); @@ -1831,7 +1831,7 @@ void Cutaway::updateGameState() { else if (objectIndex < 0) { // Hide the object objectIndex = -objectIndex; ObjectData *objectData = _logic->objectData(objectIndex); - objectData->name = -abs(objectData->name); + objectData->name = -ABS(objectData->name); _logic->roomRefreshObject(objectIndex); } @@ -1841,11 +1841,11 @@ void Cutaway::updateGameState() { if (areaSubIndex > 0) { Area *area = _logic->area(areaIndex, areaSubIndex); - area->mapNeighbours = abs(area->mapNeighbours); + area->mapNeighbours = ABS(area->mapNeighbours); } else { - Area *area = _logic->area(areaIndex, abs(areaSubIndex)); - area->mapNeighbours = -abs(area->mapNeighbours); + Area *area = _logic->area(areaIndex, ABS(areaSubIndex)); + area->mapNeighbours = -ABS(area->mapNeighbours); } } @@ -1951,7 +1951,7 @@ void Cutaway::handleText( } BobSlot *bob = - _graphics->bob( _logic->findBob(abs(object.objectNumber)) ); + _graphics->bob( _logic->findBob(ABS(object.objectNumber)) ); _graphics->bobSetText(bob, sentence, x, object.bobStartY, object.specialMove, flags); diff --git a/queen/logic.cpp b/queen/logic.cpp index 67ca80c1fa..6ee6bf0eb0 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -400,7 +400,7 @@ void Logic::initialise() { ObjectData* Logic::objectData(int index) const { - index = abs(index); // cyx: is that really necessary ? + index = ABS(index); // cyx: is that really necessary ? if (index <= _numObjects) return &_objectData[index]; else @@ -2062,7 +2062,7 @@ uint16 Logic::numItemsInventory() const { void Logic::inventoryInsertItem(uint16 itemNum, bool refresh) { int16 item = _inventoryItem[0] = (int16)itemNum; - _itemData[itemNum].name = abs(_itemData[itemNum].name); //set visible + _itemData[itemNum].name = ABS(_itemData[itemNum].name); //set visible for (int i = 1; i < 4; i++) { item = nextInventoryItem(item); _inventoryItem[i] = item; @@ -2076,7 +2076,7 @@ void Logic::inventoryInsertItem(uint16 itemNum, bool refresh) { void Logic::inventoryDeleteItem(uint16 itemNum, bool refresh) { int16 item = (int16)itemNum; - _itemData[itemNum].name = -abs(_itemData[itemNum].name); //set invisible + _itemData[itemNum].name = -ABS(_itemData[itemNum].name); //set invisible for (int i = 0; i < 4; i++) { item = nextInventoryItem(item); _inventoryItem[i] = item; @@ -2148,10 +2148,10 @@ void Logic::objectCopy(int dummyObjectIndex, int realObjectIndex) { if (frameCountDummy > frameCountReal) *dummyObject = temp; - realObject->name = abs(realObject->name); + realObject->name = ABS(realObject->name); if (fromState == -1) - dummyObject->name = -abs(dummyObject->name); + dummyObject->name = -ABS(dummyObject->name); // Make sure that WALK_OFF_DATA is copied too! diff --git a/queen/logic.h b/queen/logic.h index 66122f3820..604edb06a6 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -41,6 +41,7 @@ struct ZoneSlot { Box box; }; +// FIXME: get rid of that and use ConfigurationManager struct GameConfig { int musicVolume; bool textToggle; @@ -199,7 +200,7 @@ public: const char *objectName(uint16 objNum) const { return _objName[objNum]; } const char *objectTextualDescription(uint16 objNum) const { return _objDescription[objNum]; } - uint16 numFrames() { return _numFrames; } + uint16 numFrames() const { return _numFrames; } int talkSpeed() const { return _settings.talkSpeed; } @@ -236,19 +237,14 @@ public: void joeSetupFromBanks(const char *animBank, const char *standBank); - //! SETUP_JOE(), loads the various bobs needed to animate Joe + //! Load the various bobs needed to animate Joe void joeSetup(); - //! SETUP_HERO(), places Joe at the right place when entering a room + //! Setup Joe at the right place when entering a room ObjectData *joeSetupInRoom(bool autoPosition, uint16 scale); - //! FACE_JOE() uint16 joeFace(); - - //! GRAB_JOE() void joeGrab(uint16 state, uint16 speed); - - //! GRAB_DIR void joeGrabDirection(StateGrab grab, uint16 speed); void joeUseDress(bool showCut); @@ -263,12 +259,6 @@ public: Verb findVerbUnderCursor(int16 cursorx, int16 cursory) const; uint16 findObjectUnderCursor(int16 cursorx, int16 cursory) const; - - Walk *walk() const { return _walk; } - Display *display() const { return _display; } - Command *command() const { return _cmd; } - Resource *resource() const { return _resource; } - uint16 findObjectRoomNumber(uint16 zoneNum) const; uint16 findObjectGlobalNumber(uint16 zoneNum) const; @@ -308,6 +298,11 @@ public: bool gameSave(uint16 slot, const char *desc); bool gameLoad(uint16 slot); + Walk *walk() const { return _walk; } + Display *display() const { return _display; } + Command *command() const { return _cmd; } + Resource *resource() const { return _resource; } + enum { MAX_ZONES_NUMBER = 32, MAX_AREAS_NUMBER = 11, diff --git a/queen/talk.cpp b/queen/talk.cpp index d4f41c4a66..687ee199e8 100644 --- a/queen/talk.cpp +++ b/queen/talk.cpp @@ -188,7 +188,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { int16 index = _dialogueTree[level][i].gameStateIndex; - if (index < 0 && _logic->gameState(abs(index)) != _dialogueTree[level][i].gameStateValue) + if (index < 0 && _logic->gameState(ABS(index)) != _dialogueTree[level][i].gameStateValue) _talkString[i][0] = '\0'; sprintf(_joeVoiceFilePrefix[i], "%2d%4xJ", _talkKey, _dialogueTree[level][i].head); @@ -313,7 +313,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { if (_itemNumber[i] > 0) _logic->inventoryInsertItem(_itemNumber[i]); else - _logic->inventoryDeleteItem(abs(_itemNumber[i])); + _logic->inventoryDeleteItem(ABS(_itemNumber[i])); } } } diff --git a/queen/verb.h b/queen/verb.h index 7139df3b23..3c2437f3b7 100644 --- a/queen/verb.h +++ b/queen/verb.h @@ -100,12 +100,6 @@ public: return _verb == VERB_USE_JOURNAL; } - bool isTwoLevelsCommand() const { - return - _verb == VERB_GIVE || - _verb == VERB_USE; - } - bool isDigit() const { return _verb >= VERB_DIGIT_FIRST && -- cgit v1.2.3