Increase warnings in Windows and fix most of them (#5858)

/W3
This commit is contained in:
Pepe20129
2026-06-11 17:05:33 +02:00
committed by GitHub
parent 7c42a63ceb
commit 8470f41c29
68 changed files with 360 additions and 312 deletions
+2 -3
View File
@@ -424,14 +424,13 @@ if(MSVC)
if(SOH_WINDOWS_64BIT)
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/w;
/Od
>
$<$<CONFIG:Release>:
/Oi;
/Gy;
/W3
>
/W3;
/bigobj;
/sdl-;
/permissive-;
@@ -453,7 +452,7 @@ if(MSVC)
/permissive-;
/MP;
/sdl-;
/w;
/W3;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
${DEFAULT_CXX_EXCEPTION_HANDLING}
)
+2 -2
View File
@@ -482,7 +482,7 @@ ActorDB::Entry& ActorDB::AddEntry(const std::string& name, const std::string& de
db.resize(index + 1);
}
Entry& newEntry = db.at(index);
newEntry.entry.id = index;
newEntry.entry.id = static_cast<s32>(index);
assert(!newEntry.entry.valid);
@@ -552,7 +552,7 @@ int ActorDB::RetrieveId(const std::string& name) {
}
int ActorDB::GetEntryCount() {
return db.size();
return static_cast<int>(db.size());
}
ActorDB::Entry::Entry() {
@@ -20,11 +20,11 @@ void OnGameFrameUpdateInfiniteAmmo() {
return;
}
AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS);
AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS);
AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG);
AMMO(ITEM_BOW) = CUR_CAPACITY(UPG_QUIVER);
AMMO(ITEM_SLINGSHOT) = CUR_CAPACITY(UPG_BULLET_BAG);
AMMO(ITEM_STICK) = static_cast<s8>(CUR_CAPACITY(UPG_STICKS));
AMMO(ITEM_NUT) = static_cast<s8>(CUR_CAPACITY(UPG_NUTS));
AMMO(ITEM_BOMB) = static_cast<s8>(CUR_CAPACITY(UPG_BOMB_BAG));
AMMO(ITEM_BOW) = static_cast<s8>(CUR_CAPACITY(UPG_QUIVER));
AMMO(ITEM_SLINGSHOT) = static_cast<s8>(CUR_CAPACITY(UPG_BULLET_BAG));
if (INV_CONTENT(ITEM_BOMBCHU) != ITEM_NONE) {
int chuCapacity = 50;
if (IS_RANDO && RAND_GET_OPTION(RSK_BOMBCHU_BAG).Is(RO_BOMBCHU_BAG_PROGRESSIVE)) {
@@ -30,7 +30,8 @@ static void RegisterHurtContainer() {
UpdateHurtContainerModeState();
}
COND_HOOK(OnLoadGame, hurtEnabled != CVAR_HURT_CONTAINER_VALUE, [](int32_t) { UpdateHurtContainerModeState(); });
COND_HOOK(OnLoadGame, static_cast<int32_t>(hurtEnabled) != CVAR_HURT_CONTAINER_VALUE,
[](int32_t) { UpdateHurtContainerModeState(); });
COND_VB_SHOULD(VB_HEARTS_INCREASE_WITH_CONTAINERS, CVAR_HURT_CONTAINER_VALUE, {
*should = false;
@@ -26,7 +26,7 @@ static bool MirroredWorld_IsInDungeon(int32_t sceneNum) {
}
static void MirroredWorld_InitRandomSeed(int32_t sceneNum, uint64_t* randState) {
uint32_t seed =
uint64_t seed =
sceneNum + (IS_RANDO ? Rando::Context::GetInstance()->GetSeed() : gSaveContext.ship.stats.fileCreatedAt);
ShipUtils::RandInit(seed, randState);
}
@@ -3,9 +3,10 @@
extern "C" SaveContext gSaveContext;
#define BOSS_DEFEAT_TIMESTAMP(actorID, timestamp) \
COND_ID_HOOK(OnBossDefeat, actorID, true, \
[](void* refActor) { gSaveContext.ship.stats.itemTimestamp[timestamp] = GAMEPLAYSTAT_TOTAL_TIME; });
#define BOSS_DEFEAT_TIMESTAMP(actorID, timestamp) \
COND_ID_HOOK(OnBossDefeat, actorID, true, [](void* refActor) { \
gSaveContext.ship.stats.itemTimestamp[timestamp] = static_cast<uint32_t>(GAMEPLAYSTAT_TOTAL_TIME); \
});
static void RegisterBossDefeatTimestamps() {
BOSS_DEFEAT_TIMESTAMP(ACTOR_BOSS_GOMA, TIMESTAMP_DEFEAT_GOHMA);
@@ -21,9 +21,10 @@ void Custom_EnMThunder_Update(Actor* thisx, PlayState* play) {
// func_80A9F314(play, this->dimmingIntensity);
blueRadius = enMThunder->spinAttackTimer;
redGreen = (u32)(blueRadius * 255.0f) & 0xFF;
Lights_PointNoGlowSetInfo(&enMThunder->lightInfo, enMThunder->actor.world.pos.x, enMThunder->actor.world.pos.y,
enMThunder->actor.world.pos.z, redGreen, redGreen, (u32)(blueRadius * 100.0f),
(s32)(blueRadius * 800.0f));
Lights_PointNoGlowSetInfo(&enMThunder->lightInfo, static_cast<s16>(enMThunder->actor.world.pos.x),
static_cast<s16>(enMThunder->actor.world.pos.y),
static_cast<s16>(enMThunder->actor.world.pos.z), redGreen, redGreen,
(u32)(blueRadius * 100.0f), (s32)(blueRadius * 800.0f));
}
void OnEnMThunderInitReplaceUpdateWithCustom(void* thunder) {
@@ -1,6 +1,7 @@
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/ResourceManagerHelpers.h"
#include "soh/ShipInit.hpp"
#include "soh/ResourceManagerHelpers.h"
extern "C" {
#include "align_asset_macro.h"
@@ -58,7 +58,7 @@ std::string convertDayTime(uint32_t dayTime) {
}
std::string convertNaviTime(uint32_t value) {
uint32_t totalSeconds = value * 0.05;
uint32_t totalSeconds = value / 20;
uint32_t ss = totalSeconds % 60;
uint32_t mm = totalSeconds / 60;
return fmt::format("{:0>2}:{:0>2}", mm, ss);
@@ -70,12 +70,12 @@ std::string formatHotWaterDisplay(uint32_t value) {
return fmt::format("{:0>2}:{:0>2}", mm, ss);
}
std::string formatTimeDisplay(uint32_t value) {
uint32_t sec = value / 10;
uint32_t hh = sec / 3600;
uint32_t mm = (sec - hh * 3600) / 60;
uint32_t ss = sec - hh * 3600 - mm * 60;
uint32_t ds = value % 10;
std::string formatTimeDisplay(uint64_t value) {
uint64_t sec = value / 10;
uint64_t hh = sec / 3600;
uint64_t mm = (sec - hh * 3600) / 60;
uint64_t ss = sec - hh * 3600 - mm * 60;
uint64_t ds = value % 10;
return fmt::format("{}:{:0>2}:{:0>2}.{}", hh, mm, ss, ds);
}
+2 -2
View File
@@ -65,8 +65,8 @@ void Warp(WarpPoint& warpPoint) {
for (int buttonIndex = 0; buttonIndex < ARRAY_COUNT(gSaveContext.buttonStatus); buttonIndex++) {
gSaveContext.buttonStatus[buttonIndex] = BTN_ENABLED;
}
gSaveContext.forceRisingButtonAlphas = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC =
0;
gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = 0;
gSaveContext.forceRisingButtonAlphas = 0;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP);
gSaveContext.entranceIndex = warpPoint.entranceId;
+20 -10
View File
@@ -586,24 +586,34 @@ void AudioEditor::DrawElement() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
if (ImGui::BeginChild("SfxOptions", ImVec2(0, -8))) {
SohGui::mSohMenu->MenuDrawItem(lowHpAlarm, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(naviCall, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(enemyProx, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(lowHpAlarm, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(naviCall, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(enemyProx, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
if (!CVarGetInteger(CVAR_AUDIO("EnemyBGMDisable"), 0)) {
SohGui::mSohMenu->MenuDrawItem(leeverProx, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(leeverProx, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
}
SohGui::mSohMenu->MenuDrawItem(leadingMusic, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(displaySeqName, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(ovlDuration, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(voicePitch, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(leadingMusic, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(displaySeqName, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(ovlDuration, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(voicePitch, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
ImGui::SameLine();
ImGui::SetCursorPosY(ImGui::GetCursorPos().y + 40.f);
if (UIWidgets::Button("Reset##linkVoiceFreqMultiplier",
UIWidgets::ButtonOptions().Size(ImVec2(80, 36)).Padding(ImVec2(5.0f, 0.0f)))) {
CVarSetFloat(CVAR_AUDIO("LinkVoiceFreqMultiplier"), 1.0f);
}
SohGui::mSohMenu->MenuDrawItem(randomAudioGenModes, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(lowerOctaves, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(randomAudioGenModes,
static_cast<uint32_t>(ImGui::GetContentRegionAvail().x), THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(lowerOctaves, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
}
ImGui::EndChild();
ImGui::EndTable();
+6 -5
View File
@@ -302,7 +302,7 @@ void FileChoose_DrawBossRushMenuWindowContents(FileChooseContext* fileChooseCont
uint8_t language = (gSaveContext.language == LANGUAGE_JPN) ? LANGUAGE_ENG : gSaveContext.language;
uint8_t listOffset = fileChooseContext->bossRushOffset;
uint8_t textAlpha = fileChooseContext->bossRushUIAlpha;
int16_t textAlpha = fileChooseContext->bossRushUIAlpha;
// Draw arrows to indicate that the list can scroll up or down.
// Arrow up
@@ -351,12 +351,13 @@ void FileChoose_DrawBossRushMenuWindowContents(FileChooseContext* fileChooseCont
G_TX_NOLOD);
FileChoose_DrawTextRec(fileChooseContext->state.gfxCtx, fileChooseContext->stickLeftPrompt.arrowColorR,
fileChooseContext->stickLeftPrompt.arrowColorG,
fileChooseContext->stickLeftPrompt.arrowColorB, textAlpha, 160, (92 + textYOffset),
0.42f, 0, 0, -1.0f, 1.0f);
fileChooseContext->stickLeftPrompt.arrowColorB, textAlpha, 160.0f,
static_cast<f32>(92 + textYOffset), 0.42f, 0, 0, -1.0f, 1.0f);
FileChoose_DrawTextRec(fileChooseContext->state.gfxCtx, fileChooseContext->stickRightPrompt.arrowColorR,
fileChooseContext->stickRightPrompt.arrowColorG,
fileChooseContext->stickRightPrompt.arrowColorB, textAlpha, (171 + finalKerning),
(92 + textYOffset), 0.42f, 0, 0, 1.0f, 1.0f);
fileChooseContext->stickRightPrompt.arrowColorB, textAlpha,
static_cast<f32>(171 + finalKerning), static_cast<f32>(92 + textYOffset), 0.42f, 0,
0, 1.0f, 1.0f);
}
}
@@ -80,7 +80,7 @@ void SohInputEditorWindow::UpdateElement() {
Ship::Context::GetRawInstance()->GetControlDeck()->BlockGameInput(INPUT_EDITOR_WINDOW_GAME_INPUT_BLOCK_ID);
// continue to block input for a third of a second after getting the mapping
mGameInputBlockTimer = ImGui::GetIO().Framerate / 3;
mGameInputBlockTimer = static_cast<s32>(ImGui::GetIO().Framerate / 3);
if (mMappingInputBlockTimer != INT32_MAX) {
mMappingInputBlockTimer--;
@@ -101,7 +101,7 @@ void SohInputEditorWindow::UpdateElement() {
}
if (Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GamepadNavigationEnabled()) {
mMappingInputBlockTimer = ImGui::GetIO().Framerate / 3;
mMappingInputBlockTimer = static_cast<s32>(ImGui::GetIO().Framerate / 3);
} else {
mMappingInputBlockTimer = INT32_MAX;
}
@@ -908,7 +908,7 @@ void SohInputEditorWindow::DrawRumbleSection(uint8_t port) {
mRumbleMappingToTest->StopRumble();
mRumbleMappingToTest = nullptr;
} else {
mRumbleTimer = ImGui::GetIO().Framerate;
mRumbleTimer = static_cast<s32>(ImGui::GetIO().Framerate);
mRumbleMappingToTest = mapping;
}
}
@@ -1102,9 +1102,9 @@ void SohInputEditorWindow::DrawLEDSection(uint8_t port) {
if (ImGui::ColorEdit3("", (float*)&colorVec,
ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel)) {
Color_RGB8 color;
color.r = colorVec.x * 255.0;
color.g = colorVec.y * 255.0;
color.b = colorVec.z * 255.0;
color.r = static_cast<u8>(colorVec.x * 255.0);
color.g = static_cast<u8>(colorVec.y * 255.0);
color.b = static_cast<u8>(colorVec.z * 255.0);
CVarSetColor24(CVAR_SETTING("LEDPort1Color"), color);
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
@@ -1336,8 +1336,9 @@ void SohInputEditorWindow::DrawOcarinaControlPanel() {
ImGui::SetCursorPos(ImVec2(cursor.x, cursor.y + 5));
CheckboxOptions checkOpt = CheckboxOptions().Color(THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(dpadOcarina, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(rightStickOcarina, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(dpadOcarina, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x), THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(rightStickOcarina, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
CVarCheckbox("Customize Ocarina Controls", CVAR_SETTING("CustomOcarina.Enabled"), checkOpt);
if (!CVarGetInteger(CVAR_SETTING("CustomOcarina.Enabled"), 0)) {
@@ -1369,10 +1370,11 @@ void SohInputEditorWindow::DrawOcarinaControlPanel() {
void SohInputEditorWindow::DrawCameraControlPanel() {
ImVec2 cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
SohGui::mSohMenu->MenuDrawItem(mouseControl, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(mouseControl, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x), THEME_COLOR);
cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
SohGui::mSohMenu->MenuDrawItem(mouseAutoCapture, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(mouseAutoCapture, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
Ship::GuiWindow::BeginGroupPanel("Aiming/First-Person Camera", ImGui::GetContentRegionAvail());
CVarCheckbox("Right Stick Aiming", CVAR_SETTING("Controls.RightStickAim"),
@@ -1440,7 +1442,7 @@ void SohInputEditorWindow::DrawCameraControlPanel() {
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
Ship::GuiWindow::BeginGroupPanel("Third-Person Camera", ImGui::GetContentRegionAvail());
SohGui::mSohMenu->MenuDrawItem(freeLook, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(freeLook, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x), THEME_COLOR);
CVarCheckbox("Invert Camera X Axis", CVAR_SETTING("FreeLook.InvertXAxis"),
CheckboxOptions().Color(THEME_COLOR).Tooltip("Inverts the Camera X Axis in:\n-Free look"));
CVarCheckbox(
@@ -1473,8 +1475,8 @@ void SohInputEditorWindow::DrawDpadControlPanel() {
ImVec2 cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
Ship::GuiWindow::BeginGroupPanel("D-Pad Options", ImGui::GetContentRegionAvail());
SohGui::mSohMenu->MenuDrawItem(dpadPause, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(dpadText, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(dpadPause, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x), THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(dpadText, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x), THEME_COLOR);
if (!CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0) && !CVarGetInteger(CVAR_SETTING("DpadInText"), 0)) {
ImGui::BeginDisabled();
@@ -1980,7 +1980,7 @@ void DrawSillyTab() {
UIWidgets::Separator(true, true, 2.0f, 2.0f);
SohGui::mSohMenu->MenuDrawItem(goronNeck, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::mSohMenu->MenuDrawItem(goronNeck, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x), THEME_COLOR);
Reset_Option_Single("Reset##Goron_NeckLength", CVAR_COSMETIC("Goron.NeckLength"));
UIWidgets::Separator(true, true, 2.0f, 2.0f);
@@ -29,23 +29,21 @@ extern "C" void CustomLogoTitle_Draw(TitleContext* titleContext, uint8_t logoToD
u16 y;
u16 idx;
s32 pad1;
Vec3f v3;
Vec3f v1;
Vec3f v2;
s32 pad2[2];
OPEN_DISPS(titleContext->state.gfxCtx);
v3.x = 69;
v3.y = 69;
v3.z = 69;
v2.x = -4949.148;
v2.y = 4002.5417;
v1.x = 0;
v1.y = 0;
v1.z = 0;
v2.z = 1119.0837;
v3.x = 69.0f;
v3.y = 69.0f;
v3.z = 69.0f;
v2.x = -4949.148f;
v2.y = 4002.5417f;
v1.x = 0.0f;
v1.y = 0.0f;
v1.z = 0.0f;
v2.z = 1119.0837f;
func_8002EABC(&v1, &v2, &v3, titleContext->state.gfxCtx);
gSPSetLights1(POLY_OPA_DISP++, sTitleLights);
@@ -111,9 +109,10 @@ extern "C" void CustomLogoTitle_Draw(TitleContext* titleContext, uint8_t logoToD
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gEffIceFragment3DL);
}
Environment_FillScreen(titleContext->state.gfxCtx, 0, 0, 0, (s16)titleContext->coverAlpha, FILL_SCREEN_XLU);
Environment_FillScreen(titleContext->state.gfxCtx, 0, 0, 0, static_cast<u8>(titleContext->coverAlpha),
FILL_SCREEN_XLU);
sTitleRotY += (300 * CVarGetFloat(CVAR_COSMETIC("N64Logo.SpinSpeed"), 1.0f));
sTitleRotY += static_cast<s16>(300 * CVarGetFloat(CVAR_COSMETIC("N64Logo.SpinSpeed"), 1.0f));
CLOSE_DISPS(titleContext->state.gfxCtx);
}
@@ -100,7 +100,7 @@ void PatchArrowTipTexture() {
if (!fixTexturesOOB) {
// Unpatch the other texture fix
for (size_t i = 4; i < 8; i++) {
int instruction = start + i;
size_t instruction = start + i;
std::string unpatchName = "arrowTipTextureWithSizeFix_" + std::to_string(instruction);
ResourceMgr_UnpatchGfxByName(dlist, unpatchName.c_str());
}
@@ -117,13 +117,13 @@ void PatchArrowTipTexture() {
ResourceMgr_UnpatchGfxByName(dlist, unpatchName2.c_str());
for (size_t i = 4; i < 8; i++) {
int instruction = start + i;
size_t instruction = start + i;
std::string patchName = "arrowTipTextureWithSizeFix_" + std::to_string(instruction);
if (i == 0) {
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), instruction, gsSPNoOp());
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), static_cast<int>(instruction), gsSPNoOp());
} else {
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), instruction,
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), static_cast<int>(instruction),
arrowTipTextureWithSizeFixGfx[i - 1]);
}
}
@@ -148,7 +148,7 @@ void PatchDekuStickTextureOverflow() {
if (!CVarGetInteger(CVAR_ENHANCEMENT("FixTexturesOOB"), 0)) {
// Unpatch the other texture fix
for (size_t i = 0; i < 8; i++) {
int instruction = start + i;
size_t instruction = start + i;
std::string unpatchName = "dekuStickWithSizeFix_" + std::to_string(instruction);
ResourceMgr_UnpatchGfxByName(dlist, unpatchName.c_str());
}
@@ -165,13 +165,14 @@ void PatchDekuStickTextureOverflow() {
ResourceMgr_UnpatchGfxByName(dlist, unpatchName2.c_str());
for (size_t i = 0; i < 8; i++) {
int instruction = start + i;
size_t instruction = start + i;
std::string patchName = "dekuStickWithSizeFix_" + std::to_string(instruction);
if (i == 0) {
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), instruction, gsSPNoOp());
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), static_cast<int>(instruction), gsSPNoOp());
} else {
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), instruction, dekuStickTexWithSizeFixGfx[i - 1]);
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), static_cast<int>(instruction),
dekuStickTexWithSizeFixGfx[i - 1]);
}
}
}
@@ -198,7 +199,7 @@ void PatchFreezardTextureOverflow() {
if (!fixTexturesOOB) {
// Unpatch the other texture fix
for (size_t i = 0; i < 8; i++) {
int instruction = start + i;
size_t instruction = start + i;
std::string unpatchName = "freezardBodyTextureWithFormatFix_" + std::to_string(instruction);
ResourceMgr_UnpatchGfxByName(dlist, unpatchName.c_str());
}
@@ -215,13 +216,13 @@ void PatchFreezardTextureOverflow() {
ResourceMgr_UnpatchGfxByName(dlist, unpatchName2.c_str());
for (size_t i = 0; i < 8; i++) {
int instruction = start + i;
size_t instruction = start + i;
std::string patchName = "freezardBodyTextureWithFormatFix_" + std::to_string(instruction);
if (i == 0) {
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), instruction, gsSPNoOp());
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), static_cast<int>(instruction), gsSPNoOp());
} else {
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), instruction,
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), static_cast<int>(instruction),
freezardBodyTextureWithFormatFixGfx[i - 1]);
}
}
@@ -250,7 +251,7 @@ void PatchIronKnuckleTextureOverflow() {
if (!fixTexturesOOB) {
// Unpatch the other texture fix
for (size_t i = 0; i < 8; i++) {
int instruction = start + i;
size_t instruction = start + i;
std::string unpatchName = "ironKnuckleFireTexWithSizeFix_" + std::to_string(instruction);
ResourceMgr_UnpatchGfxByName(dlist, unpatchName.c_str());
}
@@ -267,13 +268,13 @@ void PatchIronKnuckleTextureOverflow() {
ResourceMgr_UnpatchGfxByName(dlist, unpatchName2.c_str());
for (size_t i = 0; i < 8; i++) {
int instruction = start + i;
size_t instruction = start + i;
std::string patchName = "ironKnuckleFireTexWithSizeFix_" + std::to_string(instruction);
if (i == 0) {
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), instruction, gsSPNoOp());
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), static_cast<int>(instruction), gsSPNoOp());
} else {
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), instruction,
ResourceMgr_PatchGfxByName(dlist, patchName.c_str(), static_cast<int>(instruction),
ironKnuckleFireTexWithFormatFixGfx[i - 1]);
}
}
@@ -119,8 +119,6 @@ extern "C" MessageTableEntry* sGerMessageEntryTablePtr;
extern "C" MessageTableEntry* sFraMessageEntryTablePtr;
CustomMessage CustomMessage::LoadVanillaMessageTableEntry(uint16_t textId) {
const char* foundSeg;
const char* nextSeg;
MessageTableEntry* msgEntry = sNesMessageEntryTablePtr;
u16 bufferId = textId;
CustomMessage msg;
+36 -36
View File
@@ -66,7 +66,7 @@ static bool ActorSpawnHandler(std::shared_ptr<Ship::Console> Console, const std:
if (nameId == -1) {
try {
actorId = std::stoi(args[1]);
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("Invalid actor ID");
return 1;
}
@@ -91,13 +91,13 @@ static bool ActorSpawnHandler(std::shared_ptr<Ship::Console> Console, const std:
[[fallthrough]];
case 6:
if (args[3][0] != ',') {
spawnPoint.pos.x = std::stoi(args[3]);
spawnPoint.pos.x = static_cast<f32>(std::stoi(args[3]));
}
if (args[4][0] != ',') {
spawnPoint.pos.y = std::stoi(args[4]);
spawnPoint.pos.y = static_cast<f32>(std::stoi(args[4]));
}
if (args[5][0] != ',') {
spawnPoint.pos.z = std::stoi(args[5]);
spawnPoint.pos.z = static_cast<f32>(std::stoi(args[5]));
}
}
@@ -133,7 +133,7 @@ static bool SetPlayerHealthHandler(std::shared_ptr<Ship::Console> Console, const
try {
health = std::stoi(args[1]);
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Health value must be an integer.");
return 1;
}
@@ -172,7 +172,7 @@ static bool RupeeHandler(std::shared_ptr<Ship::Console> Console, const std::vect
int rupeeAmount;
try {
rupeeAmount = std::stoi(args[1]);
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Rupee count must be an integer.");
return 1;
}
@@ -240,7 +240,7 @@ static bool AddAmmoHandler(std::shared_ptr<Ship::Console> Console, const std::ve
try {
amount = std::stoi(args[2]);
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("Ammo count must be an integer");
return 1;
}
@@ -281,7 +281,7 @@ static bool TakeAmmoHandler(std::shared_ptr<Ship::Console> Console, const std::v
try {
amount = std::stoi(args[2]);
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("Ammo count must be an integer");
return 1;
}
@@ -337,7 +337,7 @@ static bool BottleHandler(std::shared_ptr<Ship::Console> Console, const std::vec
unsigned int slot;
try {
slot = std::stoi(args[2]);
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Bottle slot must be an integer.");
return 1;
}
@@ -354,7 +354,7 @@ static bool BottleHandler(std::shared_ptr<Ship::Console> Console, const std::vec
return 1;
}
gSaveContext.inventory.items[0x11 + slot] = it->second;
gSaveContext.inventory.items[0x11 + slot] = static_cast<u8>(it->second);
return 0;
}
@@ -415,7 +415,7 @@ static bool EntranceHandler(std::shared_ptr<Ship::Console> Console, const std::v
try {
entrance = std::stoi(args[1], nullptr, 16);
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Entrance value must be a Hex number.");
return 1;
}
@@ -581,7 +581,7 @@ static bool StateSlotSelectHandler(std::shared_ptr<Ship::Console> Console, const
try {
slot = std::stoi(args[1], nullptr, 10);
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] SaveState slot value must be a number.");
return 1;
}
@@ -606,7 +606,7 @@ static bool InvisibleHandler(std::shared_ptr<Ship::Console> Console, const std::
try {
state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Invisible value must be a number.");
return 1;
}
@@ -633,7 +633,7 @@ static bool GiantLinkHandler(std::shared_ptr<Ship::Console> Console, const std::
try {
state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Giant value must be a number.");
return 1;
}
@@ -661,7 +661,7 @@ static bool MinishLinkHandler(std::shared_ptr<Ship::Console> Console, const std:
try {
state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Minish value must be a number.");
return 1;
}
@@ -689,7 +689,7 @@ static bool AddHeartContainerHandler(std::shared_ptr<Ship::Console> Console, con
try {
hearts = std::stoi(args[1]);
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Hearts value must be an integer.");
return 1;
}
@@ -721,7 +721,7 @@ static bool RemoveHeartContainerHandler(std::shared_ptr<Ship::Console> Console,
try {
hearts = std::stoi(args[1]);
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Hearts value must be an integer.");
return 1;
}
@@ -753,9 +753,9 @@ static bool GravityHandler(std::shared_ptr<Ship::Console> Console, const std::ve
GameInteractionEffect::ModifyGravity effect;
try {
effect.parameters[0] =
Ship::Math::clamp(std::stoi(args[1], nullptr, 10), GI_GRAVITY_LEVEL_LIGHT, GI_GRAVITY_LEVEL_HEAVY);
} catch (std::invalid_argument const& ex) {
effect.parameters[0] = static_cast<int32_t>(Ship::Math::clamp(
static_cast<float>(std::stoi(args[1], nullptr, 10)), GI_GRAVITY_LEVEL_LIGHT, GI_GRAVITY_LEVEL_HEAVY));
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Gravity value must be a number.");
return 1;
}
@@ -780,7 +780,7 @@ static bool NoUIHandler(std::shared_ptr<Ship::Console> Console, const std::vecto
try {
state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] No UI value must be a number.");
return 1;
}
@@ -822,7 +822,7 @@ static bool DefenseModifierHandler(std::shared_ptr<Ship::Console> Console, const
try {
effect.parameters[0] = std::stoi(args[1], nullptr, 10);
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Defense modifier value must be a number.");
return 1;
}
@@ -853,7 +853,7 @@ static bool DamageHandler(std::shared_ptr<Ship::Console> Console, const std::vec
}
effect.parameters[0] = -value;
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Damage value must be a number.");
return 1;
}
@@ -884,7 +884,7 @@ static bool HealHandler(std::shared_ptr<Ship::Console> Console, const std::vecto
}
effect.parameters[0] = value;
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Damage value must be a number.");
return 1;
}
@@ -937,7 +937,7 @@ static bool NoZHandler(std::shared_ptr<Ship::Console> Console, const std::vector
try {
state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] NoZ value must be a number.");
return 1;
}
@@ -965,7 +965,7 @@ static bool OneHitKOHandler(std::shared_ptr<Ship::Console> Console, const std::v
try {
state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] One-hit KO value must be a number.");
return 1;
}
@@ -993,7 +993,7 @@ static bool PacifistHandler(std::shared_ptr<Ship::Console> Console, const std::v
try {
state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Pacifist value must be a number.");
return 1;
}
@@ -1021,7 +1021,7 @@ static bool PaperLinkHandler(std::shared_ptr<Ship::Console> Console, const std::
try {
state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Paper Link value must be a number.");
return 1;
}
@@ -1050,7 +1050,7 @@ static bool RainstormHandler(std::shared_ptr<Ship::Console> Console, const std::
try {
state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Rainstorm value must be a number.");
return 1;
}
@@ -1078,7 +1078,7 @@ static bool ReverseControlsHandler(std::shared_ptr<Ship::Console> Console, const
try {
state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Reverse controls value must be a number.");
return 1;
}
@@ -1107,7 +1107,7 @@ static bool UpdateRupeesHandler(std::shared_ptr<Ship::Console> Console, const st
try {
effect.parameters[0] = std::stoi(args[1], nullptr, 10);
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Rupee value must be a number.");
return 1;
}
@@ -1132,7 +1132,7 @@ static bool SpeedModifierHandler(std::shared_ptr<Ship::Console> Console, const s
try {
effect.parameters[0] = std::stoi(args[1], nullptr, 10);
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Speed modifier value must be a number.");
return 1;
}
@@ -1253,7 +1253,7 @@ static bool KnockbackHandler(std::shared_ptr<Ship::Console> Console, const std::
}
effect.parameters[0] = value;
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Knockback value must be a number.");
return 1;
}
@@ -1328,7 +1328,7 @@ static bool GenerateRandoHandler(std::shared_ptr<Ship::Console> Console, const s
if (GenerateRandomizer(seed + std::to_string(value))) {
return 0;
}
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] seed|count value must be a number.");
return 1;
}
@@ -1459,7 +1459,7 @@ static bool AvailableChecksProcessUndiscoveredExitsHandler(std::shared_ptr<Ship:
} else {
try {
enabled = std::stoi(args[1]);
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Enable should be 0 or 1");
return 1;
}
@@ -1481,7 +1481,7 @@ static bool AvailableChecksRecalculateHandler(std::shared_ptr<Ship::Console> Con
if (args.size() > 1) {
try {
startingRegion = static_cast<RandomizerRegion>(std::stoi(args[1]));
} catch (std::invalid_argument const& ex) {
} catch ([[maybe_unused]] std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Region should be a number");
return 1;
}
@@ -167,7 +167,7 @@ void FindMessage(PlayState* play, const uint16_t textId, const uint8_t language)
messageTableEntry++;
nextSeg = messageTableEntry->segment;
font->msgOffset = foundSeg - seg;
font->msgLength = nextSeg - foundSeg;
font->msgLength = static_cast<u32>(nextSeg - foundSeg);
}
static const char* msgStaticTbl[] = {
@@ -208,11 +208,11 @@ void MessageDebug_StartTextBox(const char* tableId, uint16_t textId, uint8_t lan
const uintptr_t src = font->msgOffset;
memcpy(font->msgBuf, reinterpret_cast<void const*>(src), font->msgLength);
} else {
constexpr int maxBufferSize = sizeof(font->msgBuf);
constexpr size_t maxBufferSize = sizeof(font->msgBuf);
const CustomMessage messageEntry = CustomMessageManager::Instance->RetrieveMessage(tableId, textId);
font->charTexBuf[0] = (messageEntry.GetTextBoxType() << 4) | messageEntry.GetTextBoxPosition();
font->msgLength =
SohUtils::CopyStringToCharBuffer(buffer, messageEntry.GetForLanguage(language), maxBufferSize);
font->msgLength = static_cast<u32>(
SohUtils::CopyStringToCharBuffer(buffer, messageEntry.GetForLanguage(language), maxBufferSize));
msgCtx->msgLength = static_cast<int32_t>(font->msgLength);
}
msgCtx->textBoxProperties = font->charTexBuf[0];
@@ -250,8 +250,8 @@ void MessageDebug_StartTextBox(const char* tableId, uint16_t textId, uint8_t lan
}
msgCtx->textboxColorAlphaCurrent = 0;
}
msgCtx->choiceNum = msgCtx->textUnskippable = msgCtx->textboxEndType = 0;
msgCtx->msgBufPos = msgCtx->unk_E3D0 = msgCtx->textDrawPos = 0;
msgCtx->choiceNum = msgCtx->textboxEndType = 0;
msgCtx->textUnskippable = msgCtx->msgBufPos = msgCtx->unk_E3D0 = msgCtx->textDrawPos = 0;
msgCtx->talkActor = &player->actor;
msgCtx->msgMode = MSGMODE_TEXT_START;
msgCtx->stateTimer = 0;
@@ -614,7 +614,7 @@ void CreateActorSpecificData() {
};
actorSpecificData[ACTOR_EN_SKB] = [](s16 params) -> s16 {
u8 size = params;
u8 size = static_cast<u8>(params);
ImGui::InputScalar("Size", ImGuiDataType_U8, &size);
return size;
@@ -753,7 +753,7 @@ void CreateActorSpecificData() {
piece = false;
}
u8 textId = params;
u8 textId = static_cast<u8>(params);
if (!piece && !fishingSign) {
if (ImGui::InputScalar("Text ID", ImGuiDataType_U8, &textId)) {
textId |= 0x300;
+22 -16
View File
@@ -178,10 +178,10 @@ void CreateCylinderData() {
cylinderVtx.push_back(gdSPDefVtxN(0, 128, 0, 0, 0, 0, 127, 0, 0xFF)); // Top center vertex
// Create two rings of vertices
for (int i = 0; i < CYL_DIVS; ++i) {
short vtx_x = floorf(0.5f + cosf(2.f * M_PI * i / CYL_DIVS) * 128.f);
short vtx_z = floorf(0.5f - sinf(2.f * M_PI * i / CYL_DIVS) * 128.f);
signed char norm_x = cosf(2.f * M_PI * i / CYL_DIVS) * 127.f;
signed char norm_z = -sinf(2.f * M_PI * i / CYL_DIVS) * 127.f;
short vtx_x = static_cast<short>(floorf(0.5f + cosf(static_cast<f32>(2.f * M_PI * i / CYL_DIVS)) * 128.f));
short vtx_z = static_cast<short>(floorf(0.5f - sinf(static_cast<f32>(2.f * M_PI * i / CYL_DIVS)) * 128.f));
signed char norm_x = static_cast<signed char>(cosf(static_cast<f32>(2.f * M_PI * i / CYL_DIVS)) * 127.f);
signed char norm_z = static_cast<signed char>(-sinf(static_cast<f32>(2.f * M_PI * i / CYL_DIVS)) * 127.f);
cylinderVtx.push_back(gdSPDefVtxN(vtx_x, 0, vtx_z, 0, 0, norm_x, 0, norm_z, 0xFF));
cylinderVtx.push_back(gdSPDefVtxN(vtx_x, 128, vtx_z, 0, 0, norm_x, 0, norm_z, 0xFF));
}
@@ -337,8 +337,6 @@ void InitGfx(std::vector<Gfx>& gfx, ColRenderSetting setting) {
uint32_t blc1;
uint32_t blc2;
uint8_t alpha;
uint64_t cm;
uint32_t gm;
if (setting == ColRenderTransparent) {
rm = Z_CMP | IM_RD | CVG_DST_FULL | FORCE_BL;
@@ -608,7 +606,9 @@ void DrawColCheckList(std::vector<Gfx>& dl, Collider** objects, int32_t count) {
Mtx m;
MtxF mt;
SkinMatrix_SetTranslate(&mt, cyl->dim.pos.x, cyl->dim.pos.y + cyl->dim.yShift, cyl->dim.pos.z);
SkinMatrix_SetTranslate(&mt, static_cast<f32>(cyl->dim.pos.x),
static_cast<f32>(cyl->dim.pos.y + cyl->dim.yShift),
static_cast<f32>(cyl->dim.pos.z));
MtxF ms;
int32_t radius = cyl->dim.radius == 0 ? 1 : cyl->dim.radius;
SkinMatrix_SetScale(&ms, radius / 128.0f, cyl->dim.height / 128.0f, radius / 128.0f);
@@ -686,14 +686,20 @@ void DrawWaterbox(std::vector<Gfx>& dl, WaterBox* water, float water_max_depth =
}
Vec3f vtx[] = {
{ water->xMin, water->ySurface, water->zMin + water->zLength },
{ water->xMin + water->xLength, water->ySurface, water->zMin + water->zLength },
{ water->xMin + water->xLength, water->ySurface, water->zMin },
{ water->xMin, water->ySurface, water->zMin },
{ water->xMin, water_max_depth, water->zMin + water->zLength },
{ water->xMin + water->xLength, water_max_depth, water->zMin + water->zLength },
{ water->xMin + water->xLength, water_max_depth, water->zMin },
{ water->xMin, water_max_depth, water->zMin },
{ static_cast<f32>(water->xMin), static_cast<f32>(water->ySurface),
static_cast<f32>(water->zMin + water->zLength) },
{ static_cast<f32>(water->xMin + water->xLength), static_cast<f32>(water->ySurface),
static_cast<f32>(water->zMin + water->zLength) },
{ static_cast<f32>(water->xMin + water->xLength), static_cast<f32>(water->ySurface),
static_cast<f32>(water->zMin) },
{ static_cast<f32>(water->xMin), static_cast<f32>(water->ySurface), static_cast<f32>(water->zMin) },
{ static_cast<f32>(water->xMin), static_cast<f32>(water_max_depth),
static_cast<f32>(water->zMin + water->zLength) },
{ static_cast<f32>(water->xMin + water->xLength), static_cast<f32>(water_max_depth),
static_cast<f32>(water->zMin + water->zLength) },
{ static_cast<f32>(water->xMin + water->xLength), static_cast<f32>(water_max_depth),
static_cast<f32>(water->zMin) },
{ static_cast<f32>(water->xMin), static_cast<f32>(water_max_depth), static_cast<f32>(water->zMin) },
};
DrawQuad(dl, vtx[0], vtx[1], vtx[2], vtx[3]);
DrawQuad(dl, vtx[0], vtx[3], vtx[7], vtx[4]);
@@ -738,7 +744,7 @@ template <typename T> size_t ResetVector(T& vec) {
size_t oldSize = vec.size();
vec.clear();
// Reserve slightly more space than last frame to account for variance (such as different amounts of bg actors)
vec.reserve(oldSize * 1.2);
vec.reserve(static_cast<size_t>(oldSize * 1.2f));
return vec.capacity();
}
@@ -310,7 +310,7 @@ void DrawInfoTab() {
}
gSaveContext.magicCapacity = gSaveContext.magicLevel * 0x30; // Set to get the bar drawn in the UI
if (gSaveContext.magic > gSaveContext.magicCapacity) {
gSaveContext.magic = gSaveContext.magicCapacity; // Clamp magic to new max
gSaveContext.magic = static_cast<s8>(gSaveContext.magicCapacity); // Clamp magic to new max
}
int32_t magic = (int32_t)gSaveContext.magic;
@@ -1141,7 +1141,7 @@ void DrawFlagsTab() {
[&]() {
if (j == 0) {
for (int k = 0xF; k >= 0; k--) {
ImGui::SameLine(37.5 + ((0xF - k) * 33.8));
ImGui::SameLine(static_cast<f32>(37.5 + ((0xF - k) * 33.8)));
ImGui::Text("%X", k);
}
}
@@ -1768,18 +1768,18 @@ void DrawPlayerTab() {
ImGui::PushItemWidth(ImGui::GetFontSize() * 12);
if (ImGui::BeginCombo("Sword", curSword)) {
if (ImGui::Selectable("None")) {
player->currentSwordItemId = ITEM_NONE;
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
player->currentSwordItemId = static_cast<s8>(ITEM_NONE);
gSaveContext.equips.buttonItems[0] = static_cast<u8>(ITEM_NONE);
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_NONE);
}
if (ImGui::Selectable("Kokiri Sword")) {
player->currentSwordItemId = ITEM_SWORD_KOKIRI;
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI;
player->currentSwordItemId = static_cast<s8>(ITEM_SWORD_KOKIRI);
gSaveContext.equips.buttonItems[0] = static_cast<u8>(ITEM_SWORD_KOKIRI);
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_KOKIRI);
}
if (ImGui::Selectable("Master Sword")) {
player->currentSwordItemId = ITEM_SWORD_MASTER;
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
player->currentSwordItemId = static_cast<s8>(ITEM_SWORD_MASTER);
gSaveContext.equips.buttonItems[0] = static_cast<u8>(ITEM_SWORD_MASTER);
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_MASTER);
}
if (ImGui::Selectable("Biggoron's Sword")) {
@@ -1787,21 +1787,21 @@ void DrawPlayerTab() {
if (gSaveContext.swordHealth < 8) {
gSaveContext.swordHealth = 8;
}
player->currentSwordItemId = ITEM_SWORD_BGS;
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS;
player->currentSwordItemId = static_cast<s8>(ITEM_SWORD_BGS);
gSaveContext.equips.buttonItems[0] = static_cast<u8>(ITEM_SWORD_BGS);
} else {
if (gSaveContext.swordHealth < 8) {
gSaveContext.swordHealth = 8;
}
player->currentSwordItemId = ITEM_SWORD_BGS;
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KNIFE;
player->currentSwordItemId = static_cast<s8>(ITEM_SWORD_BGS);
gSaveContext.equips.buttonItems[0] = static_cast<u8>(ITEM_SWORD_KNIFE);
}
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_BIGGORON);
}
if (ImGui::Selectable("Fishing Pole")) {
player->currentSwordItemId = ITEM_FISHING_POLE;
gSaveContext.equips.buttonItems[0] = ITEM_FISHING_POLE;
player->currentSwordItemId = static_cast<s8>(ITEM_FISHING_POLE);
gSaveContext.equips.buttonItems[0] = static_cast<u8>(ITEM_FISHING_POLE);
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_MASTER);
}
ImGui::EndCombo();
+2 -2
View File
@@ -144,7 +144,7 @@ void DLViewerWindow::DrawElement() {
for (size_t i = 0; i < res->Instructions.size(); i++) {
std::string id = "##CMD" + std::to_string(i);
Gfx* gfx = (Gfx*)&res->Instructions[i];
int cmd = gfx->words.w0 >> 24;
int cmd = static_cast<int>(gfx->words.w0 >> 24);
if (cmdMap.find(cmd) == cmdMap.end())
continue;
@@ -330,7 +330,7 @@ void DLViewerWindow::DrawElement() {
}
ImGui::EndGroup();
}
} catch (const std::exception& e) { ImGui::Text("Error displaying DL instructions."); }
} catch ([[maybe_unused]] const std::exception& e) { ImGui::Text("Error displaying DL instructions."); }
ImGui::PopFont();
ImGui::EndDisabled();
@@ -94,8 +94,8 @@ extern "C" void ValueViewer_Draw(GfxPrint* printer) {
void* elementValue = element.valueFn();
if (elementValue == NULL)
continue;
GfxPrint_SetColor(printer, setting.color.x * 255, setting.color.y * 255, setting.color.z * 255,
setting.color.w * 255);
GfxPrint_SetColor(printer, static_cast<u32>(setting.color.x * 255), static_cast<u32>(setting.color.y * 255),
static_cast<u32>(setting.color.z * 255), static_cast<u32>(setting.color.w * 255));
GfxPrint_SetPos(printer, setting.x, setting.y);
switch (element.type) {
case TYPE_S8:
@@ -271,7 +271,7 @@ GameInteractionEffectQueryResult KnockbackPlayer::CanBeApplied() {
}
}
void KnockbackPlayer::_Apply() {
GameInteractor::RawAction::KnockbackPlayer(parameters[0]);
GameInteractor::RawAction::KnockbackPlayer(static_cast<f32>(parameters[0]));
}
// MARK: - ModifyLinkSize
+5 -5
View File
@@ -279,7 +279,7 @@ std::string formatHexOnlyGameplayStat(uint32_t value) {
}
extern "C" char* GameplayStats_GetCurrentTime() {
std::string timeString = formatTimestampGameplayStat(GAMEPLAYSTAT_TOTAL_TIME).c_str();
std::string timeString = formatTimestampGameplayStat(static_cast<u32>(GAMEPLAYSTAT_TOTAL_TIME)).c_str();
const size_t stringLength = timeString.length();
char* timeChar = (char*)malloc(stringLength + 1); // We need to use malloc so we can free this from a C file.
strcpy(timeChar, timeString.c_str());
@@ -453,10 +453,10 @@ void DrawGameplayStatsHeader() {
GameplayStatsRow("Build Version:", (char*)gBuildVersion);
}
if (gSaveContext.ship.stats.rtaTiming) {
GameplayStatsRow("Total Time (RTA):", formatTimestampGameplayStat(GAMEPLAYSTAT_TOTAL_TIME),
GameplayStatsRow("Total Time (RTA):", formatTimestampGameplayStat(static_cast<u32>(GAMEPLAYSTAT_TOTAL_TIME)),
gSaveContext.ship.stats.gameComplete ? COLOR_GREEN : COLOR_WHITE);
} else {
GameplayStatsRow("Total Game Time:", formatTimestampGameplayStat(GAMEPLAYSTAT_TOTAL_TIME),
GameplayStatsRow("Total Game Time:", formatTimestampGameplayStat(static_cast<u32>(GAMEPLAYSTAT_TOTAL_TIME)),
gSaveContext.ship.stats.gameComplete ? COLOR_GREEN : COLOR_WHITE);
}
if (CVarGetInteger(CVAR_GAMEPLAY_STATS("ShowAdditionalTimers"), 0)) { // !Only display total game time
@@ -592,7 +592,7 @@ void DrawGameplayStatsCountsTab() {
}
void DrawGameplayStatsBreakdownTab() {
for (int i = 0; i < gSaveContext.ship.stats.tsIdx; i++) {
for (u32 i = 0; i < gSaveContext.ship.stats.tsIdx; i++) {
std::string sceneName = ResolveSceneID(gSaveContext.ship.stats.sceneTimestamps[i].scene,
gSaveContext.ship.stats.sceneTimestamps[i].room);
std::string name;
@@ -613,7 +613,7 @@ void DrawGameplayStatsBreakdownTab() {
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 4.0f, 4.0f });
ImGui::BeginTable("gameplayStatsCounts", 1, ImGuiTableFlags_BordersOuter);
ImGui::TableSetupColumn("stat", ImGuiTableColumnFlags_WidthStretch);
for (int i = 0; i < gSaveContext.ship.stats.tsIdx; i++) {
for (u32 i = 0; i < gSaveContext.ship.stats.tsIdx; i++) {
TimestampInfo tsInfo = sceneTimestampDisplay[i];
bool canShow = !tsInfo.isRoom || CVarGetInteger(CVAR_GAMEPLAY_STATS("RoomBreakdown"), 0);
if (tsInfo.time > 0 && strnlen(tsInfo.name, 40) > 1 && canShow) {
@@ -17,7 +17,7 @@ bool ItemTableManager::AddItemEntry(uint16_t tableID, uint16_t getItemID, GetIte
try {
ItemTable* itemTable = RetrieveItemTable(tableID);
return itemTable->emplace(getItemID, getItemEntry).second;
} catch (const std::out_of_range& oor) { return false; }
} catch ([[maybe_unused]] const std::out_of_range& oor) { return false; }
}
GetItemEntry ItemTableManager::RetrieveItemEntry(uint16_t tableID, uint16_t getItemID) {
@@ -27,7 +27,7 @@ GetItemEntry ItemTableManager::RetrieveItemEntry(uint16_t tableID, uint16_t getI
getItemEntry.drawItemId = getItemEntry.itemId;
getItemEntry.drawModIndex = getItemEntry.modIndex;
return getItemEntry;
} catch (std::out_of_range& oor) { return GET_ITEM_NONE; }
} catch ([[maybe_unused]] std::out_of_range& oor) { return GET_ITEM_NONE; }
}
bool ItemTableManager::ClearItemTable(uint16_t tableID) {
@@ -35,7 +35,7 @@ bool ItemTableManager::ClearItemTable(uint16_t tableID) {
ItemTable* itemTable = RetrieveItemTable(tableID);
itemTable->clear();
return true;
} catch (const std::out_of_range& oor) { return false; }
} catch ([[maybe_unused]] const std::out_of_range& oor) { return false; }
}
ItemTable* ItemTableManager::RetrieveItemTable(uint16_t tableID) {
+5 -5
View File
@@ -522,11 +522,11 @@ void KaleidoEntryOcarinaButtons::CalculateColors() {
}
void KaleidoEntryOcarinaButtons::Update(PlayState* play) {
mButtonCollected[0] = GameInteractor::RawAction::CheckFlag(FLAG_RANDOMIZER_INF, RAND_INF_HAS_OCARINA_A) > 0;
mButtonCollected[1] = GameInteractor::RawAction::CheckFlag(FLAG_RANDOMIZER_INF, RAND_INF_HAS_OCARINA_C_UP) > 0;
mButtonCollected[2] = GameInteractor::RawAction::CheckFlag(FLAG_RANDOMIZER_INF, RAND_INF_HAS_OCARINA_C_DOWN) > 0;
mButtonCollected[3] = GameInteractor::RawAction::CheckFlag(FLAG_RANDOMIZER_INF, RAND_INF_HAS_OCARINA_C_LEFT) > 0;
mButtonCollected[4] = GameInteractor::RawAction::CheckFlag(FLAG_RANDOMIZER_INF, RAND_INF_HAS_OCARINA_C_RIGHT) > 0;
mButtonCollected[0] = GameInteractor::RawAction::CheckFlag(FLAG_RANDOMIZER_INF, RAND_INF_HAS_OCARINA_A);
mButtonCollected[1] = GameInteractor::RawAction::CheckFlag(FLAG_RANDOMIZER_INF, RAND_INF_HAS_OCARINA_C_UP);
mButtonCollected[2] = GameInteractor::RawAction::CheckFlag(FLAG_RANDOMIZER_INF, RAND_INF_HAS_OCARINA_C_DOWN);
mButtonCollected[3] = GameInteractor::RawAction::CheckFlag(FLAG_RANDOMIZER_INF, RAND_INF_HAS_OCARINA_C_LEFT);
mButtonCollected[4] = GameInteractor::RawAction::CheckFlag(FLAG_RANDOMIZER_INF, RAND_INF_HAS_OCARINA_C_RIGHT);
CalculateColors();
mAchieved = false;
for (size_t i = 0; i < mButtonCollected.size(); i++) {
+2 -2
View File
@@ -26,7 +26,7 @@ typedef struct {
int16_t height; // Textbox height
int16_t width; // Textbox width
int16_t yOffset; // Addition Y offset
uint8_t noZBuffer; // Allow rendering over geometry
bool noZBuffer; // Allow rendering over geometry
Mtx* mtx; // Allocated Mtx for rendering
Vtx* vtx; // Allocated Vtx for rendering
} NameTag;
@@ -97,7 +97,7 @@ void DrawNameTag(PlayState* play, const NameTag* nameTag) {
Matrix_Translate(nameTag->actor->world.pos.x, posY, nameTag->actor->world.pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Scale(scale * (sMirrorWorldActive ? -1.0f : 1.0f), -scale, 1.0f, MTXMODE_APPLY);
Matrix_Translate(-(float)nameTag->width / 2, -nameTag->height, 0, MTXMODE_APPLY);
Matrix_Translate(static_cast<f32>(-nameTag->width / 2.0f), static_cast<f32>(-nameTag->height), 0.0f, MTXMODE_APPLY);
Matrix_ToMtx(nameTag->mtx, (char*)__FILE__, __LINE__);
nameTagDl.push_back(gsSPMatrix(nameTag->mtx, G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW));
+1 -1
View File
@@ -10,7 +10,7 @@ typedef struct {
const char* tag; // Tag identifier to filter/remove multiple tags
int16_t yOffset; // Additional Y offset to apply for the name tag
Color_RGBA8 textColor; // Text color override. Global color is used if alpha is 0
uint8_t noZBuffer; // Allow rendering over geometry
bool noZBuffer; // Allow rendering over geometry
} NameTagOptions;
// Register required hooks for nametags on startup
@@ -736,7 +736,7 @@ static void PareDownPlaythrough() {
}
// Some spheres may now be empty, remove these
for (int i = ctx->playthroughLocations.size() - 2; i >= 0; i--) {
for (size_t i = ctx->playthroughLocations.size() - 2; i >= 0; i--) {
if (ctx->playthroughLocations.at(i).size() == 0) {
ctx->playthroughLocations.erase(ctx->playthroughLocations.begin() + i);
}
@@ -112,8 +112,8 @@ void ObjComb_RandomizerUpdate(void* actor) {
PlayState* play = gPlayState;
combActor->unk_1B2 += 0x2EE0;
combActor->actionFunc(combActor, play);
combActor->actor.shape.rot.x =
Math_SinS(combActor->unk_1B2) * CLAMP_MIN(combActor->unk_1B0, 0) + combActor->actor.home.rot.x;
combActor->actor.shape.rot.x = static_cast<s16>(Math_SinS(combActor->unk_1B2) * CLAMP_MIN(combActor->unk_1B0, 0)) +
combActor->actor.home.rot.x;
}
void RegisterShuffleBeehives() {
@@ -73,32 +73,32 @@ extern "C" void EnWood02_RandomizerDraw(Actor* thisx, PlayState* play) {
// Change texture
switch (getItemCategory) {
case ITEM_CATEGORY_MAJOR:
Matrix_Scale(0.1, 0.05, 0.1, MTXMODE_APPLY);
Matrix_Scale(0.1f, 0.05f, 0.1f, MTXMODE_APPLY);
Gfx_DrawDListOpa(play, (Gfx*)gSmallMajorCrateDL);
break;
case ITEM_CATEGORY_SKULLTULA_TOKEN:
Matrix_Scale(0.1, 0.05, 0.1, MTXMODE_APPLY);
Matrix_Scale(0.1f, 0.05f, 0.1f, MTXMODE_APPLY);
Gfx_DrawDListOpa(play, (Gfx*)gSmallTokenCrateDL);
break;
case ITEM_CATEGORY_SMALL_KEY:
Matrix_Scale(0.1, 0.05, 0.1, MTXMODE_APPLY);
Matrix_Scale(0.1f, 0.05f, 0.1f, MTXMODE_APPLY);
Gfx_DrawDListOpa(play, (Gfx*)gSmallSmallKeyCrateDL);
break;
case ITEM_CATEGORY_BOSS_KEY:
Matrix_Scale(0.1, 0.05, 0.1, MTXMODE_APPLY);
Matrix_Scale(0.1f, 0.05f, 0.1f, MTXMODE_APPLY);
Gfx_DrawDListOpa(play, (Gfx*)gSmallBossKeyCrateDL);
break;
case ITEM_CATEGORY_HEALTH:
Matrix_Scale(0.1, 0.05, 0.1, MTXMODE_APPLY);
Matrix_Scale(0.1f, 0.05f, 0.1f, MTXMODE_APPLY);
Gfx_DrawDListOpa(play, (Gfx*)gSmallHeartCrateDL);
break;
case ITEM_CATEGORY_LESSER:
Matrix_Scale(0.1, 0.05, 0.1, MTXMODE_APPLY);
Matrix_Scale(0.1f, 0.05f, 0.1f, MTXMODE_APPLY);
Gfx_DrawDListOpa(play, (Gfx*)gSmallMinorCrateDL);
break;
case ITEM_CATEGORY_JUNK:
default:
Matrix_Scale(0.04, 0.02, 0.04, MTXMODE_APPLY);
Matrix_Scale(0.04f, 0.02f, 0.04f, MTXMODE_APPLY);
Gfx_DrawDListOpa(play, (Gfx*)gLargeJunkCrateDL);
break;
}
@@ -120,7 +120,7 @@ void EnWood02_RandomizerSpawnCollectible(EnWood02* treeActor, PlayState* play) {
item00->actor.velocity.y = 0.0f;
item00->actor.world.pos.y += 120.0f;
item00->actor.speedXZ = 2.0f;
item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f);
item00->actor.world.rot.y = static_cast<s16>(Rand_CenteredFloat(65536.0f));
// clear randomizerCheck to prevent multiple bonks,
// reloading area without collecting drop won't persist this
treeIdentity->randomizerCheck = RC_UNKNOWN_CHECK;
+3 -3
View File
@@ -155,9 +155,9 @@ uint8_t GetRandomHintTextEntry(const HintText hintText) {
auto ctx = Rando::Context::GetInstance();
uint8_t size = 0;
if (ctx->GetOption(RSK_HINT_CLARITY).Is(RO_HINT_CLARITY_AMBIGUOUS)) {
size = hintText.GetAmbiguousSize();
size = static_cast<u8>(hintText.GetAmbiguousSize());
} else if (ctx->GetOption(RSK_HINT_CLARITY).Is(RO_HINT_CLARITY_OBSCURE)) {
size = hintText.GetObscureSize();
size = static_cast<u8>(hintText.GetObscureSize());
}
if (size > 0) {
return Random(0, size);
@@ -185,7 +185,7 @@ void Hint::NamesChosen() {
for (size_t c = 0; c < locations.size(); c++) {
namesTemp = {};
saveNames = false;
uint8_t selection = GetRandomHintTextEntry(GetItemHintText(c));
uint8_t selection = GetRandomHintTextEntry(GetItemHintText(static_cast<u8>(c)));
if (selection > 0) {
saveNames = true;
}
@@ -2342,8 +2342,8 @@ void RandomizerOnActorInitHandler(void* actorRef) {
enGe1->actionFunc = (EnGe1ActionFunc)EnGe1_SetNormalText;
} else if (ge1Type == GE1_TYPE_GATE_OPERATOR && enGe1->actor.world.pos.x != -1358.0f) {
// When spawning the gate operator, also spawn an extra gate operator on the wasteland side
Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_GE1, -1358.0f, 88.0f, -3018.0f, 0, 0x95B0, 0,
0x0300 | GE1_TYPE_GATE_OPERATOR);
Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_GE1, -1358.0f, 88.0f, -3018.0f, 0,
static_cast<s16>(0x95B0), 0, 0x0300 | GE1_TYPE_GATE_OPERATOR);
}
}
@@ -2352,8 +2352,8 @@ void RandomizerOnActorInitHandler(void* actorRef) {
auto jyaBigMirror = static_cast<BgJyaBigmirror*>(actorRef);
jyaBigMirror->puzzleFlags |=
BIGMIR_PUZZLE_COBRA1_SOLVED | BIGMIR_PUZZLE_COBRA2_SOLVED | BIGMIR_PUZZLE_BOMBIWA_DESTROYED;
jyaBigMirror->cobraInfo[0].rotY = 0x4000;
jyaBigMirror->cobraInfo[1].rotY = 0x8000;
jyaBigMirror->cobraInfo[0].rotY = static_cast<s16>(0x4000);
jyaBigMirror->cobraInfo[1].rotY = static_cast<s16>(0x8000);
}
if (actor->id == ACTOR_DEMO_KEKKAI && actor->params == 0) { // 0 == KEKKAI_TOWER
+10 -9
View File
@@ -199,13 +199,14 @@ Option::Option(size_t key_, std::string name_, std::vector<std::string> options_
if (imFlags_ & IMFLAG_LABEL_INLINE) {
labelPosition = UIWidgets::LabelPositions::Near;
}
widgetOptions = std::make_shared<UIWidgets::IntSliderOptions>(UIWidgets::IntSliderOptions()
.DefaultValue(defaultOption)
.Tooltip(description.c_str())
.Min(0)
.Max(options.size() - 1)
.Format(options[defaultOption].c_str())
.LabelPosition(labelPosition));
widgetOptions =
std::make_shared<UIWidgets::IntSliderOptions>(UIWidgets::IntSliderOptions()
.DefaultValue(defaultOption)
.Tooltip(description.c_str())
.Min(0)
.Max(static_cast<int32_t>(options.size() - 1))
.Format(options[defaultOption].c_str())
.LabelPosition(labelPosition));
break;
default:
break;
@@ -231,7 +232,7 @@ void Option::AddWidget(WidgetPath& path) {
RO_LOGIC_NO_LOGIC) {
maxIndex = 7;
}
sliderOpts->Max(maxIndex);
sliderOpts->Max(static_cast<int32_t>(maxIndex));
}
})
.CVar(cvarName.c_str())
@@ -392,7 +393,7 @@ void OptionGroup::AddWidgets(WidgetPath& path) const {
if (mContainerType == WidgetContainerType::TABLE) {
path.column = SECTION_COLUMN_1;
path.sidebarName = mName;
SohGui::mSohMenu->AddSidebarEntry("Randomizer", path.sidebarName, mSubGroups.size());
SohGui::mSohMenu->AddSidebarEntry("Randomizer", path.sidebarName, static_cast<uint32_t>(mSubGroups.size()));
}
if (mContainerType == WidgetContainerType::SECTION || mContainerType == WidgetContainerType::COLUMN) {
if (!mName.empty()) {
@@ -69,7 +69,7 @@ bool Rando_HandleSpoilerDrop(char* filePath) {
CVarSetInteger(CVAR_GENERAL("RandomizerNewFileDropped"), 1);
return true;
}
} catch (std::exception& e) {}
} catch ([[maybe_unused]] std::exception& e) {}
return false;
}
@@ -2298,9 +2298,11 @@ void CheckTrackerSettingsWindow::DrawElement() {
ImGui::TableHeadersRow();
ImGui::TableNextRow();
ImGui::TableNextColumn();
SohGui::GetSohMenu()->MenuDrawItem(backgroundColorWidget, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::GetSohMenu()->MenuDrawItem(backgroundColorWidget,
static_cast<uint32_t>(ImGui::GetContentRegionAvail().x), THEME_COLOR);
SohGui::GetSohMenu()->MenuDrawItem(windowTypeWidget, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::GetSohMenu()->MenuDrawItem(windowTypeWidget, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
UIWidgets::CVarSliderFloat("Font Size", CVAR_TRACKER_CHECK("FontSize"),
UIWidgets::FloatSliderOptions()
@@ -2340,17 +2342,22 @@ void CheckTrackerSettingsWindow::DrawElement() {
}
}
ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0));
SohGui::GetSohMenu()->MenuDrawItem(dungeonSpoilerWidget, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::GetSohMenu()->MenuDrawItem(dungeonSpoilerWidget,
static_cast<uint32_t>(ImGui::GetContentRegionAvail().x), THEME_COLOR);
ImGui::EndDisabled();
SohGui::GetSohMenu()->MenuDrawItem(hideUnshuffledShopWidget, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::GetSohMenu()->MenuDrawItem(hideUnshuffledShopWidget,
static_cast<uint32_t>(ImGui::GetContentRegionAvail().x), THEME_COLOR);
SohGui::GetSohMenu()->MenuDrawItem(showGSWidget, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::GetSohMenu()->MenuDrawItem(showGSWidget, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
SohGui::GetSohMenu()->MenuDrawItem(showLogicWidget, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::GetSohMenu()->MenuDrawItem(showLogicWidget, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0));
SohGui::GetSohMenu()->MenuDrawItem(checkAvailabilityWidget, ImGui::GetContentRegionAvail().x, THEME_COLOR);
SohGui::GetSohMenu()->MenuDrawItem(checkAvailabilityWidget,
static_cast<uint32_t>(ImGui::GetContentRegionAvail().x), THEME_COLOR);
ImGui::EndDisabled();
// Filtering settings
+13 -13
View File
@@ -349,7 +349,7 @@ void HandleDragAndDrop(std::vector<SplitObject>& objectList, int targetIndex, co
}
void TimeSplitCompleteSplits() {
gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_DEFEAT_GANON] = GAMEPLAYSTAT_TOTAL_TIME;
gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_DEFEAT_GANON] = static_cast<u32>(GAMEPLAYSTAT_TOTAL_TIME);
gSaveContext.ship.stats.gameComplete = true;
}
@@ -587,13 +587,13 @@ void TimeSplitsItemSplitEvent(uint32_t type, u8 item) {
if (split.splitType == type) {
if (item == split.splitID) {
if (split.splitTimeStatus == SPLIT_STATUS_ACTIVE) {
split.splitTimeCurrent = GAMEPLAYSTAT_TOTAL_TIME;
split.splitTimeCurrent = static_cast<u32>(GAMEPLAYSTAT_TOTAL_TIME);
split.splitTimeStatus = SPLIT_STATUS_COLLECTED;
if (split.splitTimeBest > GAMEPLAYSTAT_TOTAL_TIME || split.splitTimeBest == 0) {
split.splitTimeBest = GAMEPLAYSTAT_TOTAL_TIME;
split.splitTimeBest = static_cast<u32>(GAMEPLAYSTAT_TOTAL_TIME);
}
if (split.splitTimePreviousBest == 0) {
split.splitTimePreviousBest = GAMEPLAYSTAT_TOTAL_TIME;
split.splitTimePreviousBest = static_cast<u32>(GAMEPLAYSTAT_TOTAL_TIME);
}
if (index == splitList.size() - 1) {
TimeSplitCompleteSplits();
@@ -612,15 +612,15 @@ void TimeSplitsSplitBestTimeDisplay(SplitObject split) {
if (split.splitTimeStatus == SPLIT_STATUS_ACTIVE) {
if (GAMEPLAYSTAT_TOTAL_TIME > split.splitTimePreviousBest) {
splitTimeColor = COLOR_RED;
splitBestTimeDisplay = (GAMEPLAYSTAT_TOTAL_TIME - split.splitTimePreviousBest);
splitBestTimeDisplay = (static_cast<u32>(GAMEPLAYSTAT_TOTAL_TIME) - split.splitTimePreviousBest);
}
if (GAMEPLAYSTAT_TOTAL_TIME == split.splitTimePreviousBest) {
splitTimeColor = COLOR_WHITE;
splitBestTimeDisplay = GAMEPLAYSTAT_TOTAL_TIME;
splitBestTimeDisplay = static_cast<u32>(GAMEPLAYSTAT_TOTAL_TIME);
}
if (GAMEPLAYSTAT_TOTAL_TIME < split.splitTimePreviousBest) {
splitTimeColor = COLOR_GREEN;
splitBestTimeDisplay = (split.splitTimePreviousBest - GAMEPLAYSTAT_TOTAL_TIME);
splitBestTimeDisplay = (split.splitTimePreviousBest - static_cast<u32>(GAMEPLAYSTAT_TOTAL_TIME));
}
activeSplitHighlight = COLOR_LIGHT_BLUE;
}
@@ -685,7 +685,7 @@ void TimeSplitsDrawSplitsList() {
ImGui::TableNextColumn();
// Current Time
ImGui::Text("%s", (split.splitTimeStatus == SPLIT_STATUS_ACTIVE)
? formatTimestampTimeSplit(GAMEPLAYSTAT_TOTAL_TIME).c_str()
? formatTimestampTimeSplit(static_cast<u32>(GAMEPLAYSTAT_TOTAL_TIME)).c_str()
: (split.splitTimeStatus == SPLIT_STATUS_COLLECTED)
? formatTimestampTimeSplit(split.splitTimeCurrent).c_str()
: "--:--:-");
@@ -1016,21 +1016,21 @@ void TimeSplitWindow::InitElement() {
break;
}
}
TimeSplitsItemSplitEvent(tempType, itemEntry.itemId);
TimeSplitsItemSplitEvent(tempType, static_cast<u8>(itemEntry.itemId));
}
});
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPlayerBottleUpdate>(
[](int16_t contents) { TimeSplitsItemSplitEvent(SPLIT_TYPE_UPGRADE, contents); });
[](int16_t contents) { TimeSplitsItemSplitEvent(SPLIT_TYPE_UPGRADE, static_cast<u8>(contents)); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnBossDefeat>([](void* refActor) {
Actor* bossActor = (Actor*)refActor;
TimeSplitsItemSplitEvent(SPLIT_TYPE_BOSS, bossActor->id);
TimeSplitsItemSplitEvent(SPLIT_TYPE_BOSS, static_cast<u8>(bossActor->id));
});
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneInit>([](int16_t sceneNum) {
if (gPlayState->sceneNum != SCENE_KAKARIKO_VILLAGE) {
TimeSplitsItemSplitEvent(SPLIT_TYPE_ENTRANCE, sceneNum);
TimeSplitsItemSplitEvent(SPLIT_TYPE_ENTRANCE, static_cast<u8>(sceneNum));
}
});
@@ -1038,7 +1038,7 @@ void TimeSplitWindow::InitElement() {
if (gPlayState->sceneNum == SCENE_KAKARIKO_VILLAGE) {
Player* player = GET_PLAYER(gPlayState);
if (player->fallDistance > 500 && gSaveContext.health <= 0) {
TimeSplitsItemSplitEvent(SPLIT_TYPE_MISC, gPlayState->sceneNum);
TimeSplitsItemSplitEvent(SPLIT_TYPE_MISC, static_cast<u8>(gPlayState->sceneNum));
}
}
});
+4 -4
View File
@@ -344,7 +344,7 @@ void RegisterOnKaleidoscopeUpdateHook() {
// Normalize hearts to fractional count similar to z_lifemeter
int curHeartFraction = gSaveContext.health % 16;
int fullHearts = gSaveContext.health / 16;
float fraction = ceilf((float)curHeartFraction / 5) * 0.25;
float fraction = ceilf(static_cast<f32>(curHeartFraction / 5.0f)) * 0.25f;
float health = (float)fullHearts + fraction;
snprintf(arg, sizeof(arg), "%g", health);
auto translation = GetParameritizedText("health", TEXT_BANK_KALEIDO, arg);
@@ -419,7 +419,7 @@ void RegisterOnKaleidoscopeUpdateHook() {
// Check if item is assigned to a button
for (size_t i = 0; i < ARRAY_COUNT(gSaveContext.equips.cButtonSlots); i++) {
if (gSaveContext.equips.buttonItems[i + 1] == pauseCtx->cursorItem[PAUSE_ITEM]) {
assignedTo = i;
assignedTo = static_cast<s8>(i);
break;
}
}
@@ -500,7 +500,7 @@ void RegisterOnKaleidoscopeUpdateHook() {
std::string key = std::to_string(pauseCtx->cursorItem[PAUSE_EQUIP]);
auto itemTranslation = GetParameritizedText(key, TEXT_BANK_KALEIDO, nullptr);
uint8_t checkEquipItem = pauseCtx->namedItem;
uint16_t checkEquipItem = pauseCtx->namedItem;
// BGS from kaleido reports as ITEM_HEART_PIECE_2 (122)
// remap BGS and broken knife to be the BGS item for the current equip check
@@ -519,7 +519,7 @@ void RegisterOnKaleidoscopeUpdateHook() {
for (size_t i = 0; i < ARRAY_COUNT(gSaveContext.equips.cButtonSlots); i++) {
if (gSaveContext.equips.buttonItems[i + 1] == checkEquipItem) {
assignedTo = i;
assignedTo = static_cast<s8>(i);
break;
}
}
@@ -51,7 +51,7 @@ void Anchor::HandlePacket_DamagePlayer(nlohmann::json payload) {
if (damageEffect == DUMMY_PLAYER_HIT_RESPONSE_FIRE) {
for (int i = 0; i < ARRAY_COUNT(self->bodyFlameTimers); i++) {
self->bodyFlameTimers[i] = Rand_S16Offset(0, 200);
self->bodyFlameTimers[i] = static_cast<uint8_t>(Rand_S16Offset(0, 200));
}
self->bodyIsBurning = true;
} else if (damageEffect == DUMMY_PLAYER_HIT_RESPONSE_STUN) {
+1 -1
View File
@@ -65,7 +65,7 @@ void Anchor::HandlePacket_GiveItem(nlohmann::json payload) {
if (getItemEntry.getItemId == GI_SWORD_BGS) {
gSaveContext.bgsFlag = true;
}
Item_Give(gPlayState, getItemEntry.itemId);
Item_Give(gPlayState, static_cast<u8>(getItemEntry.itemId));
} else if (getItemEntry.modIndex == MOD_RANDOMIZER) {
if (getItemEntry.getItemId == RG_ICE_TRAP) {
gSaveContext.ship.pendingIceTrapCount++;
@@ -136,7 +136,8 @@ void Anchor::HandlePacket_UpdateTeamState(nlohmann::json payload) {
gSaveContext.healthCapacity = loadedData.healthCapacity;
gSaveContext.magicLevel = loadedData.magicLevel;
gSaveContext.magicCapacity = gSaveContext.magic = loadedData.magicCapacity;
gSaveContext.magicCapacity = loadedData.magicCapacity;
gSaveContext.magic = static_cast<s8>(loadedData.magicCapacity);
gSaveContext.isMagicAcquired = loadedData.isMagicAcquired;
gSaveContext.isDoubleMagicAcquired = loadedData.isDoubleMagicAcquired;
gSaveContext.isDoubleDefenseAcquired = loadedData.isDoubleDefenseAcquired;
+1 -1
View File
@@ -52,7 +52,7 @@ void Window::Draw() {
for (int index = 0; index < notifications.size(); ++index) {
auto& notification = notifications[index];
int inverseIndex = -ABS(index - (notifications.size() - 1));
int inverseIndex = -ABS(index - (static_cast<int>(notifications.size()) - 1));
ImGui::SetNextWindowViewport(vp->ID);
if (notification.remainingTime < 4.0f) {
+12 -11
View File
@@ -1529,7 +1529,7 @@ extern "C" void InitOTR(int argc, char* argv[]) {
CVarClear(CVAR_GENERAL("LetItSnow"));
}
srand(now);
srand(static_cast<unsigned int>(now));
#ifdef ENABLE_REMOTE_CONTROL
SDLNet_Init();
#endif
@@ -1864,7 +1864,8 @@ ImFont* OTRGlobals::CreateFontWithSize(float size, std::string fontPath, bool is
ImFontConfig fontConf;
fontConf.FontDataOwnedByAtlas = false;
const ImWchar* glyph_ranges = isJapaneseFont ? mImGuiIo->Fonts->GetGlyphRangesJapanese() : nullptr;
font = mImGuiIo->Fonts->AddFontFromMemoryTTF(fontData->Data, fontData->DataSize, size, &fontConf, glyph_ranges);
font = mImGuiIo->Fonts->AddFontFromMemoryTTF(fontData->Data, static_cast<int>(fontData->DataSize), size,
&fontConf, glyph_ranges);
}
// FontAwesome fonts need to have their sizes reduced by 2.0f/3.0f in order to align correctly
float iconFontSize = size * 2.0f / 3.0f;
@@ -1983,7 +1984,7 @@ extern "C" void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(vo
for (const auto& c : wstr) {
if (c < 0x80) {
printImpl(printer, c);
printImpl(printer, static_cast<char>(c));
} else if (c == GFXP_HIRAGANA_CHAR) {
hiraganaMode = true;
} else if (c == GFXP_KATAKANA_CHAR) {
@@ -2001,22 +2002,22 @@ extern "C" void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(vo
} else {
auto it = std::find(hira1.begin(), hira1.end(), c);
if (it != hira1.end()) { // hiragana block 1
printImpl(printer, 0x86 + std::distance(hira1.begin(), it));
printImpl(printer, static_cast<char>(0x86 + std::distance(hira1.begin(), it)));
}
auto it2 = std::find(hira2.begin(), hira2.end(), c);
if (it2 != hira2.end()) { // hiragana block 2
printImpl(printer, 0xe0 + std::distance(hira2.begin(), it2));
printImpl(printer, static_cast<char>(0xe0 + std::distance(hira2.begin(), it2)));
}
auto it3 = std::find(kata1.begin(), kata1.end(), c);
if (it3 != kata1.end()) { // katakana zenkaku block 1
printImpl(printer, 0xa6 + std::distance(kata1.begin(), it3));
printImpl(printer, static_cast<char>(0xa6 + std::distance(kata1.begin(), it3)));
}
auto it4 = std::find(kata2.begin(), kata2.end(), c);
if (it4 != kata2.end()) { // katakana zenkaku block 2
printImpl(printer, 0xb1 + std::distance(kata2.begin(), it4));
printImpl(printer, static_cast<char>(0xb1 + std::distance(kata2.begin(), it4)));
}
}
}
@@ -2109,9 +2110,9 @@ Color_RGB8 GetColorForControllerLED() {
}
}
}
color.r = color.r * brightness;
color.g = color.g * brightness;
color.b = color.b * brightness;
color.r = static_cast<u8>(color.r * brightness);
color.g = static_cast<u8>(color.g * brightness);
color.b = static_cast<u8>(color.b * brightness);
}
return color;
@@ -2221,7 +2222,7 @@ extern "C" int Controller_ShouldRumble(size_t slot) {
if (Ship::Context::GetRawInstance()
->GetControlDeck()
->GetConnectedPhysicalDeviceManager()
->GetConnectedSDLGamepadsForPort(slot)
->GetConnectedSDLGamepadsForPort(static_cast<s32>(slot))
.empty()) {
return 0;
}
+9 -2
View File
@@ -21,7 +21,8 @@
extern "C" PlayState* gPlayState;
extern "C" uint32_t ResourceMgr_GetNumGameVersions() {
return Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions().size();
return static_cast<u32>(
Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions().size());
}
extern "C" uint32_t ResourceMgr_GetGameVersion(int index) {
@@ -50,6 +51,9 @@ extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) {
case OOT_PAL_GC_DBG2:
case OOT_PAL_GC_MQ_DBG:
return GAME_PLATFORM_GC;
default:
assert(false);
return GAME_PLATFORM_UNKNOWN;
}
}
@@ -75,6 +79,9 @@ extern "C" uint32_t ResourceMgr_GetGameRegion(int index) {
case OOT_PAL_GC_DBG2:
case OOT_PAL_GC_MQ_DBG:
return GAME_REGION_PAL;
default:
assert(false);
return GAME_REGION_UNKNOWN;
}
}
@@ -157,7 +164,7 @@ extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize)
str[lst.get()[0][i].size()] = '\0';
result[i] = str;
}
*resultSize = lst->size();
*resultSize = static_cast<int>(lst->size());
return result;
}
+2
View File
@@ -4,9 +4,11 @@
#define GAME_REGION_NTSC 0
#define GAME_REGION_PAL 1
#define GAME_REGION_UNKNOWN 2
#define GAME_PLATFORM_N64 0
#define GAME_PLATFORM_GC 1
#define GAME_PLATFORM_UNKNOWN 2
#ifdef __cplusplus
#include <memory>
+15 -9
View File
@@ -733,7 +733,7 @@ void SaveManager::InitFileNormal() {
gSaveContext.inventory.dungeonItems[dungeon] = 0;
}
for (int dungeon = 0; dungeon < ARRAY_COUNT(gSaveContext.inventory.dungeonKeys); dungeon++) {
gSaveContext.inventory.dungeonKeys[dungeon] = 0xFF;
gSaveContext.inventory.dungeonKeys[dungeon] = static_cast<u8>(0xFF);
}
gSaveContext.inventory.defenseHearts = 0;
gSaveContext.inventory.gsTokens = 0;
@@ -837,19 +837,22 @@ void SaveManager::InitFileDebug() {
gSaveContext.deaths = 0;
if (ResourceMgr_GetGameRegion(0) == GAME_REGION_PAL && gSaveContext.language != LANGUAGE_JPN) {
const static std::array<char, 8> sPlayerName = { 0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E };
const static std::array<u8, 8> sPlayerName = { '\x15', '\x12', '\x17', '\x14', '\x3E', '\x3E', '\x3E', '\x3E' };
for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) {
gSaveContext.playerName[i] = sPlayerName[i];
}
gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_PAL;
} else if (gSaveContext.language == LANGUAGE_JPN) { // Japanese
const static std::array<char, 8> sPlayerName = { 0x81, 0x87, 0x61, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF };
const static std::array<u8, 8> sPlayerName = { '\x81', '\x87', '\x61', '\xDF', '\xDF', '\xDF', '\xDF', '\xDF' };
for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) {
gSaveContext.playerName[i] = sPlayerName[i];
}
gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_NTSC_JPN;
} else { // GAME_REGION_NTSC
const static std::array<char, 8> sPlayerName = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF };
const static std::array<u8, 8> sPlayerName = { '\xB6', '\xB3', '\xB8', '\xB5', '\xDF', '\xDF', '\xDF', '\xDF' };
for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) {
gSaveContext.playerName[i] = sPlayerName[i];
}
@@ -957,19 +960,22 @@ void SaveManager::InitFileMaxed() {
gSaveContext.deaths = 0;
if (ResourceMgr_GetGameRegion(0) == GAME_REGION_PAL && gSaveContext.language != LANGUAGE_JPN) {
const static std::array<char, 8> sPlayerName = { 0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E };
const static std::array<u8, 8> sPlayerName = { '\x15', '\x12', '\x17', '\x14', '\x3E', '\x3E', '\x3E', '\x3E' };
for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) {
gSaveContext.playerName[i] = sPlayerName[i];
}
gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_PAL;
} else if (gSaveContext.language == LANGUAGE_JPN) { // Japanese
const static std::array<char, 8> sPlayerName = { 0x81, 0x87, 0x61, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF };
const static std::array<u8, 8> sPlayerName = { '\x81', '\x87', '\x61', '\xDF', '\xDF', '\xDF', '\xDF', '\xDF' };
for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) {
gSaveContext.playerName[i] = sPlayerName[i];
}
gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_NTSC_JPN;
} else { // GAME_REGION_NTSC
const static std::array<char, 8> sPlayerName = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF };
const static std::array<u8, 8> sPlayerName = { '\xB6', '\xB3', '\xB8', '\xB5', '\xDF', '\xDF', '\xDF', '\xDF' };
for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) {
gSaveContext.playerName[i] = sPlayerName[i];
}
@@ -1321,7 +1327,7 @@ void SaveManager::LoadFile(int fileNum) {
}
InitMeta(fileNum);
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnLoadFile>(fileNum);
} catch (const std::exception& e) {
} catch ([[maybe_unused]] const std::exception& e) {
input.close();
std::string newFileName =
Ship::Context::GetPathRelativeToAppDirectory("Save") +
@@ -1349,7 +1355,7 @@ void SaveManager::ThreadPoolWait() {
bool SaveManager::SaveFile_Exist(int fileNum) {
try {
return std::filesystem::exists(GetFileName(fileNum));
} catch (std::filesystem::filesystem_error const& ex) {
} catch ([[maybe_unused]] std::filesystem::filesystem_error const& ex) {
SPDLOG_ERROR("Filesystem error");
return false;
}
+6 -6
View File
@@ -66,7 +66,7 @@ bool operator>(Color_RGBA8 const& l, Color_RGBA8 const& r) noexcept {
}
uint32_t GetVectorIndexOf(std::vector<std::string>& vector, std::string value) {
return std::distance(vector.begin(), std::find(vector.begin(), vector.end(), value));
return static_cast<u32>(std::distance(vector.begin(), std::find(vector.begin(), vector.end(), value)));
}
static bool raceDisableActive = false;
@@ -93,7 +93,7 @@ void Menu::RemoveSidebarSearch() {
if (curIndex > searchSidebarIndex) {
curIndex--;
} else if (curIndex >= menuEntries["Settings"].sidebarOrder.size()) {
curIndex = menuEntries["Settings"].sidebarOrder.size() - 1;
curIndex = static_cast<u32>(menuEntries["Settings"].sidebarOrder.size() - 1);
}
CVarSetString(menuEntries["Settings"].sidebarCvar, menuEntries["Settings"].sidebarOrder.at(curIndex).c_str());
}
@@ -129,10 +129,10 @@ Menu::Menu(const std::string& cVar, const std::string& name, uint8_t searchSideb
void Menu::InitElement() {
popped = CVarGetInteger(CVAR_SETTING("Menu.Popout"), 0);
poppedSize.x = CVarGetInteger(CVAR_SETTING("Menu.PoppedWidth"), 1280);
poppedSize.y = CVarGetInteger(CVAR_SETTING("Menu.PoppedHeight"), 800);
poppedPos.x = CVarGetInteger(CVAR_SETTING("Menu.PoppedPos.x"), 0);
poppedPos.y = CVarGetInteger(CVAR_SETTING("Menu.PoppedPos.y"), 0);
poppedSize.x = static_cast<f32>(CVarGetInteger(CVAR_SETTING("Menu.PoppedWidth"), 1280));
poppedSize.y = static_cast<f32>(CVarGetInteger(CVAR_SETTING("Menu.PoppedHeight"), 800));
poppedPos.x = static_cast<f32>(CVarGetInteger(CVAR_SETTING("Menu.PoppedPos.x"), 0));
poppedPos.y = static_cast<f32>(CVarGetInteger(CVAR_SETTING("Menu.PoppedPos.y"), 0));
menuThemeIndex = static_cast<UIWidgets::Colors>(CVarGetInteger(CVAR_SETTING("Menu.Theme"), defaultThemeIndex));
UpdateWindowBackendObjects();
+10 -10
View File
@@ -116,7 +116,7 @@ void ResolutionCustomWidget(WidgetInfo& info) {
verticalPixelCount = pixelCountPresets[item_pixelCount];
if (showHorizontalResField) {
horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX;
horizontalPixelCount = static_cast<s32>((verticalPixelCount / aspectRatioY) * aspectRatioX);
}
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalPixelCount", verticalPixelCount);
@@ -135,8 +135,8 @@ void ResolutionCustomWidget(WidgetInfo& info) {
if (horizontalPixelCount < SCREEN_WIDTH) {
horizontalPixelCount = SCREEN_WIDTH;
}
aspectRatioX = horizontalPixelCount;
aspectRatioY = verticalPixelCount;
aspectRatioX = static_cast<f32>(horizontalPixelCount);
aspectRatioY = static_cast<f32>(verticalPixelCount);
update[UPDATE_aspectRatioX] = true;
update[UPDATE_aspectRatioY] = true;
}
@@ -152,7 +152,7 @@ void ResolutionCustomWidget(WidgetInfo& info) {
aspectRatioY = aspectRatioPresetsY[2];
update[UPDATE_aspectRatioX] = true;
update[UPDATE_aspectRatioY] = true;
horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX;
horizontalPixelCount = static_cast<s32>((verticalPixelCount / aspectRatioY) * aspectRatioX);
}
}
}
@@ -166,8 +166,8 @@ void ResolutionCustomWidget(WidgetInfo& info) {
// Ignore vertical resolutions that are below the lower clamp constant.
if (showHorizontalResField && !(verticalPixelCount < minVerticalPixelCount)) {
item_aspectRatio = default_aspectRatio;
aspectRatioX = horizontalPixelCount;
aspectRatioY = verticalPixelCount;
aspectRatioX = static_cast<f32>(horizontalPixelCount);
aspectRatioY = static_cast<f32>(verticalPixelCount);
update[UPDATE_aspectRatioX] = true;
update[UPDATE_aspectRatioY] = true;
}
@@ -267,12 +267,12 @@ void ResolutionCustomWidget(WidgetInfo& info) {
if (!showHorizontalResField && (aspectRatioX > 0.0f)) { // when turning this setting off
// Refresh relevant values
aspectRatioX = aspectRatioY * horizontalPixelCount / verticalPixelCount;
horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX;
horizontalPixelCount = static_cast<s32>((verticalPixelCount / aspectRatioY) * aspectRatioX);
} else { // when turning this setting on
item_aspectRatio = default_aspectRatio;
if (aspectRatioX > 0.0f) {
// Refresh relevant values in the opposite order
horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX;
horizontalPixelCount = static_cast<s32>((verticalPixelCount / aspectRatioY) * aspectRatioX);
aspectRatioX = aspectRatioY * horizontalPixelCount / verticalPixelCount;
}
}
@@ -459,7 +459,7 @@ void RegisterResolutionWidgets() {
aspectRatioY = aspectRatioPresetsY[item_aspectRatio];
if (showHorizontalResField) {
horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX;
horizontalPixelCount = static_cast<s32>((verticalPixelCount / aspectRatioY) * aspectRatioX);
}
CVarSetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioX", aspectRatioX);
@@ -582,7 +582,7 @@ void UpdateResolutionVars() {
verticalPixelCount =
CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalPixelCount", pixelCountPresets[item_pixelCount]);
// Additional settings
horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX;
horizontalPixelCount = static_cast<s32>((verticalPixelCount / aspectRatioY) * aspectRatioX);
// Disabling flags
disabled_everything = !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", 0);
disabled_pixelCount = !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalResolutionToggle", 0);
+6 -5
View File
@@ -18,7 +18,7 @@ std::string WrappedText(const char* text, unsigned int charactersPerLine) {
std::string newText(text);
const size_t tipLength = newText.length();
int lastSpace = -1;
int currentLineLength = 0;
unsigned int currentLineLength = 0;
for (unsigned int currentCharacter = 0; currentCharacter < tipLength; currentCharacter++) {
if (newText[currentCharacter] == '\n') {
currentLineLength = 0;
@@ -930,9 +930,9 @@ bool CVarColorPicker(const char* label, const char* cvarName, Color_RGBA8 defaul
.Color(themeColor)
.Size(UIWidgets::Sizes::Inline))) {
colorVec = GetRandomValue();
color.r = fmin(fmax(colorVec.x * 255, 0), 255);
color.g = fmin(fmax(colorVec.y * 255, 0), 255);
color.b = fmin(fmax(colorVec.z * 255, 0), 255);
color.r = static_cast<u8>(fmin(fmax(colorVec.x * 255, 0), 255));
color.g = static_cast<u8>(fmin(fmax(colorVec.y * 255, 0), 255));
color.b = static_cast<u8>(fmin(fmax(colorVec.z * 255, 0), 255));
CVarSetColor(valueCVar.c_str(), color);
CVarSetInteger(rainbowCVar.c_str(), 0); // On click disable rainbow mode.
ShipInit::Init(rainbowCVar.c_str());
@@ -1264,7 +1264,8 @@ ImVec4 GetRandomValue(uint64_t* state) {
}
Color_RGBA8 RGBA8FromVec(ImVec4 vec) {
Color_RGBA8 color = { vec.x * 255, vec.y * 255, vec.z * 255, vec.w * 255 };
Color_RGBA8 color = { static_cast<u8>(vec.x * 255), static_cast<u8>(vec.y * 255), static_cast<u8>(vec.z * 255),
static_cast<u8>(vec.w * 255) };
return color;
}
+7 -7
View File
@@ -237,19 +237,19 @@ struct InterpolateCtx {
float interpolate_angle(f32 o, f32 n) {
if (o == n)
return n;
o = fmodf(o, 2 * M_PI);
o = fmodf(o, static_cast<f32>(2.0f * M_PI));
if (o < 0.0f) {
o += 2 * M_PI;
o += static_cast<f32>(2.0f * M_PI);
}
n = fmodf(n, 2 * M_PI);
n = fmodf(n, static_cast<f32>(2.0f * M_PI));
if (n < 0.0f) {
n += 2 * M_PI;
n += static_cast<f32>(2.0f * M_PI);
}
if (fabsf(o - n) > M_PI) {
if (o < n) {
o += 2 * M_PI;
o += static_cast<f32>(2.0f * M_PI);
} else {
n += 2 * M_PI;
n += static_cast<f32>(2.0f * M_PI);
}
}
if (fabsf(o - n) > M_PI / 2) {
@@ -729,7 +729,7 @@ static bool invert_matrix(const float m[16], float invOut[16]) {
return false;
}
det = 1.0 / det;
det = 1.0f / det;
for (i = 0; i < 16; i++) {
invOut[i] = inv[i] * det;
+1 -1
View File
@@ -93,7 +93,7 @@ void FB_WriteFramebufferSliceToCPU(Gfx** gfxp, void* buffer, u8 byteSwap) {
// Adjust the texture coordinates so that only a 4:3 region from the center is drawn
// to the N64 resolution buffer. Currently ratios smaller than 4:3 will just stretch to fill.
if (aspectRatio > fourByThree) {
int16_t adjustedWidth = OTRGetGameRenderWidth() / (aspectRatio / fourByThree);
int16_t adjustedWidth = (s16)(OTRGetGameRenderWidth() / (aspectRatio / fourByThree));
s0 = (OTRGetGameRenderWidth() - adjustedWidth) / 2;
s1 -= s0;
}
+7 -3
View File
@@ -7,8 +7,10 @@
#include "mixer.h"
#ifndef __clang__
#ifndef _MSC_VER
#pragma GCC optimize("unroll-loops")
#endif
#endif
#define ROUND_UP_64(v) (((v) + 63) & ~63)
#define ROUND_UP_32(v) (((v) + 31) & ~31)
@@ -516,12 +518,16 @@ void aFilterImpl(uint8_t flags, uint16_t count_or_buf, int16_t* state_or_filter)
if (flags == A_INIT) {
#ifndef __clang__
#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmemset-elt-size"
#endif
#endif
memset(tmp, 0, 8 * sizeof(int16_t));
#ifndef __clang__
#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif
#endif
memset(tmp2, 0, 8 * sizeof(int16_t));
} else {
@@ -623,15 +629,13 @@ static void aMixImplSSE2(uint16_t count, int16_t gain, uint16_t in_addr, uint16_
int nbytes = ROUND_UP_32(ROUND_DOWN_16(count << 4));
int16_t* in = BUF_S16(in_addr);
int16_t* out = BUF_S16(out_addr);
int i;
int32_t sample;
if (gain == -0x8000) {
while (nbytes > 0) {
for (unsigned int i = 0; i < 2; i++) {
__m128i outVec = _mm_loadu_si128((__m128i*)out);
__m128i inVec = _mm_loadu_si128((__m128i*)in);
__m128i subsVec = _mm_subs_epi16(outVec, inVec);
_mm_storeu_si128(out, subsVec);
_mm_storeu_si128((__m128i*)out, subsVec);
nbytes -= 8 * sizeof(int16_t);
in += 8;
out += 8;
+2 -2
View File
@@ -84,7 +84,7 @@ ResourceFactoryXMLPathV0::ReadResource(std::shared_ptr<Ship::File> file,
PathData pathDataEntry;
// pathDataEntry.count = pointCount;
pathDataEntry.count = points.size();
pathDataEntry.count = static_cast<u8>(points.size());
path->paths.push_back(points);
pathDataEntry.points = path->paths.back().data();
@@ -94,7 +94,7 @@ ResourceFactoryXMLPathV0::ReadResource(std::shared_ptr<Ship::File> file,
pathDataElement = pathDataElement->NextSiblingElement();
}
path->numPaths = path->paths.size();
path->numPaths = static_cast<u32>(path->paths.size());
return path;
};
@@ -172,12 +172,12 @@ ResourceFactoryBinarySkeletonLimbV0::ReadResource(std::shared_ptr<Ship::File> fi
for (size_t i = 0; i < skeletonLimb->skinLimbModifArray.size(); i++) {
skeletonLimb->skinAnimLimbData.limbModifications[i].vtxCount =
skeletonLimb->skinLimbModifVertexArrays[i].size();
static_cast<u16>(skeletonLimb->skinLimbModifVertexArrays[i].size());
skeletonLimb->skinAnimLimbData.limbModifications[i].skinVertices =
skeletonLimb->skinLimbModifVertexArrays[i].data();
skeletonLimb->skinAnimLimbData.limbModifications[i].transformCount =
skeletonLimb->skinLimbModifTransformationArrays[i].size();
static_cast<u16>(skeletonLimb->skinLimbModifTransformationArrays[i].size());
skeletonLimb->skinAnimLimbData.limbModifications[i].limbTransformations =
skeletonLimb->skinLimbModifTransformationArrays[i].data();
@@ -61,7 +61,7 @@ std::shared_ptr<Ship::IResource> SetActorListFactoryXML::ReadResource(std::share
child = child->NextSiblingElement();
}
setActorList->numActors = setActorList->actorList.size();
setActorList->numActors = static_cast<u32>(setActorList->actorList.size());
return setActorList;
}
@@ -60,7 +60,7 @@ SetAlternateHeadersFactoryXML::ReadResource(std::shared_ptr<Ship::ResourceInitDa
child = child->NextSiblingElement();
}
setAlternateHeaders->numHeaders = setAlternateHeaders->headers.size();
setAlternateHeaders->numHeaders = static_cast<u32>(setAlternateHeaders->headers.size());
return setAlternateHeaders;
}
@@ -50,7 +50,7 @@ SetEntranceListFactoryXML::ReadResource(std::shared_ptr<Ship::ResourceInitData>
child = child->NextSiblingElement();
}
setEntranceList->numEntrances = setEntranceList->entrances.size();
setEntranceList->numEntrances = static_cast<u32>(setEntranceList->entrances.size());
return setEntranceList;
}
@@ -41,7 +41,7 @@ std::shared_ptr<Ship::IResource> SetExitListFactoryXML::ReadResource(std::shared
child = child->NextSiblingElement();
}
setExitList->numExits = setExitList->exits.size();
setExitList->numExits = static_cast<u32>(setExitList->exits.size());
return setExitList;
}
@@ -75,7 +75,7 @@ std::shared_ptr<Ship::IResource> SetLightListFactoryXML::ReadResource(std::share
child = child->NextSiblingElement();
}
setLightList->numLights = setLightList->lightList.size();
setLightList->numLights = static_cast<u32>(setLightList->lightList.size());
return setLightList;
}
@@ -41,7 +41,7 @@ std::shared_ptr<Ship::IResource> SetObjectListFactoryXML::ReadResource(std::shar
child = child->NextSiblingElement();
}
setObjectList->numObjects = setObjectList->objects.size();
setObjectList->numObjects = static_cast<u32>(setObjectList->objects.size());
return setObjectList;
}
@@ -50,7 +50,7 @@ std::shared_ptr<Ship::IResource> SetPathwaysFactoryXML::ReadResource(std::shared
child = child->NextSiblingElement();
}
setPathways->numPaths = setPathways->paths.size();
setPathways->numPaths = static_cast<u32>(setPathways->paths.size());
return setPathways;
}
@@ -57,7 +57,7 @@ std::shared_ptr<Ship::IResource> SetRoomListFactoryXML::ReadResource(std::shared
child = child->NextSiblingElement();
}
setRoomList->numRooms = setRoomList->rooms.size();
setRoomList->numRooms = static_cast<u32>(setRoomList->rooms.size());
return setRoomList;
}
@@ -63,7 +63,7 @@ SetStartPositionListFactoryXML::ReadResource(std::shared_ptr<Ship::ResourceInitD
child = child->NextSiblingElement();
}
setStartPositionList->numStartPositions = setStartPositionList->startPositions.size();
setStartPositionList->numStartPositions = static_cast<u32>(setStartPositionList->startPositions.size());
return setStartPositionList;
}
@@ -67,7 +67,7 @@ SetTransitionActorListFactoryXML::ReadResource(std::shared_ptr<Ship::ResourceIni
child = child->NextSiblingElement();
}
setTransitionActorList->numTransitionActors = setTransitionActorList->transitionActorList.size();
setTransitionActorList->numTransitionActors = static_cast<u32>(setTransitionActorList->transitionActorList.size());
return setTransitionActorList;
}
+1 -1
View File
@@ -19,7 +19,7 @@ static void SetMessageEntry(MessageTableEntry& entry, const SOH::MessageEntry& m
entry.textId = msgEntry.id;
entry.typePos = (msgEntry.textboxType << 4) | msgEntry.textboxYPos;
entry.segment = msgEntry.msg.c_str();
entry.msgSize = msgEntry.msg.size();
entry.msgSize = static_cast<u32>(msgEntry.msg.size());
}
static void OTRMessage_LoadCustom(const std::string& folderPath, MessageTableEntry*& table, size_t tableSize) {
+3 -5
View File
@@ -150,10 +150,8 @@ bool Scene_CommandObjectList(PlayState* play, SOH::ISceneCommand* cmd) {
s32 i;
s32 j;
s32 k;
ObjectStatus* status2;
// s16* objectEntry = SEGMENTED_TO_VIRTUAL(cmd->objectList.segment);
s16* objectEntry = (s16*)cmdObj->GetRawPointer();
void* nextPtr;
k = 0;
i = play->objectCtx.unk_09;
@@ -248,8 +246,8 @@ bool Scene_CommandTimeSettings(PlayState* play, SOH::ISceneCommand* cmd) {
SOH::SetTimeSettings* cmdTime = (SOH::SetTimeSettings*)cmd;
if ((cmdTime->settings.hour != 0xFF) && (cmdTime->settings.minute != 0xFF)) {
gSaveContext.skyboxTime = gSaveContext.dayTime =
((cmdTime->settings.hour + (cmdTime->settings.minute / 60.0f)) * 60.0f) / ((f32)(24 * 60) / 0x10000);
gSaveContext.skyboxTime = gSaveContext.dayTime = static_cast<u16>(
((cmdTime->settings.hour + (cmdTime->settings.minute / 60.0f)) * 60.0f) / ((f32)(24 * 60) / 0x10000));
}
if (cmdTime->settings.timeIncrement != 0xFF) {
@@ -501,7 +499,7 @@ extern "C" s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomN
if (roomNum >= play->numRooms)
return 0; // UH OH
size = play->roomList[roomNum].vromEnd - play->roomList[roomNum].vromStart;
size = static_cast<u32>(play->roomList[roomNum].vromEnd - play->roomList[roomNum].vromStart);
roomCtx->unk_34 =
(void*)ALIGN16((uintptr_t)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7));