mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-07-16 10:02:59 -07:00
Warnings Round 2 (mostly Rando) (#5486)
* Handle virtually all warnings in `soh/Enhancements/randomizer`. Handle order of operations warning in FasterHeavyBlockLift. * Missed a few. * Add float-specific versions of some M_PI and M_SQRT defines, and swap them in for the static casts in draw.cpp. * Swap a static cast for M_PIf in check tracker code.
This commit is contained in:
parent
23a5198986
commit
e673eaefb6
25 changed files with 98 additions and 85 deletions
|
@ -41,7 +41,7 @@ void FasterHeavyBlockLift_Register() {
|
||||||
LinkAnimationHeader* anim = va_arg(args, LinkAnimationHeader*);
|
LinkAnimationHeader* anim = va_arg(args, LinkAnimationHeader*);
|
||||||
|
|
||||||
// Same actor is used for small and large silver rocks, use actor params to identify large ones
|
// Same actor is used for small and large silver rocks, use actor params to identify large ones
|
||||||
bool isLargeSilverRock = interactActorId == ACTOR_EN_ISHI && interactRangeActor->params & 1 == 1;
|
bool isLargeSilverRock = (interactActorId == ACTOR_EN_ISHI) && ((interactRangeActor->params & 1) == 1);
|
||||||
if (CVarGetInteger(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 0) &&
|
if (CVarGetInteger(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 0) &&
|
||||||
(isLargeSilverRock || interactActorId == ACTOR_BG_HEAVY_BLOCK)) {
|
(isLargeSilverRock || interactActorId == ACTOR_BG_HEAVY_BLOCK)) {
|
||||||
*should = false;
|
*should = false;
|
||||||
|
|
|
@ -712,11 +712,11 @@ static void PareDownPlaythrough() {
|
||||||
auto ctx = Rando::Context::GetInstance();
|
auto ctx = Rando::Context::GetInstance();
|
||||||
std::vector<RandomizerCheck> toAddBackItem;
|
std::vector<RandomizerCheck> toAddBackItem;
|
||||||
// Start at sphere before Ganon's and count down
|
// Start at sphere before Ganon's and count down
|
||||||
for (int i = ctx->playthroughLocations.size() - 2; i >= 0; i--) {
|
for (size_t i = ctx->playthroughLocations.size() - 2; i >= 0; i--) {
|
||||||
// Check each item location in sphere
|
// Check each item location in sphere
|
||||||
std::vector<int> erasableIndices;
|
std::vector<int> erasableIndices;
|
||||||
std::vector<RandomizerCheck> sphere = ctx->playthroughLocations.at(i);
|
std::vector<RandomizerCheck> sphere = ctx->playthroughLocations.at(i);
|
||||||
for (int j = sphere.size() - 1; j >= 0; j--) {
|
for (size_t j = sphere.size() - 1; j >= 0; j--) {
|
||||||
RandomizerCheck loc = sphere.at(j);
|
RandomizerCheck loc = sphere.at(j);
|
||||||
RandomizerGet locGet = ctx->GetItemLocation(loc)->GetPlacedRandomizerGet(); // Copy out item
|
RandomizerGet locGet = ctx->GetItemLocation(loc)->GetPlacedRandomizerGet(); // Copy out item
|
||||||
|
|
||||||
|
|
|
@ -63,11 +63,11 @@ const CustomMessage& HintText::GetAmbiguous(uint8_t selection) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t HintText::GetAmbiguousSize() const {
|
uint8_t HintText::GetAmbiguousSize() const {
|
||||||
return ambiguousText.size();
|
return static_cast<uint8_t>(ambiguousText.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t HintText::GetObscureSize() const {
|
uint8_t HintText::GetObscureSize() const {
|
||||||
return obscureText.size();
|
return static_cast<uint8_t>(obscureText.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
const CustomMessage& HintText::GetHintMessage(uint8_t selection) const {
|
const CustomMessage& HintText::GetHintMessage(uint8_t selection) const {
|
||||||
|
@ -598,7 +598,7 @@ static void DistributeHints(std::vector<uint8_t>& selected, size_t stoneCount,
|
||||||
}
|
}
|
||||||
// if stones are left, assign junk to every remaining stone as a fallback.
|
// if stones are left, assign junk to every remaining stone as a fallback.
|
||||||
if (stoneCount > 0) {
|
if (stoneCount > 0) {
|
||||||
selected[selected.size() - 1] += stoneCount;
|
selected[static_cast<uint8_t>(selected.size()) - 1] += static_cast<uint8_t>(stoneCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -325,7 +325,7 @@ RandomizerGet GetJunkItem() {
|
||||||
return RandomElement(JunkPoolItems);
|
return RandomElement(JunkPoolItems);
|
||||||
}
|
}
|
||||||
// Ice Trap is the last item in JunkPoolItems, so subtract 1 to never hit that index
|
// Ice Trap is the last item in JunkPoolItems, so subtract 1 to never hit that index
|
||||||
uint8_t idx = Random(0, JunkPoolItems.size() - 1);
|
uint8_t idx = Random(0, static_cast<uint32_t>(JunkPoolItems.size()) - 1);
|
||||||
return JunkPoolItems[idx];
|
return JunkPoolItems[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ bool GenerateRandomizer(std::set<RandomizerCheck> excludedLocations, std::set<Ra
|
||||||
ResetPerformanceTimers();
|
ResetPerformanceTimers();
|
||||||
StartPerformanceTimer(PT_WHOLE_SEED);
|
StartPerformanceTimer(PT_WHOLE_SEED);
|
||||||
|
|
||||||
srand(time(NULL));
|
srand(static_cast<uint32_t>(time(NULL)));
|
||||||
// if a blank seed was entered, make a random one
|
// if a blank seed was entered, make a random one
|
||||||
if (seedInput.empty()) {
|
if (seedInput.empty()) {
|
||||||
seedInput = std::to_string(rand() % 0xFFFFFFFF);
|
seedInput = std::to_string(rand() % 0xFFFFFFFF);
|
||||||
|
@ -35,7 +35,7 @@ bool GenerateRandomizer(std::set<RandomizerCheck> excludedLocations, std::set<Ra
|
||||||
int count;
|
int count;
|
||||||
try {
|
try {
|
||||||
count = std::stoi(seedInput.substr(18), nullptr);
|
count = std::stoi(seedInput.substr(18), nullptr);
|
||||||
} catch (std::invalid_argument& e) { count = 1; } catch (std::out_of_range& e) {
|
} catch (std::invalid_argument&) { count = 1; } catch (std::out_of_range&) {
|
||||||
count = 1;
|
count = 1;
|
||||||
}
|
}
|
||||||
Playthrough::Playthrough_Repeat(excludedLocations, enabledTricks, count);
|
Playthrough::Playthrough_Repeat(excludedLocations, enabledTricks, count);
|
||||||
|
|
|
@ -13,7 +13,7 @@ double RandomDouble();
|
||||||
|
|
||||||
// Get a random element from a vector or array
|
// Get a random element from a vector or array
|
||||||
template <typename T> T RandomElement(std::vector<T>& vector, bool erase) {
|
template <typename T> T RandomElement(std::vector<T>& vector, bool erase) {
|
||||||
const auto idx = Random(0, vector.size());
|
const auto idx = Random(0, static_cast<uint32_t>(vector.size()));
|
||||||
const T selected = vector[idx];
|
const T selected = vector[idx];
|
||||||
if (erase) {
|
if (erase) {
|
||||||
vector.erase(vector.begin() + idx);
|
vector.erase(vector.begin() + idx);
|
||||||
|
|
|
@ -115,7 +115,7 @@ uint16_t GetPriceFromSettings(Rando::Location* loc, PriceSettingsStruct priceSet
|
||||||
if (random < ShopPriceProbability[i]) {
|
if (random < ShopPriceProbability[i]) {
|
||||||
// The randomly generated value has surpassed the total probability up to this point, so this is the
|
// The randomly generated value has surpassed the total probability up to this point, so this is the
|
||||||
// generated price i in range [0, 59], output in range [0, 295] in increments of 5
|
// generated price i in range [0, 59], output in range [0, 295] in increments of 5
|
||||||
return i * 5;
|
return static_cast<uint16_t>(i) * 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 150;
|
return 150;
|
||||||
|
@ -196,7 +196,8 @@ uint16_t GetCheapBalancedPrice() {
|
||||||
double random = RandomDouble();
|
double random = RandomDouble();
|
||||||
for (size_t i = 0; i < CheapPriceProbability.size(); i++) {
|
for (size_t i = 0; i < CheapPriceProbability.size(); i++) {
|
||||||
if (random < CheapPriceProbability[i]) {
|
if (random < CheapPriceProbability[i]) {
|
||||||
return i * 5; // i in range [0, 19], output in range [0, 95] in increments of 5
|
// i in range [0, 19], output in range [0, 95] in increments of 5
|
||||||
|
return static_cast<uint16_t>(i) * 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -632,7 +632,7 @@ void PlandomizerLoadSpoilerLog(std::string logFile) {
|
||||||
PlandomizerAddToItemList(plandomizerRandoRetrieveItem(RG_SOLD_OUT));
|
PlandomizerAddToItemList(plandomizerRandoRetrieveItem(RG_SOLD_OUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (nlohmann::json::parse_error& e) {
|
} catch (nlohmann::json::parse_error&) {
|
||||||
Notification::Emit({ .message = "Invalid Spoiler Log Format", .remainingTime = 10.0f });
|
Notification::Emit({ .message = "Invalid Spoiler Log Format", .remainingTime = 10.0f });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -967,7 +967,7 @@ void PlandomizerDrawOptions() {
|
||||||
}
|
}
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
|
|
||||||
size_t index = 0;
|
int32_t index = 0;
|
||||||
PlandoPushImageButtonStyle();
|
PlandoPushImageButtonStyle();
|
||||||
for (auto& hash : plandoHash) {
|
for (auto& hash : plandoHash) {
|
||||||
ImGui::PushID(index);
|
ImGui::PushID(index);
|
||||||
|
@ -995,7 +995,7 @@ void PlandomizerDrawOptions() {
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
if (downRet) {
|
if (downRet) {
|
||||||
if (hash == 0) {
|
if (hash == 0) {
|
||||||
hash = gSeedTextures.size() - 1;
|
hash = static_cast<int32_t>(gSeedTextures.size()) - 1;
|
||||||
} else {
|
} else {
|
||||||
hash--;
|
hash--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ void EnCow_MoveForRandomizer(EnCow* enCow, PlayState* play) {
|
||||||
// Move left cow in lon lon tower
|
// Move left cow in lon lon tower
|
||||||
enCow->actor.world.pos.x = -229.0f;
|
enCow->actor.world.pos.x = -229.0f;
|
||||||
enCow->actor.world.pos.z = 157.0f;
|
enCow->actor.world.pos.z = 157.0f;
|
||||||
enCow->actor.shape.rot.y = 15783.0f;
|
enCow->actor.shape.rot.y = 15783;
|
||||||
moved = true;
|
moved = true;
|
||||||
} else if (play->sceneNum == SCENE_STABLE && enCow->actor.world.pos.x == -3 && enCow->actor.world.pos.z == -254) {
|
} else if (play->sceneNum == SCENE_STABLE && enCow->actor.world.pos.x == -3 && enCow->actor.world.pos.z == -254) {
|
||||||
// Move right cow in lon lon stable
|
// Move right cow in lon lon stable
|
||||||
|
@ -39,7 +39,8 @@ void RegisterShuffleCows() {
|
||||||
COND_VB_SHOULD(VB_GIVE_ITEM_FROM_COW, shouldRegister, {
|
COND_VB_SHOULD(VB_GIVE_ITEM_FROM_COW, shouldRegister, {
|
||||||
EnCow* enCow = va_arg(args, EnCow*);
|
EnCow* enCow = va_arg(args, EnCow*);
|
||||||
CowIdentity cowIdentity = OTRGlobals::Instance->gRandomizer->IdentifyCow(
|
CowIdentity cowIdentity = OTRGlobals::Instance->gRandomizer->IdentifyCow(
|
||||||
gPlayState->sceneNum, enCow->actor.world.pos.x, enCow->actor.world.pos.z);
|
gPlayState->sceneNum, static_cast<int32_t>(enCow->actor.world.pos.x),
|
||||||
|
static_cast<int32_t>(enCow->actor.world.pos.z));
|
||||||
// Has this cow already rewarded an item?
|
// Has this cow already rewarded an item?
|
||||||
if (!Flags_GetRandomizerInf(cowIdentity.randomizerInf)) {
|
if (!Flags_GetRandomizerInf(cowIdentity.randomizerInf)) {
|
||||||
Flags_SetRandomizerInf(cowIdentity.randomizerInf);
|
Flags_SetRandomizerInf(cowIdentity.randomizerInf);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "static_data.h"
|
#include "static_data.h"
|
||||||
#include <libultraship/libultra.h>
|
#include <libultraship/libultra.h>
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
#include "soh/ResourceManagerHelpers.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "variables.h"
|
#include "variables.h"
|
||||||
|
@ -11,7 +12,6 @@ extern "C" {
|
||||||
#include "overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h"
|
#include "overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h"
|
||||||
#include "objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h"
|
#include "objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h"
|
||||||
#include "soh/Enhancements/enhancementTypes.h"
|
#include "soh/Enhancements/enhancementTypes.h"
|
||||||
#include "soh/ResourceManagerHelpers.h"
|
|
||||||
extern PlayState* gPlayState;
|
extern PlayState* gPlayState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ void ObjKibako2_RandomizerSpawnCollectible(ObjKibako2* crateActor, PlayState* pl
|
||||||
item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem;
|
item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem;
|
||||||
item00->actor.velocity.y = 8.0f;
|
item00->actor.velocity.y = 8.0f;
|
||||||
item00->actor.speedXZ = 2.0f;
|
item00->actor.speedXZ = 2.0f;
|
||||||
item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f);
|
item00->actor.world.rot.y = static_cast<int16_t>(Rand_CenteredFloat(65536.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjKibako_RandomizerSpawnCollectible(ObjKibako* smallCrateActor, PlayState* play) {
|
void ObjKibako_RandomizerSpawnCollectible(ObjKibako* smallCrateActor, PlayState* play) {
|
||||||
|
@ -206,7 +206,7 @@ void ObjKibako_RandomizerSpawnCollectible(ObjKibako* smallCrateActor, PlayState*
|
||||||
item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem;
|
item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem;
|
||||||
item00->actor.velocity.y = 8.0f;
|
item00->actor.velocity.y = 8.0f;
|
||||||
item00->actor.speedXZ = 2.0f;
|
item00->actor.speedXZ = 2.0f;
|
||||||
item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f);
|
item00->actor.world.rot.y = static_cast<int16_t>(Rand_CenteredFloat(65536.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjKibako2_RandomizerInit(void* actorRef) {
|
void ObjKibako2_RandomizerInit(void* actorRef) {
|
||||||
|
|
|
@ -117,7 +117,7 @@ void EnKusa_RandomizerSpawnCollectible(EnKusa* grassActor, PlayState* play) {
|
||||||
item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem;
|
item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem;
|
||||||
item00->actor.velocity.y = 8.0f;
|
item00->actor.velocity.y = 8.0f;
|
||||||
item00->actor.speedXZ = 2.0f;
|
item00->actor.speedXZ = 2.0f;
|
||||||
item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f);
|
item00->actor.world.rot.y = static_cast<int16_t>(Rand_CenteredFloat(65536.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnKusa_RandomizerInit(void* actorRef) {
|
void EnKusa_RandomizerInit(void* actorRef) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ void ObjTsubo_RandomizerSpawnCollectible(ObjTsubo* potActor, PlayState* play) {
|
||||||
item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem;
|
item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem;
|
||||||
item00->actor.velocity.y = 8.0f;
|
item00->actor.velocity.y = 8.0f;
|
||||||
item00->actor.speedXZ = 2.0f;
|
item00->actor.speedXZ = 2.0f;
|
||||||
item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f);
|
item00->actor.world.rot.y = static_cast<int16_t>(Rand_CenteredFloat(65536.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjTsubo_RandomizerInit(void* actorRef) {
|
void ObjTsubo_RandomizerInit(void* actorRef) {
|
||||||
|
|
|
@ -597,7 +597,7 @@ extern "C" s32 OverrideLimbDrawBarinade(PlayState* play, s32 limbIndex, Gfx** dL
|
||||||
(uintptr_t)Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 8, 16, 1, 0,
|
(uintptr_t)Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 8, 16, 1, 0,
|
||||||
(play->gameplayFrames * -2) % 64, 16, 16));
|
(play->gameplayFrames * -2) % 64, 16, 16));
|
||||||
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 200);
|
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 200);
|
||||||
Matrix_RotateX(-M_PI / 2, MTXMODE_APPLY);
|
Matrix_RotateX(-M_PIf / 2.0f, MTXMODE_APPLY);
|
||||||
} else if ((limbIndex >= 10) && (limbIndex < 20)) {
|
} else if ((limbIndex >= 10) && (limbIndex < 20)) {
|
||||||
rot->x -= 0x4000;
|
rot->x -= 0x4000;
|
||||||
*dList = NULL;
|
*dList = NULL;
|
||||||
|
@ -1097,7 +1097,7 @@ extern "C" void Randomizer_DrawBronzeScale(PlayState* play, GetItemEntry* getIte
|
||||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||||
(uintptr_t)Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 2),
|
(uintptr_t)Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 2),
|
||||||
-1 * (play->state.frames * 2), 64, 64, 1, 1 * (play->state.frames * 4),
|
-1 * (play->state.frames * 2), 64, 64, 1, 1 * (play->state.frames * 4),
|
||||||
1 * -(play->state.frames * 4), 32, 32));
|
-1 * (play->state.frames * 4), 32, 32));
|
||||||
|
|
||||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
||||||
G_MTX_MODELVIEW | G_MTX_LOAD);
|
G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||||
|
@ -1116,7 +1116,7 @@ extern "C" void Randomizer_DrawFishingPoleGI(PlayState* play, GetItemEntry* getI
|
||||||
|
|
||||||
// Draw rod
|
// Draw rod
|
||||||
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
||||||
Matrix_Scale(0.2, 0.2, 0.2, MTXMODE_APPLY);
|
Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY);
|
||||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
||||||
G_MTX_MODELVIEW | G_MTX_LOAD);
|
G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||||
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingPoleGiDL);
|
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingPoleGiDL);
|
||||||
|
@ -1126,8 +1126,8 @@ extern "C" void Randomizer_DrawFishingPoleGI(PlayState* play, GetItemEntry* getI
|
||||||
Matrix_Scale(5.0f, 5.0f, 5.0f, MTXMODE_APPLY);
|
Matrix_Scale(5.0f, 5.0f, 5.0f, MTXMODE_APPLY);
|
||||||
pos = { 0.0f, -25.5f, -4.0f };
|
pos = { 0.0f, -25.5f, -4.0f };
|
||||||
Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_APPLY);
|
Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_APPLY);
|
||||||
Matrix_RotateZ(-M_PI_2, MTXMODE_APPLY);
|
Matrix_RotateZ(-M_PI_2f, MTXMODE_APPLY);
|
||||||
Matrix_RotateY(-M_PI_2 - 0.2f, MTXMODE_APPLY);
|
Matrix_RotateY(-M_PI_2f - 0.2f, MTXMODE_APPLY);
|
||||||
Matrix_Scale(0.006f, 0.006f, 0.006f, MTXMODE_APPLY);
|
Matrix_Scale(0.006f, 0.006f, 0.006f, MTXMODE_APPLY);
|
||||||
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
||||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
||||||
|
@ -1140,7 +1140,7 @@ extern "C" void Randomizer_DrawFishingPoleGI(PlayState* play, GetItemEntry* getI
|
||||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
||||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||||
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL);
|
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL);
|
||||||
Matrix_RotateZ(M_PI_2, MTXMODE_APPLY);
|
Matrix_RotateZ(M_PI_2f, MTXMODE_APPLY);
|
||||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
||||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||||
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL);
|
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL);
|
||||||
|
@ -1149,7 +1149,7 @@ extern "C" void Randomizer_DrawFishingPoleGI(PlayState* play, GetItemEntry* getI
|
||||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
||||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||||
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL);
|
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL);
|
||||||
Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY);
|
Matrix_RotateZ(M_PIf / 2.0f, MTXMODE_APPLY);
|
||||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
||||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||||
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL);
|
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL);
|
||||||
|
|
|
@ -226,7 +226,8 @@ uint8_t Hint::GetNumberOfMessages() const {
|
||||||
if (numMessages == 0) {
|
if (numMessages == 0) {
|
||||||
numMessages = 1; // RANDOTODO make std::max actually fucking work for 3 arguments
|
numMessages = 1; // RANDOTODO make std::max actually fucking work for 3 arguments
|
||||||
}
|
}
|
||||||
return numMessages;
|
// RANDOTODO will number of messages always be u8?
|
||||||
|
return static_cast<uint8_t>(numMessages);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::string> Hint::GetAllMessageStrings(MessageFormat format) const {
|
const std::vector<std::string> Hint::GetAllMessageStrings(MessageFormat format) const {
|
||||||
|
|
|
@ -1013,7 +1013,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l
|
||||||
if (item00->itemEntry.getItemId == GI_SWORD_BGS) {
|
if (item00->itemEntry.getItemId == GI_SWORD_BGS) {
|
||||||
gSaveContext.bgsFlag = true;
|
gSaveContext.bgsFlag = true;
|
||||||
}
|
}
|
||||||
Item_Give(gPlayState, item00->itemEntry.itemId);
|
Item_Give(gPlayState, static_cast<uint8_t>(item00->itemEntry.itemId));
|
||||||
} else if (item00->itemEntry.modIndex == MOD_RANDOMIZER) {
|
} else if (item00->itemEntry.modIndex == MOD_RANDOMIZER) {
|
||||||
if (item00->itemEntry.getItemId == RG_ICE_TRAP) {
|
if (item00->itemEntry.getItemId == RG_ICE_TRAP) {
|
||||||
gSaveContext.ship.pendingIceTrapCount++;
|
gSaveContext.ship.pendingIceTrapCount++;
|
||||||
|
@ -2137,23 +2137,23 @@ void RandomizerOnActorInitHandler(void* actorRef) {
|
||||||
|
|
||||||
void RandomizerOnGameFrameUpdateHandler() {
|
void RandomizerOnGameFrameUpdateHandler() {
|
||||||
if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_QUIVER)) {
|
if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_QUIVER)) {
|
||||||
AMMO(ITEM_BOW) = CUR_CAPACITY(UPG_QUIVER);
|
AMMO(ITEM_BOW) = static_cast<int8_t>(CUR_CAPACITY(UPG_QUIVER));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_BOMB_BAG)) {
|
if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_BOMB_BAG)) {
|
||||||
AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG);
|
AMMO(ITEM_BOMB) = static_cast<int8_t>(CUR_CAPACITY(UPG_BOMB_BAG));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_BULLET_BAG)) {
|
if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_BULLET_BAG)) {
|
||||||
AMMO(ITEM_SLINGSHOT) = CUR_CAPACITY(UPG_BULLET_BAG);
|
AMMO(ITEM_SLINGSHOT) = static_cast<int8_t>(CUR_CAPACITY(UPG_BULLET_BAG));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_STICK_UPGRADE)) {
|
if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_STICK_UPGRADE)) {
|
||||||
AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS);
|
AMMO(ITEM_STICK) = static_cast<int8_t>(CUR_CAPACITY(UPG_STICKS));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_NUT_UPGRADE)) {
|
if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_NUT_UPGRADE)) {
|
||||||
AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS);
|
AMMO(ITEM_NUT) = static_cast<int8_t>(CUR_CAPACITY(UPG_NUTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MAGIC_METER)) {
|
if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MAGIC_METER)) {
|
||||||
|
@ -2165,7 +2165,7 @@ void RandomizerOnGameFrameUpdateHandler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MONEY)) {
|
if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MONEY)) {
|
||||||
gSaveContext.rupees = CUR_CAPACITY(UPG_WALLET);
|
gSaveContext.rupees = static_cast<int8_t>(CUR_CAPACITY(UPG_WALLET));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Flags_GetRandomizerInf(RAND_INF_HAS_WALLET)) {
|
if (!Flags_GetRandomizerInf(RAND_INF_HAS_WALLET)) {
|
||||||
|
|
|
@ -1814,7 +1814,7 @@ void Logic::ApplyItemEffect(Item& item, bool state) {
|
||||||
if (randoGet == RG_BOTTLE_WITH_BIG_POE) {
|
if (randoGet == RG_BOTTLE_WITH_BIG_POE) {
|
||||||
BigPoes++;
|
BigPoes++;
|
||||||
}
|
}
|
||||||
mSaveContext->inventory.items[slot] = itemId;
|
mSaveContext->inventory.items[slot] = static_cast<uint8_t>(itemId);
|
||||||
} break;
|
} break;
|
||||||
case RG_RUTOS_LETTER:
|
case RG_RUTOS_LETTER:
|
||||||
SetRandoInf(RAND_INF_OBTAINED_RUTOS_LETTER, state);
|
SetRandoInf(RAND_INF_OBTAINED_RUTOS_LETTER, state);
|
||||||
|
@ -2306,7 +2306,7 @@ void Logic::SetEventChkInf(int32_t flag, bool state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Logic::GetGSCount() {
|
uint8_t Logic::GetGSCount() {
|
||||||
return mSaveContext->inventory.gsTokens;
|
return static_cast<uint8_t>(mSaveContext->inventory.gsTokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Logic::GetAmmo(uint32_t item) {
|
uint8_t Logic::GetAmmo(uint32_t item) {
|
||||||
|
|
|
@ -83,11 +83,11 @@ void Option::RestoreDelayedOption() {
|
||||||
contextSelection = delayedSelection;
|
contextSelection = delayedSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Option::SetContextIndex(size_t idx) {
|
void Option::SetContextIndex(uint8_t idx) {
|
||||||
// TODO: Set to Context's OptionValue array.
|
// TODO: Set to Context's OptionValue array.
|
||||||
contextSelection = idx;
|
contextSelection = idx;
|
||||||
if (contextSelection > options.size() - 1) {
|
if (contextSelection > static_cast<uint8_t>(options.size() - 1)) {
|
||||||
contextSelection = options.size() - 1;
|
contextSelection = static_cast<uint8_t>(options.size() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ bool Option::IsHidden() const {
|
||||||
|
|
||||||
void Option::ChangeOptions(std::vector<std::string> opts) {
|
void Option::ChangeOptions(std::vector<std::string> opts) {
|
||||||
if (GetOptionIndex() >= opts.size()) {
|
if (GetOptionIndex() >= opts.size()) {
|
||||||
CVarSetInteger(cvarName.c_str(), opts.size() - 1);
|
CVarSetInteger(cvarName.c_str(), static_cast<uint8_t>(opts.size() - 1));
|
||||||
}
|
}
|
||||||
options = std::move(opts);
|
options = std::move(opts);
|
||||||
}
|
}
|
||||||
|
@ -206,8 +206,8 @@ bool Option::RenderCheckbox() {
|
||||||
bool Option::RenderCombobox() {
|
bool Option::RenderCombobox() {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
uint8_t selected = CVarGetInteger(cvarName.c_str(), defaultOption);
|
uint8_t selected = CVarGetInteger(cvarName.c_str(), defaultOption);
|
||||||
if (selected >= options.size()) {
|
if (selected >= static_cast<uint8_t>(options.size())) {
|
||||||
selected = options.size();
|
selected = static_cast<uint8_t>(options.size());
|
||||||
CVarSetInteger(cvarName.c_str(), selected);
|
CVarSetInteger(cvarName.c_str(), selected);
|
||||||
changed = true;
|
changed = true;
|
||||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
|
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
|
||||||
|
@ -231,13 +231,13 @@ bool Option::RenderSlider() {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
int val = CVarGetInteger(cvarName.c_str(), defaultOption);
|
int val = CVarGetInteger(cvarName.c_str(), defaultOption);
|
||||||
if (val > options.size() - 1) {
|
if (val > options.size() - 1) {
|
||||||
val = options.size() - 1;
|
val = static_cast<int>(options.size()) - 1;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
UIWidgets::IntSliderOptions widgetOptions = UIWidgets::IntSliderOptions()
|
UIWidgets::IntSliderOptions widgetOptions = UIWidgets::IntSliderOptions()
|
||||||
.Color(THEME_COLOR)
|
.Color(THEME_COLOR)
|
||||||
.Min(0)
|
.Min(0)
|
||||||
.Max(options.size() - 1)
|
.Max(static_cast<uint8_t>(options.size() - 1))
|
||||||
.Tooltip(description.c_str())
|
.Tooltip(description.c_str())
|
||||||
.Format(options[val].c_str())
|
.Format(options[val].c_str())
|
||||||
.DefaultValue(defaultOption);
|
.DefaultValue(defaultOption);
|
||||||
|
|
|
@ -241,11 +241,11 @@ class Option {
|
||||||
void RestoreDelayedOption();
|
void RestoreDelayedOption();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the rando context index for this Option. Also calls `SetVariable()`.
|
* @brief Set the rando context index for this Option.
|
||||||
*
|
*
|
||||||
* @param idx the index to set as the selected index.
|
* @param idx the index to set as the selected index.
|
||||||
*/
|
*/
|
||||||
void SetContextIndex(size_t idx);
|
void SetContextIndex(uint8_t idx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Hides this Option in the menu. (Not currently being used afaik, we prefer to
|
* @brief Hides this Option in the menu. (Not currently being used afaik, we prefer to
|
||||||
|
|
|
@ -355,9 +355,12 @@ std::unordered_map<s16, s16> getItemIdToItemId = {
|
||||||
{ GI_CLAIM_CHECK, ITEM_CLAIM_CHECK },
|
{ GI_CLAIM_CHECK, ITEM_CLAIM_CHECK },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
#pragma optimize("", off)
|
#pragma optimize("", off)
|
||||||
|
#else
|
||||||
#pragma GCC push_options
|
#pragma GCC push_options
|
||||||
#pragma GCC optimize("O0")
|
#pragma GCC optimize("O0")
|
||||||
|
#endif
|
||||||
bool Randomizer::SpoilerFileExists(const char* spoilerFileName) {
|
bool Randomizer::SpoilerFileExists(const char* spoilerFileName) {
|
||||||
if (strcmp(spoilerFileName, "") != 0) {
|
if (strcmp(spoilerFileName, "") != 0) {
|
||||||
std::ifstream spoilerFileStream(SohUtils::Sanitize(spoilerFileName));
|
std::ifstream spoilerFileStream(SohUtils::Sanitize(spoilerFileName));
|
||||||
|
@ -370,8 +373,11 @@ bool Randomizer::SpoilerFileExists(const char* spoilerFileName) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#pragma GCC pop_options
|
#ifdef _MSC_VER
|
||||||
#pragma optimize("", on)
|
#pragma optimize("", on)
|
||||||
|
#else
|
||||||
|
#pragma GCC pop_options
|
||||||
|
#endif
|
||||||
|
|
||||||
void Randomizer::LoadHintMessages() {
|
void Randomizer::LoadHintMessages() {
|
||||||
auto ctx = Rando::Context::GetInstance();
|
auto ctx = Rando::Context::GetInstance();
|
||||||
|
@ -3504,9 +3510,9 @@ CrateIdentity Randomizer::IdentifyCrate(s32 sceneNum, s32 posX, s32 posZ) {
|
||||||
crateSceneNum = SCENE_MARKET_DAY;
|
crateSceneNum = SCENE_MARKET_DAY;
|
||||||
} else if (sceneNum == SCENE_GERUDOS_FORTRESS && gPlayState->linkAgeOnLoad == 1 && posX == 310) {
|
} else if (sceneNum == SCENE_GERUDOS_FORTRESS && gPlayState->linkAgeOnLoad == 1 && posX == 310) {
|
||||||
if (posZ == -1830) {
|
if (posZ == -1830) {
|
||||||
posZ = -1842.0f;
|
posZ = -1842;
|
||||||
} else if (posZ == -1770) {
|
} else if (posZ == -1770) {
|
||||||
posZ = -1782.0f;
|
posZ = -1782;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4098,7 +4104,7 @@ void RandomizerSettingsWindow::DrawElement() {
|
||||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
|
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ImGui::BeginTable("trickTags", showTag.size(),
|
if (ImGui::BeginTable("trickTags", static_cast<int>(showTag.size()),
|
||||||
ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings |
|
ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings |
|
||||||
ImGuiTableFlags_Borders)) {
|
ImGuiTableFlags_Borders)) {
|
||||||
for (auto [rtTag, isShown] : showTag) {
|
for (auto [rtTag, isShown] : showTag) {
|
||||||
|
@ -5573,7 +5579,7 @@ void RandomizerSettingsWindow::InitElement() {
|
||||||
// (special cases for rando items)
|
// (special cases for rando items)
|
||||||
void Randomizer_GameplayStats_SetTimestamp(uint16_t item) {
|
void Randomizer_GameplayStats_SetTimestamp(uint16_t item) {
|
||||||
|
|
||||||
u32 time = GAMEPLAYSTAT_TOTAL_TIME;
|
u32 time = static_cast<u32>(GAMEPLAYSTAT_TOTAL_TIME);
|
||||||
|
|
||||||
// Have items in Link's pocket shown as being obtained at 0.1 seconds
|
// Have items in Link's pocket shown as being obtained at 0.1 seconds
|
||||||
if (time == 0) {
|
if (time == 0) {
|
||||||
|
@ -5869,7 +5875,7 @@ extern "C" u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) {
|
||||||
case RG_GREG_RUPEE:
|
case RG_GREG_RUPEE:
|
||||||
Rupees_ChangeBy(1);
|
Rupees_ChangeBy(1);
|
||||||
Flags_SetRandomizerInf(RAND_INF_GREG_FOUND);
|
Flags_SetRandomizerInf(RAND_INF_GREG_FOUND);
|
||||||
gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_FOUND_GREG] = GAMEPLAYSTAT_TOTAL_TIME;
|
gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_FOUND_GREG] = static_cast<u32>(GAMEPLAYSTAT_TOTAL_TIME);
|
||||||
break;
|
break;
|
||||||
case RG_TRIFORCE_PIECE:
|
case RG_TRIFORCE_PIECE:
|
||||||
gSaveContext.ship.quest.data.randomizer.triforcePiecesCollected++;
|
gSaveContext.ship.quest.data.randomizer.triforcePiecesCollected++;
|
||||||
|
@ -5878,7 +5884,8 @@ extern "C" u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) {
|
||||||
// Teleport to credits when goal is reached.
|
// Teleport to credits when goal is reached.
|
||||||
if (gSaveContext.ship.quest.data.randomizer.triforcePiecesCollected ==
|
if (gSaveContext.ship.quest.data.randomizer.triforcePiecesCollected ==
|
||||||
(OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED) + 1)) {
|
(OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED) + 1)) {
|
||||||
gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_TRIFORCE_COMPLETED] = GAMEPLAYSTAT_TOTAL_TIME;
|
gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_TRIFORCE_COMPLETED] =
|
||||||
|
static_cast<u32>(GAMEPLAYSTAT_TOTAL_TIME);
|
||||||
gSaveContext.ship.stats.gameComplete = 1;
|
gSaveContext.ship.stats.gameComplete = 1;
|
||||||
Flags_SetRandomizerInf(RAND_INF_GRANT_GANONS_BOSSKEY);
|
Flags_SetRandomizerInf(RAND_INF_GRANT_GANONS_BOSSKEY);
|
||||||
Play_PerformSave(play);
|
Play_PerformSave(play);
|
||||||
|
@ -5911,12 +5918,12 @@ extern "C" u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) {
|
||||||
case RG_DEKU_STICK_BAG:
|
case RG_DEKU_STICK_BAG:
|
||||||
Inventory_ChangeUpgrade(UPG_STICKS, 1);
|
Inventory_ChangeUpgrade(UPG_STICKS, 1);
|
||||||
INV_CONTENT(ITEM_STICK) = ITEM_STICK;
|
INV_CONTENT(ITEM_STICK) = ITEM_STICK;
|
||||||
AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS);
|
AMMO(ITEM_STICK) = static_cast<int8_t>(CUR_CAPACITY(UPG_STICKS));
|
||||||
break;
|
break;
|
||||||
case RG_DEKU_NUT_BAG:
|
case RG_DEKU_NUT_BAG:
|
||||||
Inventory_ChangeUpgrade(UPG_NUTS, 1);
|
Inventory_ChangeUpgrade(UPG_NUTS, 1);
|
||||||
INV_CONTENT(ITEM_NUT) = ITEM_NUT;
|
INV_CONTENT(ITEM_NUT) = ITEM_NUT;
|
||||||
AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS);
|
AMMO(ITEM_NUT) = static_cast<int8_t>(CUR_CAPACITY(UPG_NUTS));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LUSLOG_WARN("Randomizer_Item_Give didn't have behaviour specified for getItemId=%d", item);
|
LUSLOG_WARN("Randomizer_Item_Give didn't have behaviour specified for getItemId=%d", item);
|
||||||
|
|
|
@ -1892,16 +1892,16 @@ static std::set<std::string> rainbowCVars = {
|
||||||
|
|
||||||
int hue = 0;
|
int hue = 0;
|
||||||
void RainbowTick() {
|
void RainbowTick() {
|
||||||
float freqHue = hue * 2 * M_PI / (360 * CVarGetFloat(CVAR_COSMETIC("RainbowSpeed"), 0.6f));
|
float freqHue = hue * 2 * M_PIf / (360 * CVarGetFloat(CVAR_COSMETIC("RainbowSpeed"), 0.6f));
|
||||||
for (auto& cvar : rainbowCVars) {
|
for (auto& cvar : rainbowCVars) {
|
||||||
if (CVarGetInteger((cvar + ".Rainbow").c_str(), 0) == 0) {
|
if (CVarGetInteger((cvar + ".Rainbow").c_str(), 0) == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color_RGBA8 newColor;
|
Color_RGBA8 newColor;
|
||||||
newColor.r = sin(freqHue + 0) * 127 + 128;
|
newColor.r = static_cast<uint8_t>(sin(freqHue + 0) * 127) + 128;
|
||||||
newColor.g = sin(freqHue + (2 * M_PI / 3)) * 127 + 128;
|
newColor.g = static_cast<uint8_t>(sin(freqHue + (2 * M_PI / 3)) * 127) + 128;
|
||||||
newColor.b = sin(freqHue + (4 * M_PI / 3)) * 127 + 128;
|
newColor.b = static_cast<uint8_t>(sin(freqHue + (4 * M_PI / 3)) * 127) + 128;
|
||||||
newColor.a = 255;
|
newColor.a = 255;
|
||||||
|
|
||||||
CVarSetColor((cvar + ".Value").c_str(), newColor);
|
CVarSetColor((cvar + ".Value").c_str(), newColor);
|
||||||
|
|
|
@ -382,7 +382,7 @@ const EntranceData entranceData[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check if Link is in the area and return that scene/entrance for tracking
|
// Check if Link is in the area and return that scene/entrance for tracking
|
||||||
s8 LinkIsInArea(const EntranceData* entrance) {
|
int16_t LinkIsInArea(const EntranceData* entrance) {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (gPlayState == nullptr) {
|
if (gPlayState == nullptr) {
|
||||||
|
|
|
@ -670,17 +670,17 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) {
|
||||||
|
|
||||||
void DrawEquip(ItemTrackerItem item) {
|
void DrawEquip(ItemTrackerItem item) {
|
||||||
bool hasEquip = HasEquipment(item);
|
bool hasEquip = HasEquipment(item);
|
||||||
int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
|
float iconSize = static_cast<float>(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36));
|
||||||
ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
|
ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
|
||||||
hasEquip && IsValidSaveFile() ? item.name : item.nameFaded),
|
hasEquip && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize, iconSize), ImVec2(0.0f, 0.0f), ImVec2(1, 1));
|
||||||
|
|
||||||
Tooltip(SohUtils::GetItemName(item.id).c_str());
|
Tooltip(SohUtils::GetItemName(item.id).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawQuest(ItemTrackerItem item) {
|
void DrawQuest(ItemTrackerItem item) {
|
||||||
bool hasQuestItem = HasQuestItem(item);
|
bool hasQuestItem = HasQuestItem(item);
|
||||||
int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
|
float iconSize = static_cast<float>(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36));
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
|
ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
|
||||||
hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
|
@ -698,7 +698,7 @@ void DrawQuest(ItemTrackerItem item) {
|
||||||
void DrawItem(ItemTrackerItem item) {
|
void DrawItem(ItemTrackerItem item) {
|
||||||
|
|
||||||
uint32_t actualItemId = GameInteractor::IsSaveLoaded() ? INV_CONTENT(item.id) : ITEM_NONE;
|
uint32_t actualItemId = GameInteractor::IsSaveLoaded() ? INV_CONTENT(item.id) : ITEM_NONE;
|
||||||
int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
|
float iconSize = static_cast<float>(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36));
|
||||||
bool hasItem = actualItemId != ITEM_NONE;
|
bool hasItem = actualItemId != ITEM_NONE;
|
||||||
std::string itemName = "";
|
std::string itemName = "";
|
||||||
|
|
||||||
|
@ -1015,7 +1015,7 @@ void DrawBottle(ItemTrackerItem item) {
|
||||||
item = actualItemTrackerItemMap[actualItemId];
|
item = actualItemTrackerItemMap[actualItemId];
|
||||||
}
|
}
|
||||||
|
|
||||||
int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
|
float iconSize = static_cast<float>(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36));
|
||||||
ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
|
ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
|
||||||
hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
|
@ -1027,7 +1027,7 @@ void DrawDungeonItem(ItemTrackerItem item) {
|
||||||
uint32_t itemId = item.id;
|
uint32_t itemId = item.id;
|
||||||
ImU32 dungeonColor = IM_COL_WHITE;
|
ImU32 dungeonColor = IM_COL_WHITE;
|
||||||
uint32_t bitMask = 1 << (item.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential
|
uint32_t bitMask = 1 << (item.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential
|
||||||
int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
|
float iconSize = static_cast<float>(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36));
|
||||||
bool hasItem = GameInteractor::IsSaveLoaded() ? (bitMask & gSaveContext.inventory.dungeonItems[item.data]) : false;
|
bool hasItem = GameInteractor::IsSaveLoaded() ? (bitMask & gSaveContext.inventory.dungeonItems[item.data]) : false;
|
||||||
bool hasSmallKey = GameInteractor::IsSaveLoaded() ? ((gSaveContext.inventory.dungeonKeys[item.data]) >= 0) : false;
|
bool hasSmallKey = GameInteractor::IsSaveLoaded() ? ((gSaveContext.inventory.dungeonKeys[item.data]) >= 0) : false;
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
|
@ -1078,19 +1078,19 @@ void DrawDungeonItem(ItemTrackerItem item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawSong(ItemTrackerItem item) {
|
void DrawSong(ItemTrackerItem item) {
|
||||||
int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
|
float iconSize = static_cast<float>(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36));
|
||||||
ImVec2 p = ImGui::GetCursorScreenPos();
|
ImVec2 p = ImGui::GetCursorScreenPos();
|
||||||
bool hasSong = HasSong(item);
|
bool hasSong = HasSong(item);
|
||||||
ImGui::SetCursorScreenPos(ImVec2(p.x + 6, p.y));
|
ImGui::SetCursorScreenPos(ImVec2(p.x + 6, p.y));
|
||||||
ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
|
ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
|
||||||
hasSong && IsValidSaveFile() ? item.name : item.nameFaded),
|
hasSong && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize / 1.5, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize / 1.5f, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
Tooltip(SohUtils::GetQuestItemName(item.id).c_str());
|
Tooltip(SohUtils::GetQuestItemName(item.id).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawNotes(bool resizeable = false) {
|
void DrawNotes(bool resizeable = false) {
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
|
float iconSize = static_cast<float>(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36));
|
||||||
int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12);
|
int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12);
|
||||||
|
|
||||||
struct ItemTrackerNotes {
|
struct ItemTrackerNotes {
|
||||||
|
@ -1113,7 +1113,7 @@ void DrawNotes(bool resizeable = false) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ImVec2 size = resizeable ? ImVec2(-FLT_MIN, ImGui::GetContentRegionAvail().y)
|
ImVec2 size = resizeable ? ImVec2(-FLT_MIN, ImGui::GetContentRegionAvail().y)
|
||||||
: ImVec2(((iconSize + iconSpacing) * 6) - 8, 200);
|
: ImVec2(((iconSize + iconSpacing) * 6) - 8.0f, 200.0f);
|
||||||
if (GameInteractor::IsSaveLoaded()) {
|
if (GameInteractor::IsSaveLoaded()) {
|
||||||
if (ItemTrackerNotes::TrackerNotesInputTextMultiline("##ItemTrackerNotes", &itemTrackerNotes, size,
|
if (ItemTrackerNotes::TrackerNotesInputTextMultiline("##ItemTrackerNotes", &itemTrackerNotes, size,
|
||||||
ImGuiInputTextFlags_AllowTabInput)) {
|
ImGuiInputTextFlags_AllowTabInput)) {
|
||||||
|
@ -1185,7 +1185,7 @@ void EndFloatingWindows() {
|
||||||
* Takes in a vector of ItemTrackerItem and draws them in rows of N items
|
* Takes in a vector of ItemTrackerItem and draws them in rows of N items
|
||||||
*/
|
*/
|
||||||
void DrawItemsInRows(std::vector<ItemTrackerItem> items, int columns = 6) {
|
void DrawItemsInRows(std::vector<ItemTrackerItem> items, int columns = 6) {
|
||||||
int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
|
float iconSize = static_cast<float>(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36));
|
||||||
int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12);
|
int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12);
|
||||||
int topPadding =
|
int topPadding =
|
||||||
(CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW) ? 20 : 0;
|
(CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW) ? 20 : 0;
|
||||||
|
@ -1194,7 +1194,7 @@ void DrawItemsInRows(std::vector<ItemTrackerItem> items, int columns = 6) {
|
||||||
int row = i / columns;
|
int row = i / columns;
|
||||||
int column = i % columns;
|
int column = i % columns;
|
||||||
ImGui::SetCursorPos(
|
ImGui::SetCursorPos(
|
||||||
ImVec2((column * (iconSize + iconSpacing) + 8), (row * (iconSize + iconSpacing)) + 8 + topPadding));
|
ImVec2((column * (iconSize + iconSpacing) + 8.0f), (row * (iconSize + iconSpacing)) + 8.0f + topPadding));
|
||||||
items[i].drawFunc(items[i]);
|
items[i].drawFunc(items[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1208,10 +1208,10 @@ void DrawItemsInACircle(std::vector<ItemTrackerItem> items) {
|
||||||
int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12);
|
int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12);
|
||||||
|
|
||||||
ImVec2 max = ImGui::GetWindowContentRegionMax();
|
ImVec2 max = ImGui::GetWindowContentRegionMax();
|
||||||
float radius = (iconSize + iconSpacing) * 2;
|
float radius = (iconSize + iconSpacing) * 2.0f;
|
||||||
|
|
||||||
for (int i = 0; i < items.size(); i++) {
|
for (int i = 0; i < items.size(); i++) {
|
||||||
float angle = (float)i / items.size() * 2.0f * M_PI;
|
float angle = static_cast<float>(i / items.size() * 2.0f * M_PI);
|
||||||
float x = (radius / 2.0f) * cos(angle) + max.x / 2.0f;
|
float x = (radius / 2.0f) * cos(angle) + max.x / 2.0f;
|
||||||
float y = (radius / 2.0f) * sin(angle) + max.y / 2.0f;
|
float y = (radius / 2.0f) * sin(angle) + max.y / 2.0f;
|
||||||
ImGui::SetCursorPos(ImVec2(x - (CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36) - 8) / 2.0f, y + 4));
|
ImGui::SetCursorPos(ImVec2(x - (CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36) - 8) / 2.0f, y + 4));
|
||||||
|
@ -1225,14 +1225,12 @@ void DrawItemsInACircle(std::vector<ItemTrackerItem> items) {
|
||||||
* to then call DrawItemsInRows
|
* to then call DrawItemsInRows
|
||||||
*/
|
*/
|
||||||
std::vector<ItemTrackerItem> GetDungeonItemsVector(std::vector<ItemTrackerDungeon> dungeons, int columns = 6) {
|
std::vector<ItemTrackerItem> GetDungeonItemsVector(std::vector<ItemTrackerDungeon> dungeons, int columns = 6) {
|
||||||
int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
|
|
||||||
int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12);
|
|
||||||
std::vector<ItemTrackerItem> dungeonItems = {};
|
std::vector<ItemTrackerItem> dungeonItems = {};
|
||||||
|
|
||||||
int rowCount = 0;
|
int rowCount = 0;
|
||||||
for (int i = 0; i < dungeons.size(); i++) {
|
for (int i = 0; i < dungeons.size(); i++) {
|
||||||
if (dungeons[i].items.size() > rowCount)
|
if (dungeons[i].items.size() > rowCount)
|
||||||
rowCount = dungeons[i].items.size();
|
rowCount = static_cast<int32_t>(dungeons[i].items.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < rowCount; i++) {
|
for (int i = 0; i < rowCount; i++) {
|
||||||
|
@ -1469,7 +1467,7 @@ void ItemTrackerSaveFile(SaveContext* saveContext, int sectionID, bool fullSave)
|
||||||
void ItemTrackerLoadFile() {
|
void ItemTrackerLoadFile() {
|
||||||
std::string initialTrackerNotes = "";
|
std::string initialTrackerNotes = "";
|
||||||
SaveManager::Instance->LoadData("personalNotes", initialTrackerNotes);
|
SaveManager::Instance->LoadData("personalNotes", initialTrackerNotes);
|
||||||
itemTrackerNotes.resize(initialTrackerNotes.length() + 1);
|
itemTrackerNotes.resize(static_cast<int>(initialTrackerNotes.length() + 1));
|
||||||
if (initialTrackerNotes != "") {
|
if (initialTrackerNotes != "") {
|
||||||
SohUtils::CopyStringToCharArray(itemTrackerNotes.Data, initialTrackerNotes.c_str(), itemTrackerNotes.size());
|
SohUtils::CopyStringToCharArray(itemTrackerNotes.Data, initialTrackerNotes.c_str(), itemTrackerNotes.size());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -22,7 +22,7 @@ void StartingItemGive(GetItemEntry getItemEntry, RandomizerCheck randomizerCheck
|
||||||
if (getItemEntry.getItemId == GI_SWORD_BGS) {
|
if (getItemEntry.getItemId == GI_SWORD_BGS) {
|
||||||
gSaveContext.bgsFlag = true;
|
gSaveContext.bgsFlag = true;
|
||||||
}
|
}
|
||||||
Item_Give(NULL, getItemEntry.itemId);
|
Item_Give(NULL, static_cast<uint8_t>(getItemEntry.itemId));
|
||||||
} else if (getItemEntry.modIndex == MOD_RANDOMIZER) {
|
} else if (getItemEntry.modIndex == MOD_RANDOMIZER) {
|
||||||
if (getItemEntry.getItemId == RG_ICE_TRAP) {
|
if (getItemEntry.getItemId == RG_ICE_TRAP) {
|
||||||
gSaveContext.ship.pendingIceTrapCount++;
|
gSaveContext.ship.pendingIceTrapCount++;
|
||||||
|
|
|
@ -24,7 +24,7 @@ std::vector<std::string> NumOpts(const int min, const int max, const int step =
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> MultiVecOpts(const std::vector<std::vector<std::string>>& optionsVector) {
|
std::vector<std::string> MultiVecOpts(const std::vector<std::vector<std::string>>& optionsVector) {
|
||||||
uint32_t totalSize = 0;
|
size_t totalSize = 0;
|
||||||
for (const auto& vector : optionsVector) {
|
for (const auto& vector : optionsVector) {
|
||||||
totalSize += vector.size();
|
totalSize += vector.size();
|
||||||
}
|
}
|
||||||
|
@ -2638,7 +2638,7 @@ void Context::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocation
|
||||||
mqSet += 1;
|
mqSet += 1;
|
||||||
break;
|
break;
|
||||||
case RO_MQ_SET_RANDOM:
|
case RO_MQ_SET_RANDOM:
|
||||||
randMQOption.push_back(i);
|
randMQOption.push_back(static_cast<uint8_t>(i));
|
||||||
dungeons[i]->SetDungeonKnown(false);
|
dungeons[i]->SetDungeonKnown(false);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -2659,7 +2659,7 @@ void Context::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocation
|
||||||
// otherwise, make everything a possibility and unknown
|
// otherwise, make everything a possibility and unknown
|
||||||
} else {
|
} else {
|
||||||
for (size_t i = 0; i < dungeons.size(); i++) {
|
for (size_t i = 0; i < dungeons.size(); i++) {
|
||||||
randMQOption.push_back(i);
|
randMQOption.push_back(static_cast<uint8_t>(i));
|
||||||
dungeons[i]->SetDungeonKnown(false);
|
dungeons[i]->SetDungeonKnown(false);
|
||||||
mOptions[dungeons[i]->GetMQSetting()].Set(RO_MQ_SET_RANDOM);
|
mOptions[dungeons[i]->GetMQSetting()].Set(RO_MQ_SET_RANDOM);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,11 @@
|
||||||
#define BTN_CUSTOM_OCARINA_PITCH_UP ((CONTROLLERBUTTONS_T)0x00400000)
|
#define BTN_CUSTOM_OCARINA_PITCH_UP ((CONTROLLERBUTTONS_T)0x00400000)
|
||||||
#define BTN_CUSTOM_OCARINA_PITCH_DOWN ((CONTROLLERBUTTONS_T)0x00800000)
|
#define BTN_CUSTOM_OCARINA_PITCH_DOWN ((CONTROLLERBUTTONS_T)0x00800000)
|
||||||
|
|
||||||
|
#define M_PIf 3.14159265358979323846f
|
||||||
|
#define M_PI_2f 1.57079632679489661923f // pi/2
|
||||||
|
#define M_SQRT2f 1.41421356237309504880f
|
||||||
|
#define M_SQRT1_2f 0.70710678118654752440f /* 1/sqrt(2) */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
#include "Enhancements/savestates.h"
|
#include "Enhancements/savestates.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue