diff --git a/soh/soh/Enhancements/Fixes/HammerHandFix.cpp b/soh/soh/Enhancements/Fixes/HammerHandFix.cpp index 5cee8c30d..5ed90e45d 100644 --- a/soh/soh/Enhancements/Fixes/HammerHandFix.cpp +++ b/soh/soh/Enhancements/Fixes/HammerHandFix.cpp @@ -1,9 +1,9 @@ #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/ResourceManagerHelpers.h" #include "soh/ShipInit.hpp" extern "C" { #include "macros.h" -#include "soh/ResourceManagerHelpers.h" #include "objects/object_link_boy/object_link_boy.h" extern SaveContext gSaveContext; } diff --git a/soh/soh/Enhancements/Graphics/ToTMedallions.cpp b/soh/soh/Enhancements/Graphics/ToTMedallions.cpp index 5a7809836..a79eb8f27 100644 --- a/soh/soh/Enhancements/Graphics/ToTMedallions.cpp +++ b/soh/soh/Enhancements/Graphics/ToTMedallions.cpp @@ -29,7 +29,7 @@ static Gfx grayscaleWhite = gsDPSetGrayscaleColor(255, 255, 255, 255); class ToTPatchSetup { public: ToTPatchSetup(Gfx ifColored, const char* patchName, int index, const char* patchName2 = "", int index2 = 0) - : patchName(patchName), index(index), ifColored(ifColored), patchName2(patchName2), index2(index2) { + : patchName(patchName), patchName2(patchName2), index(index), index2(index2), ifColored(ifColored) { } void ApplyPatch(bool colored = true) { diff --git a/soh/soh/Enhancements/kaleido.cpp b/soh/soh/Enhancements/kaleido.cpp index 25f4cfd43..58f76fbff 100644 --- a/soh/soh/Enhancements/kaleido.cpp +++ b/soh/soh/Enhancements/kaleido.cpp @@ -203,10 +203,6 @@ void Kaleido::Draw(PlayState* play) { Matrix_Translate(-108.f, 58.f, 0.0f, MTXMODE_APPLY); // Invert the matrix to render vertices with positive going down Matrix_Scale(1.0f, -1.0f, 1.0f, MTXMODE_APPLY); - // The scrolling logic is in here because the built in kaleido input throttling happens - // in its Draw functions, which get called after their update functions. I hate it but fixing - // it would be a much larger Kaleido change. - bool shouldScroll = false; bool dpad = CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0); if (((pauseCtx->unk_1E4 == 0) || (pauseCtx->unk_1E4 == 5) || (pauseCtx->unk_1E4 == 8)) && (pauseCtx->pageIndex == PAUSE_QUEST)) { @@ -220,7 +216,6 @@ void Kaleido::Draw(PlayState* play) { } if (mCursorPos < mTopIndex) { mTopIndex = mCursorPos; - shouldScroll = true; } } else if ((pauseCtx->stickRelY < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DDOWN))) { if (mCursorPos < mEntries.size() - 1) { @@ -230,7 +225,6 @@ void Kaleido::Draw(PlayState* play) { } if (mCursorPos >= mTopIndex + mNumVisible && mTopIndex + mNumVisible < mEntries.size()) { mTopIndex = mCursorPos - mNumVisible + 1; - shouldScroll = true; } } if ((pauseCtx->stickRelX < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) { @@ -258,7 +252,7 @@ void Kaleido::Draw(PlayState* play) { } } int yOffset = 1; - for (int i = mTopIndex; i < (mTopIndex + mNumVisible) && i < mEntries.size(); i++) { + for (size_t i = mTopIndex; i < (mTopIndex + mNumVisible) && i < mEntries.size(); i++) { auto& entry = mEntries[i]; entry->SetYOffset(yOffset); yOffset += 9; @@ -275,7 +269,7 @@ void Kaleido::Draw(PlayState* play) { } void Kaleido::Update(PlayState* play) { - for (int i = mTopIndex; i < (mTopIndex + mNumVisible) && i < mEntries.size(); i++) { + for (size_t i = mTopIndex; i < (mTopIndex + mNumVisible) && i < mEntries.size(); i++) { const auto& entry = mEntries[i]; entry->Update(play); } @@ -295,8 +289,8 @@ extern "C" void RandoKaleido_UpdateMiscCollectibles(int16_t inDungeonScene) { KaleidoEntryIconFlag::KaleidoEntryIconFlag(const char* iconResourceName, int iconFormat, int iconSize, int iconWidth, int iconHeight, Color_RGBA8 iconColor, FlagType flagType, int flag, std::string name) - : mFlagType(flagType), mFlag(flag), - KaleidoEntryIcon(iconResourceName, iconFormat, iconSize, iconWidth, iconHeight, iconColor, std::move(name)) { + : KaleidoEntryIcon(iconResourceName, iconFormat, iconSize, iconWidth, iconHeight, iconColor, std::move(name)), + mFlagType(flagType), mFlag(flag) { BuildVertices(); } @@ -307,8 +301,8 @@ void KaleidoEntryIconFlag::Update(PlayState* play) { KaleidoEntryIconCountRequired::KaleidoEntryIconCountRequired(const char* iconResourceName, int iconFormat, int iconSize, int iconWidth, int iconHeight, Color_RGBA8 iconColor, int* watch, int required, int total) - : mWatch(watch), mRequired(required), mTotal(total), - KaleidoEntryIcon(iconResourceName, iconFormat, iconSize, iconWidth, iconHeight, iconColor) { + : KaleidoEntryIcon(iconResourceName, iconFormat, iconSize, iconWidth, iconHeight, iconColor), mWatch(watch), + mRequired(required), mTotal(total) { mCount = *mWatch; BuildText(); BuildVertices(); @@ -375,8 +369,8 @@ void KaleidoEntryIcon::BuildVertices() { KaleidoEntryIcon::KaleidoEntryIcon(const char* iconResourceName, int iconFormat, int iconSize, int iconWidth, int iconHeight, Color_RGBA8 iconColor, std::string text) - : mIconResourceName(iconResourceName), mIconFormat(iconFormat), mIconSize(iconSize), mIconWidth(iconWidth), - mIconHeight(iconHeight), mIconColor(iconColor), KaleidoEntry(std::move(text)) { + : KaleidoEntry(std::move(text)), mIconResourceName(iconResourceName), mIconFormat(iconFormat), mIconSize(iconSize), + mIconWidth(iconWidth), mIconHeight(iconHeight), mIconColor(iconColor) { } void KaleidoEntryIcon::RebuildVertices() { @@ -446,7 +440,7 @@ void KaleidoEntryOcarinaButtons::Update(PlayState* play) { mButtonCollected[4] = GameInteractor::RawAction::CheckFlag(FLAG_RANDOMIZER_INF, RAND_INF_HAS_OCARINA_C_RIGHT) > 0; CalculateColors(); mAchieved = false; - for (int i = 0; i < mButtonCollected.size(); i++) { + for (size_t i = 0; i < mButtonCollected.size(); i++) { if (!mButtonCollected[i]) { mButtonColors[i] = Color_RGBA8{ 109, 109, 109, 255 }; } else { diff --git a/soh/soh/Enhancements/kaleido.h b/soh/soh/Enhancements/kaleido.h index 9f2bc14b3..93c542c4c 100644 --- a/soh/soh/Enhancements/kaleido.h +++ b/soh/soh/Enhancements/kaleido.h @@ -81,7 +81,7 @@ class KaleidoEntryIcon : public KaleidoEntry { * Class representing a Kaleido Entry that can be represented with an icon * that is either colored in or Grayscale according to a flag */ -class KaleidoEntryIconFlag : public KaleidoEntryIcon { +class KaleidoEntryIconFlag final : public KaleidoEntryIcon { public: /** * @param iconResourceName resource name of the icon to draw @@ -110,7 +110,7 @@ class KaleidoEntryIconFlag : public KaleidoEntryIcon { * The `required` and `total` values can be omitted from the constructor or set to 0 to only * render the count and not show progress towards a required amount or a total. */ -class KaleidoEntryIconCountRequired : public KaleidoEntryIcon { +class KaleidoEntryIconCountRequired final : public KaleidoEntryIcon { public: /** * @param iconResourceName resource name of the icon to draw @@ -141,7 +141,7 @@ class KaleidoEntryIconCountRequired : public KaleidoEntryIcon { void BuildText(); }; -class KaleidoEntryOcarinaButtons : public KaleidoEntryIcon { +class KaleidoEntryOcarinaButtons final : public KaleidoEntryIcon { public: KaleidoEntryOcarinaButtons(); void Update(PlayState* play) override; @@ -163,9 +163,9 @@ class Kaleido { private: std::vector> mEntries; std::vector mEntryDl; - int mTopIndex = 0; - int mCursorPos = 0; - int mNumVisible = 14; + size_t mTopIndex = 0; + size_t mCursorPos = 0; + const size_t mNumVisible = 14; }; } // namespace Rando diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 913d440cd..0326867d5 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -1032,11 +1032,6 @@ void CheckTrackerWindow::DrawElement() { RecalculateAvailableChecks(); } - SceneID sceneId = SCENE_ID_MAX; - if (gPlayState != nullptr) { - sceneId = (SceneID)gPlayState->sceneNum; - } - // Quick Options #ifdef __WIIU__ float headerHeight = 40.0f; diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index a948a63f7..2faf1a0cb 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -568,7 +568,7 @@ ItemTrackerNumbers GetItemCurrentAndMax(ItemTrackerItem item) { default: result.maxCapacity = 0; SPDLOG_ERROR( - "Invalid value for RSK_GERUDO_FORTRESS: " + + "Invalid value for RSK_GERUDO_FORTRESS: {}", OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GERUDO_FORTRESS)); assert(false); break; @@ -1379,17 +1379,17 @@ void DrawItemsInACircle(std::vector items) { * Loops over dungeons and creates vectors of items in the correct order * to then call DrawItemsInRows */ -std::vector GetDungeonItemsVector(std::vector dungeons, int columns = 6) { +std::vector GetDungeonItemsVector(std::vector dungeons, size_t columns = 6) { std::vector dungeonItems = {}; - int rowCount = 0; - for (int i = 0; i < dungeons.size(); i++) { + size_t rowCount = 0; + for (size_t i = 0; i < dungeons.size(); i++) { if (dungeons[i].items.size() > rowCount) rowCount = static_cast(dungeons[i].items.size()); } - for (int i = 0; i < rowCount; i++) { - for (int j = 0; j < MIN(dungeons.size(), columns); j++) { + for (size_t i = 0; i < rowCount; i++) { + for (size_t j = 0; j < MIN(dungeons.size(), columns); j++) { if (dungeons[j].items.size() > i) { switch (dungeons[j].items[i]) { case ITEM_KEY_SMALL: diff --git a/soh/soh/Enhancements/savestates.cpp b/soh/soh/Enhancements/savestates.cpp index 270bdef7d..aa29afb37 100644 --- a/soh/soh/Enhancements/savestates.cpp +++ b/soh/soh/Enhancements/savestates.cpp @@ -364,7 +364,7 @@ SaveStateMgr::~SaveStateMgr() { } SaveState::SaveState(std::shared_ptr mgr, unsigned int slot) - : saveStateMgr(mgr), slot(slot), info(nullptr) { + : slot(slot), saveStateMgr(mgr), info(nullptr) { this->info = std::make_shared(); }