summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorblackgamma7 <blackgamma7@gmail.com>2023-09-06 10:58:17 -0400
committerGitHub <noreply@github.com>2023-09-06 10:58:17 -0400
commit475b8a1ebabe3246dc9d9b5b0b230e403d7bbb4c (patch)
treeb9ad4f84133d02e246327bd8f43cdd4e13fa4d0f /src
parent8913c4fa0d2cec19db6e8b4d8598125977243c5d (diff)
z_fishing partially documented (#1424)
* Document z_Fishing Document code and data RE: Fishing minigame. * More z_fishing.c progress Id's more values, added flag for "High score" entries * moved and renamed Fishing flags Flags moved outside z_fishing.c - ending sequence checks for "hat stolen" flag. * more fishing.c Id'ing added more id's and clarification. * Update z_fishing.h clarified not about fish weight. * more z_fishing.c documenting missed a bitfeiled in the fishing "highScores" that kept track of your number of fishing trips * Update z64save.h a #define got lost for the "fishing games played" increment * z_fishing: a few formatting and naming changes based on feedback - removed comments summing textboxes as it was deemed redundant - tried to unify fish measurment as "length" - clarified a few vars based on name - formatted single-line comments to have one space. * Update z_fishing.c ran format.py and fixle.sh * Update z_fishing.c changed code around a few bools that was still matching. * `z_en_Fishing`: changes from feedback, id'd rotate phase fields. * Update z_fishing.c merge fix * `z_fishing`: More doc'ing. * `z_fishing`: changes based on feedback * `z_fishing`: fixed typo * `z_fishing`: merge with master * Update z_fishing.c sSinkingLureLocationPos was too redundant * Merge fix, added more comments, #defines, id's * Update z_fishing.c adding EN_FISH_PARAM may have led to mismatch. * `z_fishing`: fixed compare mismatch * Update z64save.h fix typo * Update z_fishing.c a few more id's
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c2
-rw-r--r--src/overlays/actors/ovl_Fishing/z_fishing.c2765
-rw-r--r--src/overlays/actors/ovl_Fishing/z_fishing.h72
3 files changed, 1437 insertions, 1402 deletions
diff --git a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c
index 03eeee153..176ea5615 100644
--- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c
+++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c
@@ -1083,7 +1083,7 @@ void DemoEc_UpdateFishingOwner(DemoEc* this, PlayState* play) {
void DemoEc_FishingOwnerPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) {
DemoEc* this = (DemoEc*)thisx;
- if ((limbIndex == 8) && !(HIGH_SCORE(HS_FISHING) & 0x1000)) {
+ if ((limbIndex == 8) && !(HIGH_SCORE(HS_FISHING) & HS_FISH_STOLE_HAT)) {
gSPDisplayList((*gfx)++, SEGMENTED_TO_VIRTUAL(gFishingOwnerHatDL));
}
}
diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c
index 6f8629384..ff5ed8eb4 100644
--- a/src/overlays/actors/ovl_Fishing/z_fishing.c
+++ b/src/overlays/actors/ovl_Fishing/z_fishing.c
@@ -22,10 +22,10 @@ void Fishing_DrawFish(Actor* thisx, PlayState* play);
void Fishing_DrawOwner(Actor* thisx, PlayState* play);
typedef struct {
- /* 0x00 */ u8 unk_00;
+ /* 0x00 */ u8 isLoach;
/* 0x02 */ Vec3s pos;
- /* 0x08 */ u8 unk_08;
- /* 0x0C */ f32 unk_0C;
+ /* 0x08 */ u8 baseLength;
+ /* 0x0C */ f32 perception;
} FishingFishInit; // size = 0x10
typedef enum {
@@ -50,12 +50,10 @@ typedef struct {
/* 0x25 */ u8 timer;
/* 0x26 */ char unk_26[0x04];
/* 0x2A */ s16 alpha;
- /* 0x2C */ s16 unk_2C;
- /* 0x2E */ s16 unk_2E;
- /* 0x30 */ f32 unk_30;
- /* 0x34 */ f32 unk_34;
- /* 0x38 */ f32 unk_38;
- /* 0x3C */ f32 unk_3C;
+ /* 0x2C */ s16 state;
+ /* 0x2E */ s16 alphaMax;
+ /* 0x30 */ f32 scale;
+ /* 0x34 */ Vec3f rot;
} FishingEffect; // size = 0x40
#define POND_PROP_COUNT 140
@@ -100,10 +98,10 @@ typedef struct {
/* 0x00 */ u8 type;
/* 0x02 */ s16 timer;
/* 0x04 */ Vec3f pos;
- /* 0x10 */ Vec3f unk_10;
+ /* 0x10 */ Vec3f homePos;
/* 0x1C */ Vec3f projectedPos;
- /* 0x28 */ f32 unk_28;
- /* 0x2C */ f32 unk_2C;
+ /* 0x28 */ f32 velY;
+ /* 0x2C */ f32 scaleX;
/* 0x30 */ f32 unk_30;
/* 0x34 */ f32 unk_34;
/* 0x38 */ f32 unk_38;
@@ -114,6 +112,12 @@ typedef struct {
/* 0x44 */ u8 shouldDraw;
} FishingGroupFish; // size = 0x48
+typedef enum {
+ /* 0x00 */ FS_LURE_STOCK,
+ /* 0x01 */ FS_LURE_UNK, // hinted at with an "== 1"
+ /* 0x02 */ FS_LURE_SINKING
+} FishingLureTypes;
+
#define LINE_SEG_COUNT 200
#define SINKING_LURE_SEG_COUNT 20
@@ -129,41 +133,47 @@ ActorInit Fishing_InitVars = {
(ActorFunc)Fishing_DrawFish,
};
-static f32 D_80B7A650 = 0.0f;
+static f32 sStormStrength = 0.0f;
-static u8 D_80B7A654 = 0;
+static u8 sStormStrengthTarget = 0;
-static f32 D_80B7A658 = 0.0f;
+static f32 sFishingStormShade = 0.0f;
-static Vec3f D_80B7A65C = { 0.0f, 0.0f, 0.0f };
+static Vec3f sFishingStormSfxPos = { 0.0f, 0.0f, 0.0f };
-static f32 D_80B7A668 = 0.0f;
+static f32 sStormSfxFreqScale = 0.0f;
static u8 sSinkingLureLocation = 0;
-static f32 D_80B7A670 = 0.0f;
+static f32 sFishOnHandLength = 0.0f;
-static u8 D_80B7A674 = true;
+static u8 sIsRodVisible = true;
-static u16 D_80B7A678 = 0;
+static u16 sFishLengthToWeigh = 0;
-static u8 D_80B7A67C = 0;
+static u8 sFishingCaughtTextDelay = 0;
-static s32 D_80B7A680 = 0;
+static s32 sFishingTimePlayed = 0;
-static s16 D_80B7A684 = 0;
+static s16 sOwnerTheftTimer = 0;
-static u8 D_80B7A688 = 0;
-static u8 D_80B7A68C = 0;
-static u8 D_80B7A690 = 0;
+typedef enum {
+ /* 0x00 */ FS_OWNER_BALD,
+ /* 0x01 */ FS_OWNER_CAPPED,
+ /* 0x02 */ FS_OWNER_HAIR
+} FishingOwnerHair;
+
+static u8 sOwnerHair = FS_OWNER_BALD;
+static u8 sIsOwnersHatHooked = false; // hat is on fishing hook
+static u8 sIsOwnersHatSunk = false; // hat is sinking into pond.
-static s16 D_80B7A694 = 0;
+static s16 sRodCastState = 0;
static Vec3f sFishMouthOffset = { 500.0f, 500.0f, 0.0f };
static u8 D_80B7A6A4 = 0;
-static f32 D_80B7A6A8 = 0.0f;
+static f32 sRodBendRotY = 0.0f;
static f32 D_80B7A6AC = 0.0f;
static f32 D_80B7A6B0 = 0.0f;
static f32 D_80B7A6B4 = 0.0f;
@@ -171,12 +181,12 @@ static f32 D_80B7A6B8 = 0.0f;
static f32 D_80B7A6BC = 0.0f;
static f32 D_80B7A6C0 = 0.0f;
-static s16 D_80B7A6C4 = 0;
-static s16 D_80B7A6C8 = 0;
+static s16 sStickAdjXPrev = 0;
+static s16 sStickAdjYPrev = 0;
-static u8 D_80B7A6CC = 0;
-static u8 D_80B7A6D0 = 0;
-static u8 D_80B7A6D4 = 0;
+static u8 sFishingPlayerCinematicState = 0;
+static u8 sFishingCinematicTimer = 0;
+static u8 sSinkingLureFound = false;
static ColliderJntSphElementInit sJntSphElementsInit[12] = {
{
@@ -326,81 +336,81 @@ static ColliderJntSphInit sJntSphInit = {
sJntSphElementsInit,
};
-static f32 D_80B7A898 = 0.0f;
+static f32 sFishGroupVar = 0.0f;
static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
-static Vec3f D_80B7A8A8 = { 0.0f, 0.0f, 2000.0f };
+static Vec3f sUnusedVec = { 0.0f, 0.0f, 2000.0f };
static Fishing* sFishingMain;
-static u8 D_80B7E074;
+static u8 sReelLock;
static u8 sLinkAge;
-static u8 D_80B7E076;
-static u8 D_80B7E077;
-static f32 D_80B7E078;
-static u8 D_80B7E07C;
-static u8 D_80B7E07D;
-static u8 D_80B7E07E;
-static s16 D_80B7E080;
-static u8 D_80B7E082;
-static u16 D_80B7E084;
-static u16 D_80B7E086;
-static s8 D_80B7E088;
+static u8 sFishingFoggy;
+static u8 sStormChanceTimer;
+static f32 sFishingRecordLength;
+static u8 sFishOnHandIsLoach;
+static u8 sFishGameNumber; // increments for each purchased play. effects weather
+static u8 sLureCaughtWith;
+static s16 sFishFightTime;
+static u8 sPondOwnerTextIdIndex;
+static u16 sFishesCaught;
+static u16 sFishingCaughtTextId;
+static s8 sLureCameraZoomLevel;
static Vec3f sOwnerHeadPos;
-static Vec3s sEffOwnerHatRot;
-static u8 D_80B7E0A2;
-static s16 D_80B7E0A4;
-static s16 D_80B7E0A6;
+static Vec3s sEffOwnersHatRot;
+static u8 sLureMoveDelay; // a small delay between the lure hitting the water, and being able to reel.
+static s16 sRumbleDelay;
+static s16 sFishingMusicDelay;
static Fishing* sFishingHookedFish;
-static s16 D_80B7E0AC;
-static s16 D_80B7E0AE;
+static s16 sFishingPlayingState;
+static s16 sLureTimer; // AND'd for various effects/checks
static s16 D_80B7E0B0;
static s16 D_80B7E0B2;
-static s16 D_80B7E0B4;
-static u8 D_80B7E0B6;
+static s16 sRodCastTimer; // used for the inital line casting
+static u8 sLureEquipped;
static Vec3f sLurePos;
-static Vec3f D_80B7E0C8;
+static Vec3f sLureDrawPos;
static Vec3f sLureRot;
-static Vec3f D_80B7E0E8;
-static Vec3f D_80B7E0F8;
-static f32 D_80B7E104;
-static f32 D_80B7E108;
-static f32 D_80B7E10C;
-static f32 D_80B7E110;
+static Vec3f sLurePosDelta;
+static Vec3f sLureCastDelta;
+static f32 sLure1Rotate; // lure type 1 is programmed to change this.
+static f32 sLurePosZOffset;
+static f32 sLureRotXTarget;
+static f32 sLureRotXStep;
static s8 D_80B7E114;
-static s16 D_80B7E116;
+static s16 sRodPullback; // holding A+Down to keep the fish on line
static u8 D_80B7E118;
-static f32 D_80B7E11C;
-static u8 D_80B7E120;
-static s16 D_80B7E122;
-static u8 D_80B7E124;
-static Vec3f D_80B7E128;
-static f32 D_80B7E134;
-static f32 D_80B7E138;
-static s16 D_80B7E13C;
-static f32 D_80B7E140;
-static f32 D_80B7E144;
+static f32 sRodReelingSpeed;
+static u8 sWiggleAttraction;
+static s16 sLureBitTimer;
+static u8 sLineHooked;
+static Vec3f sLureLineSegPosDelta;
+static f32 sLureWiggleRotYTarget;
+static f32 sLureWigglePosY;
+static s16 sLureWiggleRotY;
+static f32 sLureWiggleSign; // +/-1.0f
+static f32 sRodLineSpooled; // 200 represents the full spool.
static f32 D_80B7E148;
-static f32 D_80B7E14C;
+static f32 sFishingLineScale;
static s16 D_80B7E150;
-static f32 D_80B7E154;
+static f32 sReelLinePosStep;
static Vec3f sRodTipPos;
static Vec3f sReelLinePos[LINE_SEG_COUNT];
static Vec3f sReelLineRot[LINE_SEG_COUNT];
static Vec3f sReelLineUnk[LINE_SEG_COUNT];
static Vec3f sLureHookRefPos[2];
static f32 sLureHookRotY[2];
-static u8 D_80B7FDA8;
+static u8 sRodHitTimer; // brief timer for bending rod when line is snapped
static Vec3f sSinkingLurePos[SINKING_LURE_SEG_COUNT];
-static s16 D_80B7FEA0;
+static s16 sSinkingLureSegmentIndex;
static f32 sProjectedW;
static Vec3f sSubCamEye;
static Vec3f sSubCamAt;
static s16 sSubCamId;
-static f32 D_80B7FEC8;
+static f32 sCatchCamX;
static f32 sSubCamVelFactor;
static f32 D_80B7FED0;
static Vec3f sSinkingLureBasePos;
-static f32 D_80B7FEE4;
+static f32 sSinkingLureHeldY; // the lure going to its mark when being held up.
static s32 sRandSeed0;
static s32 sRandSeed1;
static s32 sRandSeed2;
@@ -462,7 +472,7 @@ s16 Fishing_SmoothStepToS(s16* pValue, s16 target, s16 scale, s16 step) {
return stepSize;
}
-void Fishing_SpawnRipple(Vec3f* projectedPos, FishingEffect* effect, Vec3f* pos, f32 arg3, f32 arg4, s16 arg5,
+void Fishing_SpawnRipple(Vec3f* projectedPos, FishingEffect* effect, Vec3f* pos, f32 scale, f32 rotX, s16 alpha,
s16 countLimit) {
s16 i;
@@ -476,18 +486,18 @@ void Fishing_SpawnRipple(Vec3f* projectedPos, FishingEffect* effect, Vec3f* pos,
effect->pos = *pos;
effect->vel = sZeroVec;
effect->accel = sZeroVec;
- effect->unk_30 = arg3 * 0.0025f;
- effect->unk_34 = arg4 * 0.0025f;
+ effect->scale = scale * 0.0025f;
+ effect->rot.x = rotX * 0.0025f;
- if (arg3 > 300.0f) {
+ if (scale > 300.0f) {
effect->alpha = 0;
- effect->unk_2E = arg5;
- effect->unk_2C = 0;
- effect->unk_38 = (effect->unk_34 - effect->unk_30) * 0.05f;
+ effect->alphaMax = alpha;
+ effect->state = 0;
+ effect->rot.y = (effect->rot.x - effect->scale) * 0.05f;
} else {
- effect->alpha = arg5;
- effect->unk_2C = 1;
- effect->unk_38 = (effect->unk_34 - effect->unk_30) * 0.1f;
+ effect->alpha = alpha;
+ effect->state = 1;
+ effect->rot.y = (effect->rot.x - effect->scale) * 0.1f;
}
break;
}
@@ -512,7 +522,7 @@ void Fishing_SpawnDustSplash(Vec3f* projectedPos, FishingEffect* effect, Vec3f*
effect->vel = *vel;
effect->accel = accel;
effect->alpha = 100 + (s16)Rand_ZeroFloat(100.0f);
- effect->unk_30 = scale;
+ effect->scale = scale;
break;
}
@@ -536,8 +546,8 @@ void Fishing_SpawnWaterDust(Vec3f* projectedPos, FishingEffect* effect, Vec3f* p
effect->accel = accel;
effect->alpha = 255;
effect->timer = (s16)Rand_ZeroFloat(100.0f);
- effect->unk_30 = scale;
- effect->unk_34 = 2.0f * scale;
+ effect->scale = scale;
+ effect->rot.x = 2.0f * scale;
break;
}
@@ -545,7 +555,7 @@ void Fishing_SpawnWaterDust(Vec3f* projectedPos, FishingEffect* effect, Vec3f* p
}
}
-void Fishing_SpawnBubble(Vec3f* projectedPos, FishingEffect* effect, Vec3f* pos, f32 scale, u8 arg4) {
+void Fishing_SpawnBubble(Vec3f* projectedPos, FishingEffect* effect, Vec3f* pos, f32 scale, u8 state) {
s16 i;
Vec3f vel = { 0.0f, 1.0f, 0.0f };
@@ -560,8 +570,8 @@ void Fishing_SpawnBubble(Vec3f* projectedPos, FishingEffect* effect, Vec3f* pos,
effect->vel = vel;
effect->accel = sZeroVec;
effect->timer = (s16)Rand_ZeroFloat(100.0f);
- effect->unk_30 = scale;
- effect->unk_2C = arg4;
+ effect->scale = scale;
+ effect->state = state;
break;
}
@@ -584,9 +594,9 @@ void Fishing_SpawnRainDrop(FishingEffect* effect, Vec3f* pos, Vec3f* rot) {
effect->type = FS_EFF_RAIN_DROP;
effect->pos = *pos;
effect->accel = sZeroVec;
- effect->unk_34 = rot->x;
- effect->unk_38 = rot->y;
- effect->unk_3C = rot->z;
+ effect->rot.x = rot->x;
+ effect->rot.y = rot->y;
+ effect->rot.z = rot->z;
Matrix_RotateY(rot->y, MTXMODE_NEW);
Matrix_RotateX(rot->x, MTXMODE_APPLY);
Matrix_MultVec3f(&velSrc, &effect->vel);
@@ -826,13 +836,13 @@ void Fishing_Init(Actor* thisx, PlayState* play2) {
sLinkAge = gSaveContext.save.linkAge;
}
- if (thisx->params < 100) {
- D_80B7E074 = 0;
+ if (thisx->params < EN_FISH_PARAM) {
+ sReelLock = 0;
sFishingMain = this;
Collider_InitJntSph(play, &sFishingMain->collider);
Collider_SetJntSph(play, &sFishingMain->collider, thisx, &sJntSphInit, sFishingMain->colliderElements);
- thisx->params = 1;
+ thisx->params = EN_FISH_OWNER;
SkelAnime_InitFlex(play, &this->skelAnime, &gFishingOwnerSkel, &gFishingOwnerAnim, NULL, NULL, 0);
Animation_MorphToLoop(&this->skelAnime, &gFishingOwnerAnim, 0.0f);
@@ -852,55 +862,55 @@ void Fishing_Init(Actor* thisx, PlayState* play2) {
thisx->flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3;
if (sLinkAge != LINK_AGE_CHILD) {
- if (HIGH_SCORE(HS_FISHING) & 0x1000) {
- D_80B7A688 = 0;
+ if (HIGH_SCORE(HS_FISHING) & HS_FISH_STOLE_HAT) {
+ sOwnerHair = FS_OWNER_BALD;
} else {
- D_80B7A688 = 1;
+ sOwnerHair = FS_OWNER_CAPPED;
}
} else {
- D_80B7A688 = 2;
+ sOwnerHair = FS_OWNER_HAIR;
}
- D_80B7A684 = 20;
+ sOwnerTheftTimer = 20;
play->specialEffects = sEffects;
gTimeSpeed = 1;
- D_80B7E0AC = 0;
- D_80B7E0A6 = 10;
+ sFishingPlayingState = 0;
+ sFishingMusicDelay = 10;
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
if (sLinkAge == LINK_AGE_CHILD) {
- if ((HIGH_SCORE(HS_FISHING) & 0x7F) != 0) {
- D_80B7E078 = HIGH_SCORE(HS_FISHING) & 0x7F;
+ if ((HIGH_SCORE(HS_FISHING) & HS_FISH_LENGTH_CHILD) != 0) {
+ sFishingRecordLength = HIGH_SCORE(HS_FISHING) & HS_FISH_LENGTH_CHILD;
} else {
- D_80B7E078 = 40.0f;
+ sFishingRecordLength = 40.0f; // 6 lbs
}
} else {
- if ((HIGH_SCORE(HS_FISHING) & 0x7F000000) != 0) {
- D_80B7E078 = (HIGH_SCORE(HS_FISHING) & 0x7F000000) >> 0x18;
+ if ((HIGH_SCORE(HS_FISHING) & HS_FISH_LENGTH_ADULT) != 0) {
+ sFishingRecordLength = (HIGH_SCORE(HS_FISHING) & HS_FISH_LENGTH_ADULT) >> 0x18;
} else {
- D_80B7E078 = 45.0f;
+ sFishingRecordLength = 45.0f; // 7 lbs
}
}
- D_80B7E07D = (HIGH_SCORE(HS_FISHING) & 0xFF0000) >> 0x10;
- if ((D_80B7E07D & 7) == 7) {
+ sFishGameNumber = (HIGH_SCORE(HS_FISHING) & (HS_FISH_PLAYED * 255)) >> 0x10;
+ if ((sFishGameNumber & 7) == 7) {
play->roomCtx.unk_74[0] = 90;
- D_80B7E076 = 1;
+ sFishingFoggy = 1;
} else {
play->roomCtx.unk_74[0] = 40;
- D_80B7E076 = 0;
+ sFishingFoggy = 0;
}
- if (((D_80B7E07D & 7) == 6) || (KREG(3) != 0)) {
- D_80B7E077 = 100;
+ if (((sFishGameNumber & 7) == 6) || (KREG(3) != 0)) {
+ sStormChanceTimer = 100;
if (KREG(3) != 0) {
KREG(3) = 0;
- HIGH_SCORE(HS_FISHING) &= 0xFF00FFFF;
- HIGH_SCORE(HS_FISHING) |= 0x60000;
+ HIGH_SCORE(HS_FISHING) &= ~(HS_FISH_PLAYED * 255);
+ HIGH_SCORE(HS_FISHING) |= (HS_FISH_PLAYED * 6);
}
} else {
- D_80B7E077 = 0;
+ sStormChanceTimer = 0;
}
for (i = 0; i < FISHING_EFFECT_COUNT; i++) {
@@ -921,17 +931,17 @@ void Fishing_Init(Actor* thisx, PlayState* play2) {
fish->type = FS_GROUP_FISH_NORMAL;
if (i <= 20) {
- fish->unk_10.x = fish->pos.x = sinf(sFishGroupAngle1) * 720.0f;
- fish->unk_10.z = fish->pos.z = cosf(sFishGroupAngle1) * 720.0f;
+ fish->homePos.x = fish->pos.x = sinf(sFishGroupAngle1) * 720.0f;
+ fish->homePos.z = fish->pos.z = cosf(sFishGroupAngle1) * 720.0f;
} else if (i <= 40) {
- fish->unk_10.x = fish->pos.x = sinf(sFishGroupAngle2) * 720.0f;
- fish->unk_10.z = fish->pos.z = cosf(sFishGroupAngle2) * 720.0f;
+ fish->homePos.x = fish->pos.x = sinf(sFishGroupAngle2) * 720.0f;
+ fish->homePos.z = fish->pos.z = cosf(sFishGroupAngle2) * 720.0f;
} else {
- fish->unk_10.x = fish->pos.x = sinf(sFishGroupAngle3) * 720.0f;
- fish->unk_10.z = fish->pos.z = cosf(sFishGroupAngle3) * 720.0f;
+ fish->homePos.x = fish->pos.x = sinf(sFishGroupAngle3) * 720.0f;
+ fish->homePos.z = fish->pos.z = cosf(sFishGroupAngle3) * 720.0f;
}
- fish->unk_10.y = fish->pos.y = -35.0f;
+ fish->homePos.y = fish->pos.y = -35.0f;
fish->timer = Rand_ZeroFloat(100.0f);
@@ -951,7 +961,7 @@ void Fishing_Init(Actor* thisx, PlayState* play2) {
ENKANBAN_FISHING);
Actor_Spawn(&play->actorCtx, play, ACTOR_FISHING, 0.0f, 0.0f, 0.0f, 0, 0, 0, 200);
- if ((KREG(1) == 1) || ((D_80B7E07D & 3) == 3)) {
+ if ((KREG(1) == 1) || ((sFishGameNumber & 3) == 3)) {
if (sLinkAge != LINK_AGE_CHILD) {
fishCount = 16;
} else {
@@ -966,7 +976,7 @@ void Fishing_Init(Actor* thisx, PlayState* play2) {
sFishInits[i].pos.z, 0, Rand_ZeroFloat(0x10000), 0, 100 + i);
}
} else {
- if ((thisx->params < 115) || (thisx->params == 200)) {
+ if ((thisx->params < (EN_FISH_PARAM + 15)) || (thisx->params == EN_FISH_AQUARIUM)) {
SkelAnime_InitFlex(play, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, NULL, NULL, 0);
Animation_MorphToLoop(&this->skelAnime, &gFishingFishAnim, 0.0f);
} else {
@@ -976,32 +986,34 @@ void Fishing_Init(Actor* thisx, PlayState* play2) {
SkelAnime_Update(&this->skelAnime);
- if (thisx->params == 200) {
- this->unk_158 = 100;
+ if (thisx->params == EN_FISH_AQUARIUM) {
+ this->fishState = 100;
Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_PROP);
thisx->targetMode = 0;
thisx->flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3;
this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo);
} else {
- this->unk_158 = 10;
- this->unk_15A = 10;
+ this->fishState = 10;
+ this->fishStateNext = 10;
- this->unk_150 = sFishInits[thisx->params - 100].unk_00;
- this->unk_1A8 = sFishInits[thisx->params - 100].unk_0C;
- this->unk_1AC = sFishInits[thisx->params - 100].unk_08;
+ this->isLoach = sFishInits[thisx->params - EN_FISH_PARAM].isLoach;
+ this->perception = sFishInits[thisx->params - EN_FISH_PARAM].perception;
+ this->fishLength = sFishInits[thisx->params - EN_FISH_PARAM].baseLength;
- this->unk_1AC += Rand_ZeroFloat(4.99999f);
+ this->fishLength += Rand_ZeroFloat(4.99999f);
- if ((this->unk_1AC >= 65.0f) && (Rand_ZeroOne() < 0.05f)) {
- this->unk_1AC += Rand_ZeroFloat(7.99999f);
+ // small chance to make big fish even bigger.
+ if ((this->fishLength >= 65.0f) && (Rand_ZeroOne() < 0.05f)) {
+ this->fishLength += Rand_ZeroFloat(7.99999f);
}
if (KREG(6) != 0) {
- this->unk_1AC = KREG(6) + 80.0f;
+ this->fishLength = KREG(6) + 80.0f;
}
+ // "Come back when you get older! The fish will be bigger, too!"
if (sLinkAge == LINK_AGE_CHILD) {
- this->unk_1AC *= 0.73f;
+ this->fishLength *= 0.73f;
}
}
}
@@ -1013,9 +1025,9 @@ void Fishing_Destroy(Actor* thisx, PlayState* play2) {
SkelAnime_Free(&this->skelAnime, play);
- if (thisx->params == 200) {
+ if (thisx->params == EN_FISH_AQUARIUM) {
LightContext_RemoveLight(play, &play->lightCtx, this->lightNode);
- } else if (thisx->params == 1) {
+ } else if (thisx->params == EN_FISH_OWNER) {
Collider_DestroyJntSph(play, &this->collider);
}
}
@@ -1033,14 +1045,14 @@ void Fishing_UpdateEffects(FishingEffect* effect, PlayState* play) {
effect->vel.y += effect->accel.y;
if (effect->type == FS_EFF_RIPPLE) {
- Math_ApproachF(&effect->unk_30, effect->unk_34, 0.2f, effect->unk_38);
+ Math_ApproachF(&effect->scale, effect->rot.x, 0.2f, effect->rot.y);
- if (effect->unk_2C == 0) {
+ if (effect->state == 0) {
effect->alpha += 20;
- if (effect->alpha >= effect->unk_2E) {
- effect->alpha = effect->unk_2E;
- effect->unk_2C++;
+ if (effect->alpha >= effect->alphaMax) {
+ effect->alpha = effect->alphaMax;
+ effect->state++;
}
} else {
effect->alpha -= 8;
@@ -1050,7 +1062,7 @@ void Fishing_UpdateEffects(FishingEffect* effect, PlayState* play) {
}
}
} else if (effect->type == FS_EFF_WATER_DUST) {
- Math_ApproachF(&effect->unk_30, effect->unk_34, 0.1f, 0.1f);
+ Math_ApproachF(&effect->scale, effect->rot.x, 0.1f, 0.1f);
effect->alpha -= 10;
if (effect->pos.y > (WATER_SURFACE_Y(play) - 5.0f)) {
@@ -1063,7 +1075,7 @@ void Fishing_UpdateEffects(FishingEffect* effect, PlayState* play) {
effect->type = FS_EFF_NONE;
}
} else if (effect->type == FS_EFF_BUBBLE) {
- if (effect->unk_2C == 0) {
+ if (effect->state == 0) {
rippleY = WATER_SURFACE_Y(play);
} else {
rippleY = 69.0f;
@@ -1100,14 +1112,14 @@ void Fishing_UpdateEffects(FishingEffect* effect, PlayState* play) {
effect->pos.y = WATER_SURFACE_Y(play) + ((sqrtf(sqDistXZ) - 920.0f) * 0.11f);
effect->timer = KREG(17) + 2;
effect->type = FS_EFF_RAIN_SPLASH;
- effect->unk_30 = (KREG(18) + 30) * 0.001f;
+ effect->scale = (KREG(18) + 30) * 0.001f;
} else {
effect->pos.y = WATER_SURFACE_Y(play) + 3.0f;
effect->timer = 0;
if (Rand_ZeroOne() < 0.75f) {
effect->type = FS_EFF_RAIN_RIPPLE;
effect->vel = sZeroVec;
- effect->unk_30 = (KREG(18) + 30) * 0.001f;
+ effect->scale = (KREG(18) + 30) * 0.001f;
} else {
effect->type = FS_EFF_NONE;
}
@@ -1116,7 +1128,7 @@ void Fishing_UpdateEffects(FishingEffect* effect, PlayState* play) {
effect->vel = sZeroVec;
}
} else if (effect->type >= FS_EFF_RAIN_RIPPLE) {
- effect->unk_30 += (KREG(18) + 30) * 0.001f;
+ effect->scale += (KREG(18) + 30) * 0.001f;
if (effect->timer >= 6) {
effect->type = FS_EFF_NONE;
@@ -1125,11 +1137,11 @@ void Fishing_UpdateEffects(FishingEffect* effect, PlayState* play) {
f32 sqDistXZ;
f32 bottomY;
- effect->unk_30 = 0.010000001f;
+ effect->scale = 10 * .001f;
- Math_ApproachS(&sEffOwnerHatRot.y, 0, 20, 100);
- Math_ApproachS(&sEffOwnerHatRot.x, 0, 20, 100);
- Math_ApproachS(&sEffOwnerHatRot.z, -0x4000, 20, 100);
+ Math_ApproachS(&sEffOwnersHatRot.y, 0, 20, 100);
+ Math_ApproachS(&sEffOwnersHatRot.x, 0, 20, 100);
+ Math_ApproachS(&sEffOwnersHatRot.z, -0x4000, 20, 100);
sqDistXZ = SQ(effect->pos.x) + SQ(effect->pos.z);
bottomY = WATER_SURFACE_Y(play) + ((sqrtf(sqDistXZ) - 920.0f) * 0.147f);
@@ -1144,19 +1156,19 @@ void Fishing_UpdateEffects(FishingEffect* effect, PlayState* play) {
Fishing_SpawnRipple(NULL, play->specialEffects, &pos, 30.0f, 300.0f, 150, 90);
}
- if (effect->unk_2C >= 0) {
- effect->unk_2C++;
+ if (effect->state >= 0) {
+ effect->state++;
}
- if (effect->unk_2C == 30) {
+ if (effect->state == 30) {
Message_StartTextbox(play, 0x40B3, NULL);
}
- if ((effect->unk_2C >= 100) && (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT)) {
+ if ((effect->state >= 100) && (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT)) {
if (Message_ShouldAdvance(play) || (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) {
Message_CloseTextbox(play);
Rupees_ChangeBy(-50);
- effect->unk_2C = -1;
+ effect->state = -1;
}
}
}
@@ -1190,7 +1202,7 @@ void Fishing_DrawEffects(FishingEffect* effect, PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, effect->alpha);
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
- Matrix_Scale(effect->unk_30, 1.0f, effect->unk_30, MTXMODE_APPLY);
+ Matrix_Scale(effect->scale, 1.0f, effect->scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2305),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -1214,7 +1226,7 @@ void Fishing_DrawEffects(FishingEffect* effect, PlayState* play) {
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&play->billboardMtxF);
- Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY);
+ Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2346),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -1242,7 +1254,7 @@ void Fishing_DrawEffects(FishingEffect* effect, PlayState* play) {
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&play->billboardMtxF);
- Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY);
+ Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2394),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -1265,7 +1277,7 @@ void Fishing_DrawEffects(FishingEffect* effect, PlayState* play) {
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&play->billboardMtxF);
- Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY);
+ Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2423),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -1287,9 +1299,9 @@ void Fishing_DrawEffects(FishingEffect* effect, PlayState* play) {
}
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
- Matrix_RotateY(effect->unk_38, MTXMODE_APPLY);
- Matrix_RotateX(effect->unk_34, MTXMODE_APPLY);
- Matrix_RotateZ(effect->unk_3C, MTXMODE_APPLY);
+ Matrix_RotateY(effect->rot.y, MTXMODE_APPLY);
+ Matrix_RotateX(effect->rot.x, MTXMODE_APPLY);
+ Matrix_RotateZ(effect->rot.z, MTXMODE_APPLY);
Matrix_Scale(0.002f, 1.0f, 0.1f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2467),
@@ -1314,7 +1326,7 @@ void Fishing_DrawEffects(FishingEffect* effect, PlayState* play) {
}
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
- Matrix_Scale(effect->unk_30, 1.0f, effect->unk_30, MTXMODE_APPLY);
+ Matrix_Scale(effect->scale, 1.0f, effect->scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2504),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -1343,7 +1355,7 @@ void Fishing_DrawEffects(FishingEffect* effect, PlayState* play) {
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_RotateY(rotY, MTXMODE_APPLY);
- Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY);
+ Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2541),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -1356,10 +1368,10 @@ void Fishing_DrawEffects(FishingEffect* effect, PlayState* play) {
effect = firstEffect;
if (effect->type == FS_EFF_OWNER_HAT) {
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
- Matrix_RotateY(BINANG_TO_RAD_ALT2(sEffOwnerHatRot.y), MTXMODE_APPLY);
- Matrix_RotateX(BINANG_TO_RAD_ALT2(sEffOwnerHatRot.x), MTXMODE_APPLY);
- Matrix_RotateZ(BINANG_TO_RAD_ALT2(sEffOwnerHatRot.z), MTXMODE_APPLY);
- Matrix_Scale(effect->unk_30, effect->unk_30, effect->unk_30, MTXMODE_APPLY);
+ Matrix_RotateY(BINANG_TO_RAD_ALT2(sEffOwnersHatRot.y), MTXMODE_APPLY);
+ Matrix_RotateX(BINANG_TO_RAD_ALT2(sEffOwnersHatRot.x), MTXMODE_APPLY);
+ Matrix_RotateZ(BINANG_TO_RAD_ALT2(sEffOwnersHatRot.z), MTXMODE_APPLY);
+ Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY);
Matrix_Translate(-1250.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateX(M_PI / 2, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2560),
@@ -1394,7 +1406,8 @@ void Fishing_DrawStreamSplash(PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 2613);
}
-s32 func_80B6C2EC(Vec3f* vec) {
+// Checks if postion is above Fishing Pond owner's countertop.
+s32 Fishing_IsAboveCounter(Vec3f* vec) {
if (((vec->x >= 110.0f) && (vec->x <= 150.0f) && (vec->z <= 1400.0f) && (vec->z >= 1160.0f)) ||
((vec->x >= 110.0f) && (vec->x <= 210.0f) && (vec->z <= 1200.0f) && (vec->z >= 1160.0f))) {
if (vec->y <= 42.0f) {
@@ -1415,14 +1428,14 @@ void Fishing_UpdateLine(PlayState* play, Vec3f* basePos, Vec3f* pos, Vec3f* rot,
f32 ry;
f32 dist;
f32 spD8;
- s16 temp_s2;
+ s16 spooled;
s32 pad;
f32 temp_f20;
Vec3f posSrc = { 0.0f, 0.0f, 0.0f };
Vec3f posStep;
- f32 phi_f18;
- Vec3f spA4;
- Vec3f sp98;
+ f32 lineLength;
+ Vec3f tempPos;
+ Vec3f segPos;
f32 sp94;
f32 sp90;
f32 sp8C;
@@ -1432,36 +1445,36 @@ void Fishing_UpdateLine(PlayState* play, Vec3f* basePos, Vec3f* pos, Vec3f* rot,
f32 phi_f2;
if (D_80B7A6A4 != 0) {
- spA4 = *basePos;
- sp98 = pos[LINE_SEG_COUNT - 1];
+ tempPos = *basePos;
+ segPos = pos[LINE_SEG_COUNT - 1];
- sp94 = sp98.x - spA4.x;
- sp90 = sp98.y - spA4.y;
- sp8C = sp98.z - spA4.z;
+ sp94 = segPos.x - tempPos.x;
+ sp90 = segPos.y - tempPos.y;
+ sp8C = segPos.z - tempPos.z;
- phi_f18 = sqrtf(SQ(sp94) + SQ(sp90) + SQ(sp8C)) * 0.97f;
- if (phi_f18 > 1000.0f) {
- phi_f18 = 1000.0f;
+ lineLength = sqrtf(SQ(sp94) + SQ(sp90) + SQ(sp8C)) * 0.97f;
+ if (lineLength > 1000.0f) {
+ lineLength = 1000.0f;
}
- D_80B7E144 = 200.0f - (phi_f18 * 200.0f * 0.001f);
+ sRodLineSpooled = 200.0f - (lineLength * 200.0f * 0.001f);
}
- temp_s2 = D_80B7E144;
+ spooled = sRodLineSpooled;
posSrc.z = 5.0f;
for (i = 0; i < LINE_SEG_COUNT; i++) {
- if (i <= temp_s2) {
+ if (i <= spooled) {
pos[i] = *basePos;
} else if (D_80B7A6A4 != 0) {
- temp_f20 = (f32)(i - temp_s2) / (f32)(LINE_SEG_COUNT - temp_s2 + 1);
- Math_ApproachF(&pos[i].x, (sp94 * temp_f20) + spA4.x, 1.0f, 20.0f);
- Math_ApproachF(&pos[i].y, (sp90 * temp_f20) + spA4.y, 1.0f, 20.0f);
- Math_ApproachF(&pos[i].z, (sp8C * temp_f20) + spA4.z, 1.0f, 20.0f);
+ temp_f20 = (f32)(i - spooled) / (f32)(LINE_SEG_COUNT - spooled + 1);
+ Math_ApproachF(&pos[i].x, (sp94 * temp_f20) + tempPos.x, 1.0f, 20.0f);
+ Math_ApproachF(&pos[i].y, (sp90 * temp_f20) + tempPos.y, 1.0f, 20.0f);
+ Math_ApproachF(&pos[i].z, (sp8C * temp_f20) + tempPos.z, 1.0f, 20.0f);
}
}
- for (i = temp_s2 + 1, k = 0; i < LINE_SEG_COUNT; i++, k++) {
+ for (i = spooled + 1, k = 0; i < LINE_SEG_COUNT; i++, k++) {
temp_f18 = 2.0f * D_80B7E148;
dx = (pos + i)->x - (pos + i - 1)->x;
@@ -1475,7 +1488,7 @@ void Fishing_UpdateLine(PlayState* play, Vec3f* basePos, Vec3f* pos, Vec3f* rot,
phi_f12 = WATER_SURFACE_Y(play);
}
- if (D_80B7E0B6 == 2) {
+ if (sLureEquipped == FS_LURE_SINKING) {
if (spD8 < phi_f12) {
phi_f12 = ((sqrtf(sqDistXZ) - 920.0f) * 0.147f) + WATER_SURFACE_Y(play);
if (spD8 > phi_f12) {
@@ -1505,7 +1518,7 @@ void Fishing_UpdateLine(PlayState* play, Vec3f* basePos, Vec3f* pos, Vec3f* rot,
}
}
- if (func_80B6C2EC(&pos[i])) {
+ if (Fishing_IsAboveCounter(&pos[i])) {
spD8 = 42.0f;
}
@@ -1539,11 +1552,11 @@ void Fishing_UpdateLinePos(Vec3f* pos) {
f32 dist;
Vec3f posSrc = { 0.0f, 0.0f, 0.0f };
Vec3f posStep;
- s16 min = D_80B7E144;
+ s16 spooled = sRodLineSpooled;
posSrc.z = 5.0f;
- for (i = LINE_SEG_COUNT - 2; i > min; i--) {
+ for (i = LINE_SEG_COUNT - 2; i > spooled; i--) {
dx = (pos + i)->x - (pos + i + 1)->x;
dy = (pos + i)->y - (pos + i + 1)->y;
dz = (pos + i)->z - (pos + i + 1)->z;
@@ -1578,7 +1591,7 @@ void Fishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookInd
Matrix_Push();
- if ((D_80B7A694 == 3) && ((pos->y > WATER_SURFACE_Y(play)) || ((D_80B7A68C != 0) && hookIndex))) {
+ if ((sRodCastState == 3) && ((pos->y > WATER_SURFACE_Y(play)) || (sIsOwnersHatHooked && hookIndex))) {
offsetY = 0.0f;
} else if (pos->y < WATER_SURFACE_Y(play)) {
offsetY = -1.0f;
@@ -1604,7 +1617,7 @@ void Fishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookInd
Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_NEW);
- if ((player->actor.speed == 0.0f) && (D_80B7E138 == 0.0f)) {
+ if ((player->actor.speed == 0.0f) && (sLureWigglePosY == 0.0f)) {
Math_ApproachF(&sLureHookRotY[hookIndex], ry, 0.1f, 0.3f);
} else {
sLureHookRotY[hookIndex] = ry;
@@ -1625,24 +1638,24 @@ void Fishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookInd
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gFishingLureHookDL);
- if ((hookIndex == 1) && (D_80B7A68C != 0)) {
+ if ((hookIndex == 1) && (sIsOwnersHatHooked)) {
Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY);
Matrix_Translate(250.0f, 0.0f, -1400.0f, MTXMODE_APPLY);
Matrix_Push();
- if (D_80B7A690 != 0) {
+ if (sIsOwnersHatSunk) {
FishingEffect* effect = play->specialEffects;
MtxF mf;
Matrix_MultVec3f(&sZeroVec, &effect->pos);
Matrix_Get(&mf);
- Matrix_MtxFToYXZRotS(&mf, &sEffOwnerHatRot, 0);
+ Matrix_MtxFToYXZRotS(&mf, &sEffOwnersHatRot, 0);
- D_80B7A690 = 0;
- D_80B7A68C = 0;
+ sIsOwnersHatSunk = false;
+ sIsOwnersHatHooked = false;
effect->type = FS_EFF_OWNER_HAT;
- effect->unk_2C = 0;
+ effect->state = 0;
effect->vel = sZeroVec;
effect->accel = sZeroVec;
}
@@ -1682,7 +1695,7 @@ void Fishing_UpdateSinkingLure(PlayState* play) {
sSinkingLurePos[0] = sLurePos;
- if (D_80B7A6D4 != 0) {
+ if (sSinkingLureFound) {
offsetY = -1.0f;
} else if (sLurePos.y < WATER_SURFACE_Y(play)) {
offsetY = 0.5f;
@@ -1690,7 +1703,7 @@ void Fishing_UpdateSinkingLure(PlayState* play) {
offsetY = -5.0f;
}
- if (D_80B7A694 == 5) {
+ if (sRodCastState == 5) {
Matrix_RotateY(BINANG_TO_RAD(player->actor.shape.rot.y), MTXMODE_NEW);
sp94.x = 5.0f;
sp94.y = 0.0f;
@@ -1701,7 +1714,7 @@ void Fishing_UpdateSinkingLure(PlayState* play) {
for (i = 1; i < SINKING_LURE_SEG_COUNT; i++) {
Vec3f* pos = sSinkingLurePos;
- if ((i < 10) && (D_80B7A694 == 5)) {
+ if ((i < 10) && (sRodCastState == 5)) {
offsetX = (10 - i) * sp88.x * 0.1f;
offsetZ = (10 - i) * sp88.z * 0.1f;
} else {
@@ -1745,9 +1758,9 @@ void Fishing_DrawSinkingLure(PlayState* play) {
gSPDisplayList(POLY_OPA_DISP++, gFishingSinkingLureSegmentMaterialDL);
for (i = SINKING_LURE_SEG_COUNT - 1; i >= 0; i--) {
- if ((i + D_80B7FEA0) < SINKING_LURE_SEG_COUNT) {
+ if ((i + sSinkingLureSegmentIndex) < SINKING_LURE_SEG_COUNT) {
Matrix_Translate(sSinkingLurePos[i].x, sSinkingLurePos[i].y, sSinkingLurePos[i].z, MTXMODE_NEW);
- scale = sSinkingLureSizes[i + D_80B7FEA0] * 0.04f;
+ scale = sSinkingLureSizes[i + sSinkingLureSegmentIndex] * 0.04f;
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
Matrix_ReplaceRotation(&play->billboardMtxF);
@@ -1762,9 +1775,9 @@ void Fishing_DrawSinkingLure(PlayState* play) {
gSPDisplayList(POLY_XLU_DISP++, gFishingSinkingLureSegmentMaterialDL);
for (i = SINKING_LURE_SEG_COUNT - 1; i >= 0; i--) {
- if ((i + D_80B7FEA0) < SINKING_LURE_SEG_COUNT) {
+ if ((i + sSinkingLureSegmentIndex) < SINKING_LURE_SEG_COUNT) {
Matrix_Translate(sSinkingLurePos[i].x, sSinkingLurePos[i].y, sSinkingLurePos[i].z, MTXMODE_NEW);
- scale = sSinkingLureSizes[i + D_80B7FEA0] * 0.04f;
+ scale = sSinkingLureSizes[i + sSinkingLureSegmentIndex] * 0.04f;
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
Matrix_ReplaceRotation(&play->billboardMtxF);
@@ -1783,7 +1796,7 @@ void Fishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) {
Vec3f posStep;
Vec3f hookPos[2];
s16 i;
- s16 spB4 = D_80B7E144;
+ s16 spooled = sRodLineSpooled;
s32 pad;
Player* player = GET_PLAYER(play);
@@ -1792,17 +1805,17 @@ void Fishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) {
Gfx_SetupDL_25Opa(play->state.gfxCtx);
Matrix_Push();
- if (D_80B7A6D4 != 0) {
+ if (sSinkingLureFound) {
Vec3f posTemp = sLurePos;
sLurePos = sSinkingLureBasePos;
Fishing_DrawSinkingLure(play);
sLurePos = posTemp;
}
- if ((D_80B7A694 == 4) || (D_80B7A694 == 5)) {
+ if ((sRodCastState == 4) || (sRodCastState == 5)) {
sLurePos = sFishingHookedFish->fishMouthPos;
- if ((D_80B7A694 == 5) && (D_80B7E0B6 == 2)) {
+ if ((sRodCastState == 5) && (sLureEquipped == FS_LURE_SINKING)) {
Matrix_RotateY(BINANG_TO_RAD(player->actor.shape.rot.y), MTXMODE_NEW);
posSrc.x = 2.0f;
posSrc.y = 0.0f;
@@ -1811,7 +1824,7 @@ void Fishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) {
sLurePos.x += posStep.x;
sLurePos.z += posStep.z;
}
- } else if (D_80B7A694 == 0) {
+ } else if (sRodCastState == 0) {
sLurePos = sReelLinePos[LINE_SEG_COUNT - 1];
sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI;
@@ -1822,12 +1835,12 @@ void Fishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) {
}
}
- if (D_80B7E0B6 != 2) {
+ if (sLureEquipped != FS_LURE_SINKING) {
Matrix_Translate(sLurePos.x, sLurePos.y, sLurePos.z, MTXMODE_NEW);
- Matrix_RotateY(sLureRot.y + D_80B7E104, MTXMODE_APPLY);
+ Matrix_RotateY(sLureRot.y + sLure1Rotate, MTXMODE_APPLY);
Matrix_RotateX(sLureRot.x, MTXMODE_APPLY);
Matrix_Scale(0.0039999997f, 0.0039999997f, 0.0039999997f, MTXMODE_APPLY);
- Matrix_Translate(0.0f, 0.0f, D_80B7E108, MTXMODE_APPLY);
+ Matrix_Translate(0.0f, 0.0f, sLurePosZOffset, MTXMODE_APPLY);
Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY);
Matrix_RotateY(M_PI / 2, MTXMODE_APPLY);
@@ -1840,7 +1853,7 @@ void Fishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) {
posSrc.x = -850.0f;
posSrc.y = 0.0f;
posSrc.z = 0.0f;
- Matrix_MultVec3f(&posSrc, &D_80B7E0C8);
+ Matrix_MultVec3f(&posSrc, &sLureDrawPos);
posSrc.x = 500.0f;
posSrc.z = -300.0f;
@@ -1858,7 +1871,7 @@ void Fishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) {
gDPSetCombineMode(POLY_XLU_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 55);
- if ((D_80B7A694 == 4) && ((D_80B7E124 != 0) || (D_80B7E0B6 != 2))) {
+ if ((sRodCastState == 4) && ((sLineHooked != 0) || (sLureEquipped != FS_LURE_SINKING))) {
f32 rx;
f32 ry;
f32 dist;
@@ -1879,14 +1892,14 @@ void Fishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) {
Matrix_Translate(sRodTipPos.x, sRodTipPos.y, sRodTipPos.z, MTXMODE_NEW);
Matrix_RotateY(ry, MTXMODE_APPLY);
Matrix_RotateX(rx, MTXMODE_APPLY);
- Matrix_Scale(D_80B7E14C, 1.0f, dist, MTXMODE_APPLY);
+ Matrix_Scale(sFishingLineScale, 1.0f, dist, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 3444),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gFishingLineModelDL);
} else {
- for (i = spB4; i < LINE_SEG_COUNT - 1; i++) {
- if ((i == LINE_SEG_COUNT - 3) && (D_80B7E0B6 == 0) && (D_80B7A694 == 3)) {
+ for (i = spooled; i < LINE_SEG_COUNT - 1; i++) {
+ if ((i == LINE_SEG_COUNT - 3) && (sLureEquipped == FS_LURE_STOCK) && (sRodCastState == 3)) {
f32 rx;
f32 ry;
f32 dist;
@@ -1894,9 +1907,9 @@ void Fishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) {
f32 dy;
f32 dz;
- dx = D_80B7E0C8.x - (linePos + i)->x;
- dy = D_80B7E0C8.y - (linePos + i)->y;
- dz = D_80B7E0C8.z - (linePos + i)->z;
+ dx = sLureDrawPos.x - (linePos + i)->x;
+ dy = sLureDrawPos.y - (linePos + i)->y;
+ dz = sLureDrawPos.z - (linePos + i)->z;
ry = Math_FAtan2F(dx, dz);
dist = sqrtf(SQ(dx) + SQ(dz));
@@ -1907,7 +1920,7 @@ void Fishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) {
Matrix_Translate((linePos + i)->x, (linePos + i)->y, (linePos + i)->z, MTXMODE_NEW);
Matrix_RotateY(ry, MTXMODE_APPLY);
Matrix_RotateX(rx, MTXMODE_APPLY);
- Matrix_Scale(D_80B7E14C, 1.0f, dist, MTXMODE_APPLY);
+ Matrix_Scale(sFishingLineScale, 1.0f, dist, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 3475),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -1918,7 +1931,7 @@ void Fishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) {
Matrix_Translate((linePos + i)->x, (linePos + i)->y, (linePos + i)->z, MTXMODE_NEW);
Matrix_RotateY((lineRot + i)->y, MTXMODE_APPLY);
Matrix_RotateX((lineRot + i)->x, MTXMODE_APPLY);
- Matrix_Scale(D_80B7E14C, 1.0f, 0.005f, MTXMODE_APPLY);
+ Matrix_Scale(sFishingLineScale, 1.0f, 0.005f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 3492),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -1947,7 +1960,7 @@ static Vec3f sRodTipOffset = { 0.0f, 0.0f, 0.0f };
void Fishing_DrawRod(PlayState* play) {
s16 i;
- f32 spC8;
+ f32 lureXZLen;
f32 spC4;
f32 spC0;
Input* input = &play->state.input[0];
@@ -1956,8 +1969,8 @@ void Fishing_DrawRod(PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 3600);
- if (D_80B7FDA8 != 0) {
- D_80B7FDA8--;
+ if (sRodHitTimer != 0) {
+ sRodHitTimer--;
Math_ApproachF(&D_80B7A6C0, 35.0f, 1.0f, 100.0f);
Math_ApproachF(&D_80B7A6BC, -0.8f, 1.0f, 0.4f);
@@ -1965,8 +1978,8 @@ void Fishing_DrawRod(PlayState* play) {
} else {
s16 target = 0;
- if ((D_80B7A694 == 4) && (D_80B7E124 != 0)) {
- target = Math_SinS(D_80B7E0AE * 25600) * 1500.0f;
+ if ((sRodCastState == 4) && sLineHooked) {
+ target = Math_SinS(sLureTimer * 25600) * 1500.0f;
} else {
Math_ApproachZeroF(&D_80B7A6C0, 0.1f, 10.0f);
Math_ApproachZeroF(&D_80B7A6BC, 1.0f, 0.05f);
@@ -1975,17 +1988,17 @@ void Fishing_DrawRod(PlayState* play) {
Math_ApproachS(&player->actor.shape.rot.x, target, 5, 1000);
}
- if ((D_80B7A694 == 3) || (D_80B7A694 == 4)) {
- if ((input->rel.stick_x == 0) && (D_80B7A6C4 != 0)) {
+ if ((sRodCastState == 3) || (sRodCastState == 4)) {
+ if ((input->rel.stick_x == 0) && (sStickAdjXPrev != 0)) {
D_80B7A6B0 = 0.0f;
}
- if ((input->rel.stick_y == 0) && (D_80B7A6C8 != 0)) {
+ if ((input->rel.stick_y == 0) && (sStickAdjYPrev != 0)) {
D_80B7A6B4 = 0.0f;
}
- spC8 = player->unk_85C;
+ lureXZLen = player->unk_85C;
Math_SmoothStepToF(&player->unk_85C, input->rel.stick_y * 0.02f, 0.3f, 5.0f, 0.0f);
- spC8 = player->unk_85C - spC8;
+ lureXZLen = player->unk_85C - lureXZLen;
spC4 = player->unk_858;
Math_SmoothStepToF(&player->unk_858, input->rel.stick_x * 0.02f, 0.3f, 5.0f, 0.0f);
@@ -2004,18 +2017,18 @@ void Fishing_DrawRod(PlayState* play) {
player->unk_85C = -1.0f;
}
- Math_ApproachF(&D_80B7A6A8, spC4 * 70.0f * -0.01f, 1.0f, D_80B7A6B0);
+ Math_ApproachF(&sRodBendRotY, spC4 * 70.0f * -0.01f, 1.0f, D_80B7A6B0);
Math_ApproachF(&D_80B7A6B0, 1.0f, 1.0f, 0.1f);
- Math_ApproachF(&D_80B7A6AC, spC8 * 70.0f * 0.01f, 1.0f, D_80B7A6B4);
+ Math_ApproachF(&D_80B7A6AC, lureXZLen * 70.0f * 0.01f, 1.0f, D_80B7A6B4);
Math_ApproachF(&D_80B7A6B4, 1.0f, 1.0f, 0.1f);
Math_ApproachZeroF(&D_80B7A6B8, 1.0f, 0.05f);
} else {
Math_ApproachZeroF(&player->unk_85C, 1.0f, 0.1f);
Math_ApproachZeroF(&player->unk_858, 1.0f, 0.1f);
- Math_ApproachF(&D_80B7A6AC, (Math_SinS(D_80B7E0AE * 3000) * 0.025f) + -0.03f, 1.0f, 0.05f);
- Math_ApproachZeroF(&D_80B7A6A8, 1.0f, 0.05f);
+ Math_ApproachF(&D_80B7A6AC, (Math_SinS(sLureTimer * 3000) * 0.025f) + -0.03f, 1.0f, 0.05f);
+ Math_ApproachZeroF(&sRodBendRotY, 1.0f, 0.05f);
- if ((D_80B7E0B4 >= 19) && (D_80B7E0B4 <= 24)) {
+ if ((sRodCastTimer > 18) && (sRodCastTimer < 25)) {
Math_ApproachF(&D_80B7A6B8, 0.8f, 1.0f, 0.2f);
} else {
Math_ApproachF(&D_80B7A6B8, 0.0f, 1.0f, 0.4f);
@@ -2036,7 +2049,7 @@ void Fishing_DrawRod(PlayState* play) {
Matrix_Translate(0.0f, 230.0f, 0.0f, MTXMODE_APPLY);
}
- if (D_80B7A694 == 5) {
+ if (sRodCastState == 5) {
Matrix_RotateY(0.56f * M_PI, MTXMODE_APPLY);
} else {
Matrix_RotateY(0.41f * M_PI, MTXMODE_APPLY);
@@ -2052,7 +2065,7 @@ void Fishing_DrawRod(PlayState* play) {
Matrix_Translate(0.0f, 0.0f, -1300.0f, MTXMODE_APPLY);
for (i = 0; i < 22; i++) {
- Matrix_RotateY(sRodBendRatios[i] * D_80B7A6A8 * 0.5f, MTXMODE_APPLY);
+ Matrix_RotateY(sRodBendRatios[i] * sRodBendRotY * 0.5f, MTXMODE_APPLY);
Matrix_RotateX(sRodBendRatios[i] * spC0 * 0.5f, MTXMODE_APPLY);
Matrix_Push();
@@ -2085,18 +2098,18 @@ void Fishing_DrawRod(PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 3838);
}
-static Vec3f D_80B7AF94 = { 0.0f, 0.0f, 0.0f };
+static Vec3f sSoundPos = { 0.0f, 0.0f, 0.0f };
void Fishing_UpdateLure(Fishing* this, PlayState* play) {
f32 spE4;
f32 spE0;
- s16 phi_v0;
+ s16 timer;
s16 spDC;
f32 spD8;
f32 spD4;
f32 spD0;
- f32 phi_f16;
- f32 spC8;
+ f32 lengthCasted;
+ f32 lureXZLen;
s16 i;
Player* player = GET_PLAYER(play);
Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
@@ -2108,12 +2121,12 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) {
f32 sp7C;
f32 sp78;
f32 phi_f0;
- f32 sp70;
+ f32 wiggle;
Vec3f sp64;
Vec3f sp58;
s32 pad;
- D_80B7E0AE++;
+ sLureTimer++;
if (D_80B7E0B0 != 0) {
D_80B7E0B0--;
@@ -2123,12 +2136,12 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) {
D_80B7E0B2--;
}
- if (D_80B7E0B4 != 0) {
- D_80B7E0B4--;
+ if (sRodCastTimer != 0) {
+ sRodCastTimer--;
}
- if (D_80B7E122 != 0) {
- D_80B7E122--;
+ if (sLureBitTimer != 0) {
+ sLureBitTimer--;
}
if (D_80B7E150 != 0) {
@@ -2139,33 +2152,34 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) {
D_80B7A6A4--;
}
- if (D_80B7E0A4 != 0) {
- D_80B7E0A4--;
+ if (sRumbleDelay != 0) {
+ sRumbleDelay--;
}
if (D_80B7E114 != 0) {
D_80B7E114--;
}
- if (D_80B7E0AC == 1) {
- D_80B7E0AC = 2;
- D_80B7E084 = 0;
- D_80B7E082 = 0;
- D_80B7E0B6 = 0;
+ if (sFishingPlayingState == 1) {
+ sFishingPlayingState = 2;
+ sFishesCaught = 0;
+ sPondOwnerTextIdIndex = 0;
+ sLureEquipped = FS_LURE_STOCK;
- if (((sLinkAge == LINK_AGE_CHILD) && (HIGH_SCORE(HS_FISHING) & 0x400)) ||
- ((sLinkAge != LINK_AGE_CHILD) && (HIGH_SCORE(HS_FISHING) & 0x800))) {
+ // if prize item won as child or adult, set the sinking lure location.
+ if (((sLinkAge == LINK_AGE_CHILD) && (HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_CHILD)) ||
+ ((sLinkAge != LINK_AGE_CHILD) && (HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_ADULT))) {
sSinkingLureLocation = (u8)Rand_ZeroFloat(3.999f) + 1;
}
D_80B7E148 = 520.0f;
- D_80B7E144 = 195.0f;
+ sRodLineSpooled = 195.0f;
- D_80B7A694 = D_80B7E0B6 = D_80B7E0AE = D_80B7E0B0 = D_80B7E0B2 = D_80B7E0B4 = D_80B7E120 = D_80B7E114 =
+ sRodCastState = sLureEquipped = sLureTimer = D_80B7E0B0 = D_80B7E0B2 = sRodCastTimer = sWiggleAttraction = D_80B7E114 =
D_80B7E150 = 0;
- D_80B7E104 = D_80B7E154 = D_80B7E108 = 0.0f;
+ sLure1Rotate = sReelLinePosStep = sLurePosZOffset = 0.0f;
- D_80B7E128 = zeroVec;
+ sLureLineSegPosDelta = zeroVec;
for (i = 0; i < LINE_SEG_COUNT; i++) {
sReelLinePos[i] = zeroVec;
@@ -2174,78 +2188,78 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) {
}
}
- SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sLurePos, &D_80B7AF94, &sProjectedW);
+ SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sLurePos, &sSoundPos, &sProjectedW);
- if (D_80B7A694 == 0) {
- Math_ApproachF(&D_80B7E108, -800.0f, 1.0f, 20.0f);
+ if (sRodCastState == 0) {
+ Math_ApproachF(&sLurePosZOffset, -800.0f, 1.0f, 20.0f);
} else {
- Math_ApproachF(&D_80B7E108, 300.0f, 1.0f, 20.0f);
+ Math_ApproachF(&sLurePosZOffset, 300.0f, 1.0f, 20.0f);
}
- switch (D_80B7A694) {
+ switch (sRodCastState) {
case 0:
- D_80B7FEA0 = 0;
+ sSinkingLureSegmentIndex = 0;
if (KREG(14) != 0) {
KREG(14) = 0;
- D_80B7E0B6 = 2 - D_80B7E0B6;
- if (D_80B7E0B6 != 0) {
- D_80B7E082 = 0;
+ sLureEquipped = FS_LURE_SINKING - sLureEquipped;
+ if (sLureEquipped != FS_LURE_STOCK) {
+ sPondOwnerTextIdIndex = 0;
}
}
- Math_ApproachF(&D_80B7E144, 195.0f, 1.0f, 1.0f);
+ Math_ApproachF(&sRodLineSpooled, 195.0f, 1.0f, 1.0f);
if (player->stateFlags1 & PLAYER_STATE1_27) {
- D_80B7E0B4 = 0;
+ sRodCastTimer = 0;
player->unk_860 = 0;
}
- if (D_80B7E0B4 == 0) {
+ if (sRodCastTimer == 0) {
if ((D_80B7E0B0 == 0) && (player->unk_860 == 1)) {
- D_80B7E0B4 = 37;
+ sRodCastTimer = 37;
Message_CloseTextbox(play);
}
} else {
sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI;
sLureRot.y = sReelLineRot[LINE_SEG_COUNT - 2].y;
- if (D_80B7E0B4 == 18) {
- D_80B7A694 = 1;
+ if (sRodCastTimer == 18) {
+ sRodCastState = 1;
sLurePos = sRodTipPos;
Matrix_RotateY(BINANG_TO_RAD_ALT(player->actor.shape.rot.y), MTXMODE_NEW);
sp90.x = 0.0f;
sp90.y = 0.0f;
sp90.z = 25.0f;
- Matrix_MultVec3f(&sp90, &D_80B7E0E8);
- D_80B7E0E8.y = 15.0f;
- D_80B7E0F8.x = D_80B7E0F8.z = 0.0f;
- D_80B7E0F8.y = -1.0f;
+ Matrix_MultVec3f(&sp90, &sLurePosDelta);
+ sLurePosDelta.y = 15.0f;
+ sLureCastDelta.x = sLureCastDelta.z = 0.0f;
+ sLureCastDelta.y = -1.0f;
D_80B7E148 = 0.0f;
D_80B7E0B2 = 5;
- D_80B7E11C = 0.5f;
+ sRodReelingSpeed = 0.5f;
D_80B7E118 = Rand_ZeroFloat(1.9f);
sFishMouthOffset.y = 500.0f;
- Sfx_PlaySfxAtPos(&D_80B7AF94, NA_SE_IT_SWORD_SWING_HARD);
+ Sfx_PlaySfxAtPos(&sSoundPos, NA_SE_IT_SWORD_SWING_HARD);
}
}
break;
- case 1:
+ case 1: // casting the line
spE0 = sLurePos.y;
- sLurePos.x += D_80B7E0E8.x;
- sLurePos.y += D_80B7E0E8.y;
- sLurePos.z += D_80B7E0E8.z;
-
- D_80B7E0E8.x += D_80B7E0F8.x;
- D_80B7E0E8.y += D_80B7E0F8.y;
- D_80B7E0E8.z += D_80B7E0F8.z;
-
- if (CHECK_BTN_ALL(input->cur.button, BTN_A) || (D_80B7A68C != 0)) {
- D_80B7E0E8.x *= 0.9f;
- D_80B7E0E8.z *= 0.9f;
- if (D_80B7A68C == 0) {
+ sLurePos.x += sLurePosDelta.x;
+ sLurePos.y += sLurePosDelta.y;
+ sLurePos.z += sLurePosDelta.z;
+
+ sLurePosDelta.x += sLureCastDelta.x;
+ sLurePosDelta.y += sLureCastDelta.y;
+ sLurePosDelta.z += sLureCastDelta.z;
+ // air drag by hat or reeling during cast.
+ if (CHECK_BTN_ALL(input->cur.button, BTN_A) || sIsOwnersHatHooked) {
+ sLurePosDelta.x *= 0.9f;
+ sLurePosDelta.z *= 0.9f;
+ if (!sIsOwnersHatHooked) {
Sfx_PlaySfxCentered(NA_SE_IT_FISHING_REEL_HIGH - SFX_FLAG);
}
}
@@ -2262,14 +2276,14 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) {
sLureRot.y = Math_Atan2F(spD0, spD8) + M_PI;
}
- phi_f16 = sqrtf(SQ(spD8) + SQ(spD4) + SQ(spD0));
- if (phi_f16 > 1000.0f) {
- phi_f16 = 1000.0f;
+ lengthCasted = sqrtf(SQ(spD8) + SQ(spD4) + SQ(spD0));
+ if (lengthCasted > 1000.0f) {
+ lengthCasted = 1000.0f;
}
- D_80B7E144 = 200.0f - (phi_f16 * 200.0f * 0.001f);
+ sRodLineSpooled = 200.0f - (lengthCasted * 200.0f * 0.001f);
- spC8 = SQ(sLurePos.x) + SQ(sLurePos.z);
- if (spC8 > SQ(920.0f)) {
+ lureXZLen = SQ(sLurePos.x) + SQ(sLurePos.z);
+ if (lureXZLen > SQ(920.0f)) {
if ((KREG(56) != 0) || (sLurePos.y > 160.0f) || (sLurePos.x < 80.0f) || (sLurePos.x > 180.0f) ||
(sLurePos.z > 1350.0f) || (sLurePos.z < 1100.0f) || (sLurePos.y < 45.0f)) {
sp80 = this->actor.world.pos;
@@ -2279,50 +2293,50 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) {
this->actor.world.pos = sp80;
if (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) {
- D_80B7E0E8.y = -0.5f;
+ sLurePosDelta.y = -0.5f;
}
if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) {
- if (D_80B7E0E8.y > 0.0f) {
- D_80B7E0E8.y = 0.0f;
+ if (sLurePosDelta.y > 0.0f) {
+ sLurePosDelta.y = 0.0f;
}
- D_80B7E0E8.x = D_80B7E0E8.z = 0.0f;
+ sLurePosDelta.x = sLurePosDelta.z = 0.0f;
}
} else {
- if (func_80B6C2EC(&sLurePos) != 0) {
- D_80B7A694 = 3;
- D_80B7E154 = 0.0f;
+ if (Fishing_IsAboveCounter(&sLurePos)) {
+ sRodCastState = 3;
+ sReelLinePosStep = 0.0f;
}
}
- spE4 = ((sqrtf(spC8) - 920.0f) * 0.11f) + WATER_SURFACE_Y(play);
+ spE4 = ((sqrtf(lureXZLen) - 920.0f) * 0.11f) + WATER_SURFACE_Y(play);
if (sLurePos.y <= spE4) {
sLurePos.y = spE4;
- D_80B7E0E8.x = D_80B7E0E8.y = D_80B7E0E8.z = 0.0f;
- D_80B7A694 = 3;
- D_80B7E154 = 0.0;
+ sLurePosDelta.x = sLurePosDelta.y = sLurePosDelta.z = 0.0f;
+ sRodCastState = 3;
+ sReelLinePosStep = 0.0;
} else {
Math_ApproachF(&D_80B7E148, 0.0f, 1.0f, 0.05f);
- Sfx_PlaySfxAtPos(&D_80B7AF94, NA_SE_EN_FANTOM_FLOAT - SFX_FLAG);
+ Sfx_PlaySfxAtPos(&sSoundPos, NA_SE_EN_FANTOM_FLOAT - SFX_FLAG);
}
} else {
spE4 = WATER_SURFACE_Y(play);
if (sLurePos.y <= spE4) {
- D_80B7A694 = 2;
- D_80B7E154 = 0.0f;
- D_80B7E0E8.x = D_80B7E0E8.z = 0.0f;
+ sRodCastState = 2;
+ sReelLinePosStep = 0.0f;
+ sLurePosDelta.x = sLurePosDelta.z = 0.0f;
- if (D_80B7E0B6 == 2) {
- D_80B7E0A2 = 0;
+ if (sLureEquipped == FS_LURE_SINKING) {
+ sLureMoveDelay = 0;
} else {
- D_80B7E0A2 = 10;
+ sLureMoveDelay = 10;
}
if ((sLurePos.y <= spE4) && (spE4 < spE0) && (spE4 == WATER_SURFACE_Y(play))) {
D_80B7E114 = 10;
- Sfx_PlaySfxAtPos(&D_80B7AF94, NA_SE_EV_BOMB_DROP_WATER);
- D_80B7E0F8.y = 0.0f;
- D_80B7E0E8.y *= 0.2f;
+ Sfx_PlaySfxAtPos(&sSoundPos, NA_SE_EV_BOMB_DROP_WATER);
+ sLureCastDelta.y = 0.0f;
+ sLurePosDelta.y *= 0.2f;
for (i = 0; i < 50; i++) {
sp7C = Rand_ZeroFloat(1.5f) + 0.5f;
@@ -2346,7 +2360,7 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) {
}
} else {
Math_ApproachZeroF(&D_80B7E148, 1.0f, 0.05f);
- Sfx_PlaySfxAtPos(&D_80B7AF94, NA_SE_EN_FANTOM_FLOAT - SFX_FLAG);
+ Sfx_PlaySfxAtPos(&sSoundPos, NA_SE_EN_FANTOM_FLOAT - SFX_FLAG);
}
}
@@ -2354,219 +2368,220 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) {
sReelLinePos[LINE_SEG_COUNT - 1].y = sLurePos.y;
sReelLinePos[LINE_SEG_COUNT - 1].z = sLurePos.z;
- D_80B7E140 = 1.0f;
- D_80B7E10C = 0.5f;
+ sLureWiggleSign = 1.0f;
+ sLureRotXTarget = 0.5f;
break;
case 2:
if (sLurePos.y <= WATER_SURFACE_Y(play)) {
- sLurePos.y += D_80B7E0E8.y;
+ sLurePos.y += sLurePosDelta.y;
- Math_ApproachZeroF(&D_80B7E0E8.y, 1.0f, 1.0f);
+ Math_ApproachZeroF(&sLurePosDelta.y, 1.0f, 1.0f);
- if (D_80B7E0B6 != 2) {
+ if (sLureEquipped != FS_LURE_SINKING) {
Math_ApproachF(&sLurePos.y, WATER_SURFACE_Y(play), 0.5f, 1.0f);
}
}
Math_ApproachF(&D_80B7E148, 2.0f, 1.0f, 0.1f);
- if (D_80B7E0A2 == 0) {
- D_80B7A694 = 3;
+ if (sLureMoveDelay == 0) {
+ sRodCastState = 3;
} else {
- D_80B7E0A2--;
+ sLureMoveDelay--;
}
break;
case 3:
- D_80B7FEA0 = 0;
+ sSinkingLureSegmentIndex = 0;
- if ((D_80B7A68C != 0) && ((SQ(sLurePos.x) + SQ(sLurePos.z)) < SQ(500.0f))) {
- D_80B7A690 = 1;
+ if (sIsOwnersHatHooked && ((SQ(sLurePos.x) + SQ(sLurePos.z)) < SQ(500.0f))) {
+ sIsOwnersHatSunk = true;
}
player->unk_860 = 2;
- if (D_80B7E138 < 3.0f) {
- spD0 = D_80B7E10C * Math_SinS(D_80B7E0AE * 0x1060);
- Math_ApproachF(&sLureRot.x, -M_PI / 6.0f + spD0, 0.3f, D_80B7E110);
- Math_ApproachF(&D_80B7E110, 0.5f, 1.0f, 0.02f);
- Math_ApproachZeroF(&D_80B7E10C, 1.0f, 0.02f);
+ if (sLureWigglePosY < 3.0f) {
+ spD0 = sLureRotXTarget * Math_SinS(sLureTimer * 0x1060);
+ Math_ApproachF(&sLureRot.x, -M_PI / 6.0f + spD0, 0.3f, sLureRotXStep);
+ Math_ApproachF(&sLureRotXStep, 0.5f, 1.0f, 0.02f);
+ Math_ApproachZeroF(&sLureRotXTarget, 1.0f, 0.02f);
} else {
- D_80B7E110 = 0.0f;
+ sLureRotXStep = 0.0f;
}
spDC = 0x4000;
spE4 = WATER_SURFACE_Y(play);
- spC8 = SQ(sLurePos.x) + SQ(sLurePos.z);
- if (spC8 < SQ(920.0f)) {
+ lureXZLen = SQ(sLurePos.x) + SQ(sLurePos.z);
+ if (lureXZLen < SQ(920.0f)) {
if (sLurePos.y <= (spE4 + 4.0f)) {
- sp70 = 0.0f;
+ wiggle = 0.0f;
if (D_80B7E150 == 0) {
if (fabsf(input->rel.stick_x) > 30.0f) {
- sp70 = fabsf((input->rel.stick_x - D_80B7A6C4) * (1.0f / 60.0f));
+ wiggle = fabsf((input->rel.stick_x - sStickAdjXPrev) * (1.0f / 60.0f));
} else if (fabsf(input->rel.stick_y) > 30.0f) {
- sp70 = fabsf((input->rel.stick_y - D_80B7A6C8) * (1.0f / 60.0f));
+ wiggle = fabsf((input->rel.stick_y - sStickAdjYPrev) * (1.0f / 60.0f));
}
}
- if (sp70 > 1.0f) {
- sp70 = 1.0f;
+ if (wiggle > 1.0f) {
+ wiggle = 1.0f;
}
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
- sp70 = 0.5f;
+ wiggle = 0.5f;
}
- if (D_80B7A68C != 0) {
- if (sp70 > 0.3f) {
- sp70 = 0.3f;
+ if (sIsOwnersHatHooked) {
+ if (wiggle > 0.3f) {
+ wiggle = 0.3f;
}
}
- if ((sp70 > 0.2f) && (D_80B7E138 < 4.0f)) {
+ if ((wiggle > 0.2f) && (sLureWigglePosY < 4.0f)) {
D_80B7E150 = 5;
- if (sp70 > 0.8f) {
- D_80B7E120 = 2;
+ if (wiggle > 0.8f) {
+ sWiggleAttraction = 2;
} else {
- D_80B7E120 = 1;
+ sWiggleAttraction = 1;
}
sp90.x = player->actor.world.pos.x - sLurePos.x;
sp90.z = player->actor.world.pos.z - sLurePos.z;
sp90.y = Math_Atan2F(sp90.z, sp90.x);
- D_80B7E134 = (sp70 * D_80B7E140) + sp90.y;
- D_80B7E140 = D_80B7E140 * -1.0f;
- D_80B7E138 = fabsf(sp70) * 6.0f;
+ sLureWiggleRotYTarget = (wiggle * sLureWiggleSign) + sp90.y;
+ sLureWiggleSign *= -1.0f;
+ sLureWigglePosY = fabsf(wiggle) * 6.0f;
sLureRot.x = 0.0f;
- D_80B7E10C = 0.5f;
- D_80B7E144 += (fabsf(sp70) * (7.5f + (KREG(25) * 0.1f)));
+ sLureRotXTarget = 0.5f;
+ sRodLineSpooled += (fabsf(wiggle) * (7.5f + (KREG(25) * 0.1f)));
- func_800F436C(&D_80B7AF94, NA_SE_EV_LURE_MOVE_W, (sp70 * 1.999f * 0.25f) + 0.75f);
+ func_800F436C(&sSoundPos, NA_SE_EV_LURE_MOVE_W, (wiggle * 1.999f * 0.25f) + 0.75f);
- if (D_80B7E0B6 == 2) {
- D_80B7E128.y = 5.0f * sp70;
- sReelLinePos[LINE_SEG_COUNT - 1].y += D_80B7E128.y;
- sLurePos.y += D_80B7E128.y;
+ if (sLureEquipped == FS_LURE_SINKING) {
+ sLureLineSegPosDelta.y = 5.0f * wiggle;
+ sReelLinePos[LINE_SEG_COUNT - 1].y += sLureLineSegPosDelta.y;
+ sLurePos.y += sLureLineSegPosDelta.y;
}
} else if (CHECK_BTN_ALL(input->cur.button, BTN_A)) {
spDC = 0x500;
- D_80B7E134 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI;
+ sLureWiggleRotYTarget = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI;
sLureRot.x = 0.0f;
- D_80B7E10C = 0.5f;
- if (D_80B7E0B6 == 2) {
- D_80B7E128.y = 0.2f;
- sReelLinePos[LINE_SEG_COUNT - 1].y += D_80B7E128.y;
- sLurePos.y += D_80B7E128.y;
+ sLureRotXTarget = 0.5f;
+ if (sLureEquipped == FS_LURE_SINKING) {
+ sLureLineSegPosDelta.y = 0.2f;
+ sReelLinePos[LINE_SEG_COUNT - 1].y += sLureLineSegPosDelta.y;
+ sLurePos.y += sLureLineSegPosDelta.y;
}
}
} else {
- if (D_80B7E144 > 150.0f) {
+ if (sRodLineSpooled > 150.0f) {
sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI;
- D_80B7E134 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI;
- D_80B7E144 += 2.0f;
+ sLureWiggleRotYTarget = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI;
+ sRodLineSpooled += 2.0f;
}
}
} else {
- spE4 = ((sqrtf(spC8) - 920.0f) * 0.11f) + WATER_SURFACE_Y(play);
+ spE4 = ((sqrtf(lureXZLen) - 920.0f) * 0.11f) + WATER_SURFACE_Y(play);
if (sLurePos.y <= spE4) {
sLurePos.y = spE4;
spDC = 0x500;
- D_80B7E134 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI;
+ sLureWiggleRotYTarget = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI;
sLureRot.x = 0.0f;
+ // lure hopping on land
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
- D_80B7E144 += 6.0f;
- Sfx_PlaySfxAtPos(&D_80B7AF94, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_SAND);
+ sRodLineSpooled += 6.0f;
+ Sfx_PlaySfxAtPos(&sSoundPos, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_SAND);
}
} else {
- if (D_80B7E144 > 150.0f) {
+ if (sRodLineSpooled > 150.0f) {
sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI;
- D_80B7E134 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI;
- D_80B7E144 += 2.0f;
+ sLureWiggleRotYTarget = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI;
+ sRodLineSpooled += 2.0f;
}
}
}
- Math_ApproachZeroF(&D_80B7E138, 1.0f, 0.3f);
- Math_ApproachS(&D_80B7E13C, (D_80B7E134 * 32768.0f) / M_PI, 3, spDC);
+ Math_ApproachZeroF(&sLureWigglePosY, 1.0f, 0.3f);
+ Math_ApproachS(&sLureWiggleRotY, (sLureWiggleRotYTarget * 32768.0f) / M_PI, 3, spDC);
- sLureRot.y = BINANG_TO_RAD_ALT(D_80B7E13C);
+ sLureRot.y = BINANG_TO_RAD_ALT(sLureWiggleRotY);
sp90.x = 0.0f;
sp90.y = 0.0f;
- sp90.z = D_80B7E138;
+ sp90.z = sLureWigglePosY;
Matrix_RotateY(sLureRot.y, MTXMODE_NEW);
- if (D_80B7E0B6 == 2) {
+ if (sLureEquipped == FS_LURE_SINKING) {
Matrix_MultVec3f(&sp90, &sp64);
- D_80B7E128.x = sp64.x;
- D_80B7E128.z = sp64.z;
+ sLureLineSegPosDelta.x = sp64.x;
+ sLureLineSegPosDelta.z = sp64.z;
phi_f0 = 10.0f;
} else {
- Matrix_MultVec3f(&sp90, &D_80B7E128);
+ Matrix_MultVec3f(&sp90, &sLureLineSegPosDelta);
phi_f0 = 0.0f;
}
- D_80B7E104 = 0.0f;
+ sLure1Rotate = 0.0f;
- if ((D_80B7E0B6 == 1) && CHECK_BTN_ALL(input->cur.button, BTN_A)) {
- D_80B7E128.y = -2.0f;
+ if ((sLureEquipped == FS_LURE_UNK) && CHECK_BTN_ALL(input->cur.button, BTN_A)) {
+ sLureLineSegPosDelta.y = -2.0f;
- if ((D_80B7E0AE & 1) != 0) {
- D_80B7E104 = 0.5f;
+ if ((sLureTimer & 1) != 0) {
+ sLure1Rotate = 0.5f;
} else {
- D_80B7E104 = -0.5f;
+ sLure1Rotate = -0.5f;
}
} else if (sReelLinePos[LINE_SEG_COUNT - 1].y < (WATER_SURFACE_Y(play) + phi_f0)) {
- if (D_80B7E0B6 == 2) {
+ if (sLureEquipped == FS_LURE_SINKING) {
sp58 = this->actor.world.pos;
this->actor.prevPos = this->actor.world.pos = sLurePos;
Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 30.0f,
UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_6);
this->actor.world.pos = sp58;
- D_80B7E128.y += -0.5f;
- if (D_80B7E128.y < -1.0f) {
- D_80B7E128.y = -1.0f;
+ sLureLineSegPosDelta.y += -0.5f;
+ if (sLureLineSegPosDelta.y < -1.0f) {
+ sLureLineSegPosDelta.y = -1.0f;
}
if (sLurePos.y < (this->actor.floorHeight + 5.0f)) {
sReelLinePos[LINE_SEG_COUNT - 1].y = sLurePos.y = this->actor.floorHeight + 5.0f;
- D_80B7E128.y = 0.0f;
+ sLureLineSegPosDelta.y = 0.0f;
} else {
- D_80B7E120 = 1;
+ sWiggleAttraction = 1;
}
} else {
- D_80B7E128.y = fabsf(sReelLinePos[LINE_SEG_COUNT - 1].y - WATER_SURFACE_Y(play)) * 0.2f;
- if (D_80B7E128.y > 1.5f) {
- D_80B7E128.y = 1.5f;
+ sLureLineSegPosDelta.y = fabsf(sReelLinePos[LINE_SEG_COUNT - 1].y - WATER_SURFACE_Y(play)) * 0.2f;
+ if (sLureLineSegPosDelta.y > 1.5f) {
+ sLureLineSegPosDelta.y = 1.5f;
}
}
}
- sReelLinePos[LINE_SEG_COUNT - 1].x += D_80B7E128.x;
- sReelLinePos[LINE_SEG_COUNT - 1].y += D_80B7E128.y;
- sReelLinePos[LINE_SEG_COUNT - 1].z += D_80B7E128.z;
+ sReelLinePos[LINE_SEG_COUNT - 1].x += sLureLineSegPosDelta.x;
+ sReelLinePos[LINE_SEG_COUNT - 1].y += sLureLineSegPosDelta.y;
+ sReelLinePos[LINE_SEG_COUNT - 1].z += sLureLineSegPosDelta.z;
if (sReelLinePos[LINE_SEG_COUNT - 1].y > (spE4 + 6.0f)) {
sReelLinePos[LINE_SEG_COUNT - 1].y -= 5.0f;
}
- D_80B7E0E8.x = D_80B7E0E8.y = D_80B7E0E8.z = D_80B7E0F8.y = 0.0f;
+ sLurePosDelta.x = sLurePosDelta.y = sLurePosDelta.z = sLureCastDelta.y = 0.0f;
if (CHECK_BTN_ALL(input->cur.button, BTN_A)) {
if (CHECK_BTN_ALL(input->cur.button, BTN_R)) {
- D_80B7E144 += 1.5f;
+ sRodLineSpooled += 1.5f;
Sfx_PlaySfxCentered(NA_SE_IT_FISHING_REEL_HIGH - SFX_FLAG);
- Math_ApproachF(&D_80B7E154, 1000.0f, 1.0f, 2.0f);
+ Math_ApproachF(&sReelLinePosStep, 1000.0f, 1.0f, 2.0f);
} else {
- D_80B7E144 += D_80B7E11C;
+ sRodLineSpooled += sRodReelingSpeed;
Sfx_PlaySfxCentered(NA_SE_IT_FISHING_REEL_SLOW - SFX_FLAG);
- Math_ApproachF(&D_80B7E154, 1000.0f, 1.0f, 0.2f);
+ Math_ApproachF(&sReelLinePosStep, 1000.0f, 1.0f, 0.2f);
}
if (sReelLinePos[LINE_SEG_COUNT - 1].y > (WATER_SURFACE_Y(play) + 4.0f)) {
@@ -2578,31 +2593,31 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) {
Math_ApproachF(&D_80B7E148, 2.0f, 1.0f, 0.2f);
}
- Math_ApproachF(&sLurePos.x, sReelLinePos[LINE_SEG_COUNT - 1].x, 1.0f, D_80B7E154);
- Math_ApproachF(&sLurePos.y, sReelLinePos[LINE_SEG_COUNT - 1].y, 1.0f, D_80B7E154);
- Math_ApproachF(&sLurePos.z, sReelLinePos[LINE_SEG_COUNT - 1].z, 1.0f, D_80B7E154);
+ Math_ApproachF(&sLurePos.x, sReelLinePos[LINE_SEG_COUNT - 1].x, 1.0f, sReelLinePosStep);
+ Math_ApproachF(&sLurePos.y, sReelLinePos[LINE_SEG_COUNT - 1].y, 1.0f, sReelLinePosStep);
+ Math_ApproachF(&sLurePos.z, sReelLinePos[LINE_SEG_COUNT - 1].z, 1.0f, sReelLinePosStep);
- if (D_80B7E138 > 1.0f) {
- Math_ApproachF(&D_80B7E154, 1000.0f, 1.0f, 1.0f);
+ if (sLureWigglePosY > 1.0f) {
+ Math_ApproachF(&sReelLinePosStep, 1000.0f, 1.0f, 1.0f);
}
- Math_ApproachF(&D_80B7E154, 1000.0f, 1.0f, 0.1f);
+ Math_ApproachF(&sReelLinePosStep, 1000.0f, 1.0f, 0.1f);
- if (D_80B7E144 >= 195.0f) {
- D_80B7E144 = 195.0f;
- D_80B7A694 = 0;
+ if (sRodLineSpooled >= 195.0f) {
+ sRodLineSpooled = 195.0f;
+ sRodCastState = 0;
D_80B7E148 = 520.0f;
- D_80B7A6CC = 3;
+ sFishingPlayerCinematicState = 3;
}
if ((sLurePos.y <= (WATER_SURFACE_Y(play) + 4.0f)) && (sLurePos.y >= (WATER_SURFACE_Y(play) - 4.0f))) {
- phi_v0 = 63;
- if (CHECK_BTN_ALL(input->cur.button, BTN_A) || (D_80B7E138 > 1.0f)) {
- phi_v0 = 1;
+ timer = 63;
+ if (CHECK_BTN_ALL(input->cur.button, BTN_A) || (sLureWigglePosY > 1.0f)) {
+ timer = 1;
}
- if ((D_80B7E0AE & phi_v0) == 0) {
+ if ((sLureTimer & timer) == 0) {
spA8 = sLurePos;
spA8.y = WATER_SURFACE_Y(play);
Fishing_SpawnRipple(NULL, play->specialEffects, &spA8, 30.0f, 300.0f, 150, 90);
@@ -2613,20 +2628,20 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) {
case 4:
if (this->unk_157 != 0) {
this->unk_157--;
- D_80B7E144 += D_80B7E11C;
+ sRodLineSpooled += sRodReelingSpeed;
}
if (CHECK_BTN_ALL(input->cur.button, BTN_A)) {
if ((SQ(sLurePos.x) + SQ(sLurePos.z)) > SQ(920.0f)) {
- D_80B7E144 += (1.0f + (KREG(65) * 0.1f));
+ sRodLineSpooled += (1.0f + (KREG(65) * 0.1f));
} else {
- D_80B7E144 += D_80B7E11C;
+ sRodLineSpooled += sRodReelingSpeed;
}
Sfx_PlaySfxCentered(NA_SE_IT_FISHING_REEL_SLOW - SFX_FLAG);
}
- if ((D_80B7E0AE & 0x1F) == 0) {
- if ((D_80B7E124 != 0) || (D_80B7E0B6 != 2)) {
+ if ((sLureTimer & 0x1F) == 0) {
+ if (sLineHooked || (sLureEquipped != FS_LURE_SINKING)) {
D_80B7A6A4 = 5;
}
}
@@ -2635,7 +2650,7 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) {
break;
case 5:
- D_80B7E14C = 0.0005000001f;
+ sFishingLineScale = 0.0005000001f;
sReelLinePos[LINE_SEG_COUNT - 1].x = sLurePos.x;
sReelLinePos[LINE_SEG_COUNT - 1].y = sLurePos.y;
sReelLinePos[LINE_SEG_COUNT - 1].z = sLurePos.z;
@@ -2644,7 +2659,7 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) {
}
}
-s32 func_80B70A2C(Fishing* this, PlayState* play, u8 ignorePosCheck) {
+s32 Fishing_SplashBySize(Fishing* this, PlayState* play, u8 ignorePosCheck) {
s16 i;
s16 count;
f32 scale;
@@ -2658,9 +2673,9 @@ s32 func_80B70A2C(Fishing* this, PlayState* play, u8 ignorePosCheck) {
}
// Necessary to match
- if (this->unk_1AC) {}
+ if (this->fishLength) {}
- if (this->unk_1AC >= 40.0f) {
+ if (this->fishLength >= 40.0f) {
count = 40;
scale = 1.2f;
} else {
@@ -2690,12 +2705,12 @@ s32 func_80B70A2C(Fishing* this, PlayState* play, u8 ignorePosCheck) {
Fishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &pos, 100.0f, 800.0f, 150, 90);
- this->unk_151 = 30;
+ this->lilyTimer = 30;
return true;
}
-void func_80B70CF0(Fishing* this, PlayState* play) {
+void Fishing_SplashBySize2(Fishing* this, PlayState* play) {
s16 count;
s16 i;
f32 scale;
@@ -2705,9 +2720,9 @@ void func_80B70CF0(Fishing* this, PlayState* play) {
f32 angle;
// Necessary to match
- if (this->unk_1AC) {}
+ if (this->fishLength) {}
- if (this->unk_1AC >= 45.0f) {
+ if (this->fishLength >= 45.0f) {
count = 30;
scale = 0.5f;
} else {
@@ -2734,86 +2749,86 @@ void func_80B70CF0(Fishing* this, PlayState* play) {
}
void func_80B70ED4(Fishing* this, Input* input) {
- Vec3f sp34;
+ Vec3f lineVec;
Vec3f sp28;
- f32 sp24;
+ f32 lineLengthSQ;
- sp34.x = sLurePos.x - this->actor.world.pos.x;
- sp34.y = sLurePos.y - this->actor.world.pos.y;
- sp34.z = sLurePos.z - this->actor.world.pos.z;
+ lineVec.x = sLurePos.x - this->actor.world.pos.x;
+ lineVec.y = sLurePos.y - this->actor.world.pos.y;
+ lineVec.z = sLurePos.z - this->actor.world.pos.z;
- sp24 = SQ(sp34.x) + SQ(sp34.y) + SQ(sp34.z);
+ lineLengthSQ = SQ(lineVec.x) + SQ(lineVec.y) + SQ(lineVec.z);
- if ((D_80B7A694 == 3) && (this->unk_1A2 == 0) && (D_80B7A68C == 0)) {
+ if ((sRodCastState == 3) && (this->unk_1A2 == 0) && !sIsOwnersHatHooked) {
Matrix_RotateY(BINANG_TO_RAD_ALT(-this->actor.shape.rot.y), MTXMODE_NEW);
- Matrix_MultVec3f(&sp34, &sp28);
-
- if ((sp28.z > 0.0f) || (this->unk_1AC < 40.0f)) {
- if ((this->unk_158 == 7) && (sp24 < SQ(200.0f))) {
- this->unk_158 = 4;
- this->unk_1B4 = sLurePos;
- this->unk_1B0 = 28672.0f;
- this->unk_188 = 5.0f;
+ Matrix_MultVec3f(&lineVec, &sp28);
+
+ if ((sp28.z > 0.0f) || (this->fishLength < 40.0f)) {
+ if ((this->fishState == 7) && (lineLengthSQ < SQ(200.0f))) {
+ this->fishState = 4;
+ this->fishTargetPos = sLurePos;
+ this->rotationStep = 28672.0f;
+ this->speedTarget = 5.0f;
} else {
- if ((CHECK_BTN_ALL(input->cur.button, BTN_A) || (D_80B7E138 > 1.0f)) && (sp24 < SQ(120.0f))) {
- this->unk_158 = 2;
+ if ((CHECK_BTN_ALL(input->cur.button, BTN_A) || (sLureWigglePosY > 1.0f)) && (lineLengthSQ < SQ(120.0f))) {
+ this->fishState = 2;
this->unk_15E = 0;
- this->unk_17A[0] = 0;
- this->unk_17A[2] = (s16)Rand_ZeroFloat(100.0f) + 100;
- this->unk_1A8 = sFishInits[this->actor.params - 100].unk_0C;
- this->unk_1B0 = 0.0f;
+ this->timerArray[0] = 0;
+ this->timerArray[2] = (s16)Rand_ZeroFloat(100.0f) + 100;
+ this->perception = sFishInits[this->actor.params - EN_FISH_PARAM].perception;
+ this->rotationStep = 0.0f;
}
- if ((this->unk_17A[1] == 0) && (sp24 < SQ(70.0f))) {
- this->unk_158 = 2;
+ if ((this->timerArray[1] == 0) && (lineLengthSQ < SQ(70.0f))) {
+ this->fishState = 2;
this->unk_15E = 0;
- this->unk_17A[0] = 0;
- this->unk_17A[2] = (s16)Rand_ZeroFloat(100.0f) + 100;
- this->unk_1A8 = sFishInits[this->actor.params - 100].unk_0C;
- this->unk_1B0 = 0.0f;
+ this->timerArray[0] = 0;
+ this->timerArray[2] = (s16)Rand_ZeroFloat(100.0f) + 100;
+ this->perception = sFishInits[this->actor.params - EN_FISH_PARAM].perception;
+ this->rotationStep = 0.0f;
}
}
}
- } else if ((D_80B7A694 == 4) && (D_80B7E124 != 0) && (sp24 < SQ(100.0f)) && (this->unk_158 >= 10)) {
- this->unk_15A = 0;
- this->unk_158 = 1;
+ } else if ((sRodCastState == 4) && sLineHooked && (lineLengthSQ < SQ(100.0f)) && (this->fishState >= 10)) {
+ this->fishStateNext = 0;
+ this->fishState = 1;
this->unk_1A4 = 1000;
this->unk_1A2 = 100;
- this->unk_17A[1] = 50;
+ this->timerArray[1] = 50;
}
- if ((D_80B7E0B6 != 2) && (D_80B7E114 != 0) && (this->unk_1AC > 60.0f) && (sp24 < SQ(30.0f)) &&
- (this->unk_158 >= 10)) {
- this->unk_15A = 0;
- this->unk_158 = 1;
+ if ((sLureEquipped != FS_LURE_SINKING) && (D_80B7E114 != 0) && (this->fishLength > 60.0f) &&
+ (lineLengthSQ < SQ(30.0f)) && (this->fishState >= 10)) {
+ this->fishStateNext = 0;
+ this->fishState = 1;
this->unk_1A4 = 1000;
this->unk_1A2 = 100;
- this->unk_17A[1] = 50;
+ this->timerArray[1] = 50;
}
}
-void func_80B71278(Fishing* this, u8 arg1) {
+void Fishing_FishLeapSfx(Fishing* this, u8 outOfWater) {
s16 sfxId;
- u8 temp;
+ u8 length;
- if (this->unk_150 == 0) {
- temp = this->unk_1AC;
+ if (this->isLoach == 0) {
+ length = this->fishLength;
} else {
- temp = 2.0f * this->unk_1AC;
+ length = 2.0f * this->fishLength;
}
- if (arg1 == 0) {
- if (temp >= 50) {
+ if (outOfWater == false) {
+ if (length >= 50) {
sfxId = NA_SE_EV_DIVE_INTO_WATER;
- } else if (temp >= 40) {
+ } else if (length >= 40) {
sfxId = NA_SE_EV_BOMB_DROP_WATER;
} else {
sfxId = NA_SE_EV_BOMB_DROP_WATER;
}
} else {
- if (temp >= 50) {
+ if (length >= 50) {
sfxId = NA_SE_EV_JUMP_OUT_WATER;
- } else if (temp >= 40) {
+ } else if (length >= 40) {
sfxId = NA_SE_EV_OUT_OF_WATER;
} else {
sfxId = NA_SE_EV_OUT_OF_WATER;
@@ -2825,8 +2840,8 @@ void func_80B71278(Fishing* this, u8 arg1) {
void Fishing_HandleAquariumDialog(Fishing* this, PlayState* play) {
if (sLinkAge == LINK_AGE_CHILD) {
- if ((HIGH_SCORE(HS_FISHING) & 0x7F) != 0) {
- if (HIGH_SCORE(HS_FISHING) & 0x80) {
+ if ((HIGH_SCORE(HS_FISHING) & HS_FISH_LENGTH_CHILD) != 0) {
+ if (HIGH_SCORE(HS_FISHING) & HS_FISH_CHEAT_CHILD) {
this->actor.textId = 0x40B1;
} else {
this->actor.textId = 0x4089;
@@ -2835,8 +2850,8 @@ void Fishing_HandleAquariumDialog(Fishing* this, PlayState* play) {
this->actor.textId = 0x40AE;
}
} else {
- if ((HIGH_SCORE(HS_FISHING) & 0x7F000000) != 0) {
- if (HIGH_SCORE(HS_FISHING) & 0x80000000) {
+ if ((HIGH_SCORE(HS_FISHING) & HS_FISH_LENGTH_ADULT) != 0) {
+ if (HIGH_SCORE(HS_FISHING) & HS_FISH_CHEAT_ADULT) {
this->actor.textId = 0x40B1;
} else {
this->actor.textId = 0x4089;
@@ -2846,47 +2861,47 @@ void Fishing_HandleAquariumDialog(Fishing* this, PlayState* play) {
}
}
- if (this->unk_1D3 == 0) {
- if (this->unk_1D4 == 0) {
+ if (!this->isAquariumMessage) {
+ if (this->aquariumWaitTimer == 0) {
this->actor.flags |= ACTOR_FLAG_0;
if (Actor_ProcessTalkRequest(&this->actor, play)) {
- D_80B7A678 = D_80B7E078;
- this->unk_1D3 = 1;
+ sFishLengthToWeigh = sFishingRecordLength;
+ this->isAquariumMessage = true;
} else {
func_8002F2F4(&this->actor, play);
}
} else {
- this->unk_1D4--;
+ this->aquariumWaitTimer--;
this->actor.flags &= ~ACTOR_FLAG_0;
}
} else if (Actor_TextboxIsClosing(&this->actor, play)) {
- this->unk_1D3 = 0;
- this->unk_1D4 = 20;
+ this->isAquariumMessage = false;
+ this->aquariumWaitTimer = 20;
}
}
void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
s16 i;
- s16 sp134 = 10;
- f32 sp130;
- f32 sp12C;
- f32 sp128;
- f32 sp124;
+ s16 rotXYScale = 10;
+ f32 distX;
+ f32 distY;
+ f32 distZ;
+ f32 distToTarget;
f32 multiplier;
- f32 sp11C;
- f32 sp118;
- Vec3f sp10C;
- Vec3f sp100;
- s16 spFE;
- s16 spFC;
- s16 spFA;
- s16 phi_v0;
+ f32 chance;
+ f32 playerSpeedMod;
+ Vec3f multiVecSrc;
+ Vec3f targetPosOffset;
+ s16 rotXTarget;
+ s16 rotYtarget;
+ s16 rotZScale;
+ s16 timer;
s16 spF6;
- s16 spF4;
- s16 spF2;
- s16 spF0;
- s16 spEE;
+ s16 rotXScale;
+ s16 rotXStep;
+ s16 rotYScale;
+ s16 rotYStep;
Fishing* this = (Fishing*)thisx;
PlayState* play = play2;
Player* player = GET_PLAYER(play);
@@ -2894,47 +2909,47 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
f32 spD8;
f32 phi_f0;
f32 phi_f2;
- Vec3f spC4;
+ Vec3f bubblePos;
Vec3f spB8;
u8 phi_v0_2;
f32 temp_f0;
f32 temp;
s32 pad;
- f32 spA4;
- u16 spA2;
- u8 phi_a1;
+ f32 rumbleStrength;
+ u16 attempts;
+ u8 rumbleStrength8;
this->actor.uncullZoneForward = 700.0f;
this->actor.uncullZoneScale = 50.0f;
- if (this->unk_150 == 0) {
- sp118 = (player->actor.speed * 0.15f) + 0.25f;
+ if (this->isLoach == 0) {
+ playerSpeedMod = (player->actor.speed * 0.15f) + 0.25f;
} else {
- sp118 = (player->actor.speed * 0.3f) + 0.25f;
+ playerSpeedMod = (player->actor.speed * 0.3f) + 0.25f;
}
if ((D_80B7E0B0 != 0) || (sSubCamId != SUB_CAM_ID_DONE) ||
- ((player->actor.world.pos.z > 1150.0f) && (this->unk_158 != 100))) {
+ ((player->actor.world.pos.z > 1150.0f) && (this->fishState != 100))) {
this->actor.flags &= ~ACTOR_FLAG_0;
} else {
this->actor.flags |= ACTOR_FLAG_0;
- if (D_80B7A694 != 0) {
+ if (sRodCastState != 0) {
if (D_80B7E0B2 == 0) {
this->actor.focus.pos = sLurePos;
} else if (D_80B7E0B2 == 1) {
- D_80B7A6CC = 1;
+ sFishingPlayerCinematicState = 1;
D_80B7FED0 = 0.0f;
- D_80B7E088 = 2;
+ sLureCameraZoomLevel = 2;
}
}
this->actor.focus.pos = this->actor.world.pos;
}
- this->unk_15C++;
+ this->stateAndTimer++;
for (i = 0; i < 4; i++) {
- if (this->unk_17A[i] != 0) {
- this->unk_17A[i]--;
+ if (this->timerArray[i] != 0) {
+ this->timerArray[i]--;
}
}
@@ -2946,18 +2961,18 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
this->unk_1A2--;
}
- if (this->unk_1A0 != 0) {
- this->unk_1A0--;
+ if (this->bumpTimer != 0) {
+ this->bumpTimer--;
}
- if (this->unk_151 != 0) {
- this->unk_151--;
+ if (this->lilyTimer != 0) {
+ this->lilyTimer--;
}
- Math_ApproachF(&this->unk_198, this->unk_190, 1.0f, 0.2f);
+ Math_ApproachF(&this->fishLimbRotPhaseStep, this->unk_190, 1.0f, 0.2f);
- if (this->unk_158 == 6) {
- Math_ApproachF(&this->unk_19C, this->unk_194, 0.2f, 200.0f);
+ if (this->fishState == 6) {
+ Math_ApproachF(&this->fishLimbRotPhaseMag, this->unk_194, 0.2f, 200.0f);
} else {
phi_f0 = 1.0f;
phi_f2 = 1.0f;
@@ -2965,62 +2980,62 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
phi_f0 = (KREG(64) * 0.1f) + 1.5f;
phi_f2 = 3.0f;
}
- Math_ApproachF(&this->unk_19C, this->unk_194 * phi_f0, 1.0f, 500.0f * phi_f2);
+ Math_ApproachF(&this->fishLimbRotPhaseMag, this->unk_194 * phi_f0, 1.0f, 500.0f * phi_f2);
}
- Math_ApproachS(&this->unk_170, 0, 5, 0x1F4);
+ Math_ApproachS(&this->fishLimbDRotZDelta, 0, 5, 500);
- if (this->unk_150 == 0) {
- Actor_SetScale(&this->actor, this->unk_1AC * 15.0f * 0.00001f);
+ if (this->isLoach == 0) {
+ Actor_SetScale(&this->actor, this->fishLength * 15.0f * 0.00001f);
- this->unk_18C += this->unk_198;
+ this->fishLimbRotPhase += this->fishLimbRotPhaseStep;
- temp = cosf(this->unk_18C);
- this->unk_16C = this->unk_16E + (s16)(temp * this->unk_19C);
+ temp = cosf(this->fishLimbRotPhase);
+ this->fishLimb23RotYDelta = this->unk_16E + (s16)(temp * this->fishLimbRotPhaseMag);
- temp = cosf(this->unk_18C + -1.2f);
- this->unk_176 = this->unk_16E + (s16)(temp * this->unk_19C * 1.6f);
+ temp = cosf(this->fishLimbRotPhase + -1.2f);
+ this->fishLimb4RotYDelta = this->unk_16E + (s16)(temp * this->fishLimbRotPhaseMag * 1.6f);
} else {
- Actor_SetScale(&this->actor, this->unk_1AC * 65.0f * 0.000001f);
+ Actor_SetScale(&this->actor, this->fishLength * 65.0f * 0.000001f);
this->actor.scale.x = this->actor.scale.z * 1.1f;
this->actor.scale.y = this->actor.scale.z * 1.1f;
- this->unk_18C += this->unk_198 * 0.8f;
+ this->fishLimbRotPhase += this->fishLimbRotPhaseStep * 0.8f;
for (i = 0; i < 3; i++) {
- temp = cosf(this->unk_18C + (i * 2.1f));
- this->unk_1CC[i] = this->unk_16E + (s16)(temp * this->unk_19C * 2.0f);
+ temp = cosf(this->fishLimbRotPhase + (i * 2.1f));
+ this->loachRotYDelta[i] = this->unk_16E + (s16)(temp * this->fishLimbRotPhaseMag * 2.0f);
}
- temp = cosf(this->unk_18C + 0.4f);
- this->unk_16C = (this->unk_19C * temp * 2.0f) * 0.6f;
+ temp = cosf(this->fishLimbRotPhase + 0.4f);
+ this->fishLimb23RotYDelta = (this->fishLimbRotPhaseMag * temp * 2.0f) * 0.6f;
}
- sp130 = this->unk_1B4.x - this->actor.world.pos.x;
- sp12C = this->unk_1B4.y - this->actor.world.pos.y;
- sp128 = this->unk_1B4.z - this->actor.world.pos.z;
+ distX = this->fishTargetPos.x - this->actor.world.pos.x;
+ distY = this->fishTargetPos.y - this->actor.world.pos.y;
+ distZ = this->fishTargetPos.z - this->actor.world.pos.z;
- spFC = Math_Atan2S(sp128, sp130);
- sp124 = sqrtf(SQ(sp130) + SQ(sp128));
+ rotYtarget = Math_Atan2S(distZ, distX);
+ distToTarget = sqrtf(SQ(distX) + SQ(distZ));
- spFE = Math_Atan2S(sp124, sp12C);
- sp124 = sqrtf(SQ(sp130) + SQ(sp128) + SQ(sp12C));
+ rotXTarget = Math_Atan2S(distToTarget, distY);
+ distToTarget = sqrtf(SQ(distX) + SQ(distZ) + SQ(distY));
- if ((this->unk_1A0 != 0) && (this->unk_158 != 2) && (this->unk_158 != 3) && (this->unk_158 != 4)) {
- if ((this->unk_15C & 0x40) != 0) {
- spFC += 0x4000;
+ if ((this->bumpTimer != 0) && (this->fishState != 2) && (this->fishState != 3) && (this->fishState != 4)) {
+ if ((this->stateAndTimer & 0x40) != 0) {
+ rotYtarget += 0x4000;
} else {
- spFC -= 0x4000;
+ rotYtarget -= 0x4000;
}
- if (((this->unk_15C + 0x20) & 0x40) != 0) {
- spFE += 0x2000;
+ if (((this->stateAndTimer + 0x20) & 0x40) != 0) {
+ rotXTarget += 0x2000;
} else {
- spFE -= 0x2000;
+ rotXTarget -= 0x2000;
}
}
- switch (this->unk_158) {
+ switch (this->fishState) {
case 100:
Fishing_HandleAquariumDialog(this, play);
@@ -3031,109 +3046,109 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
(s16)this->actor.world.pos.y + 20.0f, (s16)this->actor.world.pos.z - 50.0f, 255,
255, 255, 255);
- this->unk_1AC = D_80B7E078;
- sp100.y = (f32)Math_SinS(play->gameplayFrames * 300) * 1;
- sp100.z = (f32)Math_SinS(play->gameplayFrames * 230) * 2;
+ this->fishLength = sFishingRecordLength;
+ targetPosOffset.y = (f32)Math_SinS(play->gameplayFrames * 300) * 1;
+ targetPosOffset.z = (f32)Math_SinS(play->gameplayFrames * 230) * 2;
this->actor.world.pos.x = 130.0f;
- this->actor.world.pos.y = 55.0f + sp100.y;
- this->actor.world.pos.z = 1300.0f + sp100.z;
+ this->actor.world.pos.y = 55.0f + targetPosOffset.y;
+ this->actor.world.pos.z = 1300.0f + targetPosOffset.z;
this->actor.shape.rot.y = -0x8000;
if ((this->actor.projectedPos.z < 200.0f) && (this->actor.projectedPos.z > 0.0f)) {
- spC4.x = Rand_CenteredFloat(5.0f) + 130.0f;
- spC4.y = 40.0f;
- spC4.z = Rand_CenteredFloat(5.0f) + 1280.0f;
- Fishing_SpawnBubble(NULL, play->specialEffects, &spC4, Rand_ZeroFloat(0.02f) + 0.03f, 1);
+ bubblePos.x = Rand_CenteredFloat(5.0f) + 130.0f;
+ bubblePos.y = 40.0f;
+ bubblePos.z = Rand_CenteredFloat(5.0f) + 1280.0f;
+ Fishing_SpawnBubble(NULL, play->specialEffects, &bubblePos, Rand_ZeroFloat(0.02f) + 0.03f, 1);
}
- Math_ApproachS(&this->unk_172, (Math_SinS(this->unk_15C * 0x800) * 2500.0f) + 2500.0f, 2, 0x7D0);
- Math_ApproachS(&this->unk_174, Math_SinS(this->unk_15C * 0xA00) * 1500.0f, 2, 0x7D0);
+ Math_ApproachS(&this->fishLimbEFRotYDelta, (Math_SinS(this->stateAndTimer * 0x800) * 2500.0f) + 2500.0f, 2, 0x7D0);
+ Math_ApproachS(&this->fishLimb89RotYDelta, Math_SinS(this->stateAndTimer * 0xA00) * 1500.0f, 2, 0x7D0);
this->unk_190 = 0.3f;
this->unk_194 = 1000.0f / 3.0f;
return;
case 10:
- this->unk_1B4 = this->actor.home.pos;
+ this->fishTargetPos = this->actor.home.pos;
Math_ApproachF(&this->actor.speed, 2.0f, 1.0f, 0.5f);
- Math_ApproachF(&this->unk_1B0, 4096.0f, 1.0f, 256.0f);
+ Math_ApproachF(&this->rotationStep, 4096.0f, 1.0f, 256.0f);
- if (sp124 < 40.0f) {
- this->unk_158 = 11;
+ if (distToTarget < 40.0f) {
+ this->fishState = 11;
this->unk_190 = 0.4f;
this->unk_194 = 500.0f;
}
func_80B70ED4(this, input);
- if (this->actor.xzDistToPlayer < (250.0f * sp118)) {
- this->unk_15A = this->unk_158 = 0;
+ if (this->actor.xzDistToPlayer < (250.0f * playerSpeedMod)) {
+ this->fishStateNext = this->fishState = 0;
this->unk_1A4 = 1000;
this->unk_1A2 = 200;
- this->unk_17A[1] = 50;
+ this->timerArray[1] = 50;
}
break;
case 11:
- this->unk_1B4 = this->actor.home.pos;
+ this->fishTargetPos = this->actor.home.pos;
Math_ApproachF(&this->actor.speed, 0.0f, 1.0f, 0.05f);
- Math_ApproachF(&this->unk_1B0, 0.0f, 1.0f, 256.0f);
+ Math_ApproachF(&this->rotationStep, 0.0f, 1.0f, 256.0f);
- if (sp124 >= 40.0f) {
- this->unk_158 = 10;
+ if (distToTarget >= 40.0f) {
+ this->fishState = 10;
this->unk_190 = 1.0f;
this->unk_194 = 2000.0f;
}
func_80B70ED4(this, input);
- if (this->actor.xzDistToPlayer < (250.0f * sp118)) {
- this->unk_15A = this->unk_158 = 0;
+ if (this->actor.xzDistToPlayer < (250.0f * playerSpeedMod)) {
+ this->fishStateNext = this->fishState = 0;
this->unk_1A4 = 1000;
this->unk_1A2 = 200;
- this->unk_17A[1] = 50;
+ this->timerArray[1] = 50;
}
if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) {
if ((gSaveContext.save.dayTime >= CLOCK_TIME(18, 0)) &&
(gSaveContext.save.dayTime <= CLOCK_TIME(18, 0) + 27)) {
- this->unk_158 = 7;
- this->unk_17A[3] = (s16)Rand_ZeroFloat(150.0f) + 200;
+ this->fishState = 7;
+ this->timerArray[3] = (s16)Rand_ZeroFloat(150.0f) + 200;
}
if ((gSaveContext.save.dayTime >= CLOCK_TIME(5, 30) - 1) &&
(gSaveContext.save.dayTime < CLOCK_TIME(5, 30) + 27)) {
- this->unk_158 = 7;
- this->unk_17A[3] = (s16)Rand_ZeroFloat(150.0f) + 200;
+ this->fishState = 7;
+ this->timerArray[3] = (s16)Rand_ZeroFloat(150.0f) + 200;
}
}
if (KREG(15) != 0) {
KREG(15) = 0;
- this->unk_158 = 7;
- this->unk_17A[3] = (s16)Rand_ZeroFloat(150.0f) + 2000;
+ this->fishState = 7;
+ this->timerArray[3] = (s16)Rand_ZeroFloat(150.0f) + 2000;
}
break;
case 0:
Math_ApproachF(&this->actor.speed, 1.0f, 1.0f, 0.05f);
- Math_ApproachF(&this->unk_1B0, 0.0f, 1.0f, 256.0f);
+ Math_ApproachF(&this->rotationStep, 0.0f, 1.0f, 256.0f);
- if (this->unk_17A[0] == 0) {
+ if (this->timerArray[0] == 0) {
if (this->unk_1A4 == 0) {
- this->unk_158 = this->unk_15A = 10;
+ this->fishState = this->fishStateNext = 10;
} else {
- this->unk_158 = 1;
- this->unk_17A[0] = (s16)Rand_ZeroFloat(30.0f) + 10;
- this->unk_1B4.x = Rand_CenteredFloat(300.0f);
- this->unk_1B4.y = (WATER_SURFACE_Y(play) - 50.0f) - Rand_ZeroFloat(50.0f);
- this->unk_1B4.z = Rand_CenteredFloat(300.0f);
+ this->fishState = 1;
+ this->timerArray[0] = (s16)Rand_ZeroFloat(30.0f) + 10;
+ this->fishTargetPos.x = Rand_CenteredFloat(300.0f);
+ this->fishTargetPos.y = (WATER_SURFACE_Y(play) - 50.0f) - Rand_ZeroFloat(50.0f);
+ this->fishTargetPos.z = Rand_CenteredFloat(300.0f);
this->unk_190 = 1.0f;
this->unk_194 = 2000.0f;
}
}
- if (D_80B7E0B6 == 2) {
+ if (sLureEquipped == FS_LURE_SINKING) {
func_80B70ED4(this, input);
} else {
this->actor.flags &= ~ACTOR_FLAG_0;
@@ -3141,36 +3156,36 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
break;
case 1:
- if (this->unk_150 == 1) {
- this->unk_158 = -1;
+ if (this->isLoach == 1) {
+ this->fishState = -1;
this->unk_1A4 = 20000;
this->unk_1A2 = 20000;
- this->unk_1B4.x = 0.0f;
- this->unk_1B4.y = -140.0f;
- this->unk_1B4.z = 0.0f;
+ this->fishTargetPos.x = 0.0f;
+ this->fishTargetPos.y = -140.0f;
+ this->fishTargetPos.z = 0.0f;
} else {
- Math_ApproachF(&this->unk_1B0, 4096.0f, 1.0f, 256.0f);
+ Math_ApproachF(&this->rotationStep, 4096.0f, 1.0f, 256.0f);
- if ((this->actor.xzDistToPlayer < (250.0f * sp118)) || (this->unk_17A[1] != 0)) {
- Math_ApproachF(&this->unk_1B0, 8192.0f, 1.0f, 768.0f);
+ if ((this->actor.xzDistToPlayer < (250.0f * playerSpeedMod)) || (this->timerArray[1] != 0)) {
+ Math_ApproachF(&this->rotationStep, 8192.0f, 1.0f, 768.0f);
Math_ApproachF(&this->actor.speed, 4.2f, 1.0f, 0.75);
this->unk_190 = 1.2f;
this->unk_194 = 4000.0f;
- this->unk_17A[0] = 20;
+ this->timerArray[0] = 20;
} else {
this->unk_190 = 1.0f;
this->unk_194 = 2000.0f;
Math_ApproachF(&this->actor.speed, 1.5f, 1.0f, 0.1f);
}
- if ((this->unk_17A[0] == 0) || (sp124 < 50.0f)) {
- this->unk_158 = 0;
- this->unk_17A[0] = (s16)Rand_ZeroFloat(30.0f) + 3;
+ if ((this->timerArray[0] == 0) || (distToTarget < 50.0f)) {
+ this->fishState = 0;
+ this->timerArray[0] = (s16)Rand_ZeroFloat(30.0f) + 3;
this->unk_190 = 1.0f;
this->unk_194 = 500.0f;
}
- if (D_80B7E0B6 == 2) {
+ if (sLureEquipped == FS_LURE_SINKING) {
func_80B70ED4(this, input);
} else {
this->actor.flags &= ~ACTOR_FLAG_0;
@@ -3178,57 +3193,57 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
}
break;
- case -1:
- Math_ApproachS(&this->unk_166, 0, 0x14, 0x20);
+ case -1: // loach state 1
+ Math_ApproachS(&this->rotationTarget.x, 0, 0x14, 0x20);
- if ((this->actor.xzDistToPlayer < (250.0f * sp118)) || (this->unk_17A[1] != 0)) {
+ if ((this->actor.xzDistToPlayer < (250.0f * playerSpeedMod)) || (this->timerArray[1] != 0)) {
Math_ApproachF(&this->actor.speed, 3.0f, 1.0f, 0.75);
this->unk_190 = 1.0f;
- this->unk_17A[0] = 20;
+ this->timerArray[0] = 20;
this->unk_194 = 4000.0f;
- Math_ApproachF(&this->unk_1B0, 4096.0f, 1.0f, 256.0f);
+ Math_ApproachF(&this->rotationStep, 4096.0f, 1.0f, 256.0f);
if ((play->gameplayFrames % 32) == 0) {
- this->unk_1B4.x = Rand_CenteredFloat(600.0f);
- this->unk_1B4.z = Rand_CenteredFloat(600.0f);
- this->unk_1B4.y = -120.0f;
+ this->fishTargetPos.x = Rand_CenteredFloat(600.0f);
+ this->fishTargetPos.z = Rand_CenteredFloat(600.0f);
+ this->fishTargetPos.y = -120.0f;
}
- } else if (sp124 > 50.0f) {
+ } else if (distToTarget > 50.0f) {
this->unk_190 = 0.8f;
this->unk_194 = 1500.0f;
Math_ApproachF(&this->actor.speed, 1.0f, 1.0f, 0.1f);
- Math_ApproachF(&this->unk_1B0, 2048.0f, 1.0f, 128.0f);
+ Math_ApproachF(&this->rotationStep, 2048.0f, 1.0f, 128.0f);
} else {
this->unk_190 = 0.4f;
this->unk_194 = 500.0f;
Math_ApproachZeroF(&this->actor.speed, 1.0f, 0.02f);
- Math_ApproachF(&this->unk_1B0, 0.0f, 1.0f, 256.0f);
+ Math_ApproachF(&this->rotationStep, 0.0f, 1.0f, 256.0f);
}
if (this->unk_1A4 == 0) {
- this->unk_158 = 10;
- this->unk_15A = 10;
+ this->fishState = 10;
+ this->fishStateNext = 10;
} else if ((KREG(2) != 0) || (((this->unk_1A4 & 0x7FF) == 0) && (this->unk_1A4 < 15000))) {
KREG(2) = 0;
- this->unk_158 = -2;
+ this->fishState = -2;
this->actor.world.rot.x = this->actor.shape.rot.x = 0;
- this->unk_1B4.y = WATER_SURFACE_Y(play) + 10.0f;
- this->unk_1B4.x = Rand_ZeroFloat(50.0f);
- this->unk_1B4.z = Rand_ZeroFloat(50.0f);
+ this->fishTargetPos.y = WATER_SURFACE_Y(play) + 10.0f;
+ this->fishTargetPos.x = Rand_ZeroFloat(50.0f);
+ this->fishTargetPos.z = Rand_ZeroFloat(50.0f);
}
this->actor.flags &= ~ACTOR_FLAG_0;
break;
case -2:
- if ((this->actor.xzDistToPlayer < (250.0f * sp118)) || (this->unk_17A[1] != 0)) {
- this->unk_158 = -1;
- this->unk_1B4.y = -120.0f;
+ if ((this->actor.xzDistToPlayer < (250.0f * playerSpeedMod)) || (this->timerArray[1] != 0)) {
+ this->fishState = -1;
+ this->fishTargetPos.y = -120.0f;
} else {
this->unk_190 = 0.6f;
this->unk_194 = 1000.0f;
- Math_ApproachS(&this->unk_166, -0x1000, 0x14, 0x100);
+ Math_ApproachS(&this->rotationTarget.x, -0x1000, 0x14, 0x100);
if (this->actor.world.pos.y < (WATER_SURFACE_Y(play) - 20.0f)) {
Math_ApproachF(&this->actor.speed, 0.5f, 1.0f, 0.1f);
@@ -3236,11 +3251,11 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
Math_ApproachZeroF(&this->actor.speed, 1.0f, 0.01f);
if ((this->actor.speed == 0.0f) || (this->actor.world.pos.y > (WATER_SURFACE_Y(play) - 5.0f))) {
- this->unk_1B4.x = Rand_ZeroFloat(300.0f);
- this->unk_1B4.z = Rand_ZeroFloat(300.0f);
- this->unk_1B4.y = this->actor.floorHeight + 10.0f;
- this->unk_158 = -25;
- this->unk_1B0 = 0.0f;
+ this->fishTargetPos.x = Rand_ZeroFloat(300.0f);
+ this->fishTargetPos.z = Rand_ZeroFloat(300.0f);
+ this->fishTargetPos.y = this->actor.floorHeight + 10.0f;
+ this->fishState = -25;
+ this->rotationStep = 0.0f;
spB8 = this->fishMouthPos;
spB8.y = WATER_SURFACE_Y(play);
@@ -3254,99 +3269,99 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
}
}
- Math_ApproachF(&this->unk_1B0, 2048.0f, 1.0f, 128.0f);
+ Math_ApproachF(&this->rotationStep, 2048.0f, 1.0f, 128.0f);
this->actor.flags &= ~ACTOR_FLAG_0;
}
break;
case -25:
- if ((this->actor.xzDistToPlayer < (250.0f * sp118)) || (this->unk_17A[1] != 0)) {
- this->unk_158 = -1;
- this->unk_1B4.y = -120.0f;
+ if ((this->actor.xzDistToPlayer < (250.0f * playerSpeedMod)) || (this->timerArray[1] != 0)) {
+ this->fishState = -1;
+ this->fishTargetPos.y = -120.0f;
} else {
- Math_ApproachS(&this->unk_166, 0x1000, 0x14, 0x6A);
+ Math_ApproachS(&this->rotationTarget.x, 0x1000, 0x14, 0x6A);
- if (sp124 > 40.0f) {
+ if (distToTarget > 40.0f) {
this->unk_190 = 0.7f;
this->unk_194 = 1200.0f;
Math_ApproachF(&this->actor.speed, 0.5f, 1.0f, 0.01f);
- Math_ApproachF(&this->unk_1B0, 2048.0f, 1.0f, 128.0f);
+ Math_ApproachF(&this->rotationStep, 2048.0f, 1.0f, 128.0f);
} else {
- this->unk_158 = -1;
+ this->fishState = -1;
}
}
break;
case 2:
if (((this->actor.params + D_80B7E118) & 1) != 0) {
- sp10C.x = 10.0f;
+ multiVecSrc.x = 10.0f;
} else {
- sp10C.x = -10.0f;
+ multiVecSrc.x = -10.0f;
}
- sp10C.y = 0.0f;
- sp10C.z = 0.0f;
+ multiVecSrc.y = 0.0f;
+ multiVecSrc.z = 0.0f;
Matrix_RotateY(sLureRot.y, MTXMODE_NEW);
- Matrix_MultVec3f(&sp10C, &sp100);
+ Matrix_MultVec3f(&multiVecSrc, &targetPosOffset);
- this->unk_1B4.x = sLurePos.x + sp100.x;
- this->unk_1B4.z = sLurePos.z + sp100.z;
+ this->fishTargetPos.x = sLurePos.x + targetPosOffset.x;
+ this->fishTargetPos.z = sLurePos.z + targetPosOffset.z;
- if (D_80B7E0B6 == 2) {
- this->unk_1B4.y = sLurePos.y;
- } else if (this->unk_150 == 0) {
- this->unk_1B4.y = sLurePos.y - 15.0f;
+ if (sLureEquipped == FS_LURE_SINKING) {
+ this->fishTargetPos.y = sLurePos.y;
+ } else if (this->isLoach == 0) {
+ this->fishTargetPos.y = sLurePos.y - 15.0f;
} else {
- this->unk_1B4.y = sLurePos.y - 5.0f;
+ this->fishTargetPos.y = sLurePos.y - 5.0f;
}
- if (this->unk_1B4.y <= this->actor.floorHeight) {
- this->unk_1B4.y = this->actor.floorHeight + 3.0f;
+ if (this->fishTargetPos.y <= this->actor.floorHeight) {
+ this->fishTargetPos.y = this->actor.floorHeight + 3.0f;
}
- if ((D_80B7E0B6 != 2) && (this->unk_1B4.y < this->actor.world.pos.y)) {
- Math_ApproachF(&this->actor.world.pos.y, this->unk_1B4.y, 0.1f,
- (this->actor.world.pos.y - this->unk_1B4.y) * 0.1f);
+ if ((sLureEquipped != FS_LURE_SINKING) && (this->fishTargetPos.y < this->actor.world.pos.y)) {
+ Math_ApproachF(&this->actor.world.pos.y, this->fishTargetPos.y, 0.1f,
+ (this->actor.world.pos.y - this->fishTargetPos.y) * 0.1f);
}
- Math_ApproachF(&this->unk_1B0, 8192.0f, 1.0f, (KREG(16) * 128) + 384.0f);
+ Math_ApproachF(&this->rotationStep, 8192.0f, 1.0f, (KREG(16) * 128) + 384.0f);
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
- this->unk_1A8 += 0.005f;
+ this->perception += 0.005f;
}
- if (D_80B7E120 != 0) {
- if (D_80B7E120 == 1) {
- this->unk_1A8 += 0.01f;
+ if (sWiggleAttraction != 0) {
+ if (sWiggleAttraction == 1) {
+ this->perception += 0.01f;
} else {
- this->unk_1A8 += 0.05f;
+ this->perception += 0.05f;
}
- D_80B7E120 = 0;
+ sWiggleAttraction = 0;
}
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
- this->unk_1A8 += 0.008f;
+ this->perception += 0.008f;
}
- if (sp124 < ((this->unk_1AC * 0.5f) + 20.0f)) {
+ if (distToTarget < ((this->fishLength * 0.5f) + 20.0f)) {
if (this->unk_15E == 0) {
this->unk_190 = 1.0f;
this->unk_194 = 500.0f;
- this->unk_17A[0] = (s16)Rand_ZeroFloat(10.0f) + 2;
+ this->timerArray[0] = (s16)Rand_ZeroFloat(10.0f) + 2;
}
Math_ApproachF(&this->actor.speed, -0.2f, 1.0f, 0.1f);
this->unk_15E = 1;
} else {
if (this->unk_15E != 0) {
this->unk_190 = 1.0f;
- this->unk_1B0 = 0.0f;
+ this->rotationStep = 0.0f;
this->unk_194 = 3000.0f;
}
Math_ApproachF(&this->actor.speed, 3.0f, 1.0f, 0.15f);
this->unk_15E = 0;
}
- if (this->unk_1AC >= 60.0f) {
+ if (this->fishLength >= 60.0f) {
multiplier = 0.3f;
- } else if (this->unk_1AC >= 45.0f) {
+ } else if (this->fishLength >= 45.0f) {
multiplier = 0.6f;
} else {
multiplier = 1.0f;
@@ -3357,202 +3372,203 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
} else if ((gSaveContext.save.dayTime >= CLOCK_TIME(5, 0)) &&
(gSaveContext.save.dayTime < CLOCK_TIME(7, 0))) {
multiplier *= 1.5f;
- } else if (D_80B7E076 != 0) {
+ } else if (sFishingFoggy != 0) {
multiplier *= 1.5f;
- } else if ((u8)D_80B7A650 != 0) {
+ } else if ((u8)sStormStrength != 0) {
multiplier *= 3.0f;
}
- sp11C = 0.03f * multiplier;
- if (D_80B7E0B6 == 2) {
- sp11C *= 5.0f;
+ chance = 0.03f * multiplier;
+ if (sLureEquipped == FS_LURE_SINKING) {
+ chance *= 5.0f;
}
- if (((this->unk_17A[0] == 1) || (Rand_ZeroOne() < sp11C)) &&
- ((Rand_ZeroOne() < (this->unk_1A8 * multiplier)) || ((this->unk_150 + 1) == KREG(69)))) {
- if (this->unk_150 == 0) {
- this->unk_158 = 3;
+ if (((this->timerArray[0] == 1) || (Rand_ZeroOne() < chance)) &&
+ ((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;
- this->unk_17A[0] = Rand_ZeroFloat(10.0f);
+ this->timerArray[0] = Rand_ZeroFloat(10.0f);
} else {
- this->unk_158 = -3;
+ this->fishState = -3;
this->unk_190 = 1.0f;
this->unk_194 = 3000.0f;
- this->unk_17A[0] = 40;
+ this->timerArray[0] = 40;
}
- if (D_80B7E0B6 == 2) {
- this->unk_188 = Rand_ZeroFloat(1.5f) + 3.0f;
+ if (sLureEquipped == FS_LURE_SINKING) {
+ this->speedTarget = Rand_ZeroFloat(1.5f) + 3.0f;
} else {
- this->unk_188 = Rand_ZeroFloat(1.5f) + 4.5f;
+ this->speedTarget = Rand_ZeroFloat(1.5f) + 4.5f;
}
}
- if ((D_80B7A694 != 3) || (this->unk_17A[2] == 0) ||
+ if ((sRodCastState != 3) || (this->timerArray[2] == 0) ||
(sqrtf(SQ(this->actor.world.pos.x) + SQ(this->actor.world.pos.z)) > 800.0f)) {
- this->unk_158 = this->unk_15A;
- this->unk_17A[1] = (s16)Rand_ZeroFloat(30.0f) + 50;
- this->unk_17A[0] = (s16)Rand_ZeroFloat(10.0f) + 5;
+ this->fishState = this->fishStateNext;
+ this->timerArray[1] = (s16)Rand_ZeroFloat(30.0f) + 50;
+ this->timerArray[0] = (s16)Rand_ZeroFloat(10.0f) + 5;
this->unk_190 = 1.0f;
- this->unk_1B0 = 0.0f;
+ this->rotationStep = 0.0f;
this->unk_194 = 2000.0f;
}
- if (this->actor.xzDistToPlayer < (100.0f * sp118)) {
- this->unk_15A = this->unk_158 = 0;
+ if (this->actor.xzDistToPlayer < (100.0f * playerSpeedMod)) {
+ this->fishStateNext = this->fishState = 0;
this->unk_1A4 = 1000;
this->unk_1A2 = 200;
- this->unk_17A[1] = 50;
+ this->timerArray[1] = 50;
}
break;
case 3:
- this->unk_151 = 6;
- sp134 = 2;
+ this->lilyTimer = 6;
+ rotXYScale = 2;
if ((((s16)player->actor.world.pos.x + D_80B7E118) & 1) != 0) {
- sp10C.x = 30.0f;
+ multiVecSrc.x = 30.0f;
} else {
- sp10C.x = -30.0f;
+ multiVecSrc.x = -30.0f;
}
- sp10C.y = 0.0f;
- sp10C.z = 30.0f;
+ multiVecSrc.y = 0.0f;
+ multiVecSrc.z = 30.0f;
Matrix_RotateY(sLureRot.y, MTXMODE_NEW);
- Matrix_MultVec3f(&sp10C, &sp100);
+ Matrix_MultVec3f(&multiVecSrc, &targetPosOffset);
- this->unk_1B4.x = sLurePos.x + sp100.x;
- this->unk_1B4.z = sLurePos.z + sp100.z;
- this->unk_1B4.y = sLurePos.y - 10.0f;
- this->unk_1B0 = 4096.0f;
- Math_ApproachF(&this->actor.speed, this->unk_188 * 0.8f, 1.0f, 1.0f);
+ this->fishTargetPos.x = sLurePos.x + targetPosOffset.x;
+ this->fishTargetPos.z = sLurePos.z + targetPosOffset.z;
+ this->fishTargetPos.y = sLurePos.y - 10.0f;
+ this->rotationStep = 4096.0f;
+ Math_ApproachF(&this->actor.speed, this->speedTarget * 0.8f, 1.0f, 1.0f);
- if ((D_80B7A694 != 3) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) ||
+ if ((sRodCastState != 3) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) ||
(sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) {
- this->unk_158 = this->unk_15A;
- this->unk_17A[0] = 0;
+ this->fishState = this->fishStateNext;
+ this->timerArray[0] = 0;
this->unk_190 = 1.0f;
this->unk_194 = 2000.0f;
- } else if ((this->unk_17A[0] == 0) || (sp124 < 30.0f)) {
- this->unk_158 = 4;
- this->unk_1B4 = sLurePos;
- this->unk_1B0 = 16384.0f;
+ } else if ((this->timerArray[0] == 0) || (distToTarget < 30.0f)) {
+ this->fishState = 4;
+ this->fishTargetPos = sLurePos;
+ this->rotationStep = 16384.0f;
this->unk_190 = 1.2f;
this->unk_194 = 5000.0f;
- this->unk_17A[0] = 20;
+ this->timerArray[0] = 20;
}
break;
case 4:
- Math_ApproachF(&this->unk_1B0, 16384.0f, 1.0f, 4096.0f);
- Math_ApproachS(&this->unk_170, 0x4E20, 4, 0x1388);
+ Math_ApproachF(&this->rotationStep, 16384.0f, 1.0f, 4096.0f);
+ Math_ApproachS(&this->fishLimbDRotZDelta, 0x4E20, 4, 0x1388);
- this->unk_151 = 50;
- sp134 = 2;
- this->unk_1B4 = sLurePos;
- Math_ApproachF(&this->actor.speed, this->unk_188, 1.0f, 1.0f);
+ this->lilyTimer = 50;
+ rotXYScale = 2;
+ this->fishTargetPos = sLurePos;
+ Math_ApproachF(&this->actor.speed, this->speedTarget, 1.0f, 1.0f);
- if ((D_80B7A694 != 3) || (this->unk_17A[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) ||
+ if ((sRodCastState != 3) || (this->timerArray[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) ||
(sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) {
- this->unk_17A[0] = 0;
- this->unk_158 = this->unk_15A;
+ this->timerArray[0] = 0;
+ this->fishState = this->fishStateNext;
this->unk_190 = 1.0f;
this->unk_194 = 2000.0f;
- } else if (sp124 < 10.0f) {
- if (func_80B70A2C(this, play, false)) {
- func_80B71278(this, 0);
+ } else if (distToTarget < 10.0f) {
+ if (Fishing_SplashBySize(this, play, false)) {
+ Fishing_FishLeapSfx(this, false);
}
- this->unk_158 = 5;
+ this->fishState = 5;
this->unk_190 = 1.2f;
this->unk_194 = 5000.0f;
- this->unk_17A[1] = 150;
- this->unk_17A[0] = 0;
- this->unk_17A[2] = 0;
- this->unk_17A[3] = 120;
+ this->timerArray[1] = 150;
+ this->timerArray[0] = 0;
+ this->timerArray[2] = 0;
+ this->timerArray[3] = 120;
- D_80B7A694 = 4;
+ sRodCastState = 4;
sFishingHookedFish = this;
sFishMouthOffset.y = 500.0f - Rand_ZeroFloat(400.0f);
- if (D_80B7E0B6 == 2) {
- if (this->unk_1AC > 70.0f) {
- phi_v0 = (s16)Rand_ZeroFloat(20.0f) + 10;
- } else if (this->unk_1AC > 60.0f) {
- phi_v0 = (s16)Rand_ZeroFloat(30.0f) + 20;
- } else if (this->unk_1AC > 50.0f) {
- phi_v0 = (s16)Rand_ZeroFloat(30.0f) + 30;
+ // get rumble time based on size and lure used.
+ if (sLureEquipped == FS_LURE_SINKING) {
+ if (this->fishLength > 70.0f) {
+ timer = (s16)Rand_ZeroFloat(20.0f) + 10;
+ } else if (this->fishLength > 60.0f) {
+ timer = (s16)Rand_ZeroFloat(30.0f) + 20;
+ } else if (this->fishLength > 50.0f) {
+ timer = (s16)Rand_ZeroFloat(30.0f) + 30;
} else {
- phi_v0 = (s16)Rand_ZeroFloat(40.0f) + 40;
+ timer = (s16)Rand_ZeroFloat(40.0f) + 40;
}
- D_80B7E122 = phi_v0;
- D_80B7E0A4 = phi_v0;
- Rumble_Override(0.0f, 60, phi_v0 * 3, 10);
+ sLureBitTimer = timer;
+ sRumbleDelay = timer;
+ Rumble_Override(0.0f, 60, timer * 3, 10);
} else {
- if (this->unk_1AC > 70.0f) {
- phi_v0 = (s16)Rand_ZeroFloat(5.0f) + 10;
- } else if (this->unk_1AC > 60.0f) {
- phi_v0 = (s16)Rand_ZeroFloat(5.0f) + 15;
- } else if (this->unk_1AC > 50.0f) {
- phi_v0 = (s16)Rand_ZeroFloat(5.0f) + 17;
+ if (this->fishLength > 70.0f) {
+ timer = (s16)Rand_ZeroFloat(5.0f) + 10;
+ } else if (this->fishLength > 60.0f) {
+ timer = (s16)Rand_ZeroFloat(5.0f) + 15;
+ } else if (this->fishLength > 50.0f) {
+ timer = (s16)Rand_ZeroFloat(5.0f) + 17;
} else {
- phi_v0 = (s16)Rand_ZeroFloat(5.0f) + 25;
+ timer = (s16)Rand_ZeroFloat(5.0f) + 25;
}
- D_80B7E122 = phi_v0;
- D_80B7E0A4 = phi_v0;
- Rumble_Override(0.0f, 180, phi_v0 * 3, 10);
+ sLureBitTimer = timer;
+ sRumbleDelay = timer;
+ Rumble_Override(0.0f, 180, timer * 3, 10);
}
- D_80B7E124 = 0;
- D_80B7E116 = 100;
- D_80B7E080 = 0;
+ sLineHooked = 0;
+ sRodPullback = 100;
+ sFishFightTime = 0;
}
break;
case -3:
- this->unk_151 = 50;
- this->unk_1B4 = sLurePos;
+ this->lilyTimer = 50;
+ this->fishTargetPos = sLurePos;
Math_ApproachF(&this->actor.speed, 2.0f, 1.0f, 1.0f);
- if ((D_80B7A694 != 3) || (this->unk_17A[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) ||
+ if ((sRodCastState != 3) || (this->timerArray[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) ||
(sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) {
- this->unk_17A[0] = 0;
+ this->timerArray[0] = 0;
this->unk_190 = 1.0f;
- this->unk_158 = this->unk_15A;
+ this->fishState = this->fishStateNext;
this->unk_194 = 2000.0f;
- } else if (sp124 < 10.0f) {
+ } else if (distToTarget < 10.0f) {
if (sLurePos.y > (WATER_SURFACE_Y(play) - 10.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EV_JUMP_OUT_WATER);
Sfx_PlaySfxCentered(NA_SE_PL_CATCH_BOOMERANG);
}
- func_80B70A2C(this, play, false);
- this->unk_158 = 5;
+ Fishing_SplashBySize(this, play, false);
+ this->fishState = 5;
this->unk_190 = 1.2f;
this->unk_194 = 5000.0f;
- this->unk_17A[1] = 150;
- this->unk_17A[0] = 0;
- this->unk_17A[2] = 0;
- this->unk_17A[3] = 120;
+ this->timerArray[1] = 150;
+ this->timerArray[0] = 0;
+ this->timerArray[2] = 0;
+ this->timerArray[3] = 120;
- D_80B7A694 = 4;
+ sRodCastState = 4;
sFishingHookedFish = this;
- if (D_80B7E0B6 == 2) {
- D_80B7E122 = 30;
- D_80B7E0A4 = 100;
+ if (sLureEquipped == FS_LURE_SINKING) {
+ sLureBitTimer = 30;
+ sRumbleDelay = 100;
Rumble_Override(0.0f, 60, 90, 10);
} else {
- D_80B7E122 = 30;
- D_80B7E0A4 = 40;
+ sLureBitTimer = 30;
+ sRumbleDelay = 40;
Rumble_Override(0.0f, 180, 90, 10);
}
- D_80B7E124 = 0;
- D_80B7E116 = 100;
- D_80B7E080 = 0;
+ sLineHooked = false;
+ sRodPullback = 100;
+ sFishFightTime = 0;
}
break;
@@ -3560,23 +3576,24 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
this->actor.uncullZoneForward = 1200.0f;
this->actor.uncullZoneScale = 200.0f;
- D_80B7E080++;
- osSyncPrintf("HIT FISH %dcm\n", (u8)this->unk_1AC);
+ sFishFightTime++;
+ osSyncPrintf("HIT FISH %dcm\n", (u8)this->fishLength);
- Math_ApproachS(&this->unk_170, 0x2AF8, 4, 0xBB8);
+ Math_ApproachS(&this->fishLimbDRotZDelta, 0x2AF8, 4, 0xBB8);
sFishingHookedFish = this;
Math_ApproachS(&player->actor.shape.rot.y, this->actor.yawTowardsPlayer + 0x8000, 5, 0x500);
- if (D_80B7E124 == 0) {
- if ((D_80B7FEA0 < 20) && ((D_80B7E0AE & 3) == 0)) {
- D_80B7FEA0++;
+ if (sLineHooked == 0) {
+ if ((sSinkingLureSegmentIndex < 20) && ((sLureTimer & 3) == 0)) {
+ sSinkingLureSegmentIndex++;
}
}
- if ((D_80B7E122 != 0) && (D_80B7E124 == 0)) {
- if (((input->rel.stick_y < -50) && (D_80B7A6C8 > -40)) || CHECK_BTN_ALL(input->press.button, BTN_A)) {
+ if ((sLureBitTimer != 0) && (sLineHooked == 0)) { // pull the line to hook it
+ if (((input->rel.stick_y < -50) && (sStickAdjYPrev > -40)) ||
+ CHECK_BTN_ALL(input->press.button, BTN_A)) {
if (input->rel.stick_y < -50) {
- temp_f0 = 40.0f - ((this->unk_1AC - 30.0f) * 1.333333f);
+ temp_f0 = 40.0f - ((this->fishLength - 30.0f) * 1.333333f);
if (temp_f0 > 0.0f) {
this->unk_152 = temp_f0;
this->unk_154 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
@@ -3584,106 +3601,106 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
}
}
- this->unk_198 = 1.7f;
- this->unk_19C = 7000.0f;
- D_80B7E124 = 1;
+ this->fishLimbRotPhaseStep = 1.7f;
+ this->fishLimbRotPhaseMag = 7000.0f;
+ sLineHooked = 1;
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 8, NA_BGM_ENEMY);
- D_80B7E0A6 = 0;
+ sFishingMusicDelay = 0;
- if (this->unk_150 == 1) {
- spA4 = (this->unk_1AC * 3.0f) + 120.0f;
+ if (this->isLoach == 1) {
+ rumbleStrength = (this->fishLength * 3.0f) + 120.0f;
} else {
- spA4 = (2.0f * this->unk_1AC) + 120.0f;
+ rumbleStrength = (2.0f * this->fishLength) + 120.0f;
}
- if (spA4 > 255.0f) {
- spA4 = 255.0f;
+ if (rumbleStrength > 255.0f) {
+ rumbleStrength = 255.0f;
}
- Rumble_Override(0.0f, spA4, 120, 5);
- D_80B7E0A4 = 40;
- D_80B7FDA8 = 10;
+ Rumble_Override(0.0f, rumbleStrength, 120, 5);
+ sRumbleDelay = 40;
+ sRodHitTimer = 10;
Sfx_PlaySfxCentered(NA_SE_IT_FISHING_HIT);
}
}
if (this->actor.world.pos.y < WATER_SURFACE_Y(play)) {
- if (this->unk_17A[1] > 30) {
+ if (this->timerArray[1] > 30) {
phi_v0_2 = 7;
} else {
phi_v0_2 = 0xF;
}
- if (((this->unk_15C & phi_v0_2) == 0) && (Rand_ZeroOne() < 0.75f) && (D_80B7E0A4 == 0)) {
- if (this->unk_1AC >= 70.0f) {
- spA4 = 255.0f;
- } else if (this->unk_1AC >= 60.0f) {
- spA4 = 230.0f;
- } else if (this->unk_1AC >= 50.0f) {
- spA4 = 200.0f;
- } else if (this->unk_1AC >= 40.0f) {
- spA4 = 170.0f;
+ if (((this->stateAndTimer & phi_v0_2) == 0) && (Rand_ZeroOne() < 0.75f) && (sRumbleDelay == 0)) {
+ if (this->fishLength >= 70.0f) {
+ rumbleStrength = 255.0f;
+ } else if (this->fishLength >= 60.0f) {
+ rumbleStrength = 230.0f;
+ } else if (this->fishLength >= 50.0f) {
+ rumbleStrength = 200.0f;
+ } else if (this->fishLength >= 40.0f) {
+ rumbleStrength = 170.0f;
} else {
- spA4 = 140.0f;
+ rumbleStrength = 140.0f;
}
if (phi_v0_2 == 0xF) {
- spA4 *= 3.0f / 4.0f;
+ rumbleStrength *= 3.0f / 4.0f;
}
- Rumble_Override(0.0f, spA4, (s16)Rand_ZeroFloat(5.0f) + 10, 5);
+ Rumble_Override(0.0f, rumbleStrength, (s16)Rand_ZeroFloat(5.0f) + 10, 5);
}
- if (this->unk_17A[1] > 30) {
- if (this->unk_17A[0] == 0) {
- sp10C.x = 0.0f;
- sp10C.y = 0.0f;
- sp10C.z = 200.0f;
+ if (this->timerArray[1] > 30) {
+ if (this->timerArray[0] == 0) {
+ multiVecSrc.x = 0.0f;
+ multiVecSrc.y = 0.0f;
+ multiVecSrc.z = 200.0f;
- for (spA2 = 0; spA2 < 100; spA2++) {
+ for (attempts = 0; attempts < 100; attempts++) {
Matrix_RotateY(Rand_CenteredFloat(3.0f * M_PI / 4.0f) +
BINANG_TO_RAD_ALT(this->actor.yawTowardsPlayer + 0x8000),
MTXMODE_NEW);
- Matrix_MultVec3f(&sp10C, &sp100);
+ Matrix_MultVec3f(&multiVecSrc, &targetPosOffset);
- this->unk_1B4.x = this->actor.world.pos.x + sp100.x;
- this->unk_1B4.z = this->actor.world.pos.z + sp100.z;
+ this->fishTargetPos.x = this->actor.world.pos.x + targetPosOffset.x;
+ this->fishTargetPos.z = this->actor.world.pos.z + targetPosOffset.z;
- if ((SQ(this->unk_1B4.x) + SQ(this->unk_1B4.z)) < SQ(750.0f)) {
+ if ((SQ(this->fishTargetPos.x) + SQ(this->fishTargetPos.z)) < SQ(750.0f)) {
break;
}
}
- if ((Rand_ZeroOne() < 0.1f) && (this->unk_17A[3] == 0)) {
- if (this->unk_1AC >= 60.0f) {
- phi_a1 = 255;
- } else if (this->unk_1AC >= 50.0f) {
- phi_a1 = 200;
+ if ((Rand_ZeroOne() < 0.1f) && (this->timerArray[3] == 0)) {
+ if (this->fishLength >= 60.0f) {
+ rumbleStrength8 = 255;
+ } else if (this->fishLength >= 50.0f) {
+ rumbleStrength8 = 200;
} else {
- phi_a1 = 180;
+ rumbleStrength8 = 180;
}
- Rumble_Override(0.0f, phi_a1, 90, 2);
- this->unk_17A[0] = 20;
- this->unk_17A[1] = 100;
- this->unk_17A[2] = 20;
- this->unk_17A[3] = 100;
- this->unk_1B4.y = 300.0f;
- D_80B7E0A4 = 0x28;
- D_80B7E116 = (s16)Rand_ZeroFloat(30.0f) + 20;
+ Rumble_Override(0.0f, rumbleStrength8, 90, 2);
+ this->timerArray[0] = 20;
+ this->timerArray[1] = 100;
+ this->timerArray[2] = 20;
+ this->timerArray[3] = 100;
+ this->fishTargetPos.y = 300.0f;
+ sRumbleDelay = 40;
+ sRodPullback = (s16)Rand_ZeroFloat(30.0f) + 20;
} else {
- this->unk_17A[0] = (s16)Rand_ZeroFloat(10.0f) + 3;
- this->unk_17A[2] = 0;
- this->unk_1B4.y = -70.0f - Rand_ZeroFloat(150.0f);
+ this->timerArray[0] = (s16)Rand_ZeroFloat(10.0f) + 3;
+ this->timerArray[2] = 0;
+ this->fishTargetPos.y = -70.0f - Rand_ZeroFloat(150.0f);
}
}
- if (this->unk_17A[2] != 0) {
- D_80B7E11C = 0.0f;
+ if (this->timerArray[2] != 0) {
+ sRodReelingSpeed = 0.0f;
this->unk_190 = 1.6f;
this->unk_194 = 6000.0f;
Math_ApproachF(&this->actor.speed, 7.5f, 1.0f, 1.0f);
- Math_ApproachS(&this->unk_170, 0x4E20, 2, 0xFA0);
+ Math_ApproachS(&this->fishLimbDRotZDelta, 20000, 2, 4000);
} else {
- if ((D_80B7E124 == 0) && (D_80B7E0B6 == 2)) {
+ if ((sLineHooked == 0) && (sLureEquipped == FS_LURE_SINKING)) {
this->unk_190 = 1.0f;
this->unk_194 = 2000.0f;
Math_ApproachF(&this->actor.speed, 3.0f, 1.0f, 0.2f);
@@ -3693,15 +3710,15 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
Math_ApproachF(&this->actor.speed, 5.0f, 1.0f, 0.5f);
}
- if (this->unk_150 == 0) {
- D_80B7E11C = 1.0f - (this->unk_1AC * 0.00899f);
+ if (this->isLoach == 0) {
+ sRodReelingSpeed = 1.0f - (this->fishLength * 0.00899f);
} else {
- D_80B7E11C = 1.0f - (this->unk_1AC * 0.00899f * 1.4f);
+ sRodReelingSpeed = 1.0f - (this->fishLength * 0.00899f * 1.4f);
}
}
} else {
- if (((this->unk_17A[1] & 0xF) == 0) && CHECK_BTN_ALL(input->cur.button, BTN_A) &&
- (!(this->unk_1AC >= 60.0f) || (D_80B7E080 >= 2000))) {
+ if (((this->timerArray[1] & 0xF) == 0) && CHECK_BTN_ALL(input->cur.button, BTN_A) &&
+ (!(this->fishLength >= 60.0f) || (sFishFightTime >= 2000))) {
this->unk_152 = (s16)Rand_ZeroFloat(30.0f) + 15;
this->unk_154 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
}
@@ -3709,57 +3726,57 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
this->unk_190 = 1.0f;
this->unk_194 = 4500.0f;
- if (this->unk_150 == 0) {
- D_80B7E11C = 1.3f - (this->unk_1AC * 0.00899f);
+ if (this->isLoach == 0) {
+ sRodReelingSpeed = 1.3f - (this->fishLength * 0.00899f);
} else {
- D_80B7E11C = 1.3f - (this->unk_1AC * 0.00899f * 1.4f);
+ sRodReelingSpeed = 1.3f - (this->fishLength * 0.00899f * 1.4f);
}
Math_ApproachF(&this->actor.speed, 2.0f, 1.0f, 0.5f);
- if (this->unk_17A[1] == 0) {
+ if (this->timerArray[1] == 0) {
this->unk_152 = 0;
- if (D_80B7E080 < 2000) {
- this->unk_17A[1] = (s16)Rand_ZeroFloat(50.0f) + 50;
- } else if (D_80B7E080 < 3000) {
- this->unk_17A[1] = (s16)Rand_ZeroFloat(20.0f) + 30;
+ if (sFishFightTime < 2000) {
+ this->timerArray[1] = (s16)Rand_ZeroFloat(50.0f) + 50;
+ } else if (sFishFightTime < 3000) {
+ this->timerArray[1] = (s16)Rand_ZeroFloat(20.0f) + 30;
} else {
- this->unk_17A[1] = (s16)Rand_ZeroFloat(10.0f) + 25;
+ this->timerArray[1] = (s16)Rand_ZeroFloat(10.0f) + 25;
}
}
}
}
- if (D_80B7E074 != 0) {
- D_80B7E11C = 0.0f;
+ if (sReelLock != 0) {
+ sRodReelingSpeed = 0.0f;
}
- if (D_80B7E124 || (D_80B7E0B6 != 2)) {
+ if (sLineHooked || (sLureEquipped != FS_LURE_SINKING)) {
if (this->actor.speed < 3.0f) {
- if ((D_80B7E0AE & 8) != 0) {
- sp100.x = -0.8f;
+ if ((sLureTimer & 8) != 0) {
+ targetPosOffset.x = -0.8f;
} else {
- sp100.x = -0.75f;
+ targetPosOffset.x = -0.75f;
}
} else {
- if ((D_80B7E0AE & 4) != 0) {
- sp100.x = -0.9f;
+ if ((sLureTimer & 4) != 0) {
+ targetPosOffset.x = -0.9f;
} else {
- sp100.x = -0.85f;
+ targetPosOffset.x = -0.85f;
}
}
Math_ApproachF(&D_80B7A6C0, 35.0f, 0.1f, 3.5f);
- Math_ApproachF(&D_80B7A6BC, sp100.x, 0.3f, 0.1f);
+ Math_ApproachF(&D_80B7A6BC, targetPosOffset.x, 0.3f, 0.1f);
}
sReelLinePos[LINE_SEG_COUNT - 1] = this->fishMouthPos;
- sp10C.x = sReelLinePos[LINE_SEG_COUNT - 1].x - sReelLinePos[LINE_SEG_COUNT - 2].x;
- sp10C.y = sReelLinePos[LINE_SEG_COUNT - 1].y - sReelLinePos[LINE_SEG_COUNT - 2].y;
- sp10C.z = sReelLinePos[LINE_SEG_COUNT - 1].z - sReelLinePos[LINE_SEG_COUNT - 2].z;
+ multiVecSrc.x = sReelLinePos[LINE_SEG_COUNT - 1].x - sReelLinePos[LINE_SEG_COUNT - 2].x;
+ multiVecSrc.y = sReelLinePos[LINE_SEG_COUNT - 1].y - sReelLinePos[LINE_SEG_COUNT - 2].y;
+ multiVecSrc.z = sReelLinePos[LINE_SEG_COUNT - 1].z - sReelLinePos[LINE_SEG_COUNT - 2].z;
- if ((SQ(sp10C.x) + SQ(sp10C.y) + SQ(sp10C.z)) > SQ(20.0f)) {
+ if ((SQ(multiVecSrc.x) + SQ(multiVecSrc.y) + SQ(multiVecSrc.z)) > SQ(20.0f)) {
Math_ApproachF(&this->actor.world.pos.x, sReelLinePos[LINE_SEG_COUNT - 2].x, 0.2f,
2.0f * (this->actor.speed * 1.5f));
Math_ApproachF(&this->actor.world.pos.y, sReelLinePos[LINE_SEG_COUNT - 2].y, 0.2f,
@@ -3769,84 +3786,85 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
}
if (CHECK_BTN_ALL(input->cur.button, BTN_A) || (input->rel.stick_y < -30)) {
- if (D_80B7E116 < 100) {
- D_80B7E116++;
+ if (sRodPullback < 100) {
+ sRodPullback++;
}
} else {
- if (D_80B7E116 != 0) {
- D_80B7E116--;
+ if (sRodPullback != 0) {
+ sRodPullback--;
}
}
- if ((D_80B7A694 < 3) || ((D_80B7E074 != 0) && (D_80B7E080 > 50)) || (D_80B7E080 >= 6000) ||
- ((D_80B7E122 == 0) && (D_80B7E124 == 0)) || (D_80B7E116 == 0) ||
- (((D_80B7E0AE & 0x7F) == 0) && (Rand_ZeroOne() < 0.05f) && (D_80B7E0B6 != 2) && (KREG(69) == 0))) {
- D_80B7A67C = 20;
+ if ((sRodCastState < 3) || ((sReelLock != 0) && (sFishFightTime > 50)) || (sFishFightTime >= 6000) ||
+ ((sLureBitTimer == 0) && (sLineHooked == 0)) || (sRodPullback == 0) ||
+ (((sLureTimer & 0x7F) == 0) && (Rand_ZeroOne() < 0.05f) && (sLureEquipped != FS_LURE_SINKING) &&
+ (KREG(69) == 0))) {
+ sFishingCaughtTextDelay = 20;
- if ((D_80B7E122 == 0) && (D_80B7E124 == 0)) {
- D_80B7E086 = 0x4081;
- if (((sLinkAge == LINK_AGE_CHILD) && (HIGH_SCORE(HS_FISHING) & 0x400)) ||
- ((sLinkAge != LINK_AGE_CHILD) && (HIGH_SCORE(HS_FISHING) & 0x800))) {
- D_80B7A67C = 0;
+ if ((sLureBitTimer == 0) && (sLineHooked == 0)) {
+ sFishingCaughtTextId = 0x4081;
+ if (((sLinkAge == LINK_AGE_CHILD) && (HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_CHILD)) ||
+ ((sLinkAge != LINK_AGE_CHILD) && (HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_ADULT))) {
+ sFishingCaughtTextDelay = 0;
}
} else {
- D_80B7E086 = 0x4082;
+ sFishingCaughtTextId = 0x4082;
Rumble_Override(0.0f, 1, 3, 1);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 10);
}
- this->unk_158 = this->unk_15A = 0;
+ this->fishState = this->fishStateNext = 0;
this->unk_1A4 = 10000;
this->unk_1A2 = 500;
- this->unk_17A[1] = 50;
- this->unk_17A[0] = 0;
+ this->timerArray[1] = 50;
+ this->timerArray[0] = 0;
this->unk_190 = 1.0f;
this->unk_194 = 3000.0f;
- if (D_80B7A694 == 4) {
- D_80B7A694 = 3;
+ if (sRodCastState == 4) {
+ sRodCastState = 3;
}
- D_80B7E0A6 = 50;
- D_80B7E11C = 0.5f;
+ sFishingMusicDelay = 50;
+ sRodReelingSpeed = 0.5f;
this->unk_152 = 0;
} else if (this->actor.xzDistToPlayer < (KREG(59) + 50.0f)) {
- this->unk_158 = 6;
- this->unk_17A[0] = 100;
+ this->fishState = 6;
+ this->timerArray[0] = 100;
player->unk_860 = 3;
Rumble_Override(0.0f, 1, 3, 1);
- D_80B7E084++;
+ sFishesCaught++;
Cutscene_StartManual(play, &play->csCtx);
- D_80B7A6CC = 100;
- D_80B7FEC8 = 45.0f;
- D_80B7A694 = 5;
+ sFishingPlayerCinematicState = 100;
+ sCatchCamX = 45.0f;
+ sRodCastState = 5;
this->unk_190 = 1.0f;
this->unk_194 = 500.0f;
- this->unk_19C = 5000.0f;
+ this->fishLimbRotPhaseMag = 5000.0f;
if (this->actor.world.pos.y <= WATER_SURFACE_Y(play)) {
- func_80B71278(this, 1);
- func_80B70A2C(this, play, true);
+ Fishing_FishLeapSfx(this, true);
+ Fishing_SplashBySize(this, play, true);
}
- goto case_6;
+ goto hoistCatch;
}
break;
- case_6:
+ hoistCatch:
case 6:
- Math_ApproachS(&this->unk_170, 0x2AF8, 2, 0xFA0);
- Math_ApproachF(&D_80B7FEC8, 15.0f, 0.05f, 0.75f);
+ Math_ApproachS(&this->fishLimbDRotZDelta, 11000, 2, 4000);
+ Math_ApproachF(&sCatchCamX, 15.0f, 0.05f, 0.75f);
- sp10C.x = D_80B7FEC8;
+ multiVecSrc.x = sCatchCamX;
if (sLinkAge != LINK_AGE_CHILD) {
- sp10C.y = 30.0f;
- sp10C.z = 55.0f;
+ multiVecSrc.y = 30.0f;
+ multiVecSrc.z = 55.0f;
} else {
- sp10C.y = 10.0f;
- sp10C.z = 50.0f;
+ multiVecSrc.y = 10.0f;
+ multiVecSrc.z = 50.0f;
}
Matrix_RotateY(BINANG_TO_RAD_ALT(player->actor.shape.rot.y), MTXMODE_NEW);
- Matrix_MultVec3f(&sp10C, &sSubCamEye);
+ Matrix_MultVec3f(&multiVecSrc, &sSubCamEye);
sSubCamEye.x += player->actor.world.pos.x;
sSubCamEye.y += player->actor.world.pos.y;
@@ -3859,75 +3877,76 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
sSubCamAt.y += 25.0f;
}
- if (this->unk_17A[0] == 90) {
+ if (this->timerArray[0] == 90) {
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 9, NA_BGM_HEART_GET);
- D_80B7A67C = 40;
+ sFishingCaughtTextDelay = 40;
- if (this->unk_150 == 0) {
- D_80B7A678 = this->unk_1AC;
+ if (this->isLoach == 0) {
+ sFishLengthToWeigh = this->fishLength;
- if (D_80B7A678 >= 75) {
- D_80B7E086 = 0x409F;
- } else if (D_80B7A678 >= 50) {
- D_80B7E086 = 0x4091;
+ if (sFishLengthToWeigh >= 75) {
+ sFishingCaughtTextId = 0x409F;
+ } else if (sFishLengthToWeigh >= 50) {
+ sFishingCaughtTextId = 0x4091;
} else {
- D_80B7E086 = 0x4083;
+ sFishingCaughtTextId = 0x4083;
}
} else {
- D_80B7A678 = 2.0f * this->unk_1AC;
- D_80B7E086 = 0x4099;
+ sFishLengthToWeigh = 2.0f * this->fishLength;
+ sFishingCaughtTextId = 0x4099;
}
- this->unk_1D5 = 0;
+ this->keepState = 0;
}
this->unk_160 = -0x4000;
this->actor.shape.rot.y = player->actor.shape.rot.y + 0x5000;
this->actor.shape.rot.x = this->actor.shape.rot.z = this->unk_162 = this->unk_164 = this->unk_16E = 0;
- sp10C.x = 4.0f;
- sp10C.y = -10.0f;
- sp10C.z = 5.0f;
- Matrix_MultVec3f(&sp10C, &sp100);
- Math_ApproachF(&this->actor.world.pos.x, player->bodyPartsPos[PLAYER_BODYPART_R_HAND].x + sp100.x, 1.0f,
+ multiVecSrc.x = 4.0f;
+ multiVecSrc.y = -10.0f;
+ multiVecSrc.z = 5.0f;
+ Matrix_MultVec3f(&multiVecSrc, &targetPosOffset);
+ Math_ApproachF(&this->actor.world.pos.x, player->bodyPartsPos[PLAYER_BODYPART_R_HAND].x + targetPosOffset.x, 1.0f,
6.0f);
- Math_ApproachF(&this->actor.world.pos.y, player->bodyPartsPos[PLAYER_BODYPART_R_HAND].y + sp100.y, 1.0f,
+ Math_ApproachF(&this->actor.world.pos.y, player->bodyPartsPos[PLAYER_BODYPART_R_HAND].y + targetPosOffset.y, 1.0f,
6.0f);
- Math_ApproachF(&this->actor.world.pos.z, player->bodyPartsPos[PLAYER_BODYPART_R_HAND].z + sp100.z, 1.0f,
+ Math_ApproachF(&this->actor.world.pos.z, player->bodyPartsPos[PLAYER_BODYPART_R_HAND].z + targetPosOffset.z, 1.0f,
6.0f);
- D_80B7E144 = 188.0f;
+ sRodLineSpooled = 188.0f;
- if (this->unk_17A[0] <= 50) {
- switch (this->unk_1D5) {
+ if (this->timerArray[0] <= 50) {
+ switch (this->keepState) {
case 0:
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) ||
(Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) {
if (Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
if (play->msgCtx.choiceIndex == 0) {
- if (D_80B7A670 == 0.0f) {
- D_80B7A670 = this->unk_1AC;
- D_80B7E07C = this->unk_150;
- D_80B7E07E = D_80B7E0B6;
+ if (sFishOnHandLength == 0.0f) {
+ sFishOnHandLength = this->fishLength;
+ sFishOnHandIsLoach = this->isLoach;
+ sLureCaughtWith = sLureEquipped;
Actor_Kill(&this->actor);
- } else if ((this->unk_150 == 0) && (D_80B7E07C == 0) &&
- ((s16)this->unk_1AC < (s16)D_80B7A670)) {
- this->unk_1D5 = 1;
- this->unk_17A[0] = 0x3C;
+ } else if ((this->isLoach == 0) && (sFishOnHandIsLoach == 0) &&
+ ((s16)this->fishLength < (s16)sFishOnHandLength)) {
+ this->keepState = 1;
+ this->timerArray[0] = 0x3C;
+
Message_StartTextbox(play, 0x4098, NULL);
} else {
- f32 temp1 = D_80B7A670;
- s16 temp2 = D_80B7E07C;
- D_80B7A670 = this->unk_1AC;
- D_80B7E07C = this->unk_150;
- D_80B7E07E = D_80B7E0B6;
- this->unk_1AC = temp1;
- this->unk_150 = temp2;
+ f32 lengthTemp = sFishOnHandLength;
+ s16 loachTemp = sFishOnHandIsLoach;
+ sFishOnHandLength = this->fishLength;
+ sFishOnHandIsLoach = this->isLoach;
+ sLureCaughtWith = sLureEquipped;
+ this->fishLength = lengthTemp;
+ this->isLoach = loachTemp;
}
}
- if (this->unk_1D5 == 0) {
- D_80B7A694 = 0;
+ if (this->keepState == 0) {
+ sRodCastState = 0;
}
}
}
@@ -3938,32 +3957,32 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
if (Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
if (play->msgCtx.choiceIndex != 0) {
- f32 temp1 = D_80B7A670;
- s16 temp2 = D_80B7E07C;
- D_80B7A670 = this->unk_1AC;
- D_80B7E07E = D_80B7E0B6;
- this->unk_1AC = temp1;
- this->unk_150 = temp2;
+ f32 temp1 = sFishOnHandLength;
+ s16 temp2 = sFishOnHandIsLoach;
+ sFishOnHandLength = this->fishLength;
+ sLureCaughtWith = sLureEquipped;
+ this->fishLength = temp1;
+ this->isLoach = temp2;
}
- D_80B7A694 = 0;
+ sRodCastState = 0;
}
}
break;
}
}
- if (D_80B7A694 == 0) {
+ if (sRodCastState == 0) {
if (this->actor.update != NULL) {
- this->unk_158 = this->unk_15A = 0;
+ this->fishState = this->fishStateNext = 0;
this->unk_1A4 = 10000;
this->unk_1A2 = 500;
- this->unk_17A[1] = 50;
- this->unk_17A[0] = 0;
+ this->timerArray[1] = 50;
+ this->timerArray[0] = 0;
this->unk_190 = 1.0f;
this->unk_194 = 2000.0f;
SkelAnime_Free(&this->skelAnime, play);
- if (this->unk_150 == 0) {
+ if (this->isLoach == 0) {
SkelAnime_InitFlex(play, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, NULL, NULL, 0);
Animation_MorphToLoop(&this->skelAnime, &gFishingFishAnim, 0.0f);
} else {
@@ -3974,92 +3993,93 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
}
D_80B7E148 = 520.0f;
- D_80B7E144 = 195.0f;
+ sRodLineSpooled = 195.0f;
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 10);
- D_80B7E0A6 = 20;
- D_80B7A6CC = 3;
+ sFishingMusicDelay = 20;
+ sFishingPlayerCinematicState = 3;
}
break;
case 7:
- this->unk_151 = 50;
- sp134 = 5;
- this->unk_1B0 = 12288.0f;
-
- if (this->actor.params < 104) {
- this->unk_1B4 = sGroupFishes[this->actor.params - 100].pos;
- D_80B7A898 = 1;
- } else if (this->actor.params < 108) {
- this->unk_1B4 = sGroupFishes[this->actor.params - 100 + 16].pos;
- D_80B7A898 = 2;
+ this->lilyTimer = 50;
+ rotXYScale = 5;
+ this->rotationStep = 12288.0f;
+
+ if (this->actor.params < (EN_FISH_PARAM + 4)) {
+ this->fishTargetPos = sGroupFishes[this->actor.params - EN_FISH_PARAM].pos;
+ sFishGroupVar = 1;
+ } else if (this->actor.params < (EN_FISH_PARAM + 8)) {
+ this->fishTargetPos = sGroupFishes[this->actor.params - EN_FISH_PARAM + 16].pos;
+ sFishGroupVar = 2;
} else {
- this->unk_1B4 = sGroupFishes[this->actor.params - 100 + 32].pos;
- D_80B7A898 = 3;
+ this->fishTargetPos = sGroupFishes[this->actor.params - EN_FISH_PARAM + 32].pos;
+ sFishGroupVar = 3;
}
Math_ApproachF(&this->actor.speed, 5.0f, 1.0f, 1.0f);
- if (sp124 < 20.0f) {
- Math_ApproachS(&this->unk_170, 0x4E20, 2, 0xFA0);
+ if (distToTarget < 20.0f) {
+ Math_ApproachS(&this->fishLimbDRotZDelta, 20000, 2, 4000);
- if ((this->unk_17A[2] == 0) && func_80B70A2C(this, play, false)) {
- func_80B71278(this, Rand_ZeroFloat(1.99f));
- this->unk_17A[2] = (s16)Rand_ZeroFloat(20.0f) + 20;
+ if ((this->timerArray[2] == 0) && Fishing_SplashBySize(this, play, false)) {
+ Fishing_FishLeapSfx(this, Rand_ZeroFloat(1.99f));
+ this->timerArray[2] = (s16)Rand_ZeroFloat(20.0f) + 20;
}
}
- if (this->unk_17A[3] == 0) {
- this->unk_158 = 10;
- this->unk_15A = 10;
+ if (this->timerArray[3] == 0) {
+ this->fishState = 10;
+ this->fishStateNext = 10;
} else {
func_80B70ED4(this, input);
- if (this->actor.xzDistToPlayer < (100.0f * sp118)) {
- this->unk_15A = this->unk_158 = 0;
+ if (this->actor.xzDistToPlayer < (100.0f * playerSpeedMod)) {
+ this->fishStateNext = this->fishState = 0;
this->unk_1A4 = 500;
this->unk_1A2 = 200;
- this->unk_17A[1] = 50;
+ this->timerArray[1] = 50;
}
}
break;
}
- Math_ApproachS(&this->unk_172, (Math_SinS(this->unk_15C * 0x1000) * 5000.0f) + 5000.0f, 2, 0x7D0);
+ Math_ApproachS(&this->fishLimbEFRotYDelta, (Math_SinS(this->stateAndTimer * 0x1000) * 5000.0f) + 5000.0f, 2, 0x7D0);
- if (this->unk_158 != 6) {
+ if (this->fishState != 6) {
if (this->actor.world.pos.y > WATER_SURFACE_Y(play)) {
this->unk_190 = 1.5f;
this->unk_194 = 5000.0f;
Math_ApproachS(&this->unk_16E, 0, 5, 0x7D0);
- spF4 = spF0 = spFA = 3;
- spF2 = spEE = 0x2000;
+ rotXScale = rotYScale = rotZScale = 3;
+ rotXStep = rotYStep = 0x2000;
- this->unk_17A[2] = 0;
+ this->timerArray[2] = 0;
this->unk_184 -= 1.0f;
} else {
Math_ApproachZeroF(&this->unk_184, 1.0f, 2.0f);
- if ((this->unk_158 != -1) && (this->unk_158 != -2) && (this->unk_158 != -25)) {
- this->unk_166 = 0;
+ // check for Loach states
+ if ((this->fishState != -1) && (this->fishState != -2) && (this->fishState != -25)) {
+ this->rotationTarget.x = 0;
}
- this->unk_168 = this->unk_16A = 0;
- spF4 = spF0 = spFA = 4;
- spF2 = spEE = 0x2000;
+ this->rotationTarget.y = this->rotationTarget.z = 0;
+ rotXScale = rotYScale = rotZScale = 4;
+ rotXStep = rotYStep = 0x2000;
- spF6 = Fishing_SmoothStepToS(&this->actor.world.rot.y, spFC, sp134, this->unk_1B0) * 3.0f;
- Math_ApproachS(&this->actor.world.rot.x, spFE, sp134, this->unk_1B0 * 0.5f);
+ spF6 = Fishing_SmoothStepToS(&this->actor.world.rot.y, rotYtarget, rotXYScale, this->rotationStep) * 3.0f;
+ Math_ApproachS(&this->actor.world.rot.x, rotXTarget, rotXYScale, this->rotationStep * 0.5f);
- if (spF6 > 0x1F40) {
- spF6 = 0x1F40;
- } else if (spF6 < -0x1F40) {
- spF6 = -0x1F40;
+ if (spF6 > 8000) {
+ spF6 = 8000;
+ } else if (spF6 < -8000) {
+ spF6 = -8000;
}
if (this->actor.speed >= 3.2f) {
- Math_ApproachS(&this->unk_16E, spF6, 2, 0x4E20);
+ Math_ApproachS(&this->unk_16E, spF6, 2, 20000);
} else {
- Math_ApproachS(&this->unk_16E, spF6, 3, 0xBB8);
+ Math_ApproachS(&this->unk_16E, spF6, 3, 3000);
}
Actor_UpdateVelocityXYZ(&this->actor);
@@ -4070,25 +4090,25 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
this->actor.world.pos.y += (this->unk_184 * 1.5f);
if (this->unk_152 != 0) {
- this->unk_168 = this->unk_154;
+ this->rotationTarget.y = this->unk_154;
this->unk_152--;
if (this->unk_156 != 0) {
- spF0 = 5;
- spEE = 0x4000;
+ rotYScale = 5;
+ rotYStep = 0x4000;
} else {
- spF0 = 10;
- spEE = 0x800;
+ rotYScale = 10;
+ rotYStep = 0x800;
}
- this->unk_166 = -0x500 - this->actor.shape.rot.x;
- spF4 = 5;
- spF2 = 0x4000;
+ this->rotationTarget.x = -0x500 - this->actor.shape.rot.x;
+ rotXScale = 5;
+ rotXStep = 0x4000;
} else {
this->unk_156 = 0;
}
- Math_ApproachS(&this->unk_160, this->unk_166, spF4, spF2);
- Math_ApproachS(&this->unk_162, this->unk_168, spF0, spEE);
- Math_ApproachS(&this->unk_164, this->unk_16A, spFA, 0x2000);
+ Math_ApproachS(&this->unk_160, this->rotationTarget.x, rotXScale, rotXStep);
+ Math_ApproachS(&this->unk_162, this->rotationTarget.y, rotYScale, rotYStep);
+ Math_ApproachS(&this->unk_164, this->rotationTarget.z, rotZScale, 0x2000);
if (this->actor.speed <= 0.5f) {
Math_ApproachS(&this->actor.shape.rot.x, 0, 10, this->unk_178);
@@ -4100,37 +4120,37 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
this->actor.shape.rot.y = this->actor.world.rot.y;
- if ((this->unk_158 != -1) && (this->unk_158 != -2) && (this->unk_158 != -25)) {
+ if ((this->fishState != -1) && (this->fishState != -2) && (this->fishState != -25)) {
if ((this->actor.world.pos.y > WATER_SURFACE_Y(play)) && (this->actor.prevPos.y <= WATER_SURFACE_Y(play))) {
- func_80B70A2C(this, play, true);
- func_80B71278(this, 1);
+ Fishing_SplashBySize(this, play, true);
+ Fishing_FishLeapSfx(this, true);
this->unk_184 = this->actor.velocity.y;
this->actor.velocity.y = 0.0f;
- this->unk_16A = Rand_CenteredFloat(32768.0f);
+ this->rotationTarget.z = Rand_CenteredFloat(32768.0f);
} else if ((this->actor.world.pos.y < WATER_SURFACE_Y(play)) &&
(this->actor.prevPos.y >= WATER_SURFACE_Y(play))) {
if (this->unk_184 < -5.0f) {
this->unk_184 = -5.0f;
}
this->actor.world.rot.x = -0xFA0;
- func_80B70A2C(this, play, true);
- this->unk_1D2 = 20;
- func_80B71278(this, 0);
+ Fishing_SplashBySize(this, play, true);
+ this->bubbleTime = 20;
+ Fishing_FishLeapSfx(this, 0);
}
}
if ((this->actor.world.pos.y < WATER_SURFACE_Y(play)) &&
- (this->actor.world.pos.y > (WATER_SURFACE_Y(play) - 10.0f)) && ((this->unk_15C & 1) == 0) &&
+ (this->actor.world.pos.y > (WATER_SURFACE_Y(play) - 10.0f)) && ((this->stateAndTimer & 1) == 0) &&
(this->actor.speed > 0.0f)) {
Vec3f pos = this->actor.world.pos;
pos.y = WATER_SURFACE_Y(play);
Fishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &pos, 80.0f, 500.0f, 150, 90);
}
- if ((this->actor.speed > 0.0f) || (this->unk_158 == 5)) {
+ if ((this->actor.speed > 0.0f) || (this->fishState == 5)) {
f32 velocityY = this->actor.velocity.y;
- spD8 = this->unk_1AC * 0.1f;
+ spD8 = this->fishLength * 0.1f;
this->actor.world.pos.y -= spD8;
this->actor.prevPos.y -= spD8;
@@ -4143,7 +4163,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
this->actor.velocity.y = velocityY;
if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) {
- this->unk_1A0 = 20;
+ this->bumpTimer = 20;
}
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
@@ -4153,47 +4173,48 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
this->actor.velocity.z = this->actor.world.pos.z * -0.003f;
Actor_PlaySfx(&this->actor, NA_SE_EV_FISH_LEAP);
- func_80B70CF0(this, play);
+ Fishing_SplashBySize2(this, play);
+
if (Rand_ZeroOne() < 0.5f) {
- this->unk_16A = 0x4000;
+ this->rotationTarget.z = 0x4000;
} else {
- this->unk_16A = -0x4000;
+ this->rotationTarget.z = -0x4000;
}
if (Rand_ZeroOne() < 0.5f) {
- this->unk_166 = 0;
+ this->rotationTarget.x = 0;
} else {
- this->unk_166 = (s16)Rand_CenteredFloat(32.0f) + 0x8000;
+ this->rotationTarget.x = (s16)Rand_CenteredFloat(32.0f) + 0x8000;
}
- this->unk_168 = (s16)Rand_CenteredFloat(16384.0f);
+ this->rotationTarget.y = (s16)Rand_CenteredFloat(16384.0f);
this->unk_190 = 1.0f;
this->unk_194 = 5000.0f;
- this->unk_19C = 5000.0f;
+ this->fishLimbRotPhaseMag = 5000.0f;
} else {
this->unk_184 = 0.0f;
- if ((this->unk_158 == 5) && ((this->unk_15C & 1) == 0)) {
+ if ((this->fishState == 5) && ((this->stateAndTimer & 1) == 0)) {
Vec3f pos;
pos.x = Rand_CenteredFloat(10.0f) + this->actor.world.pos.x;
pos.z = Rand_CenteredFloat(10.0f) + this->actor.world.pos.z;
pos.y = this->actor.floorHeight + 5.0f;
Fishing_SpawnWaterDust(&this->actor.projectedPos, play->specialEffects, &pos,
- (this->unk_1AC * 0.005f) + 0.15f);
+ (this->fishLength * 0.005f) + 0.15f);
}
}
}
}
}
- if (this->unk_1D2 != 0) {
+ if (this->bubbleTime != 0) {
s16 i;
Vec3f pos;
- f32 range = (this->unk_1AC * 0.075f) + 10.0f;
+ f32 range = (this->fishLength * 0.075f) + 10.0f;
- this->unk_1D2--;
+ this->bubbleTime--;
for (i = 0; i < 2; i++) {
pos.x = Rand_CenteredFloat(range) + this->actor.world.pos.x;
@@ -4209,19 +4230,19 @@ s32 Fishing_FishOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve
Fishing* this = (Fishing*)thisx;
if (limbIndex == 0xD) {
- rot->z -= this->unk_170 - 11000;
+ rot->z -= this->fishLimbDRotZDelta - 11000;
} else if ((limbIndex == 2) || (limbIndex == 3)) {
- rot->y += this->unk_16C;
+ rot->y += this->fishLimb23RotYDelta;
} else if (limbIndex == 4) {
- rot->y += this->unk_176;
+ rot->y += this->fishLimb4RotYDelta;
} else if (limbIndex == 0xE) {
- rot->y -= this->unk_172;
+ rot->y -= this->fishLimbEFRotYDelta;
} else if (limbIndex == 0xF) {
- rot->y += this->unk_172;
+ rot->y += this->fishLimbEFRotYDelta;
} else if (limbIndex == 8) {
- rot->y += this->unk_174;
+ rot->y += this->fishLimb89RotYDelta;
} else if (limbIndex == 9) {
- rot->y -= this->unk_174;
+ rot->y -= this->fishLimb89RotYDelta;
}
return 0;
@@ -4239,11 +4260,11 @@ s32 Fishing_LoachOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, V
Fishing* this = (Fishing*)thisx;
if (limbIndex == 3) {
- rot->y += this->unk_1CC[0];
+ rot->y += this->loachRotYDelta[0];
} else if (limbIndex == 4) {
- rot->y += this->unk_1CC[1];
+ rot->y += this->loachRotYDelta[1];
} else if (limbIndex == 5) {
- rot->y += this->unk_1CC[2];
+ rot->y += this->loachRotYDelta[2];
}
return 0;
@@ -4269,15 +4290,15 @@ void Fishing_DrawFish(Actor* thisx, PlayState* play) {
Matrix_RotateZ(BINANG_TO_RAD_ALT(this->unk_164 + this->actor.shape.rot.z), MTXMODE_APPLY);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
- if (this->unk_150 == 0) {
- Matrix_RotateY(BINANG_TO_RAD(this->unk_16C) - (M_PI / 2), MTXMODE_APPLY);
- Matrix_Translate(0.0f, 0.0f, this->unk_16C * 10.0f * 0.01f, MTXMODE_APPLY);
+ if (this->isLoach == 0) {
+ Matrix_RotateY(BINANG_TO_RAD(this->fishLimb23RotYDelta) - (M_PI / 2), MTXMODE_APPLY);
+ Matrix_Translate(0.0f, 0.0f, this->fishLimb23RotYDelta * 10.0f * 0.01f, MTXMODE_APPLY);
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
Fishing_FishOverrideLimbDraw, Fishing_FishPostLimbDraw, this);
} else {
Matrix_Translate(0.0f, 0.0f, 3000.0f, MTXMODE_APPLY);
- Matrix_RotateY(BINANG_TO_RAD(this->unk_16C), MTXMODE_APPLY);
+ Matrix_RotateY(BINANG_TO_RAD(this->fishLimb23RotYDelta), MTXMODE_APPLY);
Matrix_Translate(0.0f, 0.0f, -3000.0f, MTXMODE_APPLY);
Matrix_RotateY(-(M_PI / 2), MTXMODE_APPLY);
@@ -4342,7 +4363,7 @@ void Fishing_UpdatePondProps(PlayState* play) {
actor = play->actorCtx.actorLists[ACTORCAT_NPC].head;
while (actor != NULL) {
- if (!((actor->id == ACTOR_FISHING) && (actor->params >= 100))) {
+ if (!((actor->id == ACTOR_FISHING) && (actor->params >= EN_FISH_PARAM))) {
actor = actor->next;
} else {
Fishing_HandleReedContact(prop, &actor->world.pos);
@@ -4356,10 +4377,10 @@ void Fishing_UpdatePondProps(PlayState* play) {
actor = play->actorCtx.actorLists[ACTORCAT_NPC].head;
while (actor != NULL) {
- if (!((actor->id == ACTOR_FISHING) && (actor->params >= 100))) {
+ if (!((actor->id == ACTOR_FISHING) && (actor->params >= EN_FISH_PARAM))) {
actor = actor->next;
} else {
- Fishing_HandleLilyPadContact(prop, &actor->world.pos, ((Fishing*)actor)->unk_151);
+ Fishing_HandleLilyPadContact(prop, &actor->world.pos, ((Fishing*)actor)->lilyTimer);
actor = actor->next;
}
}
@@ -4510,7 +4531,7 @@ void Fishing_UpdateGroupFishes(PlayState* play) {
f32 temp1;
f32 temp2;
- if ((D_80B7E114 != 0) || (D_80B7A694 == 4)) {
+ if ((D_80B7E114 != 0) || (sRodCastState == 4)) {
refPos = &sLurePos;
} else {
refPos = &player->actor.world.pos;
@@ -4526,7 +4547,7 @@ void Fishing_UpdateGroupFishes(PlayState* play) {
if ((SQ(temp1) + SQ(temp2)) < SQ(50.0f)) {
sFishGroupAngle1 += 0.3f;
groupContactFlags |= 1;
- } else if (D_80B7A898 != 0.0f) {
+ } else if (sFishGroupVar != 0.0f) {
sFishGroupAngle1 += 0.05f;
basePos[0].y = WATER_SURFACE_Y(play) - 5.0f;
} else {
@@ -4543,7 +4564,7 @@ void Fishing_UpdateGroupFishes(PlayState* play) {
if ((SQ(temp1) + SQ(temp2)) < SQ(50.0f)) {
sFishGroupAngle2 -= 0.3f;
groupContactFlags |= 2;
- } else if (D_80B7A898 != 0.0f) {
+ } else if (sFishGroupVar != 0.0f) {
sFishGroupAngle2 -= 0.05f;
basePos[1].y = WATER_SURFACE_Y(play) - 5.0f;
} else {
@@ -4560,7 +4581,7 @@ void Fishing_UpdateGroupFishes(PlayState* play) {
if ((SQ(temp1) + SQ(temp2)) < SQ(50.0f)) {
sFishGroupAngle3 -= 0.3f;
groupContactFlags |= 4;
- } else if (D_80B7A898 != 0.0f) {
+ } else if (sFishGroupVar != 0.0f) {
sFishGroupAngle3 -= 0.05f;
basePos[2].y = WATER_SURFACE_Y(play) - 5.0f;
} else {
@@ -4596,22 +4617,22 @@ void Fishing_UpdateGroupFishes(PlayState* play) {
groupFlag = 4;
}
- dx = fish->unk_10.x - fish->pos.x;
- dy = fish->unk_10.y - fish->pos.y;
- dz = fish->unk_10.z - fish->pos.z;
+ dx = fish->homePos.x - fish->pos.x;
+ dy = fish->homePos.y - fish->pos.y;
+ dz = fish->homePos.z - fish->pos.z;
spD4 = Math_Atan2S(dz, dx);
dist = sqrtf(SQ(dx) + SQ(dz));
spD6 = Math_Atan2S(dist, dy);
if ((dist < 10.0f) || (((fish->timer % 32) == 0) && (Rand_ZeroOne() > 0.5f))) {
- fish->unk_10.y = basePos[groupIndex].y + Rand_CenteredFloat(10.0f);
+ fish->homePos.y = basePos[groupIndex].y + Rand_CenteredFloat(10.0f);
- if (D_80B7A898 != 0.0f) {
- fish->unk_10.x = basePos[groupIndex].x + Rand_CenteredFloat(200.0f);
- fish->unk_10.z = basePos[groupIndex].z + Rand_CenteredFloat(200.0f);
+ if (sFishGroupVar != 0.0f) {
+ fish->homePos.x = basePos[groupIndex].x + Rand_CenteredFloat(200.0f);
+ fish->homePos.z = basePos[groupIndex].z + Rand_CenteredFloat(200.0f);
} else {
- fish->unk_10.x = basePos[groupIndex].x + Rand_CenteredFloat(100.0f);
- fish->unk_10.z = basePos[groupIndex].z + Rand_CenteredFloat(100.0f);
+ fish->homePos.x = basePos[groupIndex].x + Rand_CenteredFloat(100.0f);
+ fish->homePos.z = basePos[groupIndex].z + Rand_CenteredFloat(100.0f);
}
ripplePos = fish->pos;
@@ -4619,8 +4640,8 @@ void Fishing_UpdateGroupFishes(PlayState* play) {
Fishing_SpawnRipple(&fish->projectedPos, play->specialEffects, &ripplePos, 20.0f,
Rand_ZeroFloat(50.0f) + 100.0f, 150, 90);
- if (fish->unk_28 < 1.5f) {
- fish->unk_28 = 1.5f;
+ if (fish->velY < 1.5f) {
+ fish->velY = 1.5f;
}
fish->unk_34 = 1.5f;
@@ -4628,32 +4649,32 @@ void Fishing_UpdateGroupFishes(PlayState* play) {
}
target = Fishing_SmoothStepToS(&fish->unk_3E, spD4, 5, 0x4000) * 3.0f;
- if (target > 0x1F40) {
- target = 0x1F40;
- } else if (target < -0x1F40) {
- target = -0x1F40;
+ if (target > 8000) {
+ target = 8000;
+ } else if (target < -8000) {
+ target = -8000;
}
- Math_ApproachS(&fish->unk_42, target, 3, 0x1388);
+ Math_ApproachS(&fish->unk_42, target, 3, 5000);
offset = fish->unk_42 * -0.0001f;
Math_ApproachS(&fish->unk_3C, spD6, 5, 0x4000);
if (groupContactFlags & groupFlag) {
fish->unk_38 = 1.0f;
- fish->unk_28 = 6.0f;
+ fish->velY = 6.0f;
fish->unk_34 = 2.0f;
}
- if (D_80B7A898 != 0.0f) {
+ if (sFishGroupVar != 0.0f) {
fish->unk_38 = 1.0f;
- fish->unk_28 = 4.0f;
+ fish->velY = 4.0f;
fish->unk_34 = 2.0f;
}
- Math_ApproachF(&fish->unk_28, 0.75f, 1.0f, 0.05f);
+ Math_ApproachF(&fish->velY, 0.75f, 1.0f, 0.05f);
- temp1 = fish->unk_28 * spD8;
+ temp1 = fish->velY * spD8;
temp2 = Math_CosS(fish->unk_3C) * temp1;
fish->pos.x += temp2 * Math_SinS(fish->unk_3E);
@@ -4664,14 +4685,14 @@ void Fishing_UpdateGroupFishes(PlayState* play) {
Math_ApproachF(&fish->unk_34, 1.0f, 1.0f, 0.1f);
Math_ApproachF(&fish->unk_38, 0.4f, 1.0f, 0.04f);
fish->unk_30 += fish->unk_34;
- fish->unk_2C = (cosf(fish->unk_30) * fish->unk_38) + offset;
+ fish->scaleX = (cosf(fish->unk_30) * fish->unk_38) + offset;
}
}
fish++;
}
- D_80B7A898 = 0.0f;
+ sFishGroupVar = 0.0f;
}
void Fishing_DrawGroupFishes(PlayState* play) {
@@ -4703,7 +4724,7 @@ void Fishing_DrawGroupFishes(PlayState* play) {
Matrix_Translate(fish->pos.x, fish->pos.y, fish->pos.z, MTXMODE_NEW);
Matrix_RotateY(BINANG_TO_RAD_ALT2((f32)fish->unk_3E), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT2(-(f32)fish->unk_3C), MTXMODE_APPLY);
- Matrix_Scale(fish->unk_2C * scale, scale, scale, MTXMODE_APPLY);
+ Matrix_Scale(fish->scaleX * scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 8093),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -4716,14 +4737,15 @@ void Fishing_DrawGroupFishes(PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 8099);
}
-static u16 D_80B7AFB8[] = { 0x4096, 0x408D, 0x408E, 0x408F, 0x4094, 0x4095 };
+static u16 sPondOwnerTextIds[] = { 0x4096, 0x408D, 0x408E, 0x408F, 0x4094, 0x4095 };
void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) {
- switch (this->unk_15C) {
+ switch (this->stateAndTimer) {
case 0:
- if (D_80B7E0AC == 0) {
+ if (sFishingPlayingState == 0) {
if (sLinkAge != LINK_AGE_CHILD) {
- if ((HIGH_SCORE(HS_FISHING) & 0x100) && !(HIGH_SCORE(HS_FISHING) & 0x200)) {
+ if ((HIGH_SCORE(HS_FISHING) & HS_FISH_PLAYED_CHILD) &&
+ !(HIGH_SCORE(HS_FISHING) & HS_FISH_PLAYED_ADULT)) {
this->actor.textId = 0x4093;
} else {
this->actor.textId = 0x407B;
@@ -4731,22 +4753,22 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) {
} else {
this->actor.textId = 0x407B;
}
- } else if (D_80B7A68C == 0) {
+ } else if (!sIsOwnersHatHooked) {
this->actor.textId = 0x4084;
} else {
this->actor.textId = 0x4097;
}
if (Actor_ProcessTalkRequest(&this->actor, play)) {
- if (D_80B7E0AC == 0) {
- this->unk_15C = 1;
+ if (sFishingPlayingState == 0) {
+ this->stateAndTimer = 1;
if (sLinkAge != LINK_AGE_CHILD) {
- HIGH_SCORE(HS_FISHING) |= 0x200;
+ HIGH_SCORE(HS_FISHING) |= HS_FISH_PLAYED_ADULT;
} else {
- HIGH_SCORE(HS_FISHING) |= 0x100;
+ HIGH_SCORE(HS_FISHING) |= HS_FISH_PLAYED_CHILD;
}
} else {
- this->unk_15C = 10;
+ this->stateAndTimer = 10;
}
} else {
func_8002F2CC(&this->actor, play, 100.0f);
@@ -4767,15 +4789,15 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) {
this->actor.textId = 0x407D;
}
Message_ContinueTextbox(play, this->actor.textId);
- this->unk_15C = 2;
+ this->stateAndTimer = 2;
} else {
Message_ContinueTextbox(play, 0x407E);
- this->unk_15C = 3;
+ this->stateAndTimer = 3;
}
break;
case 1:
Message_ContinueTextbox(play, 0x2D);
- this->unk_15C = 3;
+ this->stateAndTimer = 3;
break;
}
}
@@ -4785,17 +4807,17 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
Message_ContinueTextbox(play, 0x407F);
- this->unk_15C = 4;
+ this->stateAndTimer = 4;
}
break;
case 3:
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
- this->unk_15C = 0;
+ this->stateAndTimer = 0;
}
if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) {
- this->unk_15C = 0;
+ this->stateAndTimer = 0;
}
break;
@@ -4805,9 +4827,9 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) {
switch (play->msgCtx.choiceIndex) {
case 0:
- D_80B7A678 = D_80B7E078;
+ sFishLengthToWeigh = sFishingRecordLength;
Message_ContinueTextbox(play, 0x4080);
- this->unk_15C = 5;
+ this->stateAndTimer = 5;
break;
case 1:
Message_ContinueTextbox(play, 0x407F);
@@ -4822,30 +4844,30 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) {
play->interfaceCtx.unk_260 = 1;
play->startPlayerFishing(play);
- D_80B7E0AC = 1;
- D_80B7A684 = 20;
- this->unk_15C = 0;
+ sFishingPlayingState = 1;
+ sOwnerTheftTimer = 20;
+ this->stateAndTimer = 0;
if ((HIGH_SCORE(HS_FISHING) & 0xFF0000) < 0xFF0000) {
- HIGH_SCORE(HS_FISHING) += 0x10000;
+ HIGH_SCORE(HS_FISHING) += HS_FISH_PLAYED;
}
}
break;
case 10:
- if (D_80B7A68C != 0) {
+ if (sIsOwnersHatHooked) { // owner asks for hat back
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
switch (play->msgCtx.choiceIndex) {
case 0:
Message_ContinueTextbox(play, 0x40B2);
- D_80B7A688 = 1;
- D_80B7A68C = 0;
- this->unk_15C = 20;
+ sOwnerHair = FS_OWNER_CAPPED;
+ sIsOwnersHatHooked = false;
+ this->stateAndTimer = 20;
break;
case 1:
- this->unk_15C = 0;
+ this->stateAndTimer = 0;
break;
}
}
@@ -4855,73 +4877,74 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) {
switch (play->msgCtx.choiceIndex) {
case 0:
- if (D_80B7A670 == 0.0f) {
+ if (sFishOnHandLength == 0.0f) {
this->actor.textId = 0x408C;
- this->unk_15C = 20;
- } else if (D_80B7E07C == 0) {
- D_80B7A678 = D_80B7A670;
- if ((s16)D_80B7E078 < (s16)D_80B7A670) {
- if (D_80B7E07E == 2) {
+ this->stateAndTimer = 20;
+ } else if (sFishOnHandIsLoach == 0) {
+ sFishLengthToWeigh = sFishOnHandLength;
+ if ((s16)sFishingRecordLength < (s16)sFishOnHandLength) {
+ if (sLureCaughtWith == FS_LURE_SINKING) {
this->actor.textId = 0x40B0;
} else {
this->actor.textId = 0x4086;
}
- this->unk_15C = 11;
+ this->stateAndTimer = 11;
} else {
this->actor.textId = 0x408B;
- this->unk_15C = 20;
+ this->stateAndTimer = 20;
}
} else {
this->actor.textId = 0x409B;
- this->unk_15C = 11;
+ this->stateAndTimer = 11;
}
Message_ContinueTextbox(play, this->actor.textId);
break;
case 1:
- if (D_80B7A680 > 36000) {
- D_80B7A680 = 30000;
+ if (sFishingTimePlayed > 36000) {
+ sFishingTimePlayed = 30000;
Message_ContinueTextbox(play, 0x4088);
} else {
- if (D_80B7E076 == 0) {
- if (D_80B7E082 == 0) {
- D_80B7E082++;
+ if (sFishingFoggy == 0) {
+ if (sPondOwnerTextIdIndex == 0) {
+ sPondOwnerTextIdIndex++;
}
}
- if ((D_80B7E0B6 == 2) && (D_80B7AFB8[D_80B7E082] == 0x408D)) {
+ if ((sLureEquipped == FS_LURE_SINKING) &&
+ (sPondOwnerTextIds[sPondOwnerTextIdIndex] == 0x408D)) {
Message_ContinueTextbox(play, 0x40AF);
} else {
- Message_ContinueTextbox(play, D_80B7AFB8[D_80B7E082]);
+ Message_ContinueTextbox(play, sPondOwnerTextIds[sPondOwnerTextIdIndex]);
}
- D_80B7E082++;
+ sPondOwnerTextIdIndex++;
if (sLinkAge != LINK_AGE_CHILD) {
- if (D_80B7E082 >= 6) {
- D_80B7E082 = 0;
+ if (sPondOwnerTextIdIndex >= 6) {
+ sPondOwnerTextIdIndex = 0;
}
} else {
- if (D_80B7E082 >= 4) {
- D_80B7E082 = 0;
+ if (sPondOwnerTextIdIndex >= 4) {
+ sPondOwnerTextIdIndex = 0;
}
}
}
- this->unk_15C = 0;
+ this->stateAndTimer = 0;
break;
case 2:
- if (D_80B7E084 == 0) {
+ if (sFishesCaught == 0) {
Message_ContinueTextbox(play, 0x4085);
} else if (sLinkAge == LINK_AGE_CHILD) {
Message_ContinueTextbox(play, 0x4092);
}
- this->unk_15C = 22;
+ this->stateAndTimer = 22;
break;
}
}
}
break;
- case 11:
+ case 11: // collect prize, update record.
if (((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) ||
(Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) &&
Message_ShouldAdvance(play)) {
@@ -4929,80 +4952,81 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) {
Message_CloseTextbox(play);
- if (D_80B7E07C == 0) {
- D_80B7E078 = D_80B7A670;
- D_80B7A670 = 0.0f;
+ if (sFishOnHandIsLoach == 0) {
+ sFishingRecordLength = sFishOnHandLength;
+ sFishOnHandLength = 0.0f;
if (sLinkAge == LINK_AGE_CHILD) {
f32 temp;
HIGH_SCORE(HS_FISHING) &= 0xFFFFFF00;
- HIGH_SCORE(HS_FISHING) |= (s32)D_80B7E078 & 0x7F;
+ HIGH_SCORE(HS_FISHING) |= (s32)sFishingRecordLength & HS_FISH_LENGTH_CHILD;
- temp = (HIGH_SCORE(HS_FISHING) & 0x7F000000) >> 0x18;
- if (temp < D_80B7E078) {
+ temp = (HIGH_SCORE(HS_FISHING) & HS_FISH_LENGTH_ADULT) >> 0x18;
+ if (temp < sFishingRecordLength) {
HIGH_SCORE(HS_FISHING) &= 0xFFFFFF;
- HIGH_SCORE(HS_FISHING) |= ((s32)D_80B7E078 & 0x7F) << 0x18;
+ HIGH_SCORE(HS_FISHING) |= ((s32)sFishingRecordLength & HS_FISH_LENGTH_CHILD) << 0x18;
- if (D_80B7E07E == 2) {
- HIGH_SCORE(HS_FISHING) |= 0x80000000;
+ if (sLureCaughtWith == FS_LURE_SINKING) {
+ HIGH_SCORE(HS_FISHING) |= HS_FISH_CHEAT_ADULT;
}
}
- if (D_80B7E07E == 2) {
- HIGH_SCORE(HS_FISHING) |= 0x80;
- this->unk_15C = 0;
+ if (sLureCaughtWith == FS_LURE_SINKING) {
+ HIGH_SCORE(HS_FISHING) |= HS_FISH_CHEAT_CHILD;
+ this->stateAndTimer = 0;
break;
}
} else {
HIGH_SCORE(HS_FISHING) &= 0xFFFFFF;
- HIGH_SCORE(HS_FISHING) |= ((s32)D_80B7E078 & 0x7F) << 0x18;
+ HIGH_SCORE(HS_FISHING) |= ((s32)sFishingRecordLength & HS_FISH_LENGTH_CHILD) << 0x18;
- if (D_80B7E07E == 2) {
- HIGH_SCORE(HS_FISHING) |= 0x80000000;
- this->unk_15C = 0;
+ if (sLureCaughtWith == FS_LURE_SINKING) {
+ HIGH_SCORE(HS_FISHING) |= HS_FISH_CHEAT_ADULT;
+ this->stateAndTimer = 0;
break;
}
}
- if (D_80B7E078 >= 60.0f) {
+ if (sFishingRecordLength >= 60.0f) { // 13 lbs
getItemId = GI_RUPEE_PURPLE;
- } else if (D_80B7E078 >= 50.0f) {
+ } else if (sFishingRecordLength >= 50.0f) { // 9 lbs
getItemId = GI_RUPEE_RED;
- } else if (D_80B7E078 >= 40.0f) {
+ } else if (sFishingRecordLength >= 40.0f) { // 6 lbs
getItemId = GI_RUPEE_BLUE;
} else {
getItemId = GI_RUPEE_GREEN;
}
- if (sLinkAge == LINK_AGE_CHILD) {
- if ((D_80B7E078 >= 50.0f) && !(HIGH_SCORE(HS_FISHING) & 0x400)) {
- HIGH_SCORE(HS_FISHING) |= 0x400;
+ if (sLinkAge == LINK_AGE_CHILD) { // 9 lbs
+ if ((sFishingRecordLength >= 50.0f) && !(HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_CHILD)) {
+ HIGH_SCORE(HS_FISHING) |= HS_FISH_PRIZE_CHILD;
getItemId = GI_HEART_PIECE;
sSinkingLureLocation = (u8)Rand_ZeroFloat(3.999f) + 1;
}
- } else {
- if ((D_80B7E078 >= 60.0f) && !(HIGH_SCORE(HS_FISHING) & 0x800)) {
- HIGH_SCORE(HS_FISHING) |= 0x800;
+ } else { // 13 lbs
+ if ((sFishingRecordLength >= 60.0f) && !(HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_ADULT)) {
+ HIGH_SCORE(HS_FISHING) |= HS_FISH_PRIZE_ADULT;
getItemId = GI_SCALE_GOLDEN;
sSinkingLureLocation = (u8)Rand_ZeroFloat(3.999f) + 1;
}
}
} else {
getItemId = GI_RUPEE_PURPLE;
- D_80B7A670 = 0.0f;
+ sFishOnHandLength = 0.0f; // doesn't record loach
}
this->actor.parent = NULL;
+
Actor_OfferGetItem(&this->actor, play, getItemId, 2000.0f, 1000.0f);
- this->unk_15C = 23;
+ this->stateAndTimer = 23;
}
break;
case 20:
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
- this->unk_15C = 0;
+ this->stateAndTimer = 0;
}
break;
@@ -5012,15 +5036,15 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) {
switch (play->msgCtx.choiceIndex) {
case 0:
- this->unk_15C = 0;
+ this->stateAndTimer = 0;
break;
case 1:
- if (D_80B7E084 == 0) {
+ if (sFishesCaught == 0) {
Message_ContinueTextbox(play, 0x4085);
} else if (sLinkAge == LINK_AGE_CHILD) {
Message_ContinueTextbox(play, 0x4092);
}
- this->unk_15C = 22;
+ this->stateAndTimer = 22;
break;
}
}
@@ -5030,56 +5054,56 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) {
if (play) {}
if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) {
- this->unk_15C = 0;
- if (D_80B7A68C != 0) {
- D_80B7A688 = 1;
- D_80B7A68C = 0;
+ this->stateAndTimer = 0;
+ if (sIsOwnersHatHooked) {
+ sOwnerHair = FS_OWNER_CAPPED;
+ sIsOwnersHatHooked = false;
}
- D_80B7E0AC = 0;
+ sFishingPlayingState = 0;
play->interfaceCtx.unk_260 = 0;
}
break;
case 23:
- D_80B7A674 = false;
+ sIsRodVisible = false;
if (Actor_HasParent(&this->actor, play)) {
- this->unk_15C = 24;
+ this->stateAndTimer = 24;
} else {
Actor_OfferGetItem(&this->actor, play, GI_SCALE_GOLDEN, 2000.0f, 1000.0f);
}
break;
case 24:
- D_80B7A674 = false;
+ sIsRodVisible = false;
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) {
- if (D_80B7E07C == 0) {
- this->unk_15C = 0;
+ if (sFishOnHandIsLoach == 0) {
+ this->stateAndTimer = 0;
} else {
Message_StartTextbox(play, 0x409C, NULL);
- this->unk_15C = 20;
+ this->stateAndTimer = 20;
}
}
break;
}
}
-static s16 D_80B7AFC4[] = { 0, 1, 2, 2, 1 };
+static s16 sOwnerBlinkIndex[] = { 0, 1, 2, 2, 1 };
static Vec3f sStreamSfxPos = { 670.0f, 0.0f, -600.0f };
-static Vec3s sSinkingLureLocationPos[] = {
- { -364, -30, -269 },
- { 1129, 3, -855 },
- { -480, 0, -1055 },
- { 553, -48, -508 },
+static Vec3s sSinkingLureLocations[] = {
+ { -364, -30, -269 }, // in the pond, log past the lilies.
+ { 1129, 3, -855 }, // rock next to stream
+ { -480, 0, -1055 }, // wall opposite of entrance
+ { 553, -48, -508 }, // tip of log beside 3 posts
};
void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
Fishing* this = (Fishing*)thisx;
- Vec3f sp114;
- Vec3f sp108;
- Vec3f spFC;
+ Vec3f multiVecSrc;
+ Vec3f eyeTarget;
+ Vec3f lureDist;
s16 headRotTarget;
s16 playerShadowAlpha;
f32 target;
@@ -5110,7 +5134,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
SkelAnime_Update(&this->skelAnime);
- if ((D_80B7A684 != 0) || (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE)) {
+ if ((sOwnerTheftTimer != 0) || (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE)) {
this->actor.flags &= ~ACTOR_FLAG_0;
} else {
this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_5;
@@ -5122,88 +5146,92 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
headRotTarget = 0;
}
- if (headRotTarget > 0x2710) {
- headRotTarget = 0x2710;
- } else if (headRotTarget < -0x2710) {
- headRotTarget = -0x2710;
+ if (headRotTarget > 10000) {
+ headRotTarget = 10000;
+ } else if (headRotTarget < -10000) {
+ headRotTarget = -10000;
}
- Math_ApproachS(&this->unk_164, headRotTarget, 3, 0x1388);
+ Math_ApproachS(&this->unk_164, headRotTarget, 3, 5000);
if (((play->gameplayFrames % 32) == 0) && (Rand_ZeroOne() < 0.3f)) {
this->unk_162 = 4;
}
- this->unk_160 = D_80B7AFC4[this->unk_162];
+ this->unk_160 = sOwnerBlinkIndex[this->unk_162];
if (this->unk_162 != 0) {
this->unk_162--;
}
- if (D_80B7A684 != 0) {
- D_80B7A684--;
+ if (sOwnerTheftTimer != 0) {
+ sOwnerTheftTimer--;
}
- if ((D_80B7A68C == 0) && (D_80B7E0B6 != 2) && (D_80B7A694 > 0) && (D_80B7A688 == 1) && (D_80B7A684 == 0)) {
+ // steal the owner's hat
+ if (!sIsOwnersHatHooked && (sLureEquipped != FS_LURE_SINKING) && (sRodCastState > 0) &&
+ (sOwnerHair == FS_OWNER_CAPPED) && (sOwnerTheftTimer == 0)) {
f32 dx = sOwnerHeadPos.x - sLurePos.x;
f32 dy = sOwnerHeadPos.y - sLurePos.y;
f32 dz = sOwnerHeadPos.z - sLurePos.z;
if ((sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < 25.0f) || (KREG(77) > 0)) {
KREG(77) = 0;
- D_80B7A688 = 0;
- D_80B7A68C = 1;
+ sOwnerHair = FS_OWNER_BALD;
+ sIsOwnersHatHooked = true;
Message_StartTextbox(play, 0x4087, NULL);
}
}
- if (D_80B7A688 == 0) {
- HIGH_SCORE(HS_FISHING) |= 0x1000;
- } else if (D_80B7A688 == 1) {
- HIGH_SCORE(HS_FISHING) &= ~0x1000;
+ // update hat flag.
+ if (sOwnerHair == FS_OWNER_BALD) {
+ HIGH_SCORE(HS_FISHING) |= HS_FISH_STOLE_HAT;
+ } else if (sOwnerHair == FS_OWNER_CAPPED) {
+ HIGH_SCORE(HS_FISHING) &= ~HS_FISH_STOLE_HAT;
}
if (KREG(77) < 0) {
KREG(77) = 0;
- D_80B7A690 = 1;
+ sIsOwnersHatSunk = true;
}
- if (D_80B7A67C != 0) {
- D_80B7A67C--;
- if (D_80B7A67C == 0) {
- Message_StartTextbox(play, D_80B7E086, NULL);
+ if (sFishingCaughtTextDelay != 0) {
+ sFishingCaughtTextDelay--;
+ if (sFishingCaughtTextDelay == 0) {
+ Message_StartTextbox(play, sFishingCaughtTextId, NULL);
}
}
Fishing_HandleOwnerDialog(this, play);
- D_80B7E14C = 0.0015f;
- D_80B7A680++;
+ sFishingLineScale = 0.0015f;
+ sFishingTimePlayed++;
- if ((D_80B7E0AC != 0) && D_80B7A674) {
+ if ((sFishingPlayingState != 0) && sIsRodVisible) {
Fishing_UpdateLure(this, play);
}
Fishing_UpdateEffects(play->specialEffects, play);
Fishing_UpdatePondProps(play);
Fishing_UpdateGroupFishes(play);
-
- if ((D_80B7E0AC != 0) && (D_80B7A6CC == 0) && (player->actor.world.pos.z > 1360.0f) &&
+ // can't leave with the rod
+ if ((sFishingPlayingState != 0) && (sFishingPlayerCinematicState == 0) && (player->actor.world.pos.z > 1360.0f) &&
(fabsf(player->actor.world.pos.x) < 25.0f)) {
player->actor.world.pos.z = 1360.0f;
player->actor.speed = 0.0f;
- if (D_80B7A6D0 == 0) {
- D_80B7A6CC = 10;
+ if (sFishingCinematicTimer == 0) {
+ sFishingPlayerCinematicState = 10;
}
}
+ // check if can/have found sinking lure.
if ((sSinkingLureLocation != 0) &&
- (fabsf(player->actor.world.pos.x - sSinkingLureLocationPos[sSinkingLureLocation - 1].x) < 25.0f) &&
- (fabsf(player->actor.world.pos.y - sSinkingLureLocationPos[sSinkingLureLocation - 1].y) < 10.0f) &&
- (fabsf(player->actor.world.pos.z - sSinkingLureLocationPos[sSinkingLureLocation - 1].z) < 25.0f)) {
+ (fabsf(player->actor.world.pos.x - sSinkingLureLocations[sSinkingLureLocation - 1].x) < 25.0f) &&
+ (fabsf(player->actor.world.pos.y - sSinkingLureLocations[sSinkingLureLocation - 1].y) < 10.0f) &&
+ (fabsf(player->actor.world.pos.z - sSinkingLureLocations[sSinkingLureLocation - 1].z) < 25.0f)) {
sSinkingLureLocation = 0;
- D_80B7A6CC = 20;
+ sFishingPlayerCinematicState = 20;
Rumble_Override(0.0f, 150, 10, 10);
Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20);
@@ -5211,18 +5239,19 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
if (KREG(0) != 0) {
KREG(0) = 0;
- D_80B7E0B6 = 0;
- D_80B7A6CC = 20;
+ sLureEquipped = FS_LURE_STOCK;
+ sFishingPlayerCinematicState = 20;
Rumble_Override(0.0f, 150, 10, 10);
Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20);
}
- if (D_80B7A6D0 != 0) {
- D_80B7A6D0--;
+ if (sFishingCinematicTimer != 0) {
+ sFishingCinematicTimer--;
}
- switch (D_80B7A6CC) {
+ // handle cinematics (i.e.: catching fish, finding sinking lure)
+ switch (sFishingPlayerCinematicState) {
case 0:
break;
@@ -5239,7 +5268,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
sSubCamAt.x = mainCam->at.x;
sSubCamAt.y = mainCam->at.y;
sSubCamAt.z = mainCam->at.z;
- D_80B7A6CC = 2;
+ sFishingPlayerCinematicState = 2;
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_B_MINIMAP);
sSubCamVelFactor = 0.0f;
FALLTHROUGH;
@@ -5248,50 +5277,50 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
case 2:
Letterbox_SetSizeTarget(27);
- spFC.x = sLurePos.x - player->actor.world.pos.x;
- spFC.z = sLurePos.z - player->actor.world.pos.z;
- lureDistXZ = sqrtf(SQXZ(spFC));
- Matrix_RotateY(Math_Atan2F(spFC.z, spFC.x), MTXMODE_NEW);
+ lureDist.x = sLurePos.x - player->actor.world.pos.x;
+ lureDist.z = sLurePos.z - player->actor.world.pos.z;
+ lureDistXZ = sqrtf(SQXZ(lureDist));
+ Matrix_RotateY(Math_Atan2F(lureDist.z, lureDist.x), MTXMODE_NEW);
- sp114.x = 0.0f;
- sp114.y = 0.0f;
- sp114.z = 100.0f;
- Matrix_MultVec3f(&sp114, &spFC);
+ multiVecSrc.x = 0.0f;
+ multiVecSrc.y = 0.0f;
+ multiVecSrc.z = 100.0f;
+ Matrix_MultVec3f(&multiVecSrc, &lureDist);
- if (D_80B7A694 == 1) {
+ if (sRodCastState == 1) {
subCamAtMaxVelFrac = 0.2f;
} else {
subCamAtMaxVelFrac = 0.1f;
}
- Math_ApproachF(&sSubCamAt.x, sLurePos.x, subCamAtMaxVelFrac, fabsf(spFC.x) * sSubCamVelFactor);
+ Math_ApproachF(&sSubCamAt.x, sLurePos.x, subCamAtMaxVelFrac, fabsf(lureDist.x) * sSubCamVelFactor);
Math_ApproachF(&sSubCamAt.y, sLurePos.y, subCamAtMaxVelFrac, 50.0f * sSubCamVelFactor);
- Math_ApproachF(&sSubCamAt.z, sLurePos.z, subCamAtMaxVelFrac, fabsf(spFC.z) * sSubCamVelFactor);
+ Math_ApproachF(&sSubCamAt.z, sLurePos.z, subCamAtMaxVelFrac, fabsf(lureDist.z) * sSubCamVelFactor);
- sp114.x = 0.0f - D_80B7FED0;
+ multiVecSrc.x = 0.0f - D_80B7FED0;
if (sLinkAge != LINK_AGE_CHILD) {
- sp114.y = 80.0f;
+ multiVecSrc.y = 80.0f;
} else {
- sp114.y = 55.0f;
+ multiVecSrc.y = 55.0f;
}
- sp114.z = -80.0f;
+ multiVecSrc.z = -80.0f;
- Matrix_MultVec3f(&sp114, &sp108);
- sp108.x += player->actor.world.pos.x;
- sp108.y += player->actor.world.pos.y;
- sp108.z += player->actor.world.pos.z;
+ Matrix_MultVec3f(&multiVecSrc, &eyeTarget);
+ eyeTarget.x += player->actor.world.pos.x;
+ eyeTarget.y += player->actor.world.pos.y;
+ eyeTarget.z += player->actor.world.pos.z;
Math_ApproachF(&D_80B7FED0, 30.0f, 0.1f, 0.4f);
- if (CHECK_BTN_ALL(input->press.button, BTN_Z)) {
- if ((D_80B7E088 >= 0) && (D_80B7E122 == 0)) {
- D_80B7E088++;
+ if (CHECK_BTN_ALL(input->press.button, BTN_Z)) { // zoom in/out from the lure
+ if ((sLureCameraZoomLevel >= 0) && (sLureBitTimer == 0)) {
+ sLureCameraZoomLevel++;
- if (D_80B7E088 >= 4) {
- D_80B7E088 = 0;
+ if (sLureCameraZoomLevel >= 4) {
+ sLureCameraZoomLevel = 0;
}
- if ((D_80B7E088 == 0) || (D_80B7E088 == 3)) {
+ if ((sLureCameraZoomLevel == 0) || (sLureCameraZoomLevel == 3)) {
Sfx_PlaySfxCentered(NA_SE_SY_CAMERA_ZOOM_DOWN);
} else {
Sfx_PlaySfxCentered(NA_SE_SY_CAMERA_ZOOM_UP);
@@ -5299,44 +5328,44 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
}
}
- if (D_80B7A694 >= 3) {
+ if (sRodCastState >= 3) {
if (lureDistXZ < 110.0f) {
- D_80B7E088 = -1;
- } else if ((lureDistXZ > 300.0f) && (D_80B7E088 < 0)) {
- D_80B7E088 = 0;
+ sLureCameraZoomLevel = -1;
+ } else if ((lureDistXZ > 300.0f) && (sLureCameraZoomLevel < 0)) {
+ sLureCameraZoomLevel = 0;
}
}
- if (D_80B7E088 > 0) {
+ if (sLureCameraZoomLevel > 0) {
f32 dist;
f32 offset;
f32 factor;
- dist = sqrtf(SQ(spFC.x) + SQ(spFC.z)) * 0.001f;
+ dist = sqrtf(SQ(lureDist.x) + SQ(lureDist.z)) * 0.001f;
if (dist > 1.0f) {
dist = 1.0f;
}
- if (D_80B7E088 == 2) {
+ if (sLureCameraZoomLevel == 2) {
offset = 0.3f;
} else {
offset = 0.1f;
}
factor = 0.4f + offset + (dist * 0.4f);
- sp108.x += (sLurePos.x - sp108.x) * factor;
- sp108.y += ((sLurePos.y - sp108.y) * factor) + 20.0f;
- sp108.z += (sLurePos.z - sp108.z) * factor;
- D_80B7E14C = 0.0005000001f;
+ eyeTarget.x += (sLurePos.x - eyeTarget.x) * factor;
+ eyeTarget.y += ((sLurePos.y - eyeTarget.y) * factor) + 20.0f;
+ eyeTarget.z += (sLurePos.z - eyeTarget.z) * factor;
+ sFishingLineScale = 0.0005000001f;
}
- sp114.x = 0.0f;
- sp114.y = 0.0f;
- sp114.z = 100.0f;
- Matrix_MultVec3f(&sp114, &spFC);
+ multiVecSrc.x = 0.0f;
+ multiVecSrc.y = 0.0f;
+ multiVecSrc.z = 100.0f;
+ Matrix_MultVec3f(&multiVecSrc, &lureDist);
- Math_ApproachF(&sSubCamEye.x, sp108.x, 0.3f, fabsf(spFC.x) * sSubCamVelFactor);
- Math_ApproachF(&sSubCamEye.y, sp108.y, 0.3f, 20.0f * sSubCamVelFactor);
- Math_ApproachF(&sSubCamEye.z, sp108.z, 0.3f, fabsf(spFC.z) * sSubCamVelFactor);
+ Math_ApproachF(&sSubCamEye.x, eyeTarget.x, 0.3f, fabsf(lureDist.x) * sSubCamVelFactor);
+ Math_ApproachF(&sSubCamEye.y, eyeTarget.y, 0.3f, 20.0f * sSubCamVelFactor);
+ Math_ApproachF(&sSubCamEye.z, eyeTarget.z, 0.3f, fabsf(lureDist.z) * sSubCamVelFactor);
break;
case 3: {
@@ -5347,7 +5376,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
mainCam->at = sSubCamAt;
Play_ReturnToMainCam(play, sSubCamId, 0);
Cutscene_StopManual(play, &play->csCtx);
- D_80B7A6CC = 0;
+ sFishingPlayerCinematicState = 0;
sSubCamId = SUB_CAM_ID_DONE;
Environment_EnableUnderwaterLights(play, 0);
play->envCtx.adjFogNear = 0;
@@ -5356,7 +5385,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
break;
}
- case 10: {
+ case 10: { // owner tells you to return the rod.
Camera* mainCam;
Cutscene_StartManual(play, &play->csCtx);
@@ -5372,7 +5401,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
sSubCamAt.y = mainCam->at.y;
sSubCamAt.z = mainCam->at.z;
Message_StartTextbox(play, 0x409E, NULL);
- D_80B7A6CC = 11;
+ sFishingPlayerCinematicState = 11;
Rumble_Override(0.0f, 150, 10, 10);
FALLTHROUGH;
}
@@ -5390,15 +5419,16 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
Play_ReturnToMainCam(play, sSubCamId, 0);
Cutscene_StopManual(play, &play->csCtx);
func_8002DF54(play, &this->actor, PLAYER_CSMODE_7);
- D_80B7A6CC = 0;
+ sFishingPlayerCinematicState = 0;
+
sSubCamId = SUB_CAM_ID_DONE;
- D_80B7A6D0 = 30;
+ sFishingCinematicTimer = 30;
Environment_EnableUnderwaterLights(play, 0);
play->envCtx.adjFogNear = 0;
}
break;
- case 20: {
+ case 20: { // found the sinking lure
Camera* mainCam;
Cutscene_StartManual(play, &play->csCtx);
@@ -5414,57 +5444,57 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
sSubCamAt.y = mainCam->at.y;
sSubCamAt.z = mainCam->at.z;
Message_StartTextbox(play, 0x409A, NULL);
- D_80B7A6CC = 21;
- D_80B7FEC8 = 45.0f;
- D_80B7A6D0 = 10;
+ sFishingPlayerCinematicState = 21;
+ sCatchCamX = 45.0f;
+ sFishingCinematicTimer = 10;
FALLTHROUGH;
}
case 21:
- if ((D_80B7A6D0 == 0) && Message_ShouldAdvance(play)) {
- D_80B7A6CC = 22;
- D_80B7A6D0 = 40;
+ if ((sFishingCinematicTimer == 0) && Message_ShouldAdvance(play)) {
+ sFishingPlayerCinematicState = 22;
+ sFishingCinematicTimer = 40;
func_8002DF54(play, &this->actor, PLAYER_CSMODE_28);
- D_80B7FEE4 = 0.0f;
+ sSinkingLureHeldY = 0.0f;
}
break;
case 22:
- if (D_80B7A6D0 == 30) {
+ if (sFishingCinematicTimer == 30) {
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 9, NA_BGM_ITEM_GET);
}
- D_80B7A6D4 = 1;
+ sSinkingLureFound = true;
- Math_ApproachF(&D_80B7FEE4, 71.0f, 0.5f, 3.0f);
+ Math_ApproachF(&sSinkingLureHeldY, 71.0f, 0.5f, 3.0f);
Matrix_RotateY(BINANG_TO_RAD_ALT(player->actor.shape.rot.y), MTXMODE_NEW);
- sp114.x = Math_SinS(play->gameplayFrames * 0x1000);
- sp114.y = D_80B7FEE4;
- sp114.z = -5.0f;
+ multiVecSrc.x = Math_SinS(play->gameplayFrames * 0x1000);
+ multiVecSrc.y = sSinkingLureHeldY;
+ multiVecSrc.z = -5.0f;
if (sLinkAge == LINK_AGE_CHILD) {
- sp114.y -= 20.0f;
+ multiVecSrc.y -= 20.0f;
}
- Matrix_MultVec3f(&sp114, &sp108);
+ Matrix_MultVec3f(&multiVecSrc, &eyeTarget);
- sSinkingLureBasePos.x = player->actor.world.pos.x + sp108.x;
- sSinkingLureBasePos.y = player->actor.world.pos.y + sp108.y;
- sSinkingLureBasePos.z = player->actor.world.pos.z + sp108.z;
+ sSinkingLureBasePos.x = player->actor.world.pos.x + eyeTarget.x;
+ sSinkingLureBasePos.y = player->actor.world.pos.y + eyeTarget.y;
+ sSinkingLureBasePos.z = player->actor.world.pos.z + eyeTarget.z;
- Math_ApproachF(&D_80B7FEC8, 15.0f, 0.1f, 0.75f);
+ Math_ApproachF(&sCatchCamX, 15.0f, 0.1f, 0.75f);
- sp114.x = D_80B7FEC8 - 15.0f;
+ multiVecSrc.x = sCatchCamX - 15.0f;
if (sLinkAge != LINK_AGE_CHILD) {
- sp114.y = 60.0f;
- sp114.z = -30.0f;
+ multiVecSrc.y = 60.0f;
+ multiVecSrc.z = -30.0f;
} else {
- sp114.y = 40.0f;
- sp114.z = -35.0f;
+ multiVecSrc.y = 40.0f;
+ multiVecSrc.z = -35.0f;
}
- Matrix_MultVec3f(&sp114, &sSubCamEye);
+ Matrix_MultVec3f(&multiVecSrc, &sSubCamEye);
sSubCamEye.x += player->actor.world.pos.x;
sSubCamEye.y += player->actor.world.pos.y;
sSubCamEye.z += player->actor.world.pos.z;
@@ -5476,7 +5506,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
sSubCamAt.y += 40.0f;
}
- if (D_80B7A6D0 == 0) {
+ if (sFishingCinematicTimer == 0) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) ||
(Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) {
if (Message_ShouldAdvance(play)) {
@@ -5484,8 +5514,8 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
Message_CloseTextbox(play);
if (play->msgCtx.choiceIndex == 0) {
- D_80B7E0B6 = 2;
- D_80B7E082 = 0;
+ sLureEquipped = FS_LURE_SINKING;
+ sPondOwnerTextIdIndex = 0;
}
mainCam->eye = sSubCamEye;
@@ -5494,12 +5524,13 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
Play_ReturnToMainCam(play, sSubCamId, 0);
Cutscene_StopManual(play, &play->csCtx);
func_8002DF54(play, &this->actor, PLAYER_CSMODE_7);
- D_80B7A6CC = 0;
+ sFishingPlayerCinematicState = 0;
+
sSubCamId = SUB_CAM_ID_DONE;
player->unk_860 = -5;
D_80B7E0B0 = 5;
- D_80B7A6D4 = 0;
- D_80B7E0A6 = 20;
+ sSinkingLureFound = false;
+ sFishingMusicDelay = 20;
Environment_EnableUnderwaterLights(play, 0);
play->envCtx.adjFogNear = 0;
}
@@ -5517,7 +5548,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
if (sSubCamEye.y <= (WATER_SURFACE_Y(play) + 1.0f)) {
Environment_EnableUnderwaterLights(play, 1);
- if (D_80B7E076 != 0) {
+ if (sFishingFoggy != 0) {
play->envCtx.adjFogNear = -178;
} else {
play->envCtx.adjFogNear = -46;
@@ -5566,15 +5597,15 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
}
if (sREG(15) != 0) {
- if (D_80B7A654 != (sREG(15) - 1)) {
- if (D_80B7A654 == 0) {
+ if (sStormStrengthTarget != (sREG(15) - 1)) {
+ if (sStormStrengthTarget == 0) {
play->envCtx.stormRequest = STORM_REQUEST_START;
} else {
play->envCtx.stormRequest = STORM_REQUEST_STOP;
}
}
- D_80B7A654 = sREG(15) - 1;
+ sStormStrengthTarget = sREG(15) - 1;
}
if (sREG(14) == 1) {
@@ -5590,53 +5621,55 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
osSyncPrintf("zelda_time %x\n", ((void)0, gSaveContext.save.dayTime));
osSyncPrintf(VT_RST);
- if (D_80B7E077 >= 2) {
- D_80B7E077--;
+ if (sStormChanceTimer >= 2) {
+ sStormChanceTimer--;
}
- if ((D_80B7E077 == 1) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && ((D_80B7A680 & 0xFFF) == 0xFFF)) {
- D_80B7E077 = 200;
+ if ((sStormChanceTimer == 1) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) &&
+ ((sFishingTimePlayed & 0xFFF) == 0xFFF)) {
+ sStormChanceTimer = 200;
if (Rand_ZeroOne() < 0.5f) {
- D_80B7A654 = (u8)Rand_ZeroFloat(10.0f) + 5;
+ sStormStrengthTarget = (u8)Rand_ZeroFloat(10.0f) + 5;
play->envCtx.stormRequest = STORM_REQUEST_START;
} else {
- D_80B7A654 = 0;
+ sStormStrengthTarget = 0;
play->envCtx.stormRequest = STORM_REQUEST_STOP;
}
}
- Math_ApproachF(&D_80B7A650, D_80B7A654, 1.0f, 0.05f);
+ Math_ApproachF(&sStormStrength, sStormStrengthTarget, 1.0f, 0.05f);
- if (D_80B7A650 > 0.0f) {
- target = (D_80B7A650 * 0.03f) + 0.8f;
+ if (sStormStrength > 0.0f) {
+ target = (sStormStrength * 0.03f) + 0.8f;
if (target > 1.2f) {
target = 1.2f;
}
- Math_ApproachF(&D_80B7A668, target, 1.0f, 0.01f);
+ Math_ApproachF(&sStormSfxFreqScale, target, 1.0f, 0.01f);
}
- target = (10.0f - D_80B7A650) * 150.1f;
+ target = (10.0f - sStormStrength) * 150.1f;
if (target < 0.0f) {
target = 0.0f;
}
if (1) {}
if (1) {}
- Math_ApproachF(&D_80B7A65C.z, target, 1.0f, 5.0f);
+ Math_ApproachF(&sFishingStormSfxPos.z, target, 1.0f, 5.0f);
- if (D_80B7A65C.z < 1500.0f) {
- func_800F436C(&D_80B7A65C, NA_SE_EV_RAIN - SFX_FLAG, D_80B7A668);
+ if (sFishingStormSfxPos.z < 1500.0f) {
+ func_800F436C(&sFishingStormSfxPos, NA_SE_EV_RAIN - SFX_FLAG, sStormSfxFreqScale);
}
- if (D_80B7A654 != 0) {
- Math_ApproachF(&D_80B7A658, -200.0f, 1.0f, 2.0f);
+ if (sStormStrengthTarget != 0) {
+ Math_ApproachF(&sFishingStormShade, -200.0f, 1.0f, 2.0f);
} else {
- Math_ApproachZeroF(&D_80B7A658, 1.0f, 2.0f);
+ Math_ApproachZeroF(&sFishingStormShade, 1.0f, 2.0f);
}
- play->envCtx.adjLight1Color[0] = play->envCtx.adjLight1Color[1] = play->envCtx.adjLight1Color[2] = D_80B7A658;
+ play->envCtx.adjLight1Color[0] = play->envCtx.adjLight1Color[1] = play->envCtx.adjLight1Color[2] =
+ sFishingStormShade;
- if ((u8)D_80B7A650 > 0) {
+ if ((u8)sStormStrength > 0) {
s32 pad;
Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN);
s16 i;
@@ -5650,7 +5683,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
rot.y = 1.0f;
rot.z = (Camera_GetInputDirYaw(mainCam) * -(M_PI / 0x8000)) + rot.y;
- for (i = 0; i < (u8)D_80B7A650; i++) {
+ for (i = 0; i < (u8)sStormStrength; i++) {
pos.x = Rand_CenteredFloat(700.0f) + play->view.eye.x;
pos.y = (Rand_ZeroFloat(100.0f) + 150.0f) - 170.0f;
pos.z = Rand_CenteredFloat(700.0f) + play->view.eye.z;
@@ -5670,8 +5703,8 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sStreamSfxPos, &sStreamSfxProjectedPos, &sProjectedW);
Sfx_PlaySfxAtPos(&sStreamSfxProjectedPos, NA_SE_EV_WATER_WALL - SFX_FLAG);
-
- gSaveContext.minigameScore = (SQ((f32)D_80B7A678) * 0.0036f) + 0.5f;
+ // convert length to weight. Theoretical max of 59 lbs (127^2*.0036+.5)
+ gSaveContext.minigameScore = (SQ((f32)sFishLengthToWeigh) * 0.0036f) + 0.5f;
if (BREG(26) != 0) {
BREG(26) = 0;
@@ -5696,9 +5729,9 @@ void Fishing_OwnerPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3
OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 9134);
Matrix_MultVec3f(&sZeroVec, &sOwnerHeadPos);
- if (D_80B7A688 == 1) {
+ if (sOwnerHair == FS_OWNER_CAPPED) {
gSPDisplayList(POLY_OPA_DISP++, SEGMENTED_TO_VIRTUAL(gFishingOwnerHatDL));
- } else if (D_80B7A688 == 2) {
+ } else if (sOwnerHair == FS_OWNER_HAIR) {
gSPDisplayList(POLY_OPA_DISP++, SEGMENTED_TO_VIRTUAL(gFishingOwnerHairDL));
}
@@ -5735,10 +5768,10 @@ void Fishing_DrawOwner(Actor* thisx, PlayState* play) {
Fishing_DrawGroupFishes(play);
Fishing_DrawStreamSplash(play);
- if (D_80B7E0A6 != 0) {
- D_80B7E0A6--;
+ if (sFishingMusicDelay != 0) {
+ sFishingMusicDelay--;
- if (D_80B7E0A6 == 0) {
+ if (sFishingMusicDelay == 0) {
if (sLinkAge != LINK_AGE_CHILD) {
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_KAKARIKO_ADULT);
} else {
@@ -5753,17 +5786,17 @@ void Fishing_DrawOwner(Actor* thisx, PlayState* play) {
}
}
- if ((D_80B7E0AC != 0) && D_80B7A674) {
+ if ((sFishingPlayingState != 0) && sIsRodVisible) {
Fishing_DrawRod(play);
Fishing_UpdateLinePos(sReelLinePos);
Fishing_UpdateLine(play, &sRodTipPos, sReelLinePos, sReelLineRot, sReelLineUnk);
Fishing_DrawLureAndLine(play, sReelLinePos, sReelLineRot);
- D_80B7A6C4 = input->rel.stick_x;
- D_80B7A6C8 = input->rel.stick_y;
+ sStickAdjXPrev = input->rel.stick_x;
+ sStickAdjYPrev = input->rel.stick_y;
}
- D_80B7A674 = true;
+ sIsRodVisible = true;
Matrix_Translate(130.0f, 40.0f, 1300.0f, MTXMODE_NEW);
Matrix_Scale(0.08f, 0.12f, 0.14f, MTXMODE_APPLY);
@@ -5776,7 +5809,7 @@ void Fishing_DrawOwner(Actor* thisx, PlayState* play) {
gSPDisplayList(POLY_OPA_DISP++, gFishingAquariumBottomDL);
gSPDisplayList(POLY_XLU_DISP++, gFishingAquariumContainerDL);
- if ((D_80B7E0AC != 0) && (D_80B7E0B6 == 2)) {
+ if ((sFishingPlayingState != 0) && (sLureEquipped == FS_LURE_SINKING)) {
Fishing_DrawSinkingLure(play);
}
diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.h b/src/overlays/actors/ovl_Fishing/z_fishing.h
index 58483652c..40b7f908b 100644
--- a/src/overlays/actors/ovl_Fishing/z_fishing.h
+++ b/src/overlays/actors/ovl_Fishing/z_fishing.h
@@ -9,50 +9,48 @@ struct Fishing;
typedef struct Fishing {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x004];
- /* 0x0150 */ u8 unk_150;
- /* 0x0151 */ u8 unk_151;
+ /* 0x0150 */ u8 isLoach;
+ /* 0x0151 */ u8 lilyTimer; // if near lily and >0, lily moves. Move more if >20
/* 0x0152 */ u8 unk_152;
/* 0x0154 */ s16 unk_154;
/* 0x0156 */ u8 unk_156;
/* 0x0157 */ u8 unk_157;
- /* 0x0158 */ s16 unk_158;
- /* 0x015A */ s16 unk_15A;
- /* 0x015C */ s16 unk_15C;
+ /* 0x0158 */ s16 fishState; // negative index for loach behavior
+ /* 0x015A */ s16 fishStateNext;
+ /* 0x015C */ s16 stateAndTimer; // fish use as timer that's AND'd, owner as talking state
/* 0x015E */ s16 unk_15E;
- /* 0x0160 */ s16 unk_160;
- /* 0x0162 */ s16 unk_162;
- /* 0x0164 */ s16 unk_164;
- /* 0x0166 */ s16 unk_166;
- /* 0x0168 */ s16 unk_168;
- /* 0x016A */ s16 unk_16A;
- /* 0x016C */ s16 unk_16C;
+ /* 0x0160 */ s16 unk_160; // fish use as rotateX, owner as index of eye texture
+ /* 0x0162 */ s16 unk_162; // fish use as rotateY, owner as index of eye texture
+ /* 0x0164 */ s16 unk_164; // fish use as rotateZ, owner as rotation of head
+ /* 0x0166 */ Vec3s rotationTarget;
+ /* 0x016C */ s16 fishLimb23RotYDelta;
/* 0x016E */ s16 unk_16E;
- /* 0x0170 */ s16 unk_170;
- /* 0x0172 */ s16 unk_172;
- /* 0x0174 */ s16 unk_174;
- /* 0x0176 */ s16 unk_176;
+ /* 0x0170 */ s16 fishLimbDRotZDelta;
+ /* 0x0172 */ s16 fishLimbEFRotYDelta;
+ /* 0x0174 */ s16 fishLimb89RotYDelta;
+ /* 0x0176 */ s16 fishLimb4RotYDelta;
/* 0x0178 */ s16 unk_178;
- /* 0x017A */ s16 unk_17A[4];
+ /* 0x017A */ s16 timerArray[4];
/* 0x0184 */ f32 unk_184;
- /* 0x0188 */ f32 unk_188;
- /* 0x018C */ f32 unk_18C;
- /* 0x0190 */ f32 unk_190;
- /* 0x0194 */ f32 unk_194;
- /* 0x0198 */ f32 unk_198;
- /* 0x019C */ f32 unk_19C;
- /* 0x01A0 */ s16 unk_1A0;
- /* 0x01A2 */ s16 unk_1A2;
- /* 0x01A4 */ s16 unk_1A4;
- /* 0x01A8 */ f32 unk_1A8;
- /* 0x01AC */ f32 unk_1AC;
- /* 0x01B0 */ f32 unk_1B0;
- /* 0x01B4 */ Vec3f unk_1B4;
+ /* 0x0188 */ f32 speedTarget;
+ /* 0x018C */ f32 fishLimbRotPhase;
+ /* 0x0190 */ f32 unk_190; // fishLimbRotPhaseStep target
+ /* 0x0194 */ f32 unk_194; // fishLimbRotPhaseMag target
+ /* 0x0198 */ f32 fishLimbRotPhaseStep;
+ /* 0x019C */ f32 fishLimbRotPhaseMag;
+ /* 0x01A0 */ s16 bumpTimer; // set when hitting a wall.
+ /* 0x01A2 */ s16 unk_1A2; // "scared" timer?
+ /* 0x01A4 */ s16 unk_1A4; // "scared" timer? set at same time as above
+ /* 0x01A8 */ f32 perception; // how easily they are drawn to the lure.
+ /* 0x01AC */ f32 fishLength; // fish are (x^2*.0036+.5) lbs, loach double that.
+ /* 0x01B0 */ f32 rotationStep;
+ /* 0x01B4 */ Vec3f fishTargetPos;
/* 0x01C0 */ Vec3f fishMouthPos;
- /* 0x01CC */ s16 unk_1CC[3];
- /* 0x01D2 */ u8 unk_1D2;
- /* 0x01D3 */ u8 unk_1D3;
- /* 0x01D4 */ u8 unk_1D4;
- /* 0x01D5 */ u8 unk_1D5;
+ /* 0x01CC */ s16 loachRotYDelta[3]; // adds rotation to the loach limb 3-5.
+ /* 0x01D2 */ u8 bubbleTime; // spawn bubbles while >0
+ /* 0x01D3 */ u8 isAquariumMessage;
+ /* 0x01D4 */ u8 aquariumWaitTimer;
+ /* 0x01D5 */ u8 keepState; // case-switch and keeping or releasing a fish
/* 0x01D8 */ SkelAnime skelAnime;
/* 0x021C */ LightNode* lightNode;
/* 0x0220 */ LightInfo lightInfo;
@@ -60,4 +58,8 @@ typedef struct Fishing {
/* 0x0250 */ ColliderJntSphElement colliderElements[12];
} Fishing; // size = 0x0550
+#define EN_FISH_OWNER 1 // param for owner of pond. default if params<100
+#define EN_FISH_PARAM 100 // param base for fish in pond.
+#define EN_FISH_AQUARIUM 200 // param for record fish in tank.
+
#endif