Skip to content

Commit

Permalink
Better function names
Browse files Browse the repository at this point in the history
  • Loading branch information
aMannus committed Jan 4, 2025
1 parent 73ab45f commit 865c4a9
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions soh/soh/Enhancements/randomizer/3drando/item_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ static void PlaceVanillaOverworldFish() {

static void PlaceVanillaFairies() {
auto ctx = Rando::Context::GetInstance();
for (auto rc : Rando::StaticData::GetFairyLocations()) {
for (auto rc : Rando::StaticData::GetOverworldFairyLocations()) {
ctx->PlaceItemInLocation(rc, GetJunkItem(), false, true);
}
if (ctx->GetDungeon(Rando::GANONS_CASTLE)->IsMQ()) {
Expand Down Expand Up @@ -1309,7 +1309,7 @@ void GenerateItemPool() {

// Shuffle Fairies
if (ctx->GetOption(RSK_SHUFFLE_FAIRIES)) {
for (auto rc : Rando::StaticData::GetFairyLocations()) {
for (auto rc : Rando::StaticData::GetOverworldFairyLocations()) {
AddItemToMainPool(GetJunkItem());
}
// 8 extra for Ganon's Castle + 2 Dodongo's Cavern Gossip Stone + 3 Shadow Temple
Expand Down
30 changes: 15 additions & 15 deletions soh/soh/Enhancements/randomizer/ShuffleFairies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#define FAIRY_FLAG_TIMED (1 << 8)

void FairyShuffleDrawRandomizedItem(EnElf* enElf, PlayState* play) {
void ShuffleFairies_DrawRandomizedItem(EnElf* enElf, PlayState* play) {
GetItemEntry randoGetItem = enElf->sohFairyIdentity.itemEntry;
if (CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("MysteriousShuffle"), 0)) {
randoGetItem = GET_ITEM_MYSTERY;
Expand All @@ -21,7 +21,7 @@ void FairyShuffleDrawRandomizedItem(EnElf* enElf, PlayState* play) {
Matrix_Pop();
}

bool FairyShuffleFairyExists(FairyIdentity fairyIdentity) {
bool ShuffleFairies_FairyExists(FairyIdentity fairyIdentity) {
Actor* actor = gPlayState->actorCtx.actorLists[ACTORCAT_ITEMACTION].head;

while (actor != NULL) {
Expand All @@ -39,7 +39,7 @@ bool FairyShuffleFairyExists(FairyIdentity fairyIdentity) {
return false;
}

FairyIdentity FairyShuffleGetIdentity(int32_t params) {
FairyIdentity ShuffleFairies_GetFairyIdentity(int32_t params) {
FairyIdentity fairyIdentity;
s16 sceneNum = gPlayState->sceneNum;
fairyIdentity.randomizerInf = RAND_INF_MAX;
Expand All @@ -61,20 +61,20 @@ FairyIdentity FairyShuffleGetIdentity(int32_t params) {
return fairyIdentity;
}

bool FairyShuffleSpawnFairy(f32 posX, f32 posY, f32 posZ, int32_t params) {
FairyIdentity fairyIdentity = FairyShuffleGetIdentity(params);
bool ShuffleFairies_SpawnFairy(f32 posX, f32 posY, f32 posZ, int32_t params) {
FairyIdentity fairyIdentity = ShuffleFairies_GetFairyIdentity(params);
if (!Flags_GetRandomizerInf(fairyIdentity.randomizerInf)) {
EnElf* fairy = (EnElf*)Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_ELF, posX, posY - 30.0f, posZ, 0,
0, 0, FAIRY_HEAL, true);
fairy->sohFairyIdentity = fairyIdentity;
fairy->actor.draw = (ActorFunc)FairyShuffleDrawRandomizedItem;
fairy->actor.draw = (ActorFunc)ShuffleFairies_DrawRandomizedItem;
fairy->fairyFlags |= FAIRY_FLAG_TIMED;
return true;
}
return false;
}

void FairyShuffleOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_list originalArgs) {
void ShuffleFairies_OnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_list originalArgs) {
va_list args;
va_copy(args, originalArgs);

Expand All @@ -94,7 +94,7 @@ void FairyShuffleOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va
s16 grottoId = (gPlayState->sceneNum == SCENE_FAIRYS_FOUNTAIN) ? Grotto_CurrentGrotto() : 0;
for (s16 index = 0; index < 8; index++) {
int32_t params = (grottoId << 8) | index;
if (FairyShuffleSpawnFairy(actor->world.pos.x, actor->world.pos.y, actor->world.pos.z,
if (ShuffleFairies_SpawnFairy(actor->world.pos.x, actor->world.pos.y, actor->world.pos.z,
params)) {
fairySpawned = true;
}
Expand All @@ -108,7 +108,7 @@ void FairyShuffleOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va
bool fairySpawned = false;
for (s16 index = 0; index < 3; index++) {
int32_t params = ((objBean->dyna.actor.params & 0x3F) << 8) | index;
if (FairyShuffleSpawnFairy(objBean->dyna.actor.world.pos.x, objBean->dyna.actor.world.pos.y,
if (ShuffleFairies_SpawnFairy(objBean->dyna.actor.world.pos.x, objBean->dyna.actor.world.pos.y,
objBean->dyna.actor.world.pos.z,
params)) {
fairySpawned = true;
Expand Down Expand Up @@ -150,9 +150,9 @@ void FairyShuffleOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va
// stop spawning the vanilla fairy as well when these fairies exist, otherwise both
// the randomized and the vanilla fairy will spawn. When the randomized fairy is already
// collected, the vanilla code will handle that part automatically.
FairyIdentity fairyIdentity = FairyShuffleGetIdentity(params);
if (!FairyShuffleFairyExists(fairyIdentity)) {
if (FairyShuffleSpawnFairy(gossipStone->actor.world.pos.x, gossipStone->actor.world.pos.y,
FairyIdentity fairyIdentity = ShuffleFairies_GetFairyIdentity(params);
if (!ShuffleFairies_FairyExists(fairyIdentity)) {
if (ShuffleFairies_SpawnFairy(gossipStone->actor.world.pos.x, gossipStone->actor.world.pos.y,
gossipStone->actor.world.pos.z, params)) {
Audio_PlayActorSound2(&gossipStone->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY);
// Set vanilla check for fairy spawned so it doesn't spawn the vanilla fairy afterwards as well.
Expand All @@ -167,11 +167,11 @@ void FairyShuffleOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va

uint32_t onVanillaBehaviorHook = 0;

void FairyShuffleRegisterHooks() {
onVanillaBehaviorHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnVanillaBehavior>(FairyShuffleOnVanillaBehaviorHandler);
void ShuffleFairies_RegisterHooks() {
onVanillaBehaviorHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnVanillaBehavior>(ShuffleFairies_OnVanillaBehaviorHandler);
}

void FairyShuffleUnregisterHooks() {
void ShuffleFairies_UnregisterHooks() {
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnVanillaBehavior>(onVanillaBehaviorHook);

onVanillaBehaviorHook = 0;
Expand Down
4 changes: 2 additions & 2 deletions soh/soh/Enhancements/randomizer/ShuffleFairies.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ typedef struct FairyIdentity {
GetItemEntry itemEntry;
} FairyIdentity;

void FairyShuffleRegisterHooks();
void FairyShuffleUnregisterHooks();
void ShuffleFairies_RegisterHooks();
void ShuffleFairies_UnregisterHooks();
4 changes: 2 additions & 2 deletions soh/soh/Enhancements/randomizer/hook_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2407,7 +2407,7 @@ void RandomizerRegisterHooks() {
shufflePotsOnActorInitHook = 0;
shufflePotsOnVanillaBehaviorHook = 0;

FairyShuffleUnregisterHooks();
ShuffleFairies_UnregisterHooks();

if (!IS_RANDO) return;

Expand Down Expand Up @@ -2453,7 +2453,7 @@ void RandomizerRegisterHooks() {
}

if (RAND_GET_OPTION(RSK_SHUFFLE_FAIRIES)) {
FairyShuffleRegisterHooks();
ShuffleFairies_RegisterHooks();
}
});
}
2 changes: 1 addition & 1 deletion soh/soh/Enhancements/randomizer/location_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ std::vector<RandomizerCheck> Rando::StaticData::GetAllDungeonLocations() {
return dungeonLocations;
}

std::vector<RandomizerCheck> Rando::StaticData::GetFairyLocations() {
std::vector<RandomizerCheck> Rando::StaticData::GetOverworldFairyLocations() {
std::vector<RandomizerCheck> fairyLocations = {};
for (Location& location : locationTable) {
if (location.GetRCType() == RCTYPE_FAIRY && location.GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
Expand Down
2 changes: 1 addition & 1 deletion soh/soh/Enhancements/randomizer/static_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class StaticData {
static std::vector<RandomizerCheck> GetPondFishLocations();
static std::vector<RandomizerCheck> GetOverworldFishLocations();
static std::vector<RandomizerCheck> GetOverworldPotLocations();
static std::vector<RandomizerCheck> GetFairyLocations();
static std::vector<RandomizerCheck> GetOverworldFairyLocations();
static std::array<std::pair<RandomizerCheck, RandomizerCheck>, 17> randomizerFishingPondFish;
static std::unordered_map<int8_t, RandomizerCheck> randomizerGrottoFishMap;
static std::vector<RandomizerHint> oldVerHintOrder;
Expand Down

0 comments on commit 865c4a9

Please sign in to comment.