diff options
Diffstat (limited to 'engines/cryomni3d/versailles')
-rw-r--r-- | engines/cryomni3d/versailles/data.cpp | 6 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/dialogs_manager.cpp | 18 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/dialogs_manager.h | 4 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/documentation.cpp | 184 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/documentation.h | 30 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/engine.cpp | 112 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/engine.h | 148 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/logic.cpp | 92 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/menus.cpp | 100 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/music.cpp | 10 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/saveload.cpp | 36 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/toolbar.cpp | 28 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/toolbar.h | 38 |
13 files changed, 403 insertions, 403 deletions
diff --git a/engines/cryomni3d/versailles/data.cpp b/engines/cryomni3d/versailles/data.cpp index a11b1ab428..61ed9e4f75 100644 --- a/engines/cryomni3d/versailles/data.cpp +++ b/engines/cryomni3d/versailles/data.cpp @@ -25,7 +25,7 @@ namespace CryOmni3D { namespace Versailles { -const unsigned int CryOmni3DEngine_Versailles::kSpritesMapTable[] = { +const uint CryOmni3DEngine_Versailles::kSpritesMapTable[] = { /* 0 */ 242, 240, 243, 241, 256, 93, 97, 94, 160, 98, 178, 161, 179, 196, 197, 244, /* 16 */ 142, 245, 143, 254, 95, 99, 113, 96, 100, 180, 114, 181, 73, 144, 74, 250, /* 32 */ 202, 145, 170, 251, 203, 130, 206, 171, 49, 131, 207, 115, 116, 222, 75, 85, @@ -43,7 +43,7 @@ const unsigned int CryOmni3DEngine_Versailles::kSpritesMapTable[] = { /* 224 */ 80, 221, 1, 263, 78, 67, 174, 212, 68, 175, 213, 190, 191, 238, 0, 239, /* 240 */ 224, 77, 146, 2, 147, 79, 158, 176, 159, 177, 194, 192, 195, 193, /*-1u, -1u*/ }; -const unsigned int CryOmni3DEngine_Versailles::kSpritesMapTableSize = ARRAYSIZE(kSpritesMapTable); +const uint CryOmni3DEngine_Versailles::kSpritesMapTableSize = ARRAYSIZE(kSpritesMapTable); const LevelInitialState CryOmni3DEngine_Versailles::kLevelInitialStates[] = { { 1, M_PI, 0. }, // Level 1 @@ -504,7 +504,7 @@ void CryOmni3DEngine_Versailles::setupDialogVariables() { SET_DIAL_VARIABLE(136, "{CURRENT_GAME_TIME5}"); SET_DIAL_VARIABLE(137, "{JOUEUR_POSSEDE_EPIGRAPHE}"); #undef SET_DIAL_VARIABLE - for (unsigned int i = 0; i < ARRAYSIZE(videoSubSettings); i++) { + for (uint i = 0; i < ARRAYSIZE(videoSubSettings); i++) { const VideoSubSetting &vss = videoSubSettings[i]; _dialogsMan.registerSubtitlesSettings( vss.videoName, diff --git a/engines/cryomni3d/versailles/dialogs_manager.cpp b/engines/cryomni3d/versailles/dialogs_manager.cpp index f7a2146d92..27bcbb6055 100644 --- a/engines/cryomni3d/versailles/dialogs_manager.cpp +++ b/engines/cryomni3d/versailles/dialogs_manager.cpp @@ -52,7 +52,7 @@ bool Versailles_DialogsManager::play(const Common::String &sequence) { if (didSth && slowStop) { if (_engine->showSubtitles()) { bool skip = false; - unsigned int end = g_system->getMillis() + 2000; + uint end = g_system->getMillis() + 2000; while (!g_engine->shouldQuit() && g_system->getMillis() < end && !skip) { g_system->updateScreen(); if (_engine->pollEvents() && @@ -150,11 +150,11 @@ void Versailles_DialogsManager::playDialog(const Common::String &video, const Co if (_engine->showSubtitles()) { Common::Rect block = settings.textRect; - unsigned int lines = fontManager.getLinesCount(text, block.width() - 8); + uint lines = fontManager.getLinesCount(text, block.width() - 8); if (lines == 0) { lines = 5; } - unsigned int blockHeight = fontManager.lineHeight() * lines + 6; + uint blockHeight = fontManager.lineHeight() * lines + 6; block.setHeight(blockHeight); if (block.bottom >= 480) { @@ -181,13 +181,13 @@ void Versailles_DialogsManager::playDialog(const Common::String &video, const Co // Empty wave file delete audioDecoder; - unsigned int duration = 100 * text.size(); + uint duration = 100 * text.size(); if (duration < 1000) { duration = 1000; } bool skipWait = false; - unsigned int end = g_system->getMillis() + duration; + uint end = g_system->getMillis() + duration; while (!g_engine->shouldQuit() && g_system->getMillis() < end && !skipWait) { if (_engine->pollEvents() && _engine->checkKeysPressed(1, Common::KEYCODE_SPACE)) { skipWait = true; @@ -238,7 +238,7 @@ void Versailles_DialogsManager::displayMessage(const Common::String &text) { _engine->displayMessageBoxWarp(text); } -unsigned int Versailles_DialogsManager::askPlayerQuestions(const Common::String &video, +uint Versailles_DialogsManager::askPlayerQuestions(const Common::String &video, const Common::StringArray &questions) { if (_lastImage.empty()) { loadFrame(video); @@ -258,11 +258,11 @@ unsigned int Versailles_DialogsManager::askPlayerQuestions(const Common::String int16 tops[5]; int16 bottoms[5]; int16 currentHeight = 0; - unsigned int questionId = 0; + uint questionId = 0; for (Common::StringArray::const_iterator it = questions.begin(); it != questions.end(); it++, questionId++) { tops[questionId] = currentHeight; - unsigned int lines = fontManager.getLinesCount(*it, 598); + uint lines = fontManager.getLinesCount(*it, 598); if (lines == 0) { lines = 1; } @@ -288,7 +288,7 @@ unsigned int Versailles_DialogsManager::askPlayerQuestions(const Common::String bool finished = false; bool update = true; - unsigned int selectedQuestion = -1; + uint selectedQuestion = -1; while (!finished) { if (update) { update = false; diff --git a/engines/cryomni3d/versailles/dialogs_manager.h b/engines/cryomni3d/versailles/dialogs_manager.h index 3c5028ff2f..9c41fc4cef 100644 --- a/engines/cryomni3d/versailles/dialogs_manager.h +++ b/engines/cryomni3d/versailles/dialogs_manager.h @@ -50,8 +50,8 @@ protected: void playDialog(const Common::String &video, const Common::String &sound, const Common::String &text, const SubtitlesSettings &settings) override; void displayMessage(const Common::String &text) override; - unsigned int askPlayerQuestions(const Common::String &video, - const Common::StringArray &questions) override; + uint askPlayerQuestions(const Common::String &video, + const Common::StringArray &questions) override; private: CryOmni3DEngine_Versailles *_engine; diff --git a/engines/cryomni3d/versailles/documentation.cpp b/engines/cryomni3d/versailles/documentation.cpp index 79c6001ca7..abdbc63bdf 100644 --- a/engines/cryomni3d/versailles/documentation.cpp +++ b/engines/cryomni3d/versailles/documentation.cpp @@ -97,7 +97,7 @@ void Versailles_Documentation::init(const Sprites *sprites, FontManager *fontMan error("Can't open %s", kAllDocsFile); } - unsigned int allDocsSize = allDocsFile.size(); + uint allDocsSize = allDocsFile.size(); char *allDocs = new char[allDocsSize + 1]; char *end = allDocs + allDocsSize; allDocsFile.read(allDocs, allDocsSize); @@ -188,7 +188,7 @@ void Versailles_Documentation::handleDocInGame(const Common::String &record) { bool end = false; while (!end) { inGamePrepareRecord(docSurface, boxes); - unsigned int action = inGameHandleRecord(docSurface, boxes, nextRecord); + uint action = inGameHandleRecord(docSurface, boxes, nextRecord); switch (action) { case 0: // Back @@ -280,7 +280,7 @@ Common::String Versailles_Documentation::docAreaHandleSummary() { Image::BitmapDecoder bmpDecoder; Common::File file; - for (unsigned int i = 0; i < ARRAYSIZE(categories); i++) { + for (uint i = 0; i < ARRAYSIZE(categories); i++) { if (!categories[i].bmp) { // No BMP to load continue; @@ -330,14 +330,14 @@ Common::String Versailles_Documentation::docAreaHandleSummary() { g_system->showMouse(true); bool redraw = true; - unsigned int hoveredBox = -1; - unsigned int selectedBox = -1; + uint hoveredBox = -1; + uint selectedBox = -1; while (selectedBox == -1u) { if (redraw) { // Draw without worrying of already modified areas, that's handled when recomputing hoveredBox - for (unsigned int i = 0; i < ARRAYSIZE(categories); i++) { - unsigned int foreColor = 243; + for (uint i = 0; i < ARRAYSIZE(categories); i++) { + uint foreColor = 243; if (i == hoveredBox) { foreColor = 241; if (categories[hoveredBox].highlightedImg.getPixels() != nullptr) { @@ -347,8 +347,8 @@ Common::String Versailles_Documentation::docAreaHandleSummary() { } _fontManager->setForeColor(foreColor); if (categories[i].title) { - unsigned int x = categories[i].linesPos.right - _fontManager->getStrWidth(*categories[i].title); - unsigned int y = categories[i].linesPos.bottom - _fontManager->getFontMaxHeight() - 5; + uint x = categories[i].linesPos.right - _fontManager->getStrWidth(*categories[i].title); + uint y = categories[i].linesPos.bottom - _fontManager->getFontMaxHeight() - 5; _fontManager->displayStr(x, y, *categories[i].title); // Draw line to text @@ -373,7 +373,7 @@ Common::String Versailles_Documentation::docAreaHandleSummary() { // Don't change highlighted icon when clicking Common::Point mouse = _engine->getMousePos(); bool foundBox = false; - for (unsigned int i = 0; i < ARRAYSIZE(categories); i++) { + for (uint i = 0; i < ARRAYSIZE(categories); i++) { if (boxes.hitTest(i, mouse)) { foundBox = true; if (i != hoveredBox) { @@ -446,11 +446,11 @@ Common::String Versailles_Documentation::docAreaHandleTimeline() { _fontManager->setCurrentFont(0); MouseBoxes boxes(ARRAYSIZE(kTimelineEntries) + 1); - for (unsigned int box_id = 0; box_id < ARRAYSIZE(kTimelineEntries); box_id++) { + for (uint box_id = 0; box_id < ARRAYSIZE(kTimelineEntries); box_id++) { boxes.setupBox(box_id, kTimelineEntries[box_id].x, kTimelineEntries[box_id].y, kTimelineEntries[box_id].x + 30, kTimelineEntries[box_id].y + 20); } - const unsigned int leaveBoxId = ARRAYSIZE(kTimelineEntries); + const uint leaveBoxId = ARRAYSIZE(kTimelineEntries); boxes.setupBox(leaveBoxId, 639 - _sprites->getCursor(105).getWidth(), 479 - _sprites->getCursor(105).getHeight(), 640, 480); @@ -458,13 +458,13 @@ Common::String Versailles_Documentation::docAreaHandleTimeline() { g_system->showMouse(true); bool redraw = true; - unsigned int hoveredBox = -1; - unsigned int selectedBox = -1; + uint hoveredBox = -1; + uint selectedBox = -1; while (selectedBox == -1u) { if (redraw) { // Draw without worrying of already modified areas, that's handled when recomputing hoveredBox - for (unsigned int i = 0; i < ARRAYSIZE(kTimelineEntries); i++) { + for (uint i = 0; i < ARRAYSIZE(kTimelineEntries); i++) { _fontManager->setForeColor(i == hoveredBox ? 241 : 243); _fontManager->displayStr(kTimelineEntries[i].x, kTimelineEntries[i].y, kTimelineEntries[i].year); } @@ -482,7 +482,7 @@ Common::String Versailles_Documentation::docAreaHandleTimeline() { if (!_engine->getCurrentMouseButton()) { // Don't change highlighted date when clicking bool foundBox = false; - for (unsigned int i = 0; i < ARRAYSIZE(kTimelineEntries); i++) { + for (uint i = 0; i < ARRAYSIZE(kTimelineEntries); i++) { if (boxes.hitTest(i, mouse)) { foundBox = true; if (i != hoveredBox) { @@ -526,8 +526,8 @@ Common::String Versailles_Documentation::docAreaHandleTimeline() { } } -unsigned int Versailles_Documentation::docAreaHandleRecords(const Common::String &record) { - unsigned int action = -1; +uint Versailles_Documentation::docAreaHandleRecords(const Common::String &record) { + uint action = -1; _currentRecord = record; _visitTrace.clear(); @@ -639,7 +639,7 @@ void Versailles_Documentation::docAreaPrepareNavigation() { _categoryStartRecord = "VS00"; _categoryEndRecord = "VS37"; _categoryTitle = (*_messages)[72]; - unsigned int id = atoi(_currentRecord.c_str() + 2); + uint id = atoi(_currentRecord.c_str() + 2); if (id >= 16 && id <= 40) { _currentMapLayout = true; } @@ -681,7 +681,7 @@ void Versailles_Documentation::docAreaPrepareRecord(Graphics::ManagedSurface &su _fontManager->setCharSpacing(1); _fontManager->setSurface(&surface); _fontManager->setForeColor(243); - for (unsigned int box_id = 10; box_id < ARRAYSIZE(kTimelineEntries) + 10; box_id++) { + for (uint box_id = 10; box_id < ARRAYSIZE(kTimelineEntries) + 10; box_id++) { boxes.display(box_id, *_fontManager); } } @@ -689,7 +689,7 @@ void Versailles_Documentation::docAreaPrepareRecord(Graphics::ManagedSurface &su drawRecordBoxes(surface, true, boxes); } -unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &surface, +uint Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes, Common::String &nextRecord) { // Hovering is only handled for timeline entries _engine->setCursor(181); @@ -697,8 +697,8 @@ unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurf bool first = true; bool redraw = true; - unsigned int hoveredBox = -1; - unsigned int action = -1; + uint hoveredBox = -1; + uint action = -1; while (action == -1u) { if (redraw) { @@ -716,7 +716,7 @@ unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurf Common::Point mouse = _engine->getMousePos(); if (_currentInTimeline) { bool foundBox = false; - for (unsigned int i = 10; i < 10 + ARRAYSIZE(kTimelineEntries); i++) { + for (uint i = 10; i < 10 + ARRAYSIZE(kTimelineEntries); i++) { if (boxes.hitTest(i, mouse)) { foundBox = true; if (i != hoveredBox) { @@ -764,8 +764,8 @@ unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurf items.push_back(it->title); } Common::Rect iconRect = boxes.getBoxRect(2); - unsigned int selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top), - true, 20, items); + uint selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top), + true, 20, items); if (selectedItem != -1u) { nextRecord = _currentLinks[selectedItem].record; action = 2; @@ -776,8 +776,8 @@ unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurf items.push_back(it->title); } Common::Rect iconRect = boxes.getBoxRect(3); - unsigned int selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top), - true, 20, items); + uint selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top), + true, 20, items); if (selectedItem != -1u) { nextRecord = _allLinks[selectedItem].record; action = 3; @@ -792,7 +792,7 @@ unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurf Common::StringArray items; items.push_back((*_messages)[61]); items.push_back((*_messages)[62]); - unsigned int selectedItem = handlePopupMenu(surface, boxes.getBoxOrigin(1), false, 20, items); + uint selectedItem = handlePopupMenu(surface, boxes.getBoxOrigin(1), false, 20, items); if (selectedItem == 0) { action = 1; } else if (selectedItem == 1) { @@ -808,7 +808,7 @@ unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurf // Handle quit menu Common::StringArray items; items.push_back((*_messages)[60]); - unsigned int selectedItem = handlePopupMenu(surface, boxes.getBoxOrigin(6), false, 20, items); + uint selectedItem = handlePopupMenu(surface, boxes.getBoxOrigin(6), false, 20, items); if (selectedItem == 0) { action = 6; } @@ -841,7 +841,7 @@ unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurf action = -1; continue; } - unsigned int recordId = hmIt->_value.id; + uint recordId = hmIt->_value.id; if (action == 4) { recordId++; } else if (action == 5) { @@ -865,16 +865,16 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() { Common::Rect areaPos; const char *record; const char *bmp; - unsigned int messageId; + uint messageId; const Common::String *message; Common::Point messagePos; Graphics::Surface highlightedImg; - Area(const Common::Point &areaPos_, const char *bmp_, unsigned int messageId_, + Area(const Common::Point &areaPos_, const char *bmp_, uint messageId_, const char *record_ = nullptr) : areaPos(areaPos_.x, areaPos_.y, areaPos_.x, areaPos_.y), record(record_), bmp(bmp_), messageId(messageId_), message(nullptr) { } - Area(const Common::Rect &areaPos_, unsigned int messageId_, const char *record_ = nullptr) : + Area(const Common::Rect &areaPos_, uint messageId_, const char *record_ = nullptr) : areaPos(areaPos_), record(record_), bmp(nullptr), messageId(messageId_), message(nullptr) { } } areas[] = { Area(Common::Point(174, 181), "APL.bmp", 74), @@ -905,7 +905,7 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() { Image::BitmapDecoder bmpDecoder; Common::File file; - for (unsigned int i = 0; i < ARRAYSIZE(areas); i++) { + for (uint i = 0; i < ARRAYSIZE(areas); i++) { if (areas[i].bmp) { if (!file.open(areas[i].bmp)) { error("Failed to open BMP file: %s", areas[i].bmp); @@ -920,7 +920,7 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() { areas[i].areaPos.setHeight(areas[i].highlightedImg.h); } areas[i].message = &(*_messages)[areas[i].messageId]; - unsigned int lineWidth = _fontManager->getStrWidth(*areas[i].message); + uint lineWidth = _fontManager->getStrWidth(*areas[i].message); areas[i].messagePos.x = (areas[i].areaPos.left + areas[i].areaPos.right) / 2 - lineWidth / 2; areas[i].messagePos.y = areas[i].areaPos.top - 40; if (areas[i].messagePos.x < 8) { @@ -956,8 +956,8 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() { g_system->showMouse(true); bool redraw = true; - unsigned int hoveredBox = -1; - unsigned int selectedBox = -1; + uint hoveredBox = -1; + uint selectedBox = -1; while (selectedBox == -1u) { if (redraw) { @@ -967,10 +967,10 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() { mapSurface.transBlitFrom(areas[hoveredBox].highlightedImg, Common::Point(areas[hoveredBox].areaPos.left, areas[hoveredBox].areaPos.top)); } else { - unsigned int middleX = (areas[hoveredBox].areaPos.left + areas[hoveredBox].areaPos.right) / 2; - unsigned int middleY = (areas[hoveredBox].areaPos.top + areas[hoveredBox].areaPos.bottom) / 2; - unsigned int spriteX = middleX - _sprites->getCursor(163).getWidth() / 2; - unsigned int spriteY = middleY - _sprites->getCursor(163).getHeight() / 2; + uint middleX = (areas[hoveredBox].areaPos.left + areas[hoveredBox].areaPos.right) / 2; + uint middleY = (areas[hoveredBox].areaPos.top + areas[hoveredBox].areaPos.bottom) / 2; + uint spriteX = middleX - _sprites->getCursor(163).getWidth() / 2; + uint spriteY = middleY - _sprites->getCursor(163).getHeight() / 2; mapSurface.transBlitFrom(_sprites->getSurface(163), Common::Point(spriteX, spriteY), _sprites->getKeyColor(163)); } @@ -988,7 +988,7 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() { _sprites->getKeyColor(105)); /* // For debugging only - for(unsigned int i = 0; i < ARRAYSIZE(areas); i++) { + for(uint i = 0; i < ARRAYSIZE(areas); i++) { mapSurface.frameRect(areas[i].areaPos, 0); } */ @@ -1005,8 +1005,8 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() { if (!_engine->getCurrentMouseButton()) { // Don't change highlighted icon when clicking bool foundBox = false; - unsigned int oldHoveredBox = hoveredBox; - for (unsigned int i = 0; i < ARRAYSIZE(areas); i++) { + uint oldHoveredBox = hoveredBox; + for (uint i = 0; i < ARRAYSIZE(areas); i++) { if (boxes.hitTest(i, mouse)) { if (i != hoveredBox) { hoveredBox = i; @@ -1064,18 +1064,18 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() { Common::Rect areaPos; bool fillArea; const char *record; - unsigned int messageId; + uint messageId; Common::String message; Common::Point messagePos; Common::Rect areaPos1; Common::Rect areaPos2; Area(const Common::Rect &areaPos_, const char *record_, bool fillArea_ = true, - unsigned int messageId_ = -1) : + uint messageId_ = -1) : areaPos(areaPos_), record(record_), fillArea(fillArea_), messageId(messageId_) { } Area(const Common::Rect &areaPos_, const Common::Rect &areaPos1_, const Common::Rect &areaPos2_, const char *record_, bool fillArea_ = true, - unsigned int messageId_ = -1) : + uint messageId_ = -1) : areaPos(areaPos_), areaPos1(areaPos1_), areaPos2(areaPos2_), record(record_), fillArea(fillArea_), messageId(messageId_) { } } areas[] = { @@ -1117,14 +1117,14 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() { MouseBoxes boxes(ARRAYSIZE(areas) + 1); - for (unsigned int i = 0; i < ARRAYSIZE(areas); i++) { + for (uint i = 0; i < ARRAYSIZE(areas); i++) { if (areas[i].messageId != -1u) { areas[i].message = (*_messages)[areas[i].messageId]; } else { areas[i].message = getRecordTitle(areas[i].record); } - unsigned int lineWidth = _fontManager->getStrWidth(areas[i].message); - unsigned int right; + uint lineWidth = _fontManager->getStrWidth(areas[i].message); + uint right; if (areas[i].areaPos2.right) { right = areas[i].areaPos2.right; } else { @@ -1173,8 +1173,8 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() { g_system->showMouse(true); bool redraw = true; - unsigned int hoveredBox = -1; - unsigned int selectedBox = -1; + uint hoveredBox = -1; + uint selectedBox = -1; while (selectedBox == -1u) { if (redraw) { @@ -1198,10 +1198,10 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() { mapSurface.fillRect(rect, 243); } } else { - unsigned int middleX = (areas[hoveredBox].areaPos.left + areas[hoveredBox].areaPos.right) / 2; - unsigned int middleY = (areas[hoveredBox].areaPos.top + areas[hoveredBox].areaPos.bottom) / 2; - unsigned int spriteX = middleX - _sprites->getCursor(163).getWidth() / 2; - unsigned int spriteY = middleY - _sprites->getCursor(163).getHeight() / 2; + uint middleX = (areas[hoveredBox].areaPos.left + areas[hoveredBox].areaPos.right) / 2; + uint middleY = (areas[hoveredBox].areaPos.top + areas[hoveredBox].areaPos.bottom) / 2; + uint spriteX = middleX - _sprites->getCursor(163).getWidth() / 2; + uint spriteY = middleY - _sprites->getCursor(163).getHeight() / 2; mapSurface.transBlitFrom(_sprites->getSurface(163), Common::Point(spriteX, spriteY), _sprites->getKeyColor(163)); } @@ -1218,7 +1218,7 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() { _sprites->getKeyColor(105)); /* // For debugging only - for(unsigned int i = 0; i < ARRAYSIZE(areas); i++) { + for(uint i = 0; i < ARRAYSIZE(areas); i++) { mapSurface.frameRect(areas[i].areaPos, 0); if (areas[i].areaPos1.right) { mapSurface.frameRect(areas[i].areaPos1, 0); @@ -1241,8 +1241,8 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() { if (!_engine->getCurrentMouseButton()) { // Don't change highlighted icon when clicking bool foundBox = false; - unsigned int oldHoveredBox = hoveredBox; - for (unsigned int i = 0; i < ARRAYSIZE(areas); i++) { + uint oldHoveredBox = hoveredBox; + for (uint i = 0; i < ARRAYSIZE(areas); i++) { if (boxes.hitTest(i, mouse)) { if (i != hoveredBox) { hoveredBox = i; @@ -1313,7 +1313,7 @@ void Versailles_Documentation::inGamePrepareRecord(Graphics::ManagedSurface &sur _currentHasMap = false; if (_currentRecord.hasPrefix("VS")) { - unsigned int id = atoi(_currentRecord.c_str() + 2); + uint id = atoi(_currentRecord.c_str() + 2); if (id >= 16 && id <= 40) { _currentMapLayout = true; } @@ -1334,12 +1334,12 @@ void Versailles_Documentation::inGamePrepareRecord(Graphics::ManagedSurface &sur drawRecordBoxes(surface, false, boxes); } -unsigned int Versailles_Documentation::inGameHandleRecord(Graphics::ManagedSurface &surface, +uint Versailles_Documentation::inGameHandleRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes, Common::String &nextRecord) { _engine->setCursor(181); g_system->showMouse(true); - unsigned int action = -1; + uint action = -1; g_system->copyRectToScreen(surface.getPixels(), surface.pitch, 0, 0, surface.w, surface.h); @@ -1360,8 +1360,8 @@ unsigned int Versailles_Documentation::inGameHandleRecord(Graphics::ManagedSurfa items.push_back(it->title); } Common::Rect iconRect = boxes.getBoxRect(2); - unsigned int selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top), - true, 20, items); + uint selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top), + true, 20, items); if (selectedItem != -1u) { nextRecord = _currentLinks[selectedItem].record; action = 2; @@ -1464,7 +1464,7 @@ void Versailles_Documentation::drawRecordData(Graphics::ManagedSurface &surface, Common::String text = getRecordData(_currentRecord, title, subtitle, caption, hyperlinks);*/ - unsigned int lineHeight = 21; + uint lineHeight = 21; _fontManager->setCurrentFont(4); _fontManager->setTransparentBackground(true); _fontManager->setSpaceWidth(1); @@ -1539,22 +1539,22 @@ void Versailles_Documentation::drawRecordData(Graphics::ManagedSurface &surface, void Versailles_Documentation::setupRecordBoxes(bool inDocArea, MouseBoxes &boxes) { // Layout of bar in doc area is Quit | Back | | Previous | Category | Next | | Trace | Hyperlinks | All records // Layout of bar in game is ==> Trace | Hyperlinks | Quit - unsigned int allRecordsX = 640 - _sprites->getCursor(19).getWidth(); - unsigned int hyperlinksX = allRecordsX - _sprites->getCursor(242).getWidth() - 10; - unsigned int traceX = hyperlinksX - _sprites->getCursor(105).getWidth() - 10; + uint allRecordsX = 640 - _sprites->getCursor(19).getWidth(); + uint hyperlinksX = allRecordsX - _sprites->getCursor(242).getWidth() - 10; + uint traceX = hyperlinksX - _sprites->getCursor(105).getWidth() - 10; if (_visitTrace.size()) { boxes.setupBox(0, traceX, 480 - _sprites->getCursor(105).getHeight() - 3, traceX + _sprites->getCursor(105).getWidth(), 480); } if (inDocArea) { - unsigned int backX = _sprites->getCursor(225).getWidth() + 10; //Right to quit button + uint backX = _sprites->getCursor(225).getWidth() + 10; //Right to quit button _fontManager->setCurrentFont(0); _fontManager->setTransparentBackground(true); _fontManager->setSpaceWidth(0); _fontManager->setCharSpacing(1); - unsigned int categoryHalfWidth = _fontManager->getStrWidth(_categoryTitle) / 2; + uint categoryHalfWidth = _fontManager->getStrWidth(_categoryTitle) / 2; unsigned nextX = 320 + categoryHalfWidth + 20; unsigned prevX = 320 - categoryHalfWidth - 20 - _sprites->getCursor(76).getWidth(); @@ -1574,13 +1574,13 @@ void Versailles_Documentation::setupRecordBoxes(bool inDocArea, MouseBoxes &boxe // Map boxes.setupBox(8, 403, 305, 622, 428); if (_currentInTimeline) { - for (unsigned int box_id = 0; box_id < ARRAYSIZE(kTimelineEntries); box_id++) { + for (uint box_id = 0; box_id < ARRAYSIZE(kTimelineEntries); box_id++) { boxes.setupBox(10 + box_id, kTimelineEntries[box_id].x, kTimelineEntries[box_id].y, kTimelineEntries[box_id].x + 30, kTimelineEntries[box_id].y + 15, kTimelineEntries[box_id].year); } } } else { - unsigned int quitInGameX = 640 - _sprites->getCursor(105).getWidth(); + uint quitInGameX = 640 - _sprites->getCursor(105).getWidth(); boxes.setupBox(1, quitInGameX, 480 - _sprites->getCursor(105).getHeight(), quitInGameX + _sprites->getCursor(105).getWidth(), 480); } @@ -1629,28 +1629,28 @@ void Versailles_Documentation::drawRecordBoxes(Graphics::ManagedSurface &surface } } -unsigned int Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSurface +uint Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSurface &originalSurface, - const Common::Point &anchor, bool rightAligned, unsigned int itemHeight, + const Common::Point &anchor, bool rightAligned, uint itemHeight, const Common::StringArray &items) { - unsigned int maxTextWidth = 0; + uint maxTextWidth = 0; _fontManager->setCurrentFont(4); _fontManager->setTransparentBackground(true); _fontManager->setCharSpacing(1); for (Common::StringArray::const_iterator it = items.begin(); it != items.end(); it++) { - unsigned int width = _fontManager->getStrWidth(*it); + uint width = _fontManager->getStrWidth(*it); if (width > maxTextWidth) { maxTextWidth = width; } } - unsigned int width = maxTextWidth + 2 * kPopupMenuMargin; - unsigned int height = itemHeight * items.size() + 2 * kPopupMenuMargin; + uint width = maxTextWidth + 2 * kPopupMenuMargin; + uint height = itemHeight * items.size() + 2 * kPopupMenuMargin; - unsigned int hiddenItems = 0; + uint hiddenItems = 0; int top = anchor.y - height; while (top < 0) { hiddenItems++; @@ -1669,7 +1669,7 @@ unsigned int Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSu surface.copyFrom(originalSurface); MouseBoxes boxes(shownItems); - for (unsigned int i = 0; i < shownItems; i++) { + for (uint i = 0; i < shownItems; i++) { boxes.setupBox(i, popupRect.left + kPopupMenuMargin, popupRect.top + kPopupMenuMargin + i * itemHeight, popupRect.right - kPopupMenuMargin, @@ -1680,12 +1680,12 @@ unsigned int Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSu bool fullRedraw = true; bool redraw = true; - unsigned int hoveredBox = -1; - unsigned int action = -1; - unsigned int lastShownItem = items.size() - 1; - unsigned int firstShownItem = lastShownItem - shownItems + 1; + uint hoveredBox = -1; + uint action = -1; + uint lastShownItem = items.size() - 1; + uint firstShownItem = lastShownItem - shownItems + 1; - unsigned int slowScrollNextEvent = g_system->getMillis() + 250; + uint slowScrollNextEvent = g_system->getMillis() + 250; Common::Point mouse; @@ -1695,7 +1695,7 @@ unsigned int Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSu surface.fillRect(popupRect, 247); fullRedraw = false; } - for (unsigned int i = 0; i < shownItems; i++) { + for (uint i = 0; i < shownItems; i++) { if (i == 0 && firstShownItem != 0) { // There are items before the first one: display an arrow surface.transBlitFrom(_sprites->getSurface(162), @@ -1727,8 +1727,8 @@ unsigned int Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSu } mouse = _engine->getMousePos(); - unsigned int newHovered = -1; - for (unsigned int i = 0; i < shownItems; i++) { + uint newHovered = -1; + for (uint i = 0; i < shownItems; i++) { if (boxes.hitTest(i, mouse)) { newHovered = i; break; @@ -1808,7 +1808,7 @@ char *Versailles_Documentation::getDocPartAddress(char *start, char *end, const } char *foundPos = nullptr; const char *pattern; - unsigned int patternLen; + uint patternLen; for (const char **patternP = patterns; *patternP && !foundPos; patternP++) { pattern = *patternP; patternLen = strlen(pattern); @@ -1886,7 +1886,7 @@ const char *Versailles_Documentation::getRecordSubtitle(char *start, char *end) return nullptr; } - unsigned int ln = strlen(ret); + uint ln = strlen(ret); char *p = ret + ln + 1; // Got to end of line and check next line for (; p < end && *p && *p != '\r' && *p != '=' ; p++) { } if (*p == '=') { @@ -1907,7 +1907,7 @@ void Versailles_Documentation::getRecordHyperlinks(char *start, char *end, const char *const hyperlinksPatterns[] = { "SAVOIR-PLUS 1=", "SAVOIR-PLUS 2=", "SAVOIR-PLUS 3=" }; hyperlinks.clear(); - for (unsigned int hyperlinkId = 0; hyperlinkId < ARRAYSIZE(hyperlinksPatterns); hyperlinkId++) { + for (uint hyperlinkId = 0; hyperlinkId < ARRAYSIZE(hyperlinksPatterns); hyperlinkId++) { const char *patterns[] = { hyperlinksPatterns[hyperlinkId], nullptr }; const char *ret = getDocPartAddress(start, end, patterns); if (ret) { diff --git a/engines/cryomni3d/versailles/documentation.h b/engines/cryomni3d/versailles/documentation.h index 0a581d9822..a1559f8880 100644 --- a/engines/cryomni3d/versailles/documentation.h +++ b/engines/cryomni3d/versailles/documentation.h @@ -53,16 +53,16 @@ private: Common::String docAreaHandleTimeline(); Common::String docAreaHandleGeneralMap(); Common::String docAreaHandleCastleMap(); - unsigned int docAreaHandleRecords(const Common::String &record); + uint docAreaHandleRecords(const Common::String &record); void docAreaPrepareNavigation(); void docAreaPrepareRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes); - unsigned int docAreaHandleRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes, - Common::String &nextRecord); + uint docAreaHandleRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes, + Common::String &nextRecord); void inGamePrepareRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes); - unsigned int inGameHandleRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes, - Common::String &nextRecord); + uint inGameHandleRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes, + Common::String &nextRecord); void setupRecordBoxes(bool inDocArea, MouseBoxes &boxes); void setupTimelineBoxes(MouseBoxes &boxes); @@ -71,14 +71,14 @@ private: const Common::String &subtitle, const Common::String &caption); void drawRecordBoxes(Graphics::ManagedSurface &surface, bool inDocArea, MouseBoxes &boxes); - unsigned int handlePopupMenu(const Graphics::ManagedSurface &surface, - const Common::Point &anchor, bool rightAligned, unsigned int itemHeight, - const Common::StringArray &items); + uint handlePopupMenu(const Graphics::ManagedSurface &surface, + const Common::Point &anchor, bool rightAligned, uint itemHeight, + const Common::StringArray &items); struct RecordInfo { - unsigned int id; - unsigned int position; - unsigned int size; + uint id; + uint position; + uint size; }; struct LinkInfo { @@ -88,8 +88,8 @@ private: struct TimelineEntry { char year[8]; - unsigned int x; - unsigned int y; + uint x; + uint y; }; static const TimelineEntry kTimelineEntries[]; @@ -112,7 +112,7 @@ private: static const char *kAllDocsFile; static const char *kLinksDocsFile; - static const unsigned int kPopupMenuMargin = 5; + static const uint kPopupMenuMargin = 5; CryOmni3DEngine *_engine; FontManager *_fontManager; @@ -122,7 +122,7 @@ private: Common::StringArray _recordsOrdered; Common::HashMap<Common::String, RecordInfo> _records; char *_linksData; - unsigned int _linksSize; + uint _linksSize; Common::Array<LinkInfo> _allLinks; diff --git a/engines/cryomni3d/versailles/engine.cpp b/engines/cryomni3d/versailles/engine.cpp index 8401a78618..2ab47c0a1b 100644 --- a/engines/cryomni3d/versailles/engine.cpp +++ b/engines/cryomni3d/versailles/engine.cpp @@ -116,7 +116,7 @@ Common::Error CryOmni3DEngine_Versailles::run() { _transparentNewStop = 254; // Inventory has a size of 50 - _inventory.init(50, new Common::Functor1Mem<unsigned int, void, Toolbar>(&_toolbar, + _inventory.init(50, new Common::Functor1Mem<uint, void, Toolbar>(&_toolbar, &Toolbar::inventoryChanged)); // Init toolbar after we have setup sprites and fonts @@ -152,7 +152,7 @@ Common::Error CryOmni3DEngine_Versailles::run() { bool stopGame = false; while (!stopGame) { bool exitLoop = false; - unsigned int nextStep = 0; + uint nextStep = 0; #if defined(DEBUG_FAST_START) && DEBUG_FAST_START>=2 nextStep = 27; // Called in options @@ -300,7 +300,7 @@ void CryOmni3DEngine_Versailles::setupSprites() { } _sprites.loadSprites(file); - for (unsigned int i = 0; i < _sprites.getSpritesCount(); i++) { + for (uint i = 0; i < _sprites.getSpritesCount(); i++) { const Graphics::Cursor &cursor = _sprites.getCursor(i); if (cursor.getWidth() != 32 || cursor.getHeight() != 32) { _sprites.setSpriteHotspot(i, 8, 8); @@ -367,7 +367,7 @@ void CryOmni3DEngine_Versailles::setMainPaletteColor(byte color, byte red, byte } struct transparentScore { - unsigned int score; + uint score; byte redScaled; byte greenScaled; @@ -380,8 +380,8 @@ static transparentScore transparentCalculateScore(byte red, byte green, byte blu transparentScore ret; ret.score = 10 * (blue + 3 * (red + 2 * green)) / 30; if (ret.score) { - ret.redScaled = ((unsigned int)red) * 256 / ret.score; - ret.greenScaled = ((unsigned int)green) * 256 / ret.score; + ret.redScaled = ((uint)red) * 256 / ret.score; + ret.greenScaled = ((uint)green) * 256 / ret.score; } else { ret.redScaled = 0; ret.greenScaled = 0; @@ -393,26 +393,26 @@ void CryOmni3DEngine_Versailles::calculateTransparentMapping() { // Calculate colors proximity array transparentScore *proximities = new transparentScore[256]; - for (unsigned int i = _transparentSrcStart; i < _transparentSrcStop; i++) { + for (uint i = _transparentSrcStart; i < _transparentSrcStop; i++) { proximities[i] = transparentCalculateScore(_mainPalette[3 * i + 0], _mainPalette[3 * i + 1], _mainPalette[3 * i + 2]); } - unsigned int newColorsNextId = _transparentNewStart; - unsigned int newColorsCount = 0; - for (unsigned int i = _transparentDstStart; i < _transparentDstStop; i++) { - byte transparentRed = ((unsigned int)_mainPalette[3 * i + 0]) * 60 / 128; - byte transparentGreen = ((unsigned int)_mainPalette[3 * i + 1]) * 50 / 128; - byte transparentBlue = ((unsigned int)_mainPalette[3 * i + 2]) * 35 / 128; + uint newColorsNextId = _transparentNewStart; + uint newColorsCount = 0; + for (uint i = _transparentDstStart; i < _transparentDstStop; i++) { + byte transparentRed = ((uint)_mainPalette[3 * i + 0]) * 60 / 128; + byte transparentGreen = ((uint)_mainPalette[3 * i + 1]) * 50 / 128; + byte transparentBlue = ((uint)_mainPalette[3 * i + 2]) * 35 / 128; // Find nearest color transparentScore newColorScore = transparentCalculateScore(transparentRed, transparentGreen, transparentBlue); - unsigned int distanceMin = -1u; - unsigned int nearestId = -1u; - for (unsigned int j = _transparentSrcStart; j < _transparentSrcStop; j++) { + uint distanceMin = -1u; + uint nearestId = -1u; + for (uint j = _transparentSrcStart; j < _transparentSrcStop; j++) { if (j != i && newColorScore.dScore(proximities[j]) < 15) { - unsigned int distance = newColorScore.dRed(proximities[j]) + newColorScore.dGreen(proximities[j]); + uint distance = newColorScore.dRed(proximities[j]) + newColorScore.dGreen(proximities[j]); if (distance < distanceMin) { distanceMin = distance; nearestId = j; @@ -450,8 +450,8 @@ void CryOmni3DEngine_Versailles::makeTranslucent(Graphics::Surface &dst, const byte *srcP = (const byte *) src.getPixels(); byte *dstP = (byte *) dst.getPixels(); - for (unsigned int y = 0; y < dst.h; y++) { - for (unsigned int x = 0; x < dst.w; x++) { + for (uint y = 0; y < dst.h; y++) { + for (uint x = 0; x < dst.w; x++) { dstP[x] = _transparentPaletteMap[srcP[x]]; } dstP += dst.pitch; @@ -608,7 +608,7 @@ void CryOmni3DEngine_Versailles::changeLevel(int level) { if (_currentLevel == 1) { _dialogsMan.reinitVariables(); - for (Common::Array<unsigned int>::iterator it = _gameVariables.begin(); it != _gameVariables.end(); + for (Common::Array<uint>::iterator it = _gameVariables.begin(); it != _gameVariables.end(); it++) { *it = 0; } @@ -667,7 +667,7 @@ void CryOmni3DEngine_Versailles::initNewLevel(int level) { // Create a first SearchSet in which we will add all others to easily cleanup the mess Common::SearchSet *visitFiles = new Common::SearchSet(); - for (unsigned int lvl = 1; lvl <= 7; lvl++) { + for (uint lvl = 1; lvl <= 7; lvl++) { Common::SearchSet *visitFilesAnimacti = new Common::SearchSet(); Common::SearchSet *visitFilesWarp = new Common::SearchSet(); Common::SearchSet *visitFilesImgFix = new Common::SearchSet(); @@ -719,7 +719,7 @@ void CryOmni3DEngine_Versailles::setupLevelWarps(int level) { _omni3dMan.setBeta(initialState.beta); } -void CryOmni3DEngine_Versailles::setGameTime(unsigned int newTime, unsigned int level) { +void CryOmni3DEngine_Versailles::setGameTime(uint newTime, uint level) { if (_currentLevel != level) { error("Level %u != current level %u", level, _currentLevel); } @@ -804,7 +804,7 @@ void CryOmni3DEngine_Versailles::gameStep() { if (_forcePaletteUpdate) { redrawWarp(); } - unsigned int actionId = handleWarp(); + uint actionId = handleWarp(); debug("handleWarp returned %u", actionId); // Don't handle keyboard for levels 4 and 5, it was a debug leftover @@ -888,7 +888,7 @@ void CryOmni3DEngine_Versailles::doGameOver() { void CryOmni3DEngine_Versailles::doPlaceChange() { const Place *nextPlace = _wam.findPlaceById(_nextPlaceId); - unsigned int state = _placeStates[_nextPlaceId].state; + uint state = _placeStates[_nextPlaceId].state; if (state == -1u) { state = 0; } @@ -942,9 +942,9 @@ void CryOmni3DEngine_Versailles::doPlaceChange() { } } -void CryOmni3DEngine_Versailles::setPlaceState(unsigned int placeId, unsigned int newState) { - unsigned int numStates = _wam.findPlaceById(placeId)->getNumStates(); - unsigned int oldState = _placeStates[placeId].state; +void CryOmni3DEngine_Versailles::setPlaceState(uint placeId, uint newState) { + uint numStates = _wam.findPlaceById(placeId)->getNumStates(); + uint oldState = _placeStates[placeId].state; if (newState > numStates) { warning("CryOmni3DEngine_Versailles::setPlaceState: newState '%d' > numStates '%d'", @@ -959,9 +959,9 @@ void CryOmni3DEngine_Versailles::setPlaceState(unsigned int placeId, unsigned in } } -void CryOmni3DEngine_Versailles::executeTransition(unsigned int nextPlaceId) { +void CryOmni3DEngine_Versailles::executeTransition(uint nextPlaceId) { const Transition *transition; - unsigned int animationId = determineTransitionAnimation(_currentPlaceId, nextPlaceId, &transition); + uint animationId = determineTransitionAnimation(_currentPlaceId, nextPlaceId, &transition); _nextPlaceId = nextPlaceId; @@ -992,7 +992,7 @@ void CryOmni3DEngine_Versailles::executeTransition(unsigned int nextPlaceId) { _omni3dMan.setAlpha(transition->dstAlpha); _omni3dMan.setBeta(-transition->dstBeta); - unsigned int nextState = _placeStates[nextPlaceId].state; + uint nextState = _placeStates[nextPlaceId].state; if (nextState == -1u) { nextState = 0; } @@ -1001,7 +1001,7 @@ void CryOmni3DEngine_Versailles::executeTransition(unsigned int nextPlaceId) { warpFile.toUppercase(); if (warpFile.hasPrefix("NOT_STOP")) { debug("Got not stop"); - unsigned int transitionNum; + uint transitionNum; // Determine transition to take if (nextPlace->getNumTransitions() == 1) { // Only one @@ -1012,7 +1012,7 @@ void CryOmni3DEngine_Versailles::executeTransition(unsigned int nextPlaceId) { } else { transitionNum = 0; } - unsigned int nextNextPlaceId = nextPlace->transitions[transitionNum].dstId; + uint nextNextPlaceId = nextPlace->transitions[transitionNum].dstId; animationId = determineTransitionAnimation(nextPlaceId, nextNextPlaceId, &transition); animation = animationId == -1u ? "" : transition->animations[animationId]; @@ -1038,7 +1038,7 @@ void CryOmni3DEngine_Versailles::executeTransition(unsigned int nextPlaceId) { } } -void CryOmni3DEngine_Versailles::fakeTransition(unsigned int dstPlaceId) { +void CryOmni3DEngine_Versailles::fakeTransition(uint dstPlaceId) { // No need of animation, caller will take care // We just setup the camera in good place for the caller const Place *srcPlace = _wam.findPlaceById(_currentPlaceId); @@ -1050,8 +1050,8 @@ void CryOmni3DEngine_Versailles::fakeTransition(unsigned int dstPlaceId) { _omni3dMan.setBeta(-transition->dstBeta); } -unsigned int CryOmni3DEngine_Versailles::determineTransitionAnimation(unsigned int srcPlaceId, - unsigned int dstPlaceId, const Transition **transition_) { +uint CryOmni3DEngine_Versailles::determineTransitionAnimation(uint srcPlaceId, + uint dstPlaceId, const Transition **transition_) { const Place *srcPlace = _wam.findPlaceById(srcPlaceId); const Place *dstPlace = _wam.findPlaceById(dstPlaceId); const Transition *transition = srcPlace->findTransition(dstPlaceId); @@ -1060,12 +1060,12 @@ unsigned int CryOmni3DEngine_Versailles::determineTransitionAnimation(unsigned i *transition_ = transition; } - unsigned int srcNumStates = srcPlace->getNumStates(); - unsigned int dstNumStates = dstPlace->getNumStates(); - unsigned int animsNum = transition->getNumAnimations(); + uint srcNumStates = srcPlace->getNumStates(); + uint dstNumStates = dstPlace->getNumStates(); + uint animsNum = transition->getNumAnimations(); - unsigned int srcState = _placeStates[srcPlaceId].state; - unsigned int dstState = _placeStates[dstPlaceId].state; + uint srcState = _placeStates[srcPlaceId].state; + uint dstState = _placeStates[dstPlaceId].state; if (srcState >= srcNumStates) { error("Invalid src state"); @@ -1108,11 +1108,11 @@ int CryOmni3DEngine_Versailles::handleWarp() { bool leftButtonPressed = false; bool firstDraw = true; bool moving = true; - unsigned int actionId; + uint actionId; g_system->showMouse(true); while (!leftButtonPressed && !exit) { int xDelta = 0, yDelta = 0; - unsigned int movingCursor = -1; + uint movingCursor = -1; pollEvents(); Common::Point mouse = getMousePos(); @@ -1195,8 +1195,8 @@ int CryOmni3DEngine_Versailles::handleWarp() { return actionId; } -bool CryOmni3DEngine_Versailles::handleWarpMouse(unsigned int *actionId, - unsigned int movingCursor) { +bool CryOmni3DEngine_Versailles::handleWarpMouse(uint *actionId, + uint movingCursor) { fixActionId(actionId); if (getCurrentMouseButton() == 2 || @@ -1265,10 +1265,10 @@ bool CryOmni3DEngine_Versailles::handleWarpMouse(unsigned int *actionId, return false; } -void CryOmni3DEngine_Versailles::fixActionId(unsigned int *actionId) const { +void CryOmni3DEngine_Versailles::fixActionId(uint *actionId) const { PlaceStateActionKey mask = PlaceStateActionKey(_currentPlaceId, _placeStates[_currentPlaceId].state, *actionId); - Common::HashMap<PlaceStateActionKey, unsigned int>::const_iterator it = _actionMasks.find(mask); + Common::HashMap<PlaceStateActionKey, uint>::const_iterator it = _actionMasks.find(mask); if (it != _actionMasks.end()) { *actionId = it->_value; return; @@ -1382,9 +1382,9 @@ void CryOmni3DEngine_Versailles::animateCursor(const Object *obj) { bool cursorWasVisible = g_system->showMouse(true); - for (unsigned int i = 4; i > 0; i--) { + for (uint i = 4; i > 0; i--) { // Wait 100ms - for (unsigned int j = 10; j > 0; j--) { + for (uint j = 10; j > 0; j--) { // pollEvents sleeps 10ms pollEvents(); g_system->updateScreen(); @@ -1392,7 +1392,7 @@ void CryOmni3DEngine_Versailles::animateCursor(const Object *obj) { setCursor(obj->idSA()); g_system->updateScreen(); // Wait 100ms - for (unsigned int j = 10; j > 0; j--) { + for (uint j = 10; j > 0; j--) { // pollEvents sleeps 10ms pollEvents(); g_system->updateScreen(); @@ -1471,7 +1471,7 @@ void CryOmni3DEngine_Versailles::displayObject(const Common::String &imgName, setMousePos(Common::Point(320, 240)); // Center of screen } -void CryOmni3DEngine_Versailles::executeSeeAction(unsigned int actionId) { +void CryOmni3DEngine_Versailles::executeSeeAction(uint actionId) { if (_currentLevel == 7 && _currentPlaceId != 20) { // Don't display fixed images unless it's the bomb // Not enough time for paintings @@ -1487,7 +1487,7 @@ void CryOmni3DEngine_Versailles::executeSeeAction(unsigned int actionId) { } } -void CryOmni3DEngine_Versailles::executeSpeakAction(unsigned int actionId) { +void CryOmni3DEngine_Versailles::executeSpeakAction(uint actionId) { PlaceActionKey key(_currentPlaceId, actionId); Common::HashMap<PlaceActionKey, Common::String>::iterator it = _whoSpeaksWhere.find(key); g_system->showMouse(true); @@ -1502,14 +1502,14 @@ void CryOmni3DEngine_Versailles::executeSpeakAction(unsigned int actionId) { } } -void CryOmni3DEngine_Versailles::executeDocAction(unsigned int actionId) { +void CryOmni3DEngine_Versailles::executeDocAction(uint actionId) { if (_currentLevel == 7) { // Not enough time for doc displayMessageBoxWarp(13); return; } - Common::HashMap<unsigned int, const char *>::iterator it = _docPeopleRecord.find(actionId); + Common::HashMap<uint, const char *>::iterator it = _docPeopleRecord.find(actionId); if (it == _docPeopleRecord.end() || !it->_value) { warning("Missing documentation record for action %u", actionId); return; @@ -1537,7 +1537,7 @@ void CryOmni3DEngine_Versailles::handleFixedImg(const FixedImgCallback &callback } } -unsigned int CryOmni3DEngine_Versailles::getFakeTransition(unsigned int actionId) const { +uint CryOmni3DEngine_Versailles::getFakeTransition(uint actionId) const { for (const FakeTransitionActionPlace *ft = kFakeTransitions; ft->actionId != 0; ft++) { if (ft->actionId == actionId) { return ft->placeId; @@ -1571,11 +1571,11 @@ void CryOmni3DEngine_Versailles::playInGameVideo(const Common::String &filename, } void CryOmni3DEngine_Versailles::loadBMPs(const char *pattern, Graphics::Surface *bmps, - unsigned int count) { + uint count) { Image::BitmapDecoder bmpDecoder; Common::File file; - for (unsigned int i = 0; i < count; i++) { + for (uint i = 0; i < count; i++) { Common::String bmp = Common::String::format(pattern, i); if (!file.open(bmp)) { diff --git a/engines/cryomni3d/versailles/engine.h b/engines/cryomni3d/versailles/engine.h index fc94787d9b..841145174a 100644 --- a/engines/cryomni3d/versailles/engine.h +++ b/engines/cryomni3d/versailles/engine.h @@ -51,10 +51,10 @@ class ZonFixedImage; namespace CryOmni3D { namespace Versailles { struct PlaceStateActionKey { - unsigned int placeId; - unsigned int placeState; - unsigned int actionId; - PlaceStateActionKey(unsigned int placeId_, unsigned int placeState_, unsigned int actionId_) : + uint placeId; + uint placeState; + uint actionId; + PlaceStateActionKey(uint placeId_, uint placeState_, uint actionId_) : placeId(placeId_), placeState(placeState_), actionId(actionId_) {} bool operator==(const PlaceStateActionKey &other) const { @@ -63,9 +63,9 @@ struct PlaceStateActionKey { }; struct PlaceActionKey { - unsigned int placeId; - unsigned int actionId; - PlaceActionKey(unsigned int placeId_, unsigned int actionId_) : + uint placeId; + uint actionId; + PlaceActionKey(uint placeId_, uint actionId_) : placeId(placeId_), actionId(actionId_) {} bool operator==(const PlaceActionKey &other) const { @@ -170,7 +170,7 @@ struct SoundIds { struct PlaceState { typedef void (CryOmni3DEngine_Versailles::*InitFunc)(); - typedef bool (CryOmni3DEngine_Versailles::*FilterEventFunc)(unsigned int *event); + typedef bool (CryOmni3DEngine_Versailles::*FilterEventFunc)(uint *event); PlaceState() : initPlace(nullptr), filterEvent(nullptr), docImage(nullptr), state(0) {} PlaceState(InitFunc initPlace_, FilterEventFunc filterEvent_, const char *docImage_) : @@ -179,18 +179,18 @@ struct PlaceState { InitFunc initPlace; FilterEventFunc filterEvent; const char *docImage; - unsigned int state; + uint state; }; struct LevelInitialState { - unsigned int placeId; + uint placeId; double alpha; double beta; }; struct FakeTransitionActionPlace { - unsigned int actionId; - unsigned int placeId; + uint actionId; + uint placeId; }; typedef void (CryOmni3DEngine_Versailles::*FixedImgCallback)(ZonFixedImage *); @@ -198,14 +198,14 @@ typedef void (CryOmni3DEngine_Versailles::*FixedImgCallback)(ZonFixedImage *); struct MsgBoxParameters { int font; byte foreColor; - unsigned int lineHeight; - unsigned int spaceWidth; - unsigned int charSpacing; - unsigned int initialWidth; - unsigned int incrementWidth; - unsigned int initialHeight; - unsigned int incrementHeight; - unsigned int timeoutChar; + uint lineHeight; + uint spaceWidth; + uint charSpacing; + uint initialWidth; + uint incrementWidth; + uint initialHeight; + uint incrementHeight; + uint timeoutChar; }; class CryOmni3DEngine_Versailles : public CryOmni3DEngine { @@ -230,7 +230,7 @@ public: virtual bool displayToolbar(const Graphics::Surface *original) override { return _toolbar.displayToolbar(original); }; virtual bool hasPlaceDocumentation() override; virtual bool displayPlaceDocumentation() override; - virtual unsigned int displayOptions() override; + virtual uint displayOptions() override; virtual bool shouldAbort() override { return g_engine->shouldQuit() || _abortCommand != AbortNoAbort; } private: @@ -256,65 +256,65 @@ private: void initDocPeopleRecord(); void setupLevelActionsMask(); - unsigned int currentGameTime() const { return _gameVariables[GameVariables::kCurrentTime]; } - void setGameTime(unsigned int newTime, unsigned int level); + uint currentGameTime() const { return _gameVariables[GameVariables::kCurrentTime]; } + void setGameTime(uint newTime, uint level); void updateGameTimeDialVariables(); void gameStep(); void doGameOver(); - void setPlaceState(unsigned int placeId, unsigned int newState); + void setPlaceState(uint placeId, uint newState); void doPlaceChange(); - void executeTransition(unsigned int nextPlaceId); - void fakeTransition(unsigned int dstPlaceId); - unsigned int determineTransitionAnimation(unsigned int srcId, unsigned int dstId, - const Transition **transition); + void executeTransition(uint nextPlaceId); + void fakeTransition(uint dstPlaceId); + uint determineTransitionAnimation(uint srcId, uint dstId, + const Transition **transition); - unsigned int getFakeTransition(unsigned int actionId) const; - void fixActionId(unsigned int *actionId) const; + uint getFakeTransition(uint actionId) const; + void fixActionId(uint *actionId) const; int handleWarp(); - bool handleWarpMouse(unsigned int *actionId, unsigned int movingCuror); + bool handleWarpMouse(uint *actionId, uint movingCuror); void animateWarpTransition(const Transition *transition); void redrawWarp(); void handleFixedImg(const FixedImgCallback &callback); - void executeSeeAction(unsigned int actionId); + void executeSeeAction(uint actionId); - void executeSpeakAction(unsigned int actionId); + void executeSpeakAction(uint actionId); void setupDialogShows(); bool preprocessDialog(const Common::String &sequence); void postprocessDialog(const Common::String &sequence); - void executeDocAction(unsigned int actionId); + void executeDocAction(uint actionId); void drawMenuTitle(Graphics::ManagedSurface *surface, byte color); - unsigned int displayFilePicker(const Graphics::Surface *bgFrame, bool saveMode, - Common::String &saveName); - unsigned int displayYesNoBox(Graphics::ManagedSurface &surface, const Common::Rect &position, - unsigned int msg_id); + uint displayFilePicker(const Graphics::Surface *bgFrame, bool saveMode, + Common::String &saveName); + uint displayYesNoBox(Graphics::ManagedSurface &surface, const Common::Rect &position, + uint msg_id); void displayMessageBox(const MsgBoxParameters ¶ms, const Graphics::Surface *surface, - unsigned int msg_id, const Common::Point &position, + uint msg_id, const Common::Point &position, const Common::Functor0<void> &callback) { displayMessageBox(params, surface, _messages[msg_id], position, callback); } void displayMessageBox(const MsgBoxParameters ¶ms, const Graphics::Surface *surface, const Common::String &msg, const Common::Point &position, const Common::Functor0<void> &callback); void displayMessageBoxWarp(const Common::String &message); - void displayMessageBoxWarp(unsigned int msg_id) { displayMessageBoxWarp(_messages[msg_id]); } + void displayMessageBoxWarp(uint msg_id) { displayMessageBoxWarp(_messages[msg_id]); } void displayCredits(); void warpMsgBoxCB(); bool canVisit() const; - Common::String getSaveFileName(bool visit, unsigned int saveNum) const; + Common::String getSaveFileName(bool visit, uint saveNum) const; void getSavesList(bool visit, Common::Array<Common::String> &saveNames); - void saveGame(bool visit, unsigned int saveNum, const Common::String &saveName); - bool loadGame(bool visit, unsigned int saveNum); + void saveGame(bool visit, uint saveNum, const Common::String &saveName); + bool loadGame(bool visit, uint saveNum); void animateCursor(const Object *object); void collectObject(Object *object, const ZonFixedImage *fimg = nullptr, bool showObject = true); - void collectObject(unsigned int nameID, const ZonFixedImage *fimg = nullptr, + void collectObject(uint nameID, const ZonFixedImage *fimg = nullptr, bool showObject = true) { collectObject(_objects.findObjectByNameID(nameID), fimg, showObject); } typedef void (CryOmni3DEngine_Versailles::*DisplayObjectHook)(Graphics::ManagedSurface &surface); void displayObject(const Common::String &imgName, DisplayObjectHook hook = nullptr); @@ -326,10 +326,10 @@ private: void playInGameVideo(const Common::String &filename, bool restoreCursorPalette = true); - void loadBMPs(const char *pattern, Graphics::Surface *bmps, unsigned int count); + void loadBMPs(const char *pattern, Graphics::Surface *bmps, uint count); - unsigned int getMusicId(unsigned int level, unsigned int placeId) const; - bool musicWouldChange(unsigned int level, unsigned int placeId) const; + uint getMusicId(uint level, uint placeId) const; + bool musicWouldChange(uint level, uint placeId) const; void musicUpdate(); void musicPause(); void musicResume(); @@ -337,11 +337,11 @@ private: void musicSetQuiet(bool quiet); Common::StringArray _messages; - static const unsigned int kSpritesMapTable[]; - static const unsigned int kSpritesMapTableSize; + static const uint kSpritesMapTable[]; + static const uint kSpritesMapTableSize; static const LevelInitialState kLevelInitialStates[]; static const FakeTransitionActionPlace kFakeTransitions[]; - Common::HashMap<unsigned int, FixedImgCallback> _imgScripts; + Common::HashMap<uint, FixedImgCallback> _imgScripts; Common::Array<Common::String> _paintingsTitles; Toolbar _toolbar; @@ -353,35 +353,35 @@ private: bool _forceRedrawWarp; byte *_transparentPaletteMap; - unsigned int _transparentSrcStart; - unsigned int _transparentSrcStop; - unsigned int _transparentDstStart; - unsigned int _transparentDstStop; - unsigned int _transparentNewStart; - unsigned int _transparentNewStop; + uint _transparentSrcStart; + uint _transparentSrcStop; + uint _transparentDstStart; + uint _transparentDstStop; + uint _transparentNewStart; + uint _transparentNewStop; bool _isPlaying; bool _isVisiting; AbortCommand _abortCommand; - unsigned int _loadedSave; + uint _loadedSave; int _omni3dSpeed; - unsigned int _currentLevel; + uint _currentLevel; Versailles_DialogsManager _dialogsMan; Omni3DManager _omni3dMan; ZonFixedImage *_fixedImage; - Common::Array<unsigned int> _gameVariables; + Common::Array<uint> _gameVariables; Common::Array<PlaceState> _placeStates; - Common::HashMap<PlaceStateActionKey, unsigned int> _actionMasks; + Common::HashMap<PlaceStateActionKey, uint> _actionMasks; Common::HashMap<PlaceActionKey, Common::String> _whoSpeaksWhere; - Common::HashMap<unsigned int, const char *> _docPeopleRecord; + Common::HashMap<uint, const char *> _docPeopleRecord; bool _transitionAnimateWarp; - unsigned int _nextPlaceId; + uint _nextPlaceId; WAMParser _wam; - unsigned int _currentPlaceId; + uint _currentPlaceId; const Place *_currentPlace; const Image::ImageDecoder *_currentWarpImage; @@ -401,17 +401,17 @@ private: void syncCountdown(); inline bool countDown() { if (_countingDown) { return doCountDown(); } else { return false; } } inline void drawCountdown(Graphics::ManagedSurface *surface = nullptr) { if (_countingDown) { doDrawCountdown(surface); } } - void drawCountdownVideo(unsigned int frameNum) { drawCountdown(); } + void drawCountdownVideo(uint frameNum) { drawCountdown(); } bool _countingDown; - unsigned int _countdownNextEvent; + uint _countdownNextEvent; char _countdownValue[6]; Graphics::ManagedSurface _countdownSurface; bool doCountDown(); void doDrawCountdown(Graphics::ManagedSurface *surface); // Objects - template<unsigned int ID> + template<uint ID> void genericDisplayObject(); void obj_105(); void obj_106(); @@ -425,9 +425,9 @@ private: void obj_142hk(Graphics::ManagedSurface &surface); // Fixed image - template<unsigned int ID> + template<uint ID> void genericDumbImage(ZonFixedImage *fimg); - template<unsigned int ID> + template<uint ID> void genericPainting(ZonFixedImage *fimg); #define IMG_CB(name) void img_ ## name(ZonFixedImage *fimg) IMG_CB(31101); @@ -460,7 +460,7 @@ private: IMG_CB(34174d); IMG_CB(34174e); IMG_CB(34174f); - static const unsigned int kSafeDigitsCount = 12; + static const uint kSafeDigitsCount = 12; static const unsigned short kSafeDigitsX[]; static const unsigned short kSafeDigitsY[]; static const char *kSafeDates[]; @@ -504,7 +504,7 @@ private: IMG_CB(44161d); IMG_CB(44161e); IMG_CB(44161f); - static const unsigned int kEpigraphMaxLetters = 32; + static const uint kEpigraphMaxLetters = 32; static const char *kEpigraphContent; static const char *kEpigraphPassword; bool handleEpigraph(ZonFixedImage *fimg); @@ -527,20 +527,20 @@ private: IMG_CB(88003d); IMG_CB(88003e); IMG_CB(88003f); - static const unsigned int kBombPasswordSmallLength = 40; - static const unsigned int kBombPasswordMaxLength = 60; + static const uint kBombPasswordSmallLength = 40; + static const uint kBombPasswordMaxLength = 60; static const unsigned short kBombLettersPos[2][kBombPasswordMaxLength][2]; static const char *kBombPassword; bool handleBomb(ZonFixedImage *fimg); void drawBombLetters(Graphics::ManagedSurface &surface, const Graphics::Surface(&bmpLetters)[26], - const unsigned int kBombPasswordLength, + const uint kBombPasswordLength, const unsigned char (&bombPossibilites)[kBombPasswordMaxLength][5], const unsigned char (&bombCurrentLetters)[kBombPasswordMaxLength]); IMG_CB(88004); IMG_CB(88004b); #undef IMG_CB -#define FILTER_EVENT(level, place) bool filterEventLevel ## level ## Place ## place(unsigned int *event) +#define FILTER_EVENT(level, place) bool filterEventLevel ## level ## Place ## place(uint *event) #define INIT_PLACE(level, place) void initPlaceLevel ## level ## Place ## place() FILTER_EVENT(1, 1); FILTER_EVENT(1, 2); diff --git a/engines/cryomni3d/versailles/logic.cpp b/engines/cryomni3d/versailles/logic.cpp index 55608cdb40..559f296cb1 100644 --- a/engines/cryomni3d/versailles/logic.cpp +++ b/engines/cryomni3d/versailles/logic.cpp @@ -129,7 +129,7 @@ void CryOmni3DEngine_Versailles::setupObjects() { #undef SET_OBJECT } -template<unsigned int ID> +template<uint ID> void CryOmni3DEngine_Versailles::genericDisplayObject() { displayObject(imagesObjects[ID]); } @@ -189,7 +189,7 @@ void CryOmni3DEngine_Versailles::obj_126hk(Graphics::ManagedSurface &surface) { drawEpigraphLetters(surface, bmpLetters, kEpigraphPassword); - for (unsigned int i = 0; i < 26; i++) { + for (uint i = 0; i < 26; i++) { bmpLetters[i].free(); } } @@ -238,7 +238,7 @@ void CryOmni3DEngine_Versailles::obj_142hk(Graphics::ManagedSurface &surface) { Common::Point(448, 356), }; - unsigned int id = _currentPlaceId - 14; + uint id = _currentPlaceId - 14; assert(id < ARRAYSIZE(markers)); /* @@ -249,8 +249,8 @@ void CryOmni3DEngine_Versailles::obj_142hk(Graphics::ManagedSurface &surface) { for(id = 0; id < ARRAYSIZE(markers); id++) { */ // Why - 20? Ask to game creators, it's like that in the code - unsigned int spriteX = markers[id].x - _sprites.getCursor(4).getWidth() / 2 - 20; - unsigned int spriteY = markers[id].y - _sprites.getCursor(4).getHeight() / 2; + uint spriteX = markers[id].x - _sprites.getCursor(4).getWidth() / 2 - 20; + uint spriteY = markers[id].y - _sprites.getCursor(4).getHeight() / 2; surface.transBlitFrom(_sprites.getSurface(4), Common::Point(spriteX, spriteY), _sprites.getKeyColor(4)); /* @@ -424,7 +424,7 @@ void CryOmni3DEngine_Versailles::setupImgScripts() { } // Generic handler for dumb fixed images -template<unsigned int ID> +template<uint ID> void CryOmni3DEngine_Versailles::genericDumbImage(ZonFixedImage *fimg) { fimg->load(imagesPaintings[ID]); while (1) { @@ -446,7 +446,7 @@ void CryOmni3DEngine_Versailles::genericDumbImage(ZonFixedImage *fimg) { } while (false) // Generic handler for paintings fixed images -template<unsigned int ID> +template<uint ID> void CryOmni3DEngine_Versailles::genericPainting(ZonFixedImage *fimg) { fimg->load(imagesPaintings[ID]); while (1) { @@ -1189,7 +1189,7 @@ bool CryOmni3DEngine_Versailles::handleSafe(ZonFixedImage *fimg) { Graphics::ManagedSurface tempSurf; loadBMPs("coff_%02d.bmp", bmpDigits, 10); - for (unsigned int i = 0; i < kSafeDigitsCount; i++) { + for (uint i = 0; i < kSafeDigitsCount; i++) { safeDigits[i] = rnd.getRandomNumber(9); } @@ -1236,7 +1236,7 @@ bool CryOmni3DEngine_Versailles::handleSafe(ZonFixedImage *fimg) { } } - for (unsigned int i = 0; i < 10; i++) { + for (uint i = 0; i < 10; i++) { bmpDigits[i].free(); } return success; @@ -1247,7 +1247,7 @@ const unsigned short CryOmni3DEngine_Versailles::kSafeDigitsY[] = { 148, 230, 31 void CryOmni3DEngine_Versailles::drawSafeDigits(Graphics::ManagedSurface &surface, const Graphics::Surface(&bmpDigits)[10], const unsigned char (&safeDigits)[kSafeDigitsCount]) { - for (unsigned int i = 0; i < ARRAYSIZE(safeDigits); i++) { + for (uint i = 0; i < ARRAYSIZE(safeDigits); i++) { const Graphics::Surface &digit = bmpDigits[safeDigits[i]]; Common::Point dst(kSafeDigitsX[i % 4], kSafeDigitsY[i / 4]); surface.transBlitFrom(digit, dst); @@ -1256,13 +1256,13 @@ void CryOmni3DEngine_Versailles::drawSafeDigits(Graphics::ManagedSurface &surfac const char *CryOmni3DEngine_Versailles::kSafeDates[] = { "1643", "1668", "1674" }; bool CryOmni3DEngine_Versailles::checkSafeDigits(unsigned char (&safeDigits)[kSafeDigitsCount]) { - unsigned int dateChecked; + uint dateChecked; for (dateChecked = 0; dateChecked < ARRAYSIZE(kSafeDates); dateChecked++) { const char *checkDate = kSafeDates[dateChecked]; // Find the date in one of safe digits lines - unsigned int line; + uint line; for (line = 0; line < kSafeDigitsCount; line += 4) { - unsigned int digit; + uint digit; for (digit = 0; digit < 4; digit++) { if (safeDigits[line + digit] != checkDate[digit] - '0') { break; @@ -1506,7 +1506,7 @@ IMG_CB(41802) { break; } if (fimg->_usedObject && fimg->_currentZone == 0) { - unsigned int objID = fimg->_usedObject->idOBJ(); + uint objID = fimg->_usedObject->idOBJ(); if (objID == 100) { playInGameVideo("12E2_24"); // Force reload of the place @@ -1553,7 +1553,7 @@ IMG_CB(41802b) { break; } if (fimg->_usedObject && fimg->_currentZone == 0) { - unsigned int objID = fimg->_usedObject->idOBJ(); + uint objID = fimg->_usedObject->idOBJ(); if (objID == 100) { playInGameVideo("12E2_24"); // Force reload of the place @@ -1598,7 +1598,7 @@ IMG_CB(41802c) { break; } if (fimg->_usedObject && fimg->_currentZone == 0) { - unsigned int objID = fimg->_usedObject->idOBJ(); + uint objID = fimg->_usedObject->idOBJ(); if (objID == 100) { playInGameVideo("12E2_24"); // Force reload of the place @@ -1633,7 +1633,7 @@ IMG_CB(41802d) { break; } if (fimg->_usedObject && fimg->_currentZone == 0) { - unsigned int objID = fimg->_usedObject->idOBJ(); + uint objID = fimg->_usedObject->idOBJ(); if (objID == 100) { playInGameVideo("12E2_24"); // Force reload of the place @@ -2397,7 +2397,7 @@ bool CryOmni3DEngine_Versailles::handleEpigraph(ZonFixedImage *fimg) { } } - for (unsigned int i = 0; i < 26; i++) { + for (uint i = 0; i < 26; i++) { bmpLetters[i].free(); } return success; @@ -2408,8 +2408,8 @@ const char *CryOmni3DEngine_Versailles::kEpigraphPassword = "LELOUPETLATETE"; void CryOmni3DEngine_Versailles::drawEpigraphLetters(Graphics::ManagedSurface &surface, const Graphics::Surface(&bmpLetters)[26], const Common::String &letters) { - for (unsigned int i = 0; i < letters.size() && i < kEpigraphMaxLetters; i++) { - unsigned int letterId = 0; + for (uint i = 0; i < letters.size() && i < kEpigraphMaxLetters; i++) { + uint letterId = 0; if (letters[i] >= 'A' && letters[i] <= 'Z') { letterId = letters[i] - 'A'; } @@ -2930,20 +2930,20 @@ bool CryOmni3DEngine_Versailles::handleBomb(ZonFixedImage *fimg) { unsigned char bombCurrentLetters[60]; Graphics::ManagedSurface tempSurf; - const unsigned int kBombPasswordLength = strlen(kBombPassword); + const uint kBombPasswordLength = strlen(kBombPassword); if (kBombPasswordLength >= kBombPasswordMaxLength) { error("Bomb password is too long"); } loadBMPs("bomb_%02d.bmp", bmpLetters, 26); - for (unsigned int i = 0; i < kBombPasswordLength; i++) { + for (uint i = 0; i < kBombPasswordLength; i++) { bombPossibilites[i][0] = toupper(kBombPassword[i]); - for (unsigned int j = 1; j < 5; j++) { + for (uint j = 1; j < 5; j++) { bool foundSameLetter; do { foundSameLetter = false; bombPossibilites[i][j] = rnd.getRandomNumberRng('A', 'Z'); - for (unsigned int k = 0; k < j; k++) { + for (uint k = 0; k < j; k++) { if (bombPossibilites[i][k] == bombPossibilites[i][j]) { foundSameLetter = true; } @@ -2984,7 +2984,7 @@ bool CryOmni3DEngine_Versailles::handleBomb(ZonFixedImage *fimg) { // Check if password is OK success = true; - for (unsigned int i = 0; i < kBombPasswordLength; i++) { + for (uint i = 0; i < kBombPasswordLength; i++) { unsigned char letterChar = bombPossibilites[i][bombCurrentLetters[i]]; if (letterChar != kBombPassword[i]) { success = false; @@ -3003,7 +3003,7 @@ bool CryOmni3DEngine_Versailles::handleBomb(ZonFixedImage *fimg) { } } - for (unsigned int i = 0; i < 26; i++) { + for (uint i = 0; i < 26; i++) { bmpLetters[i].free(); } return success; @@ -3034,13 +3034,13 @@ const unsigned short CryOmni3DEngine_Versailles::kBombLettersPos[2][kBombPasswor }; void CryOmni3DEngine_Versailles::drawBombLetters(Graphics::ManagedSurface &surface, - const Graphics::Surface(&bmpLetters)[26], const unsigned int kBombPasswordLength, + const Graphics::Surface(&bmpLetters)[26], const uint kBombPasswordLength, const unsigned char (&bombPossibilites)[kBombPasswordMaxLength][5], const unsigned char (&bombCurrentLetters)[kBombPasswordMaxLength]) { - unsigned int table = kBombPasswordLength <= kBombPasswordSmallLength ? 0 : 1; - for (unsigned int i = 0; i < kBombPasswordLength; i++) { + uint table = kBombPasswordLength <= kBombPasswordSmallLength ? 0 : 1; + for (uint i = 0; i < kBombPasswordLength; i++) { unsigned char letterChar = bombPossibilites[i][bombCurrentLetters[i]]; - unsigned int letterId = 0; + uint letterId = 0; if (letterChar >= 'A' && letterChar <= 'Z') { letterId = letterChar - 'A'; } @@ -3103,7 +3103,7 @@ IMG_CB(88004b) { #undef IMG_CB // Init place and filter event -#define FILTER_EVENT(level, place) bool CryOmni3DEngine_Versailles::filterEventLevel ## level ## Place ## place(unsigned int *event) +#define FILTER_EVENT(level, place) bool CryOmni3DEngine_Versailles::filterEventLevel ## level ## Place ## place(uint *event) #define INIT_PLACE(level, place) void CryOmni3DEngine_Versailles::initPlaceLevel ## level ## Place ## place() FILTER_EVENT(1, 1) { @@ -3194,7 +3194,7 @@ FILTER_EVENT(1, 7) { FILTER_EVENT(1, 14) { if (*event == 31141 && _placeStates[14].state == 0) { // Open the curtain - unsigned int fakePlaceId = getFakeTransition(*event); + uint fakePlaceId = getFakeTransition(*event); fakeTransition(fakePlaceId); playInGameVideo("10D2_1"); setPlaceState(14, 1); @@ -3236,7 +3236,7 @@ FILTER_EVENT(1, 14) { _placeStates[14].state); } - unsigned int fakePlaceId = getFakeTransition(*event); + uint fakePlaceId = getFakeTransition(*event); fakeTransition(fakePlaceId); playInGameVideo(video); @@ -3257,7 +3257,7 @@ FILTER_EVENT(2, 1) { _dialogsMan["{JOUEUR-MONTRE-UN-PAMPHLET}"] = 'N'; _dialogsMan["{JOUEUR-MONTRE-TOUT-AUTRE-OBJET}"] = 'N'; _dialogsMan["{JOUEUR-MONTRE-PAPIER-ECRIT-ENCRE-SYMPATHIQUE}"] = 'N'; - unsigned int idOBJ = _inventory.selectedObject()->idOBJ(); + uint idOBJ = _inventory.selectedObject()->idOBJ(); if (idOBJ == 96 || idOBJ == 101 || idOBJ == 115 || idOBJ == 125 || idOBJ == 127) { _dialogsMan["{JOUEUR-MONTRE-UN-PAMPHLET}"] = 'Y'; @@ -3373,7 +3373,7 @@ FILTER_EVENT(2, 2) { assert(callback != nullptr); // Adjust viewpoint for video - unsigned int fakePlaceId = getFakeTransition(*event); + uint fakePlaceId = getFakeTransition(*event); fakeTransition(fakePlaceId); playInGameVideo(video); @@ -3395,7 +3395,7 @@ FILTER_EVENT(2, 2) { FILTER_EVENT(2, 5) { if (*event == 22501 && _inventory.selectedObject()) { - unsigned int idOBJ = _inventory.selectedObject()->idOBJ(); + uint idOBJ = _inventory.selectedObject()->idOBJ(); if (idOBJ == 96) { if (!_inventory.inInventoryByNameID(101)) { _dialogsMan["{JOUEUR-MONTRE-PAMPHLET-ARTS}"] = 'Y'; @@ -3480,7 +3480,7 @@ FILTER_EVENT(2, 9) { FILTER_EVENT(2, 11) { if (*event == 22111 && _inventory.selectedObject()) { bool gameOver = false; - unsigned int idOBJ = _inventory.selectedObject()->idOBJ(); + uint idOBJ = _inventory.selectedObject()->idOBJ(); if (idOBJ == 107) { _dialogsMan["{JOUEUR-MONTRE-TITRE-FABLE-APPARU-SUR-ESQUISSE}"] = 'Y'; } else if (idOBJ == 109) { @@ -3510,7 +3510,7 @@ FILTER_EVENT(2, 11) { FILTER_EVENT(2, 12) { if (*event == 22121 && _inventory.selectedObject()) { - unsigned int idOBJ = _inventory.selectedObject()->idOBJ(); + uint idOBJ = _inventory.selectedObject()->idOBJ(); if (idOBJ == 105) { _dialogsMan["{LE JOUEUR-PRESENTE-AUTRES-ESQUISSES-OU-ESQUISSE-NON-TRIEES}"] = 'Y'; _dialogsMan["{JOUEUR-A-MONTRE-ESQUISSES-NON-TRIEES-LEBRUN}"] = 'Y'; @@ -3967,7 +3967,7 @@ FILTER_EVENT(4, 15) { FILTER_EVENT(4, 16) { if (*event == 24161 && _inventory.selectedObject()) { - unsigned int idOBJ = _inventory.selectedObject()->idOBJ(); + uint idOBJ = _inventory.selectedObject()->idOBJ(); if (idOBJ == 124) { _dialogsMan["{JOUEUR-DONNE-REPAS}"] = 'Y'; } else { @@ -4012,7 +4012,7 @@ FILTER_EVENT(4, 17) { setPlaceState(17, 1); return false; } else if (*event == 34172) { - unsigned int fakePlaceId = getFakeTransition(*event); + uint fakePlaceId = getFakeTransition(*event); fakeTransition(fakePlaceId); handleFixedImg(&CryOmni3DEngine_Versailles::img_34172); return false; @@ -4035,7 +4035,7 @@ INIT_PLACE(5, 6) { FILTER_EVENT(5, 9) { if (*event == 25090 && _inventory.selectedObject()) { - unsigned int idOBJ = _inventory.selectedObject()->idOBJ(); + uint idOBJ = _inventory.selectedObject()->idOBJ(); if (currentGameTime() < 4) { if (idOBJ == 125 && _gameVariables[GameVariables::kStateLampoonReligion] == 3) { _dialogsMan["{JOUEUR-MONTRE-PAMPHLET-RELIGION}"] = 'Y'; @@ -4096,7 +4096,7 @@ FILTER_EVENT(5, 9) { FILTER_EVENT(5, 14) { if (*event == 25142 && _inventory.selectedObject()) { - unsigned int idOBJ = _inventory.selectedObject()->idOBJ(); + uint idOBJ = _inventory.selectedObject()->idOBJ(); if (idOBJ == 125) { _dialogsMan["{JOUEUR-MONTRE-PAMPHLET-RELIGION}"] = 'Y'; } else { @@ -4263,7 +4263,7 @@ FILTER_EVENT(5, 23) { FILTER_EVENT(5, 27) { if (*event == 25270) { if (_inventory.selectedObject()) { - unsigned int idOBJ = _inventory.selectedObject()->idOBJ(); + uint idOBJ = _inventory.selectedObject()->idOBJ(); if (idOBJ == 115) { _dialogsMan["{JOUEUR-MONTRE-PAMPHLET-ARCHITECTURE}"] = 'Y'; } else if (idOBJ == 125) { @@ -4328,7 +4328,7 @@ FILTER_EVENT(5, 29) { FILTER_EVENT(5, 33) { if (*event == 35330 && !_gameVariables[GameVariables::kLoweredChandelier]) { - unsigned int fakePlaceId = getFakeTransition(*event); + uint fakePlaceId = getFakeTransition(*event); fakeTransition(fakePlaceId); playInGameVideo("LUSTRE"); @@ -4571,7 +4571,7 @@ FILTER_EVENT(7, 20) { void CryOmni3DEngine_Versailles::initCountdown() { strcpy(_countdownValue, "05:00"); if (_gameVariables[GameVariables::kSavedCountdown]) { - unsigned int counter = _gameVariables[GameVariables::kSavedCountdown]; + uint counter = _gameVariables[GameVariables::kSavedCountdown]; _countdownValue[4] = counter; counter >>= 8; _countdownValue[3] = counter; @@ -4583,7 +4583,7 @@ void CryOmni3DEngine_Versailles::initCountdown() { } void CryOmni3DEngine_Versailles::syncCountdown() { - unsigned int counter = 0; + uint counter = 0; counter |= _countdownValue[0]; counter <<= 8; counter |= _countdownValue[1]; diff --git a/engines/cryomni3d/versailles/menus.cpp b/engines/cryomni3d/versailles/menus.cpp index 9a4447876c..7e88d67a94 100644 --- a/engines/cryomni3d/versailles/menus.cpp +++ b/engines/cryomni3d/versailles/menus.cpp @@ -60,7 +60,7 @@ void CryOmni3DEngine_Versailles::drawMenuTitle(Graphics::ManagedSurface *surface _fontManager.setCurrentFont(oldFont); } -unsigned int CryOmni3DEngine_Versailles::displayOptions() { +uint CryOmni3DEngine_Versailles::displayOptions() { Common::Array<int> menuEntries; menuEntries.push_back(26); menuEntries.push_back(27); @@ -84,9 +84,9 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() { int drawState = 1; - unsigned int volumeCursorMiddleY = _sprites.getCursor(102).getHeight() / 2; - unsigned int volume = CLIP(ConfMan.getInt("sfx_volume"), 0, 256); - unsigned int soundVolumeY = ((283 * (256 - volume)) >> 8) + 101; + uint volumeCursorMiddleY = _sprites.getCursor(102).getHeight() / 2; + uint volume = CLIP(ConfMan.getInt("sfx_volume"), 0, 256); + uint soundVolumeY = ((283 * (256 - volume)) >> 8) + 101; byte volumeForeColor = 243; Graphics::ManagedSurface optionsSurface; @@ -98,10 +98,10 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() { setCursor(181); g_system->showMouse(true); - unsigned int hoveredBox = -1; - unsigned int selectedBox; + uint hoveredBox = -1; + uint selectedBox; int selectedMsg = 0; - unsigned int volumeBox; + uint volumeBox; bool resetScreen = true; bool forceEvents = true; @@ -132,10 +132,10 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() { optionsSurface.hLine(544, 429, 613, volumeForeColor); // minus 1 because hLine draws inclusive boxes.reset(); - unsigned int boxId = 0; - unsigned int top = 195; - unsigned int bottom; - unsigned int width; + uint boxId = 0; + uint top = 195; + uint bottom; + uint width; for (Common::Array<int>::iterator it = menuEntries.begin(); it != menuEntries.end(); it++) { if (*it == 30 && !ConfMan.getBool("subtitles")) { @@ -156,7 +156,7 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() { } else if (*it == -42 && canVisit()) { *it = 42; } else if (*it == 48) { - unsigned int omni3D_speed = ConfMan.getInt("omni3d_speed"); + uint omni3D_speed = ConfMan.getInt("omni3d_speed"); switch (omni3D_speed) { case 1: *it = 51; @@ -215,7 +215,7 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() { if (pollEvents() || forceEvents) { // always call pollEvents forceEvents = false; Common::Point mouse = getMousePos(); - unsigned int boxId = 0; + uint boxId = 0; Common::Array<int>::iterator it; for (it = menuEntries.begin(); it != menuEntries.end(); it++) { if (boxes.hitTest(boxId, mouse)) { @@ -319,7 +319,7 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() { Common::String saveName; bool wasVisiting = _isVisiting; _isVisiting = false; - unsigned int saveNumber = displayFilePicker(bgFrame, false, saveName); + uint saveNumber = displayFilePicker(bgFrame, false, saveName); if (saveNumber == -1u) { _isVisiting = wasVisiting; drawState = 1; @@ -334,7 +334,7 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() { Common::String saveName; bool wasVisiting = _isVisiting; _isVisiting = true; - unsigned int saveNumber = displayFilePicker(bgFrame, false, saveName); + uint saveNumber = displayFilePicker(bgFrame, false, saveName); if (saveNumber == -1u) { _isVisiting = wasVisiting; drawState = 1; @@ -347,7 +347,7 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() { waitMouseRelease(); } else if (selectedMsg == 29) { Common::String saveName; - unsigned int saveNumber = displayFilePicker(bgFrame, true, saveName); + uint saveNumber = displayFilePicker(bgFrame, true, saveName); if (saveNumber != -1u) { saveGame(_isVisiting, saveNumber, saveName); } @@ -475,11 +475,11 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() { return selectedMsg; } -unsigned int CryOmni3DEngine_Versailles::displayYesNoBox(Graphics::ManagedSurface &surface, - const Common::Rect &position, unsigned int msg_id) { - unsigned int confirmWidth = _fontManager.getStrWidth(_messages[53]); - unsigned int cancelWidth = _fontManager.getStrWidth(_messages[54]); - unsigned int oldFont = _fontManager.getCurrentFont(); +uint CryOmni3DEngine_Versailles::displayYesNoBox(Graphics::ManagedSurface &surface, + const Common::Rect &position, uint msg_id) { + uint confirmWidth = _fontManager.getStrWidth(_messages[53]); + uint cancelWidth = _fontManager.getStrWidth(_messages[54]); + uint oldFont = _fontManager.getCurrentFont(); _fontManager.setSurface(&surface); _fontManager.setForeColor(240); @@ -500,11 +500,11 @@ unsigned int CryOmni3DEngine_Versailles::displayYesNoBox(Graphics::ManagedSurfac bool end = false; bool redraw = true; - unsigned int result = -1u; + uint result = -1u; while (!end || redraw) { if (redraw) { - for (unsigned int boxId = 0; boxId < 2; boxId++) { + for (uint boxId = 0; boxId < 2; boxId++) { if (boxId == result) { _fontManager.setForeColor(240); } else { @@ -520,7 +520,7 @@ unsigned int CryOmni3DEngine_Versailles::displayYesNoBox(Graphics::ManagedSurfac if (pollEvents()) { Common::Point mouse = getMousePos(); - unsigned int hit_result = -1u; + uint hit_result = -1u; if (boxes.hitTest(1, mouse)) { hit_result = 1; } else if (boxes.hitTest(0, mouse)) { @@ -549,7 +549,7 @@ unsigned int CryOmni3DEngine_Versailles::displayYesNoBox(Graphics::ManagedSurfac return result; } -unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surface *bgFrame, +uint CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surface *bgFrame, bool saveMode, Common::String &saveName) { Graphics::ManagedSurface surface(bgFrame->w, bgFrame->h, bgFrame->format); surface.blitFrom(*bgFrame); @@ -579,10 +579,10 @@ unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surfa // Yes/No buttons const Common::String &okMsg = _messages[53]; - unsigned int okWidth = _fontManager.getStrWidth(okMsg); + uint okWidth = _fontManager.getStrWidth(okMsg); boxes.setupBox(6, 246, 430, 246 + okWidth, 450, &okMsg); const Common::String &cancelMsg = _messages[54]; - unsigned int cancelWidth = _fontManager.getStrWidth(cancelMsg); + uint cancelWidth = _fontManager.getStrWidth(cancelMsg); boxes.setupBox(7, 146, 430, 146 + cancelWidth, 450, &cancelMsg); // Up/Down buttons @@ -593,19 +593,19 @@ unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surfa setCursor(181); - unsigned int fileListOffset = CLIP(ConfMan.getInt(_isVisiting ? "visits_list_off" : - "saves_list_off"), 0, 100 - 6); + uint fileListOffset = CLIP(ConfMan.getInt(_isVisiting ? "visits_list_off" : + "saves_list_off"), 0, 100 - 6); - unsigned int boxHovered = -1; - unsigned int boxSelected = -1; + uint boxHovered = -1; + uint boxSelected = -1; bool textCursorState = false; - unsigned int textCursorNextState = 0; - unsigned int textCursorPos = -1; + uint textCursorNextState = 0; + uint textCursorPos = -1; bool autoRepeatInhibit = false; - unsigned int autoRepeatDelay = 250; - unsigned int autoRepeatEndInhibit = 0; + uint autoRepeatDelay = 250; + uint autoRepeatEndInhibit = 0; bool finished = false; bool filesListChanged = true; @@ -613,7 +613,7 @@ unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surfa while (!finished) { if (filesListChanged || redraw) { if (filesListChanged) { - for (unsigned int file = 0, fileY = 280; file < 6; file++, fileY += 20) { + for (uint file = 0, fileY = 280; file < 6; file++, fileY += 20) { boxes.setupBox(file, 146, fileY, 408, fileY + 14, &savesList[file + fileListOffset]); } // Redraw background as file list changed @@ -621,7 +621,7 @@ unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surfa filesListChanged = false; } // Don't redraw the scroll buttons - for (unsigned int box = 0; box < 8; box++) { + for (uint box = 0; box < 8; box++) { if (box == boxSelected) { // Selected _fontManager.setForeColor(240); @@ -661,12 +661,12 @@ unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surfa g_system->updateScreen(); pollEvents(); Common::KeyState key = getNextKey(); - unsigned int mousePressed = getCurrentMouseButton(); + uint mousePressed = getCurrentMouseButton(); if (!mousePressed) { bool boxFound = false; // Don't handle scroll arrows hovering - for (unsigned int box = 0; box < 8; box++) { + for (uint box = 0; box < 8; box++) { if (boxes.hitTest(box, getMousePos())) { boxFound = true; if (boxHovered != box) { @@ -733,7 +733,7 @@ unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surfa } if (g_system->getMillis() > textCursorNextState) { textCursorNextState = g_system->getMillis() + 200; // Blink at 200ms period - unsigned int width = _fontManager.getStrWidth(savesList[boxSelected + fileListOffset]); + uint width = _fontManager.getStrWidth(savesList[boxSelected + fileListOffset]); Common::Rect boxRct = boxes.getBoxRect(boxSelected); textCursorPos = boxRct.left + width; textCursorState = !textCursorState; @@ -742,7 +742,7 @@ unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surfa } if (!autoRepeatInhibit) { bool autoRepeatTrigger = false; - unsigned int oldFileListOffset = fileListOffset; + uint oldFileListOffset = fileListOffset; if (mousePressed) { if (boxes.hitTest(8, getMousePos()) && fileListOffset > 0) { fileListOffset--; @@ -827,9 +827,9 @@ void CryOmni3DEngine_Versailles::displayMessageBox(const MsgBoxParameters ¶m _fontManager.setSpaceWidth(params.spaceWidth); _fontManager.setCharSpacing(params.charSpacing); - unsigned int width = params.initialWidth; - unsigned int height = params.initialHeight; - unsigned int lineCount = 0; + uint width = params.initialWidth; + uint height = params.initialHeight; + uint lineCount = 0; Common::Point pt = position; Common::Rect rct; @@ -868,7 +868,7 @@ void CryOmni3DEngine_Versailles::displayMessageBox(const MsgBoxParameters ¶m tooLarge = true; } lineCount = _fontManager.getLinesCount(msg, rct.width() - 12); - if (lineCount && lineCount * _fontManager.lineHeight() + 18 < (unsigned int)rct.height()) { + if (lineCount && lineCount * _fontManager.lineHeight() + 18 < (uint)rct.height()) { notEnough = false; } } @@ -889,7 +889,7 @@ void CryOmni3DEngine_Versailles::displayMessageBox(const MsgBoxParameters ¶m dstSurface.w, dstSurface.h); waitMouseRelease(); - unsigned int disappearTime = g_system->getMillis() + msg.size() * params.timeoutChar * 10; + uint disappearTime = g_system->getMillis() + msg.size() * params.timeoutChar * 10; bool finished = false; while (!finished) { g_system->updateScreen(); @@ -962,8 +962,8 @@ void CryOmni3DEngine_Versailles::displayCredits() { char line[256]; bool end = false; bool calculatedScreen = false; - unsigned int lineHeight = 20; - unsigned int currentY = 0; + uint lineHeight = 20; + uint currentY = 0; int32 fileOffset = 0; bool skipScreen = false; @@ -985,7 +985,7 @@ void CryOmni3DEngine_Versailles::displayCredits() { } skipScreen = false; // Wait - unsigned int endScreenTime = g_system->getMillis() + 6000; + uint endScreenTime = g_system->getMillis() + 6000; while (g_system->getMillis() < endScreenTime && !skipScreen) { g_system->updateScreen(); if (pollEvents()) { @@ -1054,7 +1054,7 @@ void CryOmni3DEngine_Versailles::displayCredits() { } else { // Text if (calculatedScreen) { - unsigned int width = _fontManager.getStrWidth(line); + uint width = _fontManager.getStrWidth(line); // Center around 315 _fontManager.displayStr(315 - width / 2, currentY, line); } diff --git a/engines/cryomni3d/versailles/music.cpp b/engines/cryomni3d/versailles/music.cpp index a19e82a538..2fa60beadb 100644 --- a/engines/cryomni3d/versailles/music.cpp +++ b/engines/cryomni3d/versailles/music.cpp @@ -52,7 +52,7 @@ void CryOmni3DEngine_Versailles::musicUpdate() { return; } - unsigned int musicId = getMusicId(_currentLevel, _currentPlaceId); + uint musicId = getMusicId(_currentLevel, _currentPlaceId); const char *musicBName = kMusicFiles[_currentLevel - 1][musicId]; assert(musicBName != nullptr); @@ -131,15 +131,15 @@ void CryOmni3DEngine_Versailles::musicSetQuiet(bool quiet) { } } -bool CryOmni3DEngine_Versailles::musicWouldChange(unsigned int level, unsigned int placeId) const { - unsigned int musicId = getMusicId(level, placeId); +bool CryOmni3DEngine_Versailles::musicWouldChange(uint level, uint placeId) const { + uint musicId = getMusicId(level, placeId); const char *musicFile = kMusicFiles[_currentLevel - 1][musicId]; return musicFile != _musicCurrentFile; } -unsigned int CryOmni3DEngine_Versailles::getMusicId(unsigned int level, - unsigned int placeId) const { +uint CryOmni3DEngine_Versailles::getMusicId(uint level, + uint placeId) const { // No need of place state switch (level) { case 1: diff --git a/engines/cryomni3d/versailles/saveload.cpp b/engines/cryomni3d/versailles/saveload.cpp index 752cb761e4..a6620a39d8 100644 --- a/engines/cryomni3d/versailles/saveload.cpp +++ b/engines/cryomni3d/versailles/saveload.cpp @@ -34,7 +34,7 @@ namespace Versailles { #define SAVE_DESCRIPTION_LEN 20 -Common::String CryOmni3DEngine_Versailles::getSaveFileName(bool visit, unsigned int saveNum) const { +Common::String CryOmni3DEngine_Versailles::getSaveFileName(bool visit, uint saveNum) const { return Common::String::format("%s%s.%04u", _targetName.c_str(), visit ? "_visit" : "", saveNum); } @@ -108,12 +108,12 @@ void CryOmni3DEngine_Versailles::getSavesList(bool visit, Common::StringArray &s } } - for (unsigned int i = saveNames.size(); i < 100; i++) { + for (uint i = saveNames.size(); i < 100; i++) { saveNames.push_back(_messages[55]); } } -void CryOmni3DEngine_Versailles::saveGame(bool visit, unsigned int saveNum, +void CryOmni3DEngine_Versailles::saveGame(bool visit, uint saveNum, const Common::String &saveName) { if (visit && saveNum == 1) { error("Can't erase bootstrap visit"); @@ -149,17 +149,17 @@ void CryOmni3DEngine_Versailles::saveGame(bool visit, unsigned int saveNum, // Dialog variables assert(_dialogsMan.size() < 200); - for (unsigned int i = 0; i < _dialogsMan.size(); i++) { + for (uint i = 0; i < _dialogsMan.size(); i++) { out->writeByte(_dialogsMan[i]); } - for (unsigned int i = _dialogsMan.size(); i < 200; i++) { + for (uint i = _dialogsMan.size(); i < 200; i++) { out->writeByte(0); } // Inventory assert(_inventory.size() == 50); for (Inventory::const_iterator it = _inventory.begin(); it != _inventory.end(); it++) { - unsigned int objId = -1; + uint objId = -1; if (*it != nullptr) { // Inventory contains pointers to objects stored in _objects objId = *it - _objects.begin(); @@ -178,20 +178,20 @@ void CryOmni3DEngine_Versailles::saveGame(bool visit, unsigned int saveNum, // Places states assert(_placeStates.size() <= 100); Common::Array<PlaceState>::const_iterator placeIt = _placeStates.begin(); - for (unsigned int i = 0; placeIt != _placeStates.end(); placeIt++, i++) { + for (uint i = 0; placeIt != _placeStates.end(); placeIt++, i++) { out->writeUint32BE(placeIt->state); } - for (unsigned int i = _placeStates.size(); i < 100; i++) { + for (uint i = _placeStates.size(); i < 100; i++) { out->writeUint32BE(0); } // Game variables assert(_gameVariables.size() < 100); - for (Common::Array<unsigned int>::const_iterator it = _gameVariables.begin(); + for (Common::Array<uint>::const_iterator it = _gameVariables.begin(); it != _gameVariables.end(); it++) { out->writeUint32BE(*it); } - for (unsigned int i = _gameVariables.size(); i < 100; i++) { + for (uint i = _gameVariables.size(); i < 100; i++) { out->writeUint32BE(0); } @@ -200,7 +200,7 @@ void CryOmni3DEngine_Versailles::saveGame(bool visit, unsigned int saveNum, delete out; } -bool CryOmni3DEngine_Versailles::loadGame(bool visit, unsigned int saveNum) { +bool CryOmni3DEngine_Versailles::loadGame(bool visit, uint saveNum) { Common::SeekableReadStream *in; if (visit && saveNum == 1) { @@ -241,17 +241,17 @@ bool CryOmni3DEngine_Versailles::loadGame(bool visit, unsigned int saveNum) { // Dialog variables assert(_dialogsMan.size() < 200); - for (unsigned int i = 0; i < _dialogsMan.size(); i++) { + for (uint i = 0; i < _dialogsMan.size(); i++) { _dialogsMan[i] = in->readByte(); } - for (unsigned int i = _dialogsMan.size(); i < 200; i++) { + for (uint i = _dialogsMan.size(); i < 200; i++) { in->readByte(); } // Inventory assert(_inventory.size() == 50); for (Inventory::iterator it = _inventory.begin(); it != _inventory.end(); it++) { - unsigned int objId = in->readUint32BE(); + uint objId = in->readUint32BE(); if (objId >= _objects.size()) { objId = -1; } @@ -276,17 +276,17 @@ bool CryOmni3DEngine_Versailles::loadGame(bool visit, unsigned int saveNum) { // Places states // Store them and use them once we called initNewLevel, we can't call it before because it needs _gameVariables (and especially kCurrentTime) to be correctly set uint32 placesStates[100]; - for (unsigned int i = 0; i < 100; i++) { + for (uint i = 0; i < 100; i++) { placesStates[i] = in->readUint32BE(); } // Game variables assert(_gameVariables.size() < 100); - for (Common::Array<unsigned int>::iterator it = _gameVariables.begin(); it != _gameVariables.end(); + for (Common::Array<uint>::iterator it = _gameVariables.begin(); it != _gameVariables.end(); it++) { *it = in->readUint32BE(); } - for (unsigned int i = _gameVariables.size(); i < 100; i++) { + for (uint i = _gameVariables.size(); i < 100; i++) { in->readUint32BE(); } @@ -305,7 +305,7 @@ bool CryOmni3DEngine_Versailles::loadGame(bool visit, unsigned int saveNum) { _omni3dMan.setBeta(beta); // _placeStates has just been resized in initNewLevel - unsigned int i = 0; + uint i = 0; for (Common::Array<PlaceState>::iterator placeIt = _placeStates.begin(); placeIt != _placeStates.end() && i < ARRAYSIZE(placesStates); placeIt++, i++) { placeIt->state = placesStates[i]; diff --git a/engines/cryomni3d/versailles/toolbar.cpp b/engines/cryomni3d/versailles/toolbar.cpp index 2f9426beac..f6884bd035 100644 --- a/engines/cryomni3d/versailles/toolbar.cpp +++ b/engines/cryomni3d/versailles/toolbar.cpp @@ -73,7 +73,7 @@ Toolbar::~Toolbar() { _destSurface.free(); } -void Toolbar::inventoryChanged(unsigned int newPosition) { +void Toolbar::inventoryChanged(uint newPosition) { if (newPosition != -1u && newPosition > _inventoryOffset) { _inventoryOffset = newPosition - 7; } @@ -103,8 +103,8 @@ const { return it; } -unsigned int Toolbar::captureEvent(const Common::Point &mousePos, unsigned int dragStatus) { - unsigned int result = 0; +uint Toolbar::captureEvent(const Common::Point &mousePos, uint dragStatus) { + uint result = 0; Common::Array<Zone>::const_iterator it = hitTestZones(mousePos); if (it != _zones.end()) { result = (this->*(it->callback))(dragStatus); @@ -162,7 +162,7 @@ void Toolbar::updateZones() { } } -unsigned int Toolbar::callbackInventory(unsigned int invId, unsigned int dragStatus) { +uint Toolbar::callbackInventory(uint invId, uint dragStatus) { if (!_inventoryEnabled) { return 0; } @@ -206,7 +206,7 @@ unsigned int Toolbar::callbackInventory(unsigned int invId, unsigned int dragSta } -unsigned int Toolbar::callbackInventoryPrev(unsigned int dragStatus) { +uint Toolbar::callbackInventoryPrev(uint dragStatus) { if (!_inventoryEnabled) { return 0; } @@ -221,7 +221,7 @@ unsigned int Toolbar::callbackInventoryPrev(unsigned int dragStatus) { return 0; } -unsigned int Toolbar::callbackInventoryNext(unsigned int dragStatus) { +uint Toolbar::callbackInventoryNext(uint dragStatus) { if (!_inventoryEnabled) { return 0; } @@ -235,7 +235,7 @@ unsigned int Toolbar::callbackInventoryNext(unsigned int dragStatus) { return 0; } -unsigned int Toolbar::callbackViewObject(unsigned int dragStatus) { +uint Toolbar::callbackViewObject(uint dragStatus) { if (!_inventoryEnabled) { return 0; } @@ -274,7 +274,7 @@ unsigned int Toolbar::callbackViewObject(unsigned int dragStatus) { } } -unsigned int Toolbar::callbackOptions(unsigned int dragStatus) { +uint Toolbar::callbackOptions(uint dragStatus) { _mouse_in_options = true; switch (dragStatus) { @@ -300,7 +300,7 @@ unsigned int Toolbar::callbackOptions(unsigned int dragStatus) { } } -unsigned int Toolbar::callbackDocumentation(unsigned int dragStatus) { +uint Toolbar::callbackDocumentation(uint dragStatus) { _mouse_in_options = true; switch (dragStatus) { @@ -372,7 +372,7 @@ void Toolbar::drawToolbar(const Graphics::Surface *original) { if (_inventoryEnabled && _inventoryHovered != -1u) { Object *obj = (*_inventory)[_inventoryHovered]; - unsigned int zoneId = _inventoryHovered - _inventoryOffset; + uint zoneId = _inventoryHovered - _inventoryOffset; if (zoneId >= 8) { // The object is hidden: huh? return; @@ -383,8 +383,8 @@ void Toolbar::drawToolbar(const Graphics::Surface *original) { _fontManager->setCurrentFont(5); _fontManager->setTransparentBackground(true); const Common::String &objName = (*_messages)[obj->idOBJ()]; - unsigned int x = 195 - _fontManager->getStrWidth(objName); - unsigned int startX = _zones[zoneId].rect.left + kTextOffset; + uint x = 195 - _fontManager->getStrWidth(objName); + uint startX = _zones[zoneId].rect.left + kTextOffset; _fontManager->displayStr(x, 38 + _position, objName); _destSurface.hLine(x, 54 + _position, startX - 1, 243); // minus 1 because hLine draws inclusive _destSurface.vLine(startX, 42 + _position, 54 + _position, 243); @@ -546,8 +546,8 @@ void Toolbar::handleToolbarEvents(const Graphics::Surface *original) { // The 2nd above condition is maybe useless because when the mouse button is down the selected object is always null bool shouldHover = false; Common::Array<Zone>::const_iterator zoneIt = hitTestZones(mousePosInToolbar); - unsigned int zoneId = zoneIt - _zones.begin(); - unsigned int inventoryId = zoneId + _inventoryOffset; + uint zoneId = zoneIt - _zones.begin(); + uint inventoryId = zoneId + _inventoryOffset; if (zoneId < 8 && inventoryId < _inventory->size() && (*_inventory)[inventoryId] != nullptr) { // It's the inventory shouldHover = true; diff --git a/engines/cryomni3d/versailles/toolbar.h b/engines/cryomni3d/versailles/toolbar.h index 11517cc10b..e65d161afe 100644 --- a/engines/cryomni3d/versailles/toolbar.h +++ b/engines/cryomni3d/versailles/toolbar.h @@ -51,13 +51,13 @@ public: Graphics::Surface &getBackgroundSurface() { return _bgSurface; } bool displayToolbar(const Graphics::Surface *original); - void inventoryChanged(unsigned int newPosition); - unsigned int inventoryOffset() const { return _inventoryOffset; } - void setInventoryOffset(unsigned int offset) { _inventoryOffset = offset; } + void inventoryChanged(uint newPosition); + uint inventoryOffset() const { return _inventoryOffset; } + void setInventoryOffset(uint offset) { _inventoryOffset = offset; } void setInventoryEnabled(bool enabled) { _inventoryEnabled = enabled; } private: - typedef unsigned int (Toolbar::*ZoneCallback)(unsigned int dragStatus); + typedef uint(Toolbar::*ZoneCallback)(uint dragStatus); struct Zone { Common::Rect rect; uint16 imageMain; @@ -73,21 +73,21 @@ private: Inventory *_inventory; CryOmni3DEngine *_engine; - static const unsigned int kTextOffset = 13; + static const uint kTextOffset = 13; void addZone(uint16 cursorMainId, uint16 cursorSecondaryId, Common::Point position, ZoneCallback callback); void updateZones(); Common::Array<Zone>::const_iterator hitTestZones(const Common::Point &mousePos) const; - unsigned int captureEvent(const Common::Point &mousePos, unsigned int dragStatus); + uint captureEvent(const Common::Point &mousePos, uint dragStatus); void drawToolbar(const Graphics::Surface *original); void handleToolbarEvents(const Graphics::Surface *original); bool _inventoryEnabled; - unsigned int _inventoryMaxOffset; - unsigned int _inventoryOffset; - unsigned int _inventoryHovered; - unsigned int _inventorySelected; + uint _inventoryMaxOffset; + uint _inventoryOffset; + uint _inventoryHovered; + uint _inventorySelected; Object *_backup_selected_object; bool _mouse_in_options; @@ -96,19 +96,19 @@ private: bool _parentMustRedraw; bool _shortExit; - unsigned int _position; + uint _position; Graphics::Surface _bgSurface; Graphics::ManagedSurface _destSurface; - template<unsigned int N> - unsigned int callbackInventory(unsigned int dragStatus) { return callbackInventory(N, dragStatus); } - unsigned int callbackInventory(unsigned int invId, unsigned int dragStatus); - unsigned int callbackInventoryPrev(unsigned int dragStatus); - unsigned int callbackInventoryNext(unsigned int dragStatus); - unsigned int callbackViewObject(unsigned int dragStatus); - unsigned int callbackOptions(unsigned int dragStatus); - unsigned int callbackDocumentation(unsigned int dragStatus); + template<uint N> + uint callbackInventory(uint dragStatus) { return callbackInventory(N, dragStatus); } + uint callbackInventory(uint invId, uint dragStatus); + uint callbackInventoryPrev(uint dragStatus); + uint callbackInventoryNext(uint dragStatus); + uint callbackViewObject(uint dragStatus); + uint callbackOptions(uint dragStatus); + uint callbackDocumentation(uint dragStatus); }; } // End of namespace Versailles |