From 38bead0c37c61e118378053659a2874830bbb85a Mon Sep 17 00:00:00 2001 From: Le Philousophe Date: Sun, 30 Jun 2019 16:43:32 +0200 Subject: [PATCH] JANITORIAL/CRYOMNI3D: Fix warnings in MSVC Most of them were due to setting -1 to unsigned values Else it was bogus unintialized values --- engines/cryomni3d/cryomni3d.cpp | 6 +- engines/cryomni3d/dialogs_manager.cpp | 4 +- engines/cryomni3d/fixed_image.cpp | 8 +- engines/cryomni3d/image/codecs/hlz.cpp | 6 +- engines/cryomni3d/objects.cpp | 2 +- engines/cryomni3d/objects.h | 2 +- engines/cryomni3d/sprites.cpp | 4 +- .../cryomni3d/versailles/dialogs_manager.cpp | 14 +- .../cryomni3d/versailles/documentation.cpp | 120 ++++++++--------- engines/cryomni3d/versailles/engine.cpp | 48 +++---- engines/cryomni3d/versailles/logic.cpp | 122 +++++++++--------- engines/cryomni3d/versailles/menus.cpp | 54 ++++---- engines/cryomni3d/versailles/saveload.cpp | 6 +- engines/cryomni3d/versailles/toolbar.cpp | 28 ++-- engines/cryomni3d/versailles/toolbar.h | 2 +- engines/cryomni3d/video/hnm_decoder.cpp | 12 +- engines/cryomni3d/video/hnm_decoder.h | 2 +- engines/cryomni3d/wam_parser.cpp | 2 +- 18 files changed, 221 insertions(+), 221 deletions(-) diff --git a/engines/cryomni3d/cryomni3d.cpp b/engines/cryomni3d/cryomni3d.cpp index 05d370c0a44..334bcd3d4d2 100644 --- a/engines/cryomni3d/cryomni3d.cpp +++ b/engines/cryomni3d/cryomni3d.cpp @@ -43,7 +43,7 @@ namespace CryOmni3D { CryOmni3DEngine::CryOmni3DEngine(OSystem *syst, const CryOmni3DGameDescription *gamedesc) : Engine(syst), _gameDescription(gamedesc), _canLoadSave(false), _fontManager(), _sprites(), _dragStatus(kDragStatus_NoDrag), - _autoRepeatNextEvent(-1u) { + _autoRepeatNextEvent(uint(-1)) { if (!_mixer->isReady()) { error("Sound initialization failed"); } @@ -287,7 +287,7 @@ bool CryOmni3DEngine::pollEvents() { if (ABS(delta.x) > 2 || ABS(delta.y) > 2) { // We moved from the start point _dragStatus = kDragStatus_Dragging; - } else if (_autoRepeatNextEvent != -1u) { + } else if (_autoRepeatNextEvent != uint(-1)) { // Check for auto repeat duration if (_autoRepeatNextEvent < g_system->getMillis()) { _dragStatus = kDragStatus_Pressed; @@ -297,7 +297,7 @@ bool CryOmni3DEngine::pollEvents() { // We just finished dragging _dragStatus = kDragStatus_Finished; // Cancel auto repeat - _autoRepeatNextEvent = -1; + _autoRepeatNextEvent = uint(-1); } } // Else we weren't dragging and still aren't diff --git a/engines/cryomni3d/dialogs_manager.cpp b/engines/cryomni3d/dialogs_manager.cpp index 5f78d2c4318..145fe0b074c 100644 --- a/engines/cryomni3d/dialogs_manager.cpp +++ b/engines/cryomni3d/dialogs_manager.cpp @@ -308,7 +308,7 @@ bool DialogsManager::play(const Common::String &sequence, bool &slowStop) { for (; *questionEnd != '>'; questionEnd++) { } questions.push_back(Common::String(questionStart, questionEnd)); } - uint eocInserted = -1; + uint eocInserted = uint(-1); if (!endOfConversationFound && questions.size() > 0) { eocInserted = questions.size(); questions.push_back(_endOfConversationText); @@ -324,7 +324,7 @@ bool DialogsManager::play(const Common::String &sequence, bool &slowStop) { uint playerChoice = askPlayerQuestions(video, questions); didSomething = true; // -1 when shouldAbort - if (playerChoice == -1u || playerChoice == eocInserted) { + if (playerChoice == uint(-1) || playerChoice == eocInserted) { break; } diff --git a/engines/cryomni3d/fixed_image.cpp b/engines/cryomni3d/fixed_image.cpp index 16a35f8f1ae..de685fedc2b 100644 --- a/engines/cryomni3d/fixed_image.cpp +++ b/engines/cryomni3d/fixed_image.cpp @@ -125,8 +125,8 @@ void ZonFixedImage::loadZones(const Common::String &image) { int32 zonesNumber = zonFile.size() / 26; _zones.reserve(zonesNumber); - _highLeftId = -1; - _highRightId = -1; + _highLeftId = Common::Array::size_type(-1); + _highRightId = Common::Array::size_type(-1); int leftSeen = 0x7fffffff; // MAX_INT int rightSeen = 0; @@ -173,7 +173,7 @@ Common::Point ZonFixedImage::getZoneCenter(uint zoneId) const { } void ZonFixedImage::manage() { - _currentZone = -1; + _currentZone = uint(-1); _zoneLow = false; _zoneHigh = false; _zoneHighLeft = false; @@ -242,7 +242,7 @@ void ZonFixedImage::manage() { if (zoneIt != _zones.end()) { _currentZone = zoneIt - _zones.begin(); } else { - _currentZone = -1; + _currentZone = uint(-1); } if (_zonesMode == kZonesMode_Standard) { diff --git a/engines/cryomni3d/image/codecs/hlz.cpp b/engines/cryomni3d/image/codecs/hlz.cpp index 146336efdc4..6f550c77203 100644 --- a/engines/cryomni3d/image/codecs/hlz.cpp +++ b/engines/cryomni3d/image/codecs/hlz.cpp @@ -47,7 +47,7 @@ const Graphics::Surface *HLZDecoder::decodeFrame(Common::SeekableReadStream &str _surface->create(_width, _height, Graphics::PixelFormat::createFormatCLUT8()); byte *dst = (byte *)_surface->getPixels(); - decodeFrameInPlace(stream, -1, dst); + decodeFrameInPlace(stream, uint32(-1), dst); return _surface; } @@ -56,7 +56,7 @@ Graphics::PixelFormat HLZDecoder::getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); } -static inline bool getReg(Common::SeekableReadStream &stream, uint32 *size, uint32 *reg, +static inline uint getReg(Common::SeekableReadStream &stream, uint32 *size, uint32 *reg, int *regBits) { if (*regBits == 0) { if (*size < 4) { @@ -66,7 +66,7 @@ static inline bool getReg(Common::SeekableReadStream &stream, uint32 *size, uint *size -= 4; *regBits = 32; } - bool ret = (*reg >> 31) != 0; + uint ret = (*reg >> 31) & 0x1; *reg <<= 1; (*regBits)--; return ret; diff --git a/engines/cryomni3d/objects.cpp b/engines/cryomni3d/objects.cpp index 3a299487078..0a687f996ca 100644 --- a/engines/cryomni3d/objects.cpp +++ b/engines/cryomni3d/objects.cpp @@ -62,7 +62,7 @@ void Inventory::add(Object *obj) { void Inventory::remove(uint position) { (*this)[position] = nullptr; - (*_changeCallback)(-1u); + (*_changeCallback)(uint(-1)); } void Inventory::removeByIconID(uint iconID) { diff --git a/engines/cryomni3d/objects.h b/engines/cryomni3d/objects.h index 806a7453686..0004672f201 100644 --- a/engines/cryomni3d/objects.h +++ b/engines/cryomni3d/objects.h @@ -35,7 +35,7 @@ class Object { public: typedef Common::Functor0 *ViewCallback; - Object() : _valid(false), _idCA(-1), _idCl(-1), _idSA(-1), _idSl(-1), _idOBJ(-1), + Object() : _valid(false), _idCA(uint(-1)), _idCl(uint(-1)), _idSA(uint(-1)), _idSl(uint(-1)), _idOBJ(uint(-1)), _viewCallback(nullptr) {} Object(const Sprites &sprites, uint id_CA, uint id_OBJ) : _idCA(id_CA), diff --git a/engines/cryomni3d/sprites.cpp b/engines/cryomni3d/sprites.cpp index 36cd439f1c4..81844e7ad04 100644 --- a/engines/cryomni3d/sprites.cpp +++ b/engines/cryomni3d/sprites.cpp @@ -86,7 +86,7 @@ void Sprites::setupMapTable(const uint *table, uint size) { _map = nullptr; // Reset the reverse mapping for (Common::Array::iterator it = _cursors.begin(); it != _cursors.end(); it++) { - (*it)->_constantId = -1; + (*it)->_constantId = uint(-1); } if (table) { _map = new Common::Array(table, size); @@ -185,7 +185,7 @@ uint Sprites::calculateSpriteId(uint baseId, uint offset) const { error("Calculate sprite is out of bounds: %d/%d", baseId, _cursors.size()); } uint spriteId = _cursors[baseId]->_constantId; - if (spriteId == -1u) { + if (spriteId == uint(-1)) { error("Sprite %d is unreachable", baseId); } return spriteId; diff --git a/engines/cryomni3d/versailles/dialogs_manager.cpp b/engines/cryomni3d/versailles/dialogs_manager.cpp index b69dfc17896..1ec751ad9fb 100644 --- a/engines/cryomni3d/versailles/dialogs_manager.cpp +++ b/engines/cryomni3d/versailles/dialogs_manager.cpp @@ -249,7 +249,7 @@ uint Versailles_DialogsManager::askPlayerQuestions(const Common::String &video, } if (questions.size() == 0 || questions.size() > 5) { - return -1; + return uint(-1); } FontManager &fontManager = _engine->_fontManager; @@ -292,7 +292,7 @@ uint Versailles_DialogsManager::askPlayerQuestions(const Common::String &video, bool finished = false; bool update = true; - uint selectedQuestion = -1; + uint selectedQuestion = uint(-1); while (!finished) { if (update) { update = false; @@ -313,15 +313,15 @@ uint Versailles_DialogsManager::askPlayerQuestions(const Common::String &video, _engine->clearKeys(); if (_engine->shouldAbort()) { finished = true; - selectedQuestion = -1; + selectedQuestion = uint(-1); break; } Common::Point mousePos = _engine->getMousePos(); - if (_engine->getDragStatus() == kDragStatus_Finished && selectedQuestion != -1u) { + if (_engine->getDragStatus() == kDragStatus_Finished && selectedQuestion != uint(-1)) { finished = true; } else if (mousePos.x >= 608 || mousePos.y < offsetY) { - if (selectedQuestion != -1u) { - selectedQuestion = -1; + if (selectedQuestion != uint(-1)) { + selectedQuestion = uint(-1); update = true; } } else { @@ -336,7 +336,7 @@ uint Versailles_DialogsManager::askPlayerQuestions(const Common::String &video, update = true; } } else { - selectedQuestion = -1; + selectedQuestion = uint(-1); update = true; } } diff --git a/engines/cryomni3d/versailles/documentation.cpp b/engines/cryomni3d/versailles/documentation.cpp index 9e90e0089de..8defe0e7073 100644 --- a/engines/cryomni3d/versailles/documentation.cpp +++ b/engines/cryomni3d/versailles/documentation.cpp @@ -105,7 +105,7 @@ void Versailles_Documentation::init(const Sprites *sprites, FontManager *fontMan allDocsFile.close(); const char *patterns[] = { "FICH=", nullptr }; - RecordInfo record = { 0, 0, 0 }; + RecordInfo record = { uint(-1), uint(-1), uint(-1) }; char *currentPos = allDocs; char *lastRecordName = nullptr; @@ -330,10 +330,10 @@ Common::String Versailles_Documentation::docAreaHandleSummary() { _engine->showMouse(true); bool redraw = true; - uint hoveredBox = -1; - uint selectedBox = -1; + uint hoveredBox = uint(-1); + uint selectedBox = uint(-1); - while (selectedBox == -1u) { + while (selectedBox == uint(-1)) { if (redraw) { // Draw without worrying of already modified areas, that's handled when recomputing hoveredBox for (uint i = 0; i < ARRAYSIZE(categories); i++) { @@ -383,7 +383,7 @@ Common::String Versailles_Documentation::docAreaHandleSummary() { } } } - if (!foundBox && hoveredBox != -1u) { + if (!foundBox && hoveredBox != uint(-1)) { if (categories[hoveredBox].highlightedImg.getPixels() != nullptr) { // Restore original icon const Common::Point &imgPos = categories[hoveredBox].imgPos; @@ -391,12 +391,12 @@ Common::String Versailles_Documentation::docAreaHandleSummary() { imgPos.x - 36, imgPos.y - 65, imgPos.x + 37, imgPos.y + 8), Common::Point(imgPos.x - 36, imgPos.y - 65)); } - hoveredBox = -1; + hoveredBox = uint(-1); redraw = true; } } if (_engine->getDragStatus() == kDragStatus_Finished) { - if (hoveredBox != -1u) { + if (hoveredBox != uint(-1)) { selectedBox = hoveredBox; } } @@ -463,10 +463,10 @@ Common::String Versailles_Documentation::docAreaHandleTimeline() { _engine->showMouse(true); bool redraw = true; - uint hoveredBox = -1; - uint selectedBox = -1; + uint hoveredBox = uint(-1); + uint selectedBox = uint(-1); - while (selectedBox == -1u) { + while (selectedBox == uint(-1)) { if (redraw) { // Draw without worrying of already modified areas, that's handled when recomputing hoveredBox for (uint i = 0; i < ARRAYSIZE(kTimelineEntries); i++) { @@ -497,13 +497,13 @@ Common::String Versailles_Documentation::docAreaHandleTimeline() { } } } - if (!foundBox && hoveredBox != -1u) { - hoveredBox = -1; + if (!foundBox && hoveredBox != uint(-1)) { + hoveredBox = uint(-1); redraw = true; } } if (_engine->getDragStatus() == kDragStatus_Finished) { - if (hoveredBox != -1u) { + if (hoveredBox != uint(-1)) { selectedBox = hoveredBox; } if (boxes.hitTest(leaveBoxId, mouse)) { @@ -533,7 +533,7 @@ Common::String Versailles_Documentation::docAreaHandleTimeline() { } uint Versailles_Documentation::docAreaHandleRecords(const Common::String &record) { - uint action = -1; + uint action = uint(-1); _currentRecord = record; _visitTrace.clear(); @@ -543,7 +543,7 @@ uint Versailles_Documentation::docAreaHandleRecords(const Common::String &record MouseBoxes boxes(10 + ARRAYSIZE(kTimelineEntries)); while (true) { - if (action == -1u) { + if (action == uint(-1)) { _currentRecord.toUppercase(); //debug("Displaying %s", _currentRecord.c_str()); @@ -554,7 +554,7 @@ uint Versailles_Documentation::docAreaHandleRecords(const Common::String &record switch (action) { case 0: - action = -1; + action = uint(-1); // Back if (!_visitTrace.empty()) { _currentRecord = _visitTrace.back(); @@ -567,13 +567,13 @@ uint Versailles_Documentation::docAreaHandleRecords(const Common::String &record // Back to root return 1; case 2: - action = -1; + action = uint(-1); // Follow hyperlink keeping trace _visitTrace.push_back(_currentRecord); _currentRecord = nextRecord; break; case 3: - action = -1; + action = uint(-1); // Follow hyperlink losing trace _visitTrace.clear(); _currentRecord = nextRecord; @@ -582,7 +582,7 @@ uint Versailles_Documentation::docAreaHandleRecords(const Common::String &record // Quit return 2; case 7: - action = -1; + action = uint(-1); // General map _visitTrace.clear(); nextRecord = docAreaHandleGeneralMap(); @@ -596,7 +596,7 @@ uint Versailles_Documentation::docAreaHandleRecords(const Common::String &record // castle has been selected, display its map // fall through case 8: - action = -1; + action = uint(-1); // Castle map _visitTrace.clear(); nextRecord = docAreaHandleCastleMap(); @@ -610,7 +610,7 @@ uint Versailles_Documentation::docAreaHandleRecords(const Common::String &record } break; case 9: - action = -1; + action = uint(-1); // Start of category _currentRecord = _categoryStartRecord; break; @@ -701,10 +701,10 @@ uint Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &sur bool first = true; bool redraw = true; - uint hoveredBox = -1; - uint action = -1; + uint hoveredBox = uint(-1); + uint action = uint(-1); - while (action == -1u) { + while (action == uint(-1)) { if (redraw) { g_system->copyRectToScreen(surface.getPixels(), surface.pitch, 0, 0, surface.w, surface.h); redraw = false; @@ -728,7 +728,7 @@ uint Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &sur _fontManager->setCurrentFont(0); _fontManager->setTransparentBackground(true); _fontManager->setSurface(&surface); - if (hoveredBox != -1u) { + if (hoveredBox != uint(-1)) { // Restore the previous entry hovered _fontManager->setForeColor(243); boxes.display(hoveredBox, *_fontManager); @@ -740,11 +740,11 @@ uint Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &sur } } } - if (!foundBox && hoveredBox != -1u) { + if (!foundBox && hoveredBox != uint(-1)) { // Restore the previous entry hovered _fontManager->setForeColor(243); boxes.display(hoveredBox, *_fontManager); - hoveredBox = -1; + hoveredBox = uint(-1); redraw = true; } } else if (_currentHasMap) { // Mutually exclusive with timeline @@ -757,7 +757,7 @@ uint Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &sur } else { if (hoveredBox == 8) { _engine->setCursor(181); - hoveredBox = -1; + hoveredBox = uint(-1); } } } @@ -771,7 +771,7 @@ uint Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &sur Common::Rect iconRect = boxes.getBoxRect(2); uint selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top), true, 20, items); - if (selectedItem != -1u) { + if (selectedItem != uint(-1)) { nextRecord = _currentLinks[selectedItem].record; action = 2; } @@ -783,7 +783,7 @@ uint Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &sur Common::Rect iconRect = boxes.getBoxRect(3); uint selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top), true, 20, items); - if (selectedItem != -1u) { + if (selectedItem != uint(-1)) { nextRecord = _allLinks[selectedItem].record; action = 3; } @@ -823,7 +823,7 @@ uint Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &sur } else if (boxes.hitTest(9, mouse)) { // Category name action = 9; - } else if (_currentInTimeline && hoveredBox != -1u) { + } else if (_currentInTimeline && hoveredBox != uint(-1)) { // Clicked on a timeline entry nextRecord = "VT"; nextRecord += kTimelineEntries[hoveredBox - 10].year; @@ -833,17 +833,17 @@ uint Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &sur } if (action == 4 || action == 5) { if (action == 4 && _currentRecord == _categoryEndRecord) { - action = -1; + action = uint(-1); continue; } if (action == 5 && _currentRecord == _categoryStartRecord) { - action = -1; + action = uint(-1); continue; } Common::HashMap::iterator hmIt = _records.find(_currentRecord); if (hmIt == _records.end()) { // Shouldn't happen - action = -1; + action = uint(-1); continue; } uint recordId = hmIt->_value.id; @@ -961,13 +961,13 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() { _engine->showMouse(true); bool redraw = true; - uint hoveredBox = -1; - uint selectedBox = -1; + uint hoveredBox = uint(-1); + uint selectedBox = uint(-1); - while (selectedBox == -1u) { + while (selectedBox == uint(-1)) { if (redraw) { // Draw without worrying of already modified areas, that's handled when recomputing hoveredBox - if (hoveredBox != -1u) { + if (hoveredBox != uint(-1)) { if (areas[hoveredBox].highlightedImg.getPixels() != nullptr) { mapSurface.transBlitFrom(areas[hoveredBox].highlightedImg, Common::Point(areas[hoveredBox].areaPos.left, areas[hoveredBox].areaPos.top)); @@ -1022,11 +1022,11 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() { break; } } - if (!foundBox && hoveredBox != -1u) { - hoveredBox = -1; + if (!foundBox && hoveredBox != uint(-1)) { + hoveredBox = uint(-1); redraw = true; } - if (hoveredBox != oldHoveredBox && oldHoveredBox != -1u) { + if (hoveredBox != oldHoveredBox && oldHoveredBox != uint(-1)) { // Restore original area mapSurface.blitFrom(*bgFrame, areas[oldHoveredBox].areaPos, Common::Point(areas[oldHoveredBox].areaPos.left, areas[oldHoveredBox].areaPos.top)); @@ -1039,7 +1039,7 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() { } } if (_engine->getDragStatus() == kDragStatus_Finished) { - if (hoveredBox != -1u && areas[hoveredBox].record) { + if (hoveredBox != uint(-1) && areas[hoveredBox].record) { selectedBox = hoveredBox; } else if (boxes.hitTest(ARRAYSIZE(areas), mouse)) { selectedBox = ARRAYSIZE(areas); @@ -1128,7 +1128,7 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() { MouseBoxes boxes(ARRAYSIZE(areas) + 1); for (uint i = 0; i < ARRAYSIZE(areas); i++) { - if (areas[i].messageId != -1u) { + if (areas[i].messageId != uint(-1)) { areas[i].message = (*_messages)[areas[i].messageId]; } else { areas[i].message = getRecordTitle(areas[i].record); @@ -1183,13 +1183,13 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() { _engine->showMouse(true); bool redraw = true; - uint hoveredBox = -1; - uint selectedBox = -1; + uint hoveredBox = uint(-1); + uint selectedBox = uint(-1); - while (selectedBox == -1u) { + while (selectedBox == uint(-1)) { if (redraw) { // Draw without worrying of already modified areas, that's handled when recomputing hoveredBox - if (hoveredBox != -1u) { + if (hoveredBox != uint(-1)) { if (areas[hoveredBox].fillArea) { Common::Rect rect(areas[hoveredBox].areaPos); rect.bottom += 1; // fillRect needs to fill including the limit @@ -1263,11 +1263,11 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() { break; } } - if (!foundBox && hoveredBox != -1u) { - hoveredBox = -1; + if (!foundBox && hoveredBox != uint(-1)) { + hoveredBox = uint(-1); redraw = true; } - if (hoveredBox != oldHoveredBox && oldHoveredBox != -1u) { + if (hoveredBox != oldHoveredBox && oldHoveredBox != uint(-1)) { // Restore original area Common::Rect areaPos = areas[oldHoveredBox].areaPos; if (areas[oldHoveredBox].areaPos2.right) { @@ -1287,7 +1287,7 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() { } } if (_engine->getDragStatus() == kDragStatus_Finished) { - if (hoveredBox != -1u && areas[hoveredBox].record) { + if (hoveredBox != uint(-1) && areas[hoveredBox].record) { selectedBox = hoveredBox; } else if (boxes.hitTest(ARRAYSIZE(areas), mouse)) { selectedBox = ARRAYSIZE(areas); @@ -1350,11 +1350,11 @@ uint Versailles_Documentation::inGameHandleRecord(Graphics::ManagedSurface &surf _engine->setCursor(181); _engine->showMouse(true); - uint action = -1; + uint action = uint(-1); g_system->copyRectToScreen(surface.getPixels(), surface.pitch, 0, 0, surface.w, surface.h); - while (action == -1u) { + while (action == uint(-1)) { g_system->updateScreen(); g_system->delayMillis(10); @@ -1374,7 +1374,7 @@ uint Versailles_Documentation::inGameHandleRecord(Graphics::ManagedSurface &surf Common::Rect iconRect = boxes.getBoxRect(2); uint selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top), true, 20, items); - if (selectedItem != -1u) { + if (selectedItem != uint(-1)) { nextRecord = _currentLinks[selectedItem].record; action = 2; } @@ -1694,8 +1694,8 @@ uint Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSurface bool fullRedraw = true; bool redraw = true; - uint hoveredBox = -1; - uint action = -1; + uint hoveredBox = uint(-1); + uint action = uint(-1); uint lastShownItem = items.size() - 1; uint firstShownItem = lastShownItem - shownItems + 1; @@ -1703,7 +1703,7 @@ uint Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSurface Common::Point mouse; - while (action == -1u) { + while (action == uint(-1)) { if (redraw) { if (fullRedraw) { surface.fillRect(popupRect, 247); @@ -1742,7 +1742,7 @@ uint Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSurface } mouse = _engine->getMousePos(); - uint newHovered = -1; + uint newHovered = uint(-1); for (uint i = 0; i < shownItems; i++) { if (boxes.hitTest(i, mouse)) { newHovered = i; @@ -1758,7 +1758,7 @@ uint Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSurface DragStatus dragStatus = _engine->getDragStatus(); - if (hoveredBox == -1u) { + if (hoveredBox == uint(-1)) { if (dragStatus == kDragStatus_Pressed) { break; } else { @@ -1823,7 +1823,7 @@ char *Versailles_Documentation::getDocPartAddress(char *start, char *end, const } char *foundPos = nullptr; const char *pattern; - uint patternLen = 0; + uint patternLen = uint(-1); for (const char **patternP = patterns; *patternP && !foundPos; patternP++) { pattern = *patternP; patternLen = strlen(pattern); diff --git a/engines/cryomni3d/versailles/engine.cpp b/engines/cryomni3d/versailles/engine.cpp index 86f214dcbec..b901ee9422a 100644 --- a/engines/cryomni3d/versailles/engine.cpp +++ b/engines/cryomni3d/versailles/engine.cpp @@ -53,7 +53,7 @@ CryOmni3DEngine_Versailles::CryOmni3DEngine_Versailles(OSystem *syst, _mainPalette(nullptr), _cursorPalette(nullptr), _transparentPaletteMap(nullptr), _currentPlace(nullptr), _currentWarpImage(nullptr), _fixedImage(nullptr), _transitionAnimateWarp(true), _forceRedrawWarp(false), _forcePaletteUpdate(false), - _fadedPalette(false), _loadedSave(-1), _dialogsMan(this), + _fadedPalette(false), _loadedSave(uint(-1)), _dialogsMan(this), _musicVolumeFactor(1.), _musicCurrentFile(nullptr), _countingDown(false), _countdownNextEvent(0) { } @@ -465,8 +465,8 @@ void CryOmni3DEngine_Versailles::calculateTransparentMapping() { // Find nearest color transparentScore newColorScore = transparentCalculateScore(transparentRed, transparentGreen, transparentBlue); - uint distanceMin = -1u; - uint nearestId = -1u; + uint distanceMin = uint(-1); + uint nearestId = uint(-1); for (uint j = _transparentSrcStart; j < _transparentSrcStop; j++) { if (j != i && newColorScore.dScore(proximities[j]) < 15) { uint distance = newColorScore.dRed(proximities[j]) + newColorScore.dGreen(proximities[j]); @@ -477,9 +477,9 @@ void CryOmni3DEngine_Versailles::calculateTransparentMapping() { } } - if (nearestId == -1u) { + if (nearestId == uint(-1)) { // Couldn't find a good enough color, try to create one - if (_transparentNewStart != -1u && newColorsNextId <= _transparentNewStop) { + if (_transparentNewStart != uint(-1) && newColorsNextId <= _transparentNewStop) { _mainPalette[3 * newColorsNextId + 0] = transparentRed; _mainPalette[3 * newColorsNextId + 1] = transparentGreen; _mainPalette[3 * newColorsNextId + 2] = transparentBlue; @@ -490,7 +490,7 @@ void CryOmni3DEngine_Versailles::calculateTransparentMapping() { } } - if (nearestId == -1u) { + if (nearestId == uint(-1)) { // Couldn't allocate a new color, return the original one nearestId = i; } @@ -675,11 +675,11 @@ void CryOmni3DEngine_Versailles::changeLevel(int level) { _gameVariables[GameVariables::kCurrentTime] = 1; // keep back place state for level 2 - int place8_state_backup; + int place8_state_backup = -1; if (level == 2) { place8_state_backup = _placeStates[8].state; } - _nextPlaceId = -1; + _nextPlaceId = uint(-1); initNewLevel(_currentLevel); // restore place state for level 2 if (level == 2) { @@ -743,7 +743,7 @@ void CryOmni3DEngine_Versailles::setupLevelWarps(int level) { const LevelInitialState &initialState = kLevelInitialStates[level - 1]; - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = initialState.placeId; } _omni3dMan.setAlpha(initialState.alpha); @@ -825,7 +825,7 @@ void CryOmni3DEngine_Versailles::setGameTime(uint newTime, uint level) { void CryOmni3DEngine_Versailles::gameStep() { while (!_abortCommand) { - if (_nextPlaceId != -1u) { + if (_nextPlaceId != uint(-1)) { if (_placeStates[_nextPlaceId].initPlace) { (this->*_placeStates[_nextPlaceId].initPlace)(); } @@ -842,7 +842,7 @@ void CryOmni3DEngine_Versailles::gameStep() { // Get selected object there to detect when it has just been deselected Object *selectedObject = _inventory.selectedObject(); - _nextPlaceId = -1; + _nextPlaceId = uint(-1); bool doEvent; if (_placeStates[_currentPlaceId].filterEvent && !_isVisiting) { doEvent = (this->*_placeStates[_currentPlaceId].filterEvent)(&actionId); @@ -866,7 +866,7 @@ void CryOmni3DEngine_Versailles::gameStep() { if (doEvent) { executeSpeakAction(actionId); // Force refresh of place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } } @@ -888,7 +888,7 @@ void CryOmni3DEngine_Versailles::gameStep() { // never filtered executeSpeakAction(actionId); // Force refresh of place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } } else if (actionId == 66666) { @@ -920,7 +920,7 @@ void CryOmni3DEngine_Versailles::doGameOver() { void CryOmni3DEngine_Versailles::doPlaceChange() { const Place *nextPlace = _wam.findPlaceById(_nextPlaceId); uint state = _placeStates[_nextPlaceId].state; - if (state == -1u) { + if (state == uint(-1)) { state = 0; } @@ -933,7 +933,7 @@ void CryOmni3DEngine_Versailles::doPlaceChange() { if (warpFile.size() > 0) { if (warpFile.hasPrefix("NOT_MOVE")) { // Don't move so do nothing but cancel place change - _nextPlaceId = -1; + _nextPlaceId = uint(-1); } else { _currentPlace = nextPlace; if (!warpFile.hasPrefix("NOT_STOP")) { @@ -965,7 +965,7 @@ void CryOmni3DEngine_Versailles::doPlaceChange() { setMousePos(Common::Point(320, 240)); // Center of screen _currentPlaceId = _nextPlaceId; - _nextPlaceId = -1; + _nextPlaceId = uint(-1); } } } else { @@ -996,7 +996,7 @@ void CryOmni3DEngine_Versailles::executeTransition(uint nextPlaceId) { _nextPlaceId = nextPlaceId; - Common::String animation = animationId == -1u ? "" : transition->animations[animationId]; + Common::String animation = (animationId == uint(-1)) ? "" : transition->animations[animationId]; animation.toUppercase(); debug("Transition animation: %s", animation.c_str()); if (animation.hasPrefix("NOT_FLI")) { @@ -1024,7 +1024,7 @@ void CryOmni3DEngine_Versailles::executeTransition(uint nextPlaceId) { _omni3dMan.setBeta(-transition->dstBeta); uint nextState = _placeStates[nextPlaceId].state; - if (nextState == -1u) { + if (nextState == uint(-1)) { nextState = 0; } const Place *nextPlace = _wam.findPlaceById(nextPlaceId); @@ -1046,7 +1046,7 @@ void CryOmni3DEngine_Versailles::executeTransition(uint nextPlaceId) { uint nextNextPlaceId = nextPlace->transitions[transitionNum].dstId; animationId = determineTransitionAnimation(nextPlaceId, nextNextPlaceId, &transition); - animation = animationId == -1u ? "" : transition->animations[animationId]; + animation = (animationId == uint(-1)) ? "" : transition->animations[animationId]; animation.toUppercase(); debug("Transition animation: %s", animation.c_str()); @@ -1107,7 +1107,7 @@ uint CryOmni3DEngine_Versailles::determineTransitionAnimation(uint srcPlaceId, } if (animsNum == 0) { - return -1; + return uint(-1); } if (animsNum == 1) { @@ -1139,12 +1139,12 @@ int CryOmni3DEngine_Versailles::handleWarp() { bool leftButtonPressed = false; bool firstDraw = true; bool moving = true; - uint actionId; + uint actionId = uint(-1); showMouse(true); _canLoadSave = true; while (!leftButtonPressed && !exit) { int xDelta = 0, yDelta = 0; - uint movingCursor = -1; + uint movingCursor = uint(-1); pollEvents(); Common::Point mouse = getMousePos(); @@ -1293,7 +1293,7 @@ bool CryOmni3DEngine_Versailles::handleWarpMouse(uint *actionId, setCursor(145); } else if (*actionId >= 50000 && *actionId < 60000) { setCursor(136); - } else if (movingCursor != -1u) { + } else if (movingCursor != uint(-1)) { setCursor(movingCursor); } else { setCursor(45); @@ -1575,7 +1575,7 @@ void CryOmni3DEngine_Versailles::handleFixedImg(const FixedImgCallback &callback // functor is deleted in ZoneFixedImage functor = nullptr; - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _forcePaletteUpdate = true; } } diff --git a/engines/cryomni3d/versailles/logic.cpp b/engines/cryomni3d/versailles/logic.cpp index 6ce21bc1a2c..cd76c3f599b 100644 --- a/engines/cryomni3d/versailles/logic.cpp +++ b/engines/cryomni3d/versailles/logic.cpp @@ -745,7 +745,7 @@ IMG_CB(32120) { _gameVariables[GameVariables::kSketchState] = 3; playInGameVideo("23I_11"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } _inventory.removeByIconID(38); @@ -760,7 +760,7 @@ IMG_CB(32120) { _gameVariables[GameVariables::kSketchState] = 4; playInGameVideo("23I_12"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } _inventory.removeByIconID(38); @@ -915,7 +915,7 @@ IMG_CB(34132) { IMG_CB(34172) { playInGameVideo("43X3_10"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } fimg->_exit = true; @@ -934,7 +934,7 @@ IMG_CB(34173) { /* playInGameVideo("43X3_21"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } */ @@ -1075,7 +1075,7 @@ IMG_CB(34174c) { playInGameVideo("cofouv"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -1212,7 +1212,7 @@ bool CryOmni3DEngine_Versailles::handleSafe(ZonFixedImage *fimg) { // Animate handle playInGameVideo("43x3_poi"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -1377,7 +1377,7 @@ IMG_CB(41801) { // Animate opening playInGameVideo("12E2_11"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -1403,7 +1403,7 @@ IMG_CB(41801b) { // Animate closing playInGameVideo("12E2_13"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } fimg->_exit = true; @@ -1436,7 +1436,7 @@ IMG_CB(41801c) { // Animate closing playInGameVideo("12E2_13"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } fimg->_exit = true; @@ -1510,7 +1510,7 @@ IMG_CB(41802) { if (objID == 100) { playInGameVideo("12E2_24"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } _inventory.removeByNameID(100); @@ -1522,7 +1522,7 @@ IMG_CB(41802) { // Lampoon about arts playInGameVideo("PAP-BRUL"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } doGameOver(); @@ -1557,7 +1557,7 @@ IMG_CB(41802b) { if (objID == 100) { playInGameVideo("12E2_24"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } _inventory.removeByNameID(100); @@ -1569,7 +1569,7 @@ IMG_CB(41802b) { // Lampoon about arts playInGameVideo("PAP-BRUL"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } doGameOver(); @@ -1602,7 +1602,7 @@ IMG_CB(41802c) { if (objID == 100) { playInGameVideo("12E2_24"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } _inventory.removeByNameID(100); @@ -1614,7 +1614,7 @@ IMG_CB(41802c) { // Lampoon about arts playInGameVideo("PAP-BRUL"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } doGameOver(); @@ -1637,7 +1637,7 @@ IMG_CB(41802d) { if (objID == 100) { playInGameVideo("12E2_24"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } _inventory.removeByNameID(100); @@ -1649,7 +1649,7 @@ IMG_CB(41802d) { // Lampoon about arts playInGameVideo("PAP-BRUL"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } doGameOver(); @@ -1719,7 +1719,7 @@ IMG_CB(43145) { if (fimg->_currentZone == 0) { playInGameVideo("30L_51"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -1731,7 +1731,7 @@ IMG_CB(43145) { } else if (fimg->_currentZone == 1) { playInGameVideo("30L_52"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -1811,7 +1811,7 @@ IMG_CB(43146) { if (fimg->_currentZone == 0) { playInGameVideo("30L_41"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -1823,7 +1823,7 @@ IMG_CB(43146) { } else if (fimg->_currentZone == 1) { playInGameVideo("30L_42"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -2009,7 +2009,7 @@ IMG_CB(43190) { if (fimg->_zoneUse) { playInGameVideo("31L1_2A"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } ZonFixedImage::CallbackFunctor *functor = @@ -2032,7 +2032,7 @@ IMG_CB(43190b) { if (fimg->_zoneUse) { playInGameVideo("31L1_2B"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } ZonFixedImage::CallbackFunctor *functor = @@ -2055,7 +2055,7 @@ IMG_CB(43190c) { if (fimg->_zoneUse) { playInGameVideo("31L1_2C"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } ZonFixedImage::CallbackFunctor *functor = @@ -2078,7 +2078,7 @@ IMG_CB(43190d) { if (fimg->_zoneUse) { playInGameVideo("31L1_2D"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } ZonFixedImage::CallbackFunctor *functor = @@ -2575,7 +2575,7 @@ IMG_CB(88001) { playInGameVideo("33P_10"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -2640,7 +2640,7 @@ IMG_CB(88001c) { playInGameVideo("33P_14"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -2907,7 +2907,7 @@ IMG_CB(88003f) { playInGameVideo("COFFRE"); _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } playTransitionEndLevel(7); @@ -3156,7 +3156,7 @@ IMG_CB(88004b) { // Open the toilets playInGameVideo("31j32"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } fimg->load("31j32.gif"); @@ -3178,7 +3178,7 @@ IMG_CB(88004b) { // Close the toilets playInGameVideo("31j32b"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } } @@ -3212,7 +3212,7 @@ FILTER_EVENT(1, 2) { _dialogsMan.play("11E_HUI"); _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } return false; @@ -3327,7 +3327,7 @@ FILTER_EVENT(1, 14) { playInGameVideo(video); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3355,7 +3355,7 @@ FILTER_EVENT(2, 1) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3384,7 +3384,7 @@ FILTER_EVENT(2, 1) { playInGameVideo(video); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3405,7 +3405,7 @@ FILTER_EVENT(2, 2) { } const char *video = nullptr; - FixedImgCallback callback; + FixedImgCallback callback = nullptr; const Object *obj = _inventory.selectedObject(); bool deselectObj = false; @@ -3464,7 +3464,7 @@ FILTER_EVENT(2, 2) { playInGameVideo(video); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3494,7 +3494,7 @@ FILTER_EVENT(2, 5) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3523,7 +3523,7 @@ INIT_PLACE(2, 9) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3548,7 +3548,7 @@ FILTER_EVENT(2, 9) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3577,7 +3577,7 @@ FILTER_EVENT(2, 11) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3622,7 +3622,7 @@ FILTER_EVENT(2, 12) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3660,7 +3660,7 @@ FILTER_EVENT(3, 3) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3680,7 +3680,7 @@ FILTER_EVENT(3, 10) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3698,7 +3698,7 @@ FILTER_EVENT(3, 10) { } _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } } @@ -3730,7 +3730,7 @@ FILTER_EVENT(3, 13) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3798,7 +3798,7 @@ FILTER_EVENT(3, 18) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } return true; @@ -3831,7 +3831,7 @@ FILTER_EVENT(3_5, 20) { playInGameVideo("31j31"); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3869,7 +3869,7 @@ FILTER_EVENT(3, 22) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3920,7 +3920,7 @@ bool CryOmni3DEngine_Versailles::filterEventLevel3Obj23151() { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3947,7 +3947,7 @@ INIT_PLACE(4, 9) { _dialogsMan.play("4_MAI"); _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } } @@ -3960,7 +3960,7 @@ FILTER_EVENT(4, 10) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -3981,7 +3981,7 @@ FILTER_EVENT(4, 10) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -4029,7 +4029,7 @@ FILTER_EVENT(4, 12_13_14) { playInGameVideo(video); // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -4062,7 +4062,7 @@ FILTER_EVENT(4, 16) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -4134,7 +4134,7 @@ FILTER_EVENT(5, 9) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -4165,7 +4165,7 @@ FILTER_EVENT(5, 9) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -4192,7 +4192,7 @@ FILTER_EVENT(5, 14) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -4361,7 +4361,7 @@ FILTER_EVENT(5, 27) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -4441,7 +4441,7 @@ FILTER_EVENT(5, 34) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } // Handled here @@ -4521,7 +4521,7 @@ FILTER_EVENT(6, 19) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } @@ -4638,7 +4638,7 @@ FILTER_EVENT(7, 20) { _forcePaletteUpdate = true; // Force reload of the place - if (_nextPlaceId == -1u) { + if (_nextPlaceId == uint(-1)) { _nextPlaceId = _currentPlaceId; } // Handled here diff --git a/engines/cryomni3d/versailles/menus.cpp b/engines/cryomni3d/versailles/menus.cpp index fcc8235df05..eff2085e342 100644 --- a/engines/cryomni3d/versailles/menus.cpp +++ b/engines/cryomni3d/versailles/menus.cpp @@ -98,10 +98,10 @@ uint CryOmni3DEngine_Versailles::displayOptions() { setCursor(181); showMouse(true); - uint hoveredBox = -1; - uint selectedBox = -1; + uint hoveredBox = uint(-1); + uint selectedBox = uint(-1); int selectedMsg = 0; - uint volumeBox = -1; + uint volumeBox = uint(-1); bool resetScreen = true; bool forceEvents = true; @@ -283,8 +283,8 @@ uint CryOmni3DEngine_Versailles::displayOptions() { } while (false); } } else { - if (hoveredBox != -1u) { - hoveredBox = -1; + if (hoveredBox != uint(-1)) { + hoveredBox = uint(-1); drawState = 2; } if (volumeForeColor != 243) { @@ -326,7 +326,7 @@ uint CryOmni3DEngine_Versailles::displayOptions() { bool wasVisiting = _isVisiting; _isVisiting = false; uint saveNumber = displayFilePicker(bgFrame, false, saveName); - if (saveNumber == -1u) { + if (saveNumber == uint(-1)) { _isVisiting = wasVisiting; drawState = 1; selectedMsg = 0; @@ -341,7 +341,7 @@ uint CryOmni3DEngine_Versailles::displayOptions() { bool wasVisiting = _isVisiting; _isVisiting = true; uint saveNumber = displayFilePicker(bgFrame, false, saveName); - if (saveNumber == -1u) { + if (saveNumber == uint(-1)) { _isVisiting = wasVisiting; drawState = 1; selectedMsg = 0; @@ -354,7 +354,7 @@ uint CryOmni3DEngine_Versailles::displayOptions() { } else if (selectedMsg == 29) { Common::String saveName; uint saveNumber = displayFilePicker(bgFrame, true, saveName); - if (saveNumber != -1u) { + if (saveNumber != uint(-1)) { saveGame(_isVisiting, saveNumber, saveName); } drawState = 1; @@ -508,7 +508,7 @@ uint CryOmni3DEngine_Versailles::displayYesNoBox(Graphics::ManagedSurface &surfa bool end = false; bool redraw = true; - uint result = -1u; + uint result = uint(-1); while (!end || redraw) { if (redraw) { @@ -529,7 +529,7 @@ uint CryOmni3DEngine_Versailles::displayYesNoBox(Graphics::ManagedSurface &surfa if (pollEvents()) { Common::Point mouse = getMousePos(); - uint hit_result = -1u; + uint hit_result = uint(-1); if (boxes.hitTest(1, mouse)) { hit_result = 1; } else if (boxes.hitTest(0, mouse)) { @@ -539,7 +539,7 @@ uint CryOmni3DEngine_Versailles::displayYesNoBox(Graphics::ManagedSurface &surfa result = hit_result; redraw = true; } - if ((getCurrentMouseButton() == 1) && (result != -1u)) { + if ((getCurrentMouseButton() == 1) && (result != uint(-1))) { end = true; } Common::KeyCode keyPressed = getNextKey().keycode; @@ -605,12 +605,12 @@ uint CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surface *bgFr uint fileListOffset = CLIP(ConfMan.getInt(_isVisiting ? "visits_list_off" : "saves_list_off"), 0, 100 - 6); - uint boxHovered = -1; - uint boxSelected = -1; + uint boxHovered = uint(-1); + uint boxSelected = uint(-1); bool textCursorState = false; uint textCursorNextState = 0; - uint textCursorPos = -1; + uint textCursorPos = uint(-1); bool autoRepeatInhibit = false; uint autoRepeatDelay = 250; @@ -634,7 +634,7 @@ uint CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surface *bgFr if (box == boxSelected) { // Selected _fontManager.setForeColor(240); - } else if (box == 6 && boxSelected == -1u) { + } else if (box == 6 && boxSelected == uint(-1)) { // Ok and no file selected _fontManager.setForeColor(245); } else if (box == boxHovered) { @@ -686,14 +686,14 @@ uint CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surface *bgFr } } } - if (!boxFound && boxHovered != -1u) { - boxHovered = -1; + if (!boxFound && boxHovered != uint(-1)) { + boxHovered = uint(-1); redraw = true; } } if (key == Common::KEYCODE_RETURN || (mousePressed == 1 && boxHovered == 6)) { // OK - if (boxSelected != -1u) { + if (boxSelected != uint(-1)) { Common::String &selectedSaveName = savesList[boxSelected + fileListOffset]; if (!selectedSaveName.size()) { selectedSaveName = _messages[56]; // No name @@ -704,16 +704,16 @@ uint CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surface *bgFr } else if (mousePressed == 1) { if (boxHovered == 7) { // Cancel - boxSelected = -1; + boxSelected = uint(-1); finished = true; - } else if (boxHovered != -1u && boxHovered != boxSelected) { + } else if (boxHovered != uint(-1) && boxHovered != boxSelected) { // This can only be a file bool existingSave = (savesList[boxHovered + fileListOffset] != _messages[55]); // Don't allow to save on slot 0 when visiting to avoid problems with original visit save bool validSave = !(_isVisiting && saveMode && boxSelected == 0); if ((saveMode || existingSave) && validSave) { // Restore old name - if (saveMode && boxSelected != -1u) { + if (saveMode && boxSelected != uint(-1)) { savesList[boxSelected + fileListOffset] = saveNameBackup; filesListChanged = true; } @@ -728,7 +728,7 @@ uint CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surface *bgFr } } } - if (boxSelected != -1u && saveMode) { + if (boxSelected != uint(-1) && saveMode) { if (key.keycode != Common::KEYCODE_INVALID) { // Reference means we edit in place Common::String &selectedSaveName = savesList[boxSelected + fileListOffset]; @@ -787,11 +787,11 @@ uint CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surface *bgFr } if (autoRepeatTrigger) { // Restore old name - if (saveMode && boxSelected != -1u) { + if (saveMode && boxSelected != uint(-1)) { savesList[boxSelected + oldFileListOffset] = saveNameBackup; } - boxHovered = -1; - boxSelected = -1; + boxHovered = uint(-1); + boxSelected = uint(-1); autoRepeatInhibit = true; autoRepeatEndInhibit = g_system->getMillis() + autoRepeatDelay; filesListChanged = true; @@ -806,12 +806,12 @@ uint CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surface *bgFr autoRepeatDelay = 250; } } - if (boxSelected != -1u) { + if (boxSelected != uint(-1)) { saveName = savesList[boxSelected + fileListOffset]; ConfMan.setInt(_isVisiting ? "visits_list_off" : "saves_list_off", fileListOffset); return boxSelected + fileListOffset + 1; } else { - return -1; + return uint(-1); } } diff --git a/engines/cryomni3d/versailles/saveload.cpp b/engines/cryomni3d/versailles/saveload.cpp index 2c14c3d624d..1cdf8e9a513 100644 --- a/engines/cryomni3d/versailles/saveload.cpp +++ b/engines/cryomni3d/versailles/saveload.cpp @@ -154,7 +154,7 @@ void CryOmni3DEngine_Versailles::saveGame(bool visit, uint saveNum, // Inventory assert(_inventory.size() == 50); for (Inventory::const_iterator it = _inventory.begin(); it != _inventory.end(); it++) { - uint objId = -1; + uint objId = uint(-1); if (*it != nullptr) { // Inventory contains pointers to objects stored in _objects objId = *it - _objects.begin(); @@ -244,9 +244,9 @@ bool CryOmni3DEngine_Versailles::loadGame(bool visit, uint saveNum) { for (Inventory::iterator it = _inventory.begin(); it != _inventory.end(); it++) { uint objId = in->readUint32BE(); if (objId >= _objects.size()) { - objId = -1; + objId = uint(-1); } - if (objId != -1u) { + if (objId != uint(-1)) { *it = _objects.begin() + objId; } else { *it = nullptr; diff --git a/engines/cryomni3d/versailles/toolbar.cpp b/engines/cryomni3d/versailles/toolbar.cpp index d372755af1e..6f08bb5b2bd 100644 --- a/engines/cryomni3d/versailles/toolbar.cpp +++ b/engines/cryomni3d/versailles/toolbar.cpp @@ -62,10 +62,10 @@ void Toolbar::init(const Sprites *sprites, FontManager *fontManager, addZone(225, 225, optPos, &Toolbar::callbackOptions); // Previous or next - addZone(183, -1, Common::Point(190, 18), &Toolbar::callbackInventoryPrev); - addZone(240, -1, Common::Point(574, 18), &Toolbar::callbackInventoryNext); + addZone(183, uint16(-1), Common::Point(190, 18), &Toolbar::callbackInventoryPrev); + addZone(240, uint16(-1), Common::Point(574, 18), &Toolbar::callbackInventoryNext); // View - addZone(142, -1, Common::Point(158, 12), &Toolbar::callbackViewObject); + addZone(142, uint16(-1), Common::Point(158, 12), &Toolbar::callbackViewObject); } Toolbar::~Toolbar() { @@ -74,7 +74,7 @@ Toolbar::~Toolbar() { } void Toolbar::inventoryChanged(uint newPosition) { - if (newPosition != -1u && newPosition > _inventoryOffset) { + if (newPosition != uint(-1) && newPosition > _inventoryOffset) { _inventoryOffset = newPosition - 7; } // Refresh @@ -244,7 +244,7 @@ uint Toolbar::callbackViewObject(uint dragStatus) { _mouse_in_view_object = true; - if (_inventorySelected == -1u) { + if (_inventorySelected == uint(-1)) { // Nothing selected in toolbar return 0; } @@ -371,7 +371,7 @@ void Toolbar::drawToolbar(const Graphics::Surface *original) { } // And now draw the object description if needed - if (_inventoryEnabled && _inventoryHovered != -1u) { + if (_inventoryEnabled && _inventoryHovered != uint(-1)) { Object *obj = (*_inventory)[_inventoryHovered]; uint zoneId = _inventoryHovered - _inventoryOffset; @@ -413,8 +413,8 @@ bool Toolbar::displayToolbar(const Graphics::Surface *original) { _engine->makeTranslucent(_bgSurface, subset); // WORKAROUND: Reset the inventory status at init to let sprites highlighted until toolbar is hidden - _inventorySelected = -1; - _inventoryHovered = -1; + _inventorySelected = uint(-1); + _inventoryHovered = uint(-1); _zones[12].secondary = true; updateZones(); @@ -473,8 +473,8 @@ void Toolbar::handleToolbarEvents(const Graphics::Surface *original) { bool redrawToolbar; // Don't have anything hovered for now - _inventoryHovered = -1; - _inventorySelected = -1; + _inventoryHovered = uint(-1); + _inventorySelected = uint(-1); _inventory->setSelectedObject(nullptr); _backup_selected_object = nullptr; @@ -519,7 +519,7 @@ void Toolbar::handleToolbarEvents(const Graphics::Surface *original) { redrawToolbar = true; } else if (_engine->getDragStatus() == kDragStatus_Pressed) { // A click happened and wasn't handled, deselect object - _inventorySelected = -1; + _inventorySelected = uint(-1); _inventory->setSelectedObject(nullptr); _engine->setCursor(181); // Reset view object @@ -565,10 +565,10 @@ void Toolbar::handleToolbarEvents(const Graphics::Surface *original) { redrawToolbar = true; } } - if (!shouldHover && _inventoryHovered != -1u && !_mouse_in_view_object) { + if (!shouldHover && _inventoryHovered != uint(-1) && !_mouse_in_view_object) { // Remove hovering - _inventoryHovered = -1; - _inventorySelected = -1; + _inventoryHovered = uint(-1); + _inventorySelected = uint(-1); updateZones(); if (!_inventory->selectedObject()) { // Reset back the cursor if nothing is selected diff --git a/engines/cryomni3d/versailles/toolbar.h b/engines/cryomni3d/versailles/toolbar.h index e65d161afe9..cb1eeb4b501 100644 --- a/engines/cryomni3d/versailles/toolbar.h +++ b/engines/cryomni3d/versailles/toolbar.h @@ -42,7 +42,7 @@ class Toolbar { public: Toolbar() : _sprites(nullptr), _fontManager(nullptr), _inventory(nullptr), _messages(nullptr), _inventoryOffset(0), _engine(nullptr), - _inventoryHovered(-1), _inventorySelected(-1), _inventoryEnabled(true), + _inventoryHovered(uint(-1)), _inventorySelected(uint(-1)), _inventoryEnabled(true), _position(60) { } ~Toolbar(); diff --git a/engines/cryomni3d/video/hnm_decoder.cpp b/engines/cryomni3d/video/hnm_decoder.cpp index 15e86dad6b6..db59782d663 100644 --- a/engines/cryomni3d/video/hnm_decoder.cpp +++ b/engines/cryomni3d/video/hnm_decoder.cpp @@ -188,9 +188,9 @@ HNMDecoder::HNM4VideoTrack::~HNM4VideoTrack() { } void HNMDecoder::HNM4VideoTrack::setFrameDelay(uint32 frameDelay) { - if (_nextFrameDelay == -1u) { + if (_nextFrameDelay == uint32(-1)) { _nextFrameDelay = frameDelay; - } else if (_nextNextFrameDelay == -1u) { + } else if (_nextNextFrameDelay == uint32(-1)) { _nextNextFrameDelay = frameDelay; } else { _nextNextFrameDelay += frameDelay; @@ -325,9 +325,9 @@ void HNMDecoder::HNM4VideoTrack::decodeInterframe(Common::SeekableReadStream *st _surface.setPixels(_frameBufferC); _curFrame++; - _nextFrameStartTime += _nextFrameDelay != -1u ? _nextFrameDelay : _regularFrameDelay; + _nextFrameStartTime += _nextFrameDelay != uint32(-1) ? _nextFrameDelay : _regularFrameDelay; _nextFrameDelay = _nextNextFrameDelay; - _nextNextFrameDelay = -1u; + _nextNextFrameDelay = uint32(-1); if (size > 0) { stream->skip(size); @@ -340,9 +340,9 @@ void HNMDecoder::HNM4VideoTrack::decodeIntraframe(Common::SeekableReadStream *st _surface.setPixels(_frameBufferC); _curFrame++; - _nextFrameStartTime += _nextFrameDelay != -1u ? _nextFrameDelay : _regularFrameDelay; + _nextFrameStartTime += _nextFrameDelay != uint32(-1) ? _nextFrameDelay : _regularFrameDelay; _nextFrameDelay = _nextNextFrameDelay; - _nextNextFrameDelay = -1u; + _nextNextFrameDelay = uint32(-1); } HNMDecoder::DPCMAudioTrack::DPCMAudioTrack(uint16 channels, uint16 bits, uint sampleRate, diff --git a/engines/cryomni3d/video/hnm_decoder.h b/engines/cryomni3d/video/hnm_decoder.h index 993638e1806..695488f670b 100644 --- a/engines/cryomni3d/video/hnm_decoder.h +++ b/engines/cryomni3d/video/hnm_decoder.h @@ -75,7 +75,7 @@ private: void decodeInterframe(Common::SeekableReadStream *stream, uint32 size); void decodeIntraframe(Common::SeekableReadStream *stream, uint32 size); - void restart() { _nextFrameDelay = -1; _nextNextFrameDelay = -1; } + void restart() { _nextFrameDelay = uint32(-1); _nextNextFrameDelay = uint32(-1); } void setFrameDelay(uint32 frameDelay); private: diff --git a/engines/cryomni3d/wam_parser.cpp b/engines/cryomni3d/wam_parser.cpp index 8119cda47be..852cc98e404 100644 --- a/engines/cryomni3d/wam_parser.cpp +++ b/engines/cryomni3d/wam_parser.cpp @@ -122,7 +122,7 @@ Place *WAMParser::findPlaceById_(uint placeId) { } void Place::setupWarpConstraints(Omni3DManager &omni3d) const { - int16 iAlphaMin, iAlphaMax; + int16 iAlphaMin = -32768, iAlphaMax = 32767; bool alphaConstraint = false; omni3d.clearConstraints();