From 398c95a331c408cad596e1d0e7aca2653495bea9 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Fri, 21 Jan 2011 12:24:18 +0000 Subject: MOHAWK: Remove non-state uses of ~0 from CSTime. svn-id: r55373 --- engines/mohawk/cstime.cpp | 4 ++-- engines/mohawk/cstime_game.cpp | 32 ++++++++++++++++---------------- engines/mohawk/cstime_game.h | 10 +++++----- engines/mohawk/cstime_ui.cpp | 30 +++++++++++++++--------------- engines/mohawk/cstime_ui.h | 6 +++--- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/engines/mohawk/cstime.cpp b/engines/mohawk/cstime.cpp index 6ca824a143..0d72a68648 100644 --- a/engines/mohawk/cstime.cpp +++ b/engines/mohawk/cstime.cpp @@ -249,7 +249,7 @@ uint16 MohawkEngine_CSTime::getCurrentEventType() { void MohawkEngine_CSTime::eventIdle() { bool done = false; while (_events.size() && !done && true /* TODO: !_options->getState() */) { - _lastTimeout = ~0; + _lastTimeout = 0xffffffff; bool advanceQueue = true; bool processEvent = true; @@ -346,7 +346,7 @@ bool MohawkEngine_CSTime::NISIsRunning() { void MohawkEngine_CSTime::reset() { _NISRunning = false; - _lastTimeout = ~0; + _lastTimeout = 0xffffffff; _processingEvent = false; } diff --git a/engines/mohawk/cstime_game.cpp b/engines/mohawk/cstime_game.cpp index 57dffabd80..3186415f92 100644 --- a/engines/mohawk/cstime_game.cpp +++ b/engines/mohawk/cstime_game.cpp @@ -478,7 +478,7 @@ void CSTimeConversation::end(bool useLastClicked, bool runEvents) { } setState(~0); - _currHover = ~0; + _currHover = 0xffff; interface->clearTextLine(); interface->clearDialogArea(); @@ -555,13 +555,13 @@ void CSTimeConversation::mouseMove(Common::Point &pos) { return; } - if (_currHover != (uint)~0) { + if (_currHover != 0xffff) { if (_vm->getInterface()->cursorGetShape() != 3) { _vm->getInterface()->cursorSetShape(1, true); if (_vm->getInterface()->getInventoryDisplay()->getState() != 4) unhighlightLine(_currHover); } - _currHover = ~0; + _currHover = 0xffff; } } @@ -569,7 +569,7 @@ void CSTimeConversation::mouseUp(Common::Point &pos) { if (_vm->getInterface()->getInventoryDisplay()->getState() == 4) return; - if (_currEntry == (uint)~0) + if (_currEntry == 0xffff) return; // TODO: case 20 rect check @@ -610,8 +610,8 @@ void CSTimeConversation::clear() { _state = ~0; _talkCount = 0; _sourceChar = 0xffff; - _currHover = ~0; - _currEntry = ~0; + _currHover = 0xffff; + _currEntry = 0xffff; _nextToProcess = 0xffff; for (uint i = 0; i < 8; i++) for (uint j = 0; j < 5; j++) @@ -678,7 +678,7 @@ CSTimeCase::CSTimeCase(MohawkEngine_CSTime *vm, uint id) : _vm(vm), _id(id) { assert(!_conversations.empty()); _currConv = _conversations[0]; - _currScene = ~0; + _currScene = 0xffff; } CSTimeCase::~CSTimeCase() { @@ -750,8 +750,8 @@ CSTimeScene *CSTimeCase::getCurrScene() { CSTimeScene::CSTimeScene(MohawkEngine_CSTime *vm, CSTimeCase *case_, uint id) : _vm(vm), _case(case_), _id(id) { _activeChar = NULL; - _currHotspot = ~0; - _hoverHotspot = ~0; + _currHotspot = 0xffff; + _hoverHotspot = 0xffff; load(); } @@ -901,7 +901,7 @@ void CSTimeScene::mouseDown(Common::Point &pos) { // In help mode, we ignore clicks on any help hotspot. if (!hotspotContainsEvent(i, kCSTimeEventStartHelp)) break; - _currHotspot = ~0; + _currHotspot = 0xffff; return; } @@ -910,7 +910,7 @@ void CSTimeScene::mouseDown(Common::Point &pos) { if (hotspot.events[j].type != kCSTimeEventStartConversation) continue; // FIXME: check that the conversation *is* the current one - _currHotspot = ~0; + _currHotspot = 0xffff; return; } @@ -931,7 +931,7 @@ void CSTimeScene::mouseDown(Common::Point &pos) { // FIXME: return if sailing puzzle - _currHotspot = ~0; + _currHotspot = 0xffff; for (uint i = 0; i < _hotspots.size(); i++) { CSTimeHotspot &hotspot = _hotspots[i]; if (!hotspot.region.containsPoint(pos)) @@ -942,7 +942,7 @@ void CSTimeScene::mouseDown(Common::Point &pos) { break; } - if (_currHotspot == (uint)~0) + if (_currHotspot == 0xffff) _vm->getInterface()->cursorSetShape(4, false); } @@ -1026,7 +1026,7 @@ void CSTimeScene::mouseMove(Common::Point &pos) { } } - if (_hoverHotspot == (uint)~0) + if (_hoverHotspot == 0xffff) return; CSTimeConversation *conv = _case->getCurrConversation(); @@ -1046,13 +1046,13 @@ void CSTimeScene::mouseMove(Common::Point &pos) { _vm->getInterface()->clearTextLine(); } - _hoverHotspot = (uint)~0; + _hoverHotspot = 0xffff; } void CSTimeScene::mouseUp(Common::Point &pos) { // TODO: if sailing puzzle is active, return - if (_currHotspot == (uint)~0) { + if (_currHotspot == 0xffff) { if (_vm->getInterface()->cursorGetShape() == 4) _vm->getInterface()->cursorChangeShape(1); return; diff --git a/engines/mohawk/cstime_game.h b/engines/mohawk/cstime_game.h index ce955cc524..d859664d80 100644 --- a/engines/mohawk/cstime_game.h +++ b/engines/mohawk/cstime_game.h @@ -176,7 +176,7 @@ protected: uint _talkCount; uint16 _sourceChar; - uint _currEntry, _currHover; + uint16 _currEntry, _currHover; uint16 _nextToProcess; bool _asked[8][5]; @@ -228,8 +228,8 @@ protected: CSTimeCase *_case; uint _id; - uint _currHotspot; - uint _hoverHotspot; + uint16 _currHotspot; + uint16 _hoverHotspot; void load(); void cursorOverHotspot(uint id); @@ -253,7 +253,7 @@ public: uint getId() { return _id; } Common::String &getRolloverText(uint id) { return _rolloverText[id]; } CSTimeScene *getCurrScene(); - void setCurrScene(uint id) { _currScene = id; } + void setCurrScene(uint16 id) { _currScene = id; } void setConversation(uint id) { _currConv = _conversations[id]; } CSTimeConversation *getCurrConversation() { return _currConv; } uint16 getNoteFeatureId(uint16 id) { return _noteFeatureId[id]; } @@ -271,7 +271,7 @@ protected: MohawkEngine_CSTime *_vm; uint _id; - uint _currScene; + uint16 _currScene; uint16 _noteFeatureId[3]; Common::Array _rolloverText; Common::Array _scenes; diff --git a/engines/mohawk/cstime_ui.cpp b/engines/mohawk/cstime_ui.cpp index 50e0c64a91..1590c75bf7 100644 --- a/engines/mohawk/cstime_ui.cpp +++ b/engines/mohawk/cstime_ui.cpp @@ -654,7 +654,7 @@ void CSTimeInterface::stopDragging() { setCursorForCurrentPoint(); // Find the inventory object hotspot which is topmost for this drop, if any. - uint foundInvObjHotspot = ~0; + uint16 foundInvObjHotspot = 0xffff; const Common::Array &hotspots = scene->getHotspots(); for (uint i = 0; i < hotspots.size(); i++) { if (hotspots[i].state != 1) @@ -666,7 +666,7 @@ void CSTimeInterface::stopDragging() { continue; if (invObj->hotspots[j].hotspotId != i) continue; - if (foundInvObjHotspot != (uint)~0 && invObj->hotspots[foundInvObjHotspot].hotspotId < invObj->hotspots[j].hotspotId) + if (foundInvObjHotspot != 0xffff && invObj->hotspots[foundInvObjHotspot].hotspotId < invObj->hotspots[j].hotspotId) continue; foundInvObjHotspot = j; } @@ -675,7 +675,7 @@ void CSTimeInterface::stopDragging() { // Work out if we're going to consume (nom-nom) the object after the drop. bool consumeObj = false; bool runConsumeEvents = false; - if (foundInvObjHotspot != (uint)~0) { + if (foundInvObjHotspot != 0xffff) { CSTimeInventoryHotspot &hotspot = invObj->hotspots[foundInvObjHotspot]; clearTextLine(); @@ -783,7 +783,7 @@ void CSTimeInterface::stopDragging() { if (_vm->getCase()->getId() == 1 && _vm->getCase()->getCurrScene()->getId() == 4) { // Hardcoded behaviour for torches in the dark tomb, in the first case. - if (_draggedItem == 1 && foundInvObjHotspot == (uint)~0) { + if (_draggedItem == 1 && foundInvObjHotspot == 0xffff) { // Trying to drag an unlit torch around? _vm->addEvent(CSTimeEvent(kCSTimeEventCharStartFlapping, 0, 16352)); } else if (_draggedItem == 2 && _vm->_caseVariable[2] == 1) { @@ -868,7 +868,7 @@ void CSTimeInventoryDisplay::install() { void CSTimeInventoryDisplay::draw() { for (uint i = 0; i < MAX_DISPLAYED_ITEMS; i++) { - if (_displayedItems[i] == (uint)~0) + if (_displayedItems[i] == 0xffff) continue; CSTimeInventoryObject *invObj = _vm->getCase()->_inventoryObjs[_displayedItems[i]]; @@ -900,7 +900,7 @@ void CSTimeInventoryDisplay::draw() { void CSTimeInventoryDisplay::show() { for (uint i = 0; i < MAX_DISPLAYED_ITEMS; i++) { - if (_displayedItems[i] == (uint)~0) + if (_displayedItems[i] == 0xffff) continue; CSTimeInventoryObject *invObj = _vm->getCase()->_inventoryObjs[_displayedItems[i]]; if (!invObj->feature) @@ -911,7 +911,7 @@ void CSTimeInventoryDisplay::show() { void CSTimeInventoryDisplay::hide() { for (uint i = 0; i < MAX_DISPLAYED_ITEMS; i++) { - if (_displayedItems[i] == (uint)~0) + if (_displayedItems[i] == 0xffff) continue; CSTimeInventoryObject *invObj = _vm->getCase()->_inventoryObjs[_displayedItems[i]]; if (!invObj->feature) @@ -941,7 +941,7 @@ void CSTimeInventoryDisplay::idle() { void CSTimeInventoryDisplay::clearDisplay() { for (uint i = 0; i < MAX_DISPLAYED_ITEMS; i++) - _displayedItems[i] = ~0; + _displayedItems[i] = 0xffff; // We always start out with the Time Cuffs. _vm->_haveInvItem[TIME_CUFFS_ID] = 1; @@ -950,13 +950,13 @@ void CSTimeInventoryDisplay::clearDisplay() { _cuffsState = false; } -void CSTimeInventoryDisplay::insertItemInDisplay(uint id) { +void CSTimeInventoryDisplay::insertItemInDisplay(uint16 id) { for (uint i = 0; i < MAX_DISPLAYED_ITEMS; i++) if (_displayedItems[i] == id) return; for (uint i = 0; i < MAX_DISPLAYED_ITEMS; i++) - if (_displayedItems[i] == (uint)~0) { + if (_displayedItems[i] == 0xffff) { _displayedItems[i] = id; return; } @@ -964,7 +964,7 @@ void CSTimeInventoryDisplay::insertItemInDisplay(uint id) { error("couldn't insert item into display"); } -void CSTimeInventoryDisplay::removeItem(uint id) { +void CSTimeInventoryDisplay::removeItem(uint16 id) { CSTimeInventoryObject *invObj = _vm->getCase()->_inventoryObjs[id]; if (invObj->feature) { _vm->getView()->removeFeature(invObj->feature, true); @@ -972,12 +972,12 @@ void CSTimeInventoryDisplay::removeItem(uint id) { } for (uint i = 0; i < MAX_DISPLAYED_ITEMS; i++) if (_displayedItems[i] == id) - _displayedItems[i] = ~0; + _displayedItems[i] = 0xffff; } void CSTimeInventoryDisplay::mouseDown(Common::Point &pos) { for (uint i = 0; i < MAX_DISPLAYED_ITEMS; i++) { - if (_displayedItems[i] == (uint)~0) + if (_displayedItems[i] == 0xffff) continue; if (!_itemRect[i].contains(pos)) continue; @@ -1003,7 +1003,7 @@ void CSTimeInventoryDisplay::mouseMove(Common::Point &pos) { } for (uint i = 0; i < MAX_DISPLAYED_ITEMS; i++) { - if (_displayedItems[i] == (uint)~0) + if (_displayedItems[i] == 0xffff) continue; if (!_itemRect[i].contains(pos)) continue; @@ -1029,7 +1029,7 @@ void CSTimeInventoryDisplay::mouseMove(Common::Point &pos) { void CSTimeInventoryDisplay::mouseUp(Common::Point &pos) { for (uint i = 0; i < MAX_DISPLAYED_ITEMS; i++) { - if (_displayedItems[i] == (uint)~0) + if (_displayedItems[i] == 0xffff) continue; if (!_itemRect[i].contains(pos)) continue; diff --git a/engines/mohawk/cstime_ui.h b/engines/mohawk/cstime_ui.h index 236f73ab22..2d5aa2a183 100644 --- a/engines/mohawk/cstime_ui.h +++ b/engines/mohawk/cstime_ui.h @@ -71,8 +71,8 @@ public: void hide(); void idle(); void clearDisplay(); - void insertItemInDisplay(uint id); - void removeItem(uint id); + void insertItemInDisplay(uint16 id); + void removeItem(uint16 id); void mouseDown(Common::Point &pos); void mouseMove(Common::Point &pos); @@ -99,7 +99,7 @@ protected: bool _cuffsState; uint16 _cuffsShape; uint16 _draggedItem; - uint _displayedItems[MAX_DISPLAYED_ITEMS]; + uint16 _displayedItems[MAX_DISPLAYED_ITEMS]; }; class CSTimeBook { -- cgit v1.2.3