simply all loaches logic (#4325)

the previous all loaches logic required modifying every `isLoach` check
throughout the file. this had the benefit of allowing live-toggling all fish
to be loaches or not, but added a lot of complexity.

this changes the logic to just set `isLoach` on each fish instead, and updates the tooltip to note an area reload is required
This commit is contained in:
briaguya 2024-10-02 12:37:22 -04:00 committed by GitHub
commit b575aaaf99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 17 deletions

View file

@ -957,7 +957,7 @@ void DrawEnhancementsMenu() {
UIWidgets::PaddedEnhancementSliderInt("Adult Minimum Weight: %d", "##aMinimumWeight", CVAR_ENHANCEMENT("MinimumFishWeightAdult"), 6, 13, "", 13, true, true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("The minimum weight for the unique fishing reward as an adult");
UIWidgets::PaddedEnhancementCheckbox("All fish are Hyrule Loaches", CVAR_ENHANCEMENT("AllHyruleLoaches"), true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("Every fish in the fishing pond will always be a Hyrule Loach");
UIWidgets::Tooltip("Every fish in the fishing pond will always be a Hyrule Loach\n\nNote: This requires reloading the area");
ImGui::EndMenu();
}
UIWidgets::Spacer(0);

View file

@ -1021,7 +1021,7 @@ void Fishing_Init(Actor* thisx, PlayState* play2) {
this->fishState = 10;
this->fishStateNext = 10;
this->isLoach = sFishInits[thisx->params - EN_FISH_PARAM].isLoach;
this->isLoach = sFishInits[thisx->params - EN_FISH_PARAM].isLoach || AllHyruleLoaches();
this->perception = sFishInits[thisx->params - EN_FISH_PARAM].perception;
this->fishLength = sFishInits[thisx->params - EN_FISH_PARAM].baseLength;
@ -2847,7 +2847,7 @@ void Fishing_FishLeapSfx(Fishing* this, u8 outOfWater) {
s16 sfxId;
u8 length;
if (this->isLoach == 0 && !AllHyruleLoaches()) {
if (this->isLoach == 0) {
length = this->fishLength;
} else {
length = 2.0f * this->fishLength;
@ -2992,7 +2992,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
this->actor.uncullZoneForward = 700.0f;
this->actor.uncullZoneScale = 50.0f;
if (this->isLoach == 0 && !AllHyruleLoaches()) {
if (this->isLoach == 0) {
playerSpeedMod = (player->actor.speedXZ * 0.15f) + 0.25f;
} else {
playerSpeedMod = (player->actor.speedXZ * 0.3f) + 0.25f;
@ -3054,7 +3054,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
Math_ApproachS(&this->fishLimbDRotZDelta, 0, 5, 0x1F4);
if (this->isLoach == 0 && !AllHyruleLoaches()) {
if (this->isLoach == 0) {
Actor_SetScale(&this->actor, this->fishLength * 15.0f * 0.00001f);
this->fishLimbRotPhase += this->fishLimbRotPhaseStep;
@ -3223,7 +3223,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
break;
case 1:
if (this->isLoach == 1 || AllHyruleLoaches()) {
if (this->isLoach == 1) {
this->fishState = -1;
this->unk_1A4 = 20000;
this->unk_1A2 = 20000;
@ -3376,7 +3376,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
if (sLureEquipped == FS_LURE_SINKING) {
this->fishTargetPos.y = sLurePos.y;
} else if (this->isLoach == 0 && !AllHyruleLoaches()) {
} else if (this->isLoach == 0) {
this->fishTargetPos.y = sLurePos.y - 15.0f;
} else {
this->fishTargetPos.y = sLurePos.y - 5.0f;
@ -3451,8 +3451,8 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
}
if (getGuaranteeBite() == 1 ||
((this->timerArray[0] == 1) || (Rand_ZeroOne() < chance)) &&
((Rand_ZeroOne() < (this->perception * multiplier)) || (((this->isLoach || AllHyruleLoaches()) + 1) == KREG(69)))) {
if (this->isLoach == 0 && !AllHyruleLoaches()) {
((Rand_ZeroOne() < (this->perception * multiplier)) || ((this->isLoach + 1) == KREG(69)))) {
if (this->isLoach == 0) {
this->fishState = 3;
this->unk_190 = 1.2f;
this->unk_194 = 5000.0f;
@ -3673,7 +3673,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_ENEMY | 0x800);
sFishingMusicDelay = 0;
if (this->isLoach == 1 || AllHyruleLoaches()) {
if (this->isLoach == 1) {
rumbleStrength = (this->fishLength * 3.0f) + 120.0f;
} else {
rumbleStrength = (2.0f * this->fishLength) + 120.0f;
@ -3776,7 +3776,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
Math_ApproachF(&this->actor.speedXZ, 5.0f, 1.0f, 0.5f);
}
if (this->isLoach == 0 && !AllHyruleLoaches()) {
if (this->isLoach == 0) {
sRodReelingSpeed = 1.0f - (this->fishLength * 0.00899f);
} else {
sRodReelingSpeed = 1.0f - (this->fishLength * 0.00899f * 1.4f);
@ -3792,7 +3792,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
this->unk_190 = 1.0f;
this->unk_194 = 4500.0f;
if (this->isLoach == 0 && !AllHyruleLoaches()) {
if (this->isLoach == 0) {
sRodReelingSpeed = 1.3f - (this->fishLength * 0.00899f);
} else {
sRodReelingSpeed = 1.3f - (this->fishLength * 0.00899f * 1.4f);
@ -3946,7 +3946,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_HEART_GET | 0x900);
sFishingCaughtTextDelay = 40;
if (this->isLoach == 0 && !AllHyruleLoaches()) {
if (this->isLoach == 0) {
sFishLengthToWeigh = this->fishLength;
if (sFishLengthToWeigh >= 75) {
@ -3993,10 +3993,10 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
if (play->msgCtx.choiceIndex == 0) {
if (sFishOnHandLength == 0.0f) {
sFishOnHandLength = this->fishLength;
sFishOnHandIsLoach = (this->isLoach || AllHyruleLoaches());
sFishOnHandIsLoach = this->isLoach;
sLureCaughtWith = sLureEquipped;
Actor_Kill(&this->actor);
} else if (getShouldConfirmKeep() && (this->isLoach == 0 && !AllHyruleLoaches()) && (sFishOnHandIsLoach == 0) &&
} else if (getShouldConfirmKeep() && (this->isLoach == 0) && (sFishOnHandIsLoach == 0) &&
((s16)this->fishLength < (s16)sFishOnHandLength)) {
this->keepState = 1;
this->timerArray[0] = 0x3C;
@ -4048,7 +4048,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
this->unk_194 = 2000.0f;
SkelAnime_Free(&this->skelAnime, play);
if (this->isLoach == 0 && !AllHyruleLoaches()) {
if (this->isLoach == 0) {
SkelAnime_InitFlex(play, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, 0, 0, 0);
Animation_MorphToLoop(&this->skelAnime, &gFishingFishAnim, 0.0f);
} else {
@ -4356,7 +4356,7 @@ void Fishing_DrawFish(Actor* thisx, PlayState* play) {
Matrix_RotateZ(((this->unk_164 + this->actor.shape.rot.z) / 32768.0f) * M_PI, MTXMODE_APPLY);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
if (this->isLoach == 0 && !AllHyruleLoaches()) {
if (this->isLoach == 0) {
Matrix_RotateY((this->fishLimb23RotYDelta * (M_PI / 32768)) - (M_PI / 2), MTXMODE_APPLY);
Matrix_Translate(0.0f, 0.0f, this->fishLimb23RotYDelta * 10.0f * 0.01f, MTXMODE_APPLY);