From 475b8a1ebabe3246dc9d9b5b0b230e403d7bbb4c Mon Sep 17 00:00:00 2001 From: blackgamma7 Date: Wed, 6 Sep 2023 10:58:17 -0400 Subject: [PATCH 01/29] 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 --- include/z64save.h | 12 + src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c | 2 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 2759 ++++++++++--------- src/overlays/actors/ovl_Fishing/z_fishing.h | 72 +- 4 files changed, 1446 insertions(+), 1399 deletions(-) diff --git a/include/z64save.h b/include/z64save.h index c7eb9a65a..3e006fa1e 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -324,6 +324,18 @@ typedef enum { /* 0x06 */ HS_DAMPE_RACE } HighScores; +// the score value for the fishing minigame also stores many flags. +#define HS_FISH_LENGTH_CHILD 0x7F // mask for record length of catch as child. +#define HS_FISH_LENGTH_ADULT 0x7F000000 // mask for record length of catch as adult. +#define HS_FISH_PLAYED_CHILD 0x100 // set when first talking to owner as child +#define HS_FISH_PLAYED_ADULT 0x200 // set when first talking to owner as adult +#define HS_FISH_PRIZE_CHILD 0x400 // won the Piece of Heart +#define HS_FISH_PRIZE_ADULT 0x800 // won the Golden Scale +#define HS_FISH_STOLE_HAT 0x1000 // Pond owner is visibly bald as Adult Link. +#define HS_FISH_CHEAT_CHILD 0x80 // used Sinking Lure as child to catch record fish +#define HS_FISH_CHEAT_ADULT 0x80000000 // used Sinking Lure as adult to catch record fish +#define HS_FISH_PLAYED 0x10000 // incremented for every play. controls weather. + typedef enum { /* 0 */ SUNSSONG_INACTIVE, /* 1 */ SUNSSONG_START, // the suns ocarina effect signals that the song has finished playing 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 s16 D_80B7A694 = 0; +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 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; + sLurePos.x += sLurePosDelta.x; + sLurePos.y += sLurePosDelta.y; + sLurePos.z += sLurePosDelta.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) { + 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); + Matrix_MultVec3f(&lineVec, &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; + 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; + this->lilyTimer = 50; + rotXYScale = 5; + this->rotationStep = 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; + 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 From d314cfe92395172612676a8ad007a0639c8d5666 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 6 Sep 2023 17:14:15 +0200 Subject: [PATCH 02/29] Document pause states (excluding gameover) (#1483) * Document PauseContext.state * Very light docs surrounding pause states * PAUSE_STATE_UNPAUSE -> PAUSE_STATE_RESUME_GAMEPLAY and comment on purpose in the enum * PAUSE_STATE_MAIN -> PAUSE_STATE_6 * format * Player_InitDrawPause -> Player_InitPauseDrawData --- include/functions.h | 2 +- include/z64pause.h | 29 ++++ src/code/z_bgcheck.c | 9 +- src/code/z_game_over.c | 2 +- src/code/z_kaleido_scope_call.c | 22 +-- src/code/z_kaleido_setup.c | 9 +- src/code/z_kankyo.c | 6 +- src/code/z_lifemeter.c | 3 +- src/code/z_map_exp.c | 4 +- src/code/z_parameter.c | 36 +++-- src/code/z_play.c | 14 +- src/code/z_player_lib.c | 4 +- .../z_en_okarina_effect.c | 2 +- .../ovl_kaleido_scope/z_kaleido_collect.c | 8 +- .../ovl_kaleido_scope/z_kaleido_equipment.c | 8 +- .../misc/ovl_kaleido_scope/z_kaleido_item.c | 4 +- .../ovl_kaleido_scope/z_kaleido_map_PAL.c | 4 +- .../misc/ovl_kaleido_scope/z_kaleido_prompt.c | 3 +- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 142 ++++++++++-------- .../misc/ovl_kaleido_scope/z_lmap_mark.c | 2 +- 20 files changed, 174 insertions(+), 139 deletions(-) diff --git a/include/functions.h b/include/functions.h index 0484c66c1..8f83176af 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1039,7 +1039,7 @@ s32 Player_OverrideLimbDrawGameplayCrawling(PlayState* play, s32 limbIndex, Gfx* u8 func_80090480(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, Vec3f* newBase); void Player_DrawGetItem(PlayState* play, Player* this); void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); -u32 func_80091738(PlayState* play, u8* segment, SkelAnime* skelAnime); +u32 Player_InitPauseDrawData(PlayState* play, u8* segment, SkelAnime* skelAnime); void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots); void PreNMI_Init(GameState* thisx); diff --git a/include/z64pause.h b/include/z64pause.h index 79db8ea4b..f25d5c6ed 100644 --- a/include/z64pause.h +++ b/include/z64pause.h @@ -26,6 +26,35 @@ typedef enum { #define PAUSE_EQUIP_BUFFER_SIZE sizeof(u16[PAUSE_EQUIP_PLAYER_HEIGHT][PAUSE_EQUIP_PLAYER_WIDTH]) #define PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE 0x5000 +typedef enum { + /* 0 */ PAUSE_STATE_OFF, + /* 1 */ PAUSE_STATE_WAIT_LETTERBOX, // Request no letterboxing and wait for it. + /* 2 */ PAUSE_STATE_WAIT_BG_PRERENDER, // Wait for the pause background prerender to be done. + /* 3 */ PAUSE_STATE_INIT, // Load data and initialize/setup various things. + /* 4 */ PAUSE_STATE_OPENING_1, // Animate the pause menu coming together with rotations and other animations. + /* 5 */ PAUSE_STATE_OPENING_2, // Finish some animations for opening the menu. + /* 6 */ PAUSE_STATE_6, // Pause menu ready for player inputs. + /* 7 */ PAUSE_STATE_SAVE_PROMPT, // Save prompt in the pause menu + /* 8 */ PAUSE_STATE_8, + /* 9 */ PAUSE_STATE_9, + /* 10 */ PAUSE_STATE_10, + /* 11 */ PAUSE_STATE_11, + /* 12 */ PAUSE_STATE_12, + /* 13 */ PAUSE_STATE_13, + /* 14 */ PAUSE_STATE_14, + /* 15 */ PAUSE_STATE_15, + /* 16 */ PAUSE_STATE_16, + /* 17 */ PAUSE_STATE_17, + /* 18 */ PAUSE_STATE_CLOSING, // Animate the pause menu closing + /* 19 */ PAUSE_STATE_RESUME_GAMEPLAY // Handles returning to normal gameplay once the pause menu is visually closed +} PauseState; + +#define IS_PAUSE_STATE_GAMEOVER(pauseCtx) \ + (((pauseCtx)->state >= PAUSE_STATE_8) && ((pauseCtx)->state <= PAUSE_STATE_17)) + +#define IS_PAUSED(pauseCtx) \ + (((pauseCtx)->state != PAUSE_STATE_OFF) || ((pauseCtx)->debugState != 0)) + typedef struct { /* 0x0000 */ View view; /* 0x0128 */ u8* iconItemSegment; diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index e0634028c..0525c8987 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -3154,7 +3154,7 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) { f32 result; f32 intersect2; s32 i2; - s32 pauseState; + s32 isPaused; DynaPolyActor* dynaActor; s32 pad; Vec3f polyVtx[3]; @@ -3223,11 +3223,8 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) { dynaActor = DynaPoly_GetActor(dynaRaycastDown->colCtx, *dynaRaycastDown->bgId); if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycastDown->play != NULL)) { - pauseState = dynaRaycastDown->play->pauseCtx.state != 0; - if (pauseState == 0) { - pauseState = dynaRaycastDown->play->pauseCtx.debugState != 0; - } - if (!pauseState && (dynaRaycastDown->colCtx->dyna.bgActorFlags[*dynaRaycastDown->bgId] & BGACTOR_1)) { + isPaused = IS_PAUSED(&dynaRaycastDown->play->pauseCtx); + if (!isPaused && (dynaRaycastDown->colCtx->dyna.bgActorFlags[*dynaRaycastDown->bgId] & BGACTOR_1)) { curTransform = &dynaRaycastDown->dyna->bgActors[*dynaRaycastDown->bgId].curTransform; polyMin = &dynaRaycastDown->dyna diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 14f71fc6e..796ce358d 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -95,7 +95,7 @@ void GameOver_Update(PlayState* play) { gGameOverTimer--; if (gGameOverTimer == 0) { - play->pauseCtx.state = 8; + play->pauseCtx.state = PAUSE_STATE_8; gameOverCtx->state++; Rumble_Reset(); } diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 1f22ebdad..4278b12ef 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -56,30 +56,30 @@ void KaleidoScopeCall_Update(PlayState* play) { KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; PauseContext* pauseCtx = &play->pauseCtx; - if ((pauseCtx->state != 0) || (pauseCtx->debugState != 0)) { - if (pauseCtx->state == 1) { + if (IS_PAUSED(pauseCtx)) { + if (pauseCtx->state == PAUSE_STATE_WAIT_LETTERBOX) { if (Letterbox_GetSize() == 0) { R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_LOG_MODE = 3; R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; pauseCtx->unk_1E4 = 0; pauseCtx->unk_1EC = 0; - pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; + pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_WAIT_BG_PRERENDER } - } else if (pauseCtx->state == 8) { + } else if (pauseCtx->state == PAUSE_STATE_8) { R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_LOG_MODE = 3; R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; pauseCtx->unk_1E4 = 0; pauseCtx->unk_1EC = 0; - pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; - } else if ((pauseCtx->state == 2) || (pauseCtx->state == 9)) { + pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_9 + } else if ((pauseCtx->state == PAUSE_STATE_WAIT_BG_PRERENDER) || (pauseCtx->state == PAUSE_STATE_9)) { osSyncPrintf("PR_KAREIDOSCOPE_MODE=%d\n", R_PAUSE_BG_PRERENDER_STATE); if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_READY) { - pauseCtx->state++; + pauseCtx->state++; // PAUSE_STATE_INIT or PAUSE_STATE_10 } - } else if (pauseCtx->state != 0) { + } else if (pauseCtx->state != PAUSE_STATE_OFF) { if (gKaleidoMgrCurOvl != kaleidoScopeOvl) { if (gKaleidoMgrCurOvl != NULL) { osSyncPrintf(VT_FGCOL(GREEN)); @@ -101,7 +101,7 @@ void KaleidoScopeCall_Update(PlayState* play) { if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { sKaleidoScopeUpdateFunc(play); - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + if (!IS_PAUSED(&play->pauseCtx)) { osSyncPrintf(VT_FGCOL(GREEN)); // "Kaleido area Kaleidoscope Emission" osSyncPrintf("カレイド領域 カレイドスコープ排出\n"); @@ -119,8 +119,8 @@ void KaleidoScopeCall_Draw(PlayState* play) { KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_READY) { - if (((play->pauseCtx.state >= 4) && (play->pauseCtx.state <= 7)) || - ((play->pauseCtx.state >= 11) && (play->pauseCtx.state <= 18))) { + if (((play->pauseCtx.state >= PAUSE_STATE_OPENING_1) && (play->pauseCtx.state <= PAUSE_STATE_SAVE_PROMPT)) || + ((play->pauseCtx.state >= PAUSE_STATE_11) && (play->pauseCtx.state <= PAUSE_STATE_CLOSING))) { if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { sKaleidoScopeDrawFunc(play); } diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 1e7af416d..554282ba1 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -12,7 +12,7 @@ void KaleidoSetup_Update(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; Input* input = &play->state.input[0]; - if (pauseCtx->state == 0 && pauseCtx->debugState == 0 && play->gameOverCtx.state == GAMEOVER_INACTIVE && + if (!IS_PAUSED(pauseCtx) && play->gameOverCtx.state == GAMEOVER_INACTIVE && play->transitionTrigger == TRANS_TRIGGER_OFF && play->transitionMode == TRANS_MODE_OFF && gSaveContext.save.cutsceneIndex < 0xFFF0 && gSaveContext.nextCutsceneIndex < 0xFFF0 && !Play_InCsMode(play) && play->shootingGalleryStatus <= 1 && gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY && @@ -24,6 +24,7 @@ void KaleidoSetup_Update(PlayState* play) { pauseCtx->debugState = 3; } } else if (CHECK_BTN_ALL(input->press.button, BTN_START)) { + // The start button was pressed, pause gSaveContext.prevHudVisibilityMode = gSaveContext.hudVisibilityMode; WREG(16) = -175; @@ -43,13 +44,13 @@ void KaleidoSetup_Update(PlayState* play) { } pauseCtx->mode = (u16)(pauseCtx->pageIndex * 2) + 1; - pauseCtx->state = 1; + pauseCtx->state = PAUSE_STATE_WAIT_LETTERBOX; osSyncPrintf("Mode=%d eye.x=%f, eye.z=%f kscp_pos=%d\n", pauseCtx->mode, pauseCtx->eye.x, pauseCtx->eye.z, pauseCtx->pageIndex); } - if (pauseCtx->state == 1) { + if (pauseCtx->state == PAUSE_STATE_WAIT_LETTERBOX) { WREG(2) = -6240; R_UPDATE_RATE = 2; @@ -66,7 +67,7 @@ void KaleidoSetup_Init(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; u64 temp = 0; // Necessary to match - pauseCtx->state = 0; + pauseCtx->state = PAUSE_STATE_OFF; pauseCtx->debugState = 0; pauseCtx->alpha = 0; pauseCtx->unk_1EA = 0; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 97e15a6e2..0cd66f64d 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -888,8 +888,8 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex Rumble_ClearRequests(); } - if (pauseCtx->state == 0) { - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + if (pauseCtx->state == PAUSE_STATE_OFF) { + if (!IS_PAUSED(&play->pauseCtx)) { if (play->skyboxId == SKYBOX_NORMAL_SKY) { play->skyboxCtx.rot.y -= 0.001f; } else if (play->skyboxId == SKYBOX_CUTSCENE_MAP) { @@ -920,7 +920,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex } } - if ((pauseCtx->state == 0) && (gameOverCtx->state == GAMEOVER_INACTIVE)) { + if ((pauseCtx->state == PAUSE_STATE_OFF) && (gameOverCtx->state == GAMEOVER_INACTIVE)) { if (((msgCtx->msgLength == 0) && (msgCtx->msgMode == MSGMODE_NONE)) || (((void)0, gSaveContext.gameMode) == GAMEMODE_END_CREDITS)) { if ((envCtx->changeSkyboxTimer == 0) && !FrameAdvance_IsEnabled(play) && diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index a1f04093b..42edcb102 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -506,8 +506,7 @@ void Health_UpdateBeatingHeart(PlayState* play) { if (interfaceCtx->beatingHeartOscillator <= 0) { interfaceCtx->beatingHeartOscillator = 0; interfaceCtx->beatingHeartOscillatorDirection = 0; - if (!Player_InCsMode(play) && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && - Health_IsCritical() && !Play_InCsMode(play)) { + if (!Player_InCsMode(play) && !IS_PAUSED(&play->pauseCtx) && Health_IsCritical() && !Play_InCsMode(play)) { Sfx_PlaySfxCentered(NA_SE_SY_HITPOINT_ALARM); } } diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 0cd53e31d..c5d5f177b 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -365,7 +365,7 @@ void Minimap_Draw(PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_map_exp.c", 626); - if (play->pauseCtx.state < 4) { + if (play->pauseCtx.state <= PAUSE_STATE_INIT) { switch (play->sceneId) { case SCENE_DEKU_TREE: case SCENE_DODONGOS_CAVERN: @@ -523,7 +523,7 @@ void Map_Update(PlayState* play) { s16 floor; s16 i; - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + if (!IS_PAUSED(&play->pauseCtx)) { switch (play->sceneId) { case SCENE_DEKU_TREE: case SCENE_DODONGOS_CAVERN: diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index dec9597d5..28a7ef06e 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2139,7 +2139,7 @@ void Interface_SetDoAction(PlayState* play, u16 action) { interfaceCtx->unk_1EC = 1; interfaceCtx->unk_1F4 = 0.0f; Interface_LoadActionLabel(interfaceCtx, action, 1); - if (pauseCtx->state != 0) { + if (pauseCtx->state != PAUSE_STATE_OFF) { interfaceCtx->unk_1EC = 3; } } @@ -2556,7 +2556,7 @@ void Magic_Update(PlayState* play) { case MAGIC_STATE_CONSUME_LENS: // Slowly consume magic while lens is on - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && (msgCtx->msgMode == MSGMODE_NONE) && + if (!IS_PAUSED(&play->pauseCtx) && (msgCtx->msgMode == MSGMODE_NONE) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play)) { if ((gSaveContext.save.info.playerData.magic == 0) || @@ -2812,8 +2812,8 @@ void Interface_DrawItemButtons(PlayState* play) { (R_ITEM_BTN_X(3) + R_ITEM_BTN_WIDTH(3)) << 2, (R_ITEM_BTN_Y(3) + R_ITEM_BTN_WIDTH(3)) << 2, G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(3) << 1, R_ITEM_BTN_DD(3) << 1); - if ((pauseCtx->state < 8) || (pauseCtx->state >= 18)) { - if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugState != 0)) { + if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { + if (IS_PAUSED(&play->pauseCtx)) { // Start Button Texture, Color & Label gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 120, 120, interfaceCtx->startAlpha); @@ -2841,8 +2841,7 @@ void Interface_DrawItemButtons(PlayState* play) { } } - if (interfaceCtx->naviCalling && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && - (play->csCtx.state == CS_STATE_IDLE)) { + if (interfaceCtx->naviCalling && !IS_PAUSED(&play->pauseCtx) && (play->csCtx.state == CS_STATE_IDLE)) { if (!sCUpInvisible) { // C-Up Button Texture, Color & Label (Navi Text) gDPPipeSync(OVERLAY_DISP++); @@ -3372,7 +3371,7 @@ void Interface_Draw(PlayState* play) { func_8008A994(interfaceCtx); - if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 3)) { + if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 3)) { // Inventory Equip Effects gSPSegment(OVERLAY_DISP++, 0x08, pauseCtx->iconItemSegment); Gfx_SetupDL_42Overlay(play->state.gfxCtx); @@ -3423,7 +3422,7 @@ void Interface_Draw(PlayState* play) { Gfx_SetupDL_39Overlay(play->state.gfxCtx); - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + if (!IS_PAUSED(&play->pauseCtx)) { if (gSaveContext.minigameState != 1) { // Carrots rendering if the action corresponds to riding a horse if (interfaceCtx->unk_1EE == 8) { @@ -3520,11 +3519,10 @@ void Interface_Draw(PlayState* play) { } } - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && - (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (msgCtx->msgMode == MSGMODE_NONE) && - !(player->stateFlags2 & PLAYER_STATE2_24) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && - (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play) && (gSaveContext.minigameState != 1) && - (play->shootingGalleryStatus <= 1) && + if (!IS_PAUSED(&play->pauseCtx) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + (msgCtx->msgMode == MSGMODE_NONE) && !(player->stateFlags2 & PLAYER_STATE2_24) && + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && + !Play_InCsMode(play) && (gSaveContext.minigameState != 1) && (play->shootingGalleryStatus <= 1) && !((play->sceneId == SCENE_BOMBCHU_BOWLING_ALLEY) && Flags_GetSwitch(play, 0x38))) { timerId = TIMER_ID_MAIN; @@ -3977,7 +3975,7 @@ void Interface_Update(PlayState* play) { osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language); } - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + if (!IS_PAUSED(&play->pauseCtx)) { if ((gSaveContext.minigameState == 1) || !IS_CUTSCENE_LAYER || ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.sceneLayer == 4))) { if ((msgCtx->msgMode == MSGMODE_NONE) || @@ -4130,10 +4128,10 @@ void Interface_Update(PlayState* play) { Health_UpdateMeter(play); - if ((gSaveContext.timerState >= TIMER_STATE_ENV_HAZARD_MOVE) && (play->pauseCtx.state == 0) && - (play->pauseCtx.debugState == 0) && (msgCtx->msgMode == MSGMODE_NONE) && - !(player->stateFlags2 & PLAYER_STATE2_24) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && - (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play)) {} + if ((gSaveContext.timerState >= TIMER_STATE_ENV_HAZARD_MOVE) && !IS_PAUSED(&play->pauseCtx) && + (msgCtx->msgMode == MSGMODE_NONE) && !(player->stateFlags2 & PLAYER_STATE2_24) && + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && + !Play_InCsMode(play)) {} if (gSaveContext.rupeeAccumulator != 0) { if (gSaveContext.rupeeAccumulator > 0) { @@ -4216,7 +4214,7 @@ void Interface_Update(PlayState* play) { WREG(7) = interfaceCtx->unk_1F4; // Update Magic - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && (msgCtx->msgMode == MSGMODE_NONE) && + if (!IS_PAUSED(&play->pauseCtx) && (msgCtx->msgMode == MSGMODE_NONE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionMode == TRANS_MODE_OFF) && ((play->csCtx.state == CS_STATE_IDLE) || !Player_InCsMode(play))) { diff --git a/src/code/z_play.c b/src/code/z_play.c index 4e3a7b286..c1840037e 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -447,7 +447,7 @@ void Play_Init(GameState* thisx) { void Play_Update(PlayState* this) { s32 pad1; - s32 sp80; + s32 isPaused; Input* input; u32 i; s32 pad2; @@ -849,7 +849,7 @@ void Play_Update(PlayState* this) { } PLAY_LOG(3551); - sp80 = (this->pauseCtx.state != 0) || (this->pauseCtx.debugState != 0); + isPaused = IS_PAUSED(&this->pauseCtx); PLAY_LOG(3555); AnimationContext_Reset(&this->animationCtx); @@ -859,7 +859,7 @@ void Play_Update(PlayState* this) { PLAY_LOG(3577); - if ((sp80 == 0) && (IREG(72) == 0)) { + if (!isPaused && (IREG(72) == 0)) { PLAY_LOG(3580); this->gameplayFrames++; @@ -926,7 +926,7 @@ void Play_Update(PlayState* this) { if (this->viewpoint != VIEWPOINT_NONE) { if (CHECK_BTN_ALL(input[0].press.button, BTN_CUP)) { - if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugState != 0)) { + if (IS_PAUSED(&this->pauseCtx)) { // "Changing viewpoint is prohibited due to the kaleidoscope" osSyncPrintf(VT_FGCOL(CYAN) "カレイドスコープ中につき視点変更を禁止しております\n" VT_RST); } else if (Player_InCsMode(this)) { @@ -950,7 +950,7 @@ void Play_Update(PlayState* this) { PLAY_LOG(3716); - if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugState != 0)) { + if (IS_PAUSED(&this->pauseCtx)) { PLAY_LOG(3721); KaleidoScopeCall_Update(this); } else if (this->gameOverCtx.state != GAMEOVER_INACTIVE) { @@ -987,7 +987,7 @@ void Play_Update(PlayState* this) { skip: PLAY_LOG(3801); - if ((sp80 == 0) || gDebugCamEnabled) { + if (!isPaused || gDebugCamEnabled) { s32 pad3[5]; s32 i; @@ -1013,7 +1013,7 @@ skip: } void Play_DrawOverlayElements(PlayState* this) { - if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugState != 0)) { + if (IS_PAUSED(&this->pauseCtx)) { KaleidoScopeCall_Draw(this); } diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 981bcf761..ad90fed5a 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1641,7 +1641,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve } } -u32 func_80091738(PlayState* play, u8* segment, SkelAnime* skelAnime) { +u32 Player_InitPauseDrawData(PlayState* play, u8* segment, SkelAnime* skelAnime) { s16 linkObjectId = gLinkObjectIds[(void)0, gSaveContext.save.linkAge]; u32 size; void* ptr; @@ -1663,7 +1663,7 @@ u32 func_80091738(PlayState* play, u8* segment, SkelAnime* skelAnime) { SkelAnime_InitLink(play, skelAnime, gPlayerSkelHeaders[(void)0, gSaveContext.save.linkAge], &gPlayerAnim_link_normal_wait, 9, ptr, ptr, PLAYER_LIMB_MAX); - return size + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE + + return PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE + size + sizeof(Vec3s[PLAYER_LIMB_BUF_COUNT]); } diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 585ccc088..687401745 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -72,7 +72,7 @@ void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, PlayState* play) { void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, PlayState* play) { CutsceneFlags_Unset(play, 5); - if (((play->pauseCtx.state == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + if (((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->msgCtx.msgLength == 0) && (!FrameAdvance_IsEnabled(play)) && ((play->transitionMode == TRANS_MODE_OFF) || (gSaveContext.gameMode != GAMEMODE_NORMAL))) || (this->timer >= 250)) { diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index 031657f4e..77cd9b4e1 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -86,7 +86,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { if (pauseCtx->cursorSpecialPos == 0) { pauseCtx->nameColorSet = 0; - if ((pauseCtx->state != 6) || ((pauseCtx->stickAdjX == 0) && (pauseCtx->stickAdjY == 0))) { + if ((pauseCtx->state != PAUSE_STATE_6) || ((pauseCtx->stickAdjX == 0) && (pauseCtx->stickAdjY == 0))) { sp216 = pauseCtx->cursorSlot[PAUSE_QUEST]; } else { phi_s3 = pauseCtx->cursorPoint[PAUSE_QUEST]; @@ -178,7 +178,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { KaleidoScope_SetCursorVtx(pauseCtx, sp216 * 4, pauseCtx->questVtx); - if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->cursorSpecialPos == 0)) { + if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->cursorSpecialPos == 0)) { if ((sp216 >= QUEST_SONG_MINUET) && (sp216 < QUEST_KOKIRI_EMERALD)) { if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) { sp216 = pauseCtx->cursorSlot[PAUSE_QUEST]; @@ -444,7 +444,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - if ((pauseCtx->state == 4) || (pauseCtx->state == 0x12)) { + if ((pauseCtx->state == PAUSE_STATE_OPENING_1) || (pauseCtx->state == PAUSE_STATE_CLOSING)) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, D_8082A070[0][0], D_8082A070[0][1], D_8082A070[0][2], pauseCtx->alpha); } else { @@ -462,7 +462,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { 48, 48, 0); } - if (pauseCtx->state == 6) { + if (pauseCtx->state == PAUSE_STATE_6) { gDPPipeSync(POLY_OPA_DISP++); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index 4cf5d53f3..e3e5997a5 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -152,7 +152,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { } } - if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_EQUIP)) { + if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_EQUIP)) { oldCursorPoint = pauseCtx->cursorPoint[PAUSE_EQUIP]; pauseCtx->cursorColorSet = 0; @@ -469,9 +469,9 @@ void KaleidoScope_DrawEquipment(PlayState* play) { KaleidoScope_SetCursorVtx(pauseCtx, cursorSlot * 4, pauseCtx->equipVtx); - if ((pauseCtx->cursorSpecialPos == 0) && (cursorItem != PAUSE_ITEM_NONE) && (pauseCtx->state == 6) && - (pauseCtx->unk_1E4 == 0) && CHECK_BTN_ALL(input->press.button, BTN_A) && - (pauseCtx->cursorX[PAUSE_EQUIP] != 0)) { + if ((pauseCtx->cursorSpecialPos == 0) && (cursorItem != PAUSE_ITEM_NONE) && + (pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && + CHECK_BTN_ALL(input->press.button, BTN_A) && (pauseCtx->cursorX[PAUSE_EQUIP] != 0)) { if ((gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == 9) || (gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index 3f9655d2c..5294bfdcb 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -103,7 +103,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { pauseCtx->cursorColorSet = 0; pauseCtx->nameColorSet = 0; - if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM)) { + if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM)) { moveCursorResult = 0; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; @@ -349,7 +349,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { index = cursorSlot * 4; // required to match? KaleidoScope_SetCursorVtx(pauseCtx, index, pauseCtx->itemVtx); - if ((pauseCtx->debugState == 0) && (pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) { + if ((pauseCtx->debugState == 0) && (pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0)) { if (CHECK_BTN_ANY(input->press.button, BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) { if (((gSlotAgeReqs[cursorSlot] == 9) || (gSlotAgeReqs[cursorSlot] == ((void)0, gSaveContext.save.linkAge))) && diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c index 771038ae5..b14003eed 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c @@ -46,7 +46,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx, "../z_kaleido_map_PAL.c", 123); - if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) { + if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) { pauseCtx->cursorColorSet = 0; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_MAP]; @@ -410,7 +410,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx, "../z_kaleido_map_PAL.c", 556); - if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) { + if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) { pauseCtx->cursorColorSet = 0; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c index 0fd3310bd..ca2017e33 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c @@ -8,7 +8,8 @@ void KaleidoScope_UpdatePrompt(PlayState* play) { s8 stickAdjX = input->rel.stick_x; s16 step; - if (((pauseCtx->state == 7) && (pauseCtx->unk_1EC == 1)) || (pauseCtx->state == 0xE) || (pauseCtx->state == 0x10)) { + if (((pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) && (pauseCtx->unk_1EC == 1)) || + (pauseCtx->state == PAUSE_STATE_14) || (pauseCtx->state == PAUSE_STATE_16)) { if ((pauseCtx->promptChoice == 0) && (stickAdjX >= 30)) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 3d36920f8..0ea6f38ed 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -436,7 +436,7 @@ void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex) { temp = pauseCtx->unk_1E4; - if ((((pauseCtx->unk_1E4 == 0) || (temp == 8)) && (pauseCtx->state == 6)) || + if ((((pauseCtx->unk_1E4 == 0) || (temp == 8)) && (pauseCtx->state == PAUSE_STATE_6)) || ((pauseCtx->pageIndex == PAUSE_QUEST) && ((temp < 3) || (temp == 5) || (temp == 8)))) { if (pauseCtx->pageIndex == pageIndex) { @@ -519,8 +519,8 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx, "../z_kaleido_scope_PAL.c", 1100); - if ((pauseCtx->state < 8) || (pauseCtx->state > 0x11)) { - if (pauseCtx->state != 7) { + if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { + if (pauseCtx->state != PAUSE_STATE_SAVE_PROMPT) { stepR = ABS(D_8082AB8C - D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][0]) / D_8082AD3C; stepG = ABS(D_8082AB90 - D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][1]) / D_8082AD3C; stepB = ABS(D_8082AB94 - D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][2]) / D_8082AD3C; @@ -785,7 +785,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { Gfx_SetupDL_42Opa(gfxCtx); - if ((pauseCtx->state == 7) || ((pauseCtx->state >= 8) && (pauseCtx->state < 0x12))) { + if ((pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) || IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { KaleidoScope_UpdatePrompt(play); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA, G_CC_MODULATEIA); @@ -822,16 +822,17 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx, "../z_kaleido_scope_PAL.c", 1424), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if ((pauseCtx->state >= 8) && (pauseCtx->state <= 0x11)) { + if (IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->saveVtx, sGameOverTexs); - } else { + } else { // PAUSE_STATE_SAVE_PROMPT POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->saveVtx, sSaveTexs[gSaveContext.language]); } gSPVertex(POLY_OPA_DISP++, &pauseCtx->saveVtx[60], 32, 0); - if (((pauseCtx->state == 7) && (pauseCtx->unk_1EC < 4)) || (pauseCtx->state == 0xE)) { + if (((pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) && (pauseCtx->unk_1EC < 4)) || + (pauseCtx->state == PAUSE_STATE_14)) { POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sSavePromptTexs[gSaveContext.language], 152, 16, 0); @@ -854,8 +855,9 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sPromptChoiceTexs[gSaveContext.language][1], 48, 16, 16); - } else if ((pauseCtx->state != 7) || (pauseCtx->unk_1EC < 4)) { - if ((pauseCtx->state != 0xF) && ((pauseCtx->state == 0x10) || (pauseCtx->state == 0x11))) { + } else if ((pauseCtx->state != PAUSE_STATE_SAVE_PROMPT) || (pauseCtx->unk_1EC < 4)) { + if ((pauseCtx->state != PAUSE_STATE_15) && + ((pauseCtx->state == PAUSE_STATE_16) || (pauseCtx->state == PAUSE_STATE_17))) { POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sContinuePromptTexs[gSaveContext.language], 152, 16, 0); @@ -885,7 +887,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - if ((pauseCtx->state != 0x10) && (pauseCtx->state != 0x11)) { + if ((pauseCtx->state != PAUSE_STATE_16) && (pauseCtx->state != PAUSE_STATE_17)) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 0, pauseCtx->alpha); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); } @@ -1119,7 +1121,8 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); gDPSetEnvColor(POLY_OPA_DISP++, 20, 30, 40, 0); - if ((pauseCtx->state == 6) && (pauseCtx->namedItem != PAUSE_ITEM_NONE) && (pauseCtx->nameDisplayTimer < WREG(89)) && + if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->namedItem != PAUSE_ITEM_NONE) && + (pauseCtx->nameDisplayTimer < WREG(89)) && (((u32)pauseCtx->unk_1E4 == 0) || (pauseCtx->unk_1E4 == 2) || ((pauseCtx->unk_1E4 >= 4) && (pauseCtx->unk_1E4 <= 7)) || (pauseCtx->unk_1E4 == 8)) && (pauseCtx->cursorSpecialPos == 0)) { @@ -1198,7 +1201,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->infoPanelVtx[16], 8, 0); - if (pauseCtx->state == 7) { + if (pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) { pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = WREG(61 + gSaveContext.language); pauseCtx->infoPanelVtx[17].v.ob[0] = pauseCtx->infoPanelVtx[19].v.ob[0] = @@ -1223,7 +1226,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, D_8082AD60[gSaveContext.language], D_8082ADE0[gSaveContext.language], 16, 4); } else if (pauseCtx->cursorSpecialPos != 0) { - if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) { + if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0)) { pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = -63; pauseCtx->infoPanelVtx[17].v.ob[0] = pauseCtx->infoPanelVtx[19].v.ob[0] = @@ -1655,7 +1658,7 @@ s16 func_80823A0C(PlayState* play, Vtx* vtx, s16 arg2, s16 arg3) { vtx[phi_t1 + 1].v.ob[0] = vtx[phi_t1 + 3].v.ob[0] = vtx[phi_t1 + 0].v.ob[0] + ptr2[phi_t3]; - if (!((pauseCtx->state >= 8) && (pauseCtx->state <= 0x11))) { + if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { vtx[phi_t1 + 0].v.ob[1] = vtx[phi_t1 + 1].v.ob[1] = ptr3[phi_t3] + pauseCtx->offsetY; } else { vtx[phi_t1 + 0].v.ob[1] = vtx[phi_t1 + 1].v.ob[1] = YREG(60 + phi_t3) + pauseCtx->offsetY; @@ -1786,9 +1789,9 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->offsetY = 0; - if ((pauseCtx->state == 4) || (pauseCtx->state >= 0x12) || - ((pauseCtx->state == 7) && ((pauseCtx->unk_1EC == 2) || (pauseCtx->unk_1EC == 5))) || - ((pauseCtx->state >= 8) && (pauseCtx->state <= 0xD))) { + if ((pauseCtx->state == PAUSE_STATE_OPENING_1) || (pauseCtx->state >= PAUSE_STATE_CLOSING) || + ((pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) && ((pauseCtx->unk_1EC == 2) || (pauseCtx->unk_1EC == 5))) || + ((pauseCtx->state >= PAUSE_STATE_8) && (pauseCtx->state <= PAUSE_STATE_13))) { pauseCtx->offsetY = 80; } @@ -2296,12 +2299,12 @@ void KaleidoScope_Draw(PlayState* play) { KaleidoScope_SetView(pauseCtx, 0.0f, 0.0f, 64.0f); - if (!((pauseCtx->state >= 8) && (pauseCtx->state <= 0x11))) { + if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { KaleidoScope_DrawInfoPanel(play); } } - if ((pauseCtx->state >= 0xB) && (pauseCtx->state <= 0x11)) { + if ((pauseCtx->state >= PAUSE_STATE_11) && (pauseCtx->state <= PAUSE_STATE_17)) { KaleidoScope_DrawGameOver(play); } @@ -2333,7 +2336,7 @@ void KaleidoScope_GrayOutTextureRGBA32(u32* texture, u16 pixelCount) { } } -void func_808265BC(PlayState* play) { +void KaleidoScope_UpdateOpening(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; pauseCtx->eye.x += D_8082ABAC[pauseCtx->mode] * ZREG(46); @@ -2341,6 +2344,8 @@ void func_808265BC(PlayState* play) { pauseCtx->unk_1EA += 4 * ZREG(46); if (pauseCtx->unk_1EA == (64 * ZREG(47))) { + // Finished opening + func_80084BF4(play, 1); gSaveContext.buttonStatus[0] = D_8082AB6C[pauseCtx->pageIndex][0]; gSaveContext.buttonStatus[1] = D_8082AB6C[pauseCtx->pageIndex][1]; @@ -2349,10 +2354,11 @@ void func_808265BC(PlayState* play) { gSaveContext.buttonStatus[4] = D_8082AB6C[pauseCtx->pageIndex][4]; pauseCtx->pageIndex = D_8082ABEC[pauseCtx->mode]; pauseCtx->unk_1E4 = 0; - pauseCtx->state++; + pauseCtx->state++; // PAUSE_STATE_6 pauseCtx->alpha = 255; Interface_LoadActionLabelB(play, DO_ACTION_SAVE); } else if (pauseCtx->unk_1EA == 64) { + // `ZREG(47)` is always 1 so this normally never happens pauseCtx->pageIndex = D_8082ABEC[pauseCtx->mode]; pauseCtx->mode = (u16)(pauseCtx->pageIndex * 2) + 1; } @@ -2501,10 +2507,10 @@ void KaleidoScope_Update(PlayState* play) { s32 pad; if ((R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_READY) && - (((pauseCtx->state >= 4) && (pauseCtx->state <= 7)) || - ((pauseCtx->state >= 0xA) && (pauseCtx->state <= 0x12)))) { + (((pauseCtx->state >= PAUSE_STATE_OPENING_1) && (pauseCtx->state <= PAUSE_STATE_SAVE_PROMPT)) || + ((pauseCtx->state >= PAUSE_STATE_10) && (pauseCtx->state <= PAUSE_STATE_CLOSING)))) { - if ((((u32)pauseCtx->unk_1E4 == 0) || (pauseCtx->unk_1E4 == 8)) && (pauseCtx->state == 6)) { + if ((((u32)pauseCtx->unk_1E4 == 0) || (pauseCtx->unk_1E4 == 8)) && (pauseCtx->state == PAUSE_STATE_6)) { pauseCtx->stickAdjX = input->rel.stick_x; pauseCtx->stickAdjY = input->rel.stick_y; KaleidoScope_UpdateCursorSize(play); @@ -2513,13 +2519,13 @@ void KaleidoScope_Update(PlayState* play) { KaleidoScope_UpdateCursorSize(play); } - if (pauseCtx->state == 6) { + if (pauseCtx->state == PAUSE_STATE_6) { KaleidoScope_UpdateNamePanel(play); } } switch (pauseCtx->state) { - case 3: + case PAUSE_STATE_INIT: D_808321A8[0] = gSaveContext.buttonStatus[0]; D_808321A8[1] = gSaveContext.buttonStatus[1]; D_808321A8[2] = gSaveContext.buttonStatus[2]; @@ -2538,7 +2544,7 @@ void KaleidoScope_Update(PlayState* play) { //! @bug messed up alignment, should match `ALIGN64` pauseCtx->playerSegment = (void*)(((uintptr_t)play->objectCtx.spaceStart + 0x30) & ~0x3F); - size1 = func_80091738(play, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime); + size1 = Player_InitPauseDrawData(play, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime); osSyncPrintf("プレイヤー size1=%x\n", size1); pauseCtx->iconItemSegment = (void*)ALIGN16((uintptr_t)pauseCtx->playerSegment + size1); @@ -2888,11 +2894,13 @@ void KaleidoScope_Update(PlayState* play) { } } - pauseCtx->state = 4; + pauseCtx->state = PAUSE_STATE_OPENING_1; break; - case 4: + case PAUSE_STATE_OPENING_1: if (pauseCtx->unk_1F4 == 160.0f) { + // First frame in this state + KaleidoScope_SetDefaultCursor(play); KaleidoScope_ProcessPlayerPreRender(); } @@ -2908,26 +2916,27 @@ void KaleidoScope_Update(PlayState* play) { if (pauseCtx->unk_1F4 == 0) { interfaceCtx->startAlpha = 255; WREG(2) = 0; - pauseCtx->state = 5; + pauseCtx->state = PAUSE_STATE_OPENING_2; } - func_808265BC(play); + KaleidoScope_UpdateOpening(play); break; - case 5: + case PAUSE_STATE_OPENING_2: pauseCtx->alpha += (u16)(255 / (WREG(6) + WREG(4))); - func_808265BC(play); - if (pauseCtx->state == 6) { + KaleidoScope_UpdateOpening(play); + + if (pauseCtx->state == PAUSE_STATE_6) { KaleidoScope_UpdateNamePanel(play); } break; - case 6: + case PAUSE_STATE_6: switch (pauseCtx->unk_1E4) { case 0: if (CHECK_BTN_ALL(input->press.button, BTN_START)) { Interface_SetDoAction(play, DO_ACTION_NONE); - pauseCtx->state = 0x12; + pauseCtx->state = PAUSE_STATE_CLOSING; WREG(2) = -6240; func_800F64E0(0); } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { @@ -2941,7 +2950,7 @@ void KaleidoScope_Update(PlayState* play) { gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); pauseCtx->unk_1EC = 0; - pauseCtx->state = 7; + pauseCtx->state = PAUSE_STATE_SAVE_PROMPT; } break; @@ -2970,7 +2979,7 @@ void KaleidoScope_Update(PlayState* play) { if (CHECK_BTN_ALL(input->press.button, BTN_START)) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); Interface_SetDoAction(play, DO_ACTION_NONE); - pauseCtx->state = 0x12; + pauseCtx->state = PAUSE_STATE_CLOSING; WREG(2) = -6240; func_800F64E0(0); pauseCtx->unk_1E4 = 0; @@ -2988,7 +2997,7 @@ void KaleidoScope_Update(PlayState* play) { gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); pauseCtx->unk_1EC = 0; - pauseCtx->state = 7; + pauseCtx->state = PAUSE_STATE_SAVE_PROMPT; } else if (pauseCtx->ocarinaStaff->state == pauseCtx->ocarinaSongIdx) { Audio_PlaySfxGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -3021,7 +3030,7 @@ void KaleidoScope_Update(PlayState* play) { if (CHECK_BTN_ALL(input->press.button, BTN_START)) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); Interface_SetDoAction(play, DO_ACTION_NONE); - pauseCtx->state = 0x12; + pauseCtx->state = PAUSE_STATE_CLOSING; WREG(2) = -6240; func_800F64E0(0); pauseCtx->unk_1E4 = 0; @@ -3038,7 +3047,7 @@ void KaleidoScope_Update(PlayState* play) { gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); pauseCtx->unk_1EC = 0; - pauseCtx->state = 7; + pauseCtx->state = PAUSE_STATE_SAVE_PROMPT; } break; @@ -3051,7 +3060,7 @@ void KaleidoScope_Update(PlayState* play) { } break; - case 7: + case PAUSE_STATE_SAVE_PROMPT: switch (pauseCtx->unk_1EC) { case 0: pauseCtx->unk_204 -= 314.0f / WREG(6); @@ -3120,7 +3129,7 @@ void KaleidoScope_Update(PlayState* play) { WREG(16) += WREG(25) / WREG(6); WREG(17) += WREG(26) / WREG(6); if (pauseCtx->unk_204 >= -314.0f) { - pauseCtx->state = 6; + pauseCtx->state = PAUSE_STATE_6; pauseCtx->unk_1EC = 0; pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 = 0.0f; pauseCtx->unk_204 = -314.0f; @@ -3143,7 +3152,7 @@ void KaleidoScope_Update(PlayState* play) { } } else { pauseCtx->debugState = 0; - pauseCtx->state = 0x13; + pauseCtx->state = PAUSE_STATE_RESUME_GAMEPLAY; pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 = 160.0f; pauseCtx->namedItem = PAUSE_ITEM_NONE; pauseCtx->unk_1E4 = 0; @@ -3153,7 +3162,7 @@ void KaleidoScope_Update(PlayState* play) { } break; - case 0xA: + case PAUSE_STATE_10: pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->dungeonMapSlot = VREG(30) + 3; WREG(16) = -175; @@ -3210,10 +3219,10 @@ void KaleidoScope_Update(PlayState* play) { D_8082B260 = 30; VREG(88) = 98; pauseCtx->promptChoice = 0; - pauseCtx->state++; + pauseCtx->state++; // PAUSE_STATE_11 break; - case 0xB: + case PAUSE_STATE_11: stepR = ABS(D_8082AB8C - 30) / D_8082B260; stepG = ABS(D_8082AB90) / D_8082B260; stepB = ABS(D_8082AB94) / D_8082B260; @@ -3269,19 +3278,19 @@ void KaleidoScope_Update(PlayState* play) { D_8082ABA0 = 130; D_8082ABA4 = 0; - pauseCtx->state++; + pauseCtx->state++; // PAUSE_STATE_12 D_8082B260 = 40; } break; - case 0xC: + case PAUSE_STATE_12: D_8082B260--; if (D_8082B260 == 0) { - pauseCtx->state = 0xD; + pauseCtx->state = PAUSE_STATE_13; } break; - case 0xD: + case PAUSE_STATE_13: pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 = pauseCtx->unk_204 -= 160.0f / WREG(6); pauseCtx->infoPanelOffsetY += 40 / WREG(6); @@ -3297,7 +3306,7 @@ void KaleidoScope_Update(PlayState* play) { VREG(88) = 66; WREG(2) = 0; pauseCtx->alpha = 255; - pauseCtx->state = 0xE; + pauseCtx->state = PAUSE_STATE_14; gSaveContext.save.info.playerData.deaths++; if (gSaveContext.save.info.playerData.deaths > 999) { gSaveContext.save.info.playerData.deaths = 999; @@ -3306,13 +3315,13 @@ void KaleidoScope_Update(PlayState* play) { osSyncPrintf("kscope->angle_s = %f\n", pauseCtx->unk_204); break; - case 0xE: + case PAUSE_STATE_14: if (CHECK_BTN_ALL(input->press.button, BTN_A)) { if (pauseCtx->promptChoice != 0) { pauseCtx->promptChoice = 0; Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - pauseCtx->state = 0x10; + pauseCtx->state = PAUSE_STATE_16; gameOverCtx->state++; } else { Audio_PlaySfxGeneral(NA_SE_SY_PIECE_OF_HEART, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -3321,26 +3330,26 @@ void KaleidoScope_Update(PlayState* play) { Play_SaveSceneFlags(play); gSaveContext.save.info.playerData.savedSceneId = play->sceneId; Sram_WriteSave(&play->sramCtx); - pauseCtx->state = 0xF; + pauseCtx->state = PAUSE_STATE_15; D_8082B25C = 3; } } break; - case 0xF: + case PAUSE_STATE_15: D_8082B25C--; if (D_8082B25C == 0) { - pauseCtx->state = 0x10; + pauseCtx->state = PAUSE_STATE_16; gameOverCtx->state++; } else if ((D_8082B25C <= 80) && (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START))) { - pauseCtx->state = 0x10; + pauseCtx->state = PAUSE_STATE_16; gameOverCtx->state++; func_800F64E0(0); } break; - case 0x10: + case PAUSE_STATE_16: if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START)) { if (pauseCtx->promptChoice == 0) { Audio_PlaySfxGeneral(NA_SE_SY_PIECE_OF_HEART, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -3406,16 +3415,16 @@ void KaleidoScope_Update(PlayState* play) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - pauseCtx->state = 0x11; + pauseCtx->state = PAUSE_STATE_17; } break; - case 0x11: + case PAUSE_STATE_17: if (interfaceCtx->unk_244 != 255) { interfaceCtx->unk_244 += 10; if (interfaceCtx->unk_244 >= 255) { interfaceCtx->unk_244 = 255; - pauseCtx->state = 0; + pauseCtx->state = PAUSE_STATE_OFF; R_UPDATE_RATE = 3; R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_OFF; func_800981B8(&play->objectCtx); @@ -3449,7 +3458,7 @@ void KaleidoScope_Update(PlayState* play) { } break; - case 0x12: + case PAUSE_STATE_CLOSING: if (pauseCtx->unk_1F4 != 160.0f) { pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 += 160.0f / WREG(6); pauseCtx->infoPanelOffsetY -= 40 / WREG(6); @@ -3463,7 +3472,7 @@ void KaleidoScope_Update(PlayState* play) { } } else { pauseCtx->debugState = 0; - pauseCtx->state = 0x13; + pauseCtx->state = PAUSE_STATE_RESUME_GAMEPLAY; pauseCtx->unk_200 = 160.0f; pauseCtx->unk_1FC = 160.0f; pauseCtx->unk_1F8 = 160.0f; @@ -3473,10 +3482,11 @@ void KaleidoScope_Update(PlayState* play) { } break; - case 0x13: - pauseCtx->state = 0; + case PAUSE_STATE_RESUME_GAMEPLAY: + pauseCtx->state = PAUSE_STATE_OFF; R_UPDATE_RATE = 3; R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_OFF; + func_800981B8(&play->objectCtx); func_800418D0(&play->colCtx, play); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c index 56d27d4cb..4e1ab85d4 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c @@ -80,7 +80,7 @@ void PauseMapMark_DrawForDungeon(PlayState* play) { Matrix_Push(); - if ((play->pauseCtx.state == 4) || (play->pauseCtx.state >= 0x12)) { + if ((play->pauseCtx.state == PAUSE_STATE_OPENING_1) || (play->pauseCtx.state >= PAUSE_STATE_CLOSING)) { Matrix_Translate(-36.0f, 101.0f, 0.0f, MTXMODE_APPLY); } else { Matrix_Translate(-36.0f, 21.0f, 0.0f, MTXMODE_APPLY); From 527c3ba7045ba21c99645902a4796f2596fba313 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 6 Sep 2023 18:43:50 +0200 Subject: [PATCH 03/29] Player doc: anim wrappers (#1437) * Player doc: anim wrappers * revert name callbacks in `D_80854AA4` * Adj -> Adjusted * format * Add `PLAYER_ANIM_ADJUSTED_SPEED` * format * Add a comment on `Player_AnimReplaceApplyFlags` --------- Co-authored-by: fig02 --- .../actors/ovl_player_actor/z_player.c | 578 +++++++++--------- 1 file changed, 297 insertions(+), 281 deletions(-) diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 6c6c2f712..a02a588ee 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -23,6 +23,10 @@ #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_link_child/object_link_child.h" +// Some player animations are played at this reduced speed, for reasons yet unclear. +// This is called "adjusted" for now. +#define PLAYER_ANIM_ADJUSTED_SPEED (2.0f / 3.0f) + typedef struct { /* 0x00 */ u8 itemId; /* 0x01 */ u8 field; // various bit-packed data @@ -1582,20 +1586,20 @@ s32 func_8083224C(PlayState* play) { return CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_8); } -void func_80832264(PlayState* play, Player* this, LinkAnimationHeader* anim) { +void Player_AnimPlayOnce(PlayState* play, Player* this, LinkAnimationHeader* anim) { LinkAnimation_PlayOnce(play, &this->skelAnime, anim); } -void func_80832284(PlayState* play, Player* this, LinkAnimationHeader* anim) { +void Player_AnimPlayLoop(PlayState* play, Player* this, LinkAnimationHeader* anim) { LinkAnimation_PlayLoop(play, &this->skelAnime, anim); } -void func_808322A4(PlayState* play, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, anim, 2.0f / 3.0f); +void Player_AnimPlayLoopAdjusted(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, anim, PLAYER_ANIM_ADJUSTED_SPEED); } -void func_808322D0(PlayState* play, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, 2.0f / 3.0f); +void Player_AnimPlayOnceAdjusted(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, PLAYER_ANIM_ADJUSTED_SPEED); } void func_808322FC(Player* this) { @@ -1816,49 +1820,49 @@ void func_80832924(Player* this, struct_80832924* entry) { } while (cont); } -void func_80832B0C(PlayState* play, Player* this, LinkAnimationHeader* anim) { +void Player_AnimChangeOnceMorph(PlayState* play, Player* this, LinkAnimationHeader* anim) { LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, -6.0f); } -void func_80832B78(PlayState* play, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_Change(play, &this->skelAnime, anim, 2.0f / 3.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, - -6.0f); +void Player_AnimChangeOnceMorphAdjusted(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_Change(play, &this->skelAnime, anim, PLAYER_ANIM_ADJUSTED_SPEED, 0.0f, Animation_GetLastFrame(anim), + ANIMMODE_ONCE, -6.0f); } -void func_80832BE8(PlayState* play, Player* this, LinkAnimationHeader* anim) { +void Player_AnimChangeLoopMorph(PlayState* play, Player* this, LinkAnimationHeader* anim) { LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f); } -void func_80832C2C(PlayState* play, Player* this, LinkAnimationHeader* anim) { +void Player_AnimChangeFreeze(PlayState* play, Player* this, LinkAnimationHeader* anim) { LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); } -void func_80832C6C(PlayState* play, Player* this, LinkAnimationHeader* anim) { +void Player_AnimChangeLoopSlowMorph(PlayState* play, Player* this, LinkAnimationHeader* anim) { LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -16.0f); } s32 func_80832CB0(PlayState* play, Player* this, LinkAnimationHeader* anim) { if (LinkAnimation_Update(play, &this->skelAnime)) { - func_80832284(play, this, anim); + Player_AnimPlayLoop(play, this, anim); return 1; } else { return 0; } } -void func_80832CFC(Player* this) { +void Player_SkelAnimeResetPrevTranslRot(Player* this) { this->skelAnime.prevTransl = this->skelAnime.baseTransl; this->skelAnime.prevRot = this->actor.shape.rot.y; } -void func_80832D20(Player* this) { - func_80832CFC(this); +void Player_SkelAnimeResetPrevTranslRotAgeScale(Player* this) { + Player_SkelAnimeResetPrevTranslRot(this); this->skelAnime.prevTransl.x *= this->ageProperties->unk_08; this->skelAnime.prevTransl.y *= this->ageProperties->unk_08; this->skelAnime.prevTransl.z *= this->ageProperties->unk_08; } -void func_80832DB0(Player* this) { +void Player_ZeroRootLimbYaw(Player* this) { this->skelAnime.jointTable[1].y = 0; } @@ -1874,7 +1878,7 @@ void func_80832DBC(Player* this) { } else { this->skelAnime.jointTable[0].y = this->skelAnime.baseTransl.y; } - func_80832CFC(this); + Player_SkelAnimeResetPrevTranslRot(this); this->skelAnime.moveFlags = 0; } } @@ -1905,14 +1909,14 @@ void func_80832E48(Player* this, s32 flags) { func_808322FC(this); } -#define FLAG_FUNC_80832F54_8 (1 << 8) -#define FLAG_FUNC_80832F54_9 (1 << 9) +#define ANIM_REPLACE_APPLY_FLAG_8 (1 << 8) +#define ANIM_REPLACE_APPLY_FLAG_9 (1 << 9) -void func_80832F54(PlayState* play, Player* this, s32 flags) { - if (flags & FLAG_FUNC_80832F54_9) { - func_80832D20(this); - } else if ((flags & FLAG_FUNC_80832F54_8) || (this->skelAnime.moveFlags != 0)) { - func_80832CFC(this); +void Player_AnimReplaceApplyFlags(PlayState* play, Player* this, s32 flags) { + if (flags & ANIM_REPLACE_APPLY_FLAG_9) { + Player_SkelAnimeResetPrevTranslRotAgeScale(this); + } else if ((flags & ANIM_REPLACE_APPLY_FLAG_8) || (this->skelAnime.moveFlags != 0)) { + Player_SkelAnimeResetPrevTranslRot(this); } else { this->skelAnime.prevTransl = this->skelAnime.jointTable[0]; this->skelAnime.prevRot = this->actor.shape.rot.y; @@ -1923,38 +1927,42 @@ void func_80832F54(PlayState* play, Player* this, s32 flags) { AnimationContext_DisableQueue(play); } -void func_80832FFC(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, f32 playbackSpeed) { +void Player_AnimReplacePlayOnceSetSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, + f32 playbackSpeed) { LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, playbackSpeed); - func_80832F54(play, this, flags); + Player_AnimReplaceApplyFlags(play, this, flags); } -void func_8083303C(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { - func_80832FFC(play, this, anim, flags, 1.0f); +void Player_AnimReplacePlayOnce(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { + Player_AnimReplacePlayOnceSetSpeed(play, this, anim, flags, 1.0f); } -void func_80833064(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { - func_80832FFC(play, this, anim, flags, 2.0f / 3.0f); +void Player_AnimReplacePlayOnceAdjusted(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { + Player_AnimReplacePlayOnceSetSpeed(play, this, anim, flags, PLAYER_ANIM_ADJUSTED_SPEED); } -void func_8083308C(PlayState* play, Player* this, LinkAnimationHeader* anim) { - func_80833064(play, this, anim, ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE); +void Player_AnimReplaceNormalPlayOnceAdjusted(PlayState* play, Player* this, LinkAnimationHeader* anim) { + Player_AnimReplacePlayOnceAdjusted(play, this, anim, + ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE); } -void func_808330AC(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, f32 playbackSpeed) { +void Player_AnimReplacePlayLoopSetSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, + f32 playbackSpeed) { LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, anim, playbackSpeed); - func_80832F54(play, this, flags); + Player_AnimReplaceApplyFlags(play, this, flags); } -void func_808330EC(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { - func_808330AC(play, this, anim, flags, 1.0f); +void Player_AnimReplacePlayLoop(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { + Player_AnimReplacePlayLoopSetSpeed(play, this, anim, flags, 1.0f); } -void func_80833114(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { - func_808330AC(play, this, anim, flags, 2.0f / 3.0f); +void Player_AnimReplacePlayLoopAdjusted(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { + Player_AnimReplacePlayLoopSetSpeed(play, this, anim, flags, PLAYER_ANIM_ADJUSTED_SPEED); } -void func_8083313C(PlayState* play, Player* this, LinkAnimationHeader* anim) { - func_80833114(play, this, anim, ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE); +void Player_AnimReplaceNormalPlayLoopAdjusted(PlayState* play, Player* this, LinkAnimationHeader* anim) { + Player_AnimReplacePlayLoopAdjusted(play, this, anim, + ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE); } void func_8083315C(PlayState* play, Player* this) { @@ -2000,7 +2008,7 @@ void func_808332F4(Player* this, PlayState* play) { this->unk_862 = ABS(giEntry->gi); } -static LinkAnimationHeader* func_80833338(Player* this) { +LinkAnimationHeader* func_80833338(Player* this) { return GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType); } @@ -2605,7 +2613,7 @@ s32 func_80834A2C(Player* this, PlayState* play) { if (func_80833350(this) != 0) { func_808348EC(play, this); - func_80832264(play, this, func_80833338(this)); + Player_AnimPlayOnce(play, this, func_80833338(this)); this->unk_6AC = 0; } else { func_808348EC(play, this); @@ -2678,9 +2686,9 @@ s32 func_80834D2C(Player* this, PlayState* play) { } if (this->stateFlags1 & PLAYER_STATE1_23) { - func_80832284(play, this, &gPlayerAnim_link_uma_anim_walk); + Player_AnimPlayLoop(play, this, &gPlayerAnim_link_uma_anim_walk); } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !func_80833B54(this)) { - func_80832284(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType)); + Player_AnimPlayLoop(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType)); } return 1; @@ -3227,7 +3235,7 @@ void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) { this->stateFlags1 |= PLAYER_STATE1_7; - func_80832264(play, this, anim); + Player_AnimPlayOnce(play, this, anim); if (anim == &gPlayerAnim_link_derth_rebirth) { this->skelAnime.endFrame = 84.0f; } @@ -3265,10 +3273,10 @@ s32 func_80836670(Player* this, PlayState* play) { if (!(this->stateFlags1 & PLAYER_STATE1_23) && (this->actor.parent != NULL) && Player_HoldsHookshot(this)) { func_80835C58(play, this, func_80850AEC, 1); this->stateFlags3 |= PLAYER_STATE3_7; - func_80832264(play, this, &gPlayerAnim_link_hook_fly_start); - func_80832F54(play, this, - ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | - ANIM_FLAG_PLAYER_7); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_hook_fly_start); + Player_AnimReplaceApplyFlags(play, this, + ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | + ANIM_FLAG_PLAYER_7); func_80832224(this); this->yaw = this->actor.shape.rot.y; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; @@ -3785,9 +3793,9 @@ void func_80837948(PlayState* play, Player* this, s32 arg2) { this->meleeWeaponAnimation = arg2; - func_808322D0(play, this, D_80854190[arg2].unk_00); + Player_AnimPlayOnceAdjusted(play, this, D_80854190[arg2].unk_00); if ((arg2 != PLAYER_MWA_FLIPSLASH_START) && (arg2 != PLAYER_MWA_JUMPSLASH_START)) { - func_80832F54(play, this, FLAG_FUNC_80832F54_9 | ANIM_FLAG_0 | ANIM_FLAG_PLAYER_SETMOVE); + Player_AnimReplaceApplyFlags(play, this, ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_0 | ANIM_FLAG_PLAYER_SETMOVE); } this->yaw = this->actor.shape.rot.y; @@ -3837,7 +3845,7 @@ void func_80837B60(Player* this) { void func_80837B9C(Player* this, PlayState* play) { func_80835C58(play, this, func_8084411C, 0); - func_80832284(play, this, &gPlayerAnim_link_normal_landing_wait); + Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_landing_wait); this->unk_850 = 1; if (this->unk_6AD != 3) { this->unk_6AD = 0; @@ -3851,7 +3859,7 @@ static LinkAnimationHeader* D_808544B0[] = { }; void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, s16 arg5, s32 arg6) { - LinkAnimationHeader* sp2C = NULL; + LinkAnimationHeader* anim = NULL; LinkAnimationHeader** sp28; if (this->stateFlags1 & PLAYER_STATE1_13) { @@ -3875,7 +3883,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, if (arg2 == 3) { func_80835C58(play, this, func_8084FB10, 0); - sp2C = &gPlayerAnim_link_normal_ice_down; + anim = &gPlayerAnim_link_normal_ice_down; func_80832224(this); Player_RequestRumble(this, 255, 10, 40, 0); @@ -3887,7 +3895,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, Player_RequestRumble(this, 255, 80, 150, 0); - func_808322A4(play, this, &gPlayerAnim_link_normal_electric_shock); + Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_normal_electric_shock); func_80832224(this); this->unk_850 = 20; @@ -3900,7 +3908,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, this->speedXZ = 4.0f; this->actor.velocity.y = 0.0f; - sp2C = &gPlayerAnim_link_swimer_swim_hit; + anim = &gPlayerAnim_link_swimer_swim_hit; func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } else if ((arg2 == 1) || (arg2 == 2) || !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || @@ -3919,7 +3927,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, this->speedXZ = 3.0f; this->actor.velocity.y = 6.0f; - func_80832C2C(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_damage_run, this->modelAnimType)); + Player_AnimChangeFreeze(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_damage_run, this->modelAnimType)); func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } else { this->actor.speed = arg3; @@ -3927,9 +3935,9 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, this->actor.velocity.y = arg4; if (ABS(arg5) > 0x4000) { - sp2C = &gPlayerAnim_link_normal_front_downA; + anim = &gPlayerAnim_link_normal_front_downA; } else { - sp2C = &gPlayerAnim_link_normal_back_downA; + anim = &gPlayerAnim_link_normal_back_downA; } if ((this->actor.category != ACTORCAT_PLAYER) && (this->actor.colChkInfo.health == 0)) { @@ -3970,7 +3978,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, sp28 += 1; } - sp2C = *sp28; + anim = *sp28; func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } @@ -3987,8 +3995,8 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, this->stateFlags1 |= PLAYER_STATE1_26; - if (sp2C != NULL) { - func_808322D0(play, this, sp2C); + if (anim != NULL) { + Player_AnimPlayOnceAdjusted(play, this, anim); } } @@ -4126,7 +4134,7 @@ s32 func_808382DC(Player* this, PlayState* play) { } LinkAnimation_PlayOnce(play, &this->skelAnime2, anim); } else { - func_80832264(play, this, D_808543C4[Player_HoldsTwoHandedWeapon(this)]); + Player_AnimPlayOnce(play, this, D_808543C4[Player_HoldsTwoHandedWeapon(this)]); } } @@ -4200,7 +4208,7 @@ void func_80838940(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* func_80835C58(play, this, func_8084411C, 1); if (anim != NULL) { - func_808322D0(play, this, anim); + Player_AnimPlayOnceAdjusted(play, this, anim); } this->actor.velocity.y = arg2 * D_808535E8; @@ -4219,7 +4227,7 @@ void func_808389E8(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* s32 func_80838A14(Player* this, PlayState* play) { s32 sp3C; - LinkAnimationHeader* sp38; + LinkAnimationHeader* anim; f32 sp34; f32 temp; f32 wallPolyNormalX; @@ -4262,7 +4270,7 @@ s32 func_80838A14(Player* this, PlayState* play) { sp34 = this->wallHeight; if (this->ageProperties->unk_14 <= sp34) { - sp38 = &gPlayerAnim_link_normal_250jump_start; + anim = &gPlayerAnim_link_normal_250jump_start; this->speedXZ = 1.0f; } else { wallPolyNormalX = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.x); @@ -4272,14 +4280,14 @@ s32 func_80838A14(Player* this, PlayState* play) { this->stateFlags1 |= PLAYER_STATE1_14; if (func_808332B8(this)) { - sp38 = &gPlayerAnim_link_swimer_swim_15step_up; + anim = &gPlayerAnim_link_swimer_swim_15step_up; sp34 -= (60.0f * this->ageProperties->unk_08); this->stateFlags1 &= ~PLAYER_STATE1_27; } else if (this->ageProperties->unk_18 <= sp34) { - sp38 = &gPlayerAnim_link_normal_150step_up; + anim = &gPlayerAnim_link_normal_150step_up; sp34 -= (59.0f * this->ageProperties->unk_08); } else { - sp38 = &gPlayerAnim_link_normal_100step_up; + anim = &gPlayerAnim_link_normal_100step_up; sp34 -= (41.0f * this->ageProperties->unk_08); } @@ -4294,7 +4302,7 @@ s32 func_80838A14(Player* this, PlayState* play) { this->actor.bgCheckFlags |= BGCHECKFLAG_GROUND; - LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, sp38, 1.3f); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, 1.3f); AnimationContext_DisableQueue(play); this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; @@ -4322,12 +4330,12 @@ void func_80838E70(PlayState* play, Player* this, f32 arg2, s16 arg3) { this->unk_450.x = (Math_SinS(arg3) * arg2) + this->actor.world.pos.x; this->unk_450.z = (Math_CosS(arg3) * arg2) + this->actor.world.pos.z; - func_80832264(play, this, func_80833338(this)); + Player_AnimPlayOnce(play, this, func_80833338(this)); } void func_80838F18(PlayState* play, Player* this) { func_80835C58(play, this, func_8084D610, 0); - func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim_wait); + Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim_wait); } void func_80838F5C(PlayState* play, Player* this) { @@ -4341,7 +4349,7 @@ void func_80838F5C(PlayState* play, Player* this) { s32 func_80838FB8(PlayState* play, Player* this) { if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (this->stateFlags1 & PLAYER_STATE1_31)) { func_80838F5C(play, this); - func_80832284(play, this, &gPlayerAnim_link_normal_landing_wait); + Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_landing_wait); func_80832698(this, NA_SE_VO_LI_FALL_S); Sfx_PlaySfxCentered2(NA_SE_OC_SECRET_WARP_IN); return 1; @@ -4637,7 +4645,7 @@ s32 func_80839800(Player* this, PlayState* play) { if (this->doorTimer != 0) { this->unk_850 = 0; - func_80832B0C(play, this, func_80833338(this)); + Player_AnimChangeOnceMorph(play, this, func_80833338(this)); this->skelAnime.endFrame = 0.0f; } else { this->speedXZ = 0.1f; @@ -4691,9 +4699,9 @@ s32 func_80839800(Player* this, PlayState* play) { } func_80832224(this); - func_80832F54(play, this, - FLAG_FUNC_80832F54_9 | ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 | - ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_PLAYER_7); + Player_AnimReplaceApplyFlags(play, this, + ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | + ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_PLAYER_7); // If this door is the second half of a double door (spawned as child) if (doorActor->parent != NULL) { @@ -4768,13 +4776,13 @@ void func_80839E88(Player* this, PlayState* play) { } this->unk_874 = this->unk_870; - func_80832284(play, this, anim); + Player_AnimPlayLoop(play, this, anim); this->yaw = this->actor.shape.rot.y; } void func_80839F30(Player* this, PlayState* play) { func_80835C58(play, this, func_808407CC, 1); - func_80832B0C(play, this, func_80833338(this)); + Player_AnimChangeOnceMorph(play, this, func_80833338(this)); this->yaw = this->actor.shape.rot.y; } @@ -4851,7 +4859,7 @@ void func_8083A0F4(PlayState* play, Player* this) { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_carryB, this->modelAnimType); } - func_80832264(play, this, anim); + Player_AnimPlayOnce(play, this, anim); } } else { func_80839F90(this, play); @@ -4932,20 +4940,20 @@ s32 func_8083A4A8(Player* this, PlayState* play) { return 1; } -void func_8083A5C4(PlayState* play, Player* this, CollisionPoly* arg2, f32 arg3, LinkAnimationHeader* arg4) { +void func_8083A5C4(PlayState* play, Player* this, CollisionPoly* arg2, f32 arg3, LinkAnimationHeader* anim) { f32 nx = COLPOLY_GET_NORMAL(arg2->normal.x); f32 nz = COLPOLY_GET_NORMAL(arg2->normal.z); func_80835C58(play, this, func_8084BBE4, 0); func_80832564(play, this); - func_80832264(play, this, arg4); + Player_AnimPlayOnce(play, this, anim); this->actor.world.pos.x -= (arg3 + 1.0f) * nx; this->actor.world.pos.z -= (arg3 + 1.0f) * nz; this->actor.shape.rot.y = this->yaw = Math_Atan2S(nz, nx); func_80832224(this); - func_80832CFC(this); + Player_SkelAnimeResetPrevTranslRot(this); } s32 func_8083A6AC(Player* this, PlayState* play) { @@ -4996,9 +5004,9 @@ s32 func_8083A6AC(Player* this, PlayState* play) { this->actor.shape.rot.y = this->yaw; this->stateFlags1 |= PLAYER_STATE1_21; - func_80832F54(play, this, - ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | - ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); + Player_AnimReplaceApplyFlags(play, this, + ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 | + ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); this->unk_850 = -1; this->unk_84F = sp50; @@ -5088,7 +5096,7 @@ void func_8083AA10(Player* this, PlayState* play) { if ((D_80853604 == FLOOR_PROPERTY_9) || (D_80853600 <= this->ageProperties->unk_34) || !func_8083A6AC(this, play)) { - func_80832284(play, this, &gPlayerAnim_link_normal_landing_wait); + Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_landing_wait); return; } } @@ -5227,7 +5235,7 @@ s32 func_8083B040(Player* this, PlayState* play) { } else { func_80835C58(play, this, func_8085063C, 1); this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; - func_80832264(play, this, func_80833338(this)); + Player_AnimPlayOnce(play, this, func_80833338(this)); func_80835EA4(play, 4); } @@ -5293,9 +5301,10 @@ s32 func_8083B040(Player* this, PlayState* play) { this->exchangeItemId = sp2C; if (this->unk_84F < 0) { - func_80832B0C(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check, this->modelAnimType)); + Player_AnimChangeOnceMorph(play, this, + GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check, this->modelAnimType)); } else { - func_80832264(play, this, D_80854548[this->unk_84F]); + Player_AnimPlayOnce(play, this, D_80854548[this->unk_84F]); } func_80832224(this); @@ -5307,20 +5316,20 @@ s32 func_8083B040(Player* this, PlayState* play) { if (sp2C >= 0) { if (sp2C == 0xC) { func_80835DE4(play, this, func_8084EED8, 0); - func_808322D0(play, this, &gPlayerAnim_link_bottle_bug_out); + Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_bottle_bug_out); func_80835EA4(play, 3); } else if ((sp2C > 0) && (sp2C < 4)) { func_80835DE4(play, this, func_8084EFC0, 0); - func_808322D0(play, this, &gPlayerAnim_link_bottle_fish_out); + Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_bottle_fish_out); func_80835EA4(play, (sp2C == 1) ? 1 : 5); } else { func_80835DE4(play, this, func_8084EAC0, 0); - func_80832B78(play, this, &gPlayerAnim_link_bottle_drink_demo_start); + Player_AnimChangeOnceMorphAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_start); func_80835EA4(play, 2); } } else { func_80835DE4(play, this, func_8084E3C4, 0); - func_808322D0(play, this, &gPlayerAnim_link_normal_okarina_start); + Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_okarina_start); this->stateFlags2 |= PLAYER_STATE2_27; func_80835EA4(play, (this->unk_6A8 != NULL) ? 0x5B : 0x5A); if (this->unk_6A8 != NULL) { @@ -5597,7 +5606,7 @@ void func_8083C0B8(Player* this, PlayState* play) { void func_8083C0E8(Player* this, PlayState* play) { func_80835C58(play, this, func_80840BC8, 1); - func_80832264(play, this, func_80833338(this)); + Player_AnimPlayOnce(play, this, func_80833338(this)); this->yaw = this->actor.shape.rot.y; } @@ -5668,7 +5677,7 @@ s32 func_8083C2B0(Player* this, PlayState* play) { LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); if (Player_IsChildWithHylianShield(this)) { - func_80832F54(play, this, ANIM_FLAG_PLAYER_2); + Player_AnimReplaceApplyFlags(play, this, ANIM_FLAG_PLAYER_2); } Player_PlaySfx(this, NA_SE_IT_SHIELD_POSTURE); @@ -5722,7 +5731,7 @@ s32 func_8083C61C(PlayState* play, Player* this) { if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (AMMO(ITEM_DEKU_NUT) != 0)) { func_80835C58(play, this, func_8084E604, 0); - func_80832264(play, this, &gPlayerAnim_link_normal_light_bom); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_light_bom); this->unk_6AD = 0; return 1; } @@ -5746,7 +5755,7 @@ s32 func_8083C6B8(PlayState* play, Player* this) { this->unk_850 = 1; } - func_808322D0(play, this, D_80854554[this->unk_850].unk_00); + Player_AnimPlayOnceAdjusted(play, this, D_80854554[this->unk_850].unk_00); Player_PlaySfx(this, NA_SE_IT_SWORD_SWING); func_80832698(this, NA_SE_VO_LI_AUTO_JUMP); @@ -5766,7 +5775,7 @@ s32 func_8083C6B8(PlayState* play, Player* this) { func_80835C58(play, this, func_80850C68, 0); this->unk_860 = 1; Player_ZeroSpeedXZ(this); - func_80832264(play, this, &gPlayerAnim_link_fishing_throw); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_fishing_throw); return 1; } else { return 0; @@ -5786,7 +5795,7 @@ void func_8083C858(Player* this, PlayState* play) { } func_80835C58(play, this, func, 1); - func_80832BE8(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_run, this->modelAnimType)); + Player_AnimChangeLoopMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_run, this->modelAnimType)); this->unk_89C = 0; this->unk_864 = this->unk_868 = 0.0f; @@ -5807,7 +5816,7 @@ s32 func_8083C910(PlayState* play, Player* this, f32 arg2) { sp28 -= this->actor.world.pos.y; if (this->ageProperties->unk_24 <= sp28) { func_80835C58(play, this, func_8084D7C4, 0); - func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim); + Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim); this->stateFlags1 |= PLAYER_STATE1_27 | PLAYER_STATE1_29; this->unk_850 = 20; this->speedXZ = 2.0f; @@ -5859,7 +5868,7 @@ void func_8083CB2C(Player* this, s16 yaw, PlayState* play) { void func_8083CB94(Player* this, PlayState* play) { func_80835C58(play, this, func_80840DE4, 1); - func_80832BE8(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_walk, this->modelAnimType)); + Player_AnimChangeLoopMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_walk, this->modelAnimType)); } void func_8083CBF0(Player* this, s16 yaw, PlayState* play) { @@ -5872,7 +5881,7 @@ void func_8083CBF0(Player* this, s16 yaw, PlayState* play) { void func_8083CC9C(Player* this, PlayState* play) { func_80835C58(play, this, func_8084193C, 1); - func_80832BE8(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_side_walkR, this->modelAnimType)); + Player_AnimChangeLoopMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_side_walkR, this->modelAnimType)); this->unk_868 = 0.0f; } @@ -5900,14 +5909,14 @@ void func_8083CE0C(Player* this, PlayState* play) { } else { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_waitL2wait, this->modelAnimType); } - func_80832264(play, this, anim); + Player_AnimPlayOnce(play, this, anim); this->yaw = this->actor.shape.rot.y; } void func_8083CEAC(Player* this, PlayState* play) { func_80835C58(play, this, func_80840450, 1); - func_80832B0C(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait2waitR, this->modelAnimType)); + Player_AnimChangeOnceMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait2waitR, this->modelAnimType)); this->unk_850 = 1; } @@ -5969,7 +5978,7 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { (this->currentBoots != PLAYER_BOOTS_IRON))) { func_80835C58(play, this, func_8084DC48, 0); - func_80832264(play, this, &gPlayerAnim_link_swimer_swim_deep_start); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_swimer_swim_deep_start); this->unk_6C2 = 0; this->stateFlags2 |= PLAYER_STATE2_10; @@ -6001,9 +6010,10 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { } func_80832340(play, this); - func_80832B0C(play, this, - (this->stateFlags1 & PLAYER_STATE1_11) ? &gPlayerAnim_link_swimer_swim_get - : &gPlayerAnim_link_swimer_swim_deep_end); + Player_AnimChangeOnceMorph(play, this, + (this->stateFlags1 & PLAYER_STATE1_11) + ? &gPlayerAnim_link_swimer_swim_get + : &gPlayerAnim_link_swimer_swim_deep_end); if (func_8083CFA8(play, this, this->actor.velocity.y, 500)) { Player_PlaySfx(this, NA_SE_PL_FACE_UP); @@ -6018,7 +6028,7 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { } void func_8083D330(PlayState* play, Player* this) { - func_80832284(play, this, &gPlayerAnim_link_swimer_swim); + Player_AnimPlayLoop(play, this, &gPlayerAnim_link_swimer_swim); this->unk_6C2 = 16000; this->unk_850 = 1; } @@ -6036,9 +6046,10 @@ void func_8083D36C(PlayState* play, Player* this) { func_8083D330(play, this); } else { func_80835C58(play, this, func_8084D610, 1); - func_80832B0C(play, this, - (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) ? &gPlayerAnim_link_swimer_wait2swim_wait - : &gPlayerAnim_link_swimer_land2swim_wait); + Player_AnimChangeOnceMorph(play, this, + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) + ? &gPlayerAnim_link_swimer_wait2swim_wait + : &gPlayerAnim_link_swimer_land2swim_wait); } } @@ -6318,10 +6329,10 @@ s32 func_8083E0FC(Player* this, PlayState* play) { this->yaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; Actor_MountHorse(play, this, &rideActor->actor); - func_80832264(play, this, D_80854578[temp].anim); - func_80832F54(play, this, - ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | - ANIM_FLAG_PLAYER_7); + Player_AnimPlayOnce(play, this, D_80854578[temp].anim); + Player_AnimReplaceApplyFlags(play, this, + ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | + ANIM_FLAG_PLAYER_7); this->actor.parent = this->rideActor; func_80832224(this); Actor_DisableLens(play); @@ -6379,7 +6390,7 @@ s32 func_8083E318(PlayState* play, Player* this, CollisionPoly* floorPoly) { if (D_80853610 >= 0) { this->unk_84F = 1; } - func_80832BE8(play, this, D_80854590[this->unk_84F]); + Player_AnimChangeLoopMorph(play, this, D_80854590[this->unk_84F]); this->speedXZ = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z)); this->yaw = playerVelYaw; return true; @@ -6437,7 +6448,7 @@ s32 func_8083E5A8(Player* this, PlayState* play) { if (!(this->stateFlags2 & PLAYER_STATE2_10) || (this->currentBoots == PLAYER_BOOTS_IRON)) { func_80836898(play, this, func_8083A434); - func_808322D0(play, this, &gPlayerAnim_link_demo_get_itemB); + Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_demo_get_itemB); func_80835EA4(play, 9); } @@ -6475,14 +6486,15 @@ s32 func_8083E5A8(Player* this, PlayState* play) { if ((giEntry->itemId != ITEM_NONE) && (giEntry->gi >= 0) && (Item_CheckObtainability(giEntry->itemId) == ITEM_NONE)) { - func_808322D0(play, this, this->ageProperties->unk_98); - func_80832F54(play, this, - FLAG_FUNC_80832F54_9 | ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 | - ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_PLAYER_7); + Player_AnimPlayOnceAdjusted(play, this, this->ageProperties->unk_98); + Player_AnimReplaceApplyFlags(play, this, + ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | + ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | + ANIM_FLAG_PLAYER_7); chest->unk_1F4 = 1; Camera_ChangeSetting(Play_GetCamera(play, CAM_ID_MAIN), CAM_SET_SLOW_CHEST_CS); } else { - func_80832264(play, this, &gPlayerAnim_link_normal_box_kick); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_box_kick); chest->unk_1F4 = -1; } @@ -6527,7 +6539,7 @@ s32 func_8083E5A8(Player* this, PlayState* play) { void func_8083EA94(Player* this, PlayState* play) { func_80835C58(play, this, func_80846578, 1); - func_80832264(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_throw, this->modelAnimType)); + Player_AnimPlayOnce(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_throw, this->modelAnimType)); } s32 func_8083EAF0(Player* this, Actor* actor) { @@ -6545,7 +6557,7 @@ s32 func_8083EB44(Player* this, PlayState* play) { if (!func_80835644(play, this, this->heldActor)) { if (!func_8083EAF0(this, this->heldActor)) { func_80835C58(play, this, func_808464B0, 1); - func_80832264(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_put, this->modelAnimType)); + Player_AnimPlayOnce(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_put, this->modelAnimType)); } else { func_8083EA94(this, play); } @@ -6622,7 +6634,7 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 interactWallFlags) { f32 wallPolyNormalX = COLPOLY_GET_NORMAL(wallPoly->normal.x); f32 wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); f32 sp34 = this->wallDistance; - LinkAnimationHeader* sp30; + LinkAnimationHeader* anim; func_80836898(play, this, func_8083A3B0); this->stateFlags1 |= PLAYER_STATE1_21; @@ -6631,20 +6643,20 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 interactWallFlags) { if ((sp8C != 0) || (interactWallFlags & WALL_FLAG_1)) { if ((this->unk_84F = sp8C) != 0) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - sp30 = &gPlayerAnim_link_normal_Fclimb_startA; + anim = &gPlayerAnim_link_normal_Fclimb_startA; } else { - sp30 = &gPlayerAnim_link_normal_Fclimb_hold2upL; + anim = &gPlayerAnim_link_normal_Fclimb_hold2upL; } sp34 = (this->ageProperties->unk_38 - 1.0f) - sp34; } else { - sp30 = this->ageProperties->unk_A4; + anim = this->ageProperties->unk_A4; sp34 = sp34 - 1.0f; } this->unk_850 = -2; this->actor.world.pos.y += phi_f20; this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; } else { - sp30 = this->ageProperties->unk_A8; + anim = this->ageProperties->unk_A8; this->unk_850 = -4; this->actor.shape.rot.y = this->yaw = this->actor.wallYaw; } @@ -6653,10 +6665,10 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 interactWallFlags) { this->actor.world.pos.z = (sp34 * wallPolyNormalZ) + sp7C; func_80832224(this); Math_Vec3f_Copy(&this->actor.prevPos, &this->actor.world.pos); - func_80832264(play, this, sp30); - func_80832F54(play, this, - ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | - ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); + Player_AnimPlayOnce(play, this, anim); + Player_AnimReplaceApplyFlags(play, this, + ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 | + ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); return true; } @@ -6734,10 +6746,10 @@ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWall this->actor.world.pos.z = zVertex1 + (wallDistance * wallPolyNormalZ); func_80832224(this); this->actor.prevPos = this->actor.world.pos; - func_80832264(play, this, &gPlayerAnim_link_child_tunnel_start); - func_80832F54(play, this, - ANIM_FLAG_0 | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | - ANIM_FLAG_PLAYER_7); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_child_tunnel_start); + Player_AnimReplaceApplyFlags(play, this, + ANIM_FLAG_0 | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | + ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); return true; } @@ -6824,10 +6836,10 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { if (this->speedXZ > 0.0f) { // Leaving a crawlspace forwards this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; - func_80832264(play, this, &gPlayerAnim_link_child_tunnel_end); - func_80832F54(play, this, - ANIM_FLAG_0 | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | - ANIM_FLAG_PLAYER_7); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_child_tunnel_end); + Player_AnimReplaceApplyFlags(play, this, + ANIM_FLAG_0 | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | + ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); OnePointCutscene_Init(play, 9601, 999, NULL, CAM_ID_MAIN); } else { // Leaving a crawlspace backwards @@ -6835,9 +6847,9 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_child_tunnel_start, -1.0f, Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_start), 0.0f, ANIMMODE_ONCE, 0.0f); - func_80832F54(play, this, - ANIM_FLAG_0 | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | - ANIM_FLAG_PLAYER_7); + Player_AnimReplaceApplyFlags(play, this, + ANIM_FLAG_0 | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | + ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); OnePointCutscene_Init(play, 9602, 999, NULL, CAM_ID_MAIN); } @@ -6856,7 +6868,7 @@ void func_8083F72C(Player* this, LinkAnimationHeader* anim, PlayState* play) { func_80835C58(play, this, func_8084B78C, 0); } - func_80832264(play, this, anim); + Player_AnimPlayOnce(play, this, anim); func_80832224(this); this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; @@ -6933,7 +6945,7 @@ s32 func_8083F9D0(PlayState* play, Player* this) { } func_80839FFC(this, play); - func_80832264(play, this, &gPlayerAnim_link_normal_push_wait_end); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_push_wait_end); this->stateFlags2 &= ~PLAYER_STATE2_4; return 1; } @@ -6941,13 +6953,13 @@ s32 func_8083F9D0(PlayState* play, Player* this) { void func_8083FAB8(Player* this, PlayState* play) { func_80835C58(play, this, func_8084B898, 0); this->stateFlags2 |= PLAYER_STATE2_4; - func_80832264(play, this, &gPlayerAnim_link_normal_push_start); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_push_start); } void func_8083FB14(Player* this, PlayState* play) { func_80835C58(play, this, func_8084B9E4, 0); this->stateFlags2 |= PLAYER_STATE2_4; - func_80832264(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_pull_start, this->modelAnimType)); + Player_AnimPlayOnce(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_pull_start, this->modelAnimType)); } void func_8083FB7C(Player* this, PlayState* play) { @@ -7143,7 +7155,7 @@ void func_80840450(Player* this, PlayState* play) { if (this->unk_850 != 0) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832DBC(this); - func_80832284(play, this, func_808334E4(this)); + Player_AnimPlayLoop(play, this, func_808334E4(this)); this->unk_850 = 0; this->stateFlags3 &= ~PLAYER_STATE3_3; } @@ -7215,7 +7227,7 @@ void func_808407CC(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832DBC(this); - func_80832264(play, this, func_80833338(this)); + Player_AnimPlayOnce(play, this, func_80833338(this)); } func_8083721C(this); @@ -7513,7 +7525,7 @@ void func_80841138(Player* this, PlayState* play) { void func_8084140C(Player* this, PlayState* play) { func_80835C58(play, this, func_8084170C, 1); - func_80832B0C(play, this, &gPlayerAnim_link_normal_back_brake); + Player_AnimChangeOnceMorph(play, this, &gPlayerAnim_link_normal_back_brake); } s32 func_80841458(Player* this, f32* arg1, s16* arg2, PlayState* play) { @@ -7576,7 +7588,7 @@ void func_808414F8(Player* this, PlayState* play) { void func_808416C0(Player* this, PlayState* play) { func_80835C58(play, this, func_808417FC, 1); - func_80832264(play, this, &gPlayerAnim_link_normal_back_brake_end); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_back_brake_end); } void func_8084170C(Player* this, PlayState* play) { @@ -7980,7 +7992,7 @@ s32 func_8084285C(Player* this, f32 arg1, f32 arg2, f32 arg3) { s32 func_808428D8(Player* this, PlayState* play) { if (!Player_IsChildWithHylianShield(this) && (Player_GetMeleeWeaponHeld(this) != 0) && D_80853614) { - func_80832264(play, this, &gPlayerAnim_link_normal_defense_kiru); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_defense_kiru); this->unk_84F = 1; this->meleeWeaponAnimation = PLAYER_MWA_STAB_1H; this->yaw = this->actor.shape.rot.y + this->unk_6BE; @@ -8072,7 +8084,7 @@ void func_80842D20(PlayState* play, Player* this) { sp28 = 0; } - func_808322D0(play, this, D_808545CC[Player_HoldsTwoHandedWeapon(this) + sp28]); + Player_AnimPlayOnceAdjusted(play, this, D_808545CC[Player_HoldsTwoHandedWeapon(this) + sp28]); } Player_RequestRumble(this, 180, 20, 100, 0); @@ -8184,7 +8196,7 @@ void func_80843188(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (!Player_IsChildWithHylianShield(this)) { - func_80832284(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_defense_wait, this->modelAnimType)); + Player_AnimPlayLoop(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_defense_wait, this->modelAnimType)); } this->unk_850 = 1; this->unk_84F = 0; @@ -8247,7 +8259,7 @@ void func_80843188(Player* this, PlayState* play) { LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_clink_normal_defense_ALL, 1.0f, Animation_GetLastFrame(&gPlayerAnim_clink_normal_defense_ALL), 0.0f, ANIMMODE_ONCE, 0.0f); - func_80832F54(play, this, ANIM_FLAG_PLAYER_2); + Player_AnimReplaceApplyFlags(play, this, ANIM_FLAG_PLAYER_2); } else { if (this->itemAction < 0) { func_8008EC70(this); @@ -8341,9 +8353,9 @@ void func_8084377C(Player* this, PlayState* play) { this->stateFlags1 |= PLAYER_STATE1_26; } - func_80832264(play, this, - (this->yaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_downB - : &gPlayerAnim_link_normal_back_downB); + Player_AnimPlayOnce(play, this, + (this->yaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_downB + : &gPlayerAnim_link_normal_back_downB); func_80832698(this, NA_SE_VO_LI_FREEZE); } } @@ -8367,9 +8379,9 @@ void func_80843954(Player* this, PlayState* play) { this->stateFlags1 |= PLAYER_STATE1_26; } - func_808322D0(play, this, - (this->yaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_down_wake - : &gPlayerAnim_link_normal_back_down_wake); + Player_AnimPlayOnceAdjusted(play, this, + (this->yaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_down_wake + : &gPlayerAnim_link_normal_back_down_wake); this->yaw = this->actor.shape.rot.y; } } @@ -8717,7 +8729,7 @@ void func_80844708(Player* this, PlayState* play) { } } - func_80832264(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_hip_down, this->modelAnimType)); + Player_AnimPlayOnce(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_hip_down, this->modelAnimType)); this->speedXZ = -this->speedXZ; Player_RequestQuake(play, 33267, 3, 12); Player_RequestRumble(this, 255, 20, 150, 0); @@ -8757,7 +8769,7 @@ void func_80844A44(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; if (LinkAnimation_Update(play, &this->skelAnime)) { - func_80832284(play, this, &gPlayerAnim_link_normal_run_jump_water_fall_wait); + Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_run_jump_water_fall_wait); } Math_StepToF(&this->speedXZ, 0.0f, 0.05f); @@ -8834,14 +8846,14 @@ void func_80844D30(Player* this, PlayState* play) { void func_80844D68(Player* this, PlayState* play) { func_80839FFC(this, play); func_80832318(this); - func_80832B0C(play, this, D_80854368[Player_HoldsTwoHandedWeapon(this)]); + Player_AnimChangeOnceMorph(play, this, D_80854368[Player_HoldsTwoHandedWeapon(this)]); this->yaw = this->actor.shape.rot.y; } void func_80844DC8(Player* this, PlayState* play) { func_80835C58(play, this, func_80844E68, 1); this->unk_868 = 0.0f; - func_80832284(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); + Player_AnimPlayLoop(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); this->unk_850 = 1; } @@ -8860,7 +8872,7 @@ void func_80844E68(Player* this, PlayState* play) { func_80832DBC(this); func_808355DC(this); this->stateFlags1 &= ~PLAYER_STATE1_17; - func_80832284(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); + Player_AnimPlayLoop(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); this->unk_850 = -1; } @@ -9338,7 +9350,7 @@ void func_80846260(Player* this, PlayState* play) { func_8083721C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { - func_80832284(play, this, &gPlayerAnim_link_silver_wait); + Player_AnimPlayLoop(play, this, &gPlayerAnim_link_silver_wait); this->unk_850 = 1; return; } @@ -9360,7 +9372,7 @@ void func_80846260(Player* this, PlayState* play) { } else if (CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)) { func_80835C58(play, this, func_80846358, 1); - func_80832264(play, this, &gPlayerAnim_link_silver_throw); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_silver_throw); } } @@ -9384,7 +9396,7 @@ void func_80846358(Player* this, PlayState* play) { void func_80846408(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { - func_80832284(play, this, &gPlayerAnim_link_normal_nocarry_free_wait); + Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_nocarry_free_wait); this->unk_850 = 15; return; } @@ -9546,9 +9558,9 @@ void func_808467D4(PlayState* play, Player* this) { this->yaw = this->actor.shape.rot.y = -0x8000; LinkAnimation_Change(play, &this->skelAnime, this->ageProperties->unk_A0, 2.0f / 3.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); - func_80832F54(play, this, - FLAG_FUNC_80832F54_9 | ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 | - ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_PLAYER_7); + Player_AnimReplaceApplyFlags(play, this, + ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 | + ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_PLAYER_7); if (LINK_IS_ADULT) { func_80846720(play, this, 0); } @@ -9557,8 +9569,9 @@ void func_808467D4(PlayState* play, Player* this) { void func_808468A8(PlayState* play, Player* this) { func_80835C58(play, this, func_8084F9A0, 0); - func_80832F54(play, this, - ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); + Player_AnimReplaceApplyFlags(play, this, + ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | + ANIM_FLAG_PLAYER_7); } void func_808468E8(PlayState* play, Player* this) { @@ -10602,10 +10615,10 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->actor.parent = this->rideActor; func_8083A360(play, this); this->stateFlags1 |= PLAYER_STATE1_23; - func_80832264(play, this, &gPlayerAnim_link_uma_wait_1); - func_80832F54(play, this, - ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | - ANIM_FLAG_PLAYER_7); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_uma_wait_1); + Player_AnimReplaceApplyFlags(play, this, + ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE | + ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); this->unk_850 = 99; } @@ -11332,7 +11345,7 @@ s32 func_8084B3CC(PlayState* play, Player* this) { } this->stateFlags1 |= PLAYER_STATE1_20; - func_80832264(play, this, func_80833338(this)); + Player_AnimPlayOnce(play, this, func_80833338(this)); Player_ZeroSpeedXZ(this); func_8083B010(this); return 1; @@ -11397,12 +11410,12 @@ void func_8084B530(Player* this, PlayState* play) { if (this->skelAnime.moveFlags != 0) { func_80832DBC(this); if ((this->targetActor->category == ACTORCAT_NPC) && (this->heldItemAction != PLAYER_IA_FISHING_POLE)) { - func_808322D0(play, this, &gPlayerAnim_link_normal_talk_free); + Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_talk_free); } else { - func_80832284(play, this, func_80833338(this)); + Player_AnimPlayLoop(play, this, func_80833338(this)); } } else { - func_808322A4(play, this, &gPlayerAnim_link_normal_talk_free_wait); + Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_normal_talk_free_wait); } } @@ -11556,7 +11569,7 @@ void func_8084BBE4(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { // clang-format off - anim = (this->unk_84F > 0) ? &gPlayerAnim_link_normal_fall_wait : GET_PLAYER_ANIM(PLAYER_ANIMGROUP_jump_climb_wait, this->modelAnimType); func_80832284(play, this, anim); + anim = (this->unk_84F > 0) ? &gPlayerAnim_link_normal_fall_wait : GET_PLAYER_ANIM(PLAYER_ANIMGROUP_jump_climb_wait, this->modelAnimType); Player_AnimPlayLoop(play, this, anim); // clang-format on } else if (this->unk_84F == 0) { if (this->skelAnime.animation == &gPlayerAnim_link_normal_fall) { @@ -11709,7 +11722,7 @@ void func_8084BF1C(Player* this, PlayState* play) { } } else { this->skelAnime.prevTransl = this->ageProperties->unk_4A[sp68]; - func_80832264(play, this, this->ageProperties->unk_AC[sp68]); + Player_AnimPlayOnce(play, this, this->ageProperties->unk_AC[sp68]); } } else { if ((this->actor.world.pos.y - this->actor.floorHeight) < 15.0f) { @@ -11737,7 +11750,7 @@ void func_8084BF1C(Player* this, PlayState* play) { if (sp80 > 0) { this->skelAnime.prevTransl = this->ageProperties->unk_7A[this->unk_850]; - func_80832264(play, this, anim2); + Player_AnimPlayOnce(play, this, anim2); } else { this->skelAnime.prevTransl = this->ageProperties->unk_86[this->unk_850]; LinkAnimation_Change(play, &this->skelAnime, anim2, -1.0f, Animation_GetLastFrame(anim2), 0.0f, @@ -11934,9 +11947,9 @@ s32 func_8084C9BC(Player* this, PlayState* play) { rideActor->actor.child = NULL; func_80835DAC(play, this, func_8084D3E4, 0); this->unk_878 = sp34 - rideActor->actor.world.pos.y; - func_80832264(play, this, - (this->mountSide < 0) ? &gPlayerAnim_link_uma_left_down - : &gPlayerAnim_link_uma_right_down); + Player_AnimPlayOnce(play, this, + (this->mountSide < 0) ? &gPlayerAnim_link_uma_left_down + : &gPlayerAnim_link_uma_right_down); return 1; } } @@ -12054,7 +12067,7 @@ void func_8084CC98(Player* this, PlayState* play) { } else if (rand < 0.2f) { temp = 1; } - func_80832264(play, this, D_8085498C[temp]); + Player_AnimPlayOnce(play, this, D_8085498C[temp]); } else { this->skelAnime.animation = D_80854944[this->unk_850 - 2]; Animation_SetMorph(play, &this->skelAnime, 8.0f); @@ -12067,7 +12080,7 @@ void func_8084CC98(Player* this, PlayState* play) { if (this->unk_850 == 1) { if ((D_808535E0 != 0) || func_8083224C(play)) { - func_80832264(play, this, &gPlayerAnim_link_uma_wait_3); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_uma_wait_3); } else if (LinkAnimation_Update(play, &this->skelAnime)) { this->unk_850 = 99; } else if (this->skelAnime.animation == &gPlayerAnim_link_uma_wait_1) { @@ -12228,12 +12241,12 @@ void func_8084D530(Player* this, f32* arg1, f32 arg2, s16 arg3) { void func_8084D574(PlayState* play, Player* this, s16 arg2) { func_80835C58(play, this, func_8084D84C, 0); this->actor.shape.rot.y = this->yaw = arg2; - func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim); + Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim); } void func_8084D5CC(PlayState* play, Player* this) { func_80835C58(play, this, func_8084DAB4, 0); - func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim); + Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim); } void func_8084D610(Player* this, PlayState* play) { @@ -12347,7 +12360,7 @@ s32 func_8084D980(PlayState* play, Player* this, f32* arg2, s16* arg3) { } if (anim != this->skelAnime.animation) { - func_80832C6C(play, this, anim); + Player_AnimChangeLoopSlowMorph(play, this, anim); return 1; } @@ -12420,7 +12433,7 @@ void func_8084DC48(Player* this, PlayState* play) { func_8084DBC4(play, this, -2.0f); } else { this->unk_84F++; - func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim_wait); + Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim_wait); } } else if (this->unk_84F == 1) { LinkAnimation_Update(play, &this->skelAnime); @@ -12429,7 +12442,7 @@ void func_8084DC48(Player* this, PlayState* play) { if (this->unk_6C2 < 10000) { this->unk_84F++; this->unk_850 = this->actor.yDistToWater; - func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim); + Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim); } } else if (!func_8083D12C(play, this, sControlInput)) { sp2C = (this->unk_850 * 0.018f) + 4.0f; @@ -12567,7 +12580,7 @@ static s16 sWarpSongEntrances[] = { void func_8084E3C4(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { - func_808322A4(play, this, &gPlayerAnim_link_normal_okarina_swing); + Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_normal_okarina_swing); this->unk_850 = 1; if (this->stateFlags2 & (PLAYER_STATE2_23 | PLAYER_STATE2_25)) { this->stateFlags2 |= PLAYER_STATE2_24; @@ -12685,9 +12698,9 @@ void func_8084E6D4(Player* this, PlayState* play) { } if (this->skelAnime.animation == &gPlayerAnim_link_normal_box_kick) { - func_808322D0(play, this, &gPlayerAnim_link_demo_get_itemB); + Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_demo_get_itemB); } else { - func_808322D0(play, this, &gPlayerAnim_link_demo_get_itemA); + Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_demo_get_itemA); } this->unk_850 = 2; @@ -12787,7 +12800,7 @@ void func_8084EAC0(Player* this, PlayState* play) { } } - func_808322A4(play, this, &gPlayerAnim_link_bottle_drink_demo_wait); + Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_wait); this->unk_850 = 1; return; } @@ -12796,7 +12809,7 @@ void func_8084EAC0(Player* this, PlayState* play) { func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); } else if (this->unk_850 == 1) { if ((gSaveContext.healthAccumulator == 0) && (gSaveContext.magicState != MAGIC_STATE_FILL)) { - func_80832B78(play, this, &gPlayerAnim_link_bottle_drink_demo_end); + Player_AnimChangeOnceMorphAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_end); this->unk_850 = 2; Player_UpdateBottleHeld(play, this, ITEM_BOTTLE_EMPTY, PLAYER_IA_BOTTLE); } @@ -12861,7 +12874,7 @@ void func_8084ECA4(Player* this, PlayState* play) { this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; this->interactRangeActor->parent = &this->actor; Player_UpdateBottleHeld(play, this, catchInfo->itemId, ABS(catchInfo->itemAction)); - func_808322D0(play, this, sp24->unk_04); + Player_AnimPlayOnceAdjusted(play, this, sp24->unk_04); func_80835EA4(play, 4); } } @@ -12870,9 +12883,9 @@ void func_8084ECA4(Player* this, PlayState* play) { } } - //! @bug If the animation is changed at any point above (such as by func_8083C0E8() or func_808322D0()), it will - //! change the curFrame to 0. This causes this flag to be set for one frame, at a time when it does not look like - //! Player is swinging the bottle. + //! @bug If the animation is changed at any point above (such as by func_8083C0E8() or + //! Player_AnimPlayOnceAdjusted()), it will change the curFrame to 0. This causes this flag to be set for one frame, + //! at a time when it does not look like Player is swinging the bottle. if (this->skelAnime.curFrame <= 7.0f) { this->stateFlags1 |= PLAYER_STATE1_SWINGING_BOTTLE; } @@ -12971,7 +12984,7 @@ void func_8084F104(Player* this, PlayState* play) { this->unk_862 = 0; if (this->unk_84F == 1) { - func_80832264(play, this, &gPlayerAnim_link_bottle_read_end); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_bottle_read_end); this->unk_850 = -1; } else { func_8083C0E8(this, play); @@ -12993,7 +13006,7 @@ void func_8084F308(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; if (LinkAnimation_Update(play, &this->skelAnime)) { - func_80832284(play, this, &gPlayerAnim_link_normal_re_dead_attack_wait); + Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_re_dead_attack_wait); } if (func_80832594(this, 0, 100)) { @@ -13612,7 +13625,7 @@ void func_80850AEC(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; if (LinkAnimation_Update(play, &this->skelAnime)) { - func_80832284(play, this, &gPlayerAnim_link_hook_fly_wait); + Player_AnimPlayLoop(play, this, &gPlayerAnim_link_hook_fly_wait); } Math_Vec3f_Sum(&this->actor.world.pos, &this->actor.velocity, &this->actor.world.pos); @@ -13664,7 +13677,7 @@ void func_80850C68(Player* this, PlayState* play) { LinkAnimation_InterpJointMorph(play, &this->skelAnime, 0.5f); } else if (LinkAnimation_Update(play, &this->skelAnime)) { this->unk_860 = 2; - func_80832284(play, this, &gPlayerAnim_link_fishing_wait); + Player_AnimPlayLoop(play, this, &gPlayerAnim_link_fishing_wait); this->unk_850 = 1; } @@ -13674,7 +13687,7 @@ void func_80850C68(Player* this, PlayState* play) { func_80853080(this, play); } else if (this->unk_860 == 3) { func_80835C58(play, this, func_80850E84, 0); - func_80832B0C(play, this, &gPlayerAnim_link_fishing_fish_catch); + Player_AnimChangeOnceMorph(play, this, &gPlayerAnim_link_fishing_fish_catch); } } @@ -13917,22 +13930,22 @@ static struct_80854B18 D_80854E50[PLAYER_CSMODE_MAX] = { { 12, &gPlayerAnim_demo_link_nwait }, // PLAYER_CSMODE_102 }; -void func_80850ED8(PlayState* play, Player* this, LinkAnimationHeader* anim) { - func_80832DB0(this); - func_80832B0C(play, this, anim); +void Player_AnimChangeOnceMorphZeroRootYawSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim) { + Player_ZeroRootLimbYaw(this); + Player_AnimChangeOnceMorph(play, this, anim); Player_ZeroSpeedXZ(this); } -void func_80850F1C(PlayState* play, Player* this, LinkAnimationHeader* anim) { - func_80832DB0(this); - LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, - -8.0f); +void Player_AnimChangeOnceMorphAdjustedZeroRootYawSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim) { + Player_ZeroRootLimbYaw(this); + LinkAnimation_Change(play, &this->skelAnime, anim, PLAYER_ANIM_ADJUSTED_SPEED, 0.0f, Animation_GetLastFrame(anim), + ANIMMODE_ONCE, -8.0f); Player_ZeroSpeedXZ(this); } -void func_80850F9C(PlayState* play, Player* this, LinkAnimationHeader* anim) { - func_80832DB0(this); - LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f); +void Player_AnimChangeLoopMorphAdjustedZeroRootYawSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim) { + Player_ZeroRootLimbYaw(this); + LinkAnimation_Change(play, &this->skelAnime, anim, PLAYER_ANIM_ADJUSTED_SPEED, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f); Player_ZeroSpeedXZ(this); } @@ -13941,55 +13954,55 @@ void func_80851008(PlayState* play, Player* this, void* anim) { } void func_80851030(PlayState* play, Player* this, void* anim) { - func_80850ED8(play, this, anim); + Player_AnimChangeOnceMorphZeroRootYawSpeed(play, this, anim); } void func_80851050(PlayState* play, Player* this, void* anim) { - func_80832DB0(this); - func_80832C2C(play, this, anim); + Player_ZeroRootLimbYaw(this); + Player_AnimChangeFreeze(play, this, anim); Player_ZeroSpeedXZ(this); } void func_80851094(PlayState* play, Player* this, void* anim) { - func_80850F1C(play, this, anim); + Player_AnimChangeOnceMorphAdjustedZeroRootYawSpeed(play, this, anim); } void func_808510B4(PlayState* play, Player* this, void* anim) { - func_80850F9C(play, this, anim); + Player_AnimChangeLoopMorphAdjustedZeroRootYawSpeed(play, this, anim); } void func_808510D4(PlayState* play, Player* this, void* anim) { - func_8083308C(play, this, anim); + Player_AnimReplaceNormalPlayOnceAdjusted(play, this, anim); } void func_808510F4(PlayState* play, Player* this, void* anim) { - func_8083303C(play, this, anim, - ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); + Player_AnimReplacePlayOnce(play, this, anim, + ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); } void func_80851114(PlayState* play, Player* this, void* anim) { - func_8083313C(play, this, anim); + Player_AnimReplaceNormalPlayLoopAdjusted(play, this, anim); } void func_80851134(PlayState* play, Player* this, void* anim) { - func_808330EC(play, this, anim, - ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); + Player_AnimReplacePlayLoop(play, this, anim, + ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); } void func_80851154(PlayState* play, Player* this, void* anim) { - func_80832264(play, this, anim); + Player_AnimPlayOnce(play, this, anim); } void func_80851174(PlayState* play, Player* this, void* anim) { - func_80832284(play, this, anim); + Player_AnimPlayLoop(play, this, anim); } void func_80851194(PlayState* play, Player* this, void* anim) { - func_808322D0(play, this, anim); + Player_AnimPlayOnceAdjusted(play, this, anim); } void func_808511B4(PlayState* play, Player* this, void* anim) { - func_808322A4(play, this, anim); + Player_AnimPlayLoopAdjusted(play, this, anim); } void func_808511D4(PlayState* play, Player* this, void* anim) { @@ -13998,7 +14011,7 @@ void func_808511D4(PlayState* play, Player* this, void* anim) { void func_808511FC(PlayState* play, Player* this, void* anim) { if (LinkAnimation_Update(play, &this->skelAnime)) { - func_80850F9C(play, this, anim); + Player_AnimChangeLoopMorphAdjustedZeroRootYawSpeed(play, this, anim); this->unk_850 = 1; } } @@ -14006,13 +14019,13 @@ void func_808511FC(PlayState* play, Player* this, void* anim) { void func_80851248(PlayState* play, Player* this, void* anim) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832DBC(this); - func_808322A4(play, this, anim); + Player_AnimPlayLoopAdjusted(play, this, anim); } } void func_80851294(PlayState* play, Player* this, void* anim) { if (LinkAnimation_Update(play, &this->skelAnime)) { - func_8083313C(play, this, anim); + Player_AnimReplaceNormalPlayLoopAdjusted(play, this, anim); this->unk_850 = 1; } } @@ -14039,7 +14052,7 @@ void func_80851368(PlayState* play, Player* this, CsCmdActorCue* cue) { this->stateFlags2 |= PLAYER_STATE2_10; this->stateFlags1 &= ~(PLAYER_STATE1_18 | PLAYER_STATE1_19); - func_80832284(play, this, &gPlayerAnim_link_swimer_swim); + Player_AnimPlayLoop(play, this, &gPlayerAnim_link_swimer_swim); } void func_808513BC(PlayState* play, Player* this, CsCmdActorCue* cue) { @@ -14058,9 +14071,9 @@ void func_808513BC(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_84F == 1) { - func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim_wait); + Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim_wait); } else { - func_80832284(play, this, &gPlayerAnim_link_swimer_swim_wait); + Player_AnimPlayLoop(play, this, &gPlayerAnim_link_swimer_swim_wait); } } @@ -14103,9 +14116,9 @@ void func_808515A4(PlayState* play, Player* this, CsCmdActorCue* cue) { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_nwait, this->modelAnimType); if ((this->cueId == 6) || (this->cueId == 0x2E)) { - func_80832264(play, this, anim); + Player_AnimPlayOnce(play, this, anim); } else { - func_80832DB0(this); + Player_ZeroRootLimbYaw(this); LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, Animation_GetLastFrame(anim), ANIMMODE_LOOP, -4.0f); } @@ -14188,7 +14201,7 @@ void func_8085190C(PlayState* play, Player* this, CsCmdActorCue* cue) { if (this->unk_850 != 0) { if (LinkAnimation_Update(play, &this->skelAnime)) { - func_80832284(play, this, func_808334E4(this)); + Player_AnimPlayLoop(play, this, func_808334E4(this)); this->unk_850 = 0; } @@ -14217,10 +14230,10 @@ static Vec3f D_80855198 = { -1.0f, 70.0f, 20.0f }; void func_808519EC(PlayState* play, Player* this, CsCmdActorCue* cue) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80855198); this->actor.shape.rot.y = -0x8000; - func_808322D0(play, this, this->ageProperties->unk_9C); - func_80832F54(play, this, - FLAG_FUNC_80832F54_9 | ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 | - ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_PLAYER_7); + Player_AnimPlayOnceAdjusted(play, this, this->ageProperties->unk_9C); + Player_AnimReplaceApplyFlags(play, this, + ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 | + ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_PLAYER_7); } static struct_808551A4 D_808551A4[] = { @@ -14290,7 +14303,7 @@ void func_80851BE8(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80851CA4(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime) && (this->unk_850 == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - func_80832264(play, this, &gPlayerAnim_link_normal_back_downB); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_back_downB); this->unk_850 = 1; } @@ -14300,7 +14313,7 @@ void func_80851CA4(PlayState* play, Player* this, CsCmdActorCue* cue) { } void func_80851D2C(PlayState* play, Player* this, CsCmdActorCue* cue) { - func_80850F1C(play, this, &gPlayerAnim_link_normal_okarina_start); + Player_AnimChangeOnceMorphAdjustedZeroRootYawSpeed(play, this, &gPlayerAnim_link_normal_okarina_start); func_8084B498(this); Player_SetModels(this, Player_ActionToModelGroup(this, this->itemAction)); } @@ -14330,26 +14343,27 @@ void func_80851E28(PlayState* play, Player* this, CsCmdActorCue* cue) { } void func_80851E64(PlayState* play, Player* this, CsCmdActorCue* cue) { - func_80833064(play, this, &gPlayerAnim_link_swimer_swim_get, - ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); + Player_AnimReplacePlayOnceAdjusted(play, this, &gPlayerAnim_link_swimer_swim_get, + ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); } void func_80851E90(PlayState* play, Player* this, CsCmdActorCue* cue) { - func_8083303C(play, this, &gPlayerAnim_clink_op3_negaeri, - ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); + Player_AnimReplacePlayOnce(play, this, &gPlayerAnim_clink_op3_negaeri, + ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); func_80832698(this, NA_SE_VO_LI_GROAN); } void func_80851ECC(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime)) { - func_808330EC(play, this, &gPlayerAnim_clink_op3_wait2, - ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); + Player_AnimReplacePlayLoop(play, this, &gPlayerAnim_clink_op3_wait2, + ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | + ANIM_FLAG_PLAYER_7); } } void func_80851F14(PlayState* play, Player* this, LinkAnimationHeader* anim, struct_80832924* arg3) { if (LinkAnimation_Update(play, &this->skelAnime)) { - func_808322A4(play, this, anim); + Player_AnimPlayLoopAdjusted(play, this, anim); this->unk_850 = 1; } else if (this->unk_850 == 0) { func_80832924(this, arg3); @@ -14369,8 +14383,9 @@ static struct_80832924 D_808551BC[] = { void func_80851FB0(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime)) { - func_808330EC(play, this, &gPlayerAnim_clink_op3_wait3, - ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); + Player_AnimReplacePlayLoop(play, this, &gPlayerAnim_clink_op3_wait3, + ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | + ANIM_FLAG_PLAYER_7); this->unk_850 = 1; } else if (this->unk_850 == 0) { func_80832924(this, D_808551BC); @@ -14393,8 +14408,9 @@ void func_80852048(PlayState* play, Player* this, CsCmdActorCue* cue) { } void func_80852080(PlayState* play, Player* this, CsCmdActorCue* cue) { - func_80833064(play, this, &gPlayerAnim_clink_demo_futtobi, - ANIM_FLAG_0 | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); + Player_AnimReplacePlayOnceAdjusted(play, this, &gPlayerAnim_clink_demo_futtobi, + ANIM_FLAG_0 | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | + ANIM_FLAG_PLAYER_7); func_80832698(this, NA_SE_VO_LI_FALL_L); } @@ -14433,7 +14449,7 @@ void func_808521B8(PlayState* play, Player* this, CsCmdActorCue* cue) { } void func_808521F4(PlayState* play, Player* this, CsCmdActorCue* cue) { - func_80832B0C(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_nwait, this->modelAnimType)); + Player_AnimChangeOnceMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_nwait, this->modelAnimType)); Player_ZeroSpeedXZ(this); } @@ -14442,7 +14458,7 @@ void func_80852234(PlayState* play, Player* this, CsCmdActorCue* cue) { } void func_8085225C(PlayState* play, Player* this, CsCmdActorCue* cue) { - func_80832F54(play, this, ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); + Player_AnimReplaceApplyFlags(play, this, ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); } void func_80852280(PlayState* play, Player* this, CsCmdActorCue* cue) { @@ -14451,7 +14467,7 @@ void func_80852280(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80852298(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime)) { - func_8083313C(play, this, &gPlayerAnim_clink_demo_koutai_wait); + Player_AnimReplaceNormalPlayLoopAdjusted(play, this, &gPlayerAnim_clink_demo_koutai_wait); this->unk_850 = 1; } else if (this->unk_850 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 10.0f)) { @@ -14480,7 +14496,7 @@ void func_80852358(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80852388(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime)) { - func_808322A4(play, this, &gPlayerAnim_demo_link_twait); + Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_demo_link_twait); this->unk_850 = 1; } @@ -14540,7 +14556,7 @@ void func_80852564(PlayState* play, Player* this, CsCmdActorCue* cue) { this->speedXZ = 2.0f; this->actor.velocity.y = -1.0f; - func_80832264(play, this, &gPlayerAnim_link_normal_back_downA); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_back_downA); func_80832698(this, NA_SE_VO_LI_FALL_L); } @@ -14556,7 +14572,7 @@ void func_808525C0(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80852608(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80846720(play, this, 0); - func_808322D0(play, this, &gPlayerAnim_link_demo_return_to_past); + Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_demo_return_to_past); } void func_80852648(PlayState* play, Player* this, CsCmdActorCue* cue) { @@ -14670,7 +14686,7 @@ void func_80852A54(PlayState* play, Player* this, CsCmdActorCue* cue) { } this->skelAnime.moveFlags = 0; - func_80832DB0(this); + Player_ZeroRootLimbYaw(this); } void func_80852B4C(PlayState* play, Player* this, CsCmdActorCue* cue, struct_80854B18* arg3) { @@ -14770,7 +14786,7 @@ s32 func_80852F38(PlayState* play, Player* this) { !(this->stateFlags3 & PLAYER_STATE3_7)) { func_80832564(play, this); func_80835C58(play, this, func_8084F308, 0); - func_80832264(play, this, &gPlayerAnim_link_normal_re_dead_attack); + Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_re_dead_attack); this->stateFlags2 |= PLAYER_STATE2_7; func_80832224(this); func_80832698(this, NA_SE_VO_LI_HELD); @@ -14798,7 +14814,7 @@ s32 func_80852FFC(PlayState* play, Actor* actor, s32 csMode) { void func_80853080(Player* this, PlayState* play) { func_80835C58(play, this, func_80840BC8, 1); - func_80832B0C(play, this, func_80833338(this)); + Player_AnimChangeOnceMorph(play, this, func_80833338(this)); this->yaw = this->actor.shape.rot.y; } @@ -14848,26 +14864,26 @@ void func_80853148(PlayState* play, Actor* actor) { } else { if (func_808332B8(this)) { func_80836898(play, this, func_8083A2F8); - func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim_wait); + Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim_wait); } else if ((actor->category != ACTORCAT_NPC) || (this->heldItemAction == PLAYER_IA_FISHING_POLE)) { func_8083A2F8(play, this); if (!func_8008E9C4(this)) { if ((actor != this->naviActor) && (actor->xzDistToPlayer < 40.0f)) { - func_808322D0(play, this, &gPlayerAnim_link_normal_backspace); + Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_backspace); } else { - func_80832284(play, this, func_80833338(this)); + Player_AnimPlayLoop(play, this, func_80833338(this)); } } } else { func_80836898(play, this, func_8083A2F8); - func_808322D0(play, this, - (actor->xzDistToPlayer < 40.0f) ? &gPlayerAnim_link_normal_backspace - : &gPlayerAnim_link_normal_talk_free); + Player_AnimPlayOnceAdjusted(play, this, + (actor->xzDistToPlayer < 40.0f) ? &gPlayerAnim_link_normal_backspace + : &gPlayerAnim_link_normal_talk_free); } if (this->skelAnime.animation == &gPlayerAnim_link_normal_backspace) { - func_80832F54(play, this, ANIM_FLAG_0 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE); + Player_AnimReplaceApplyFlags(play, this, ANIM_FLAG_0 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE); } func_80832224(this); From bedf07d5412f52cc05165b2d081578924cdd489d Mon Sep 17 00:00:00 2001 From: fig02 Date: Wed, 6 Sep 2023 13:15:07 -0400 Subject: [PATCH 04/29] Document Player's bgcheck routine (`func_80847BA0`) (#1503) * progress * progress * progress * done for now * floor pitch comments * sYDistToFloor * add function comment * sFloorShapePitch * typo in header --- include/z64player.h | 34 +- src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c | 2 +- .../actors/ovl_player_actor/z_player.c | 586 ++++++++++-------- 3 files changed, 345 insertions(+), 277 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index a23154487..7b8445bea 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -459,8 +459,16 @@ typedef enum { /* 0x67 */ PLAYER_CSMODE_MAX } PlayerCutsceneMode; +typedef enum { + /* 0 */ PLAYER_LEDGE_CLIMB_NONE, + /* 1 */ PLAYER_LEDGE_CLIMB_1, + /* 2 */ PLAYER_LEDGE_CLIMB_2, + /* 3 */ PLAYER_LEDGE_CLIMB_3, + /* 4 */ PLAYER_LEDGE_CLIMB_4 +} PlayerLedgeClimbType; + typedef struct { - /* 0x00 */ f32 unk_00; + /* 0x00 */ f32 ceilingCheckHeight; /* 0x04 */ f32 unk_04; /* 0x08 */ f32 unk_08; /* 0x0C */ f32 unk_0C; @@ -474,7 +482,7 @@ typedef struct { /* 0x2C */ f32 unk_2C; /* 0x30 */ f32 unk_30; /* 0x34 */ f32 unk_34; - /* 0x38 */ f32 unk_38; + /* 0x38 */ f32 wallCheckRadius; /* 0x3C */ f32 unk_3C; /* 0x40 */ f32 unk_40; /* 0x44 */ Vec3s unk_44; @@ -501,6 +509,8 @@ typedef struct { /* 0x10 */ Vec3f base; } WeaponInfo; // size = 0x1C +#define LEDGE_DIST_MAX 399.96002f + #define PLAYER_STATE1_0 (1 << 0) #define PLAYER_STATE1_SWINGING_BOTTLE (1 << 1) #define PLAYER_STATE1_2 (1 << 2) @@ -543,7 +553,7 @@ typedef struct { #define PLAYER_STATE2_6 (1 << 6) #define PLAYER_STATE2_7 (1 << 7) #define PLAYER_STATE2_8 (1 << 8) -#define PLAYER_STATE2_9 (1 << 9) +#define PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND (1 << 9) #define PLAYER_STATE2_10 (1 << 10) #define PLAYER_STATE2_11 (1 << 11) #define PLAYER_STATE2_12 (1 << 12) @@ -713,10 +723,10 @@ typedef struct Player { /* 0x087C */ s16 unk_87C; /* 0x087E */ s16 unk_87E; /* 0x0880 */ f32 unk_880; - /* 0x0884 */ f32 wallHeight; // height used to determine whether link can climb or grab a ledge at the top - /* 0x0888 */ f32 wallDistance; // distance to the colliding wall plane - /* 0x088C */ u8 unk_88C; - /* 0x088D */ u8 unk_88D; + /* 0x0884 */ f32 yDistToLedge; // y distance to ground above an interact wall. LEDGE_DIST_MAX if no ground is found + /* 0x0888 */ f32 distToInteractWall; // xyz distance to the interact wall + /* 0x088C */ u8 ledgeClimbType; + /* 0x088D */ u8 ledgeClimbDelayTimer; /* 0x088E */ u8 unk_88E; /* 0x088F */ u8 unk_88F; /* 0x0890 */ u8 unk_890; @@ -725,8 +735,8 @@ typedef struct Player { /* 0x0893 */ u8 hoverBootsTimer; /* 0x0894 */ s16 fallStartHeight; // last truncated Y position before falling /* 0x0896 */ s16 fallDistance; // truncated Y distance the player has fallen so far (positive is down) - /* 0x0898 */ s16 unk_898; - /* 0x089A */ s16 unk_89A; + /* 0x0898 */ s16 floorPitch; // angle of the floor slope in the direction of current world yaw (positive for ascending slope) + /* 0x089A */ s16 floorPitchAlt; // the calculation for this value is bugged and doesn't represent anything meaningful /* 0x089C */ s16 unk_89C; /* 0x089E */ u16 floorSfxOffset; /* 0x08A0 */ u8 unk_8A0; @@ -745,9 +755,9 @@ typedef struct Player { /* 0x0A73 */ u8 unk_A73; /* 0x0A74 */ PlayerFuncA74 func_A74; /* 0x0A78 */ s8 invincibilityTimer; // prevents damage when nonzero (positive = visible, counts towards zero each frame) - /* 0x0A79 */ u8 unk_A79; - /* 0x0A7A */ u8 unk_A7A; - /* 0x0A7B */ u8 unk_A7B; + /* 0x0A79 */ u8 floorTypeTimer; // counts up every frame the current floor type is the same as the last frame + /* 0x0A7A */ u8 floorProperty; + /* 0x0A7B */ u8 prevFloorType; /* 0x0A7C */ f32 unk_A7C; /* 0x0A80 */ s16 unk_A80; /* 0x0A82 */ u16 prevFloorSfxOffset; diff --git a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c index 8146c75c3..51eedf4ed 100644 --- a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c +++ b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c @@ -60,7 +60,7 @@ void func_8087B758(BgHaka* this, Player* player) { func_8002DBD0(&this->dyna.actor, &sp1C, &player->actor.world.pos); if (fabsf(sp1C.x) < 34.6f && sp1C.z > -112.8f && sp1C.z < -36.0f) { - player->stateFlags2 |= PLAYER_STATE2_9; + player->stateFlags2 |= PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND; } } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index a02a588ee..a56a1e42f 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -347,7 +347,7 @@ void func_80853148(PlayState* play, Actor* actor); // .bss part 1 static s32 D_80858AA0; static s32 D_80858AA4; -static Vec3f D_80858AA8; +static Vec3f sInteractWallCheckResult; static Input* sControlInput; // .data @@ -356,7 +356,7 @@ static u8 D_80853410[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, static PlayerAgeProperties sAgeProperties[] = { { - 56.0f, // unk_00 + 56.0f, // ceilingCheckHeight 90.0f, // unk_04 1.0f, // unk_08 111.0f, // unk_0C @@ -370,7 +370,7 @@ static PlayerAgeProperties sAgeProperties[] = { 56.0f, // unk_2C 68.0f, // unk_30 70.0f, // unk_34 - 18.0f, // unk_38 + 18.0f, // wallCheckRadius 15.0f, // unk_3C 70.0f, // unk_40 { 9, 4671, 359 }, // unk_44 @@ -408,7 +408,7 @@ static PlayerAgeProperties sAgeProperties[] = { { &gPlayerAnim_link_normal_climb_endBR, &gPlayerAnim_link_normal_climb_endBL }, // unk_CC }, { - 40.0f, // unk_00 + 40.0f, // ceilingCheckHeight 60.0f, // unk_04 11.0f / 17.0f, // unk_08 71.0f, // unk_0C @@ -422,7 +422,7 @@ static PlayerAgeProperties sAgeProperties[] = { 32.0f, // unk_2C 48.0f, // unk_30 70.0f * (11.0f / 17.0f), // unk_34 - 14.0f, // unk_38 + 14.0f, // wallCheckRadius 12.0f, // unk_3C 55.0f, // unk_40 { -24, 3565, 876 }, // unk_44 @@ -466,18 +466,18 @@ static f32 D_808535D4 = 0.0f; static s16 D_808535D8 = 0; static s16 D_808535DC = 0; static s32 D_808535E0 = 0; -static s32 D_808535E4 = FLOOR_TYPE_0; +static s32 sFloorType = FLOOR_TYPE_0; static f32 D_808535E8 = 1.0f; static f32 D_808535EC = 1.0f; -static u32 sInteractWallFlags = 0; -static u32 sConveyorSpeedIndex = CONVEYOR_SPEED_DISABLED; +static u32 sTouchedWallFlags = 0; +static u32 sConveyorSpeed = CONVEYOR_SPEED_DISABLED; static s16 sIsFloorConveyor = false; static s16 sConveyorYaw = 0; -static f32 D_80853600 = 0.0f; -static s32 D_80853604 = FLOOR_PROPERTY_0; -static s32 D_80853608 = 0; -static s32 D_8085360C = 0; -static s16 D_80853610 = 0; +static f32 sYDistToFloor = 0.0f; +static s32 sPrevFloorProperty = FLOOR_PROPERTY_0; // floor property from the previous frame +static s32 sShapeYawToTouchedWall = 0; +static s32 sWorldYawToTouchedWall = 0; +static s16 sFloorShapePitch = 0; static s32 D_80853614 = 0; static s32 D_80853618 = 0; @@ -2896,7 +2896,7 @@ void func_808355DC(Player* this) { this->stateFlags1 |= PLAYER_STATE1_17; if (!(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_7) && - (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (D_80853608 < 0x2000)) { + (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (sShapeYawToTouchedWall < 0x2000)) { this->yaw = this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; } @@ -3517,7 +3517,7 @@ s32 func_80836FAC(PlayState* play, Player* this, f32* arg2, s16* arg3, f32 arg4) } if (D_808535D4 != 0.0f) { - temp_f0 = Math_SinS(this->unk_898); + temp_f0 = Math_SinS(this->floorPitch); temp_f12 = this->unk_880; temp_f14 = CLAMP(temp_f0, 0.0f, 0.6f); @@ -4059,7 +4059,7 @@ s32 func_808382DC(Player* this, PlayState* play) { } else { sp68 = ((Player_GetHeight(this) - 8.0f) < (this->unk_6C4 * this->actor.scale.y)); - if (sp68 || (this->actor.bgCheckFlags & BGCHECKFLAG_CRUSHED) || (D_808535E4 == FLOOR_TYPE_9) || + if (sp68 || (this->actor.bgCheckFlags & BGCHECKFLAG_CRUSHED) || (sFloorType == FLOOR_TYPE_9) || (this->stateFlags2 & PLAYER_STATE2_31)) { func_80832698(this, NA_SE_VO_LI_DAMAGE_S); @@ -4183,15 +4183,15 @@ s32 func_808382DC(Player* this, PlayState* play) { return 0; } else { static u8 D_808544F4[] = { 120, 60 }; - s32 sp48 = func_80838144(D_808535E4); + s32 sp48 = func_80838144(sFloorType); if (((this->actor.wallPoly != NULL) && func_80042108(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) || ((sp48 >= 0) && func_80042108(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) && - (this->unk_A79 >= D_808544F4[sp48])) || + (this->floorTypeTimer >= D_808544F4[sp48])) || ((sp48 >= 0) && - ((this->currentTunic != PLAYER_TUNIC_GORON) || (this->unk_A79 >= D_808544F4[sp48])))) { - this->unk_A79 = 0; + ((this->currentTunic != PLAYER_TUNIC_GORON) || (this->floorTypeTimer >= D_808544F4[sp48])))) { + this->floorTypeTimer = 0; this->actor.colChkInfo.damage = 4; func_80837C0C(play, this, 0, 4.0f, 5.0f, this->actor.shape.rot.y, 20); } else { @@ -4234,31 +4234,32 @@ s32 func_80838A14(Player* this, PlayState* play) { f32 wallPolyNormalZ; f32 sp24; - if (!(this->stateFlags1 & PLAYER_STATE1_11) && (this->unk_88C >= 2) && - (!(this->stateFlags1 & PLAYER_STATE1_27) || (this->ageProperties->unk_14 > this->wallHeight))) { + if (!(this->stateFlags1 & PLAYER_STATE1_11) && (this->ledgeClimbType >= PLAYER_LEDGE_CLIMB_2) && + (!(this->stateFlags1 & PLAYER_STATE1_27) || (this->ageProperties->unk_14 > this->yDistToLedge))) { sp3C = 0; if (func_808332B8(this)) { if (this->actor.yDistToWater < 50.0f) { - if ((this->unk_88C < 2) || (this->wallHeight > this->ageProperties->unk_10)) { + if ((this->ledgeClimbType < PLAYER_LEDGE_CLIMB_2) || + (this->yDistToLedge > this->ageProperties->unk_10)) { return 0; } - } else if ((this->currentBoots != PLAYER_BOOTS_IRON) || (this->unk_88C > 2)) { + } else if ((this->currentBoots != PLAYER_BOOTS_IRON) || (this->ledgeClimbType > PLAYER_LEDGE_CLIMB_2)) { return 0; } } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || - ((this->ageProperties->unk_14 <= this->wallHeight) && (this->stateFlags1 & PLAYER_STATE1_27))) { + ((this->ageProperties->unk_14 <= this->yDistToLedge) && (this->stateFlags1 & PLAYER_STATE1_27))) { return 0; } - if ((this->actor.wallBgId != BGCHECK_SCENE) && (sInteractWallFlags & WALL_FLAG_6)) { - if (this->unk_88D >= 6) { + if ((this->actor.wallBgId != BGCHECK_SCENE) && (sTouchedWallFlags & WALL_FLAG_6)) { + if (this->ledgeClimbDelayTimer >= 6) { this->stateFlags2 |= PLAYER_STATE2_2; if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { sp3C = 1; } } - } else if ((this->unk_88D >= 6) || CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { + } else if ((this->ledgeClimbDelayTimer >= 6) || CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { sp3C = 1; } @@ -4267,7 +4268,7 @@ s32 func_80838A14(Player* this, PlayState* play) { this->stateFlags1 |= PLAYER_STATE1_18; - sp34 = this->wallHeight; + sp34 = this->yDistToLedge; if (this->ageProperties->unk_14 <= sp34) { anim = &gPlayerAnim_link_normal_250jump_start; @@ -4275,7 +4276,7 @@ s32 func_80838A14(Player* this, PlayState* play) { } else { wallPolyNormalX = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.x); wallPolyNormalZ = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.z); - sp24 = this->wallDistance + 0.5f; + sp24 = this->distToInteractWall + 0.5f; this->stateFlags1 |= PLAYER_STATE1_14; @@ -4294,7 +4295,7 @@ s32 func_80838A14(Player* this, PlayState* play) { this->actor.shape.yOffset -= sp34 * 100.0f; this->actor.world.pos.x -= sp24 * wallPolyNormalX; - this->actor.world.pos.y += this->wallHeight; + this->actor.world.pos.y += this->yDistToLedge; this->actor.world.pos.z -= sp24 * wallPolyNormalZ; func_80832224(this); @@ -4309,8 +4310,9 @@ s32 func_80838A14(Player* this, PlayState* play) { return 1; } - } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->unk_88C == 1) && (this->unk_88D >= 3)) { - temp = (this->wallHeight * 0.08f) + 5.5f; + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->ledgeClimbType == PLAYER_LEDGE_CLIMB_1) && + (this->ledgeClimbDelayTimer >= 3)) { + temp = (this->yDistToLedge * 0.08f) + 5.5f; func_808389E8(this, &gPlayerAnim_link_normal_jump, temp, play); this->speedXZ = 2.5f; @@ -4411,7 +4413,7 @@ u8 sReturnEntranceGroupIndices[] = { 0, // ENTR_RETURN_GREAT_FAIRYS_FOUNTAIN_MAGIC }; -s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) { +s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) { s32 exitIndex; s32 temp; s32 sp34; @@ -4424,12 +4426,12 @@ s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) if (!(this->stateFlags1 & PLAYER_STATE1_7) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (this->csMode == PLAYER_CSMODE_NONE) && !(this->stateFlags1 & PLAYER_STATE1_0) && (((poly != NULL) && (exitIndex = SurfaceType_GetExitIndex(&play->colCtx, poly, bgId), exitIndex != 0)) || - (func_8083816C(D_808535E4) && (this->unk_A7A == FLOOR_PROPERTY_12)))) { + (func_8083816C(sFloorType) && (this->floorProperty == FLOOR_PROPERTY_12)))) { sp34 = this->unk_A84 - (s32)this->actor.world.pos.y; if (!(this->stateFlags1 & (PLAYER_STATE1_23 | PLAYER_STATE1_27 | PLAYER_STATE1_29)) && - !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (sp34 < 100) && (D_80853600 > 100.0f)) { + !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (sp34 < 100) && (sYDistToFloor > 100.0f)) { return 0; } @@ -4488,7 +4490,7 @@ s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) gSaveContext.entranceSpeed = speedXZ; } - if (sConveyorSpeedIndex != CONVEYOR_SPEED_DISABLED) { + if (sConveyorSpeed != CONVEYOR_SPEED_DISABLED) { yaw = sConveyorYaw; } else { yaw = this->actor.world.rot.y; @@ -4510,13 +4512,13 @@ s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) if (play->transitionTrigger == TRANS_TRIGGER_OFF) { if ((this->actor.world.pos.y < -4000.0f) || - (((this->unk_A7A == FLOOR_PROPERTY_5) || (this->unk_A7A == FLOOR_PROPERTY_12)) && - ((D_80853600 < 100.0f) || (this->fallDistance > 400.0f) || + (((this->floorProperty == FLOOR_PROPERTY_5) || (this->floorProperty == FLOOR_PROPERTY_12)) && + ((sYDistToFloor < 100.0f) || (this->fallDistance > 400.0f) || ((play->sceneId != SCENE_SHADOW_TEMPLE) && (this->fallDistance > 200.0f)))) || ((play->sceneId == SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR) && (this->fallDistance > 320.0f))) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - if (this->unk_A7A == FLOOR_PROPERTY_5) { + if (this->floorProperty == FLOOR_PROPERTY_5) { Play_TriggerRespawn(play); } else { Play_TriggerVoidOut(play); @@ -4526,7 +4528,7 @@ s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) } else { func_80838F5C(play, this); this->unk_850 = 9999; - if (this->unk_A7A == FLOOR_PROPERTY_5) { + if (this->floorProperty == FLOOR_PROPERTY_5) { this->unk_84F = -1; } else { this->unk_84F = 1; @@ -4542,25 +4544,30 @@ s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) return 0; } -void func_808395DC(Player* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3) { +/** + * Gets a position relative to player's yaw. + * An offset is applied to the provided base position in the direction of shape y rotation. + * The resulting position is stored in `dest` + */ +void Player_GetRelativePosition(Player* this, Vec3f* base, Vec3f* offset, Vec3f* dest) { f32 cos = Math_CosS(this->actor.shape.rot.y); f32 sin = Math_SinS(this->actor.shape.rot.y); - arg3->x = arg1->x + ((arg2->x * cos) + (arg2->z * sin)); - arg3->y = arg1->y + arg2->y; - arg3->z = arg1->z + ((arg2->z * cos) - (arg2->x * sin)); + dest->x = base->x + ((offset->x * cos) + (offset->z * sin)); + dest->y = base->y + offset->y; + dest->z = base->z + ((offset->z * cos) - (offset->x * sin)); } Actor* Player_SpawnFairy(PlayState* play, Player* this, Vec3f* arg2, Vec3f* arg3, s32 type) { Vec3f pos; - func_808395DC(this, arg2, arg3, &pos); + Player_GetRelativePosition(this, arg2, arg3, &pos); return Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, pos.x, pos.y, pos.z, 0, 0, 0, type); } f32 func_808396F4(PlayState* play, Player* this, Vec3f* arg2, Vec3f* arg3, CollisionPoly** arg4, s32* arg5) { - func_808395DC(this, &this->actor.world.pos, arg2, arg3); + Player_GetRelativePosition(this, &this->actor.world.pos, arg2, arg3); return BgCheck_EntityRaycastDown3(&play->colCtx, arg4, arg5, arg3); } @@ -4572,17 +4579,25 @@ f32 func_8083973C(PlayState* play, Player* this, Vec3f* arg2, Vec3f* arg3) { return func_808396F4(play, this, arg2, arg3, &sp24, &sp20); } -s32 func_80839768(PlayState* play, Player* this, Vec3f* arg2, CollisionPoly** arg3, s32* arg4, Vec3f* arg5) { - Vec3f sp44; - Vec3f sp38; +/** + * Checks if a line between the player's position and the provided `offset` intersect a wall. + * + * Point A of the line is at player's world position offset by the height provided in `offset`. + * Point B of the line is at player's world position offset by the entire `offset` vector. + * Point A and B are always at the same height, meaning this is a horizontal line test. + */ +s32 Player_PosVsWallLineTest(PlayState* play, Player* this, Vec3f* offset, CollisionPoly** wallPoly, s32* bgId, + Vec3f* posResult) { + Vec3f posA; + Vec3f posB; - sp44.x = this->actor.world.pos.x; - sp44.y = this->actor.world.pos.y + arg2->y; - sp44.z = this->actor.world.pos.z; + posA.x = this->actor.world.pos.x; + posA.y = this->actor.world.pos.y + offset->y; + posA.z = this->actor.world.pos.z; - func_808395DC(this, &this->actor.world.pos, arg2, &sp38); + Player_GetRelativePosition(this, &this->actor.world.pos, offset, &posB); - return BgCheck_EntityLineTest1(&play->colCtx, &sp44, &sp38, arg5, arg3, true, false, false, true, arg4); + return BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, posResult, wallPoly, true, false, false, true, bgId); } s32 func_80839800(Player* this, PlayState* play) { @@ -4725,7 +4740,7 @@ s32 func_80839800(Player* this, PlayState* play) { BgCheck_EntityRaycastDown1(&play->colCtx, &groundPoly, &checkPos); //! @bug groundPoly's bgId is not guaranteed to be BGCHECK_SCENE - if (func_80839034(play, this, groundPoly, BGCHECK_SCENE)) { + if (Player_HandleExitsAndVoids(play, this, groundPoly, BGCHECK_SCENE)) { gSaveContext.entranceSpeed = 2.0f; gSaveContext.entranceSound = NA_SE_OC_DOOR_OPEN; } @@ -4963,7 +4978,10 @@ s32 func_8083A6AC(Player* this, PlayState* play) { Vec3f sp68; f32 temp1; - if ((this->actor.yDistToWater < -80.0f) && (ABS(this->unk_898) < 2730) && (ABS(this->unk_89A) < 2730)) { + //! @bug `floorPitch` and `floorPitchAlt` are cleared to 0 before this function is called, because the player + //! left the ground. The angles will always be zero and therefore will always pass these checks. + //! The intention seems to be to prevent ledge hanging or vine grabbing when walking off of a steep enough slope. + if ((this->actor.yDistToWater < -80.0f) && (ABS(this->floorPitch) < 0xAAA) && (ABS(this->floorPitchAlt) < 0xAAA)) { sp74.x = this->actor.prevPos.x - this->actor.world.pos.x; sp74.z = this->actor.prevPos.z - this->actor.world.pos.z; @@ -4989,7 +5007,7 @@ s32 func_8083A6AC(Player* this, PlayState* play) { sp54 = Math3D_UDistPlaneToPos(nx, ny, nz, sp84->dist, &this->actor.world.pos); - sp50 = D_80853604 == FLOOR_PROPERTY_6; + sp50 = (sPrevFloorProperty == FLOOR_PROPERTY_6); if (!sp50 && (SurfaceType_GetWallFlags(&play->colCtx, sp84, sp80) & WALL_FLAG_3)) { sp50 = 1; } @@ -5045,7 +5063,7 @@ void func_8083AA10(Player* this, PlayState* play) { if (!(this->stateFlags1 & (PLAYER_STATE1_27 | PLAYER_STATE1_29)) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (!func_80838FB8(play, this)) { - if (D_80853604 == FLOOR_PROPERTY_8) { + if (sPrevFloorProperty == FLOOR_PROPERTY_8) { this->actor.world.pos.x = this->actor.prevPos.x; this->actor.world.pos.z = this->actor.prevPos.z; return; @@ -5054,7 +5072,7 @@ void func_8083AA10(Player* this, PlayState* play) { if (!(this->stateFlags3 & PLAYER_STATE3_1) && !(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_7) && (func_8084411C != this->func_674) && (func_80844A44 != this->func_674)) { - if ((D_80853604 == FLOOR_PROPERTY_7) || (this->meleeWeaponState != 0)) { + if ((sPrevFloorProperty == FLOOR_PROPERTY_7) || (this->meleeWeaponState != 0)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); Player_ZeroSpeedXZ(this); return; @@ -5062,7 +5080,7 @@ void func_8083AA10(Player* this, PlayState* play) { if (this->hoverBootsTimer != 0) { this->actor.velocity.y = 1.0f; - D_80853604 = FLOOR_PROPERTY_9; + sPrevFloorProperty = FLOOR_PROPERTY_9; return; } @@ -5074,10 +5092,11 @@ void func_8083AA10(Player* this, PlayState* play) { this->floorSfxOffset = this->prevFloorSfxOffset; if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_LEAVE) && !(this->stateFlags1 & PLAYER_STATE1_27) && - (D_80853604 != FLOOR_PROPERTY_6) && (D_80853604 != FLOOR_PROPERTY_9) && (D_80853600 > 20.0f) && - (this->meleeWeaponState == 0) && (ABS(sp5C) < 0x2000) && (this->speedXZ > 3.0f)) { + (sPrevFloorProperty != FLOOR_PROPERTY_6) && (sPrevFloorProperty != FLOOR_PROPERTY_9) && + (sYDistToFloor > 20.0f) && (this->meleeWeaponState == 0) && (ABS(sp5C) < 0x2000) && + (this->speedXZ > 3.0f)) { - if ((D_80853604 == FLOOR_PROPERTY_11) && !(this->stateFlags1 & PLAYER_STATE1_11)) { + if ((sPrevFloorProperty == FLOOR_PROPERTY_11) && !(this->stateFlags1 & PLAYER_STATE1_11)) { sp40 = func_808396F4(play, this, &D_8085451C, &sp44, &sp58, &sp54); sp3C = this->actor.world.pos.y; @@ -5093,8 +5112,7 @@ void func_8083AA10(Player* this, PlayState* play) { func_8083A4A8(this, play); return; } - - if ((D_80853604 == FLOOR_PROPERTY_9) || (D_80853600 <= this->ageProperties->unk_34) || + if ((sPrevFloorProperty == FLOOR_PROPERTY_9) || (sYDistToFloor <= this->ageProperties->unk_34) || !func_8083A6AC(this, play)) { Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_landing_wait); return; @@ -5495,7 +5513,7 @@ s32 func_8083BB20(Player* this) { } s32 func_8083BBA0(Player* this, PlayState* play) { - if (func_8083BB20(this) && (D_808535E4 != FLOOR_TYPE_7)) { + if (func_8083BB20(this) && (sFloorType != FLOOR_TYPE_7)) { func_8083BA90(play, this, PLAYER_MWA_JUMPSLASH_START, 3.0f, 4.5f); return 1; } @@ -5511,7 +5529,7 @@ void func_8083BC04(Player* this, PlayState* play) { } s32 func_8083BC7C(Player* this, PlayState* play) { - if ((this->unk_84B[this->unk_846] == 0) && (D_808535E4 != FLOOR_TYPE_7)) { + if ((this->unk_84B[this->unk_846] == 0) && (sFloorType != FLOOR_TYPE_7)) { func_8083BC04(this, play); return 1; } @@ -5539,7 +5557,7 @@ s32 func_8083BDBC(Player* this, PlayState* play) { s32 sp2C; if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && - (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (D_808535E4 != FLOOR_TYPE_7) && + (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (sFloorType != FLOOR_TYPE_7) && (SurfaceType_GetFloorEffect(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) != FLOOR_EFFECT_1)) { sp2C = this->unk_84B[this->unk_846]; @@ -6112,11 +6130,11 @@ void func_8083D6EC(PlayState* play, Player* this) { this->actor.minVelocityY = -20.0f; this->actor.gravity = REG(68) / 100.0f; - if (func_8083816C(D_808535E4)) { + if (func_8083816C(sFloorType)) { temp1 = fabsf(this->speedXZ) * 20.0f; temp3 = 0.0f; - if (D_808535E4 == FLOOR_TYPE_4) { + if (sFloorType == FLOOR_TYPE_4) { if (this->unk_6C4 > 1300.0f) { temp2 = this->unk_6C4; } else { @@ -6131,7 +6149,7 @@ void func_8083D6EC(PlayState* play, Player* this) { temp2 = 20000.0f; if (this->currentBoots != PLAYER_BOOTS_HOVER) { temp1 += temp1; - } else if ((D_808535E4 == FLOOR_TYPE_7) || (this->currentBoots == PLAYER_BOOTS_IRON)) { + } else if ((sFloorType == FLOOR_TYPE_7) || (this->currentBoots == PLAYER_BOOTS_IRON)) { temp1 = 0; } } @@ -6233,7 +6251,7 @@ void func_8083DC54(Player* this, PlayState* play) { return; } - if (D_808535E4 == FLOOR_TYPE_11) { + if (sFloorType == FLOOR_TYPE_11) { Math_SmoothStepToS(&this->actor.focus.rot.x, -20000, 10, 4000, 800); } else { sp46 = 0; @@ -6350,12 +6368,11 @@ void Player_GetSlopeDirection(CollisionPoly* floorPoly, Vec3f* slopeNormal, s16* *downwardSlopeYaw = Math_Atan2S(slopeNormal->z, slopeNormal->x); } -static LinkAnimationHeader* D_80854590[] = { - &gPlayerAnim_link_normal_down_slope_slip, - &gPlayerAnim_link_normal_up_slope_slip, -}; - -s32 func_8083E318(PlayState* play, Player* this, CollisionPoly* floorPoly) { +s32 Player_HandleSlopes(PlayState* play, Player* this, CollisionPoly* floorPoly) { + static LinkAnimationHeader* sSlopeSlipAnims[] = { + &gPlayerAnim_link_normal_down_slope_slip, + &gPlayerAnim_link_normal_up_slope_slip, + }; s32 pad; s16 playerVelYaw; Vec3f slopeNormal; @@ -6366,7 +6383,6 @@ s32 func_8083E318(PlayState* play, Player* this, CollisionPoly* floorPoly) { if (!Player_InBlockingCsMode(play, this) && (func_8084F390 != this->func_674) && (SurfaceType_GetFloorEffect(&play->colCtx, floorPoly, this->actor.floorBgId) == FLOOR_EFFECT_1)) { - // Get direction of movement relative to the downward direction of the slope playerVelYaw = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); Player_GetSlopeDirection(floorPoly, &slopeNormal, &downwardSlopeYaw); @@ -6376,6 +6392,7 @@ s32 func_8083E318(PlayState* play, Player* this, CollisionPoly* floorPoly) { // moving parallel or upwards on the slope, player does not slip but does slow down slopeSlowdownSpeed = (1.0f - slopeNormal.y) * 40.0f; slopeSlowdownSpeedStep = SQ(slopeSlowdownSpeed) * 0.015f; + if (slopeSlowdownSpeedStep < 1.2f) { slopeSlowdownSpeedStep = 1.2f; } @@ -6387,10 +6404,11 @@ s32 func_8083E318(PlayState* play, Player* this, CollisionPoly* floorPoly) { // moving downward on the slope, causing player to slip func_80835C58(play, this, func_8084F390, 0); func_80832564(play, this); - if (D_80853610 >= 0) { + + if (sFloorShapePitch >= 0) { this->unk_84F = 1; } - Player_AnimChangeLoopMorph(play, this, D_80854590[this->unk_84F]); + Player_AnimChangeLoopMorph(play, this, sSlopeSlipAnims[this->unk_84F]); this->speedXZ = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z)); this->yaw = playerVelYaw; return true; @@ -6568,13 +6586,13 @@ s32 func_8083EB44(Player* this, PlayState* play) { return 0; } -s32 func_8083EC18(Player* this, PlayState* play, u32 interactWallFlags) { - if (this->wallHeight >= 79.0f) { +s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) { + if (this->yDistToLedge >= 79.0f) { if (!(this->stateFlags1 & PLAYER_STATE1_27) || (this->currentBoots == PLAYER_BOOTS_IRON) || (this->actor.yDistToWater < this->ageProperties->unk_2C)) { - s32 sp8C = (interactWallFlags & WALL_FLAG_3) ? 2 : 0; + s32 sp8C = (wallFlags & WALL_FLAG_3) ? 2 : 0; - if ((sp8C != 0) || (interactWallFlags & WALL_FLAG_1) || + if ((sp8C != 0) || (wallFlags & WALL_FLAG_1) || SurfaceType_CheckWallFlag2(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) { f32 phi_f20; CollisionPoly* wallPoly = this->actor.wallPoly; @@ -6633,21 +6651,21 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 interactWallFlags) { if (phi_f12 < 8.0f) { f32 wallPolyNormalX = COLPOLY_GET_NORMAL(wallPoly->normal.x); f32 wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); - f32 sp34 = this->wallDistance; + f32 sp34 = this->distToInteractWall; LinkAnimationHeader* anim; func_80836898(play, this, func_8083A3B0); this->stateFlags1 |= PLAYER_STATE1_21; this->stateFlags1 &= ~PLAYER_STATE1_27; - if ((sp8C != 0) || (interactWallFlags & WALL_FLAG_1)) { + if ((sp8C != 0) || (wallFlags & WALL_FLAG_1)) { if ((this->unk_84F = sp8C) != 0) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { anim = &gPlayerAnim_link_normal_Fclimb_startA; } else { anim = &gPlayerAnim_link_normal_Fclimb_hold2upL; } - sp34 = (this->ageProperties->unk_38 - 1.0f) - sp34; + sp34 = (this->ageProperties->wallCheckRadius - 1.0f) - sp34; } else { anim = this->ageProperties->unk_A4; sp34 = sp34 - 1.0f; @@ -6737,13 +6755,13 @@ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWall // Enter Crawlspace f32 wallPolyNormalX = COLPOLY_GET_NORMAL(wallPoly->normal.x); f32 wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); - f32 wallDistance = this->wallDistance; + f32 distToInteractWall = this->distToInteractWall; func_80836898(play, this, func_8083A40C); this->stateFlags2 |= PLAYER_STATE2_CRAWLING; this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; - this->actor.world.pos.x = xVertex1 + (wallDistance * wallPolyNormalX); - this->actor.world.pos.z = zVertex1 + (wallDistance * wallPolyNormalZ); + this->actor.world.pos.x = xVertex1 + (distToInteractWall * wallPolyNormalX); + this->actor.world.pos.z = zVertex1 + (distToInteractWall * wallPolyNormalZ); func_80832224(this); this->actor.prevPos = this->actor.world.pos; Player_AnimPlayOnce(play, this, &gPlayerAnim_link_child_tunnel_start); @@ -6787,7 +6805,7 @@ s32 func_8083F360(PlayState* play, Player* this, f32 arg1, f32 arg2, f32 arg3, f this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_WALL_INTERACT; this->actor.wallBgId = wallBgId; - sInteractWallFlags = SurfaceType_GetWallFlags(&play->colCtx, wallPoly, wallBgId); + sTouchedWallFlags = SurfaceType_GetWallFlags(&play->colCtx, wallPoly, wallBgId); wallPolyNormalX = COLPOLY_GET_NORMAL(wallPoly->normal.x); wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); @@ -6807,7 +6825,7 @@ s32 func_8083F360(PlayState* play, Player* this, f32 arg1, f32 arg2, f32 arg3, f } s32 func_8083F524(PlayState* play, Player* this) { - return func_8083F360(play, this, 26.0f, this->ageProperties->unk_38 + 5.0f, 30.0f, 0.0f); + return func_8083F360(play, this, 26.0f, this->ageProperties->wallCheckRadius + 5.0f, 30.0f, 0.0f); } /** @@ -6820,7 +6838,7 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { s16 yawToWall; if ((this->speedXZ != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && - (sInteractWallFlags & WALL_FLAG_CRAWLSPACE)) { + (sTouchedWallFlags & WALL_FLAG_CRAWLSPACE)) { // The exit wallYaws will always point inward on the crawlline // Interacting with the exit wall in front will have a yaw diff of 0x8000 @@ -6878,16 +6896,16 @@ s32 func_8083F7BC(Player* this, PlayState* play) { DynaPolyActor* wallPolyActor; if (!(this->stateFlags1 & PLAYER_STATE1_11) && (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && - (D_80853608 < 0x3000)) { + (sShapeYawToTouchedWall < 0x3000)) { - if (((this->speedXZ > 0.0f) && func_8083EC18(this, play, sInteractWallFlags)) || - Player_TryEnteringCrawlspace(this, play, sInteractWallFlags)) { + if (((this->speedXZ > 0.0f) && func_8083EC18(this, play, sTouchedWallFlags)) || + Player_TryEnteringCrawlspace(this, play, sTouchedWallFlags)) { return 1; } if (!func_808332B8(this) && ((this->speedXZ == 0.0f) || !(this->stateFlags2 & PLAYER_STATE2_2)) && - (sInteractWallFlags & WALL_FLAG_6) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && - (this->wallHeight >= 39.0f)) { + (sTouchedWallFlags & WALL_FLAG_6) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + (this->yDistToLedge >= 39.0f)) { this->stateFlags2 |= PLAYER_STATE2_0; @@ -6971,7 +6989,7 @@ void func_8083FB7C(Player* this, PlayState* play) { s32 func_8083FBC0(Player* this, PlayState* play) { if (!CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && - ((sInteractWallFlags & WALL_FLAG_3) || (sInteractWallFlags & WALL_FLAG_1) || + ((sTouchedWallFlags & WALL_FLAG_3) || (sTouchedWallFlags & WALL_FLAG_1) || SurfaceType_CheckWallFlag2(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId))) { return false; } @@ -7735,10 +7753,10 @@ void func_80841CC4(Player* this, s32 arg1, PlayState* play) { s16 target; f32 rate; - if (ABS(D_80853610) < 3640) { + if (ABS(sFloorShapePitch) < 3640) { target = 0; } else { - target = CLAMP(D_80853610, -10922, 10922); + target = CLAMP(sFloorShapePitch, -10922, 10922); } Math_ScaledStepToS(&this->unk_89C, target, 400); @@ -8457,8 +8475,8 @@ static struct_80832924 D_808545F0[] = { void func_80843CEC(Player* this, PlayState* play) { if (this->currentTunic != PLAYER_TUNIC_GORON) { - if ((play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) || (D_808535E4 == FLOOR_TYPE_9) || - ((func_80838144(D_808535E4) >= 0) && + if ((play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) || (sFloorType == FLOOR_TYPE_9) || + ((func_80838144(sFloorType) >= 0) && !func_80042108(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId))) { func_8083821C(this); } @@ -8498,7 +8516,7 @@ static FallImpactInfo D_80854600[] = { s32 func_80843E64(PlayState* play, Player* this) { s32 sp34; - if ((D_808535E4 == FLOOR_TYPE_6) || (D_808535E4 == FLOOR_TYPE_9)) { + if ((sFloorType == FLOOR_TYPE_6) || (sFloorType == FLOOR_TYPE_9)) { sp34 = 0; } else { sp34 = this->fallDistance; @@ -8543,7 +8561,7 @@ s32 func_80843E64(PlayState* play, Player* this) { Player_RequestRumble(this, (u8)sp34, (u8)(sp34 * 0.1f), (u8)sp34, 0); - if (D_808535E4 == FLOOR_TYPE_6) { + if (sFloorType == FLOOR_TYPE_6) { func_80832698(this, NA_SE_VO_LI_CLIMB_END); } } @@ -8601,7 +8619,7 @@ void func_8084411C(Player* this, PlayState* play) { if (this->unk_850 >= 0) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->unk_850 == 0) || (this->fallDistance > 0)) { - if ((D_80853600 > 800.0f) || (this->stateFlags1 & PLAYER_STATE1_2)) { + if ((sYDistToFloor > 800.0f) || (this->stateFlags1 & PLAYER_STATE1_2)) { func_80843E14(this, NA_SE_VO_LI_FALL_S); this->stateFlags1 &= ~PLAYER_STATE1_2; } @@ -8611,7 +8629,7 @@ void func_8084411C(Player* this, PlayState* play) { this->unk_850 = -1; } } else { - if ((this->unk_850 == -1) && (this->fallDistance > 120.0f) && (D_80853600 > 280.0f)) { + if ((this->unk_850 == -1) && (this->fallDistance > 120.0f) && (sYDistToFloor > 280.0f)) { this->unk_850 = -2; func_80843E14(this, NA_SE_VO_LI_FALL_L); } @@ -8619,10 +8637,10 @@ void func_8084411C(Player* this, PlayState* play) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && !(this->stateFlags2 & PLAYER_STATE2_19) && !(this->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_27)) && (this->speedXZ > 0.0f)) { - if ((this->wallHeight >= 150.0f) && (this->unk_84B[this->unk_846] == 0)) { - func_8083EC18(this, play, sInteractWallFlags); - } else if ((this->unk_88C >= 2) && (this->wallHeight < 150.0f) && - (((this->actor.world.pos.y - this->actor.floorHeight) + this->wallHeight) > + if ((this->yDistToLedge >= 150.0f) && (this->unk_84B[this->unk_846] == 0)) { + func_8083EC18(this, play, sTouchedWallFlags); + } else if ((this->ledgeClimbType >= PLAYER_LEDGE_CLIMB_2) && (this->yDistToLedge < 150.0f) && + (((this->actor.world.pos.y - this->actor.floorHeight) + this->yDistToLedge) > (70.0f * this->ageProperties->unk_08))) { AnimationContext_DisableQueue(play); if (this->stateFlags1 & PLAYER_STATE1_2) { @@ -8630,8 +8648,8 @@ void func_8084411C(Player* this, PlayState* play) { } else { func_80832698(this, NA_SE_VO_LI_HANG); } - this->actor.world.pos.y += this->wallHeight; - func_8083A5C4(play, this, this->actor.wallPoly, this->wallDistance, + this->actor.world.pos.y += this->yDistToLedge; + func_8083A5C4(play, this, this->actor.wallPoly, this->distToInteractWall, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_jump_climb_hold, this->modelAnimType)); this->actor.shape.rot.y = this->yaw += 0x8000; this->stateFlags1 |= PLAYER_STATE1_13; @@ -8714,7 +8732,8 @@ void func_80844708(Player* this, PlayState* play) { } } else { if (this->speedXZ >= 7.0f) { - if (((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (D_8085360C < 0x2000)) || + if (((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && + (sWorldYawToTouchedWall < 0x2000)) || ((this->cylinder.base.ocFlags1 & OC1_HIT) && (cylinderOc = this->cylinder.base.oc, ((cylinderOc->id == ACTOR_EN_WOOD02) && @@ -9050,7 +9069,7 @@ void func_80845668(Player* this, PlayState* play) { this->speedXZ = 1.0f; if (LinkAnimation_OnFrame(&this->skelAnime, 8.0f)) { - temp1 = this->wallHeight; + temp1 = this->yDistToLedge; if (temp1 > this->ageProperties->unk_0C) { temp1 = this->ageProperties->unk_0C; @@ -9221,7 +9240,7 @@ void func_80845CA4(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_0) { sp34 = gSaveContext.entranceSpeed; - if (sConveyorSpeedIndex != CONVEYOR_SPEED_DISABLED) { + if (sConveyorSpeed != CONVEYOR_SPEED_DISABLED) { this->unk_450.x = (Math_SinS(sConveyorYaw) * 400.0f) + this->actor.world.pos.x; this->unk_450.z = (Math_CosS(sConveyorYaw) * 400.0f) + this->actor.world.pos.z; } @@ -9924,7 +9943,7 @@ void func_808473D4(PlayState* play, Player* this) { !Player_IsChildWithHylianShield(this))) { if ((!(this->stateFlags1 & PLAYER_STATE1_14) && (sp20 <= 0) && (func_8008E9C4(this) || - ((D_808535E4 != FLOOR_TYPE_7) && + ((sFloorType != FLOOR_TYPE_7) && (func_80833B2C(this) || ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && !(this->stateFlags1 & PLAYER_STATE1_22) && (sp20 == 0))))))) { doAction = DO_ACTION_ATTACK; @@ -9962,8 +9981,18 @@ void func_808473D4(PlayState* play, Player* this) { } } -s32 func_80847A78(Player* this) { - s32 cond; +/** + * Updates state related to the Hover Boots. + * Handles a special case where the Hover Boots are able to activate when standing on certain floor types even if the + * player is standing on the ground. + * + * If the player is not on the ground, regardless of the usage of the Hover Boots, various floor related variables are + * reset. + * + * @return true if not on the ground, false otherwise. Note this is independent of the Hover Boots state. + */ +s32 Player_UpdateHoverBoots(Player* this) { + s32 canHoverOnGround; if ((this->currentBoots == PLAYER_BOOTS_HOVER) && (this->hoverBootsTimer != 0)) { this->hoverBootsTimer--; @@ -9971,90 +10000,108 @@ s32 func_80847A78(Player* this) { this->hoverBootsTimer = 0; } - cond = (this->currentBoots == PLAYER_BOOTS_HOVER) && - ((this->actor.yDistToWater >= 0.0f) || (func_80838144(D_808535E4) >= 0) || func_8083816C(D_808535E4)); + canHoverOnGround = + (this->currentBoots == PLAYER_BOOTS_HOVER) && + ((this->actor.yDistToWater >= 0.0f) || (func_80838144(sFloorType) >= 0) || func_8083816C(sFloorType)); - if (cond && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->hoverBootsTimer != 0)) { + if (canHoverOnGround && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->hoverBootsTimer != 0)) { this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - if (!cond) { + if (!canHoverOnGround) { this->hoverBootsTimer = 19; } + return false; + } else { + sFloorType = FLOOR_TYPE_0; + this->floorPitch = this->floorPitchAlt = sFloorShapePitch = 0; + + return true; } - - D_808535E4 = FLOOR_TYPE_0; - this->unk_898 = this->unk_89A = D_80853610 = 0; - - return true; } -static Vec3f D_80854798 = { 0.0f, 18.0f, 0.0f }; - -void func_80847BA0(PlayState* play, Player* this) { - u8 spC7 = 0; +/** + * Peforms various tasks related to scene collision. + * + * This includes: + * - Update BgCheckInfo, parameters adjusted due to various state flags + * - Update floor type, floor property and floor sfx offset + * - Update conveyor, reverb and light settings according to the current floor poly + * - Handle exits and voids + * - Update information relating to the "interact wall" + * - Update information for ledge climbing + * - Update hover boots + * - Calculate floor poly angles + * + */ +void Player_ProcessSceneCollision(PlayState* play, Player* this) { + static Vec3f sInteractWallCheckOffset = { 0.0f, 18.0f, 0.0f }; + u8 nextLedgeClimbType = PLAYER_LEDGE_CLIMB_NONE; CollisionPoly* floorPoly; - Vec3f spB4; - f32 spB0; - f32 spAC; - f32 spA8; - u32 spA4; + Vec3f unusedWorldPos; + f32 float0; // multi-purpose variable, see define names (fake match?) + f32 float1; // multi-purpose variable, see define names (fake match?) + f32 ceilingCheckHeight; + u32 flags; - D_80853604 = this->unk_A7A; + sPrevFloorProperty = this->floorProperty; + +#define vWallCheckRadius float0 +#define vWallCheckHeight float1 if (this->stateFlags2 & PLAYER_STATE2_CRAWLING) { - spB0 = 10.0f; - spAC = 15.0f; - spA8 = 30.0f; + vWallCheckRadius = 10.0f; + vWallCheckHeight = 15.0f; + ceilingCheckHeight = 30.0f; } else { - spB0 = this->ageProperties->unk_38; - spAC = 26.0f; - spA8 = this->ageProperties->unk_00; + vWallCheckRadius = this->ageProperties->wallCheckRadius; + vWallCheckHeight = 26.0f; + ceilingCheckHeight = this->ageProperties->ceilingCheckHeight; } if (this->stateFlags1 & (PLAYER_STATE1_29 | PLAYER_STATE1_31)) { if (this->stateFlags1 & PLAYER_STATE1_31) { this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; - spA4 = UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_5; + flags = UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_5; } else if ((this->stateFlags1 & PLAYER_STATE1_0) && ((this->unk_A84 - (s32)this->actor.world.pos.y) >= 100)) { - spA4 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_5; + flags = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_5; } else if (!(this->stateFlags1 & PLAYER_STATE1_0) && ((func_80845EF8 == this->func_674) || (func_80845CA4 == this->func_674))) { this->actor.bgCheckFlags &= ~(BGCHECKFLAG_WALL | BGCHECKFLAG_PLAYER_WALL_INTERACT); - spA4 = UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_5; + flags = UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_5; } else { - spA4 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | - UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_5; + flags = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | + UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_5; } } else { - spA4 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | - UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_5; + flags = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | + UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_5; } if (this->stateFlags3 & PLAYER_STATE3_0) { - spA4 &= ~(UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); + flags &= ~(UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); } - if (spA4 & UPDBGCHECKINFO_FLAG_2) { + if (flags & UPDBGCHECKINFO_FLAG_2) { this->stateFlags3 |= PLAYER_STATE3_4; } - Math_Vec3f_Copy(&spB4, &this->actor.world.pos); - Actor_UpdateBgCheckInfo(play, &this->actor, spAC, spB0, spA8, spA4); + Math_Vec3f_Copy(&unusedWorldPos, &this->actor.world.pos); + + Actor_UpdateBgCheckInfo(play, &this->actor, vWallCheckHeight, vWallCheckRadius, ceilingCheckHeight, flags); if (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) { this->actor.velocity.y = 0.0f; } - D_80853600 = this->actor.world.pos.y - this->actor.floorHeight; - sConveyorSpeedIndex = CONVEYOR_SPEED_DISABLED; - + sYDistToFloor = this->actor.world.pos.y - this->actor.floorHeight; + sConveyorSpeed = CONVEYOR_SPEED_DISABLED; floorPoly = this->actor.floorPoly; if (floorPoly != NULL) { - this->unk_A7A = SurfaceType_GetFloorProperty(&play->colCtx, floorPoly, this->actor.floorBgId); + this->floorProperty = SurfaceType_GetFloorProperty(&play->colCtx, floorPoly, this->actor.floorBgId); this->prevFloorSfxOffset = this->floorSfxOffset; if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { @@ -10064,7 +10111,7 @@ void func_80847BA0(PlayState* play, Player* this) { this->floorSfxOffset = SURFACE_SFX_OFFSET_WATER_DEEP; } } else { - if (this->stateFlags2 & PLAYER_STATE2_9) { + if (this->stateFlags2 & PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND) { this->floorSfxOffset = SURFACE_SFX_OFFSET_SAND; } else { this->floorSfxOffset = SurfaceType_GetSfxOffset(&play->colCtx, floorPoly, this->actor.floorBgId); @@ -10082,37 +10129,40 @@ void func_80847BA0(PlayState* play, Player* this) { } } - // This block extracts the conveyor properties from the floor poly - sConveyorSpeedIndex = SurfaceType_GetConveyorSpeed(&play->colCtx, floorPoly, this->actor.floorBgId); - if (sConveyorSpeedIndex != CONVEYOR_SPEED_DISABLED) { + sConveyorSpeed = SurfaceType_GetConveyorSpeed(&play->colCtx, floorPoly, this->actor.floorBgId); + + if (sConveyorSpeed != CONVEYOR_SPEED_DISABLED) { sIsFloorConveyor = SurfaceType_IsFloorConveyor(&play->colCtx, floorPoly, this->actor.floorBgId); + if ((!sIsFloorConveyor && (this->actor.yDistToWater > 20.0f) && (this->currentBoots != PLAYER_BOOTS_IRON)) || (sIsFloorConveyor && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) { sConveyorYaw = CONVEYOR_DIRECTION_TO_BINANG( SurfaceType_GetConveyorDirection(&play->colCtx, floorPoly, this->actor.floorBgId)); } else { - sConveyorSpeedIndex = CONVEYOR_SPEED_DISABLED; + sConveyorSpeed = CONVEYOR_SPEED_DISABLED; } } } - func_80839034(play, this, floorPoly, this->actor.floorBgId); + Player_HandleExitsAndVoids(play, this, floorPoly, this->actor.floorBgId); this->actor.bgCheckFlags &= ~BGCHECKFLAG_PLAYER_WALL_INTERACT; if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { CollisionPoly* wallPoly; s32 wallBgId; - s16 sp9A; + s16 yawDiff; s32 pad; - D_80854798.y = 18.0f; - D_80854798.z = this->ageProperties->unk_38 + 10.0f; + sInteractWallCheckOffset.y = 18.0f; + sInteractWallCheckOffset.z = this->ageProperties->wallCheckRadius + 10.0f; if (!(this->stateFlags2 & PLAYER_STATE2_CRAWLING) && - func_80839768(play, this, &D_80854798, &wallPoly, &wallBgId, &D_80858AA8)) { + Player_PosVsWallLineTest(play, this, &sInteractWallCheckOffset, &wallPoly, &wallBgId, + &sInteractWallCheckResult)) { this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_WALL_INTERACT; + if (this->actor.wallPoly != wallPoly) { this->actor.wallPoly = wallPoly; this->actor.wallBgId = wallBgId; @@ -10120,80 +10170,87 @@ void func_80847BA0(PlayState* play, Player* this) { } } - sp9A = this->actor.shape.rot.y - (s16)(this->actor.wallYaw + 0x8000); + yawDiff = this->actor.shape.rot.y - (s16)(this->actor.wallYaw + 0x8000); + sTouchedWallFlags = SurfaceType_GetWallFlags(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId); + sShapeYawToTouchedWall = ABS(yawDiff); - sInteractWallFlags = SurfaceType_GetWallFlags(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId); + yawDiff = this->yaw - (s16)(this->actor.wallYaw + 0x8000); + sWorldYawToTouchedWall = ABS(yawDiff); - D_80853608 = ABS(sp9A); +#define vSpeedScale float0 +#define vSpeedLimit float1 - sp9A = this->yaw - (s16)(this->actor.wallYaw + 0x8000); + vSpeedScale = sWorldYawToTouchedWall * 0.00008f; - D_8085360C = ABS(sp9A); - - spB0 = D_8085360C * 0.00008f; - if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || spB0 >= 1.0f) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || vSpeedScale >= 1.0f) { this->unk_880 = R_RUN_SPEED_LIMIT / 100.0f; } else { - spAC = (R_RUN_SPEED_LIMIT / 100.0f * spB0); - this->unk_880 = spAC; - if (spAC < 0.1f) { + vSpeedLimit = (R_RUN_SPEED_LIMIT / 100.0f * vSpeedScale); + this->unk_880 = vSpeedLimit; + + if (vSpeedLimit < 0.1f) { this->unk_880 = 0.1f; } } - if ((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (D_80853608 < 0x3000)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (sShapeYawToTouchedWall < 0x3000)) { CollisionPoly* wallPoly = this->actor.wallPoly; if (ABS(wallPoly->normal.y) < 600) { f32 wallPolyNormalX = COLPOLY_GET_NORMAL(wallPoly->normal.x); f32 wallPolyNormalY = COLPOLY_GET_NORMAL(wallPoly->normal.y); f32 wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); - f32 wallHeight; - CollisionPoly* groundPoly; - CollisionPoly* sp78; - s32 sp74; - Vec3f sp68; - f32 sp64; - f32 sp60; - s32 temp3; + f32 yDistToLedge; + CollisionPoly* ledgeFloorPoly; + CollisionPoly* poly; + s32 bgId; + Vec3f ledgeCheckPos; + f32 ledgePosY; + f32 ceillingPosY; + s32 wallYawDiff; - this->wallDistance = Math3D_UDistPlaneToPos(wallPolyNormalX, wallPolyNormalY, wallPolyNormalZ, - wallPoly->dist, &this->actor.world.pos); + this->distToInteractWall = Math3D_UDistPlaneToPos(wallPolyNormalX, wallPolyNormalY, wallPolyNormalZ, + wallPoly->dist, &this->actor.world.pos); - spB0 = this->wallDistance + 10.0f; - sp68.x = this->actor.world.pos.x - (spB0 * wallPolyNormalX); - sp68.z = this->actor.world.pos.z - (spB0 * wallPolyNormalZ); - sp68.y = this->actor.world.pos.y + this->ageProperties->unk_0C; +#define vLedgeCheckOffsetXZ float0 - sp64 = BgCheck_EntityRaycastDown1(&play->colCtx, &groundPoly, &sp68); - wallHeight = sp64 - this->actor.world.pos.y; - this->wallHeight = wallHeight; + vLedgeCheckOffsetXZ = this->distToInteractWall + 10.0f; - if ((this->wallHeight < 18.0f) || - BgCheck_EntityCheckCeiling(&play->colCtx, &sp60, &this->actor.world.pos, - (sp64 - this->actor.world.pos.y) + 20.0f, &sp78, &sp74, &this->actor)) { - this->wallHeight = 399.96002f; + ledgeCheckPos.x = this->actor.world.pos.x - (vLedgeCheckOffsetXZ * wallPolyNormalX); + ledgeCheckPos.z = this->actor.world.pos.z - (vLedgeCheckOffsetXZ * wallPolyNormalZ); + ledgeCheckPos.y = this->actor.world.pos.y + this->ageProperties->unk_0C; + + ledgePosY = BgCheck_EntityRaycastDown1(&play->colCtx, &ledgeFloorPoly, &ledgeCheckPos); + yDistToLedge = ledgePosY - this->actor.world.pos.y; + this->yDistToLedge = yDistToLedge; + + if ((this->yDistToLedge < 18.0f) || + BgCheck_EntityCheckCeiling(&play->colCtx, &ceillingPosY, &this->actor.world.pos, + (ledgePosY - this->actor.world.pos.y) + 20.0f, &poly, &bgId, + &this->actor)) { + this->yDistToLedge = LEDGE_DIST_MAX; } else { - D_80854798.y = (sp64 + 5.0f) - this->actor.world.pos.y; + sInteractWallCheckOffset.y = (ledgePosY + 5.0f) - this->actor.world.pos.y; - if (func_80839768(play, this, &D_80854798, &sp78, &sp74, &D_80858AA8) && - (temp3 = this->actor.wallYaw - Math_Atan2S(sp78->normal.z, sp78->normal.x), - ABS(temp3) < 0x4000) && - !SurfaceType_CheckWallFlag1(&play->colCtx, sp78, sp74)) { - this->wallHeight = 399.96002f; + if (Player_PosVsWallLineTest(play, this, &sInteractWallCheckOffset, &poly, &bgId, + &sInteractWallCheckResult) && + (wallYawDiff = this->actor.wallYaw - Math_Atan2S(poly->normal.z, poly->normal.x), + ABS(wallYawDiff) < 0x4000) && + !SurfaceType_CheckWallFlag1(&play->colCtx, poly, bgId)) { + this->yDistToLedge = LEDGE_DIST_MAX; } else if (SurfaceType_CheckWallFlag0(&play->colCtx, wallPoly, this->actor.wallBgId) == 0) { - if (this->ageProperties->unk_1C <= this->wallHeight) { - if (ABS(groundPoly->normal.y) > 28000) { - if (this->ageProperties->unk_14 <= this->wallHeight) { - spC7 = 4; - } else if (this->ageProperties->unk_18 <= this->wallHeight) { - spC7 = 3; + if (this->ageProperties->unk_1C <= this->yDistToLedge) { + if (ABS(ledgeFloorPoly->normal.y) > 0x6D60) { + if (this->ageProperties->unk_14 <= this->yDistToLedge) { + nextLedgeClimbType = PLAYER_LEDGE_CLIMB_4; + } else if (this->ageProperties->unk_18 <= this->yDistToLedge) { + nextLedgeClimbType = PLAYER_LEDGE_CLIMB_3; } else { - spC7 = 2; + nextLedgeClimbType = PLAYER_LEDGE_CLIMB_2; } } } else { - spC7 = 1; + nextLedgeClimbType = PLAYER_LEDGE_CLIMB_1; } } } @@ -10201,29 +10258,29 @@ void func_80847BA0(PlayState* play, Player* this) { } } else { this->unk_880 = R_RUN_SPEED_LIMIT / 100.0f; - this->unk_88D = 0; - this->wallHeight = 0.0f; + this->ledgeClimbDelayTimer = 0; + this->yDistToLedge = 0.0f; } - if (spC7 == this->unk_88C) { - if ((this->speedXZ != 0.0f) && (this->unk_88D < 100)) { - this->unk_88D++; + if (nextLedgeClimbType == this->ledgeClimbType) { + if ((this->speedXZ != 0.0f) && (this->ledgeClimbDelayTimer < 100)) { + this->ledgeClimbDelayTimer++; } } else { - this->unk_88C = spC7; - this->unk_88D = 0; + this->ledgeClimbType = nextLedgeClimbType; + this->ledgeClimbDelayTimer = 0; } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - D_808535E4 = SurfaceType_GetFloorType(&play->colCtx, floorPoly, this->actor.floorBgId); + sFloorType = SurfaceType_GetFloorType(&play->colCtx, floorPoly, this->actor.floorBgId); - if (!func_80847A78(this)) { + if (!Player_UpdateHoverBoots(this)) { f32 floorPolyNormalX; f32 invFloorPolyNormalY; f32 floorPolyNormalZ; - f32 sp4C; + f32 sin; s32 pad2; - f32 sp44; + f32 cos; s32 pad3; if (this->actor.floorBgId != BGCHECK_SCENE) { @@ -10234,31 +10291,31 @@ void func_80847BA0(PlayState* play, Player* this) { invFloorPolyNormalY = 1.0f / COLPOLY_GET_NORMAL(floorPoly->normal.y); floorPolyNormalZ = COLPOLY_GET_NORMAL(floorPoly->normal.z); - sp4C = Math_SinS(this->yaw); - sp44 = Math_CosS(this->yaw); + sin = Math_SinS(this->yaw); + cos = Math_CosS(this->yaw); - this->unk_898 = - Math_Atan2S(1.0f, (-(floorPolyNormalX * sp4C) - (floorPolyNormalZ * sp44)) * invFloorPolyNormalY); - this->unk_89A = - Math_Atan2S(1.0f, (-(floorPolyNormalX * sp44) - (floorPolyNormalZ * sp4C)) * invFloorPolyNormalY); + this->floorPitch = + Math_Atan2S(1.0f, (-(floorPolyNormalX * sin) - (floorPolyNormalZ * cos)) * invFloorPolyNormalY); + this->floorPitchAlt = + Math_Atan2S(1.0f, (-(floorPolyNormalX * cos) - (floorPolyNormalZ * sin)) * invFloorPolyNormalY); - sp4C = Math_SinS(this->actor.shape.rot.y); - sp44 = Math_CosS(this->actor.shape.rot.y); + sin = Math_SinS(this->actor.shape.rot.y); + cos = Math_CosS(this->actor.shape.rot.y); - D_80853610 = - Math_Atan2S(1.0f, (-(floorPolyNormalX * sp4C) - (floorPolyNormalZ * sp44)) * invFloorPolyNormalY); + sFloorShapePitch = + Math_Atan2S(1.0f, (-(floorPolyNormalX * sin) - (floorPolyNormalZ * cos)) * invFloorPolyNormalY); - func_8083E318(play, this, floorPoly); + Player_HandleSlopes(play, this, floorPoly); } } else { - func_80847A78(this); + Player_UpdateHoverBoots(this); } - if (this->unk_A7B == D_808535E4) { - this->unk_A79++; + if (this->prevFloorType == sFloorType) { + this->floorTypeTimer++; } else { - this->unk_A7B = D_808535E4; - this->unk_A79 = 0; + this->prevFloorType = sFloorType; + this->floorTypeTimer = 0; } } @@ -10586,7 +10643,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Actor_MoveXZGravity(&this->actor); } - func_80847BA0(play, this); + Player_ProcessSceneCollision(play, this); } else { f32 temp_f0; f32 phi_f12; @@ -10644,7 +10701,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { } if (!(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_7)) { - if (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (D_808535E4 == FLOOR_TYPE_5) && + if (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (sFloorType == FLOOR_TYPE_5) && (this->currentBoots != PLAYER_BOOTS_IRON)) || ((this->currentBoots == PLAYER_BOOTS_HOVER) && !(this->stateFlags1 & (PLAYER_STATE1_27 | PLAYER_STATE1_29)))) { @@ -10689,10 +10746,10 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { } Actor_UpdatePos(&this->actor); - func_80847BA0(play, this); + Player_ProcessSceneCollision(play, this); } else { - D_808535E4 = FLOOR_TYPE_0; - this->unk_A7A = FLOOR_PROPERTY_0; + sFloorType = FLOOR_TYPE_0; + this->floorProperty = FLOOR_PROPERTY_0; if (!(this->stateFlags1 & PLAYER_STATE1_0) && (this->stateFlags1 & PLAYER_STATE1_23)) { EnHorse* rideActor = (EnHorse*)this->rideActor; @@ -10707,7 +10764,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { sp58 = rideActor->actor.floorBgId; } - if ((sp5C != NULL) && func_80839034(play, this, sp5C, sp58)) { + if ((sp5C != NULL) && Player_HandleExitsAndVoids(play, this, sp5C, sp58)) { if (DREG(25) != 0) { DREG(25) = 0; } else { @@ -10716,25 +10773,25 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { } } - sConveyorSpeedIndex = CONVEYOR_SPEED_DISABLED; + sConveyorSpeed = CONVEYOR_SPEED_DISABLED; this->pushedSpeed = 0.0f; } // This block applies the bg conveyor to pushedSpeed - if ((sConveyorSpeedIndex != CONVEYOR_SPEED_DISABLED) && (this->currentBoots != PLAYER_BOOTS_IRON)) { + if ((sConveyorSpeed != CONVEYOR_SPEED_DISABLED) && (this->currentBoots != PLAYER_BOOTS_IRON)) { f32 conveyorSpeed; // converts 1-index to 0-index - sConveyorSpeedIndex--; + sConveyorSpeed--; if (!sIsFloorConveyor) { - conveyorSpeed = sWaterConveyorSpeeds[sConveyorSpeedIndex]; + conveyorSpeed = sWaterConveyorSpeeds[sConveyorSpeed]; if (!(this->stateFlags1 & PLAYER_STATE1_27)) { conveyorSpeed *= 0.25f; } } else { - conveyorSpeed = sFloorConveyorSpeeds[sConveyorSpeedIndex]; + conveyorSpeed = sFloorConveyorSpeeds[sConveyorSpeed]; } Math_StepToF(&this->pushedSpeed, conveyorSpeed, conveyorSpeed * 0.1f); @@ -10803,8 +10860,8 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->stateFlags1 &= ~(PLAYER_STATE1_SWINGING_BOTTLE | PLAYER_STATE1_9 | PLAYER_STATE1_12 | PLAYER_STATE1_22); this->stateFlags2 &= ~(PLAYER_STATE2_0 | PLAYER_STATE2_2 | PLAYER_STATE2_3 | PLAYER_STATE2_5 | PLAYER_STATE2_6 | - PLAYER_STATE2_8 | PLAYER_STATE2_9 | PLAYER_STATE2_12 | PLAYER_STATE2_14 | - PLAYER_STATE2_DO_ACTION_ENTER | PLAYER_STATE2_22 | PLAYER_STATE2_26); + PLAYER_STATE2_8 | PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND | PLAYER_STATE2_12 | + PLAYER_STATE2_14 | PLAYER_STATE2_DO_ACTION_ENTER | PLAYER_STATE2_22 | PLAYER_STATE2_26); this->stateFlags3 &= ~PLAYER_STATE3_4; func_80847298(this); @@ -10939,7 +10996,7 @@ void Player_Update(Actor* thisx, PlayState* play) { gSaveContext.dogParams = 0; } else { gSaveContext.dogParams &= 0x7FFF; - func_808395DC(this, &this->actor.world.pos, &D_80854838, &sDogSpawnPos); + Player_GetRelativePosition(this, &this->actor.world.pos, &D_80854838, &sDogSpawnPos); dogParams = gSaveContext.dogParams; dog = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_DOG, sDogSpawnPos.x, sDogSpawnPos.y, sDogSpawnPos.z, @@ -11688,7 +11745,7 @@ void func_8084BF1C(Player* this, PlayState* play) { } } - Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 6.0f, this->ageProperties->unk_00, + Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 6.0f, this->ageProperties->ceilingCheckHeight, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); func_8083F360(play, this, 26.0f, this->ageProperties->unk_3C, 50.0f, -20.0f); } @@ -11916,8 +11973,9 @@ s32 func_8084C89C(PlayState* play, Player* this, s32 arg2, f32* arg3) { *arg3 = func_8083973C(play, this, &D_808548FC[arg2], &sp40); - return (sp4C < *arg3) && (*arg3 < sp50) && !func_80839768(play, this, &D_80854914[arg2], &sp30, &sp2C, &sp34) && - !func_80839768(play, this, &D_8085492C[arg2], &sp30, &sp2C, &sp34); + return (sp4C < *arg3) && (*arg3 < sp50) && + !Player_PosVsWallLineTest(play, this, &D_80854914[arg2], &sp30, &sp2C, &sp34) && + !Player_PosVsWallLineTest(play, this, &D_8085492C[arg2], &sp30, &sp2C, &sp34); } s32 func_8084C9BC(Player* this, PlayState* play) { @@ -13098,7 +13156,7 @@ void func_8084F710(Player* this, PlayState* play) { if ((this->unk_84F != 0) && (play->csCtx.curFrame < 305)) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; - } else if (D_80853600 < 150.0f) { + } else if (sYDistToFloor < 150.0f) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_850 == 0) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { @@ -13632,7 +13690,7 @@ void func_80850AEC(Player* this, PlayState* play) { if (func_80834FBC(this)) { Math_Vec3f_Copy(&this->actor.prevPos, &this->actor.world.pos); - func_80847BA0(play, this); + Player_ProcessSceneCollision(play, this); temp = this->actor.world.pos.y - this->actor.floorHeight; if (temp > 20.0f) { From 7235af2249843fb68740111b70089bad827a4730 Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Sat, 9 Sep 2023 15:24:52 +0100 Subject: [PATCH 05/29] Apply noreturn attribute where applicable (#1532) --- include/attributes.h | 12 ++++++++++++ include/fault.h | 4 ++-- include/functions.h | 6 +++--- include/macros.h | 7 ------- include/z64.h | 1 + src/boot/assert.c | 2 +- src/boot/is_debug.c | 2 +- src/boot/z_std_dma.c | 2 +- src/code/code_800D31A0.c | 2 +- src/code/fault.c | 10 ++++++++-- 10 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 include/attributes.h diff --git a/include/attributes.h b/include/attributes.h new file mode 100644 index 000000000..13fbe70f4 --- /dev/null +++ b/include/attributes.h @@ -0,0 +1,12 @@ +#ifndef ATTRIBUTES_H +#define ATTRIBUTES_H + +#ifndef __GNUC__ +#define __attribute__(x) +#endif + +#define UNUSED __attribute__((unused)) +#define FALLTHROUGH __attribute__((fallthrough)) +#define NORETURN __attribute__((noreturn)) + +#endif diff --git a/include/fault.h b/include/fault.h index 511d3516f..c5837f99a 100644 --- a/include/fault.h +++ b/include/fault.h @@ -42,8 +42,8 @@ void Fault_Init(void); // Fatal Errors -void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2); -void Fault_AddHungupAndCrash(const char* file, s32 line); +NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2); +NORETURN void Fault_AddHungupAndCrash(const char* file, s32 line); // Client Registration diff --git a/include/functions.h b/include/functions.h index 8f83176af..8430208a2 100644 --- a/include/functions.h +++ b/include/functions.h @@ -30,13 +30,13 @@ void Locale_ResetRegion(void); u32 func_80001F48(void); u32 func_80001F8C(void); u32 Locale_IsRegionNative(void); -void __assert(const char* exp, const char* file, s32 line); +NORETURN void __assert(const char* exp, const char* file, s32 line); void isPrintfInit(void); void osSyncPrintfUnused(const char* fmt, ...); void osSyncPrintf(const char* fmt, ...); void rmonPrintf(const char* fmt, ...); void* is_proutSyncPrintf(void* arg, const char* str, u32 count); -void func_80002384(const char* exp, const char* file, u32 line); +NORETURN void func_80002384(const char* exp, const char* file, u32 line); OSPiHandle* osDriveRomInit(void); void Mio0_Decompress(Yaz0Header* hdr, u8* dst); void StackCheck_Init(StackEntry* entry, void* stackBottom, void* stackTop, u32 initValue, s32 minSpace, @@ -1476,7 +1476,7 @@ u64* SysUcode_GetUCodeBoot(void); size_t SysUcode_GetUCodeBootSize(void); u64* SysUcode_GetUCode(void); u64* SysUcode_GetUCodeData(void); -void func_800D31A0(void); +NORETURN void func_800D31A0(void); void func_800D31F0(void); void func_800D3210(void); void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); diff --git a/include/macros.h b/include/macros.h index 89a5d2949..f25069118 100644 --- a/include/macros.h +++ b/include/macros.h @@ -1,19 +1,12 @@ #ifndef MACROS_H #define MACROS_H -#ifndef __GNUC__ -#define __attribute__(x) -#endif - #ifndef AVOID_UB #define BAD_RETURN(type) type #else #define BAD_RETURN(type) void #endif -#define UNUSED __attribute__((unused)) -#define FALLTHROUGH __attribute__((fallthrough)) - #define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0])) #define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0])) diff --git a/include/z64.h b/include/z64.h index 6aed863d7..d0032b6ea 100644 --- a/include/z64.h +++ b/include/z64.h @@ -3,6 +3,7 @@ #include "ultra64.h" #include "ultra64/gs2dex.h" +#include "attributes.h" #include "z64save.h" #include "z64light.h" #include "z64bgcheck.h" diff --git a/src/boot/assert.c b/src/boot/assert.c index b7895dddd..438432d42 100644 --- a/src/boot/assert.c +++ b/src/boot/assert.c @@ -1,6 +1,6 @@ #include "global.h" -void __assert(const char* exp, const char* file, s32 line) { +NORETURN void __assert(const char* exp, const char* file, s32 line) { char msg[256]; osSyncPrintf("Assertion failed: %s, file %s, line %d, thread %d\n", exp, file, line, osGetThreadId(NULL)); diff --git a/src/boot/is_debug.c b/src/boot/is_debug.c index c064c43a3..5e501f3af 100644 --- a/src/boot/is_debug.c +++ b/src/boot/is_debug.c @@ -86,7 +86,7 @@ void* is_proutSyncPrintf(void* arg, const char* str, u32 count) { return (void*)1; } -void func_80002384(const char* exp, const char* file, u32 line) { +NORETURN void func_80002384(const char* exp, const char* file, u32 line) { osSyncPrintf("File:%s Line:%d %s \n", file, line, exp); while (true) { ; diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 3b6320b85..e68b03806 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -231,7 +231,7 @@ void DmaMgr_DmaFromDriveRom(void* ram, uintptr_t rom, size_t size) { * * This function does not return. */ -void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, const char* errorDesc) { +NORETURN void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, const char* errorDesc) { uintptr_t vrom = req->vromAddr; void* ram = req->dramAddr; size_t size = req->size; diff --git a/src/code/code_800D31A0.c b/src/code/code_800D31A0.c index 6bfa18d97..a6540c429 100644 --- a/src/code/code_800D31A0.c +++ b/src/code/code_800D31A0.c @@ -3,7 +3,7 @@ u32 gIsCtrlr2Valid = false; -void func_800D31A0(void) { +NORETURN void func_800D31A0(void) { osSyncPrintf(VT_FGCOL(RED) "\n**** Freeze!! ****\n" VT_RST); while (true) { Sleep_Msec(1000); diff --git a/src/code/fault.c b/src/code/fault.c index 97aeaa75d..593613f50 100644 --- a/src/code/fault.c +++ b/src/code/fault.c @@ -1304,19 +1304,25 @@ void Fault_HungupFaultClient(const char* exp1, const char* exp2) { * error occurs. The parameters specify two messages detailing the error, one * or both may be NULL. */ -void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) { +NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) { FaultClient client; s32 pad; Fault_AddClient(&client, Fault_HungupFaultClient, (void*)exp1, (void*)exp2); *(u32*)0x11111111 = 0; // trigger an exception via unaligned memory access + + // Since the above line triggers an exception and transfers execution to the fault handler + // this function does not return and the rest of the function is unreachable. +#ifdef __GNUC__ + __builtin_unreachable(); +#endif } /** * Like `Fault_AddHungupAndCrashImpl`, however provides a fixed message containing * filename and line number */ -void Fault_AddHungupAndCrash(const char* file, s32 line) { +NORETURN void Fault_AddHungupAndCrash(const char* file, s32 line) { char msg[256]; sprintf(msg, "HungUp %s:%d", file, line); From 7145bc346d7538a4f9acf200894c906b41104690 Mon Sep 17 00:00:00 2001 From: fig02 Date: Wed, 13 Sep 2023 20:21:54 -0400 Subject: [PATCH 06/29] Document Camera Special9 (door) angle bug (#1525) * document special9 angle bug * Update src/code/z_camera.c Co-authored-by: Dragorn421 --------- Co-authored-by: Dragorn421 --- src/code/z_camera.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/code/z_camera.c b/src/code/z_camera.c index a57155cf3..9858cfdfa 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -6876,7 +6876,7 @@ s32 Camera_Special9(Camera* camera) { f32 playerYOffset; s32 pad3; PosRot* playerPosRot = &camera->playerPosRot; - PosRot adjustedPlayerPosRot; + PosRot referencePosRot; f32 yNormal; DoorParams* doorParams = &camera->paramData.doorParams; Special9ReadOnlyData* roData = &camera->paramData.spec9.roData; @@ -6902,11 +6902,11 @@ s32 Camera_Special9(Camera* camera) { } if (doorParams->doorActor != NULL) { - Actor_GetWorldPosShapeRot(&adjustedPlayerPosRot, doorParams->doorActor); + Actor_GetWorldPosShapeRot(&referencePosRot, doorParams->doorActor); } else { - adjustedPlayerPosRot = *playerPosRot; - adjustedPlayerPosRot.pos.y += playerYOffset + roData->yOffset; - adjustedPlayerPosRot.rot.x = 0; + referencePosRot = *playerPosRot; + referencePosRot.pos.y += playerYOffset + roData->yOffset; + referencePosRot.rot.x = 0; } OLib_Vec3fDiffToVecGeo(&atEyeOffsetGeo, at, eye); @@ -6919,9 +6919,15 @@ s32 Camera_Special9(Camera* camera) { case 0: camera->stateFlags &= ~(CAM_STATE_1 | CAM_STATE_2); camera->animState++; - rwData->targetYaw = ABS(playerPosRot->rot.y - adjustedPlayerPosRot.rot.y) >= 0x4000 - ? adjustedPlayerPosRot.rot.y - 0x7FFF - : adjustedPlayerPosRot.rot.y; + + //! @bug The angle passed to ABS should be cast to s16. + //! The lack of a cast means that a door which has an angle of around 0x8000 will calculate an incorrect + //! angle and use an incorrect `targetYaw`. + //! In-game, this means if the player opens a susceptible door at a slanted angle, the camera will not + //! appear correctly on the other side after the player has walked through the door. + rwData->targetYaw = ABS(playerPosRot->rot.y - referencePosRot.rot.y) >= 0x4000 + ? referencePosRot.rot.y - 0x7FFF + : referencePosRot.rot.y; FALLTHROUGH; case 1: doorParams->timer1--; From 823e47a0f8e9fb9fab89bc61b57f45488ff6debe Mon Sep 17 00:00:00 2001 From: fig02 Date: Wed, 13 Sep 2023 20:34:07 -0400 Subject: [PATCH 07/29] Player Docs: Name actionFunc (#1531) * progress, going to merge master * merge master * finish renmaing functions * reorder declarations --- include/z64player.h | 4 +- .../actors/ovl_player_actor/z_player.c | 655 +++++++++--------- 2 files changed, 330 insertions(+), 329 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index 7b8445bea..811281a51 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -586,7 +586,7 @@ typedef struct { #define PLAYER_STATE3_RESTORE_NAYRUS_LOVE (1 << 6) // Set by ocarina effects actors when destroyed to signal Nayru's Love may be restored (see `ACTOROVL_ALLOC_ABSOLUTE`) #define PLAYER_STATE3_7 (1 << 7) -typedef void (*PlayerFunc674)(struct Player*, struct PlayState*); +typedef void (*PlayerActionFunc)(struct Player*, struct PlayState*); typedef s32 (*PlayerFunc82C)(struct Player*, struct PlayState*); typedef void (*PlayerFuncA74)(struct PlayState*, struct Player*); @@ -659,7 +659,7 @@ typedef struct Player { /* 0x0668 */ char unk_668[0x004]; /* 0x066C */ s32 unk_66C; /* 0x0670 */ s32 meleeWeaponEffectIndex; - /* 0x0674 */ PlayerFunc674 func_674; + /* 0x0674 */ PlayerActionFunc actionFunc; /* 0x0678 */ PlayerAgeProperties* ageProperties; /* 0x067C */ u32 stateFlags1; /* 0x0680 */ u32 stateFlags2; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index a56a1e42f..f4e391beb 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -161,45 +161,6 @@ s32 func_8083E0FC(Player* this, PlayState* play); s32 func_8083E5A8(Player* this, PlayState* play); s32 func_8083EB44(Player* this, PlayState* play); s32 func_8083F7BC(Player* this, PlayState* play); -void func_80840450(Player* this, PlayState* play); -void func_808407CC(Player* this, PlayState* play); -void func_80840BC8(Player* this, PlayState* play); -void func_80840DE4(Player* this, PlayState* play); -void func_808414F8(Player* this, PlayState* play); -void func_8084170C(Player* this, PlayState* play); -void func_808417FC(Player* this, PlayState* play); -void func_8084193C(Player* this, PlayState* play); -void func_80841BA8(Player* this, PlayState* play); -void func_80842180(Player* this, PlayState* play); -void func_8084227C(Player* this, PlayState* play); -void func_8084279C(Player* this, PlayState* play); -void func_808423EC(Player* this, PlayState* play); -void func_8084251C(Player* this, PlayState* play); -void func_80843188(Player* this, PlayState* play); -void func_808435C4(Player* this, PlayState* play); -void func_8084370C(Player* this, PlayState* play); -void func_8084377C(Player* this, PlayState* play); -void func_80843954(Player* this, PlayState* play); -void func_80843A38(Player* this, PlayState* play); -void func_80843CEC(Player* this, PlayState* play); -void func_8084411C(Player* this, PlayState* play); -void func_80844708(Player* this, PlayState* play); -void func_80844A44(Player* this, PlayState* play); -void func_80844AF4(Player* this, PlayState* play); -void func_80844E68(Player* this, PlayState* play); -void func_80845000(Player* this, PlayState* play); -void func_80845308(Player* this, PlayState* play); -void func_80845668(Player* this, PlayState* play); -void func_808458D0(Player* this, PlayState* play); -void func_80845CA4(Player* this, PlayState* play); -void func_80845EF8(Player* this, PlayState* play); -void func_80846050(Player* this, PlayState* play); -void func_80846120(Player* this, PlayState* play); -void func_80846260(Player* this, PlayState* play); -void func_80846358(Player* this, PlayState* play); -void func_80846408(Player* this, PlayState* play); -void func_808464B0(Player* this, PlayState* play); -void func_80846578(Player* this, PlayState* play); void func_80846648(PlayState* play, Player* this); void func_80846660(PlayState* play, Player* this); void func_808467D4(PlayState* play, Player* this); @@ -208,59 +169,11 @@ void func_808468E8(PlayState* play, Player* this); void func_80846978(PlayState* play, Player* this); void func_808469BC(PlayState* play, Player* this); void func_80846A68(PlayState* play, Player* this); -void func_8084B1D8(Player* this, PlayState* play); -void func_8084B530(Player* this, PlayState* play); -void func_8084B78C(Player* this, PlayState* play); -void func_8084B898(Player* this, PlayState* play); -void func_8084B9E4(Player* this, PlayState* play); -void func_8084BBE4(Player* this, PlayState* play); -void func_8084BDFC(Player* this, PlayState* play); -void func_8084BF1C(Player* this, PlayState* play); void Player_UpdateCommon(Player* this, PlayState* play, Input* input); -void func_8084C5F8(Player* this, PlayState* play); -void func_8084C760(Player* this, PlayState* play); -void func_8084C81C(Player* this, PlayState* play); -void func_8084CC98(Player* this, PlayState* play); -void func_8084D3E4(Player* this, PlayState* play); -void func_8084D610(Player* this, PlayState* play); -void func_8084D7C4(Player* this, PlayState* play); -void func_8084D84C(Player* this, PlayState* play); -void func_8084DAB4(Player* this, PlayState* play); -void func_8084DC48(Player* this, PlayState* play); -void func_8084E1EC(Player* this, PlayState* play); -void func_8084E30C(Player* this, PlayState* play); -void func_8084E368(Player* this, PlayState* play); -void func_8084E3C4(Player* this, PlayState* play); -void func_8084E604(Player* this, PlayState* play); -void func_8084E6D4(Player* this, PlayState* play); -void func_8084E9AC(Player* this, PlayState* play); -void func_8084EAC0(Player* this, PlayState* play); -void func_8084ECA4(Player* this, PlayState* play); -void func_8084EED8(Player* this, PlayState* play); -void func_8084EFC0(Player* this, PlayState* play); -void func_8084F104(Player* this, PlayState* play); -void func_8084F390(Player* this, PlayState* play); -void func_8084F608(Player* this, PlayState* play); -void func_8084F698(Player* this, PlayState* play); -void func_8084F710(Player* this, PlayState* play); -void func_8084F88C(Player* this, PlayState* play); -void func_8084F9A0(Player* this, PlayState* play); -void func_8084F9C0(Player* this, PlayState* play); -void func_8084FA54(Player* this, PlayState* play); -void func_8084FB10(Player* this, PlayState* play); -void func_8084FBF4(Player* this, PlayState* play); s32 func_8084FCAC(Player* this, PlayState* play); void func_8084FF7C(Player* this); void Player_UpdateBunnyEars(Player* this); s32 func_80850224(Player* this, PlayState* play); -void func_808502D0(Player* this, PlayState* play); -void func_808505DC(Player* this, PlayState* play); -void func_8085063C(Player* this, PlayState* play); -void func_8085076C(Player* this, PlayState* play); -void func_808507F4(Player* this, PlayState* play); -void func_80850AEC(Player* this, PlayState* play); -void func_80850C68(Player* this, PlayState* play); -void func_80850E84(Player* this, PlayState* play); void func_80851008(PlayState* play, Player* this, void* anim); void func_80851030(PlayState* play, Player* this, void* anim); void func_80851050(PlayState* play, Player* this, void* anim); @@ -335,7 +248,6 @@ void func_808528C8(PlayState* play, Player* this, CsCmdActorCue* cue); void func_80852944(PlayState* play, Player* this, CsCmdActorCue* cue); void func_808529D0(PlayState* play, Player* this, CsCmdActorCue* cue); void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cue); -void func_80852E14(Player* this, PlayState* play); s32 Player_IsDroppingFish(PlayState* play); s32 Player_StartFishing(PlayState* play); s32 func_80852F38(PlayState* play, Player* this); @@ -344,6 +256,95 @@ void func_80853080(Player* this, PlayState* play); s32 Player_InflictDamage(PlayState* play, s32 damage); void func_80853148(PlayState* play, Actor* actor); +void Player_Action_80840450(Player* this, PlayState* play); +void Player_Action_808407CC(Player* this, PlayState* play); +void Player_Action_80840BC8(Player* this, PlayState* play); +void Player_Action_80840DE4(Player* this, PlayState* play); +void Player_Action_808414F8(Player* this, PlayState* play); +void Player_Action_8084170C(Player* this, PlayState* play); +void Player_Action_808417FC(Player* this, PlayState* play); +void Player_Action_8084193C(Player* this, PlayState* play); +void Player_Action_80841BA8(Player* this, PlayState* play); +void Player_Action_80842180(Player* this, PlayState* play); +void Player_Action_8084227C(Player* this, PlayState* play); +void Player_Action_8084279C(Player* this, PlayState* play); +void Player_Action_808423EC(Player* this, PlayState* play); +void Player_Action_8084251C(Player* this, PlayState* play); +void Player_Action_80843188(Player* this, PlayState* play); +void Player_Action_808435C4(Player* this, PlayState* play); +void Player_Action_8084370C(Player* this, PlayState* play); +void Player_Action_8084377C(Player* this, PlayState* play); +void Player_Action_80843954(Player* this, PlayState* play); +void Player_Action_80843A38(Player* this, PlayState* play); +void Player_Action_80843CEC(Player* this, PlayState* play); +void Player_Action_8084411C(Player* this, PlayState* play); +void Player_Action_80844708(Player* this, PlayState* play); +void Player_Action_80844A44(Player* this, PlayState* play); +void Player_Action_80844AF4(Player* this, PlayState* play); +void Player_Action_80844E68(Player* this, PlayState* play); +void Player_Action_80845000(Player* this, PlayState* play); +void Player_Action_80845308(Player* this, PlayState* play); +void Player_Action_80845668(Player* this, PlayState* play); +void Player_Action_808458D0(Player* this, PlayState* play); +void Player_Action_80845CA4(Player* this, PlayState* play); +void Player_Action_80845EF8(Player* this, PlayState* play); +void Player_Action_80846050(Player* this, PlayState* play); +void Player_Action_80846120(Player* this, PlayState* play); +void Player_Action_80846260(Player* this, PlayState* play); +void Player_Action_80846358(Player* this, PlayState* play); +void Player_Action_80846408(Player* this, PlayState* play); +void Player_Action_808464B0(Player* this, PlayState* play); +void Player_Action_80846578(Player* this, PlayState* play); +void Player_Action_8084B1D8(Player* this, PlayState* play); +void Player_Action_8084B530(Player* this, PlayState* play); +void Player_Action_8084B78C(Player* this, PlayState* play); +void Player_Action_8084B898(Player* this, PlayState* play); +void Player_Action_8084B9E4(Player* this, PlayState* play); +void Player_Action_8084BBE4(Player* this, PlayState* play); +void Player_Action_8084BDFC(Player* this, PlayState* play); +void Player_Action_8084BF1C(Player* this, PlayState* play); +void Player_Action_8084C5F8(Player* this, PlayState* play); +void Player_Action_8084C760(Player* this, PlayState* play); +void Player_Action_8084C81C(Player* this, PlayState* play); +void Player_Action_8084CC98(Player* this, PlayState* play); +void Player_Action_8084D3E4(Player* this, PlayState* play); +void Player_Action_8084D610(Player* this, PlayState* play); +void Player_Action_8084D7C4(Player* this, PlayState* play); +void Player_Action_8084D84C(Player* this, PlayState* play); +void Player_Action_8084DAB4(Player* this, PlayState* play); +void Player_Action_8084DC48(Player* this, PlayState* play); +void Player_Action_8084E1EC(Player* this, PlayState* play); +void Player_Action_8084E30C(Player* this, PlayState* play); +void Player_Action_8084E368(Player* this, PlayState* play); +void Player_Action_8084E3C4(Player* this, PlayState* play); +void Player_Action_8084E604(Player* this, PlayState* play); +void Player_Action_8084E6D4(Player* this, PlayState* play); +void Player_Action_8084E9AC(Player* this, PlayState* play); +void Player_Action_8084EAC0(Player* this, PlayState* play); +void Player_Action_8084ECA4(Player* this, PlayState* play); +void Player_Action_8084EED8(Player* this, PlayState* play); +void Player_Action_8084EFC0(Player* this, PlayState* play); +void Player_Action_8084F104(Player* this, PlayState* play); +void Player_Action_8084F390(Player* this, PlayState* play); +void Player_Action_8084F608(Player* this, PlayState* play); +void Player_Action_8084F698(Player* this, PlayState* play); +void Player_Action_8084F710(Player* this, PlayState* play); +void Player_Action_8084F88C(Player* this, PlayState* play); +void Player_Action_8084F9A0(Player* this, PlayState* play); +void Player_Action_8084F9C0(Player* this, PlayState* play); +void Player_Action_8084FA54(Player* this, PlayState* play); +void Player_Action_8084FB10(Player* this, PlayState* play); +void Player_Action_8084FBF4(Player* this, PlayState* play); +void Player_Action_808502D0(Player* this, PlayState* play); +void Player_Action_808505DC(Player* this, PlayState* play); +void Player_Action_8085063C(Player* this, PlayState* play); +void Player_Action_8085076C(Player* this, PlayState* play); +void Player_Action_808507F4(Player* this, PlayState* play); +void Player_Action_80850AEC(Player* this, PlayState* play); +void Player_Action_80850C68(Player* this, PlayState* play); +void Player_Action_80850E84(Player* this, PlayState* play); +void Player_Action_80852E14(Player* this, PlayState* play); + // .bss part 1 static s32 D_80858AA0; static s32 D_80858AA4; @@ -3053,19 +3054,19 @@ s32 func_80835C08(Player* this, PlayState* play) { return 1; } -s32 func_80835C58(PlayState* play, Player* this, PlayerFunc674 func, s32 flags) { - if (func == this->func_674) { +s32 Player_SetupAction(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) { + if (actionFunc == this->actionFunc) { return 0; } - if (func_8084E3C4 == this->func_674) { + if (Player_Action_8084E3C4 == this->actionFunc) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); this->stateFlags2 &= ~(PLAYER_STATE2_24 | PLAYER_STATE2_25); - } else if (func_808507F4 == this->func_674) { + } else if (Player_Action_808507F4 == this->actionFunc) { func_80832340(play, this); } - this->func_674 = func; + this->actionFunc = actionFunc; if ((this->itemAction != this->heldItemAction) && (!(flags & 1) || !(this->stateFlags1 & PLAYER_STATE1_22))) { func_8008EC70(this); @@ -3089,22 +3090,22 @@ s32 func_80835C58(PlayState* play, Player* this, PlayerFunc674 func, s32 flags) return 1; } -void func_80835DAC(PlayState* play, Player* this, PlayerFunc674 func, s32 flags) { +void func_80835DAC(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) { s32 temp; temp = this->skelAnime.moveFlags; this->skelAnime.moveFlags = 0; - func_80835C58(play, this, func, flags); + Player_SetupAction(play, this, actionFunc, flags); this->skelAnime.moveFlags = temp; } -void func_80835DE4(PlayState* play, Player* this, PlayerFunc674 func, s32 flags) { +void func_80835DE4(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) { s32 temp; if (this->itemAction >= 0) { temp = this->itemAction; this->itemAction = this->heldItemAction; - func_80835C58(play, this, func, flags); + Player_SetupAction(play, this, actionFunc, flags); this->itemAction = temp; Player_SetModels(this, Player_ActionToModelGroup(this, this->itemAction)); } @@ -3231,7 +3232,7 @@ void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) { func_80832564(play, this); - func_80835C58(play, this, cond ? func_8084E368 : func_80843CEC, 0); + Player_SetupAction(play, this, cond ? Player_Action_8084E368 : Player_Action_80843CEC, 0); this->stateFlags1 |= PLAYER_STATE1_7; @@ -3263,7 +3264,7 @@ void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) { } s32 func_808365C8(Player* this) { - return (!(func_808458D0 == this->func_674) || + return (!(Player_Action_808458D0 == this->actionFunc) || ((this->stateFlags1 & PLAYER_STATE1_8) && ((this->heldItemId == ITEM_LAST_USED) || (this->heldItemId == ITEM_NONE)))) && (!(func_80834A2C == this->func_82C) || (Player_ItemToItemAction(this->heldItemId) == this->heldItemAction)); @@ -3271,7 +3272,7 @@ s32 func_808365C8(Player* this) { s32 func_80836670(Player* this, PlayState* play) { if (!(this->stateFlags1 & PLAYER_STATE1_23) && (this->actor.parent != NULL) && Player_HoldsHookshot(this)) { - func_80835C58(play, this, func_80850AEC, 1); + Player_SetupAction(play, this, Player_Action_80850AEC, 1); this->stateFlags3 |= PLAYER_STATE3_7; Player_AnimPlayOnce(play, this, &gPlayerAnim_link_hook_fly_start); Player_AnimReplaceApplyFlags(play, this, @@ -3288,7 +3289,7 @@ s32 func_80836670(Player* this, PlayState* play) { if (func_808365C8(this)) { func_80834298(this, play); - if (func_8084E604 == this->func_674) { + if (Player_Action_8084E604 == this->actionFunc) { return 1; } } @@ -3318,7 +3319,7 @@ s32 func_80836670(Player* this, PlayState* play) { s32 func_80836898(PlayState* play, Player* this, PlayerFuncA74 func) { this->func_A74 = func; - func_80835C58(play, this, func_808458D0, 0); + Player_SetupAction(play, this, Player_Action_808458D0, 0); this->stateFlags2 |= PLAYER_STATE2_6; return func_80832528(play, this); } @@ -3585,7 +3586,7 @@ s32 func_80837348(PlayState* play, Player* this, s8* arg2, s32 arg3) { if (!(this->stateFlags1 & (PLAYER_STATE1_0 | PLAYER_STATE1_7 | PLAYER_STATE1_29))) { if (arg3 != 0) { D_808535E0 = func_80836670(this, play); - if (func_8084E604 == this->func_674) { + if (Player_Action_8084E604 == this->actionFunc) { return 1; } } @@ -3698,7 +3699,7 @@ void func_80837704(PlayState* play, Player* this) { } void func_808377DC(PlayState* play, Player* this) { - func_80835C58(play, this, func_80844E68, 1); + Player_SetupAction(play, this, Player_Action_80844E68, 1); func_80837704(play, this); } @@ -3776,7 +3777,7 @@ void func_80837948(PlayState* play, Player* this, s32 arg2) { u32 dmgFlags; s32 temp; - func_80835C58(play, this, func_808502D0, 0); + Player_SetupAction(play, this, Player_Action_808502D0, 0); this->unk_844 = 8; if (!((arg2 >= PLAYER_MWA_FLIPSLASH_FINISH) && (arg2 <= PLAYER_MWA_JUMPSLASH_FINISH))) { func_80832318(this); @@ -3844,7 +3845,7 @@ void func_80837B60(Player* this) { } void func_80837B9C(Player* this, PlayState* play) { - func_80835C58(play, this, func_8084411C, 0); + Player_SetupAction(play, this, Player_Action_8084411C, 0); Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_landing_wait); this->unk_850 = 1; if (this->unk_6AD != 3) { @@ -3881,7 +3882,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, func_80837AE0(this, arg6); if (arg2 == 3) { - func_80835C58(play, this, func_8084FB10, 0); + Player_SetupAction(play, this, Player_Action_8084FB10, 0); anim = &gPlayerAnim_link_normal_ice_down; @@ -3891,7 +3892,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, Player_PlaySfx(this, NA_SE_PL_FREEZE_S); func_80832698(this, NA_SE_VO_LI_FREEZE); } else if (arg2 == 4) { - func_80835C58(play, this, func_8084FBF4, 0); + Player_SetupAction(play, this, Player_Action_8084FBF4, 0); Player_RequestRumble(this, 255, 80, 150, 0); @@ -3902,7 +3903,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, } else { arg5 -= this->actor.shape.rot.y; if (this->stateFlags1 & PLAYER_STATE1_27) { - func_80835C58(play, this, func_8084E30C, 0); + Player_SetupAction(play, this, Player_Action_8084E30C, 0); Player_RequestRumble(this, 180, 20, 50, 0); this->speedXZ = 4.0f; @@ -3913,7 +3914,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } else if ((arg2 == 1) || (arg2 == 2) || !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21))) { - func_80835C58(play, this, func_8084377C, 0); + Player_SetupAction(play, this, Player_Action_8084377C, 0); this->stateFlags3 |= PLAYER_STATE3_1; @@ -3959,7 +3960,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, sp28 = D_808544B0; - func_80835C58(play, this, func_8084370C, 0); + Player_SetupAction(play, this, Player_Action_8084370C, 0); func_80833C3C(this); if (this->actor.colChkInfo.damage < 5) { @@ -4118,10 +4119,10 @@ s32 func_808382DC(Player* this, PlayState* play) { if (!Player_IsChildWithHylianShield(this)) { if (this->invincibilityTimer >= 0) { LinkAnimationHeader* anim; - s32 sp54 = func_80843188 == this->func_674; + s32 sp54 = Player_Action_80843188 == this->actionFunc; if (!func_808332B8(this)) { - func_80835C58(play, this, func_808435C4, 0); + Player_SetupAction(play, this, Player_Action_808435C4, 0); } if (!(this->unk_84F = sp54)) { @@ -4205,7 +4206,7 @@ s32 func_808382DC(Player* this, PlayState* play) { } void func_80838940(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* play, u16 sfxId) { - func_80835C58(play, this, func_8084411C, 1); + Player_SetupAction(play, this, Player_Action_8084411C, 1); if (anim != NULL) { Player_AnimPlayOnceAdjusted(play, this, anim); @@ -4264,7 +4265,7 @@ s32 func_80838A14(Player* this, PlayState* play) { } if (sp3C != 0) { - func_80835C58(play, this, func_80845668, 0); + Player_SetupAction(play, this, Player_Action_80845668, 0); this->stateFlags1 |= PLAYER_STATE1_18; @@ -4323,7 +4324,7 @@ s32 func_80838A14(Player* this, PlayState* play) { } void func_80838E70(PlayState* play, Player* this, f32 arg2, s16 arg3) { - func_80835C58(play, this, func_80845CA4, 0); + Player_SetupAction(play, this, Player_Action_80845CA4, 0); func_80832440(play, this); this->unk_84F = 1; @@ -4336,12 +4337,12 @@ void func_80838E70(PlayState* play, Player* this, f32 arg2, s16 arg3) { } void func_80838F18(PlayState* play, Player* this) { - func_80835C58(play, this, func_8084D610, 0); + Player_SetupAction(play, this, Player_Action_8084D610, 0); Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim_wait); } void func_80838F5C(PlayState* play, Player* this) { - func_80835C58(play, this, func_8084F88C, 0); + Player_SetupAction(play, this, Player_Action_8084F88C, 0); this->stateFlags1 |= PLAYER_STATE1_29 | PLAYER_STATE1_31; @@ -4618,7 +4619,7 @@ s32 func_80839800(Player* this, PlayState* play) { if ((this->doorType != PLAYER_DOORTYPE_NONE) && (!(this->stateFlags1 & PLAYER_STATE1_11) || ((this->heldActor != NULL) && (this->heldActor->id == ACTOR_EN_RU1)))) { - if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) || (func_8084F9A0 == this->func_674)) { + if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) || (Player_Action_8084F9A0 == this->actionFunc)) { doorActor = this->doorActor; if (this->doorType <= PLAYER_DOORTYPE_AJAR) { @@ -4692,7 +4693,7 @@ s32 func_80839800(Player* this, PlayState* play) { sp5C = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_doorB, this->modelAnimType); } - func_80835C58(play, this, func_80845EF8, 0); + Player_SetupAction(play, this, Player_Action_80845EF8, 0); func_80832528(play, this); if (doorDirection < 0) { @@ -4780,7 +4781,7 @@ s32 func_80839800(Player* this, PlayState* play) { void func_80839E88(Player* this, PlayState* play) { LinkAnimationHeader* anim; - func_80835C58(play, this, func_80840450, 1); + Player_SetupAction(play, this, Player_Action_80840450, 1); if (this->unk_870 < 0.5f) { anim = func_808334E4(this); @@ -4796,7 +4797,7 @@ void func_80839E88(Player* this, PlayState* play) { } void func_80839F30(Player* this, PlayState* play) { - func_80835C58(play, this, func_808407CC, 1); + Player_SetupAction(play, this, Player_Action_808407CC, 1); Player_AnimChangeOnceMorph(play, this, func_80833338(this)); this->yaw = this->actor.shape.rot.y; } @@ -4812,17 +4813,17 @@ void func_80839F90(Player* this, PlayState* play) { } void func_80839FFC(Player* this, PlayState* play) { - PlayerFunc674 func; + PlayerActionFunc actionFunc; if (func_8008E9C4(this)) { - func = func_80840450; + actionFunc = Player_Action_80840450; } else if (func_80833B2C(this)) { - func = func_808407CC; + actionFunc = Player_Action_808407CC; } else { - func = func_80840BC8; + actionFunc = Player_Action_80840BC8; } - func_80835C58(play, this, func, 1); + Player_SetupAction(play, this, actionFunc, 1); } void func_8083A060(Player* this, PlayState* play) { @@ -4848,21 +4849,21 @@ void func_8083A0F4(PlayState* play, Player* this) { if (interactActorId == ACTOR_BG_TOKI_SWD) { this->interactRangeActor->parent = &this->actor; - func_80835C58(play, this, func_8084F608, 0); + Player_SetupAction(play, this, Player_Action_8084F608, 0); this->stateFlags1 |= PLAYER_STATE1_29; } else { LinkAnimationHeader* anim; if (interactActorId == ACTOR_BG_HEAVY_BLOCK) { - func_80835C58(play, this, func_80846120, 0); + Player_SetupAction(play, this, Player_Action_80846120, 0); this->stateFlags1 |= PLAYER_STATE1_29; anim = &gPlayerAnim_link_normal_heavy_carry; } else if ((interactActorId == ACTOR_EN_ISHI) && ((interactRangeActor->params & 0xF) == 1)) { - func_80835C58(play, this, func_80846260, 0); + Player_SetupAction(play, this, Player_Action_80846260, 0); anim = &gPlayerAnim_link_silver_carry; } else if (((interactActorId == ACTOR_EN_BOMBF) || (interactActorId == ACTOR_EN_KUSA)) && (Player_GetStrength() <= PLAYER_STR_NONE)) { - func_80835C58(play, this, func_80846408, 0); + Player_SetupAction(play, this, Player_Action_80846408, 0); this->actor.world.pos.x = (Math_SinS(interactRangeActor->yawTowardsPlayer) * 20.0f) + interactRangeActor->world.pos.x; this->actor.world.pos.z = @@ -4870,7 +4871,7 @@ void func_8083A0F4(PlayState* play, Player* this) { this->yaw = this->actor.shape.rot.y = interactRangeActor->yawTowardsPlayer + 0x8000; anim = &gPlayerAnim_link_normal_nocarry_free; } else { - func_80835C58(play, this, func_80846050, 0); + Player_SetupAction(play, this, Player_Action_80846050, 0); anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_carryB, this->modelAnimType); } @@ -4883,7 +4884,7 @@ void func_8083A0F4(PlayState* play, Player* this) { } void func_8083A2F8(PlayState* play, Player* this) { - func_80835DAC(play, this, func_8084B530, 0); + func_80835DAC(play, this, Player_Action_8084B530, 0); this->stateFlags1 |= PLAYER_STATE1_6 | PLAYER_STATE1_29; @@ -4894,18 +4895,18 @@ void func_8083A2F8(PlayState* play, Player* this) { } void func_8083A360(PlayState* play, Player* this) { - func_80835DAC(play, this, func_8084CC98, 0); + func_80835DAC(play, this, Player_Action_8084CC98, 0); } void func_8083A388(PlayState* play, Player* this) { - func_80835C58(play, this, func_8084B78C, 0); + Player_SetupAction(play, this, Player_Action_8084B78C, 0); } void func_8083A3B0(PlayState* play, Player* this) { s32 sp1C = this->unk_850; s32 sp18 = this->unk_84F; - func_80835DAC(play, this, func_8084BF1C, 0); + func_80835DAC(play, this, Player_Action_8084BF1C, 0); this->actor.velocity.y = 0.0f; this->unk_850 = sp1C; @@ -4913,11 +4914,11 @@ void func_8083A3B0(PlayState* play, Player* this) { } void func_8083A40C(PlayState* play, Player* this) { - func_80835DAC(play, this, func_8084C760, 0); + func_80835DAC(play, this, Player_Action_8084C760, 0); } void func_8083A434(PlayState* play, Player* this) { - func_80835DAC(play, this, func_8084E6D4, 0); + func_80835DAC(play, this, Player_Action_8084E6D4, 0); this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_29; @@ -4959,7 +4960,7 @@ void func_8083A5C4(PlayState* play, Player* this, CollisionPoly* arg2, f32 arg3, f32 nx = COLPOLY_GET_NORMAL(arg2->normal.x); f32 nz = COLPOLY_GET_NORMAL(arg2->normal.z); - func_80835C58(play, this, func_8084BBE4, 0); + Player_SetupAction(play, this, Player_Action_8084BBE4, 0); func_80832564(play, this); Player_AnimPlayOnce(play, this, anim); @@ -5043,7 +5044,7 @@ s32 func_8083A6AC(Player* this, PlayState* play) { } void func_8083A9B8(Player* this, LinkAnimationHeader* anim, PlayState* play) { - func_80835C58(play, this, func_8084BDFC, 0); + Player_SetupAction(play, this, Player_Action_8084BDFC, 0); LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, 1.3f); } @@ -5070,7 +5071,7 @@ void func_8083AA10(Player* this, PlayState* play) { } if (!(this->stateFlags3 & PLAYER_STATE3_1) && !(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_7) && - (func_8084411C != this->func_674) && (func_80844A44 != this->func_674)) { + (Player_Action_8084411C != this->actionFunc) && (Player_Action_80844A44 != this->actionFunc)) { if ((sPrevFloorProperty == FLOOR_PROPERTY_7) || (this->meleeWeaponState != 0)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); @@ -5086,7 +5087,7 @@ void func_8083AA10(Player* this, PlayState* play) { sp5C = (s16)(this->yaw - this->actor.shape.rot.y); - func_80835C58(play, this, func_8084411C, 1); + Player_SetupAction(play, this, Player_Action_8084411C, 1); func_80832440(play, this); this->floorSfxOffset = this->prevFloorSfxOffset; @@ -5104,7 +5105,7 @@ void func_8083AA10(Player* this, PlayState* play) { if (WaterBox_GetSurface1(play, &play->colCtx, sp44.x, sp44.z, &sp3C, &sp50) && ((sp3C - sp40) > 50.0f)) { func_808389E8(this, &gPlayerAnim_link_normal_run_jump_water_fall, 6.0f, play); - func_80835C58(play, this, func_80844A44, 0); + Player_SetupAction(play, this, Player_Action_80844A44, 0); return; } } @@ -5146,7 +5147,7 @@ s32 func_8083AD4C(PlayState* play, Player* this) { s32 func_8083ADD4(PlayState* play, Player* this) { if (this->unk_6AD == 3) { - func_80835C58(play, this, func_80852E14, 0); + Player_SetupAction(play, this, Player_Action_80852E14, 0); if (this->doorBgCamIndex != 0) { this->stateFlags1 |= PLAYER_STATE1_29; } @@ -5176,7 +5177,7 @@ void func_8083AE40(Player* this, s16 objectId) { } void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) { - func_80835DE4(play, this, func_808507F4, 0); + func_80835DE4(play, this, Player_Action_808507F4, 0); this->unk_84F = magicSpell - 3; Magic_RequestChange(play, sMagicSpellCosts[magicSpell], MAGIC_CONSUME_WAIT_PREVIEW); @@ -5251,7 +5252,7 @@ s32 func_8083B040(Player* this, PlayState* play) { if ((sp2C != 3) || (gSaveContext.respawn[RESPAWN_MODE_TOP].data <= 0)) { func_8083AF44(play, this, sp2C); } else { - func_80835C58(play, this, func_8085063C, 1); + Player_SetupAction(play, this, Player_Action_8085063C, 1); this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; Player_AnimPlayOnce(play, this, func_80833338(this)); func_80835EA4(play, 4); @@ -5271,7 +5272,7 @@ s32 func_8083B040(Player* this, PlayState* play) { (this->exchangeItemId == EXCH_ITEM_BOTTLE_BLUE_FIRE))))))) { if ((play->actorCtx.titleCtx.delayTimer == 0) && (play->actorCtx.titleCtx.alpha == 0)) { - func_80835DE4(play, this, func_8084F104, 0); + func_80835DE4(play, this, Player_Action_8084F104, 0); if (sp2C >= 0) { giEntry = &sGetItemTable[D_80854528[sp2C] - 1]; @@ -5298,7 +5299,7 @@ s32 func_8083B040(Player* this, PlayState* play) { (this->itemAction == PLAYER_IA_MAGIC_BEAN))) { if (this->exchangeItemId == EXCH_ITEM_MAGIC_BEAN) { Inventory_ChangeAmmo(ITEM_MAGIC_BEAN, -1); - func_80835DE4(play, this, func_8084279C, 0); + func_80835DE4(play, this, Player_Action_8084279C, 0); this->stateFlags1 |= PLAYER_STATE1_29; this->unk_850 = 0x50; this->unk_84F = -1; @@ -5333,20 +5334,20 @@ s32 func_8083B040(Player* this, PlayState* play) { sp2C = Player_ActionToBottle(this, this->itemAction); if (sp2C >= 0) { if (sp2C == 0xC) { - func_80835DE4(play, this, func_8084EED8, 0); + func_80835DE4(play, this, Player_Action_8084EED8, 0); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_bottle_bug_out); func_80835EA4(play, 3); } else if ((sp2C > 0) && (sp2C < 4)) { - func_80835DE4(play, this, func_8084EFC0, 0); + func_80835DE4(play, this, Player_Action_8084EFC0, 0); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_bottle_fish_out); func_80835EA4(play, (sp2C == 1) ? 1 : 5); } else { - func_80835DE4(play, this, func_8084EAC0, 0); + func_80835DE4(play, this, Player_Action_8084EAC0, 0); Player_AnimChangeOnceMorphAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_start); func_80835EA4(play, 2); } } else { - func_80835DE4(play, this, func_8084E3C4, 0); + func_80835DE4(play, this, Player_Action_8084E3C4, 0); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_okarina_start); this->stateFlags2 |= PLAYER_STATE2_27; func_80835EA4(play, (this->unk_6A8 != NULL) ? 0x5B : 0x5A); @@ -5357,7 +5358,7 @@ s32 func_8083B040(Player* this, PlayState* play) { } } else if (func_8083AD4C(play, this)) { if (!(this->stateFlags1 & PLAYER_STATE1_23)) { - func_80835C58(play, this, func_8084B1D8, 1); + Player_SetupAction(play, this, Player_Action_8084B1D8, 1); this->unk_850 = 13; func_8083B010(this); } @@ -5486,7 +5487,7 @@ s32 func_8083B998(Player* this, PlayState* play) { void func_8083BA90(PlayState* play, Player* this, s32 arg2, f32 xzSpeed, f32 yVelocity) { func_80837948(play, this, arg2); - func_80835C58(play, this, func_80844AF4, 0); + Player_SetupAction(play, this, Player_Action_80844AF4, 0); this->stateFlags3 |= PLAYER_STATE3_1; @@ -5522,7 +5523,7 @@ s32 func_8083BBA0(Player* this, PlayState* play) { } void func_8083BC04(Player* this, PlayState* play) { - func_80835C58(play, this, func_80844708, 0); + Player_SetupAction(play, this, Player_Action_80844708, 0); LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_landing_roll, this->modelAnimType), 1.25f * D_808535E8); @@ -5623,7 +5624,7 @@ void func_8083C0B8(Player* this, PlayState* play) { } void func_8083C0E8(Player* this, PlayState* play) { - func_80835C58(play, this, func_80840BC8, 1); + Player_SetupAction(play, this, Player_Action_80840BC8, 1); Player_AnimPlayOnce(play, this, func_80833338(this)); this->yaw = this->actor.shape.rot.y; } @@ -5671,7 +5672,7 @@ s32 func_8083C2B0(Player* this, PlayState* play) { func_80832318(this); func_808323B4(play, this); - if (func_80835C58(play, this, func_80843188, 0)) { + if (Player_SetupAction(play, this, Player_Action_80843188, 0)) { this->stateFlags1 |= PLAYER_STATE1_22; if (!Player_IsChildWithHylianShield(this)) { @@ -5748,7 +5749,7 @@ s32 func_8083C544(Player* this, PlayState* play) { s32 func_8083C61C(PlayState* play, Player* this) { if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (AMMO(ITEM_DEKU_NUT) != 0)) { - func_80835C58(play, this, func_8084E604, 0); + Player_SetupAction(play, this, Player_Action_8084E604, 0); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_light_bom); this->unk_6AD = 0; return 1; @@ -5767,7 +5768,7 @@ s32 func_8083C6B8(PlayState* play, Player* this) { if (D_80853614) { if (Player_GetBottleHeld(this) >= 0) { - func_80835C58(play, this, func_8084ECA4, 0); + Player_SetupAction(play, this, Player_Action_8084ECA4, 0); if (this->actor.yDistToWater > 12.0f) { this->unk_850 = 1; @@ -5790,7 +5791,7 @@ s32 func_8083C6B8(PlayState* play, Player* this) { return 0; } - func_80835C58(play, this, func_80850C68, 0); + Player_SetupAction(play, this, Player_Action_80850C68, 0); this->unk_860 = 1; Player_ZeroSpeedXZ(this); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_fishing_throw); @@ -5804,15 +5805,15 @@ s32 func_8083C6B8(PlayState* play, Player* this) { } void func_8083C858(Player* this, PlayState* play) { - PlayerFunc674 func; + PlayerActionFunc actionFunc; if (func_80833BCC(this)) { - func = func_8084227C; + actionFunc = Player_Action_8084227C; } else { - func = func_80842180; + actionFunc = Player_Action_80842180; } - func_80835C58(play, this, func, 1); + Player_SetupAction(play, this, actionFunc, 1); Player_AnimChangeLoopMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_run, this->modelAnimType)); this->unk_89C = 0; @@ -5833,7 +5834,7 @@ s32 func_8083C910(PlayState* play, Player* this, f32 arg2) { 0) { sp28 -= this->actor.world.pos.y; if (this->ageProperties->unk_24 <= sp28) { - func_80835C58(play, this, func_8084D7C4, 0); + Player_SetupAction(play, this, Player_Action_8084D7C4, 0); Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim); this->stateFlags1 |= PLAYER_STATE1_27 | PLAYER_STATE1_29; this->unk_850 = 20; @@ -5878,19 +5879,19 @@ void func_8083CA9C(PlayState* play, Player* this) { } void func_8083CB2C(Player* this, s16 yaw, PlayState* play) { - func_80835C58(play, this, func_808414F8, 1); + Player_SetupAction(play, this, Player_Action_808414F8, 1); LinkAnimation_CopyJointToMorph(play, &this->skelAnime); this->unk_864 = this->unk_868 = 0.0f; this->yaw = yaw; } void func_8083CB94(Player* this, PlayState* play) { - func_80835C58(play, this, func_80840DE4, 1); + Player_SetupAction(play, this, Player_Action_80840DE4, 1); Player_AnimChangeLoopMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_walk, this->modelAnimType)); } void func_8083CBF0(Player* this, s16 yaw, PlayState* play) { - func_80835C58(play, this, func_808423EC, 1); + Player_SetupAction(play, this, Player_Action_808423EC, 1); LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_anchor_back_walk, 2.2f, 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_anchor_back_walk), ANIMMODE_ONCE, -6.0f); this->speedXZ = 8.0f; @@ -5898,19 +5899,19 @@ void func_8083CBF0(Player* this, s16 yaw, PlayState* play) { } void func_8083CC9C(Player* this, PlayState* play) { - func_80835C58(play, this, func_8084193C, 1); + Player_SetupAction(play, this, Player_Action_8084193C, 1); Player_AnimChangeLoopMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_side_walkR, this->modelAnimType)); this->unk_868 = 0.0f; } void func_8083CD00(Player* this, PlayState* play) { - func_80835C58(play, this, func_8084251C, 1); + Player_SetupAction(play, this, Player_Action_8084251C, 1); LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_link_anchor_back_brake, 2.0f); } void func_8083CD54(PlayState* play, Player* this, s16 yaw) { this->yaw = yaw; - func_80835C58(play, this, func_80841BA8, 1); + Player_SetupAction(play, this, Player_Action_80841BA8, 1); this->unk_87E = 1200; this->unk_87E *= D_808535E8; LinkAnimation_Change(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_45_turn, this->modelAnimType), 1.0f, @@ -5920,7 +5921,7 @@ void func_8083CD54(PlayState* play, Player* this, s16 yaw) { void func_8083CE0C(Player* this, PlayState* play) { LinkAnimationHeader* anim; - func_80835C58(play, this, func_80840BC8, 1); + Player_SetupAction(play, this, Player_Action_80840BC8, 1); if (this->unk_870 < 0.5f) { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_waitR2wait, this->modelAnimType); @@ -5933,7 +5934,7 @@ void func_8083CE0C(Player* this, PlayState* play) { } void func_8083CEAC(Player* this, PlayState* play) { - func_80835C58(play, this, func_80840450, 1); + Player_SetupAction(play, this, Player_Action_80840450, 1); Player_AnimChangeOnceMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait2waitR, this->modelAnimType)); this->unk_850 = 1; } @@ -5995,7 +5996,7 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { if ((arg2 == NULL) || (CHECK_BTN_ALL(arg2->press.button, BTN_A) && (ABS(this->unk_6C2) < 12000) && (this->currentBoots != PLAYER_BOOTS_IRON))) { - func_80835C58(play, this, func_8084DC48, 0); + Player_SetupAction(play, this, Player_Action_8084DC48, 0); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_swimer_swim_deep_start); this->unk_6C2 = 0; @@ -6018,7 +6019,7 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { this->stateFlags2 &= ~PLAYER_STATE2_10; if (arg2 != NULL) { - func_80835C58(play, this, func_8084E1EC, 1); + Player_SetupAction(play, this, Player_Action_8084E1EC, 1); if (this->stateFlags1 & PLAYER_STATE1_10) { this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_11 | PLAYER_STATE1_29; @@ -6059,11 +6060,11 @@ void func_8083D36C(PlayState* play, Player* this) { this->stateFlags2 &= ~PLAYER_STATE2_10; func_8083D12C(play, this, NULL); this->unk_84F = 1; - } else if (func_80844A44 == this->func_674) { - func_80835C58(play, this, func_8084DC48, 0); + } else if (Player_Action_80844A44 == this->actionFunc) { + Player_SetupAction(play, this, Player_Action_8084DC48, 0); func_8083D330(play, this); } else { - func_80835C58(play, this, func_8084D610, 1); + Player_SetupAction(play, this, Player_Action_8084D610, 1); Player_AnimChangeOnceMorph(play, this, (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) ? &gPlayerAnim_link_swimer_wait2swim_wait @@ -6100,14 +6101,14 @@ void func_8083D53C(PlayState* play, Player* this) { } } - if ((func_80845668 != this->func_674) && (func_8084BDFC != this->func_674)) { + if ((Player_Action_80845668 != this->actionFunc) && (Player_Action_8084BDFC != this->actionFunc)) { if (this->ageProperties->unk_2C < this->actor.yDistToWater) { if (!(this->stateFlags1 & PLAYER_STATE1_27) || (!((this->currentBoots == PLAYER_BOOTS_IRON) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) && - (func_8084E30C != this->func_674) && (func_8084E368 != this->func_674) && - (func_8084D610 != this->func_674) && (func_8084D84C != this->func_674) && - (func_8084DAB4 != this->func_674) && (func_8084DC48 != this->func_674) && - (func_8084E1EC != this->func_674) && (func_8084D7C4 != this->func_674))) { + (Player_Action_8084E30C != this->actionFunc) && (Player_Action_8084E368 != this->actionFunc) && + (Player_Action_8084D610 != this->actionFunc) && (Player_Action_8084D84C != this->actionFunc) && + (Player_Action_8084DAB4 != this->actionFunc) && (Player_Action_8084DC48 != this->actionFunc) && + (Player_Action_8084E1EC != this->actionFunc) && (Player_Action_8084D7C4 != this->actionFunc))) { func_8083D36C(play, this); return; } @@ -6381,7 +6382,7 @@ s32 Player_HandleSlopes(PlayState* play, Player* this, CollisionPoly* floorPoly) f32 slopeSlowdownSpeedStep; s16 velYawToDownwardSlope; - if (!Player_InBlockingCsMode(play, this) && (func_8084F390 != this->func_674) && + if (!Player_InBlockingCsMode(play, this) && (Player_Action_8084F390 != this->actionFunc) && (SurfaceType_GetFloorEffect(&play->colCtx, floorPoly, this->actor.floorBgId) == FLOOR_EFFECT_1)) { // Get direction of movement relative to the downward direction of the slope playerVelYaw = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); @@ -6402,7 +6403,7 @@ s32 Player_HandleSlopes(PlayState* play, Player* this, CollisionPoly* floorPoly) Math_StepToF(&this->pushedSpeed, slopeSlowdownSpeed, slopeSlowdownSpeedStep); } else { // moving downward on the slope, causing player to slip - func_80835C58(play, this, func_8084F390, 0); + Player_SetupAction(play, this, Player_Action_8084F390, 0); func_80832564(play, this); if (sFloorShapePitch >= 0) { @@ -6556,7 +6557,7 @@ s32 func_8083E5A8(Player* this, PlayState* play) { } void func_8083EA94(Player* this, PlayState* play) { - func_80835C58(play, this, func_80846578, 1); + Player_SetupAction(play, this, Player_Action_80846578, 1); Player_AnimPlayOnce(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_throw, this->modelAnimType)); } @@ -6574,7 +6575,7 @@ s32 func_8083EB44(Player* this, PlayState* play) { CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)) { if (!func_80835644(play, this, this->heldActor)) { if (!func_8083EAF0(this, this->heldActor)) { - func_80835C58(play, this, func_808464B0, 1); + Player_SetupAction(play, this, Player_Action_808464B0, 1); Player_AnimPlayOnce(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_put, this->modelAnimType)); } else { func_8083EA94(this, play); @@ -6698,7 +6699,7 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) { } void func_8083F070(Player* this, LinkAnimationHeader* anim, PlayState* play) { - func_80835DAC(play, this, func_8084C5F8, 0); + func_80835DAC(play, this, Player_Action_8084C5F8, 0); LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, (4.0f / 3.0f)); } @@ -6849,7 +6850,7 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { } if (ABS(yawToWall) > 0x4000) { - func_80835C58(play, this, func_8084C81C, 0); + Player_SetupAction(play, this, Player_Action_8084C81C, 0); if (this->speedXZ > 0.0f) { // Leaving a crawlspace forwards @@ -6883,7 +6884,7 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { void func_8083F72C(Player* this, LinkAnimationHeader* anim, PlayState* play) { if (!func_80836898(play, this, func_8083A388)) { - func_80835C58(play, this, func_8084B78C, 0); + Player_SetupAction(play, this, Player_Action_8084B78C, 0); } Player_AnimPlayOnce(play, this, anim); @@ -6969,13 +6970,13 @@ s32 func_8083F9D0(PlayState* play, Player* this) { } void func_8083FAB8(Player* this, PlayState* play) { - func_80835C58(play, this, func_8084B898, 0); + Player_SetupAction(play, this, Player_Action_8084B898, 0); this->stateFlags2 |= PLAYER_STATE2_4; Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_push_start); } void func_8083FB14(Player* this, PlayState* play) { - func_80835C58(play, this, func_8084B9E4, 0); + Player_SetupAction(play, this, Player_Action_8084B9E4, 0); this->stateFlags2 |= PLAYER_STATE2_4; Player_AnimPlayOnce(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_pull_start, this->modelAnimType)); } @@ -7154,7 +7155,7 @@ void func_8084029C(Player* this, f32 arg1) { } } -void func_80840450(Player* this, PlayState* play) { +void Player_Action_80840450(Player* this, PlayState* play) { f32 sp44; s16 sp42; s32 temp1; @@ -7236,7 +7237,7 @@ void func_80840450(Player* this, PlayState* play) { } } -void func_808407CC(Player* this, PlayState* play) { +void Player_Action_808407CC(Player* this, PlayState* play) { f32 sp3C; s16 sp3A; s32 temp1; @@ -7257,7 +7258,7 @@ void func_808407CC(Player* this, PlayState* play) { } if (!func_80833B2C(this)) { - func_80835DAC(play, this, func_80840BC8, 1); + func_80835DAC(play, this, Player_Action_80840BC8, 1); this->yaw = this->actor.shape.rot.y; return; } @@ -7348,7 +7349,7 @@ void func_808409CC(PlayState* play, Player* this) { ANIMMODE_ONCE, -6.0f); } -void func_80840BC8(Player* this, PlayState* play) { +void Player_Action_80840BC8(Player* this, PlayState* play) { s32 sp44; s32 sp40; f32 sp3C; @@ -7410,7 +7411,7 @@ void func_80840BC8(Player* this, PlayState* play) { } } -void func_80840DE4(Player* this, PlayState* play) { +void Player_Action_80840DE4(Player* this, PlayState* play) { f32 frames; f32 coeff; f32 sp44; @@ -7542,7 +7543,7 @@ void func_80841138(Player* this, PlayState* play) { } void func_8084140C(Player* this, PlayState* play) { - func_80835C58(play, this, func_8084170C, 1); + Player_SetupAction(play, this, Player_Action_8084170C, 1); Player_AnimChangeOnceMorph(play, this, &gPlayerAnim_link_normal_back_brake); } @@ -7564,7 +7565,7 @@ s32 func_80841458(Player* this, f32* arg1, s16* arg2, PlayState* play) { return 0; } -void func_808414F8(Player* this, PlayState* play) { +void Player_Action_808414F8(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 sp2C; @@ -7605,11 +7606,11 @@ void func_808414F8(Player* this, PlayState* play) { } void func_808416C0(Player* this, PlayState* play) { - func_80835C58(play, this, func_808417FC, 1); + Player_SetupAction(play, this, Player_Action_808417FC, 1); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_back_brake_end); } -void func_8084170C(Player* this, PlayState* play) { +void Player_Action_8084170C(Player* this, PlayState* play) { s32 sp34; f32 sp30; s16 sp2E; @@ -7632,7 +7633,7 @@ void func_8084170C(Player* this, PlayState* play) { } } -void func_808417FC(Player* this, PlayState* play) { +void Player_Action_808417FC(Player* this, PlayState* play) { s32 sp1C; sp1C = LinkAnimation_Update(play, &this->skelAnime); @@ -7657,7 +7658,7 @@ void func_80841860(PlayState* play, Player* this) { LinkAnimation_BlendToJoint(play, &this->skelAnime, sp34, frame, sp38, frame, this->unk_870, this->blendTable); } -void func_8084193C(Player* this, PlayState* play) { +void Player_Action_8084193C(Player* this, PlayState* play) { f32 sp3C; s16 sp3A; s32 temp1; @@ -7721,7 +7722,7 @@ void func_8084193C(Player* this, PlayState* play) { } } -void func_80841BA8(Player* this, PlayState* play) { +void Player_Action_80841BA8(Player* this, PlayState* play) { f32 sp34; s16 sp32; @@ -7845,7 +7846,7 @@ void func_80841EE4(Player* this, PlayState* play) { } } -void func_80842180(Player* this, PlayState* play) { +void Player_Action_80842180(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; @@ -7871,7 +7872,7 @@ void func_80842180(Player* this, PlayState* play) { } } -void func_8084227C(Player* this, PlayState* play) { +void Player_Action_8084227C(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; @@ -7903,7 +7904,7 @@ void func_8084227C(Player* this, PlayState* play) { } } -void func_808423EC(Player* this, PlayState* play) { +void Player_Action_808423EC(Player* this, PlayState* play) { s32 sp34; f32 sp30; s16 sp2E; @@ -7933,7 +7934,7 @@ void func_808423EC(Player* this, PlayState* play) { } } -void func_8084251C(Player* this, PlayState* play) { +void Player_Action_8084251C(Player* this, PlayState* play) { s32 sp34; f32 sp30; s16 sp2E; @@ -7985,7 +7986,7 @@ s32 func_8084269C(PlayState* play, Player* this) { return 0; } -void func_8084279C(Player* this, PlayState* play) { +void Player_Action_8084279C(Player* this, PlayState* play) { func_80832CB0(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check_wait, this->modelAnimType)); if (DECR(this->unk_850) == 0) { @@ -8092,9 +8093,9 @@ void func_80842D20(PlayState* play, Player* this) { s32 pad; s32 sp28; - if (func_80843188 != this->func_674) { + if (Player_Action_80843188 != this->actionFunc) { func_80832440(play, this); - func_80835C58(play, this, func_808505DC, 0); + Player_SetupAction(play, this, Player_Action_808505DC, 0); if (func_8008E9C4(this)) { sp28 = 2; @@ -8202,7 +8203,7 @@ s32 func_80842DF4(PlayState* play, Player* this) { return 0; } -void func_80843188(Player* this, PlayState* play) { +void Player_Action_80843188(Player* this, PlayState* play) { f32 sp54; f32 sp50; s16 sp4E; @@ -8299,7 +8300,7 @@ void func_80843188(Player* this, PlayState* play) { this->unk_6AE |= 0xC1; } -void func_808435C4(Player* this, PlayState* play) { +void Player_Action_808435C4(Player* this, PlayState* play) { s32 temp; LinkAnimationHeader* anim; f32 frames; @@ -8309,12 +8310,12 @@ void func_808435C4(Player* this, PlayState* play) { if (this->unk_84F == 0) { D_808535E0 = func_80836670(this, play); if ((func_80834B5C == this->func_82C) || (func_808374A0(play, this, &this->skelAnime2, 4.0f) > 0)) { - func_80835C58(play, this, func_80840450, 1); + Player_SetupAction(play, this, Player_Action_80840450, 1); } } else { temp = func_808374A0(play, this, &this->skelAnime, 4.0f); if ((temp != 0) && ((temp > 0) || LinkAnimation_Update(play, &this->skelAnime))) { - func_80835C58(play, this, func_80843188, 1); + Player_SetupAction(play, this, Player_Action_80843188, 1); this->stateFlags1 |= PLAYER_STATE1_22; Player_SetModelsForHoldingShield(this); anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_defense, this->modelAnimType); @@ -8324,7 +8325,7 @@ void func_808435C4(Player* this, PlayState* play) { } } -void func_8084370C(Player* this, PlayState* play) { +void Player_Action_8084370C(Player* this, PlayState* play) { s32 sp1C; func_8083721C(this); @@ -8335,7 +8336,7 @@ void func_8084370C(Player* this, PlayState* play) { } } -void func_8084377C(Player* this, PlayState* play) { +void Player_Action_8084377C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; func_808382BC(this); @@ -8367,7 +8368,7 @@ void func_8084377C(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_29) { this->unk_850++; } else { - func_80835C58(play, this, func_80843954, 0); + Player_SetupAction(play, this, Player_Action_80843954, 0); this->stateFlags1 |= PLAYER_STATE1_26; } @@ -8383,7 +8384,7 @@ void func_8084377C(Player* this, PlayState* play) { } } -void func_80843954(Player* this, PlayState* play) { +void Player_Action_80843954(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; func_808382BC(this); @@ -8393,7 +8394,7 @@ void func_80843954(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_29) { this->unk_850++; } else { - func_80835C58(play, this, func_80843A38, 0); + Player_SetupAction(play, this, Player_Action_80843A38, 0); this->stateFlags1 |= PLAYER_STATE1_26; } @@ -8409,7 +8410,7 @@ static struct_80832924 D_808545DC[] = { { 0, -0x401E }, }; -void func_80843A38(Player* this, PlayState* play) { +void Player_Action_80843A38(Player* this, PlayState* play) { s32 sp24; this->stateFlags2 |= PLAYER_STATE2_5; @@ -8473,7 +8474,7 @@ static struct_80832924 D_808545F0[] = { { 0, -0x40AA }, }; -void func_80843CEC(Player* this, PlayState* play) { +void Player_Action_80843CEC(Player* this, PlayState* play) { if (this->currentTunic != PLAYER_TUNIC_GORON) { if ((play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) || (sFloorType == FLOOR_TYPE_9) || ((func_80838144(sFloorType) >= 0) && @@ -8584,7 +8585,7 @@ void func_8084409C(PlayState* play, Player* this, f32 speedXZ, f32 velocityY) { } } -void func_8084411C(Player* this, PlayState* play) { +void Player_Action_8084411C(Player* this, PlayState* play) { f32 sp4C; s16 sp4A; @@ -8704,7 +8705,7 @@ static struct_80832924 D_8085460C[] = { { 0, -0x2812 }, }; -void func_80844708(Player* this, PlayState* play) { +void Player_Action_80844708(Player* this, PlayState* play) { Actor* cylinderOc; s32 temp; s32 sp44; @@ -8784,7 +8785,7 @@ void func_80844708(Player* this, PlayState* play) { } } -void func_80844A44(Player* this, PlayState* play) { +void Player_Action_80844A44(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -8799,7 +8800,7 @@ void func_80844A44(Player* this, PlayState* play) { } } -void func_80844AF4(Player* this, PlayState* play) { +void Player_Action_80844AF4(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; @@ -8855,11 +8856,11 @@ s32 func_80844BE4(Player* this, PlayState* play) { } void func_80844CF8(Player* this, PlayState* play) { - func_80835C58(play, this, func_80845000, 1); + Player_SetupAction(play, this, Player_Action_80845000, 1); } void func_80844D30(Player* this, PlayState* play) { - func_80835C58(play, this, func_80845308, 1); + Player_SetupAction(play, this, Player_Action_80845308, 1); } void func_80844D68(Player* this, PlayState* play) { @@ -8870,7 +8871,7 @@ void func_80844D68(Player* this, PlayState* play) { } void func_80844DC8(Player* this, PlayState* play) { - func_80835C58(play, this, func_80844E68, 1); + Player_SetupAction(play, this, Player_Action_80844E68, 1); this->unk_868 = 0.0f; Player_AnimPlayLoop(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); this->unk_850 = 1; @@ -8880,7 +8881,7 @@ void func_80844E3C(Player* this) { Math_StepToF(&this->unk_858, 1.0f, 0.02f); } -void func_80844E68(Player* this, PlayState* play) { +void Player_Action_80844E68(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 temp; @@ -8920,7 +8921,7 @@ void func_80844E68(Player* this, PlayState* play) { } } -void func_80845000(Player* this, PlayState* play) { +void Player_Action_80845000(Player* this, PlayState* play) { s16 temp1; s32 temp2; f32 sp5C; @@ -8988,7 +8989,7 @@ void func_80845000(Player* this, PlayState* play) { } } -void func_80845308(Player* this, PlayState* play) { +void Player_Action_80845308(Player* this, PlayState* play) { f32 sp5C; f32 sp58; f32 sp54; @@ -9056,7 +9057,7 @@ void func_80845308(Player* this, PlayState* play) { } } -void func_80845668(Player* this, PlayState* play) { +void Player_Action_80845668(Player* this, PlayState* play) { s32 sp3C; f32 temp1; s32 temp2; @@ -9131,7 +9132,7 @@ void func_80845668(Player* this, PlayState* play) { } } -void func_808458D0(Player* this, PlayState* play) { +void Player_Action_808458D0(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; LinkAnimation_Update(play, &this->skelAnime); @@ -9208,7 +9209,7 @@ s32 func_80845C68(PlayState* play, s32 arg1) { return arg1; } -void func_80845CA4(Player* this, PlayState* play) { +void Player_Action_80845CA4(Player* this, PlayState* play) { f32 sp3C; s32 temp; f32 sp34; @@ -9271,7 +9272,7 @@ void func_80845CA4(Player* this, PlayState* play) { } } -void func_80845EF8(Player* this, PlayState* play) { +void Player_Action_80845EF8(Player* this, PlayState* play) { s32 sp2C; this->stateFlags2 |= PLAYER_STATE2_5; @@ -9301,7 +9302,7 @@ void func_80845EF8(Player* this, PlayState* play) { } } -void func_80846050(Player* this, PlayState* play) { +void Player_Action_80846050(Player* this, PlayState* play) { func_8083721C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -9333,7 +9334,7 @@ static struct_80832924 D_8085461C[] = { { NA_SE_VO_LI_SWORD_N, -0x20E6 }, }; -void func_80846120(Player* this, PlayState* play) { +void Player_Action_80846120(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime) && (this->unk_850++ > 20)) { if (!func_8083B040(this, play)) { func_8083A098(this, &gPlayerAnim_link_normal_heavy_carry_end, play); @@ -9365,7 +9366,7 @@ void func_80846120(Player* this, PlayState* play) { func_80832924(this, D_8085461C); } -void func_80846260(Player* this, PlayState* play) { +void Player_Action_80846260(Player* this, PlayState* play) { func_8083721C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -9390,12 +9391,12 @@ void func_80846260(Player* this, PlayState* play) { } } else if (CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)) { - func_80835C58(play, this, func_80846358, 1); + Player_SetupAction(play, this, Player_Action_80846358, 1); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_silver_throw); } } -void func_80846358(Player* this, PlayState* play) { +void Player_Action_80846358(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_80839F90(this, play); return; @@ -9413,7 +9414,7 @@ void func_80846358(Player* this, PlayState* play) { } } -void func_80846408(Player* this, PlayState* play) { +void Player_Action_80846408(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_nocarry_free_wait); this->unk_850 = 15; @@ -9430,7 +9431,7 @@ void func_80846408(Player* this, PlayState* play) { } } -void func_808464B0(Player* this, PlayState* play) { +void Player_Action_808464B0(Player* this, PlayState* play) { func_8083721C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -9452,7 +9453,7 @@ void func_808464B0(Player* this, PlayState* play) { } } -void func_80846578(Player* this, PlayState* play) { +void Player_Action_80846578(Player* this, PlayState* play) { f32 sp34; s16 sp32; @@ -9538,7 +9539,7 @@ void func_80846648(PlayState* play, Player* this) { } void func_80846660(PlayState* play, Player* this) { - func_80835C58(play, this, func_8084F710, 0); + Player_SetupAction(play, this, Player_Action_8084F710, 0); if ((play->sceneId == SCENE_LAKE_HYLIA) && IS_CUTSCENE_LAYER) { this->unk_84F = 1; } @@ -9571,7 +9572,7 @@ void func_80846720(PlayState* play, Player* this, s32 arg2) { static Vec3f D_808546F4 = { -1.0f, 69.0f, 20.0f }; void func_808467D4(PlayState* play, Player* this) { - func_80835C58(play, this, func_8084E9AC, 0); + Player_SetupAction(play, this, Player_Action_8084E9AC, 0); this->stateFlags1 |= PLAYER_STATE1_29; Math_Vec3f_Copy(&this->actor.world.pos, &D_808546F4); this->yaw = this->actor.shape.rot.y = -0x8000; @@ -9587,7 +9588,7 @@ void func_808467D4(PlayState* play, Player* this) { } void func_808468A8(PlayState* play, Player* this) { - func_80835C58(play, this, func_8084F9A0, 0); + Player_SetupAction(play, this, Player_Action_8084F9A0, 0); Player_AnimReplaceApplyFlags(play, this, ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); @@ -9595,7 +9596,7 @@ void func_808468A8(PlayState* play, Player* this) { void func_808468E8(PlayState* play, Player* this) { func_808389E8(this, &gPlayerAnim_link_normal_jump, 12.0f, play); - func_80835C58(play, this, func_8084F9C0, 0); + Player_SetupAction(play, this, Player_Action_8084F9C0, 0); this->stateFlags1 |= PLAYER_STATE1_29; this->fallStartHeight = this->actor.world.pos.y; OnePointCutscene_Init(play, 5110, 40, &this->actor, CAM_ID_MAIN); @@ -9606,7 +9607,7 @@ void func_80846978(PlayState* play, Player* this) { } void func_808469BC(PlayState* play, Player* this) { - func_80835C58(play, this, func_8084F698, 0); + Player_SetupAction(play, this, Player_Action_8084F698, 0); this->actor.draw = NULL; this->stateFlags1 |= PLAYER_STATE1_29; } @@ -9620,7 +9621,7 @@ Actor* func_80846A00(PlayState* play, Player* this, s32 arg2) { void func_80846A68(PlayState* play, Player* this) { this->actor.draw = NULL; - func_80835C58(play, this, func_8085076C, 0); + Player_SetupAction(play, this, Player_Action_8085076C, 0); this->stateFlags1 |= PLAYER_STATE1_29; } @@ -9878,7 +9879,7 @@ void func_808473D4(PlayState* play, Player* this) { if (this->unk_860 == 2) { doAction = DO_ACTION_REEL; } - } else if ((func_8084E3C4 != this->func_674) && !(this->stateFlags2 & PLAYER_STATE2_CRAWLING)) { + } else if ((Player_Action_8084E3C4 != this->actionFunc) && !(this->stateFlags2 & PLAYER_STATE2_CRAWLING)) { if ((this->doorType != PLAYER_DOORTYPE_NONE) && (!(this->stateFlags1 & PLAYER_STATE1_11) || ((heldActor != NULL) && (heldActor->id == ACTOR_EN_RU1)))) { @@ -9900,7 +9901,7 @@ void func_808473D4(PlayState* play, Player* this) { (!(this->stateFlags1 & PLAYER_STATE1_23) && (this->rideActor != NULL))) { doAction = DO_ACTION_CLIMB; } else if ((this->stateFlags1 & PLAYER_STATE1_23) && !EN_HORSE_CHECK_4((EnHorse*)this->rideActor) && - (func_8084D3E4 != this->func_674)) { + (Player_Action_8084D3E4 != this->actionFunc)) { if ((this->stateFlags2 & PLAYER_STATE2_1) && (this->targetActor != NULL)) { if (this->targetActor->category == ACTORCAT_NPC) { doAction = DO_ACTION_SPEAK; @@ -10068,7 +10069,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { } else if ((this->stateFlags1 & PLAYER_STATE1_0) && ((this->unk_A84 - (s32)this->actor.world.pos.y) >= 100)) { flags = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_5; } else if (!(this->stateFlags1 & PLAYER_STATE1_0) && - ((func_80845EF8 == this->func_674) || (func_80845CA4 == this->func_674))) { + ((Player_Action_80845EF8 == this->actionFunc) || (Player_Action_80845CA4 == this->actionFunc))) { this->actor.bgCheckFlags &= ~(BGCHECKFLAG_WALL | BGCHECKFLAG_PLAYER_WALL_INTERACT); flags = UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_5; } else { @@ -10334,7 +10335,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { if ((this->actor.parent != NULL) && (this->stateFlags3 & PLAYER_STATE3_7)) { camMode = CAM_MODE_HOOKSHOT_FLY; Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, this->actor.parent); - } else if (func_8084377C == this->func_674) { + } else if (Player_Action_8084377C == this->actionFunc) { camMode = CAM_MODE_STILL; } else if (this->stateFlags2 & PLAYER_STATE2_8) { camMode = CAM_MODE_PUSH_PULL; @@ -10371,7 +10372,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { camMode = CAM_MODE_Z_PARALLEL; } } else if (this->stateFlags1 & (PLAYER_STATE1_18 | PLAYER_STATE1_21)) { - if ((func_80845668 == this->func_674) || (this->stateFlags1 & PLAYER_STATE1_21)) { + if ((Player_Action_80845668 == this->actionFunc) || (this->stateFlags1 & PLAYER_STATE1_21)) { camMode = CAM_MODE_WALL_CLIMB; } else { camMode = CAM_MODE_JUMP; @@ -10740,7 +10741,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { if ((this->pushedSpeed != 0.0f) && !Player_InCsMode(play) && !(this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21)) && - (func_80845668 != this->func_674) && (func_808507F4 != this->func_674)) { + (Player_Action_80845668 != this->actionFunc) && (Player_Action_808507F4 != this->actionFunc)) { this->actor.velocity.x += this->pushedSpeed * Math_SinS(this->pushedYaw); this->actor.velocity.z += this->pushedSpeed * Math_CosS(this->pushedYaw); } @@ -10845,7 +10846,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { if ((this->csMode != PLAYER_CSMODE_7) || !(this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21 | PLAYER_STATE1_26))) { this->unk_6AD = 3; - } else if (func_80852E14 != this->func_674) { + } else if (Player_Action_80852E14 != this->actionFunc) { func_80852944(play, this, NULL); } } else { @@ -10878,7 +10879,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { D_80858AA4 = this->currentMask; if (!(this->stateFlags3 & PLAYER_STATE3_2)) { - this->func_674(this, play); + this->actionFunc(this, play); } Player_UpdateCamAndSeqModes(play, this); @@ -11360,7 +11361,7 @@ void func_8084B158(PlayState* play, Player* this, Input* input, f32 arg3) { LinkAnimation_Update(play, &this->skelAnime); } -void func_8084B1D8(Player* this, PlayState* play) { +void Player_Action_8084B1D8(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_27) { func_8084B000(this); func_8084AEEC(this, &this->speedXZ, 0, this->actor.shape.rot.y); @@ -11395,7 +11396,7 @@ void func_8084B1D8(Player* this, PlayState* play) { s32 func_8084B3CC(PlayState* play, Player* this) { if (play->shootingGalleryStatus != 0) { func_80832564(play, this); - func_80835C58(play, this, func_8084FA54, 0); + Player_SetupAction(play, this, Player_Action_8084FA54, 0); if (!func_8002DD6C(this) || Player_HoldsHookshot(this)) { func_80835F44(play, this, 3); @@ -11428,7 +11429,7 @@ s32 func_8084B4D4(PlayState* play, Player* this) { return 0; } -void func_8084B530(Player* this, PlayState* play) { +void Player_Action_8084B530(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; func_80836670(this, play); @@ -11460,9 +11461,9 @@ void func_8084B530(Player* this, PlayState* play) { } if (this->stateFlags1 & PLAYER_STATE1_23) { - func_8084CC98(this, play); + Player_Action_8084CC98(this, play); } else if (func_808332B8(this)) { - func_8084D610(this, play); + Player_Action_8084D610(this, play); } else if (!func_8008E9C4(this) && LinkAnimation_Update(play, &this->skelAnime)) { if (this->skelAnime.moveFlags != 0) { func_80832DBC(this); @@ -11481,7 +11482,7 @@ void func_8084B530(Player* this, PlayState* play) { } } -void func_8084B78C(Player* this, PlayState* play) { +void Player_Action_8084B78C(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 temp; @@ -11517,7 +11518,7 @@ static struct_80832924 D_80854870[] = { { NA_SE_PL_SLIP, -0x1015 }, }; -void func_8084B898(Player* this, PlayState* play) { +void Player_Action_8084B898(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 temp; @@ -11560,7 +11561,7 @@ static struct_80832924 D_80854878[] = { static Vec3f D_80854880 = { 0.0f, 26.0f, -40.0f }; -void func_8084B9E4(Player* this, PlayState* play) { +void Player_Action_8084B9E4(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 sp70; s16 sp6E; @@ -11616,7 +11617,7 @@ void func_8084B9E4(Player* this, PlayState* play) { } } -void func_8084BBE4(Player* this, PlayState* play) { +void Player_Action_8084BBE4(Player* this, PlayState* play) { f32 sp3C; s16 sp3A; LinkAnimationHeader* anim; @@ -11672,7 +11673,7 @@ void func_8084BBE4(Player* this, PlayState* play) { } } -void func_8084BDFC(Player* this, PlayState* play) { +void Player_Action_8084BDFC(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_6; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -11695,7 +11696,7 @@ void func_8084BEE4(Player* this) { : NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WOOD); } -void func_8084BF1C(Player* this, PlayState* play) { +void Player_Action_8084BF1C(Player* this, PlayState* play) { static Vec3f D_8085488C = { 0.0f, 0.0f, 26.0f }; s32 sp84; s32 sp80; @@ -11847,7 +11848,7 @@ static struct_80832924 D_808548A8[] = { { NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WOOD, -0x81E }, }; -void func_8084C5F8(Player* this, PlayState* play) { +void Player_Action_8084C5F8(Player* this, PlayState* play) { s32 temp; f32* sp38; CollisionPoly* groundPoly; @@ -11899,7 +11900,7 @@ static struct_80832924 D_808548B4[] = { * Update player's animation while entering the crawlspace. * Once inside, stop all player animations and update player's movement. */ -void func_8084C760(Player* this, PlayState* play) { +void Player_Action_8084C760(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_6; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -11930,7 +11931,7 @@ static struct_80832924 D_808548D8[] = { /** * Update player's animation while leaving the crawlspace. */ -void func_8084C81C(Player* this, PlayState* play) { +void Player_Action_8084C81C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_6; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -12003,7 +12004,7 @@ s32 func_8084C9BC(Player* this, PlayState* play) { if (EN_HORSE_CHECK_1(rideActor) || (EN_HORSE_CHECK_4(rideActor) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A))) { rideActor->actor.child = NULL; - func_80835DAC(play, this, func_8084D3E4, 0); + func_80835DAC(play, this, Player_Action_8084D3E4, 0); this->unk_878 = sp34 - rideActor->actor.world.pos.y; Player_AnimPlayOnce(play, this, (this->mountSide < 0) ? &gPlayerAnim_link_uma_left_down @@ -12079,7 +12080,7 @@ static struct_80832924 D_808549A4[] = { { NA_SE_PL_CALM_PAT, 0x884 }, { NA_SE_PL_CALM_PAT, -0x888 }, }; -void func_8084CC98(Player* this, PlayState* play) { +void Player_Action_8084CC98(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; u8* arr; @@ -12257,7 +12258,7 @@ static struct_80832924 D_808549C4[] = { { NA_SE_PL_SLIPDOWN, -0x819 }, }; -void func_8084D3E4(Player* this, PlayState* play) { +void Player_Action_8084D3E4(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_6; func_8084CBF4(this, 1.0f, 10.0f); @@ -12297,17 +12298,17 @@ void func_8084D530(Player* this, f32* arg1, f32 arg2, s16 arg3) { } void func_8084D574(PlayState* play, Player* this, s16 arg2) { - func_80835C58(play, this, func_8084D84C, 0); + Player_SetupAction(play, this, Player_Action_8084D84C, 0); this->actor.shape.rot.y = this->yaw = arg2; Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim); } void func_8084D5CC(PlayState* play, Player* this) { - func_80835C58(play, this, func_8084DAB4, 0); + Player_SetupAction(play, this, Player_Action_8084DAB4, 0); Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim); } -void func_8084D610(Player* this, PlayState* play) { +void Player_Action_8084D610(Player* this, PlayState* play) { f32 sp34; s16 sp32; @@ -12350,7 +12351,7 @@ void func_8084D610(Player* this, PlayState* play) { } } -void func_8084D7C4(Player* this, PlayState* play) { +void Player_Action_8084D7C4(Player* this, PlayState* play) { if (!func_8083B040(this, play)) { this->stateFlags2 |= PLAYER_STATE2_5; @@ -12363,7 +12364,7 @@ void func_8084D7C4(Player* this, PlayState* play) { } } -void func_8084D84C(Player* this, PlayState* play) { +void Player_Action_8084D84C(Player* this, PlayState* play) { f32 sp34; s16 sp32; s16 temp; @@ -12425,7 +12426,7 @@ s32 func_8084D980(PlayState* play, Player* this, f32* arg2, s16* arg3) { return 0; } -void func_8084DAB4(Player* this, PlayState* play) { +void Player_Action_8084DAB4(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; @@ -12456,7 +12457,7 @@ void func_8084DBC4(PlayState* play, Player* this, f32 arg2) { func_8084AEEC(this, &this->actor.velocity.y, arg2, this->yaw); } -void func_8084DC48(Player* this, PlayState* play) { +void Player_Action_8084DC48(Player* this, PlayState* play) { f32 sp2C; this->stateFlags2 |= PLAYER_STATE2_5; @@ -12584,7 +12585,7 @@ s32 func_8084DFF4(PlayState* play, Player* this) { return 0; } -void func_8084E1EC(Player* this, PlayState* play) { +void Player_Action_8084E1EC(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -12607,7 +12608,7 @@ void func_8084E1EC(Player* this, PlayState* play) { func_8084AEEC(this, &this->speedXZ, 0.0f, this->actor.shape.rot.y); } -void func_8084E30C(Player* this, PlayState* play) { +void Player_Action_8084E30C(Player* this, PlayState* play) { func_8084B000(this); if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -12617,7 +12618,7 @@ void func_8084E30C(Player* this, PlayState* play) { func_8084AEEC(this, &this->speedXZ, 0.0f, this->actor.shape.rot.y); } -void func_8084E368(Player* this, PlayState* play) { +void Player_Action_8084E368(Player* this, PlayState* play) { func_8084B000(this); if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -12636,7 +12637,7 @@ static s16 sWarpSongEntrances[] = { ENTR_TEMPLE_OF_TIME_7, }; -void func_8084E3C4(Player* this, PlayState* play) { +void Player_Action_8084E3C4(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_normal_okarina_swing); this->unk_850 = 1; @@ -12691,7 +12692,7 @@ void func_8084E3C4(Player* this, PlayState* play) { } } -void func_8084E604(Player* this, PlayState* play) { +void Player_Action_8084E604(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_8083A098(this, &gPlayerAnim_link_normal_light_bom_end, play); } else if (LinkAnimation_OnFrame(&this->skelAnime, 3.0f)) { @@ -12712,7 +12713,7 @@ static struct_80832924 D_808549E0[] = { { 0, -0x287B }, }; -void func_8084E6D4(Player* this, PlayState* play) { +void Player_Action_8084E6D4(Player* this, PlayState* play) { s32 cond; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -12795,7 +12796,7 @@ static struct_80832924 D_808549F4[] = { { 0, -0x280F }, }; -void func_8084E9AC(Player* this, PlayState* play) { +void Player_Action_8084E9AC(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_84F == 0) { if (DECR(this->unk_850) == 0) { @@ -12823,7 +12824,7 @@ static u8 D_808549FC[] = { 0x01, 0x03, 0x02, 0x04, 0x04, }; -void func_8084EAC0(Player* this, PlayState* play) { +void Player_Action_8084EAC0(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_850 == 0) { if (this->itemAction == PLAYER_IA_BOTTLE_POE) { @@ -12884,7 +12885,7 @@ static BottleCatchInfo sBottleCatchInfos[] = { { ACTOR_EN_INSECT, ITEM_BOTTLE_BUG, PLAYER_IA_BOTTLE_BUG, 0x7A }, }; -void func_8084ECA4(Player* this, PlayState* play) { +void Player_Action_8084ECA4(Player* this, PlayState* play) { struct_80854554* sp24; BottleCatchInfo* catchInfo; s32 temp; @@ -12951,7 +12952,7 @@ void func_8084ECA4(Player* this, PlayState* play) { static Vec3f D_80854A1C = { 0.0f, 0.0f, 5.0f }; -void func_8084EED8(Player* this, PlayState* play) { +void Player_Action_8084EED8(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_8083C0E8(this, play); func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); @@ -12979,7 +12980,7 @@ static struct_80832924 D_80854A34[] = { { NA_SE_EV_BOTTLE_CAP_OPEN, -0x828 }, }; -void func_8084EFC0(Player* this, PlayState* play) { +void Player_Action_8084EFC0(Player* this, PlayState* play) { func_8083721C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -13007,7 +13008,7 @@ static struct_80832924 D_80854A3C[] = { { NA_SE_PL_PUT_OUT_ITEM, -0x81E }, }; -void func_8084F104(Player* this, PlayState* play) { +void Player_Action_8084F104(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -13060,7 +13061,7 @@ void func_8084F104(Player* this, PlayState* play) { } } -void func_8084F308(Player* this, PlayState* play) { +void Player_Action_8084F308(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -13073,7 +13074,7 @@ void func_8084F308(Player* this, PlayState* play) { } } -void func_8084F390(Player* this, PlayState* play) { +void Player_Action_8084F390(Player* this, PlayState* play) { CollisionPoly* floorPoly; f32 sp50; f32 sp4C; @@ -13136,21 +13137,21 @@ void func_8084F390(Player* this, PlayState* play) { } } -void func_8084F608(Player* this, PlayState* play) { +void Player_Action_8084F608(Player* this, PlayState* play) { if ((DECR(this->unk_850) == 0) && func_8083ADD4(play, this)) { func_80852280(play, this, NULL); - func_80835C58(play, this, func_80852E14, 0); - func_80852E14(this, play); + Player_SetupAction(play, this, Player_Action_80852E14, 0); + Player_Action_80852E14(this, play); } } -void func_8084F698(Player* this, PlayState* play) { - func_80835C58(play, this, func_8084F608, 0); +void Player_Action_8084F698(Player* this, PlayState* play) { + Player_SetupAction(play, this, Player_Action_8084F608, 0); this->unk_850 = 40; Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, DEMOKANKYO_WARP_IN); } -void func_8084F710(Player* this, PlayState* play) { +void Player_Action_8084F710(Player* this, PlayState* play) { s32 pad; if ((this->unk_84F != 0) && (play->csCtx.curFrame < 305)) { @@ -13185,7 +13186,7 @@ void func_8084F710(Player* this, PlayState* play) { } } -void func_8084F88C(Player* this, PlayState* play) { +void Player_Action_8084F88C(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); if ((this->unk_850++ > 8) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { @@ -13213,11 +13214,11 @@ void func_8084F88C(Player* this, PlayState* play) { } } -void func_8084F9A0(Player* this, PlayState* play) { +void Player_Action_8084F9A0(Player* this, PlayState* play) { func_80839800(this, play); } -void func_8084F9C0(Player* this, PlayState* play) { +void Player_Action_8084F9C0(Player* this, PlayState* play) { this->actor.gravity = -1.0f; LinkAnimation_Update(play, &this->skelAnime); @@ -13229,7 +13230,7 @@ void func_8084F9C0(Player* this, PlayState* play) { } } -void func_8084FA54(Player* this, PlayState* play) { +void Player_Action_8084FA54(Player* this, PlayState* play) { this->unk_6AD = 2; func_8083AD4C(play, this); @@ -13247,7 +13248,7 @@ void func_8084FA54(Player* this, PlayState* play) { } } -void func_8084FB10(Player* this, PlayState* play) { +void Player_Action_8084FB10(Player* this, PlayState* play) { if (this->unk_84F >= 0) { if (this->unk_84F < 6) { this->unk_84F++; @@ -13272,7 +13273,7 @@ void func_8084FB10(Player* this, PlayState* play) { } } -void func_8084FBF4(Player* this, PlayState* play) { +void Player_Action_8084FBF4(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); func_808382BC(this); @@ -13438,7 +13439,7 @@ s32 func_80850224(Player* this, PlayState* play) { static Vec3f D_80854A40 = { 0.0f, 40.0f, 45.0f }; -void func_808502D0(Player* this, PlayState* play) { +void Player_Action_808502D0(Player* this, PlayState* play) { struct_80854190* sp44 = &D_80854190[this->meleeWeaponAnimation]; this->stateFlags2 |= PLAYER_STATE2_5; @@ -13509,7 +13510,7 @@ void func_808502D0(Player* this, PlayState* play) { } } -void func_808505DC(Player* this, PlayState* play) { +void Player_Action_808505DC(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); func_8083721C(this); @@ -13518,7 +13519,7 @@ void func_808505DC(Player* this, PlayState* play) { } } -void func_8085063C(Player* this, PlayState* play) { +void Player_Action_8085063C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; LinkAnimation_Update(play, &this->skelAnime); @@ -13553,7 +13554,7 @@ void func_8085063C(Player* this, PlayState* play) { } } -void func_8085076C(Player* this, PlayState* play) { +void Player_Action_8085076C(Player* this, PlayState* play) { s32 respawnData = gSaveContext.respawn[RESPAWN_MODE_TOP].data; if (this->unk_850 > 20) { @@ -13610,7 +13611,7 @@ static struct_80832924 D_80854A8C[][2] = { }, }; -void func_808507F4(Player* this, PlayState* play) { +void Player_Action_808507F4(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_84F < 0) { if ((this->itemAction == PLAYER_IA_NAYRUS_LOVE) || (gSaveContext.magicState == MAGIC_STATE_IDLE)) { @@ -13677,7 +13678,7 @@ void func_808507F4(Player* this, PlayState* play) { func_8083721C(this); } -void func_80850AEC(Player* this, PlayState* play) { +void Player_Action_80850AEC(Player* this, PlayState* play) { f32 temp; this->stateFlags2 |= PLAYER_STATE2_5; @@ -13715,7 +13716,7 @@ void func_80850AEC(Player* this, PlayState* play) { } } -void func_80850C68(Player* this, PlayState* play) { +void Player_Action_80850C68(Player* this, PlayState* play) { if ((this->unk_850 != 0) && ((this->unk_858 != 0.0f) || (this->unk_85C != 0.0f))) { f32 updateScale = R_UPDATE_RATE * 0.5f; @@ -13744,12 +13745,12 @@ void func_80850C68(Player* this, PlayState* play) { if (this->unk_860 == 0) { func_80853080(this, play); } else if (this->unk_860 == 3) { - func_80835C58(play, this, func_80850E84, 0); + Player_SetupAction(play, this, Player_Action_80850E84, 0); Player_AnimChangeOnceMorph(play, this, &gPlayerAnim_link_fishing_fish_catch); } } -void func_80850E84(Player* this, PlayState* play) { +void Player_Action_80850E84(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime) && (this->unk_860 == 0)) { func_8083A098(this, &gPlayerAnim_link_fishing_fish_catch_end, play); } @@ -14596,11 +14597,11 @@ void func_808524B0(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_808524D0(PlayState* play, Player* this, CsCmdActorCue* cue) { sControlInput->press.button |= BTN_B; - func_80844E68(this, play); + Player_Action_80844E68(this, play); } void func_80852514(PlayState* play, Player* this, CsCmdActorCue* cue) { - func_80844E68(this, play); + Player_Action_80844E68(this, play); } void func_80852544(PlayState* play, Player* this, CsCmdActorCue* cue) { @@ -14619,9 +14620,9 @@ void func_80852564(PlayState* play, Player* this, CsCmdActorCue* cue) { } static void (*D_808551FC[])(Player* this, PlayState* play) = { - func_8084377C, - func_80843954, - func_80843A38, + Player_Action_8084377C, + Player_Action_80843954, + Player_Action_80843A38, }; void func_808525C0(PlayState* play, Player* this, CsCmdActorCue* cue) { @@ -14811,7 +14812,7 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cueUnused) { func_80852B4C(play, this, cue, &D_80854E50[ABS(csMode)]); } -void func_80852E14(Player* this, PlayState* play) { +void Player_Action_80852E14(Player* this, PlayState* play) { if (this->csMode != this->prevCsMode) { D_80858AA0 = this->skelAnime.moveFlags; @@ -14828,7 +14829,7 @@ void func_80852E14(Player* this, PlayState* play) { s32 Player_IsDroppingFish(PlayState* play) { Player* this = GET_PLAYER(play); - return (func_8084EFC0 == this->func_674) && (this->itemAction == PLAYER_IA_BOTTLE_FISH); + return (Player_Action_8084EFC0 == this->actionFunc) && (this->itemAction == PLAYER_IA_BOTTLE_FISH); } s32 Player_StartFishing(PlayState* play) { @@ -14843,7 +14844,7 @@ s32 func_80852F38(PlayState* play, Player* this) { if (!Player_InBlockingCsMode(play, this) && (this->invincibilityTimer >= 0) && !func_8008F128(this) && !(this->stateFlags3 & PLAYER_STATE3_7)) { func_80832564(play, this); - func_80835C58(play, this, func_8084F308, 0); + Player_SetupAction(play, this, Player_Action_8084F308, 0); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_re_dead_attack); this->stateFlags2 |= PLAYER_STATE2_7; func_80832224(this); @@ -14860,7 +14861,7 @@ s32 func_80852FFC(PlayState* play, Actor* actor, s32 csMode) { if (!Player_InBlockingCsMode(play, this)) { func_80832564(play, this); - func_80835C58(play, this, func_80852E14, 0); + Player_SetupAction(play, this, Player_Action_80852E14, 0); this->csMode = csMode; this->unk_448 = actor; func_80832224(this); @@ -14871,7 +14872,7 @@ s32 func_80852FFC(PlayState* play, Actor* actor, s32 csMode) { } void func_80853080(Player* this, PlayState* play) { - func_80835C58(play, this, func_80840BC8, 1); + Player_SetupAction(play, this, Player_Action_80840BC8, 1); Player_AnimChangeOnceMorph(play, this, func_80833338(this)); this->yaw = this->actor.shape.rot.y; } From 239a172114b891fffe7af21777dc5313f0de9441 Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Fri, 15 Sep 2023 00:41:10 +0200 Subject: [PATCH 08/29] remove the extra ``CS_CMD_STOP`` (#1535) --- src/code/code_800BB0A0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/code/code_800BB0A0.c b/src/code/code_800BB0A0.c index e525a0069..421f9a280 100644 --- a/src/code/code_800BB0A0.c +++ b/src/code/code_800BB0A0.c @@ -61,7 +61,7 @@ s32 func_800BB2B4(Vec3f* pos, f32* roll, f32* fov, CutsceneCameraPoint* point, s } *curFrame += advance; if (*curFrame >= 1) { - if (point[++*keyFrame + 3].continueFlag == CS_CMD_STOP) { + if (point[++*keyFrame + 3].continueFlag == CS_CAM_STOP) { *keyFrame = 0; ret = true; } From 9b207c356a66aec59815cbbd557f40d48d7cccdd Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Sat, 16 Sep 2023 22:16:58 +0100 Subject: [PATCH 09/29] Document Framebuffer Filters, VisCvg and VisZbuf (#1534) * Document z_viscvg and z_viszbuf Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> Co-authored-by: Dragorn421 * Few more notes * Some more notes Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * Review * Americanisation, FB RGB * Oops * Review * Minor documentation modifications * Header, base struct and enums Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * functions.h fix * Suggested changes, further adjustments to file doc comments * Further suggested changes, standardize capitalization of gfxP * g --------- Co-authored-by: Elliptic Ellipsis Co-authored-by: Dragorn421 --- include/functions.h | 41 ++--- include/z64.h | 26 +--- include/z64vis.h | 87 +++++++++++ spec | 4 +- src/code/PreRender.c | 80 +++++----- src/code/code_800ACE70.c | 97 ------------ src/code/code_800AD920.c | 60 -------- src/code/game.c | 101 ++++++------ src/code/graph.c | 8 +- src/code/z_play.c | 10 +- src/code/z_rcp.c | 24 +-- src/code/z_view.c | 6 +- src/code/z_viscvg.c | 145 ++++++++++++++++++ src/code/z_vismono.c | 46 +++--- src/code/z_viszbuf.c | 111 ++++++++++++++ src/overlays/actors/ovl_En_Fz/z_en_fz.h | 4 +- src/overlays/actors/ovl_En_Mag/z_en_mag.c | 30 ++-- src/overlays/gamestates/ovl_title/z_title.c | 14 +- .../misc/ovl_kaleido_scope/z_kaleido_debug.c | 6 +- 19 files changed, 532 insertions(+), 368 deletions(-) create mode 100644 include/z64vis.h delete mode 100644 src/code/code_800ACE70.c delete mode 100644 src/code/code_800AD920.c create mode 100644 src/code/z_viscvg.c create mode 100644 src/code/z_viszbuf.c diff --git a/include/functions.h b/include/functions.h index 8430208a2..73ec1d5c7 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1069,7 +1069,7 @@ void Gfx_SetupDL_37Opa(GraphicsContext* gfxCtx); Gfx* Gfx_SetupDL_39(Gfx* gfx); void Gfx_SetupDL_39Opa(GraphicsContext* gfxCtx); void Gfx_SetupDL_39Overlay(GraphicsContext* gfxCtx); -void Gfx_SetupDL_39Ptr(Gfx** gfxp); +void Gfx_SetupDL_39Ptr(Gfx** gfxP); void Gfx_SetupDL_40Opa(GraphicsContext* gfxCtx); void Gfx_SetupDL_41Opa(GraphicsContext* gfxCtx); void Gfx_SetupDL_47Xlu(GraphicsContext* gfxCtx); @@ -1081,8 +1081,8 @@ void Gfx_SetupDL_42Overlay(GraphicsContext* gfxCtx); void Gfx_SetupDL_27Xlu(GraphicsContext* gfxCtx); void Gfx_SetupDL_60NoCDXlu(GraphicsContext* gfxCtx); void Gfx_SetupDL_61Xlu(GraphicsContext* gfxCtx); -void Gfx_SetupDL_56Ptr(Gfx** gfxp); -Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height); +void Gfx_SetupDL_56Ptr(Gfx** gfxP); +Gfx* Gfx_BranchTexScroll(Gfx** gfxP, u32 x, u32 y, s32 width, s32 height); Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y); Gfx* Gfx_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height); Gfx* Gfx_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2, @@ -1187,7 +1187,7 @@ void View_Apply(View* view, s32 mask); s32 View_ApplyOrthoToOverlay(View* view); s32 View_ApplyPerspectiveToOverlay(View* view); s32 View_UpdateViewingMatrix(View* view); -s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxp); +s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP); s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ); void ViMode_LogPrint(OSViMode* osViMode); void ViMode_Configure(ViMode* viMode, s32 type, s32 tvType, s32 loRes, s32 antialiasOff, s32 modeN, s32 fb16Bit, @@ -1198,15 +1198,6 @@ void ViMode_Init(ViMode* viMode); void ViMode_Destroy(ViMode* viMode); void ViMode_ConfigureFeatures(ViMode* viMode, s32 viFeatures); void ViMode_Update(ViMode* viMode, Input* input); -void func_800ACE70(struct_801664F0* this); -void func_800ACE90(struct_801664F0* this); -void func_800ACE98(struct_801664F0* this, Gfx** gfxp); -void VisMono_Init(VisMono* this); -void VisMono_Destroy(VisMono* this); -void VisMono_Draw(VisMono* this, Gfx** gfxp); -void func_800AD920(struct_80166500* this); -void func_800AD950(struct_80166500* this); -void func_800AD958(struct_80166500* this, Gfx** gfxp); void PlayerCall_InitFuncPtrs(void); void TransitionTile_Destroy(TransitionTile* this); TransitionTile* TransitionTile_Init(TransitionTile* this, s32 cols, s32 rows); @@ -1305,15 +1296,15 @@ void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void PreRender_Init(PreRender* this); void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf); void PreRender_Destroy(PreRender* this); -void func_800C170C(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a); -void func_800C1AE8(PreRender* this, Gfx** gfxp, void* fbuf, void* fbufSave); -void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxp); -void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxp); -void PreRender_DrawCoverage(PreRender* this, Gfx** gfxp); -void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxp); -void func_800C213C(PreRender* this, Gfx** gfxp); -void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxp); -void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxp); +void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a); +void func_800C1AE8(PreRender* this, Gfx** gfxP, void* fbuf, void* fbufSave); +void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxP); +void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxP); +void PreRender_DrawCoverage(PreRender* this, Gfx** gfxP); +void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxP); +void func_800C213C(PreRender* this, Gfx** gfxP); +void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxP); +void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxP); void PreRender_ApplyFilters(PreRender* this); void AudioMgr_StopAllSfx(void); void func_800C3C80(AudioMgr* audioMgr); @@ -1323,8 +1314,8 @@ void AudioMgr_ThreadEntry(void* arg0); void AudioMgr_Unlock(AudioMgr* audioMgr); void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, Scheduler* sched, IrqMgr* irqMgr); void GameState_FaultPrint(void); -void GameState_SetFBFilter(Gfx** gfx); -void GameState_DrawInputDisplay(u16 input, Gfx** gfx); +void GameState_SetFBFilter(Gfx** gfxP); +void GameState_DrawInputDisplay(u16 input, Gfx** gfxP); void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx); void GameState_SetFrameBuffer(GraphicsContext* gfxCtx); void GameState_ReqPadData(GameState* gameState); @@ -1358,7 +1349,7 @@ void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line); Gfx* Graph_GfxPlusOne(Gfx* gfx); Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst); -void* Graph_DlistAlloc(Gfx** gfx, u32 size); +void* Graph_DlistAlloc(Gfx** gfxP, u32 size); ListAlloc* ListAlloc_Init(ListAlloc* this); void* ListAlloc_Alloc(ListAlloc* this, u32 size); void ListAlloc_Free(ListAlloc* this, void* data); diff --git a/include/z64.h b/include/z64.h index d0032b6ea..0e7698115 100644 --- a/include/z64.h +++ b/include/z64.h @@ -35,6 +35,7 @@ #include "z64skybox.h" #include "z64sram.h" #include "z64view.h" +#include "z64vis.h" #include "alignment.h" #include "seqcmd.h" #include "sequence.h" @@ -795,29 +796,4 @@ typedef struct { /* 0x84 */ u32 unk_84; } ViMode; // size = 0x88 -// Vis... -typedef struct { - /* 0x00 */ u32 type; - /* 0x04 */ u32 setScissor; - /* 0x08 */ Color_RGBA8_u32 color; - /* 0x0C */ Color_RGBA8_u32 envColor; -} struct_801664F0; // size = 0x10 - -typedef struct { - /* 0x00 */ u32 unk_00; - /* 0x04 */ u32 setScissor; - /* 0x08 */ Color_RGBA8_u32 primColor; - /* 0x0C */ Color_RGBA8_u32 envColor; - /* 0x10 */ u16* tlut; - /* 0x14 */ Gfx* dList; -} VisMono; // size = 0x18 - -// Vis... -typedef struct { - /* 0x00 */ u32 useRgba; - /* 0x04 */ u32 setScissor; - /* 0x08 */ Color_RGBA8_u32 primColor; - /* 0x08 */ Color_RGBA8_u32 envColor; -} struct_80166500; // size = 0x10 - #endif diff --git a/include/z64vis.h b/include/z64vis.h new file mode 100644 index 000000000..c88d6de48 --- /dev/null +++ b/include/z64vis.h @@ -0,0 +1,87 @@ +#ifndef Z64_VIS_H +#define Z64_VIS_H + +#include "ultra64.h" +#include "color.h" + +typedef enum { + /* 0 */ FB_FILTER_NONE, + /* 1 */ FB_FILTER_CVG_RGB, + /* 2 */ FB_FILTER_CVG_RGB_UNIFORM, + /* 3 */ FB_FILTER_CVG_ONLY, + /* 4 */ FB_FILTER_CVG_RGB_FOG, // Not recommended, easily overflows blender + /* 5 */ FB_FILTER_ZBUF_IA, + /* 6 */ FB_FILTER_ZBUF_RGBA, + /* 7 */ FB_FILTER_MONO +} FramebufferFilterType; + +typedef enum { + /* 0 */ VIS_NO_SETSCISSOR, + /* 1 */ VIS_SETSCISSOR +} VisScissorType; + +typedef struct { + /* 0x00 */ u32 type; + /* 0x04 */ u32 scissorType; + /* 0x08 */ Color_RGBA8_u32 primColor; + /* 0x0C */ Color_RGBA8_u32 envColor; +} Vis; // size = 0x10 + + + +/* Cvg: Coverage */ + +#define FB_FILTER_TO_CVG_TYPE(filter) (filter) + +typedef enum { + /* 0 */ VIS_CVG_TYPE_NONE = FB_FILTER_TO_CVG_TYPE(FB_FILTER_NONE), + /* 1 */ VIS_CVG_TYPE_CVG_RGB = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB), + /* 2 */ VIS_CVG_TYPE_CVG_RGB_UNIFORM = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB_UNIFORM), + /* 3 */ VIS_CVG_TYPE_CVG_ONLY = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_ONLY), + /* 4 */ VIS_CVG_TYPE_CVG_RGB_FOG = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB_FOG) +} VisCvgType; + +typedef struct { + /* 0x00 */ Vis vis; +} VisCvg; // size = 0x10 + +void VisCvg_Init(VisCvg* this); +void VisCvg_Destroy(VisCvg* this); +void VisCvg_Draw(VisCvg* this, Gfx** gfxP); + + + +/* Mono: Desaturation */ + +// Only one type + +typedef struct { + /* 0x00 */ Vis vis; + /* 0x10 */ u16* tlut; + /* 0x14 */ Gfx* dList; +} VisMono; // size = 0x18 + +void VisMono_Init(VisMono* this); +void VisMono_Destroy(VisMono* this); +void VisMono_Draw(VisMono* this, Gfx** gfxP); + + + +/* ZBuf: Z-Buffer */ + +#define FB_FILTER_TO_ZBUF_TYPE(filter) ((filter) - FB_FILTER_ZBUF_IA) + +typedef enum { + /* 0 */ VIS_ZBUF_TYPE_IA = FB_FILTER_TO_ZBUF_TYPE(FB_FILTER_ZBUF_IA), + /* 1 */ VIS_ZBUF_TYPE_RGBA = FB_FILTER_TO_ZBUF_TYPE(FB_FILTER_ZBUF_RGBA) +} VisZBufType; + +typedef struct { + /* 0x00 */ Vis vis; +} VisZBuf; // size = 0x10 + +void VisZBuf_Init(VisZBuf* this); +void VisZBuf_Destroy(VisZBuf* this); +void VisZBuf_Draw(VisZBuf* this, Gfx** gfxP); + +#endif diff --git a/spec b/spec index 375eb73dc..f4a3bffc3 100644 --- a/spec +++ b/spec @@ -366,9 +366,9 @@ beginseg include "build/data/unk_8012ABC0.data.o" include "build/src/code/z_view.o" include "build/src/code/z_vimode.o" - include "build/src/code/code_800ACE70.o" + include "build/src/code/z_viscvg.o" include "build/src/code/z_vismono.o" - include "build/src/code/code_800AD920.o" + include "build/src/code/z_viszbuf.o" include "build/src/code/z_vr_box.o" include "build/src/code/z_vr_box_draw.o" include "build/src/code/z_player_call.o" diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 0a1b0f2cf..fb40f6e38 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -43,19 +43,19 @@ void PreRender_Destroy(PreRender* this) { /** * Copies RGBA16 image `img` to `imgDst` * - * @param gfxp Display list pointer + * @param gfxP Display list pointer * @param img Image to copy from * @param imgDst Buffer to copy to */ -void PreRender_CopyImage(PreRender* this, Gfx** gfxp, void* img, void* imgDst) { +void PreRender_CopyImage(PreRender* this, Gfx** gfxP, void* img, void* imgDst) { Gfx* gfx; s32 rowsRemaining; s32 curRow; s32 nRows; LogUtils_CheckNullPointer("this", this, "../PreRender.c", 215); - LogUtils_CheckNullPointer("glistpp", gfxp, "../PreRender.c", 216); - gfx = *gfxp; + LogUtils_CheckNullPointer("glistpp", gfxP, "../PreRender.c", 216); + gfx = *gfxP; LogUtils_CheckNullPointer("glistp", gfx, "../PreRender.c", 218); gDPPipeSync(gfx++); @@ -101,22 +101,22 @@ void PreRender_CopyImage(PreRender* this, Gfx** gfxp, void* img, void* imgDst) { gDPPipeSync(gfx++); gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf); - *gfxp = gfx; + *gfxP = gfx; } /** * Copies part of `this->fbufSave` in the region (this->ulx, this->uly), (this->lrx, this->lry) to the same location in * `this->fbuf`. */ -void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxp) { +void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxP) { Gfx* gfx; s32 rowsRemaining; s32 curRow; s32 nRows; LogUtils_CheckNullPointer("this", this, "../PreRender.c", 278); - LogUtils_CheckNullPointer("glistpp", gfxp, "../PreRender.c", 279); - gfx = *gfxp; + LogUtils_CheckNullPointer("glistpp", gfxP, "../PreRender.c", 279); + gfx = *gfxP; LogUtils_CheckNullPointer("glistp", gfx, "../PreRender.c", 281); gDPPipeSync(gfx++); @@ -164,22 +164,22 @@ void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxp) { gDPPipeSync(gfx++); gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf); gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, this->width, this->height); - *gfxp = gfx; + *gfxP = gfx; } /** * Copies `buf` to `bufSave`, discarding the alpha channel and modulating the RGB channel by * the color ('r', 'g', 'b', 'a') */ -void func_800C170C(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a) { +void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a) { Gfx* gfx; s32 rowsRemaining; s32 curRow; s32 nRows; LogUtils_CheckNullPointer("this", this, "../PreRender.c", 343); - LogUtils_CheckNullPointer("glistpp", gfxp, "../PreRender.c", 344); - gfx = *gfxp; + LogUtils_CheckNullPointer("glistpp", gfxP, "../PreRender.c", 344); + gfx = *gfxP; LogUtils_CheckNullPointer("glistp", gfx, "../PreRender.c", 346); gDPPipeSync(gfx++); @@ -232,33 +232,33 @@ void func_800C170C(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 r, gDPPipeSync(gfx++); gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf); - *gfxp = gfx; + *gfxP = gfx; } /** * Copies `fbuf` to `fbufSave`, discarding the alpha channel and leaving the rgb channel unchanged */ -void func_800C1AE8(PreRender* this, Gfx** gfxp, void* fbuf, void* fbufSave) { - func_800C170C(this, gfxp, fbuf, fbufSave, 255, 255, 255, 255); +void func_800C1AE8(PreRender* this, Gfx** gfxP, void* fbuf, void* fbufSave) { + func_800C170C(this, gfxP, fbuf, fbufSave, 255, 255, 255, 255); } /** * Reads the coverage values stored in the RGBA16 format `img` with dimensions `this->width`, `this->height` and * converts it to an 8-bpp intensity image. * - * @param gfxp Display list pointer + * @param gfxP Display list pointer * @param img Image to read coverage from * @param cvgDst Buffer to store coverage into */ -void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxp, void* img, void* cvgDst) { +void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxP, void* img, void* cvgDst) { Gfx* gfx; s32 rowsRemaining; s32 curRow; s32 nRows; LogUtils_CheckNullPointer("this", this, "../PreRender.c", 422); - LogUtils_CheckNullPointer("glistpp", gfxp, "../PreRender.c", 423); - gfx = *gfxp; + LogUtils_CheckNullPointer("glistpp", gfxP, "../PreRender.c", 423); + gfx = *gfxP; LogUtils_CheckNullPointer("glistp", gfx, "../PreRender.c", 425); gDPPipeSync(gfx++); @@ -326,30 +326,30 @@ void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxp, void* img, void* // Reset the color image to the current framebuffer gDPPipeSync(gfx++); gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf); - *gfxp = gfx; + *gfxP = gfx; } /** * Saves zbuf to zbufSave */ -void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxp) { +void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxP) { LogUtils_CheckNullPointer("this->zbuf_save", this->zbufSave, "../PreRender.c", 481); LogUtils_CheckNullPointer("this->zbuf", this->zbuf, "../PreRender.c", 482); if ((this->zbufSave != NULL) && (this->zbuf != NULL)) { - PreRender_CopyImage(this, gfxp, this->zbuf, this->zbufSave); + PreRender_CopyImage(this, gfxP, this->zbuf, this->zbufSave); } } /** * Saves fbuf to fbufSave */ -void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxp) { +void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxP) { LogUtils_CheckNullPointer("this->fbuf_save", this->fbufSave, "../PreRender.c", 495); LogUtils_CheckNullPointer("this->fbuf", this->fbuf, "../PreRender.c", 496); if ((this->fbufSave != NULL) && (this->fbuf != NULL)) { - func_800C1AE8(this, gfxp, this->fbuf, this->fbufSave); + func_800C1AE8(this, gfxP, this->fbuf, this->fbufSave); } } @@ -357,8 +357,8 @@ void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxp) { * Fetches the coverage of the current framebuffer into an image of the same format as the current color image, storing * it over the framebuffer in memory. */ -void PreRender_FetchFbufCoverage(PreRender* this, Gfx** gfxp) { - Gfx* gfx = *gfxp; +void PreRender_FetchFbufCoverage(PreRender* this, Gfx** gfxP) { + Gfx* gfx = *gfxP; gDPPipeSync(gfx++); // Set the blend color to full white and set maximum depth. @@ -392,33 +392,33 @@ void PreRender_FetchFbufCoverage(PreRender* this, Gfx** gfxp) { gDPFillRectangle(gfx++, 0, 0, this->width, this->height); gDPPipeSync(gfx++); - *gfxp = gfx; + *gfxP = gfx; } /** * Draws the coverage of the current framebuffer `this->fbuf` to an I8 image at `this->cvgSave`. Overwrites * `this->fbuf` in the process. */ -void PreRender_DrawCoverage(PreRender* this, Gfx** gfxp) { - PreRender_FetchFbufCoverage(this, gfxp); +void PreRender_DrawCoverage(PreRender* this, Gfx** gfxP) { + PreRender_FetchFbufCoverage(this, gfxP); LogUtils_CheckNullPointer("this->cvg_save", this->cvgSave, "../PreRender.c", 532); if (this->cvgSave != NULL) { - PreRender_CoverageRgba16ToI8(this, gfxp, this->fbuf, this->cvgSave); + PreRender_CoverageRgba16ToI8(this, gfxP, this->fbuf, this->cvgSave); } } /** * Restores zbufSave to zbuf */ -void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxp) { - PreRender_CopyImage(this, gfxp, this->zbufSave, this->zbuf); +void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxP) { + PreRender_CopyImage(this, gfxP, this->zbufSave, this->zbuf); } /** * Draws a full-screen image to the current framebuffer, that sources the rgb channel from `this->fbufSave` and * the alpha channel from `this->cvgSave` modulated by environment color. */ -void func_800C213C(PreRender* this, Gfx** gfxp) { +void func_800C213C(PreRender* this, Gfx** gfxP) { Gfx* gfx; s32 rowsRemaining; s32 curRow; @@ -427,8 +427,8 @@ void func_800C213C(PreRender* this, Gfx** gfxp) { if (this->cvgSave != NULL) { LogUtils_CheckNullPointer("this", this, "../PreRender.c", 563); - LogUtils_CheckNullPointer("glistpp", gfxp, "../PreRender.c", 564); - gfx = *gfxp; + LogUtils_CheckNullPointer("glistpp", gfxP, "../PreRender.c", 564); + gfx = *gfxP; LogUtils_CheckNullPointer("glistp", gfx, "../PreRender.c", 566); gDPPipeSync(gfx++); @@ -482,23 +482,23 @@ void func_800C213C(PreRender* this, Gfx** gfxp) { } gDPPipeSync(gfx++); - *gfxp = gfx; + *gfxP = gfx; } } /** * Copies fbufSave to fbuf */ -void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxp) { - PreRender_CopyImage(this, gfxp, this->fbufSave, this->fbuf); +void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxP) { + PreRender_CopyImage(this, gfxP, this->fbufSave, this->fbuf); } /** * Copies part of `this->fbufSave` in the region (this->ulx, this->uly), (this->lrx, this->lry) to the same location in * `this->fbuf`. */ -void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxp) { - PreRender_CopyImageRegionImpl(this, gfxp); +void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxP) { + PreRender_CopyImageRegionImpl(this, gfxP); } /** diff --git a/src/code/code_800ACE70.c b/src/code/code_800ACE70.c deleted file mode 100644 index a7252904d..000000000 --- a/src/code/code_800ACE70.c +++ /dev/null @@ -1,97 +0,0 @@ -#include "global.h" - -// Note : This file is related to z_vismono, the original name was probably z_vis - -Gfx D_8012AC00[] = { - gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | G_RM_VISCVG | G_RM_VISCVG2), - gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), - gsDPPipeSync(), - gsDPSetBlendColor(0, 0, 0, 8), - gsSPEndDisplayList(), -}; - -Gfx D_8012AC28[] = { - gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | - GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM) | - GBL_c2(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM)), - gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), - gsSPEndDisplayList(), -}; - -Gfx D_8012AC40[] = { - gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | - GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | - GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), - - gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), - gsSPEndDisplayList(), -}; - -Gfx D_8012AC58[] = { - gsDPSetCombineMode(G_CC_PRIMITIVE, G_CC_PRIMITIVE), - gsDPSetOtherMode(G_AD_NOTPATTERN | G_CD_DISABLE | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2), - gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), - gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | - GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | - GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), - gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), - gsSPEndDisplayList(), -}; - -// Init -void func_800ACE70(struct_801664F0* this) { - this->type = 0; - this->setScissor = false; - this->color.r = 255; - this->color.g = 255; - this->color.b = 255; - this->color.a = 255; -} - -// Destroy -void func_800ACE90(struct_801664F0* this) { -} - -// Draw -void func_800ACE98(struct_801664F0* this, Gfx** gfxp) { - Gfx* gfx = *gfxp; - - gDPPipeSync(gfx++); - gDPSetPrimDepth(gfx++, 0xFFFF, 0xFFFF); - - if (this->setScissor == true) { - gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - } - - switch (this->type) { - case 1: - gSPDisplayList(gfx++, D_8012AC40); - break; - case 2: - gDPSetColor(gfx++, G_SETPRIMCOLOR, this->color.rgba); - gSPDisplayList(gfx++, D_8012AC58); - break; - case 3: - gDPSetColor(gfx++, G_SETBLENDCOLOR, this->color.rgba); - gSPDisplayList(gfx++, D_8012AC00); - break; - case 4: - gDPSetColor(gfx++, G_SETFOGCOLOR, this->color.rgba); - gSPDisplayList(gfx++, D_8012AC28); - break; - } - - gDPPipeSync(gfx++); - *gfxp = gfx; -} diff --git a/src/code/code_800AD920.c b/src/code/code_800AD920.c deleted file mode 100644 index 94479e164..000000000 --- a/src/code/code_800AD920.c +++ /dev/null @@ -1,60 +0,0 @@ -#include "global.h" - -// Note : This file is related to z_vismono, the original name was probably z_vis - -// z-buffer -extern u16 D_0E000000[]; - -// Init -void func_800AD920(struct_80166500* this) { - this->useRgba = false; - this->setScissor = false; - this->primColor.r = 255; - this->primColor.g = 255; - this->primColor.b = 255; - this->primColor.a = 255; - this->envColor.a = 255; - this->envColor.r = 0; - this->envColor.g = 0; - this->envColor.b = 0; -} - -// Destroy -void func_800AD950(struct_80166500* this) { -} - -// Draw -void func_800AD958(struct_80166500* this, Gfx** gfxp) { - Gfx* gfx = *gfxp; - u16* tex = D_0E000000; - s32 fmt = !this->useRgba ? G_IM_FMT_IA : G_IM_FMT_RGBA; - s32 y; - s32 height = 6; - - gDPPipeSync(gfx++); - if (this->setScissor == true) { - gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - } - - gDPSetOtherMode(gfx++, - G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | G_RM_OPA_SURF | G_RM_OPA_SURF2); - gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT); - - gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba); - gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba); - - for (y = 0; y <= SCREEN_HEIGHT - height; y += height) { - gDPLoadTextureBlock(gfx++, tex, fmt, G_IM_SIZ_16b, SCREEN_WIDTH, height, 0, G_TX_NOMIRROR | G_TX_CLAMP, - G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - - gSPTextureRectangle(gfx++, 0, y << 2, SCREEN_WIDTH << 2, (y + height) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, - 1 << 10); - tex += SCREEN_WIDTH * height; - } - - gDPPipeSync(gfx++); - *gfxp = gfx; -} diff --git a/src/code/game.c b/src/code/game.c index 10fdcbefd..183a18b46 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -2,9 +2,9 @@ #include "terminal.h" SpeedMeter D_801664D0; -struct_801664F0 D_801664F0; -struct_80166500 D_80166500; -VisMono sMonoColors; +VisCvg sVisCvg; +VisZBuf sVisZBuf; +VisMono sVisMono; ViMode sViMode; FaultClient sGameFaultClient; u16 sLastButtonPressed; @@ -22,40 +22,43 @@ void GameState_FaultPrint(void) { } } -void GameState_SetFBFilter(Gfx** gfx) { - Gfx* gfxP = *gfx; +void GameState_SetFBFilter(Gfx** gfxP) { + Gfx* gfx = *gfxP; - if ((R_FB_FILTER_TYPE > 0) && (R_FB_FILTER_TYPE < 5)) { - D_801664F0.type = R_FB_FILTER_TYPE; - D_801664F0.color.r = R_FB_FILTER_PRIM_COLOR(0); - D_801664F0.color.g = R_FB_FILTER_PRIM_COLOR(1); - D_801664F0.color.b = R_FB_FILTER_PRIM_COLOR(2); - D_801664F0.color.a = R_FB_FILTER_A; - func_800ACE98(&D_801664F0, &gfxP); - } else if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) { - D_80166500.useRgba = (R_FB_FILTER_TYPE == 6); - D_80166500.primColor.r = R_FB_FILTER_PRIM_COLOR(0); - D_80166500.primColor.g = R_FB_FILTER_PRIM_COLOR(1); - D_80166500.primColor.b = R_FB_FILTER_PRIM_COLOR(2); - D_80166500.primColor.a = R_FB_FILTER_A; - D_80166500.envColor.r = R_FB_FILTER_ENV_COLOR(0); - D_80166500.envColor.g = R_FB_FILTER_ENV_COLOR(1); - D_80166500.envColor.b = R_FB_FILTER_ENV_COLOR(2); - D_80166500.envColor.a = R_FB_FILTER_A; - func_800AD958(&D_80166500, &gfxP); - } else if (R_FB_FILTER_TYPE == 7) { - sMonoColors.unk_00 = 0; - sMonoColors.primColor.r = R_FB_FILTER_PRIM_COLOR(0); - sMonoColors.primColor.g = R_FB_FILTER_PRIM_COLOR(1); - sMonoColors.primColor.b = R_FB_FILTER_PRIM_COLOR(2); - sMonoColors.primColor.a = R_FB_FILTER_A; - sMonoColors.envColor.r = R_FB_FILTER_ENV_COLOR(0); - sMonoColors.envColor.g = R_FB_FILTER_ENV_COLOR(1); - sMonoColors.envColor.b = R_FB_FILTER_ENV_COLOR(2); - sMonoColors.envColor.a = R_FB_FILTER_A; - VisMono_Draw(&sMonoColors, &gfxP); + if ((R_FB_FILTER_TYPE >= FB_FILTER_CVG_RGB) && (R_FB_FILTER_TYPE <= FB_FILTER_CVG_RGB_FOG)) { + // Visualize coverage + sVisCvg.vis.type = FB_FILTER_TO_CVG_TYPE(R_FB_FILTER_TYPE); + sVisCvg.vis.primColor.r = R_FB_FILTER_PRIM_COLOR(0); + sVisCvg.vis.primColor.g = R_FB_FILTER_PRIM_COLOR(1); + sVisCvg.vis.primColor.b = R_FB_FILTER_PRIM_COLOR(2); + sVisCvg.vis.primColor.a = R_FB_FILTER_A; + VisCvg_Draw(&sVisCvg, &gfx); + } else if ((R_FB_FILTER_TYPE == FB_FILTER_ZBUF_IA) || (R_FB_FILTER_TYPE == FB_FILTER_ZBUF_RGBA)) { + // Visualize z-buffer + sVisZBuf.vis.type = (R_FB_FILTER_TYPE == FB_FILTER_ZBUF_RGBA); + sVisZBuf.vis.primColor.r = R_FB_FILTER_PRIM_COLOR(0); + sVisZBuf.vis.primColor.g = R_FB_FILTER_PRIM_COLOR(1); + sVisZBuf.vis.primColor.b = R_FB_FILTER_PRIM_COLOR(2); + sVisZBuf.vis.primColor.a = R_FB_FILTER_A; + sVisZBuf.vis.envColor.r = R_FB_FILTER_ENV_COLOR(0); + sVisZBuf.vis.envColor.g = R_FB_FILTER_ENV_COLOR(1); + sVisZBuf.vis.envColor.b = R_FB_FILTER_ENV_COLOR(2); + sVisZBuf.vis.envColor.a = R_FB_FILTER_A; + VisZBuf_Draw(&sVisZBuf, &gfx); + } else if (R_FB_FILTER_TYPE == FB_FILTER_MONO) { + // Monochrome filter + sVisMono.vis.type = 0; + sVisMono.vis.primColor.r = R_FB_FILTER_PRIM_COLOR(0); + sVisMono.vis.primColor.g = R_FB_FILTER_PRIM_COLOR(1); + sVisMono.vis.primColor.b = R_FB_FILTER_PRIM_COLOR(2); + sVisMono.vis.primColor.a = R_FB_FILTER_A; + sVisMono.vis.envColor.r = R_FB_FILTER_ENV_COLOR(0); + sVisMono.vis.envColor.g = R_FB_FILTER_ENV_COLOR(1); + sVisMono.vis.envColor.b = R_FB_FILTER_ENV_COLOR(2); + sVisMono.vis.envColor.a = R_FB_FILTER_A; + VisMono_Draw(&sVisMono, &gfx); } - *gfx = gfxP; + *gfxP = gfx; } void func_800C4344(GameState* gameState) { @@ -110,7 +113,7 @@ void func_800C4344(GameState* gameState) { } } -void GameState_DrawInputDisplay(u16 input, Gfx** gfx) { +void GameState_DrawInputDisplay(u16 input, Gfx** gfxP) { static const u16 sInpDispBtnColors[] = { GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1), @@ -120,10 +123,10 @@ void GameState_DrawInputDisplay(u16 input, Gfx** gfx) { GPACK_RGBA5551(0, 0, 255, 1), }; s32 i, j, k; - Gfx* gfxP = *gfx; + Gfx* gfx = *gfxP; - gDPPipeSync(gfxP++); - gDPSetOtherMode(gfxP++, + gDPPipeSync(gfx++); + gDPSetOtherMode(gfx++, G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_FILL | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); @@ -131,14 +134,14 @@ void GameState_DrawInputDisplay(u16 input, Gfx** gfx) { for (i = 0; i < 16; i++) { j = i; if (input & (1 << i)) { - gDPSetFillColor(gfxP++, (sInpDispBtnColors[i] << 0x10) | sInpDispBtnColors[i]); + gDPSetFillColor(gfx++, (sInpDispBtnColors[i] << 0x10) | sInpDispBtnColors[i]); k = i + 1; - gDPFillRectangle(gfxP++, (j * 4) + 226, 220, (k * 4) + 225, 223); - gDPPipeSync(gfxP++); + gDPFillRectangle(gfx++, (j * 4) + 226, 220, (k * 4) + 225, 223); + gDPPipeSync(gfx++); } } - *gfx = gfxP; + *gfxP = gfx; } void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { @@ -413,9 +416,9 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g startTime = endTime; LogUtils_CheckNullPointer("this->cleanup", gameState->destroy, "../game.c", 1088); - func_800ACE70(&D_801664F0); - func_800AD920(&D_80166500); - VisMono_Init(&sMonoColors); + VisCvg_Init(&sVisCvg); + VisZBuf_Init(&sVisZBuf); + VisMono_Init(&sVisMono); if (R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) { ViMode_Init(&sViMode); } @@ -443,9 +446,9 @@ void GameState_Destroy(GameState* gameState) { } Rumble_Destroy(); SpeedMeter_Destroy(&D_801664D0); - func_800ACE90(&D_801664F0); - func_800AD950(&D_80166500); - VisMono_Destroy(&sMonoColors); + VisCvg_Destroy(&sVisCvg); + VisZBuf_Destroy(&sVisZBuf); + VisMono_Destroy(&sVisMono); if (R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) { ViMode_Destroy(&sViMode); } diff --git a/src/code/graph.c b/src/code/graph.c index 3d53f891c..fd79efac5 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -513,17 +513,17 @@ Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst) { return dst; } -void* Graph_DlistAlloc(Gfx** gfx, u32 size) { +void* Graph_DlistAlloc(Gfx** gfxP, u32 size) { u8* ptr; Gfx* dst; size = ALIGN8(size); - ptr = (u8*)(*gfx + 1); + ptr = (u8*)(*gfxP + 1); dst = (Gfx*)(ptr + size); - gSPBranchList(*gfx, dst); + gSPBranchList(*gfxP, dst); - *gfx = dst; + *gfxP = dst; return ptr; } diff --git a/src/code/z_play.c b/src/code/z_play.c index c1840037e..c4d891548 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -8,7 +8,7 @@ Input* D_8012D1F8 = NULL; TransitionTile sTransitionTile; s32 gTransitionTileState; -VisMono D_80161498; +VisMono sPlayVisMono; Color_RGBA8_u32 gVisMonoColor; FaultClient D_801614B8; s16 sTransitionFillTimer; @@ -199,7 +199,7 @@ void Play_Destroy(GameState* thisx) { Letterbox_Destroy(); TransitionFade_Destroy(&this->transitionFadeFlash); - VisMono_Destroy(&D_80161498); + VisMono_Destroy(&sPlayVisMono); if (gSaveContext.save.linkAge != this->linkAgeOnLoad) { Inventory_SwapAgeEquipment(); @@ -390,7 +390,7 @@ void Play_Init(GameState* thisx) { TransitionFade_SetType(&this->transitionFadeFlash, TRANS_INSTANCE_TYPE_FADE_FLASH); TransitionFade_SetColor(&this->transitionFadeFlash, RGBA8(160, 160, 160, 255)); TransitionFade_Start(&this->transitionFadeFlash); - VisMono_Init(&D_80161498); + VisMono_Init(&sPlayVisMono); gVisMonoColor.a = 0; CutsceneFlags_UnsetAll(this); @@ -1103,8 +1103,8 @@ void Play_Draw(PlayState* this) { TransitionFade_Draw(&this->transitionFadeFlash, &gfxP); if (gVisMonoColor.a > 0) { - D_80161498.primColor.rgba = gVisMonoColor.rgba; - VisMono_Draw(&D_80161498, &gfxP); + sPlayVisMono.vis.primColor.rgba = gVisMonoColor.rgba; + VisMono_Draw(&sPlayVisMono, &gfxP); } gSPEndDisplayList(gfxP++); diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index aa4d56998..3b9a85098 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -907,8 +907,8 @@ Gfx* Gfx_SetupDL(Gfx* gfx, u32 i) { return Gfx_SetupDLImpl(gfx, i); } -void Gfx_SetupDLAtPtr(Gfx** gfxp, u32 i) { - *gfxp = Gfx_SetupDL(*gfxp, i); +void Gfx_SetupDLAtPtr(Gfx** gfxP, u32 i) { + *gfxP = Gfx_SetupDL(*gfxP, i); } Gfx* Gfx_SetupDL_57(Gfx* gfx) { @@ -1193,11 +1193,11 @@ void Gfx_SetupDL_39Overlay(GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1811); } -void Gfx_SetupDL_39Ptr(Gfx** gfxp) { - Gfx* gfx = *gfxp; +void Gfx_SetupDL_39Ptr(Gfx** gfxP) { + Gfx* gfx = *gfxP; gSPDisplayList(gfx++, sSetupDL[SETUPDL_39]); - *gfxp = gfx; + *gfxP = gfx; } void Gfx_SetupDL_40Opa(GraphicsContext* gfxCtx) { @@ -1345,12 +1345,12 @@ void Gfx_SetupDL_56Opa(GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2090); } -void Gfx_SetupDL_56Ptr(Gfx** gfxp) { - Gfx* gfx = *gfxp; +void Gfx_SetupDL_56Ptr(Gfx** gfxP) { + Gfx* gfx = *gfxP; gSPDisplayList(gfx++, sSetupDL[SETUPDL_56]); - *gfxp = gfx; + *gfxP = gfx; } void Gfx_SetupDL_59Opa(GraphicsContext* gfxCtx) { @@ -1361,8 +1361,8 @@ void Gfx_SetupDL_59Opa(GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2116); } -Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height) { - Gfx* displayList = Graph_DlistAlloc(gfxp, 3 * sizeof(Gfx)); +Gfx* Gfx_BranchTexScroll(Gfx** gfxP, u32 x, u32 y, s32 width, s32 height) { + Gfx* displayList = Graph_DlistAlloc(gfxP, 3 * sizeof(Gfx)); gDPTileSync(displayList); gDPSetTileSize(displayList + 1, G_TX_RENDERTILE, x, y, x + ((width - 1) << 2), y + ((height - 1) << 2)); @@ -1371,8 +1371,8 @@ Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height) { return displayList; } -Gfx* func_80094E54(Gfx** gfxp, u32 x, u32 y) { - return Gfx_BranchTexScroll(gfxp, x, y, 0, 0); +Gfx* func_80094E54(Gfx** gfxP, u32 x, u32 y) { + return Gfx_BranchTexScroll(gfxP, x, y, 0, 0); } Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y) { diff --git a/src/code/z_view.c b/src/code/z_view.c index 328441150..117957d1b 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -539,8 +539,8 @@ s32 View_UpdateViewingMatrix(View* view) { return 1; } -s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxp) { - Gfx* gfx = *gfxp; +s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP) { + Gfx* gfx = *gfxP; GraphicsContext* gfxCtx = view->gfxCtx; s32 width; s32 height; @@ -606,7 +606,7 @@ s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxp) { } view->flags = 0; - *gfxp = gfx; + *gfxP = gfx; return 1; } diff --git a/src/code/z_viscvg.c b/src/code/z_viscvg.c new file mode 100644 index 000000000..9caf39a3f --- /dev/null +++ b/src/code/z_viscvg.c @@ -0,0 +1,145 @@ +/** + * @file z_viscvg.c + * + * This file implements full-screen frame buffer effects involving the visualization of Coverage in various ways. + * + * Coverage is roughly how much of a pixel is covered by a primitive; the final coverage for a frame is stored in the + * color image alpha component where it is used for antialiasing, see PreRender.c and §15 of the programming manual for + * details. + * + * To understand this file, it is helpful to remember that A_MEM is essentially synonymous with coverage, and that + * `GBL_c1/2(p, a, m, b)` usually represents the RDP blender calculation `(p * a + m * b)`. + * Note the division step that is often included in the blender calculation is omitted; the division is skipped if + * force blending (FORCE_BL) is set, which is the case for all render modes used in this file. + * + * Coverage is full when not on an edge, while on an edge it is usually lower. Since coverage is treated as an alpha + * value, edges of primitives where coverage is lower will show up darker than primitive interiors in all of the + * available modes. + * + * Coverage is abbreviated to "cvg"; "FB RGB" ("framebuffer red/green/blue") is the color the pixel originally had + * before the filter is applied. + */ + +#include "global.h" + +/** + * Draws only coverage: does not retain any of the original pixel RGB, primColor is used as background color. + */ +Gfx sCoverageOnlyDL[] = { + gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | G_RM_VISCVG | G_RM_VISCVG2), + // (blendColor RGB) * (cvg) + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), + gsDPPipeSync(), + gsDPSetBlendColor(0, 0, 0, 8), + gsSPEndDisplayList(), +}; + +/** + * Draws fog + coverage * RGB of pixels + * + * @bug This easily overflows the blender because the fog value is added to the coverage value. + */ +Gfx sCoverageRGBFogDL[] = { + gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | + GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM) | + GBL_c2(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM)), + // (fog RGB) * (fog alpha) + (FB RGB) * (cvg) + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), + gsSPEndDisplayList(), +}; + +/** + * Draws coverage and RGB of pixels + */ +Gfx sCoverageRGBDL[] = { + gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | + GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | + GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), + // (FB RGB) * (cvg) + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), + gsSPEndDisplayList(), +}; + +/** + * Two stage filtering: + * + * 1. Apply a uniform color filter by transparently blending primColor with original frame. The "cloud surface" + * RenderMode is used to preserve the coverage for the second stage. + * 2. Second half is the same as `sCoverageRGBDL`'s, i.e. (RGB from stage 1) * cvg + */ +Gfx sCoverageRGBUniformDL[] = { + gsDPSetCombineMode(G_CC_PRIMITIVE, G_CC_PRIMITIVE), + gsDPSetOtherMode(G_AD_NOTPATTERN | G_CD_DISABLE | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2), + // stage 1 color = (primColor RGB) * (primColor Alpha) + (FB RGB) * (1 - primColor Alpha) + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), + + gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | + GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | + GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), + // final color = (stage 1 RGB) * (cvg) + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), + gsSPEndDisplayList(), +}; + +void VisCvg_Init(VisCvg* this) { + this->vis.type = FB_FILTER_NONE; + this->vis.scissorType = VIS_NO_SETSCISSOR; + this->vis.primColor.r = 255; + this->vis.primColor.g = 255; + this->vis.primColor.b = 255; + this->vis.primColor.a = 255; +} + +void VisCvg_Destroy(VisCvg* this) { +} + +void VisCvg_Draw(VisCvg* this, Gfx** gfxP) { + Gfx* gfx = *gfxP; + + gDPPipeSync(gfx++); + gDPSetPrimDepth(gfx++, 0xFFFF, 0xFFFF); + + if (this->vis.scissorType == VIS_SETSCISSOR) { + gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + } + + switch (this->vis.type) { + case FB_FILTER_CVG_RGB: + gSPDisplayList(gfx++, sCoverageRGBDL); + break; + + case FB_FILTER_CVG_RGB_UNIFORM: + // Set primitive color for uniform color filter in custom RenderMode + gDPSetColor(gfx++, G_SETPRIMCOLOR, this->vis.primColor.rgba); + gSPDisplayList(gfx++, sCoverageRGBUniformDL); + break; + + case FB_FILTER_CVG_ONLY: + // Set background color for G_RM_VISCVG + gDPSetColor(gfx++, G_SETBLENDCOLOR, this->vis.primColor.rgba); + gSPDisplayList(gfx++, sCoverageOnlyDL); + break; + + case FB_FILTER_CVG_RGB_FOG: + // Set fog color for custom RenderMode, needs to be close to 0 to not overflow + gDPSetColor(gfx++, G_SETFOGCOLOR, this->vis.primColor.rgba); + gSPDisplayList(gfx++, sCoverageRGBFogDL); + break; + + default: + break; + } + + gDPPipeSync(gfx++); + *gfxP = gfx; +} diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index de065988e..8f0a5653f 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -1,13 +1,19 @@ /** - * Color frame buffer effect to desaturate the colors. + * @file z_vismono.c + * + * This file implements a full-screen framebuffer effect for desaturating the contents of the framebuffer image. + * + * Broadly, this effect is achieved by reinterpreting the contents of the RGBA16 color image as indices into an IA16 + * color palette that converts each color into the desaturated equivalent. More precise details can be found in inline + * comments. */ #include "global.h" // Height of the fragments the color frame buffer (CFB) is split into. // It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into -// the half of tmem (0x800 bytes) dedicated to color-indexed data. -#define VISMONO_CFBFRAG_HEIGHT (0x800 / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES)) +// the half of TMEM dedicated to color-indexed data. +#define VISMONO_CFBFRAG_HEIGHT ((TMEM_SIZE / 2) / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES)) // Maximum size of the dlist written by `VisMono_DesaturateDList`. // `VisMono_DesaturateDList` consistently uses `VISMONO_DLSIZE - 2` double words, so this can be 2 less. @@ -26,16 +32,16 @@ extern u16 D_0F000000[]; void VisMono_Init(VisMono* this) { bzero(this, sizeof(VisMono)); - this->unk_00 = 0; - this->setScissor = false; - this->primColor.r = 255; - this->primColor.g = 255; - this->primColor.b = 255; - this->primColor.a = 255; - this->envColor.r = 0; - this->envColor.g = 0; - this->envColor.b = 0; - this->envColor.a = 0; + this->vis.type = 0; + this->vis.scissorType = VIS_NO_SETSCISSOR; + this->vis.primColor.r = 255; + this->vis.primColor.g = 255; + this->vis.primColor.b = 255; + this->vis.primColor.a = 255; + this->vis.envColor.r = 0; + this->vis.envColor.g = 0; + this->vis.envColor.b = 0; + this->vis.envColor.a = 0; } void VisMono_Destroy(VisMono* this) { @@ -95,6 +101,8 @@ Gfx* VisMono_DesaturateDList(VisMono* this, Gfx* gfx) { // Set texel 1 to be a CI8 image with width `SCREEN_WIDTH * 2` and height `VISMONO_CFBFRAG_HEIGHT` // Its position in texture image space is shifted along +S by 1 + // Note the palette index for this tile has also been incremented from 0 to 1, however the palette index is + // ignored for CI8 texture sampling. gDPSetTile(gfx++, G_IM_FMT_CI, G_IM_SIZ_8b, SCREEN_WIDTH * 2 * G_IM_SIZ_8b_LINE_BYTES / 8, 0x0, 1, 1, G_TX_NOMIRROR | G_TX_CLAMP, 0, 0, G_TX_NOMIRROR | G_TX_CLAMP, 0, 0); gDPSetTileSize(gfx++, 1, 1 << 2, 0, (SCREEN_WIDTH * 2) << 2, (VISMONO_CFBFRAG_HEIGHT - 1) << 2); @@ -129,8 +137,8 @@ Gfx* VisMono_DesaturateDList(VisMono* this, Gfx* gfx) { return gfx; } -void VisMono_Draw(VisMono* this, Gfx** gfxp) { - Gfx* gfx = *gfxp; +void VisMono_Draw(VisMono* this, Gfx** gfxP) { + Gfx* gfx = *gfxP; u16* tlut; Gfx* dList; Gfx* dListEnd; @@ -159,12 +167,12 @@ void VisMono_Draw(VisMono* this, Gfx** gfxp) { gDPPipeSync(gfx++); - if (this->setScissor == true) { + if (this->vis.scissorType == VIS_SETSCISSOR) { gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } - gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba); - gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba); + gDPSetColor(gfx++, G_SETPRIMCOLOR, this->vis.primColor.rgba); + gDPSetColor(gfx++, G_SETENVCOLOR, this->vis.envColor.rgba); gDPLoadTLUT_pal256(gfx++, tlut); @@ -172,7 +180,7 @@ void VisMono_Draw(VisMono* this, Gfx** gfxp) { gDPPipeSync(gfx++); - *gfxp = gfx; + *gfxP = gfx; } void VisMono_DrawOld(VisMono* this) { diff --git a/src/code/z_viszbuf.c b/src/code/z_viszbuf.c new file mode 100644 index 000000000..90080b79c --- /dev/null +++ b/src/code/z_viszbuf.c @@ -0,0 +1,111 @@ +/** + * @file z_viszbuf.c + * + * This file implements a full-screen framebuffer effect for visualizing the z-buffer (AKA depth buffer), using either + * cycling RGBA or a single fading color. + * + * This is done by reading the z-buffer as if it were a color image, the format of which is specified by the selected + * vis type: + * - VIS_ZBUF_TYPE_IA : Produces a monotonic fade from primColor to envColor as depth increases. + * - VIS_ZBUF_TYPE_RGBA : Produces vibrant almost-periodic-looking bands. + * + * In both cases this occurs because of the format the depth information takes: it is 18-bit, and is a nonnegative + * floating-point number with + * bbb mmmmmmmmmmm dd|dd + * exponent mantissa dz value (only first 16 bits visible to CPU, the least significant 2 bits of dz are ignored) + * + * Reading z-buffer as IA16: + * bbbmmmmm mmmmmmdd + * iiiiiiii aaaaaaaa + * + * Since floating-point numbers of this format have the same ordering as their binary/hex representation, increasing + * the depth also increases the intensity in the IA16 representation and hence the interpolation parameter used to + * combine primColor and envColor. The alpha is ignored by the RenderMode. + * + * Reading z-buffer as RGBA16: + * bbbmm mmmmm mmmmd d + * rrrrr ggggg bbbbb a + * + * The red increases monotonically with the depth. The significant visible oscillation is the green component, because + * it rolls over every time the second-most-significant bit of the mantissa increments. The blue component oscillates + * too rapidly to be particularly visible (it rolls over when the 7th-most-significant bit increments). The alpha is + * again ignored by the RenderMode. + */ + +#include "global.h" + +// Height of the fragments the z-buffer is split into. +// It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into TMEM. +#define VISZBUF_ZBUFFRAG_HEIGHT (TMEM_SIZE / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES)) + +// z-buffer +extern u16 D_0E000000[]; + +/** + * Initialise to IA type with white and black as default colors. + */ +void VisZBuf_Init(VisZBuf* this) { + this->vis.type = VIS_ZBUF_TYPE_IA; + this->vis.scissorType = VIS_NO_SETSCISSOR; + this->vis.primColor.r = 255; + this->vis.primColor.g = 255; + this->vis.primColor.b = 255; + this->vis.primColor.a = 255; + this->vis.envColor.a = 255; + this->vis.envColor.r = 0; + this->vis.envColor.g = 0; + this->vis.envColor.b = 0; +} + +void VisZBuf_Destroy(VisZBuf* this) { +} + +void VisZBuf_Draw(VisZBuf* this, Gfx** gfxP) { + Gfx* gfx = *gfxP; + u16* zbufFrag = D_0E000000; + s32 fmt; + s32 y; + s32 height; + + if (this->vis.type == VIS_ZBUF_TYPE_IA) { + fmt = G_IM_FMT_IA; + } else { // VIS_ZBUF_TYPE_RGBA + fmt = G_IM_FMT_RGBA; + } + + height = VISZBUF_ZBUFFRAG_HEIGHT; + + gDPPipeSync(gfx++); + // Scissoring is only required if the scissor has not been set prior. + if (this->vis.scissorType == VIS_SETSCISSOR) { + gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + } + + // No palette so can use all of TMEM. + // G_RM_OPA_SURF discards all information previously in the pixel, and the current alpha, leaving only the color + // from this filter. + gDPSetOtherMode(gfx++, + G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | G_RM_OPA_SURF | G_RM_OPA_SURF2); + + // LERP between primColor and envColor in 1-cycle mode using the z-buffer value. + gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT); + gDPSetColor(gfx++, G_SETPRIMCOLOR, this->vis.primColor.rgba); + gDPSetColor(gfx++, G_SETENVCOLOR, this->vis.envColor.rgba); + + for (y = 0; y <= SCREEN_HEIGHT - height; y += height) { + // Load a few lines of the z-buffer, as many as can fit in TMEM at once. + gDPLoadTextureBlock(gfx++, zbufFrag, fmt, G_IM_SIZ_16b, SCREEN_WIDTH, height, 0, G_TX_NOMIRROR | G_TX_CLAMP, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + // Overwrite them with the calculated colors. + gSPTextureRectangle(gfx++, 0, y << 2, SCREEN_WIDTH << 2, (y + height) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, + 1 << 10); + zbufFrag += SCREEN_WIDTH * height; + } + + gDPPipeSync(gfx++); + *gfxP = gfx; +} diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.h b/src/overlays/actors/ovl_En_Fz/z_en_fz.h index 5c54720f2..dafada3d2 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.h +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.h @@ -16,7 +16,7 @@ typedef struct { /* 0x0010 */ Vec3f velocity; /* 0x001C */ Vec3f accel; /* 0x0028 */ char unk_28[0x4]; - /* 0x002C */ s16 primAlpha; // transparency in RGBA colour system + /* 0x002C */ s16 primAlpha; // transparency in RGBA color system /* 0x002E */ s16 primAlphaState; // 0: increasing (more opaque) 1: decreasing (more transparent) 2: collision /* 0x0030 */ f32 xyScale; /* 0x0034 */ f32 xyScaleTarget; @@ -42,7 +42,7 @@ typedef struct EnFz { /* 0x024C */ f32 iceSmokeFreezingSpawnHeight; // Height for Ice Smoke Spawn, only when freezing /* 0x0250 */ f32 unusedFloat; // Set to 135.0f /* 0x0254 */ f32 speedXZ; // Set to 4.0f when moving - /* 0x0258 */ u32 envAlpha; // transparency in RGBA colour system + /* 0x0258 */ u32 envAlpha; // transparency in RGBA color system /* 0x025C */ u16 unusedNum1; // Only set to 0 /* 0x025E */ u16 unusedNum2; // Set to either 0 when hidden or 4000 when growing /* 0x0260 */ u8 state; // 0 (hidden) 1 (growning/shrinking) 2 (full size) 3 (melting from fire) diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 60b1867d6..164252b17 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -262,9 +262,9 @@ void EnMag_Update(Actor* thisx, PlayState* play) { } } -void EnMag_DrawTextureI8(Gfx** gfxp, void* texture, s16 texWidth, s16 texHeight, s16 rectLeft, s16 rectTop, +void EnMag_DrawTextureI8(Gfx** gfxP, void* texture, s16 texWidth, s16 texHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy) { - Gfx* gfx = *gfxp; + Gfx* gfx = *gfxP; gDPLoadTextureBlock(gfx++, texture, G_IM_FMT_I, G_IM_SIZ_8b, texWidth, texHeight, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); @@ -272,13 +272,13 @@ void EnMag_DrawTextureI8(Gfx** gfxp, void* texture, s16 texWidth, s16 texHeight, gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, dsdx, dtdy); - *gfxp = gfx; + *gfxP = gfx; } -void EnMag_DrawEffectTextures(Gfx** gfxp, void* maskTex, void* effectTex, s16 maskWidth, s16 maskHeight, +void EnMag_DrawEffectTextures(Gfx** gfxP, void* maskTex, void* effectTex, s16 maskWidth, s16 maskHeight, s16 effectWidth, s16 effectHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy, u16 shifts, u16 shiftt, u16 flag, EnMag* this) { - Gfx* gfx = *gfxp; + Gfx* gfx = *gfxP; gDPLoadMultiBlock_4b(gfx++, maskTex, 0x0000, G_TX_RENDERTILE, G_IM_FMT_I, maskWidth, maskHeight, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, @@ -294,11 +294,11 @@ void EnMag_DrawEffectTextures(Gfx** gfxp, void* maskTex, void* effectTex, s16 ma gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, dsdx, dtdy); - *gfxp = gfx; + *gfxP = gfx; } -void EnMag_DrawImageRGBA32(Gfx** gfxp, s16 centerX, s16 centerY, u8* source, u32 width, u32 height) { - Gfx* gfx = *gfxp; +void EnMag_DrawImageRGBA32(Gfx** gfxP, s16 centerX, s16 centerY, u8* source, u32 width, u32 height) { + Gfx* gfx = *gfxP; u8* curTexture; s32 textureCount; u32 rectLeft; @@ -353,11 +353,11 @@ void EnMag_DrawImageRGBA32(Gfx** gfxp, s16 centerX, s16 centerY, u8* source, u32 } } - *gfxp = gfx; + *gfxP = gfx; } -void EnMag_DrawCharTexture(Gfx** gfxp, u8* texture, s32 rectLeft, s32 rectTop) { - Gfx* gfx = *gfxp; +void EnMag_DrawCharTexture(Gfx** gfxP, u8* texture, s32 rectLeft, s32 rectTop) { + Gfx* gfx = *gfxP; YREG(0) = 1024.0f / (YREG(1) / 100.0f); YREG(2) = 16.0f * (YREG(1) / 100.0f); @@ -368,10 +368,10 @@ void EnMag_DrawCharTexture(Gfx** gfxp, u8* texture, s32 rectLeft, s32 rectTop) { gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + YREG(2)) << 2, (rectTop + YREG(2)) << 2, G_TX_RENDERTILE, 0, 0, YREG(0), YREG(0)); - *gfxp = gfx; + *gfxP = gfx; } -void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) { +void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) { static s16 textAlpha = 0; static s16 textFadeDirection = 0; static s16 textFadeTimer = 0; @@ -389,7 +389,7 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) { EnMag* this = (EnMag*)thisx; Font* font = &this->font; s32 pad; - Gfx* gfx = *gfxp; + Gfx* gfx = *gfxP; u16 i, j, k; u16 rectLeft; u16 rectTop; @@ -559,7 +559,7 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) { } } - *gfxp = gfx; + *gfxP = gfx; } void EnMag_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 30bb737d6..1849b253d 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -8,15 +8,15 @@ #include "alloca.h" #include "assets/textures/nintendo_rogo_static/nintendo_rogo_static.h" -void ConsoleLogo_PrintBuildInfo(Gfx** gfxp) { - Gfx* g; +void ConsoleLogo_PrintBuildInfo(Gfx** gfxP) { + Gfx* gfx; GfxPrint* printer; - g = *gfxp; - g = Gfx_SetupDL_28(g); + gfx = *gfxP; + gfx = Gfx_SetupDL_28(gfx); printer = alloca(sizeof(GfxPrint)); GfxPrint_Init(printer); - GfxPrint_Open(printer, g); + GfxPrint_Open(printer, gfx); GfxPrint_SetColor(printer, 255, 155, 255, 255); GfxPrint_SetPos(printer, 9, 21); GfxPrint_Printf(printer, "NOT MARIO CLUB VERSION"); @@ -25,9 +25,9 @@ void ConsoleLogo_PrintBuildInfo(Gfx** gfxp) { GfxPrint_Printf(printer, "[Creator:%s]", gBuildTeam); GfxPrint_SetPos(printer, 7, 24); GfxPrint_Printf(printer, "[Date:%s]", gBuildDate); - g = GfxPrint_Close(printer); + gfx = GfxPrint_Close(printer); GfxPrint_Destroy(printer); - *gfxp = g; + *gfxP = gfx; } // Note: In other rom versions this function also updates unk_1D4, coverAlpha, addAlpha, visibleDuration to calculate diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c index 170b5860b..90c740027 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c @@ -34,12 +34,12 @@ static s16 sSlotItems[] = { ITEM_BOOMERANG, ITEM_LENS_OF_TRUTH, ITEM_MAGIC_BEAN, ITEM_HAMMER, ITEM_ARROW_LIGHT, ITEM_NAYRUS_LOVE, }; -void KaleidoScope_DrawDebugEditorText(Gfx** gfxp) { +void KaleidoScope_DrawDebugEditorText(Gfx** gfxP) { GfxPrint printer; s32 pad[2]; GfxPrint_Init(&printer); - GfxPrint_Open(&printer, *gfxp); + GfxPrint_Open(&printer, *gfxP); GfxPrint_SetPos(&printer, 4, 2); GfxPrint_SetColor(&printer, 255, 60, 0, 255); @@ -75,7 +75,7 @@ void KaleidoScope_DrawDebugEditorText(Gfx** gfxp) { GfxPrint_SetPos(&printer, 28, 24); GfxPrint_Printf(&printer, "%s", "/4"); - *gfxp = GfxPrint_Close(&printer); + *gfxP = GfxPrint_Close(&printer); GfxPrint_Destroy(&printer); } From ba07f21e9db3d5dd14a2e2155842a5cd8663bad8 Mon Sep 17 00:00:00 2001 From: fig02 Date: Sat, 16 Sep 2023 22:25:56 -0400 Subject: [PATCH 10/29] Change player struct variable spacing (#1537) * change spacing * missed something * missed another * and another lol --- include/z64player.h | 328 ++++++++++++++++++++++---------------------- 1 file changed, 164 insertions(+), 164 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index 811281a51..ae20e886d 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -591,180 +591,180 @@ typedef s32 (*PlayerFunc82C)(struct Player*, struct PlayState*); typedef void (*PlayerFuncA74)(struct PlayState*, struct Player*); typedef struct Player { - /* 0x0000 */ Actor actor; - /* 0x014C */ s8 currentTunic; // current tunic from `PlayerTunic` - /* 0x014D */ s8 currentSwordItemId; - /* 0x014E */ s8 currentShield; // current shield from `PlayerShield` - /* 0x014F */ s8 currentBoots; // current boots from `PlayerBoots` - /* 0x0150 */ s8 heldItemButton; // Button index for the item currently used - /* 0x0151 */ s8 heldItemAction; // Item action for the item currently used - /* 0x0152 */ u8 heldItemId; // Item id for the item currently used - /* 0x0153 */ s8 prevBoots; // previous boots from `PlayerBoots` - /* 0x0154 */ s8 itemAction; // the difference between this and heldItemAction is unclear - /* 0x0155 */ char unk_155[0x003]; - /* 0x0158 */ u8 modelGroup; - /* 0x0159 */ u8 nextModelGroup; - /* 0x015A */ s8 unk_15A; - /* 0x015B */ u8 modelAnimType; - /* 0x015C */ u8 leftHandType; - /* 0x015D */ u8 rightHandType; - /* 0x015E */ u8 sheathType; - /* 0x015F */ u8 currentMask; // current mask equipped from `PlayerMask` - /* 0x0160 */ Gfx** rightHandDLists; - /* 0x0164 */ Gfx** leftHandDLists; - /* 0x0168 */ Gfx** sheathDLists; - /* 0x016C */ Gfx** waistDLists; - /* 0x0170 */ u8 giObjectLoading; + /* 0x0000 */ Actor actor; + /* 0x014C */ s8 currentTunic; // current tunic from `PlayerTunic` + /* 0x014D */ s8 currentSwordItemId; + /* 0x014E */ s8 currentShield; // current shield from `PlayerShield` + /* 0x014F */ s8 currentBoots; // current boots from `PlayerBoots` + /* 0x0150 */ s8 heldItemButton; // Button index for the item currently used + /* 0x0151 */ s8 heldItemAction; // Item action for the item currently used + /* 0x0152 */ u8 heldItemId; // Item id for the item currently used + /* 0x0153 */ s8 prevBoots; // previous boots from `PlayerBoots` + /* 0x0154 */ s8 itemAction; // the difference between this and heldItemAction is unclear + /* 0x0155 */ char unk_155[0x003]; + /* 0x0158 */ u8 modelGroup; + /* 0x0159 */ u8 nextModelGroup; + /* 0x015A */ s8 unk_15A; + /* 0x015B */ u8 modelAnimType; + /* 0x015C */ u8 leftHandType; + /* 0x015D */ u8 rightHandType; + /* 0x015E */ u8 sheathType; + /* 0x015F */ u8 currentMask; // current mask equipped from `PlayerMask` + /* 0x0160 */ Gfx** rightHandDLists; + /* 0x0164 */ Gfx** leftHandDLists; + /* 0x0168 */ Gfx** sheathDLists; + /* 0x016C */ Gfx** waistDLists; + /* 0x0170 */ u8 giObjectLoading; /* 0x0174 */ DmaRequest giObjectDmaRequest; /* 0x0194 */ OSMesgQueue giObjectLoadQueue; - /* 0x01AC */ OSMesg giObjectLoadMsg; - /* 0x01B0 */ void* giObjectSegment; // also used for title card textures - /* 0x01B4 */ SkelAnime skelAnime; - /* 0x01F8 */ Vec3s jointTable[PLAYER_LIMB_BUF_COUNT]; - /* 0x0288 */ Vec3s morphTable[PLAYER_LIMB_BUF_COUNT]; - /* 0x0318 */ Vec3s blendTable[PLAYER_LIMB_BUF_COUNT]; - /* 0x03A8 */ s16 unk_3A8[2]; - /* 0x03AC */ Actor* heldActor; - /* 0x03B0 */ Vec3f leftHandPos; - /* 0x03BC */ Vec3s unk_3BC; - /* 0x03C4 */ Actor* unk_3C4; - /* 0x03C8 */ Vec3f unk_3C8; - /* 0x03D4 */ char unk_3D4[0x058]; - /* 0x042C */ s8 doorType; - /* 0x042D */ s8 doorDirection; - /* 0x042E */ s16 doorTimer; - /* 0x0430 */ Actor* doorActor; - /* 0x0434 */ s8 getItemId; - /* 0x0436 */ u16 getItemDirection; - /* 0x0438 */ Actor* interactRangeActor; - /* 0x043C */ s8 mountSide; - /* 0x043D */ char unk_43D[0x003]; - /* 0x0440 */ Actor* rideActor; - /* 0x0444 */ u8 csMode; - /* 0x0445 */ u8 prevCsMode; - /* 0x0446 */ u8 cueId; - /* 0x0447 */ u8 unk_447; - /* 0x0448 */ Actor* unk_448; - /* 0x044C */ char unk_44C[0x004]; - /* 0x0450 */ Vec3f unk_450; - /* 0x045C */ Vec3f unk_45C; - /* 0x0468 */ char unk_468[0x002]; - /* 0x046A */ s16 doorBgCamIndex; - /* 0x046C */ s16 subCamId; - /* 0x046E */ char unk_46E[0x02A]; + /* 0x01AC */ OSMesg giObjectLoadMsg; + /* 0x01B0 */ void* giObjectSegment; // also used for title card textures + /* 0x01B4 */ SkelAnime skelAnime; + /* 0x01F8 */ Vec3s jointTable[PLAYER_LIMB_BUF_COUNT]; + /* 0x0288 */ Vec3s morphTable[PLAYER_LIMB_BUF_COUNT]; + /* 0x0318 */ Vec3s blendTable[PLAYER_LIMB_BUF_COUNT]; + /* 0x03A8 */ s16 unk_3A8[2]; + /* 0x03AC */ Actor* heldActor; + /* 0x03B0 */ Vec3f leftHandPos; + /* 0x03BC */ Vec3s unk_3BC; + /* 0x03C4 */ Actor* unk_3C4; + /* 0x03C8 */ Vec3f unk_3C8; + /* 0x03D4 */ char unk_3D4[0x058]; + /* 0x042C */ s8 doorType; + /* 0x042D */ s8 doorDirection; + /* 0x042E */ s16 doorTimer; + /* 0x0430 */ Actor* doorActor; + /* 0x0434 */ s8 getItemId; + /* 0x0436 */ u16 getItemDirection; + /* 0x0438 */ Actor* interactRangeActor; + /* 0x043C */ s8 mountSide; + /* 0x043D */ char unk_43D[0x003]; + /* 0x0440 */ Actor* rideActor; + /* 0x0444 */ u8 csMode; + /* 0x0445 */ u8 prevCsMode; + /* 0x0446 */ u8 cueId; + /* 0x0447 */ u8 unk_447; + /* 0x0448 */ Actor* unk_448; + /* 0x044C */ char unk_44C[0x004]; + /* 0x0450 */ Vec3f unk_450; + /* 0x045C */ Vec3f unk_45C; + /* 0x0468 */ char unk_468[0x002]; + /* 0x046A */ s16 doorBgCamIndex; + /* 0x046C */ s16 subCamId; + /* 0x046E */ char unk_46E[0x02A]; /* 0x0498 */ ColliderCylinder cylinder; /* 0x04E4 */ ColliderQuad meleeWeaponQuads[2]; /* 0x05E4 */ ColliderQuad shieldQuad; - /* 0x0664 */ Actor* unk_664; - /* 0x0668 */ char unk_668[0x004]; - /* 0x066C */ s32 unk_66C; - /* 0x0670 */ s32 meleeWeaponEffectIndex; + /* 0x0664 */ Actor* unk_664; + /* 0x0668 */ char unk_668[0x004]; + /* 0x066C */ s32 unk_66C; + /* 0x0670 */ s32 meleeWeaponEffectIndex; /* 0x0674 */ PlayerActionFunc actionFunc; /* 0x0678 */ PlayerAgeProperties* ageProperties; - /* 0x067C */ u32 stateFlags1; - /* 0x0680 */ u32 stateFlags2; - /* 0x0684 */ Actor* unk_684; - /* 0x0688 */ Actor* boomerangActor; - /* 0x068C */ Actor* naviActor; - /* 0x0690 */ s16 naviTextId; - /* 0x0692 */ u8 stateFlags3; - /* 0x0693 */ s8 exchangeItemId; - /* 0x0694 */ Actor* targetActor; - /* 0x0698 */ f32 targetActorDistance; - /* 0x069C */ char unk_69C[0x004]; - /* 0x06A0 */ f32 unk_6A0; - /* 0x06A4 */ f32 closestSecretDistSq; - /* 0x06A8 */ Actor* unk_6A8; - /* 0x06AC */ s8 unk_6AC; - /* 0x06AD */ u8 unk_6AD; - /* 0x06AE */ u16 unk_6AE; - /* 0x06B0 */ s16 unk_6B0; - /* 0x06B2 */ char unk_6B4[0x004]; - /* 0x06B6 */ s16 unk_6B6; - /* 0x06B8 */ s16 unk_6B8; - /* 0x06BA */ s16 unk_6BA; - /* 0x06BC */ s16 unk_6BC; - /* 0x06BE */ s16 unk_6BE; - /* 0x06C0 */ s16 unk_6C0; - /* 0x06C2 */ s16 unk_6C2; - /* 0x06C4 */ f32 unk_6C4; - /* 0x06C8 */ SkelAnime skelAnime2; - /* 0x070C */ Vec3s jointTable2[PLAYER_LIMB_BUF_COUNT]; - /* 0x079C */ Vec3s morphTable2[PLAYER_LIMB_BUF_COUNT]; + /* 0x067C */ u32 stateFlags1; + /* 0x0680 */ u32 stateFlags2; + /* 0x0684 */ Actor* unk_684; + /* 0x0688 */ Actor* boomerangActor; + /* 0x068C */ Actor* naviActor; + /* 0x0690 */ s16 naviTextId; + /* 0x0692 */ u8 stateFlags3; + /* 0x0693 */ s8 exchangeItemId; + /* 0x0694 */ Actor* targetActor; + /* 0x0698 */ f32 targetActorDistance; + /* 0x069C */ char unk_69C[0x004]; + /* 0x06A0 */ f32 unk_6A0; + /* 0x06A4 */ f32 closestSecretDistSq; + /* 0x06A8 */ Actor* unk_6A8; + /* 0x06AC */ s8 unk_6AC; + /* 0x06AD */ u8 unk_6AD; + /* 0x06AE */ u16 unk_6AE; + /* 0x06B0 */ s16 unk_6B0; + /* 0x06B2 */ char unk_6B4[0x004]; + /* 0x06B6 */ s16 unk_6B6; + /* 0x06B8 */ s16 unk_6B8; + /* 0x06BA */ s16 unk_6BA; + /* 0x06BC */ s16 unk_6BC; + /* 0x06BE */ s16 unk_6BE; + /* 0x06C0 */ s16 unk_6C0; + /* 0x06C2 */ s16 unk_6C2; + /* 0x06C4 */ f32 unk_6C4; + /* 0x06C8 */ SkelAnime skelAnime2; + /* 0x070C */ Vec3s jointTable2[PLAYER_LIMB_BUF_COUNT]; + /* 0x079C */ Vec3s morphTable2[PLAYER_LIMB_BUF_COUNT]; /* 0x082C */ PlayerFunc82C func_82C; - /* 0x0830 */ f32 unk_830; - /* 0x0834 */ s16 unk_834; - /* 0x0836 */ s8 unk_836; - /* 0x0837 */ u8 unk_837; - /* 0x0838 */ f32 speedXZ; // Controls horizontal speed, used for `actor.speed`. Current or target value depending on context. - /* 0x083C */ s16 yaw; // General yaw value, used both for world and shape rotation. Current or target value depending on context. - /* 0x083E */ s16 zTargetYaw; // yaw relating to Z targeting/"parallel" mode - /* 0x0840 */ u16 underwaterTimer; - /* 0x0842 */ s8 meleeWeaponAnimation; - /* 0x0843 */ s8 meleeWeaponState; - /* 0x0844 */ s8 unk_844; - /* 0x0845 */ u8 unk_845; - /* 0x0846 */ u8 unk_846; - /* 0x0847 */ s8 unk_847[4]; - /* 0x084B */ s8 unk_84B[4]; - /* 0x084F */ s8 unk_84F; - /* 0x0850 */ s16 unk_850; // multipurpose timer - /* 0x0854 */ f32 unk_854; - /* 0x0858 */ f32 unk_858; - /* 0x085C */ f32 unk_85C; // stick length among other things - /* 0x0860 */ s16 unk_860; // stick flame timer among other things - /* 0x0862 */ s8 unk_862; // get item draw ID + 1 - /* 0x0864 */ f32 unk_864; - /* 0x0868 */ f32 unk_868; - /* 0x086C */ f32 unk_86C; - /* 0x0870 */ f32 unk_870; - /* 0x0874 */ f32 unk_874; - /* 0x0878 */ f32 unk_878; - /* 0x087C */ s16 unk_87C; - /* 0x087E */ s16 unk_87E; - /* 0x0880 */ f32 unk_880; - /* 0x0884 */ f32 yDistToLedge; // y distance to ground above an interact wall. LEDGE_DIST_MAX if no ground is found - /* 0x0888 */ f32 distToInteractWall; // xyz distance to the interact wall - /* 0x088C */ u8 ledgeClimbType; - /* 0x088D */ u8 ledgeClimbDelayTimer; - /* 0x088E */ u8 unk_88E; - /* 0x088F */ u8 unk_88F; - /* 0x0890 */ u8 unk_890; - /* 0x0891 */ u8 shockTimer; - /* 0x0892 */ u8 unk_892; - /* 0x0893 */ u8 hoverBootsTimer; - /* 0x0894 */ s16 fallStartHeight; // last truncated Y position before falling - /* 0x0896 */ s16 fallDistance; // truncated Y distance the player has fallen so far (positive is down) - /* 0x0898 */ s16 floorPitch; // angle of the floor slope in the direction of current world yaw (positive for ascending slope) - /* 0x089A */ s16 floorPitchAlt; // the calculation for this value is bugged and doesn't represent anything meaningful - /* 0x089C */ s16 unk_89C; - /* 0x089E */ u16 floorSfxOffset; - /* 0x08A0 */ u8 unk_8A0; - /* 0x08A1 */ u8 unk_8A1; - /* 0x08A2 */ s16 unk_8A2; - /* 0x08A4 */ f32 unk_8A4; - /* 0x08A8 */ f32 unk_8A8; - /* 0x08AC */ f32 pushedSpeed; // Pushing player, examples include water currents, floor conveyors, climbing sloped surfaces - /* 0x08B0 */ s16 pushedYaw; // Yaw direction of player being pushed + /* 0x0830 */ f32 unk_830; + /* 0x0834 */ s16 unk_834; + /* 0x0836 */ s8 unk_836; + /* 0x0837 */ u8 unk_837; + /* 0x0838 */ f32 speedXZ; // Controls horizontal speed, used for `actor.speed`. Current or target value depending on context. + /* 0x083C */ s16 yaw; // General yaw value, used both for world and shape rotation. Current or target value depending on context. + /* 0x083E */ s16 zTargetYaw; // yaw relating to Z targeting/"parallel" mode + /* 0x0840 */ u16 underwaterTimer; + /* 0x0842 */ s8 meleeWeaponAnimation; + /* 0x0843 */ s8 meleeWeaponState; + /* 0x0844 */ s8 unk_844; + /* 0x0845 */ u8 unk_845; + /* 0x0846 */ u8 unk_846; + /* 0x0847 */ s8 unk_847[4]; + /* 0x084B */ s8 unk_84B[4]; + /* 0x084F */ s8 unk_84F; + /* 0x0850 */ s16 unk_850; // multipurpose timer + /* 0x0854 */ f32 unk_854; + /* 0x0858 */ f32 unk_858; + /* 0x085C */ f32 unk_85C; // stick length among other things + /* 0x0860 */ s16 unk_860; // stick flame timer among other things + /* 0x0862 */ s8 unk_862; // get item draw ID + 1 + /* 0x0864 */ f32 unk_864; + /* 0x0868 */ f32 unk_868; + /* 0x086C */ f32 unk_86C; + /* 0x0870 */ f32 unk_870; + /* 0x0874 */ f32 unk_874; + /* 0x0878 */ f32 unk_878; + /* 0x087C */ s16 unk_87C; + /* 0x087E */ s16 unk_87E; + /* 0x0880 */ f32 unk_880; + /* 0x0884 */ f32 yDistToLedge; // y distance to ground above an interact wall. LEDGE_DIST_MAX if no ground is found + /* 0x0888 */ f32 distToInteractWall; // xyz distance to the interact wall + /* 0x088C */ u8 ledgeClimbType; + /* 0x088D */ u8 ledgeClimbDelayTimer; + /* 0x088E */ u8 unk_88E; + /* 0x088F */ u8 unk_88F; + /* 0x0890 */ u8 unk_890; + /* 0x0891 */ u8 shockTimer; + /* 0x0892 */ u8 unk_892; + /* 0x0893 */ u8 hoverBootsTimer; + /* 0x0894 */ s16 fallStartHeight; // last truncated Y position before falling + /* 0x0896 */ s16 fallDistance; // truncated Y distance the player has fallen so far (positive is down) + /* 0x0898 */ s16 floorPitch; // angle of the floor slope in the direction of current world yaw (positive for ascending slope) + /* 0x089A */ s16 floorPitchAlt; // the calculation for this value is bugged and doesn't represent anything meaningful + /* 0x089C */ s16 unk_89C; + /* 0x089E */ u16 floorSfxOffset; + /* 0x08A0 */ u8 unk_8A0; + /* 0x08A1 */ u8 unk_8A1; + /* 0x08A2 */ s16 unk_8A2; + /* 0x08A4 */ f32 unk_8A4; + /* 0x08A8 */ f32 unk_8A8; + /* 0x08AC */ f32 pushedSpeed; // Pushing player, examples include water currents, floor conveyors, climbing sloped surfaces + /* 0x08B0 */ s16 pushedYaw; // Yaw direction of player being pushed /* 0x08B4 */ WeaponInfo meleeWeaponInfo[3]; - /* 0x0908 */ Vec3f bodyPartsPos[PLAYER_BODYPART_MAX]; - /* 0x09E0 */ MtxF mf_9E0; - /* 0x0A20 */ MtxF shieldMf; - /* 0x0A60 */ u8 isBurning; - /* 0x0A61 */ u8 flameTimers[PLAYER_BODYPART_MAX]; // one flame per body part - /* 0x0A73 */ u8 unk_A73; + /* 0x0908 */ Vec3f bodyPartsPos[PLAYER_BODYPART_MAX]; + /* 0x09E0 */ MtxF mf_9E0; + /* 0x0A20 */ MtxF shieldMf; + /* 0x0A60 */ u8 isBurning; + /* 0x0A61 */ u8 flameTimers[PLAYER_BODYPART_MAX]; // one flame per body part + /* 0x0A73 */ u8 unk_A73; /* 0x0A74 */ PlayerFuncA74 func_A74; - /* 0x0A78 */ s8 invincibilityTimer; // prevents damage when nonzero (positive = visible, counts towards zero each frame) - /* 0x0A79 */ u8 floorTypeTimer; // counts up every frame the current floor type is the same as the last frame - /* 0x0A7A */ u8 floorProperty; - /* 0x0A7B */ u8 prevFloorType; - /* 0x0A7C */ f32 unk_A7C; - /* 0x0A80 */ s16 unk_A80; - /* 0x0A82 */ u16 prevFloorSfxOffset; - /* 0x0A84 */ s16 unk_A84; - /* 0x0A86 */ s8 unk_A86; - /* 0x0A87 */ u8 unk_A87; - /* 0x0A88 */ Vec3f unk_A88; // previous body part 0 position + /* 0x0A78 */ s8 invincibilityTimer; // prevents damage when nonzero (positive = visible, counts towards zero each frame) + /* 0x0A79 */ u8 floorTypeTimer; // counts up every frame the current floor type is the same as the last frame + /* 0x0A7A */ u8 floorProperty; + /* 0x0A7B */ u8 prevFloorType; + /* 0x0A7C */ f32 unk_A7C; + /* 0x0A80 */ s16 unk_A80; + /* 0x0A82 */ u16 prevFloorSfxOffset; + /* 0x0A84 */ s16 unk_A84; + /* 0x0A86 */ s8 unk_A86; + /* 0x0A87 */ u8 unk_A87; + /* 0x0A88 */ Vec3f unk_A88; // previous body part 0 position } Player; // size = 0xA94 #endif From 6c3e8d63cfd15c5835c11c6b1559ccd3251ac3d5 Mon Sep 17 00:00:00 2001 From: fig02 Date: Sun, 17 Sep 2023 19:56:41 -0400 Subject: [PATCH 11/29] Name player's generic `actionVar`s (#1538) * name player generic vars * format --- include/z64player.h | 4 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 12 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 8 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.c | 2 +- src/overlays/actors/ovl_En_Dha/z_en_dha.c | 8 +- src/overlays/actors/ovl_En_Mb/z_en_mb.c | 16 +- .../actors/ovl_player_actor/z_player.c | 599 +++++++++--------- 7 files changed, 327 insertions(+), 322 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index ae20e886d..fb8f7795d 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -707,8 +707,8 @@ typedef struct Player { /* 0x0846 */ u8 unk_846; /* 0x0847 */ s8 unk_847[4]; /* 0x084B */ s8 unk_84B[4]; - /* 0x084F */ s8 unk_84F; - /* 0x0850 */ s16 unk_850; // multipurpose timer + /* 0x084F */ s8 actionVar1; // context dependent variable that has different meanings depending on what action is currently running + /* 0x0850 */ s16 actionVar2; // context dependent variable that has different meanings depending on what action is currently running /* 0x0854 */ f32 unk_854; /* 0x0858 */ f32 unk_858; /* 0x085C */ f32 unk_85C; // stick length among other things diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 7cf116602..d2bfcdf05 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -756,7 +756,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { } } if (this->work[MO_TENT_ACTION_STATE] == MO_TENT_GRAB) { - player->unk_850 = 0xA; + player->actionVar2 = 0xA; player->actor.speed = player->actor.velocity.y = 0; Math_ApproachF(&player->actor.world.pos.x, this->grabPosRot.pos.x, 0.5f, 20.0f); Math_ApproachF(&player->actor.world.pos.y, this->grabPosRot.pos.y, 0.5f, 20.0f); @@ -814,7 +814,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Math_ApproachS(&this->tentRot[indS1].z, tempf2, 1.0f / this->tentMaxAngle, this->tentSpeed); } } - player->unk_850 = 0xA; + player->actionVar2 = 0xA; player->actor.world.pos.x = this->grabPosRot.pos.x; player->actor.world.pos.y = this->grabPosRot.pos.y; player->actor.world.pos.z = this->grabPosRot.pos.z; @@ -833,7 +833,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { this->work[MO_TENT_ACTION_STATE] = MO_TENT_RETREAT; this->work[MO_TENT_INVINC_TIMER] = 50; if (&this->actor == player->actor.parent) { - player->unk_850 = 0x65; + player->actionVar2 = 0x65; player->actor.parent = NULL; player->csMode = PLAYER_CSMODE_NONE; if (this->timers[0] == 0) { @@ -863,7 +863,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { case MO_TENT_CUT: Sfx_PlaySfxAtPos(&this->tentTipPos, NA_SE_EV_WATER_WALL - SFX_FLAG); if (&this->actor == player->actor.parent) { - player->unk_850 = 0x65; + player->actionVar2 = 0x65; player->actor.parent = NULL; player->csMode = PLAYER_CSMODE_NONE; } @@ -1784,7 +1784,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) { sMorphaTent2->tent2KillTimer = 1; } if (player->actor.parent != NULL) { - player->unk_850 = 0x65; + player->actionVar2 = 0x65; player->actor.parent = NULL; player->csMode = PLAYER_CSMODE_NONE; } @@ -1803,7 +1803,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) { sMorphaTent1->timers[0] = 40; sMorphaTent1->actor.flags &= ~ACTOR_FLAG_0; if (player->actor.parent == &sMorphaTent1->actor) { - player->unk_850 = 0x65; + player->actionVar2 = 0x65; player->actor.parent = NULL; player->csMode = PLAYER_CSMODE_NONE; } diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 351832258..e26d4b410 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -1749,7 +1749,7 @@ void BossSst_HandClap(BossSst* this, PlayState* play) { } if (player->actor.parent == &this->actor) { - player->unk_850 = 0; + player->actionVar2 = 0; player->actor.world.pos = this->actor.world.pos; } } @@ -1844,7 +1844,7 @@ void BossSst_HandGrab(BossSst* this, PlayState* play) { this->actor.world.pos.x += this->actor.speed * Math_SinS(this->actor.world.rot.y); this->actor.world.pos.z += this->actor.speed * Math_CosS(this->actor.world.rot.y); if (player->stateFlags2 & PLAYER_STATE2_7) { - player->unk_850 = 0; + player->actionVar2 = 0; player->actor.world.pos = this->actor.world.pos; player->actor.shape.rot.y = this->actor.shape.rot.y; } @@ -1938,7 +1938,7 @@ void BossSst_HandSwing(BossSst* this, PlayState* play) { } if (player->stateFlags2 & PLAYER_STATE2_7) { - player->unk_850 = 0; + player->actionVar2 = 0; Math_Vec3f_Copy(&player->actor.world.pos, &this->actor.world.pos); player->actor.shape.rot.x = this->actor.shape.rot.x; player->actor.shape.rot.z = (this->vParity * -0x4000) + this->actor.shape.rot.z; @@ -2422,7 +2422,7 @@ void BossSst_HandReleasePlayer(BossSst* this, PlayState* play, s32 dropPlayer) { if (player->actor.parent == &this->actor) { player->actor.parent = NULL; - player->unk_850 = 100; + player->actionVar2 = 100; this->colliderJntSph.base.ocFlags1 |= OC1_ON; OTHER_HAND(this)->colliderJntSph.base.ocFlags1 |= OC1_ON; if (dropPlayer) { diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index b917f7f97..e8db4e911 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -129,7 +129,7 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) { player = GET_PLAYER(play); if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f)) { if ((this->actor.targetMode != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && - (player->stateFlags1 & PLAYER_STATE1_31) && (player->unk_84F == 0)) { + (player->stateFlags1 & PLAYER_STATE1_31) && (player->actionVar1 == 0)) { destinationIdx = ((this->actor.params >> 0xC) & 7) - 1; Play_SetupRespawnPoint(play, RESPAWN_MODE_RETURN, 0x4FF); gSaveContext.respawn[RESPAWN_MODE_RETURN].pos.y = this->actor.world.pos.y; diff --git a/src/overlays/actors/ovl_En_Dha/z_en_dha.c b/src/overlays/actors/ovl_En_Dha/z_en_dha.c index 7406f29cf..472903dab 100644 --- a/src/overlays/actors/ovl_En_Dha/z_en_dha.c +++ b/src/overlays/actors/ovl_En_Dha/z_en_dha.c @@ -245,7 +245,7 @@ void EnDha_Wait(EnDha* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_7) && (&this->actor == player->actor.parent)) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; - player->unk_850 = 200; + player->actionVar2 = 200; } if (this->actor.home.rot.z != 0) { @@ -285,7 +285,7 @@ void EnDha_Wait(EnDha* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_7) && (&this->actor == player->actor.parent)) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; - player->unk_850 = 200; + player->actionVar2 = 200; } this->actor.home.rot.z = 1; @@ -306,7 +306,7 @@ void EnDha_TakeDamage(EnDha* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_7) && (&this->actor == player->actor.parent)) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; - player->unk_850 = 200; + player->actionVar2 = 200; } Math_SmoothStepToS(&this->limbAngleX[1], 0, 1, 2000, 0); @@ -344,7 +344,7 @@ void EnDha_Die(EnDha* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_7) && (&this->actor == player->actor.parent)) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; - player->unk_850 = 200; + player->actionVar2 = 200; } Math_SmoothStepToS(&this->limbAngleX[1], 0, 1, 0x7D0, 0); diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 3046a0cf3..4f5afaef3 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -604,7 +604,7 @@ void EnMb_Stunned(EnMb* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_7) && player->actor.parent == &this->actor) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; - player->unk_850 = 200; + player->actionVar2 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); this->attack = ENMB_ATTACK_NONE; } @@ -721,7 +721,7 @@ void EnMb_SpearPatrolEndCharge(EnMb* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_7) && player->actor.parent == &this->actor) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; - player->unk_850 = 200; + player->actionVar2 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } @@ -936,7 +936,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play) { hasHitPlayer = true; player->actor.world.pos.z = this->actor.world.pos.z + Math_SinS(this->actor.shape.rot.y) * 10.0f + Math_CosS(this->actor.shape.rot.y) * 89.0f; - player->unk_850 = 0; + player->actionVar2 = 0; player->actor.speed = 0.0f; player->actor.velocity.y = 0.0f; } @@ -947,7 +947,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play) { if (player->stateFlags2 & PLAYER_STATE2_7) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; - player->unk_850 = 200; + player->actionVar2 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } } @@ -1005,7 +1005,7 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, PlayState* play) { hasHitPlayer = true; player->actor.world.pos.z = this->actor.world.pos.z + Math_SinS(this->actor.shape.rot.y) * 10.0f + Math_CosS(this->actor.shape.rot.y) * 89.0f; - player->unk_850 = 0; + player->actionVar2 = 0; player->actor.speed = 0.0f; player->actor.velocity.y = 0.0f; } @@ -1016,7 +1016,7 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, PlayState* play) { if (player->stateFlags2 & PLAYER_STATE2_7) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; - player->unk_850 = 200; + player->actionVar2 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } this->attack = ENMB_ATTACK_NONE; @@ -1298,7 +1298,7 @@ void EnMb_SpearDead(EnMb* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_7) && player->actor.parent == &this->actor) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; - player->unk_850 = 200; + player->actionVar2 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); this->attack = ENMB_ATTACK_NONE; } @@ -1381,7 +1381,7 @@ void EnMb_CheckColliding(EnMb* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_7) && player->actor.parent == &this->actor) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; - player->unk_850 = 200; + player->actionVar2 = 200; func_8002F71C(play, &this->actor, 6.0f, this->actor.world.rot.y, 6.0f); } this->damageEffect = this->actor.colChkInfo.damageEffect; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index f4e391beb..d92449630 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -1689,13 +1689,13 @@ void func_80832564(PlayState* play, Player* this) { s32 func_80832594(Player* this, s32 arg1, s32 arg2) { s16 temp = this->unk_A80 - D_808535D8; - this->unk_850 += arg1 + (s16)(ABS(temp) * fabsf(D_808535D4) * 2.5415802156203426e-06f); + this->actionVar2 += arg1 + (s16)(ABS(temp) * fabsf(D_808535D4) * 2.5415802156203426e-06f); if (CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B)) { - this->unk_850 += 5; + this->actionVar2 += 5; } - return this->unk_850 > arg2; + return this->actionVar2 > arg2; } void func_80832630(PlayState* play) { @@ -3078,13 +3078,17 @@ s32 Player_SetupAction(PlayState* play, Player* this, PlayerActionFunc actionFun } func_80832DBC(this); + this->stateFlags1 &= ~(PLAYER_STATE1_2 | PLAYER_STATE1_6 | PLAYER_STATE1_26 | PLAYER_STATE1_28 | PLAYER_STATE1_29 | PLAYER_STATE1_31); this->stateFlags2 &= ~(PLAYER_STATE2_19 | PLAYER_STATE2_27 | PLAYER_STATE2_28); this->stateFlags3 &= ~(PLAYER_STATE3_1 | PLAYER_STATE3_3 | PLAYER_STATE3_7); - this->unk_84F = 0; - this->unk_850 = 0; + + this->actionVar1 = 0; + this->actionVar2 = 0; + this->unk_6AC = 0; + func_808326F0(this); return 1; @@ -3249,7 +3253,7 @@ void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) { if (Inventory_ConsumeFairy(play)) { play->gameOverCtx.state = GAMEOVER_REVIVE_START; - this->unk_84F = 1; + this->actionVar1 = 1; } else { play->gameOverCtx.state = GAMEOVER_DEATH_START; Audio_StopBgmAndFanfare(0); @@ -3847,7 +3851,7 @@ void func_80837B60(Player* this) { void func_80837B9C(Player* this, PlayState* play) { Player_SetupAction(play, this, Player_Action_8084411C, 0); Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_landing_wait); - this->unk_850 = 1; + this->actionVar2 = 1; if (this->unk_6AD != 3) { this->unk_6AD = 0; } @@ -3899,7 +3903,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_normal_electric_shock); func_80832224(this); - this->unk_850 = 20; + this->actionVar2 = 20; } else { arg5 -= this->actor.shape.rot.y; if (this->stateFlags1 & PLAYER_STATE1_27) { @@ -3922,7 +3926,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, func_80832224(this); if (arg2 == 2) { - this->unk_850 = 4; + this->actionVar2 = 4; this->actor.speed = 3.0f; this->speedXZ = 3.0f; @@ -4125,7 +4129,7 @@ s32 func_808382DC(Player* this, PlayState* play) { Player_SetupAction(play, this, Player_Action_808435C4, 0); } - if (!(this->unk_84F = sp54)) { + if (!(this->actionVar1 = sp54)) { func_80833638(this, func_80834BD4); if (this->unk_870 < 0.5f) { @@ -4327,8 +4331,8 @@ void func_80838E70(PlayState* play, Player* this, f32 arg2, s16 arg3) { Player_SetupAction(play, this, Player_Action_80845CA4, 0); func_80832440(play, this); - this->unk_84F = 1; - this->unk_850 = 1; + this->actionVar1 = 1; + this->actionVar2 = 1; this->unk_450.x = (Math_SinS(arg3) * arg2) + this->actor.world.pos.x; this->unk_450.z = (Math_CosS(arg3) * arg2) + this->actor.world.pos.z; @@ -4528,11 +4532,11 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol Sfx_PlaySfxCentered(NA_SE_OC_ABYSS); } else { func_80838F5C(play, this); - this->unk_850 = 9999; + this->actionVar2 = 9999; if (this->floorProperty == FLOOR_PROPERTY_5) { - this->unk_84F = -1; + this->actionVar1 = -1; } else { - this->unk_84F = 1; + this->actionVar1 = 1; } } } @@ -4647,7 +4651,7 @@ s32 func_80839800(Player* this, PlayState* play) { func_80838E70(play, this, 50.0f, this->actor.shape.rot.y); - this->unk_84F = 0; + this->actionVar1 = 0; this->unk_447 = this->doorType; this->stateFlags1 |= PLAYER_STATE1_29; @@ -4660,7 +4664,7 @@ s32 func_80839800(Player* this, PlayState* play) { func_80832224(this); if (this->doorTimer != 0) { - this->unk_850 = 0; + this->actionVar2 = 0; Player_AnimChangeOnceMorph(play, this, func_80833338(this)); this->skelAnime.endFrame = 0.0f; } else { @@ -4829,7 +4833,7 @@ void func_80839FFC(Player* this, PlayState* play) { void func_8083A060(Player* this, PlayState* play) { func_80839FFC(this, play); if (func_8008E9C4(this)) { - this->unk_850 = 1; + this->actionVar2 = 1; } } @@ -4903,14 +4907,14 @@ void func_8083A388(PlayState* play, Player* this) { } void func_8083A3B0(PlayState* play, Player* this) { - s32 sp1C = this->unk_850; - s32 sp18 = this->unk_84F; + s32 sp1C = this->actionVar2; + s32 sp18 = this->actionVar1; func_80835DAC(play, this, Player_Action_8084BF1C, 0); this->actor.velocity.y = 0.0f; - this->unk_850 = sp1C; - this->unk_84F = sp18; + this->actionVar2 = sp1C; + this->actionVar1 = sp18; } void func_8083A40C(PlayState* play, Player* this) { @@ -4923,9 +4927,9 @@ void func_8083A434(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_29; if (this->getItemId == GI_HEART_CONTAINER_2) { - this->unk_850 = 20; + this->actionVar2 = 20; } else if (this->getItemId >= 0) { - this->unk_850 = 1; + this->actionVar2 = 1; } else { this->getItemId = -this->getItemId; } @@ -4951,7 +4955,7 @@ s32 func_8083A4A8(Player* this, PlayState* play) { } func_80838940(this, anim, temp, play, NA_SE_VO_LI_AUTO_JUMP); - this->unk_850 = 1; + this->actionVar2 = 1; return 1; } @@ -5027,8 +5031,8 @@ s32 func_8083A6AC(Player* this, PlayState* play) { ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); - this->unk_850 = -1; - this->unk_84F = sp50; + this->actionVar2 = -1; + this->actionVar1 = sp50; } else { this->stateFlags1 |= PLAYER_STATE1_13; this->stateFlags1 &= ~PLAYER_STATE1_17; @@ -5179,7 +5183,7 @@ void func_8083AE40(Player* this, s16 objectId) { void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) { func_80835DE4(play, this, Player_Action_808507F4, 0); - this->unk_84F = magicSpell - 3; + this->actionVar1 = magicSpell - 3; Magic_RequestChange(play, sMagicSpellCosts[magicSpell], MAGIC_CONSUME_WAIT_PREVIEW); LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_link_magic_tame, 0.83f); @@ -5301,17 +5305,17 @@ s32 func_8083B040(Player* this, PlayState* play) { Inventory_ChangeAmmo(ITEM_MAGIC_BEAN, -1); func_80835DE4(play, this, Player_Action_8084279C, 0); this->stateFlags1 |= PLAYER_STATE1_29; - this->unk_850 = 0x50; - this->unk_84F = -1; + this->actionVar2 = 0x50; + this->actionVar1 = -1; } targetActor->flags |= ACTOR_FLAG_8; this->unk_664 = this->targetActor; } else if (sp2C == EXCH_ITEM_BOTTLE_RUTOS_LETTER) { - this->unk_84F = 1; + this->actionVar1 = 1; this->actor.textId = 0x4005; func_80835EA4(play, 1); } else { - this->unk_84F = 2; + this->actionVar1 = 2; this->actor.textId = 0xCF; func_80835EA4(play, 4); } @@ -5319,11 +5323,11 @@ s32 func_8083B040(Player* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_8; this->exchangeItemId = sp2C; - if (this->unk_84F < 0) { + if (this->actionVar1 < 0) { Player_AnimChangeOnceMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check, this->modelAnimType)); } else { - Player_AnimPlayOnce(play, this, D_80854548[this->unk_84F]); + Player_AnimPlayOnce(play, this, D_80854548[this->actionVar1]); } func_80832224(this); @@ -5359,7 +5363,7 @@ s32 func_8083B040(Player* this, PlayState* play) { } else if (func_8083AD4C(play, this)) { if (!(this->stateFlags1 & PLAYER_STATE1_23)) { Player_SetupAction(play, this, Player_Action_8084B1D8, 1); - this->unk_850 = 13; + this->actionVar2 = 13; func_8083B010(this); } this->stateFlags1 |= PLAYER_STATE1_20; @@ -5543,8 +5547,8 @@ void func_8083BCD0(Player* this, PlayState* play, s32 arg2) { if (arg2) {} - this->unk_850 = 1; - this->unk_84F = arg2; + this->actionVar2 = 1; + this->actionVar1 = arg2; this->yaw = this->actor.shape.rot.y + (arg2 << 0xE); this->speedXZ = !(arg2 & 1) ? 6.0f : 8.5f; @@ -5771,10 +5775,10 @@ s32 func_8083C6B8(PlayState* play, Player* this) { Player_SetupAction(play, this, Player_Action_8084ECA4, 0); if (this->actor.yDistToWater > 12.0f) { - this->unk_850 = 1; + this->actionVar2 = 1; } - Player_AnimPlayOnceAdjusted(play, this, D_80854554[this->unk_850].unk_00); + Player_AnimPlayOnceAdjusted(play, this, D_80854554[this->actionVar2].unk_00); Player_PlaySfx(this, NA_SE_IT_SWORD_SWING); func_80832698(this, NA_SE_VO_LI_AUTO_JUMP); @@ -5837,7 +5841,7 @@ s32 func_8083C910(PlayState* play, Player* this, f32 arg2) { Player_SetupAction(play, this, Player_Action_8084D7C4, 0); Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim); this->stateFlags1 |= PLAYER_STATE1_27 | PLAYER_STATE1_29; - this->unk_850 = 20; + this->actionVar2 = 20; this->speedXZ = 2.0f; Player_SetBootData(play, this); return 0; @@ -5851,7 +5855,7 @@ s32 func_8083C910(PlayState* play, Player* this, f32 arg2) { void func_8083CA20(PlayState* play, Player* this) { if (func_8083C910(play, this, 180.0f)) { - this->unk_850 = -20; + this->actionVar2 = -20; } } @@ -5859,7 +5863,7 @@ void func_8083CA54(PlayState* play, Player* this) { this->speedXZ = 2.0f; gSaveContext.entranceSpeed = 2.0f; if (func_8083C910(play, this, 120.0f)) { - this->unk_850 = -15; + this->actionVar2 = -15; } } @@ -5871,9 +5875,9 @@ void func_8083CA9C(PlayState* play, Player* this) { this->speedXZ = gSaveContext.entranceSpeed; if (func_8083C910(play, this, 800.0f)) { - this->unk_850 = -80 / this->speedXZ; - if (this->unk_850 < -20) { - this->unk_850 = -20; + this->actionVar2 = -80 / this->speedXZ; + if (this->actionVar2 < -20) { + this->actionVar2 = -20; } } } @@ -5936,7 +5940,7 @@ void func_8083CE0C(Player* this, PlayState* play) { void func_8083CEAC(Player* this, PlayState* play) { Player_SetupAction(play, this, Player_Action_80840450, 1); Player_AnimChangeOnceMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait2waitR, this->modelAnimType)); - this->unk_850 = 1; + this->actionVar2 = 1; } void func_8083CF10(Player* this, PlayState* play) { @@ -6025,7 +6029,7 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_11 | PLAYER_STATE1_29; } - this->unk_850 = 2; + this->actionVar2 = 2; } func_80832340(play, this); @@ -6049,7 +6053,7 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { void func_8083D330(PlayState* play, Player* this) { Player_AnimPlayLoop(play, this, &gPlayerAnim_link_swimer_swim); this->unk_6C2 = 16000; - this->unk_850 = 1; + this->actionVar2 = 1; } void func_8083D36C(PlayState* play, Player* this) { @@ -6059,7 +6063,7 @@ void func_8083D36C(PlayState* play, Player* this) { if ((this->currentBoots != PLAYER_BOOTS_IRON) && (this->stateFlags2 & PLAYER_STATE2_10)) { this->stateFlags2 &= ~PLAYER_STATE2_10; func_8083D12C(play, this, NULL); - this->unk_84F = 1; + this->actionVar1 = 1; } else if (Player_Action_80844A44 == this->actionFunc) { Player_SetupAction(play, this, Player_Action_8084DC48, 0); func_8083D330(play, this); @@ -6407,9 +6411,9 @@ s32 Player_HandleSlopes(PlayState* play, Player* this, CollisionPoly* floorPoly) func_80832564(play, this); if (sFloorShapePitch >= 0) { - this->unk_84F = 1; + this->actionVar1 = 1; } - Player_AnimChangeLoopMorph(play, this, sSlopeSlipAnims[this->unk_84F]); + Player_AnimChangeLoopMorph(play, this, sSlopeSlipAnims[this->actionVar1]); this->speedXZ = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z)); this->yaw = playerVelYaw; return true; @@ -6660,7 +6664,7 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) { this->stateFlags1 &= ~PLAYER_STATE1_27; if ((sp8C != 0) || (wallFlags & WALL_FLAG_1)) { - if ((this->unk_84F = sp8C) != 0) { + if ((this->actionVar1 = sp8C) != 0) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { anim = &gPlayerAnim_link_normal_Fclimb_startA; } else { @@ -6671,12 +6675,12 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) { anim = this->ageProperties->unk_A4; sp34 = sp34 - 1.0f; } - this->unk_850 = -2; + this->actionVar2 = -2; this->actor.world.pos.y += phi_f20; this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; } else { anim = this->ageProperties->unk_A8; - this->unk_850 = -4; + this->actionVar2 = -4; this->actor.shape.rot.y = this->yaw = this->actor.wallYaw; } @@ -7171,11 +7175,11 @@ void Player_Action_80840450(Player* this, PlayState* play) { } } - if (this->unk_850 != 0) { + if (this->actionVar2 != 0) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832DBC(this); Player_AnimPlayLoop(play, this, func_808334E4(this)); - this->unk_850 = 0; + this->actionVar2 = 0; this->stateFlags3 &= ~PLAYER_STATE3_3; } func_80833C3C(this); @@ -7364,11 +7368,12 @@ void Player_Action_80840BC8(Player* this, PlayState* play) { } if (sp40 != 0) { - if (this->unk_850 != 0) { - if (DECR(this->unk_850) == 0) { + if (this->actionVar2 != 0) { + if (DECR(this->actionVar2) == 0) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } - this->skelAnime.jointTable[0].y = (this->skelAnime.jointTable[0].y + ((this->unk_850 & 1) * 0x50)) - 0x28; + this->skelAnime.jointTable[0].y = + (this->skelAnime.jointTable[0].y + ((this->actionVar2 & 1) * 0x50)) - 0x28; } else { func_80832DBC(this); func_808409CC(play, this); @@ -7377,7 +7382,7 @@ void Player_Action_80840BC8(Player* this, PlayState* play) { func_8083721C(this); - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { if (!func_80837348(play, this, D_80854418, 1)) { if (func_80833B54(this)) { func_8083CEAC(this, play); @@ -7989,7 +7994,7 @@ s32 func_8084269C(PlayState* play, Player* this) { void Player_Action_8084279C(Player* this, PlayState* play) { func_80832CB0(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check_wait, this->modelAnimType)); - if (DECR(this->unk_850) == 0) { + if (DECR(this->actionVar2) == 0) { if (!func_8083B040(this, play)) { func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check_end, this->modelAnimType), play); } @@ -8012,7 +8017,7 @@ s32 func_8084285C(Player* this, f32 arg1, f32 arg2, f32 arg3) { s32 func_808428D8(Player* this, PlayState* play) { if (!Player_IsChildWithHylianShield(this) && (Player_GetMeleeWeaponHeld(this) != 0) && D_80853614) { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_defense_kiru); - this->unk_84F = 1; + this->actionVar1 = 1; this->meleeWeaponAnimation = PLAYER_MWA_STAB_1H; this->yaw = this->actor.shape.rot.y + this->unk_6BE; return 1; @@ -8217,8 +8222,8 @@ void Player_Action_80843188(Player* this, PlayState* play) { if (!Player_IsChildWithHylianShield(this)) { Player_AnimPlayLoop(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_defense_wait, this->modelAnimType)); } - this->unk_850 = 1; - this->unk_84F = 0; + this->actionVar2 = 1; + this->actionVar1 = 0; } if (!Player_IsChildWithHylianShield(this)) { @@ -8229,7 +8234,7 @@ void Player_Action_80843188(Player* this, PlayState* play) { func_8083721C(this); - if (this->unk_850 != 0) { + if (this->actionVar2 != 0) { sp54 = sControlInput->rel.stick_y * 100; sp50 = sControlInput->rel.stick_x * -120; sp4E = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); @@ -8257,14 +8262,14 @@ void Player_Action_80843188(Player* this, PlayState* play) { this->unk_6BC = this->actor.focus.rot.x; Math_ScaledStepToS(&this->unk_6BE, sp4A, sp46); - if (this->unk_84F != 0) { + if (this->actionVar1 != 0) { if (!func_80842DF4(play, this)) { if (this->skelAnime.curFrame < 2.0f) { func_80833A20(this, 1); } } else { - this->unk_850 = 1; - this->unk_84F = 0; + this->actionVar2 = 1; + this->actionVar1 = 0; } } else if (!func_80842964(this, play)) { if (func_8083C2B0(this, play)) { @@ -8307,7 +8312,7 @@ void Player_Action_808435C4(Player* this, PlayState* play) { func_8083721C(this); - if (this->unk_84F == 0) { + if (this->actionVar1 == 0) { D_808535E0 = func_80836670(this, play); if ((func_80834B5C == this->func_82C) || (func_808374A0(play, this, &this->skelAnime2, 4.0f) > 0)) { Player_SetupAction(play, this, Player_Action_80840450, 1); @@ -8341,7 +8346,7 @@ void Player_Action_8084377C(Player* this, PlayState* play) { func_808382BC(this); - if (!(this->stateFlags1 & PLAYER_STATE1_29) && (this->unk_850 == 0) && (this->unk_8A1 != 0)) { + if (!(this->stateFlags1 & PLAYER_STATE1_29) && (this->actionVar2 == 0) && (this->unk_8A1 != 0)) { s16 temp = this->actor.shape.rot.y - this->unk_8A2; this->yaw = this->actor.shape.rot.y = this->unk_8A2; @@ -8358,15 +8363,15 @@ void Player_Action_8084377C(Player* this, PlayState* play) { } if (LinkAnimation_Update(play, &this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - if (this->unk_850 != 0) { - this->unk_850--; - if (this->unk_850 == 0) { + if (this->actionVar2 != 0) { + this->actionVar2--; + if (this->actionVar2 == 0) { func_80853080(this, play); } } else if ((this->stateFlags1 & PLAYER_STATE1_29) || (!(this->cylinder.base.acFlags & AC_HIT) && (this->unk_8A1 == 0))) { if (this->stateFlags1 & PLAYER_STATE1_29) { - this->unk_850++; + this->actionVar2++; } else { Player_SetupAction(play, this, Player_Action_80843954, 0); this->stateFlags1 |= PLAYER_STATE1_26; @@ -8392,7 +8397,7 @@ void Player_Action_80843954(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime) && (this->speedXZ == 0.0f)) { if (this->stateFlags1 & PLAYER_STATE1_29) { - this->unk_850++; + this->actionVar2++; } else { Player_SetupAction(play, this, Player_Action_80843A38, 0); this->stateFlags1 |= PLAYER_STATE1_26; @@ -8431,10 +8436,10 @@ void Player_Action_80843A38(Player* this, PlayState* play) { static Vec3f D_808545E4 = { 0.0f, 0.0f, 5.0f }; void func_80843AE8(PlayState* play, Player* this) { - if (this->unk_850 != 0) { - if (this->unk_850 > 0) { - this->unk_850--; - if (this->unk_850 == 0) { + if (this->actionVar2 != 0) { + if (this->actionVar2 > 0) { + this->actionVar2--; + if (this->actionVar2 == 0) { if (this->stateFlags1 & PLAYER_STATE1_27) { LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_swimer_swim_wait, 1.0f, 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_swimer_swim_wait), ANIMMODE_ONCE, @@ -8444,7 +8449,7 @@ void func_80843AE8(PlayState* play, Player* this) { Animation_GetLastFrame(&gPlayerAnim_link_derth_rebirth), ANIMMODE_ONCE, 0.0f); } gSaveContext.healthAccumulator = 0x140; - this->unk_850 = -1; + this->actionVar2 = -1; } } else if (gSaveContext.healthAccumulator == 0) { this->stateFlags1 &= ~PLAYER_STATE1_7; @@ -8457,8 +8462,8 @@ void func_80843AE8(PlayState* play, Player* this) { func_80837AFC(this, -20); Audio_SetBgmVolumeOnDuringFanfare(); } - } else if (this->unk_84F != 0) { - this->unk_850 = 60; + } else if (this->actionVar1 != 0) { + this->actionVar2 = 60; Player_SpawnFairy(play, this, &this->actor.world.pos, &D_808545E4, FAIRY_REVIVE_DEATH); Player_PlaySfx(this, NA_SE_EV_FIATY_HEAL - SFX_FLAG); OnePointCutscene_Init(play, 9908, 125, &this->actor, CAM_ID_MAIN); @@ -8615,10 +8620,10 @@ void Player_Action_8084411C(Player* this, PlayState* play) { func_80836670(this, play); - if (((this->stateFlags2 & PLAYER_STATE2_19) && (this->unk_84F == 2)) || !func_8083BBA0(this, play)) { + if (((this->stateFlags2 & PLAYER_STATE2_19) && (this->actionVar1 == 2)) || !func_8083BBA0(this, play)) { if (this->actor.velocity.y < 0.0f) { - if (this->unk_850 >= 0) { - if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->unk_850 == 0) || + if (this->actionVar2 >= 0) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->actionVar2 == 0) || (this->fallDistance > 0)) { if ((sYDistToFloor > 800.0f) || (this->stateFlags1 & PLAYER_STATE1_2)) { func_80843E14(this, NA_SE_VO_LI_FALL_S); @@ -8627,11 +8632,11 @@ void Player_Action_8084411C(Player* this, PlayState* play) { LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_normal_landing, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 8.0f); - this->unk_850 = -1; + this->actionVar2 = -1; } } else { - if ((this->unk_850 == -1) && (this->fallDistance > 120.0f) && (sYDistToFloor > 280.0f)) { - this->unk_850 = -2; + if ((this->actionVar2 == -1) && (this->fallDistance > 120.0f) && (sYDistToFloor > 280.0f)) { + this->actionVar2 = -2; func_80843E14(this, NA_SE_VO_LI_FALL_L); } @@ -8665,9 +8670,9 @@ void Player_Action_8084411C(Player* this, PlayState* play) { if (this->stateFlags2 & PLAYER_STATE2_19) { if (func_8008E9C4(this)) { - anim = D_80853D4C[this->unk_84F][2]; + anim = D_80853D4C[this->actionVar1][2]; } else { - anim = D_80853D4C[this->unk_84F][1]; + anim = D_80853D4C[this->actionVar1][1]; } } else if (this->skelAnime.animation == &gPlayerAnim_link_normal_run_jump) { anim = &gPlayerAnim_link_normal_run_jump_end; @@ -8688,9 +8693,9 @@ void Player_Action_8084411C(Player* this, PlayState* play) { func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_landing, this->modelAnimType), play); this->skelAnime.endFrame = 8.0f; if (sp3C == 1) { - this->unk_850 = 10; + this->actionVar2 = 10; } else { - this->unk_850 = 20; + this->actionVar2 = 20; } } else if (sp3C == 0) { func_8083A098(this, anim, play); @@ -8724,7 +8729,7 @@ void Player_Action_80844708(Player* this, PlayState* play) { } if (func_80842964(this, play) == 0) { - if (this->unk_850 != 0) { + if (this->actionVar2 != 0) { Math_StepToF(&this->speedXZ, 0.0f, 2.0f); temp = func_808374A0(play, this, &this->skelAnime, 5.0f); @@ -8755,7 +8760,7 @@ void Player_Action_80844708(Player* this, PlayState* play) { Player_RequestRumble(this, 255, 20, 150, 0); Player_PlaySfx(this, NA_SE_PL_BODY_HIT); func_80832698(this, NA_SE_VO_LI_CLIMB_END); - this->unk_850 = 1; + this->actionVar2 = 1; return; } } @@ -8874,7 +8879,7 @@ void func_80844DC8(Player* this, PlayState* play) { Player_SetupAction(play, this, Player_Action_80844E68, 1); this->unk_868 = 0.0f; Player_AnimPlayLoop(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); - this->unk_850 = 1; + this->actionVar2 = 1; } void func_80844E3C(Player* this) { @@ -8893,18 +8898,18 @@ void Player_Action_80844E68(Player* this, PlayState* play) { func_808355DC(this); this->stateFlags1 &= ~PLAYER_STATE1_17; Player_AnimPlayLoop(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); - this->unk_850 = -1; + this->actionVar2 = -1; } func_8083721C(this); - if (!func_80842964(this, play) && (this->unk_850 != 0)) { + if (!func_80842964(this, play) && (this->actionVar2 != 0)) { func_80844E3C(this); - if (this->unk_850 < 0) { + if (this->actionVar2 < 0) { if (this->unk_858 >= 0.1f) { this->unk_845 = 0; - this->unk_850 = 1; + this->actionVar2 = 1; } else if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { func_80844D68(this, play); } @@ -9087,7 +9092,7 @@ void Player_Action_80845668(Player* this, PlayState* play) { } func_80838940(this, NULL, temp1, play, NA_SE_VO_LI_AUTO_JUMP); - this->unk_850 = -1; + this->actionVar2 = -1; return; } } else { @@ -9123,9 +9128,9 @@ void Player_Action_80845668(Player* this, PlayState* play) { } if ((this->skelAnime.animation == &gPlayerAnim_link_normal_100step_up) || (this->skelAnime.curFrame > 5.0f)) { - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { func_80832854(this); - this->unk_850 = 1; + this->actionVar2 = 1; } Math_StepToF(&this->actor.shape.yOffset, 0.0f, 150.0f); } @@ -9217,18 +9222,18 @@ void Player_Action_80845CA4(Player* this, PlayState* play) { s32 pad; if (!func_8083B040(this, play)) { - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { LinkAnimation_Update(play, &this->skelAnime); if (DECR(this->doorTimer) == 0) { this->speedXZ = 0.1f; - this->unk_850 = 1; + this->actionVar2 = 1; } - } else if (this->unk_84F == 0) { + } else if (this->actionVar1 == 0) { sp3C = 5.0f * D_808535E8; if (func_80845BA0(play, this, &sp3C, -1) < 30) { - this->unk_84F = 1; + this->actionVar1 = 1; this->stateFlags1 |= PLAYER_STATE1_29; this->unk_450.x = this->unk_45C.x; @@ -9245,8 +9250,8 @@ void Player_Action_80845CA4(Player* this, PlayState* play) { this->unk_450.x = (Math_SinS(sConveyorYaw) * 400.0f) + this->actor.world.pos.x; this->unk_450.z = (Math_CosS(sConveyorYaw) * 400.0f) + this->actor.world.pos.z; } - } else if (this->unk_850 < 0) { - this->unk_850++; + } else if (this->actionVar2 < 0) { + this->actionVar2++; sp34 = gSaveContext.entranceSpeed; sp30 = -1; @@ -9254,8 +9259,8 @@ void Player_Action_80845CA4(Player* this, PlayState* play) { temp = func_80845BA0(play, this, &sp34, sp30); - if ((this->unk_850 == 0) || ((temp == 0) && (this->speedXZ == 0.0f) && - (Play_GetCamera(play, CAM_ID_MAIN)->stateFlags & CAM_STATE_4))) { + if ((this->actionVar2 == 0) || ((temp == 0) && (this->speedXZ == 0.0f) && + (Play_GetCamera(play, CAM_ID_MAIN)->stateFlags & CAM_STATE_4))) { func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); func_80845C68(play, gSaveContext.respawn[RESPAWN_MODE_DOWN].data); @@ -9281,9 +9286,9 @@ void Player_Action_80845EF8(Player* this, PlayState* play) { func_80836670(this, play); if (sp2C) { - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { if (DECR(this->doorTimer) == 0) { - this->unk_850 = 1; + this->actionVar2 = 1; this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } } else { @@ -9335,7 +9340,7 @@ static struct_80832924 D_8085461C[] = { }; void Player_Action_80846120(Player* this, PlayState* play) { - if (LinkAnimation_Update(play, &this->skelAnime) && (this->unk_850++ > 20)) { + if (LinkAnimation_Update(play, &this->skelAnime) && (this->actionVar2++ > 20)) { if (!func_8083B040(this, play)) { func_8083A098(this, &gPlayerAnim_link_normal_heavy_carry_end, play); } @@ -9371,11 +9376,11 @@ void Player_Action_80846260(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoop(play, this, &gPlayerAnim_link_silver_wait); - this->unk_850 = 1; + this->actionVar2 = 1; return; } - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 27.0f)) { Actor* interactRangeActor = this->interactRangeActor; @@ -9417,13 +9422,13 @@ void Player_Action_80846358(Player* this, PlayState* play) { void Player_Action_80846408(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_nocarry_free_wait); - this->unk_850 = 15; + this->actionVar2 = 15; return; } - if (this->unk_850 != 0) { - this->unk_850--; - if (this->unk_850 == 0) { + if (this->actionVar2 != 0) { + this->actionVar2--; + if (this->actionVar2 == 0) { func_8083A098(this, &gPlayerAnim_link_normal_nocarry_free_end, play); this->stateFlags1 &= ~PLAYER_STATE1_11; func_80832698(this, NA_SE_VO_LI_DAMAGE_S); @@ -9541,7 +9546,7 @@ void func_80846648(PlayState* play, Player* this) { void func_80846660(PlayState* play, Player* this) { Player_SetupAction(play, this, Player_Action_8084F710, 0); if ((play->sceneId == SCENE_LAKE_HYLIA) && IS_CUTSCENE_LAYER) { - this->unk_84F = 1; + this->actionVar1 = 1; } this->stateFlags1 |= PLAYER_STATE1_29; LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_okarina_warp_goal, 2.0f / 3.0f, 0.0f, 24.0f, @@ -9584,7 +9589,7 @@ void func_808467D4(PlayState* play, Player* this) { if (LINK_IS_ADULT) { func_80846720(play, this, 0); } - this->unk_850 = 20; + this->actionVar2 = 20; } void func_808468A8(PlayState* play, Player* this) { @@ -10677,7 +10682,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Player_AnimReplaceApplyFlags(play, this, ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); - this->unk_850 = 99; + this->actionVar2 = 99; } if (this->unk_844 == 0) { @@ -11204,7 +11209,7 @@ void Player_Draw(Actor* thisx, PlayState* play2) { } if (this->stateFlags2 & PLAYER_STATE2_14) { - f32 scale = (this->unk_84F >> 1) * 22.0f; + f32 scale = (this->actionVar1 >> 1) * 22.0f; gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, (0 - play->gameplayFrames) % 128, 32, @@ -11382,7 +11387,7 @@ void Player_Action_8084B1D8(Player* this, PlayState* play) { BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)))) { func_8083C148(this, play); Sfx_PlaySfxCentered(NA_SE_SY_CAMERA_ZOOM_UP); - } else if ((DECR(this->unk_850) == 0) || (this->unk_6AD != 2)) { + } else if ((DECR(this->actionVar2) == 0) || (this->unk_6AD != 2)) { if (func_8008F128(this)) { this->unk_6AE |= 0x43; } else { @@ -11445,9 +11450,9 @@ void Player_Action_8084B530(Player* this, PlayState* play) { if (!func_8084B4D4(play, this) && !func_8084B3CC(play, this) && !func_8083ADD4(play, this)) { if ((this->targetActor != this->interactRangeActor) || !func_8083E5A8(this, play)) { if (this->stateFlags1 & PLAYER_STATE1_23) { - s32 sp24 = this->unk_850; + s32 sp24 = this->actionVar2; func_8083A360(play, this); - this->unk_850 = sp24; + this->actionVar2 = sp24; } else if (func_808332B8(this)) { func_80838F18(play, this); } else { @@ -11526,8 +11531,8 @@ void Player_Action_8084B898(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_0 | PLAYER_STATE2_6 | PLAYER_STATE2_8; if (func_80832CB0(play, this, &gPlayerAnim_link_normal_pushing)) { - this->unk_850 = 1; - } else if (this->unk_850 == 0) { + this->actionVar2 = 1; + } else if (this->actionVar2 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 11.0f)) { func_80832698(this, NA_SE_VO_LI_PUSH); } @@ -11577,9 +11582,9 @@ void Player_Action_8084B9E4(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_0 | PLAYER_STATE2_6 | PLAYER_STATE2_8; if (func_80832CB0(play, this, anim)) { - this->unk_850 = 1; + this->actionVar2 = 1; } else { - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 11.0f)) { func_80832698(this, NA_SE_VO_LI_PUSH); } @@ -11627,9 +11632,9 @@ void Player_Action_8084BBE4(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { // clang-format off - anim = (this->unk_84F > 0) ? &gPlayerAnim_link_normal_fall_wait : GET_PLAYER_ANIM(PLAYER_ANIMGROUP_jump_climb_wait, this->modelAnimType); Player_AnimPlayLoop(play, this, anim); + anim = (this->actionVar1 > 0) ? &gPlayerAnim_link_normal_fall_wait : GET_PLAYER_ANIM(PLAYER_ANIMGROUP_jump_climb_wait, this->modelAnimType); Player_AnimPlayLoop(play, this, anim); // clang-format on - } else if (this->unk_84F == 0) { + } else if (this->actionVar1 == 0) { if (this->skelAnime.animation == &gPlayerAnim_link_normal_fall) { temp = 11.0f; } else { @@ -11639,19 +11644,19 @@ void Player_Action_8084BBE4(Player* this, PlayState* play) { if (LinkAnimation_OnFrame(&this->skelAnime, temp)) { func_80832770(this, NA_SE_PL_WALK_GROUND); if (this->skelAnime.animation == &gPlayerAnim_link_normal_fall) { - this->unk_84F = 1; + this->actionVar1 = 1; } else { - this->unk_84F = -1; + this->actionVar1 = -1; } } } Math_ScaledStepToS(&this->actor.shape.rot.y, this->yaw, 0x800); - if (this->unk_84F != 0) { + if (this->actionVar1 != 0) { func_80837268(this, &sp3C, &sp3A, 0.0f, play); if (this->unk_847[this->unk_846] >= 0) { - if (this->unk_84F > 0) { + if (this->actionVar1 > 0) { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_fall_up, this->modelAnimType); } else { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_jump_climb_up, this->modelAnimType); @@ -11662,7 +11667,7 @@ void Player_Action_8084BBE4(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) || (this->actor.shape.feetFloorFlag != 0)) { func_80837B60(this); - if (this->unk_84F < 0) { + if (this->actionVar1 < 0) { this->speedXZ = -0.8f; } else { this->speedXZ = 0.8f; @@ -11692,8 +11697,8 @@ void Player_Action_8084BDFC(Player* this, PlayState* play) { } void func_8084BEE4(Player* this) { - Player_PlaySfx(this, (this->unk_84F != 0) ? NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_VINE - : NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WOOD); + Player_PlaySfx(this, (this->actionVar1 != 0) ? NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_VINE + : NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WOOD); } void Player_Action_8084BF1C(Player* this, PlayState* play) { @@ -11715,7 +11720,7 @@ void Player_Action_8084BF1C(Player* this, PlayState* play) { this->fallStartHeight = this->actor.world.pos.y; this->stateFlags2 |= PLAYER_STATE2_6; - if ((this->unk_84F != 0) && (ABS(sp84) < ABS(sp80))) { + if ((this->actionVar1 != 0) && (ABS(sp84) < ABS(sp80))) { phi_f0 = ABS(sp80) * 0.0325f; sp84 = 0; } else { @@ -11737,7 +11742,7 @@ void Player_Action_8084BF1C(Player* this, PlayState* play) { this->skelAnime.playSpeed = phi_f2 * phi_f0; - if (this->unk_850 >= 0) { + if (this->actionVar2 >= 0) { if ((this->actor.wallPoly != NULL) && (this->actor.wallBgId != BGCHECK_SCENE)) { DynaPolyActor* wallPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); if (wallPolyActor != NULL) { @@ -11751,22 +11756,22 @@ void Player_Action_8084BF1C(Player* this, PlayState* play) { func_8083F360(play, this, 26.0f, this->ageProperties->unk_3C, 50.0f, -20.0f); } - if ((this->unk_850 < 0) || !func_8083FBC0(this, play)) { + if ((this->actionVar2 < 0) || !func_8083FBC0(this, play)) { if (LinkAnimation_Update(play, &this->skelAnime) != 0) { - if (this->unk_850 < 0) { - this->unk_850 = ABS(this->unk_850) & 1; + if (this->actionVar2 < 0) { + this->actionVar2 = ABS(this->actionVar2) & 1; return; } if (sp84 != 0) { - sp68 = this->unk_84F + this->unk_850; + sp68 = this->actionVar1 + this->actionVar2; if (sp84 > 0) { D_8085488C.y = this->ageProperties->unk_40; temp_f0 = func_8083973C(play, this, &D_8085488C, &sp5C); if (this->actor.world.pos.y < temp_f0) { - if (this->unk_84F != 0) { + if (this->actionVar1 != 0) { this->actor.world.pos.y = temp_f0; this->stateFlags1 &= ~PLAYER_STATE1_21; func_8083A5C4(play, this, this->actor.wallPoly, this->ageProperties->unk_3C, @@ -11776,7 +11781,7 @@ void Player_Action_8084BF1C(Player* this, PlayState* play) { func_8083A9B8(this, &gPlayerAnim_link_normal_jump_climb_up_free, play); this->stateFlags1 |= PLAYER_STATE1_14; } else { - func_8083F070(this, this->ageProperties->unk_CC[this->unk_850], play); + func_8083F070(this, this->ageProperties->unk_CC[this->actionVar2], play); } } else { this->skelAnime.prevTransl = this->ageProperties->unk_4A[sp68]; @@ -11784,14 +11789,14 @@ void Player_Action_8084BF1C(Player* this, PlayState* play) { } } else { if ((this->actor.world.pos.y - this->actor.floorHeight) < 15.0f) { - if (this->unk_84F != 0) { + if (this->actionVar1 != 0) { func_8083FB7C(this, play); } else { - if (this->unk_850 != 0) { + if (this->actionVar2 != 0) { this->skelAnime.prevTransl = this->ageProperties->unk_44; } - func_8083F070(this, this->ageProperties->unk_C4[this->unk_850], play); - this->unk_850 = 1; + func_8083F070(this, this->ageProperties->unk_C4[this->actionVar2], play); + this->actionVar2 = 1; } } else { sp68 ^= 1; @@ -11801,16 +11806,16 @@ void Player_Action_8084BF1C(Player* this, PlayState* play) { ANIMMODE_ONCE, 0.0f); } } - this->unk_850 ^= 1; + this->actionVar2 ^= 1; } else { - if ((this->unk_84F != 0) && (sp80 != 0)) { - anim2 = this->ageProperties->unk_BC[this->unk_850]; + if ((this->actionVar1 != 0) && (sp80 != 0)) { + anim2 = this->ageProperties->unk_BC[this->actionVar2]; if (sp80 > 0) { - this->skelAnime.prevTransl = this->ageProperties->unk_7A[this->unk_850]; + this->skelAnime.prevTransl = this->ageProperties->unk_7A[this->actionVar2]; Player_AnimPlayOnce(play, this, anim2); } else { - this->skelAnime.prevTransl = this->ageProperties->unk_86[this->unk_850]; + this->skelAnime.prevTransl = this->ageProperties->unk_86[this->actionVar2]; LinkAnimation_Change(play, &this->skelAnime, anim2, -1.0f, Animation_GetLastFrame(anim2), 0.0f, ANIMMODE_ONCE, 0.0f); } @@ -11823,10 +11828,10 @@ void Player_Action_8084BF1C(Player* this, PlayState* play) { } } - if (this->unk_850 < 0) { - if (((this->unk_850 == -2) && + if (this->actionVar2 < 0) { + if (((this->actionVar2 == -2) && (LinkAnimation_OnFrame(&this->skelAnime, 14.0f) || LinkAnimation_OnFrame(&this->skelAnime, 29.0f))) || - ((this->unk_850 == -4) && + ((this->actionVar2 == -4) && (LinkAnimation_OnFrame(&this->skelAnime, 22.0f) || LinkAnimation_OnFrame(&this->skelAnime, 35.0f) || LinkAnimation_OnFrame(&this->skelAnime, 49.0f) || LinkAnimation_OnFrame(&this->skelAnime, 55.0f)))) { func_8084BEE4(this); @@ -11872,7 +11877,7 @@ void Player_Action_8084C5F8(Player* this, PlayState* play) { sp38 = D_80854898; - if (this->unk_850 != 0) { + if (this->actionVar2 != 0) { func_80832924(this, D_808548A8); sp38 = D_808548A0; } @@ -11984,8 +11989,8 @@ s32 func_8084C9BC(Player* this, PlayState* play) { s32 sp38; f32 sp34; - if (this->unk_850 < 0) { - this->unk_850 = 99; + if (this->actionVar2 < 0) { + this->actionVar2 = 99; } else { sp38 = (this->mountSide < 0) ? 0 : 1; if (!func_8084C89C(play, this, sp38, &sp34)) { @@ -12088,10 +12093,10 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { func_8084CBF4(this, 1.0f, 10.0f); - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { if (LinkAnimation_Update(play, &this->skelAnime)) { this->skelAnime.animation = &gPlayerAnim_link_uma_wait_1; - this->unk_850 = 99; + this->actionVar2 = 99; return; } @@ -12114,12 +12119,12 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { func_8002DE74(play, this); this->skelAnime.prevTransl = D_8085499C; - if ((rideActor->animationIdx != this->unk_850) && ((rideActor->animationIdx >= 2) || (this->unk_850 >= 2))) { - if ((this->unk_850 = rideActor->animationIdx) < 2) { + if ((rideActor->animationIdx != this->actionVar2) && ((rideActor->animationIdx >= 2) || (this->actionVar2 >= 2))) { + if ((this->actionVar2 = rideActor->animationIdx) < 2) { f32 rand = Rand_ZeroOne(); s32 temp = 0; - this->unk_850 = 1; + this->actionVar2 = 1; if (rand < 0.1f) { temp = 2; @@ -12128,20 +12133,20 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { } Player_AnimPlayOnce(play, this, D_8085498C[temp]); } else { - this->skelAnime.animation = D_80854944[this->unk_850 - 2]; + this->skelAnime.animation = D_80854944[this->actionVar2 - 2]; Animation_SetMorph(play, &this->skelAnime, 8.0f); - if (this->unk_850 < 4) { + if (this->actionVar2 < 4) { func_80834644(play, this); - this->unk_84F = 0; + this->actionVar1 = 0; } } } - if (this->unk_850 == 1) { + if (this->actionVar2 == 1) { if ((D_808535E0 != 0) || func_8083224C(play)) { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_uma_wait_3); } else if (LinkAnimation_Update(play, &this->skelAnime)) { - this->unk_850 = 99; + this->actionVar2 = 99; } else if (this->skelAnime.animation == &gPlayerAnim_link_uma_wait_1) { func_80832924(this, D_808549A4); } @@ -12158,11 +12163,11 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { this->csMode = PLAYER_CSMODE_NONE; } this->unk_6AD = 0; - this->unk_84F = 0; - } else if ((this->unk_850 < 2) || (this->unk_850 >= 4)) { + this->actionVar1 = 0; + } else if ((this->actionVar2 < 2) || (this->actionVar2 >= 4)) { D_808535E0 = func_80836670(this, play); if (D_808535E0 != 0) { - this->unk_84F = 0; + this->actionVar1 = 0; } } @@ -12176,10 +12181,10 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { (!func_8083224C(play) && ((rideActor->actor.speed != 0.0f) || !func_8083B644(this, play)) && !func_8083C1DC(this, play))) { if (D_808535E0 == 0) { - if (this->unk_84F != 0) { + if (this->actionVar1 != 0) { if (LinkAnimation_Update(play, &this->skelAnime2)) { rideActor->stateFlags &= ~ENHORSE_FLAG_8; - this->unk_84F = 0; + this->actionVar1 = 0; } if (this->skelAnime2.animation == &gPlayerAnim_link_uma_stop_muti) { @@ -12205,14 +12210,14 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { if (EN_HORSE_CHECK_3(rideActor)) { anim = &gPlayerAnim_link_uma_stop_muti; } else if (EN_HORSE_CHECK_2(rideActor)) { - if ((this->unk_850 >= 2) && (this->unk_850 != 99)) { - anim = D_80854968[this->unk_850 - 2]; + if ((this->actionVar2 >= 2) && (this->actionVar2 != 99)) { + anim = D_80854968[this->actionVar2 - 2]; } } if (anim != NULL) { LinkAnimation_PlayOnce(play, &this->skelAnime2, anim); - this->unk_84F = 1; + this->actionVar1 = 1; } } } @@ -12358,7 +12363,7 @@ void Player_Action_8084D7C4(Player* this, PlayState* play) { func_8084B158(play, this, NULL, this->speedXZ); func_8084B000(this); - if (DECR(this->unk_850) == 0) { + if (DECR(this->actionVar2) == 0) { func_80838F18(play, this); } } @@ -12470,8 +12475,8 @@ void Player_Action_8084DC48(Player* this, PlayState* play) { return; } - if (this->unk_84F == 0) { - if (this->unk_850 == 0) { + if (this->actionVar1 == 0) { + if (this->actionVar2 == 0) { if (LinkAnimation_Update(play, &this->skelAnime) || ((this->skelAnime.curFrame >= 22.0f) && !CHECK_BTN_ALL(sControlInput->cur.button, BTN_A))) { func_8083D330(play, this); @@ -12491,20 +12496,20 @@ void Player_Action_8084DC48(Player* this, PlayState* play) { (this->actor.yDistToWater < D_80854784[CUR_UPG_VALUE(UPG_SCALE)])) { func_8084DBC4(play, this, -2.0f); } else { - this->unk_84F++; + this->actionVar1++; Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim_wait); } - } else if (this->unk_84F == 1) { + } else if (this->actionVar1 == 1) { LinkAnimation_Update(play, &this->skelAnime); func_8084B000(this); if (this->unk_6C2 < 10000) { - this->unk_84F++; - this->unk_850 = this->actor.yDistToWater; + this->actionVar1++; + this->actionVar2 = this->actor.yDistToWater; Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim); } } else if (!func_8083D12C(play, this, sControlInput)) { - sp2C = (this->unk_850 * 0.018f) + 4.0f; + sp2C = (this->actionVar2 * 0.018f) + 4.0f; if (this->stateFlags1 & PLAYER_STATE1_11) { sControlInput = NULL; @@ -12545,9 +12550,9 @@ s32 func_8084DFF4(PlayState* play, Player* this) { return 1; } - if (this->unk_84F == 0) { + if (this->actionVar1 == 0) { giEntry = &sGetItemTable[this->getItemId - 1]; - this->unk_84F = 1; + this->actionVar1 = 1; Message_StartTextbox(play, giEntry->textId, &this->actor); Item_Give(play, giEntry->itemId); @@ -12640,7 +12645,7 @@ static s16 sWarpSongEntrances[] = { void Player_Action_8084E3C4(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_normal_okarina_swing); - this->unk_850 = 1; + this->actionVar2 = 1; if (this->stateFlags2 & (PLAYER_STATE2_23 | PLAYER_STATE2_25)) { this->stateFlags2 |= PLAYER_STATE2_24; } else { @@ -12649,7 +12654,7 @@ void Player_Action_8084E3C4(Player* this, PlayState* play) { return; } - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { return; } @@ -12717,12 +12722,12 @@ void Player_Action_8084E6D4(Player* this, PlayState* play) { s32 cond; if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_850 != 0) { - if (this->unk_850 >= 2) { - this->unk_850--; + if (this->actionVar2 != 0) { + if (this->actionVar2 >= 2) { + this->actionVar2--; } - if (func_8084DFF4(play, this) && (this->unk_850 == 1)) { + if (func_8084DFF4(play, this) && (this->actionVar2 == 1)) { cond = ((this->targetActor != NULL) && (this->exchangeItemId < 0)) || (this->stateFlags3 & PLAYER_STATE3_5); @@ -12762,11 +12767,11 @@ void Player_Action_8084E6D4(Player* this, PlayState* play) { Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_demo_get_itemA); } - this->unk_850 = 2; + this->actionVar2 = 2; func_80835EA4(play, 9); } } else { - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { if (!LINK_IS_ADULT) { func_80832924(this, D_808549E0); } @@ -12798,9 +12803,9 @@ static struct_80832924 D_808549F4[] = { void Player_Action_8084E9AC(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_84F == 0) { - if (DECR(this->unk_850) == 0) { - this->unk_84F = 1; + if (this->actionVar1 == 0) { + if (DECR(this->actionVar2) == 0) { + this->actionVar1 = 1; this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } } else { @@ -12826,7 +12831,7 @@ static u8 D_808549FC[] = { void Player_Action_8084EAC0(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { if (this->itemAction == PLAYER_IA_BOTTLE_POE) { s32 rand = Rand_S16Offset(-1, 3); @@ -12860,20 +12865,20 @@ void Player_Action_8084EAC0(Player* this, PlayState* play) { } Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_wait); - this->unk_850 = 1; + this->actionVar2 = 1; return; } func_8083C0E8(this, play); func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); - } else if (this->unk_850 == 1) { + } else if (this->actionVar2 == 1) { if ((gSaveContext.healthAccumulator == 0) && (gSaveContext.magicState != MAGIC_STATE_FILL)) { Player_AnimChangeOnceMorphAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_end); - this->unk_850 = 2; + this->actionVar2 = 2; Player_UpdateBottleHeld(play, this, ITEM_BOTTLE_EMPTY, PLAYER_IA_BOTTLE); } func_80832698(this, NA_SE_VO_LI_DRINK - SFX_FLAG); - } else if ((this->unk_850 == 2) && LinkAnimation_OnFrame(&this->skelAnime, 29.0f)) { + } else if ((this->actionVar2 == 2) && LinkAnimation_OnFrame(&this->skelAnime, 29.0f)) { func_80832698(this, NA_SE_VO_LI_BREATH_DRINK); } } @@ -12891,29 +12896,29 @@ void Player_Action_8084ECA4(Player* this, PlayState* play) { s32 temp; s32 i; - sp24 = &D_80854554[this->unk_850]; + sp24 = &D_80854554[this->actionVar2]; func_8083721C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_84F != 0) { - if (this->unk_850 == 0) { - Message_StartTextbox(play, sBottleCatchInfos[this->unk_84F - 1].textId, &this->actor); + if (this->actionVar1 != 0) { + if (this->actionVar2 == 0) { + Message_StartTextbox(play, sBottleCatchInfos[this->actionVar1 - 1].textId, &this->actor); Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900); - this->unk_850 = 1; + this->actionVar2 = 1; } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { - this->unk_84F = 0; + this->actionVar1 = 0; func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); } } else { func_8083C0E8(this, play); } } else { - if (this->unk_84F == 0) { + if (this->actionVar1 == 0) { temp = this->skelAnime.curFrame - sp24->unk_08; if (temp >= 0) { if (sp24->unk_09 >= temp) { - if (this->unk_850 != 0) { + if (this->actionVar2 != 0) { if (temp == 0) { Player_PlaySfx(this, NA_SE_IT_SCOOP_UP_WATER); } @@ -12928,8 +12933,8 @@ void Player_Action_8084ECA4(Player* this, PlayState* play) { } if (i < ARRAY_COUNT(sBottleCatchInfos)) { - this->unk_84F = i + 1; - this->unk_850 = 0; + this->actionVar1 = i + 1; + this->actionVar2 = 0; this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; this->interactRangeActor->parent = &this->actor; Player_UpdateBottleHeld(play, this, catchInfo->itemId, ABS(catchInfo->itemAction)); @@ -13012,7 +13017,7 @@ void Player_Action_8084F104(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_850 < 0) { + if (this->actionVar2 < 0) { func_8083C0E8(this, play); } else if (this->exchangeItemId == EXCH_ITEM_NONE) { Actor* targetActor = this->targetActor; @@ -13030,21 +13035,21 @@ void Player_Action_8084F104(Player* this, PlayState* play) { this->unk_862 = ABS(giEntry->gi); } - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { Message_StartTextbox(play, this->actor.textId, &this->actor); if ((this->itemAction == PLAYER_IA_CHICKEN) || (this->itemAction == PLAYER_IA_POCKET_CUCCO)) { Player_PlaySfx(this, NA_SE_EV_CHICKEN_CRY_M); } - this->unk_850 = 1; + this->actionVar2 = 1; } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~ACTOR_FLAG_8; this->unk_862 = 0; - if (this->unk_84F == 1) { + if (this->actionVar1 == 1) { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_bottle_read_end); - this->unk_850 = -1; + this->actionVar2 = -1; } else { func_8083C0E8(this, play); } @@ -13052,11 +13057,11 @@ void Player_Action_8084F104(Player* this, PlayState* play) { func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); } } - } else if (this->unk_850 >= 0) { + } else if (this->actionVar2 >= 0) { func_80832924(this, D_80854A3C); } - if ((this->unk_84F == 0) && (this->unk_664 != NULL)) { + if ((this->actionVar1 == 0) && (this->unk_664 != NULL)) { this->yaw = this->actor.shape.rot.y = func_8083DB98(this, 0); } } @@ -13099,7 +13104,7 @@ void Player_Action_8084F390(Player* this, PlayState* play) { Player_GetSlopeDirection(floorPoly, &slopeNormal, &downwardSlopeYaw); sp44 = downwardSlopeYaw; - if (this->unk_84F != 0) { + if (this->actionVar1 != 0) { sp44 = downwardSlopeYaw + 0x8000; } @@ -13124,7 +13129,7 @@ void Player_Action_8084F390(Player* this, PlayState* play) { if (Math_AsymStepToF(&this->speedXZ, sp50, sp4C, sp48) && (sp50 == 0)) { LinkAnimationHeader* anim; - if (this->unk_84F == 0) { + if (this->actionVar1 == 0) { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_down_slope_slip_end, this->modelAnimType); } else { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_up_slope_slip_end, this->modelAnimType); @@ -13138,7 +13143,7 @@ void Player_Action_8084F390(Player* this, PlayState* play) { } void Player_Action_8084F608(Player* this, PlayState* play) { - if ((DECR(this->unk_850) == 0) && func_8083ADD4(play, this)) { + if ((DECR(this->actionVar2) == 0) && func_8083ADD4(play, this)) { func_80852280(play, this, NULL); Player_SetupAction(play, this, Player_Action_80852E14, 0); Player_Action_80852E14(this, play); @@ -13147,23 +13152,23 @@ void Player_Action_8084F608(Player* this, PlayState* play) { void Player_Action_8084F698(Player* this, PlayState* play) { Player_SetupAction(play, this, Player_Action_8084F608, 0); - this->unk_850 = 40; + this->actionVar2 = 40; Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, DEMOKANKYO_WARP_IN); } void Player_Action_8084F710(Player* this, PlayState* play) { s32 pad; - if ((this->unk_84F != 0) && (play->csCtx.curFrame < 305)) { + if ((this->actionVar1 != 0) && (play->csCtx.curFrame < 305)) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; } else if (sYDistToFloor < 150.0f) { if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; func_808328A0(this); - this->unk_850 = 1; + this->actionVar2 = 1; } } else { if ((play->sceneId == SCENE_KOKIRI_FOREST) && func_8083ADD4(play, this)) { @@ -13189,13 +13194,13 @@ void Player_Action_8084F710(Player* this, PlayState* play) { void Player_Action_8084F88C(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); - if ((this->unk_850++ > 8) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { + if ((this->actionVar2++ > 8) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { - if (this->unk_84F != 0) { + if (this->actionVar1 != 0) { if (play->sceneId == SCENE_ICE_CAVERN) { Play_TriggerRespawn(play); play->nextEntranceIndex = ENTR_ICE_CAVERN_0; - } else if (this->unk_84F < 0) { + } else if (this->actionVar1 < 0) { Play_TriggerRespawn(play); } else { Play_TriggerVoidOut(play); @@ -13249,13 +13254,13 @@ void Player_Action_8084FA54(Player* this, PlayState* play) { } void Player_Action_8084FB10(Player* this, PlayState* play) { - if (this->unk_84F >= 0) { - if (this->unk_84F < 6) { - this->unk_84F++; + if (this->actionVar1 >= 0) { + if (this->actionVar1 < 6) { + this->actionVar1++; } if (func_80832594(this, 1, 100)) { - this->unk_84F = -1; + this->actionVar1 = -1; EffectSsIcePiece_SpawnBurst(play, &this->actor.world.pos, this->actor.scale.x); Player_PlaySfx(this, NA_SE_PL_ICE_BROKEN); } else { @@ -13277,8 +13282,8 @@ void Player_Action_8084FBF4(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); func_808382BC(this); - if (((this->unk_850 % 25) != 0) || func_80837B18(play, this, -1)) { - if (DECR(this->unk_850) == 0) { + if (((this->actionVar2 % 25) != 0) || func_80837B18(play, this, -1)) { + if (DECR(this->actionVar2) == 0) { func_80839F90(this, play); } } @@ -13525,9 +13530,9 @@ void Player_Action_8085063C(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); func_80836670(this, play); - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { Message_StartTextbox(play, 0x3B, &this->actor); - this->unk_850 = 1; + this->actionVar2 = 1; return; } @@ -13557,14 +13562,14 @@ void Player_Action_8085063C(Player* this, PlayState* play) { void Player_Action_8085076C(Player* this, PlayState* play) { s32 respawnData = gSaveContext.respawn[RESPAWN_MODE_TOP].data; - if (this->unk_850 > 20) { + if (this->actionVar2 > 20) { this->actor.draw = Player_Draw; this->actor.world.pos.y += 60.0f; func_80837B9C(this, play); return; } - if (this->unk_850++ == 20) { + if (this->actionVar2++ == 20) { gSaveContext.respawn[RESPAWN_MODE_TOP].data = respawnData + 1; Sfx_PlaySfxAtPos(&gSaveContext.respawn[RESPAWN_MODE_TOP].pos, NA_SE_PL_MAGIC_WIND_WARP); } @@ -13613,38 +13618,38 @@ static struct_80832924 D_80854A8C[][2] = { void Player_Action_808507F4(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_84F < 0) { + if (this->actionVar1 < 0) { if ((this->itemAction == PLAYER_IA_NAYRUS_LOVE) || (gSaveContext.magicState == MAGIC_STATE_IDLE)) { func_80839FFC(this, play); func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); } } else { - if (this->unk_850 == 0) { - LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A58[this->unk_84F], 0.83f); + if (this->actionVar2 == 0) { + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A58[this->actionVar1], 0.83f); - if (func_80846A00(play, this, this->unk_84F) != NULL) { + if (func_80846A00(play, this, this->actionVar1) != NULL) { this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; - if ((this->unk_84F != 0) || (gSaveContext.respawn[RESPAWN_MODE_TOP].data <= 0)) { + if ((this->actionVar1 != 0) || (gSaveContext.respawn[RESPAWN_MODE_TOP].data <= 0)) { gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP; } } else { Magic_Reset(play); } } else { - LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, D_80854A64[this->unk_84F], 0.83f); + LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, D_80854A64[this->actionVar1], 0.83f); - if (this->unk_84F == 0) { - this->unk_850 = -10; + if (this->actionVar1 == 0) { + this->actionVar2 = -10; } } - this->unk_850++; + this->actionVar2++; } } else { - if (this->unk_850 < 0) { - this->unk_850++; + if (this->actionVar2 < 0) { + this->actionVar2++; - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { gSaveContext.respawn[RESPAWN_MODE_TOP].data = 1; Play_SetupRespawnPoint(play, RESPAWN_MODE_TOP, 0x6FF); gSaveContext.save.info.fw.set = 1; @@ -13657,20 +13662,20 @@ void Player_Action_808507F4(Player* this, PlayState* play) { gSaveContext.save.info.fw.roomIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].roomIndex; gSaveContext.save.info.fw.tempSwchFlags = gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags; gSaveContext.save.info.fw.tempCollectFlags = gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags; - this->unk_850 = 2; + this->actionVar2 = 2; } - } else if (this->unk_84F >= 0) { - if (this->unk_850 == 0) { + } else if (this->actionVar1 >= 0) { + if (this->actionVar2 == 0) { func_80832924(this, D_80854A80); - } else if (this->unk_850 == 1) { - func_80832924(this, D_80854A8C[this->unk_84F]); - if ((this->unk_84F == 2) && LinkAnimation_OnFrame(&this->skelAnime, 30.0f)) { + } else if (this->actionVar2 == 1) { + func_80832924(this, D_80854A8C[this->actionVar1]); + if ((this->actionVar1 == 2) && LinkAnimation_OnFrame(&this->skelAnime, 30.0f)) { this->stateFlags1 &= ~(PLAYER_STATE1_28 | PLAYER_STATE1_29); } - } else if (D_80854A7C[this->unk_84F] < this->unk_850++) { - LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A70[this->unk_84F], 0.83f); + } else if (D_80854A7C[this->actionVar1] < this->actionVar2++) { + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A70[this->actionVar1], 0.83f); this->yaw = this->actor.shape.rot.y; - this->unk_84F = -1; + this->actionVar1 = -1; } } } @@ -13717,7 +13722,7 @@ void Player_Action_80850AEC(Player* this, PlayState* play) { } void Player_Action_80850C68(Player* this, PlayState* play) { - if ((this->unk_850 != 0) && ((this->unk_858 != 0.0f) || (this->unk_85C != 0.0f))) { + if ((this->actionVar2 != 0) && ((this->unk_858 != 0.0f) || (this->unk_85C != 0.0f))) { f32 updateScale = R_UPDATE_RATE * 0.5f; this->skelAnime.curFrame += this->skelAnime.playSpeed * updateScale; @@ -13737,7 +13742,7 @@ void Player_Action_80850C68(Player* this, PlayState* play) { } else if (LinkAnimation_Update(play, &this->skelAnime)) { this->unk_860 = 2; Player_AnimPlayLoop(play, this, &gPlayerAnim_link_fishing_wait); - this->unk_850 = 1; + this->actionVar2 = 1; } func_8083721C(this); @@ -14071,7 +14076,7 @@ void func_808511D4(PlayState* play, Player* this, void* anim) { void func_808511FC(PlayState* play, Player* this, void* anim) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimChangeLoopMorphAdjustedZeroRootYawSpeed(play, this, anim); - this->unk_850 = 1; + this->actionVar2 = 1; } } @@ -14085,7 +14090,7 @@ void func_80851248(PlayState* play, Player* this, void* anim) { void func_80851294(PlayState* play, Player* this, void* anim) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimReplaceNormalPlayLoopAdjusted(play, this, anim); - this->unk_850 = 1; + this->actionVar2 = 1; } } @@ -14117,9 +14122,9 @@ void func_80851368(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_808513BC(PlayState* play, Player* this, CsCmdActorCue* cue) { this->actor.gravity = 0.0f; - if (this->unk_84F == 0) { + if (this->actionVar1 == 0) { if (func_8083D12C(play, this, NULL)) { - this->unk_84F = 1; + this->actionVar1 = 1; } else { func_8084B158(play, this, NULL, fabsf(this->actor.velocity.y)); Math_ScaledStepToS(&this->unk_6C2, -10000, 800); @@ -14129,7 +14134,7 @@ void func_808513BC(PlayState* play, Player* this, CsCmdActorCue* cue) { } if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_84F == 1) { + if (this->actionVar1 == 1) { Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim_wait); } else { Player_AnimPlayLoop(play, this, &gPlayerAnim_link_swimer_swim_wait); @@ -14234,7 +14239,7 @@ void func_80851828(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80845BA0(play, this, &sp1C, 10); if (play->sceneId == SCENE_JABU_JABU_BOSS) { - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { return; } @@ -14245,8 +14250,8 @@ void func_80851828(PlayState* play, Player* this, CsCmdActorCue* cue) { } } - this->unk_850++; - if (this->unk_850 > 20) { + this->actionVar2++; + if (this->actionVar2 > 20) { this->csMode = PLAYER_CSMODE_11; } } @@ -14258,10 +14263,10 @@ void func_808518DC(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_8085190C(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80851314(this); - if (this->unk_850 != 0) { + if (this->actionVar2 != 0) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoop(play, this, func_808334E4(this)); - this->unk_850 = 0; + this->actionVar2 = 0; } func_80833C3C(this); @@ -14348,10 +14353,10 @@ static struct_80832924 D_808551B4[] = { void func_80851BE8(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimation_Update(play, &this->skelAnime); - this->unk_850++; + this->actionVar2++; - if (this->unk_850 >= 180) { - if (this->unk_850 == 180) { + if (this->actionVar2 >= 180) { + if (this->actionVar2 == 180) { LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_okarina_warp_goal, (2.0f / 3.0f), 10.0f, Animation_GetLastFrame(&gPlayerAnim_link_okarina_warp_goal), ANIMMODE_ONCE, -8.0f); } @@ -14360,13 +14365,13 @@ void func_80851BE8(PlayState* play, Player* this, CsCmdActorCue* cue) { } void func_80851CA4(PlayState* play, Player* this, CsCmdActorCue* cue) { - if (LinkAnimation_Update(play, &this->skelAnime) && (this->unk_850 == 0) && + if (LinkAnimation_Update(play, &this->skelAnime) && (this->actionVar2 == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_back_downB); - this->unk_850 = 1; + this->actionVar2 = 1; } - if (this->unk_850 != 0) { + if (this->actionVar2 != 0) { func_8083721C(this); } } @@ -14423,8 +14428,8 @@ void func_80851ECC(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80851F14(PlayState* play, Player* this, LinkAnimationHeader* anim, struct_80832924* arg3) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoopAdjusted(play, this, anim); - this->unk_850 = 1; - } else if (this->unk_850 == 0) { + this->actionVar2 = 1; + } else if (this->actionVar2 == 0) { func_80832924(this, arg3); } } @@ -14445,8 +14450,8 @@ void func_80851FB0(PlayState* play, Player* this, CsCmdActorCue* cue) { Player_AnimReplacePlayLoop(play, this, &gPlayerAnim_clink_op3_wait3, ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); - this->unk_850 = 1; - } else if (this->unk_850 == 0) { + this->actionVar2 = 1; + } else if (this->actionVar2 == 0) { func_80832924(this, D_808551BC); if (LinkAnimation_OnFrame(&this->skelAnime, 240.0f)) { this->actor.shape.shadowDraw = ActorShadow_DrawFeet; @@ -14527,8 +14532,8 @@ void func_80852280(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80852298(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimReplaceNormalPlayLoopAdjusted(play, this, &gPlayerAnim_clink_demo_koutai_wait); - this->unk_850 = 1; - } else if (this->unk_850 == 0) { + this->actionVar2 = 1; + } else if (this->actionVar2 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 10.0f)) { func_80846720(play, this, 1); } @@ -14556,10 +14561,10 @@ void func_80852358(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80852388(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_demo_link_twait); - this->unk_850 = 1; + this->actionVar2 = 1; } - if ((this->unk_850 != 0) && (play->csCtx.curFrame >= 900)) { + if ((this->actionVar2 != 0) && (play->csCtx.curFrame >= 900)) { this->rightHandType = PLAYER_MODELTYPE_LH_OPEN; } else { this->rightHandType = PLAYER_MODELTYPE_RH_FF; @@ -14568,7 +14573,7 @@ void func_80852388(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80852414(PlayState* play, Player* this, LinkAnimationHeader* anim, struct_80832924* arg3) { func_80851294(play, this, anim); - if (this->unk_850 == 0) { + if (this->actionVar2 == 0) { func_80832924(this, arg3); } } @@ -14626,7 +14631,7 @@ static void (*D_808551FC[])(Player* this, PlayState* play) = { }; void func_808525C0(PlayState* play, Player* this, CsCmdActorCue* cue) { - D_808551FC[this->unk_850](this, play); + D_808551FC[this->actionVar2](this, play); } void func_80852608(PlayState* play, Player* this, CsCmdActorCue* cue) { @@ -14688,7 +14693,7 @@ void func_808526EC(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_8085283C(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_80852944(play, this, cue); - } else if (this->unk_850 == 0) { + } else if (this->actionVar2 == 0) { Item_Give(play, ITEM_SWORD_MASTER); func_80846720(play, this, 0); } else { @@ -14803,8 +14808,8 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cueUnused) { func_80852C0C(play, this, ABS(csMode)); func_80852B4C(play, this, cue, &D_80854B18[ABS(csMode)]); - this->unk_850 = 0; - this->unk_84F = 0; + this->actionVar2 = 0; + this->actionVar1 = 0; this->cueId = cue->id; } @@ -14914,12 +14919,12 @@ void func_80853148(PlayState* play, Actor* actor) { } if (this->stateFlags1 & PLAYER_STATE1_23) { - s32 sp24 = this->unk_850; + s32 sp24 = this->actionVar2; func_80832528(play, this); func_8083A2F8(play, this); - this->unk_850 = sp24; + this->actionVar2 = sp24; } else { if (func_808332B8(this)) { func_80836898(play, this, func_8083A2F8); From 5170f2de1791a8c6c8f50ce636e3b2d5530f18aa Mon Sep 17 00:00:00 2001 From: fig02 Date: Mon, 18 Sep 2023 00:08:43 -0400 Subject: [PATCH 12/29] Start Player Item Docs (#1523) * item docs * format * loop change * some of engineers review * shorten comment (thanks formatter) * ProcessItemButtons * true/false --- include/z64player.h | 16 +- .../actors/ovl_player_actor/z_player.c | 609 ++++++++++-------- 2 files changed, 340 insertions(+), 285 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index fb8f7795d..7acac60ab 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -519,7 +519,7 @@ typedef struct { #define PLAYER_STATE1_5 (1 << 5) #define PLAYER_STATE1_6 (1 << 6) #define PLAYER_STATE1_7 (1 << 7) -#define PLAYER_STATE1_8 (1 << 8) +#define PLAYER_STATE1_START_CHANGING_HELD_ITEM (1 << 8) #define PLAYER_STATE1_9 (1 << 9) #define PLAYER_STATE1_10 (1 << 10) #define PLAYER_STATE1_11 (1 << 11) @@ -587,7 +587,7 @@ typedef struct { #define PLAYER_STATE3_7 (1 << 7) typedef void (*PlayerActionFunc)(struct Player*, struct PlayState*); -typedef s32 (*PlayerFunc82C)(struct Player*, struct PlayState*); +typedef s32 (*ItemActionFunc)(struct Player*, struct PlayState*); typedef void (*PlayerFuncA74)(struct PlayState*, struct Player*); typedef struct Player { @@ -604,7 +604,7 @@ typedef struct Player { /* 0x0155 */ char unk_155[0x003]; /* 0x0158 */ u8 modelGroup; /* 0x0159 */ u8 nextModelGroup; - /* 0x015A */ s8 unk_15A; + /* 0x015A */ s8 itemChangeType; /* 0x015B */ u8 modelAnimType; /* 0x015C */ u8 leftHandType; /* 0x015D */ u8 rightHandType; @@ -688,11 +688,11 @@ typedef struct Player { /* 0x06C0 */ s16 unk_6C0; /* 0x06C2 */ s16 unk_6C2; /* 0x06C4 */ f32 unk_6C4; - /* 0x06C8 */ SkelAnime skelAnime2; - /* 0x070C */ Vec3s jointTable2[PLAYER_LIMB_BUF_COUNT]; - /* 0x079C */ Vec3s morphTable2[PLAYER_LIMB_BUF_COUNT]; - /* 0x082C */ PlayerFunc82C func_82C; - /* 0x0830 */ f32 unk_830; + /* 0x06C8 */ SkelAnime skelAnimeUpper; + /* 0x070C */ Vec3s jointTableUpper[PLAYER_LIMB_BUF_COUNT]; + /* 0x079C */ Vec3s morphTableUpper[PLAYER_LIMB_BUF_COUNT]; + /* 0x082C */ ItemActionFunc itemActionFunc; + /* 0x0830 */ f32 skelAnimeUpperBlendWeight; /* 0x0834 */ s16 unk_834; /* 0x0836 */ s8 unk_836; /* 0x0837 */ u8 unk_837; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index d92449630..39e915695 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -86,8 +86,8 @@ typedef struct { typedef struct { /* 0x00 */ LinkAnimationHeader* anim; - /* 0x04 */ u8 unk_04; -} struct_808540F4; // size = 0x08 + /* 0x04 */ u8 changeFrame; +} ItemChangeInfo; // size = 0x08 typedef struct { /* 0x00 */ LinkAnimationHeader* unk_00; @@ -125,10 +125,10 @@ void func_8083377C(PlayState* play, Player* this); void func_808337D4(PlayState* play, Player* this); void func_80833910(PlayState* play, Player* this); void func_80833984(PlayState* play, Player* this); -void func_8083399C(PlayState* play, Player* this, s8 itemAction); +void Player_InitItemAction(PlayState* play, Player* this, s8 itemAction); s32 func_8083485C(Player* this, PlayState* play); s32 func_808349DC(Player* this, PlayState* play); -s32 func_80834A2C(Player* this, PlayState* play); +s32 Player_IA_ChangeHeldItem(Player* this, PlayState* play); s32 func_80834B5C(Player* this, PlayState* play); s32 func_80834C74(Player* this, PlayState* play); s32 func_8083501C(Player* this, PlayState* play); @@ -142,7 +142,7 @@ s32 func_808358F0(Player* this, PlayState* play); s32 func_808359FC(Player* this, PlayState* play); s32 func_80835B60(Player* this, PlayState* play); s32 func_80835C08(Player* this, PlayState* play); -void func_80835F44(PlayState* play, Player* this, s32 item); +void Player_UseItem(PlayState* play, Player* this, s32 item); void func_80839F90(Player* this, PlayState* play); s32 func_80838A14(Player* this, PlayState* play); s32 func_80839800(Player* this, PlayState* play); @@ -353,7 +353,30 @@ static Input* sControlInput; // .data -static u8 D_80853410[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; +static u8 sUpperBodyLimbCopyMap[PLAYER_LIMB_MAX] = { + false, // PLAYER_LIMB_NONE + false, // PLAYER_LIMB_ROOT + false, // PLAYER_LIMB_WAIST + false, // PLAYER_LIMB_LOWER + false, // PLAYER_LIMB_R_THIGH + false, // PLAYER_LIMB_R_SHIN + false, // PLAYER_LIMB_R_FOOT + false, // PLAYER_LIMB_L_THIGH + false, // PLAYER_LIMB_L_SHIN + false, // PLAYER_LIMB_L_FOOT + true, // PLAYER_LIMB_UPPER + true, // PLAYER_LIMB_HEAD + true, // PLAYER_LIMB_HAT + true, // PLAYER_LIMB_COLLAR + true, // PLAYER_LIMB_L_SHOULDER + true, // PLAYER_LIMB_L_FOREARM + true, // PLAYER_LIMB_L_HAND + true, // PLAYER_LIMB_R_SHOULDER + true, // PLAYER_LIMB_R_FOREARM + true, // PLAYER_LIMB_R_HAND + true, // PLAYER_LIMB_SHEATH + true // PLAYER_LIMB_TORSO +}; static PlayerAgeProperties sAgeProperties[] = { { @@ -479,8 +502,8 @@ static s32 sPrevFloorProperty = FLOOR_PROPERTY_0; // floor property from the pre static s32 sShapeYawToTouchedWall = 0; static s32 sWorldYawToTouchedWall = 0; static s16 sFloorShapePitch = 0; -static s32 D_80853614 = 0; -static s32 D_80853618 = 0; +static s32 sUseHeldItem = false; // When true, the current held item is used. Is reset to false every frame. +static s32 sHeldItemButtonIsHeldDown = false; // Indicates if the button for the current held item is held down. static u16 D_8085361C[] = { NA_SE_VO_LI_SWEAT, @@ -1212,7 +1235,7 @@ static s8 sItemActions[] = { PLAYER_IA_SWORD_BIGGORON, // ITEM_SWORD_BIGGORON }; -static s32 (*D_80853EDC[])(Player* this, PlayState* play) = { +static s32 (*sItemActionUpdateFuncs[])(Player* this, PlayState* play) = { func_8083485C, // PLAYER_IA_NONE func_8083485C, // PLAYER_IA_LAST_USED func_8083485C, // PLAYER_IA_FISHING_POLE @@ -1282,7 +1305,7 @@ static s32 (*D_80853EDC[])(Player* this, PlayState* play) = { func_8083485C, // PLAYER_IA_LENS_OF_TRUTH }; -static void (*D_80853FE8[])(PlayState* play, Player* this) = { +static void (*sItemActionInitFuncs[])(PlayState* play, Player* this) = { func_80833770, // PLAYER_IA_NONE func_80833770, // PLAYER_IA_LAST_USED func_80833770, // PLAYER_IA_FISHING_POLE @@ -1353,53 +1376,55 @@ static void (*D_80853FE8[])(PlayState* play, Player* this) = { }; typedef enum { - /* 0 */ PLAYER_D_808540F4_0, - /* 1 */ PLAYER_D_808540F4_1, - /* 2 */ PLAYER_D_808540F4_2, - /* 3 */ PLAYER_D_808540F4_3, - /* 4 */ PLAYER_D_808540F4_4, - /* 5 */ PLAYER_D_808540F4_5, - /* 6 */ PLAYER_D_808540F4_6, - /* 7 */ PLAYER_D_808540F4_7, - /* 8 */ PLAYER_D_808540F4_8, - /* 9 */ PLAYER_D_808540F4_9, - /* 10 */ PLAYER_D_808540F4_10, - /* 11 */ PLAYER_D_808540F4_11, - /* 12 */ PLAYER_D_808540F4_12, - /* 13 */ PLAYER_D_808540F4_13, - /* 14 */ PLAYER_D_808540F4_MAX -} PlayerD_808540F4Index; + /* 0 */ PLAYER_ITEM_CHG_0, + /* 1 */ PLAYER_ITEM_CHG_1, + /* 2 */ PLAYER_ITEM_CHG_2, + /* 3 */ PLAYER_ITEM_CHG_3, + /* 4 */ PLAYER_ITEM_CHG_4, + /* 5 */ PLAYER_ITEM_CHG_5, + /* 6 */ PLAYER_ITEM_CHG_6, + /* 7 */ PLAYER_ITEM_CHG_7, + /* 8 */ PLAYER_ITEM_CHG_8, + /* 9 */ PLAYER_ITEM_CHG_9, + /* 10 */ PLAYER_ITEM_CHG_10, + /* 11 */ PLAYER_ITEM_CHG_11, + /* 12 */ PLAYER_ITEM_CHG_12, + /* 13 */ PLAYER_ITEM_CHG_13, + /* 14 */ PLAYER_ITEM_CHG_MAX +} ItemChangeType; -static struct_808540F4 D_808540F4[PLAYER_D_808540F4_MAX] = { - /* PLAYER_D_808540F4_0 */ { &gPlayerAnim_link_normal_free2free, 12 }, - /* PLAYER_D_808540F4_1 */ { &gPlayerAnim_link_normal_normal2fighter, 6 }, - /* PLAYER_D_808540F4_2 */ { &gPlayerAnim_link_hammer_normal2long, 8 }, - /* PLAYER_D_808540F4_3 */ { &gPlayerAnim_link_normal_normal2free, 8 }, - /* PLAYER_D_808540F4_4 */ { &gPlayerAnim_link_fighter_fighter2long, 8 }, - /* PLAYER_D_808540F4_5 */ { &gPlayerAnim_link_normal_fighter2free, 10 }, - /* PLAYER_D_808540F4_6 */ { &gPlayerAnim_link_hammer_long2free, 7 }, - /* PLAYER_D_808540F4_7 */ { &gPlayerAnim_link_hammer_long2long, 11 }, - /* PLAYER_D_808540F4_8 */ { &gPlayerAnim_link_normal_free2free, 12 }, - /* PLAYER_D_808540F4_9 */ { &gPlayerAnim_link_normal_normal2bom, 4 }, - /* PLAYER_D_808540F4_10 */ { &gPlayerAnim_link_normal_long2bom, 4 }, - /* PLAYER_D_808540F4_11 */ { &gPlayerAnim_link_normal_free2bom, 4 }, - /* PLAYER_D_808540F4_12 */ { &gPlayerAnim_link_anchor_anchor2fighter, 5 }, - /* PLAYER_D_808540F4_13 */ { &gPlayerAnim_link_normal_free2freeB, 13 }, +static ItemChangeInfo sItemChangeInfo[PLAYER_ITEM_CHG_MAX] = { + /* PLAYER_ITEM_CHG_0 */ { &gPlayerAnim_link_normal_free2free, 12 }, + /* PLAYER_ITEM_CHG_1 */ { &gPlayerAnim_link_normal_normal2fighter, 6 }, + /* PLAYER_ITEM_CHG_2 */ { &gPlayerAnim_link_hammer_normal2long, 8 }, + /* PLAYER_ITEM_CHG_3 */ { &gPlayerAnim_link_normal_normal2free, 8 }, + /* PLAYER_ITEM_CHG_4 */ { &gPlayerAnim_link_fighter_fighter2long, 8 }, + /* PLAYER_ITEM_CHG_5 */ { &gPlayerAnim_link_normal_fighter2free, 10 }, + /* PLAYER_ITEM_CHG_6 */ { &gPlayerAnim_link_hammer_long2free, 7 }, + /* PLAYER_ITEM_CHG_7 */ { &gPlayerAnim_link_hammer_long2long, 11 }, + /* PLAYER_ITEM_CHG_8 */ { &gPlayerAnim_link_normal_free2free, 12 }, + /* PLAYER_ITEM_CHG_9 */ { &gPlayerAnim_link_normal_normal2bom, 4 }, + /* PLAYER_ITEM_CHG_10 */ { &gPlayerAnim_link_normal_long2bom, 4 }, + /* PLAYER_ITEM_CHG_11 */ { &gPlayerAnim_link_normal_free2bom, 4 }, + /* PLAYER_ITEM_CHG_12 */ { &gPlayerAnim_link_anchor_anchor2fighter, 5 }, + /* PLAYER_ITEM_CHG_13 */ { &gPlayerAnim_link_normal_free2freeB, 13 }, }; -static s8 D_80854164[PLAYER_ANIMTYPE_MAX][PLAYER_ANIMTYPE_MAX] = { - { PLAYER_D_808540F4_8, -PLAYER_D_808540F4_5, -PLAYER_D_808540F4_3, -PLAYER_D_808540F4_6, PLAYER_D_808540F4_8, - PLAYER_D_808540F4_11 }, - { PLAYER_D_808540F4_5, PLAYER_D_808540F4_0, -PLAYER_D_808540F4_1, PLAYER_D_808540F4_4, PLAYER_D_808540F4_5, - PLAYER_D_808540F4_9 }, - { PLAYER_D_808540F4_3, PLAYER_D_808540F4_1, PLAYER_D_808540F4_0, PLAYER_D_808540F4_2, PLAYER_D_808540F4_3, - PLAYER_D_808540F4_9 }, - { PLAYER_D_808540F4_6, -PLAYER_D_808540F4_4, -PLAYER_D_808540F4_2, PLAYER_D_808540F4_7, PLAYER_D_808540F4_6, - PLAYER_D_808540F4_10 }, - { PLAYER_D_808540F4_8, -PLAYER_D_808540F4_5, -PLAYER_D_808540F4_3, -PLAYER_D_808540F4_6, PLAYER_D_808540F4_8, - PLAYER_D_808540F4_11 }, - { PLAYER_D_808540F4_8, -PLAYER_D_808540F4_5, -PLAYER_D_808540F4_3, -PLAYER_D_808540F4_6, PLAYER_D_808540F4_8, - PLAYER_D_808540F4_11 }, +// Maps the appropriate ItemChangeType based on current and next animtype. +// A negative type value means the corresponding animation should be played in reverse. +static s8 sItemChangeTypes[PLAYER_ANIMTYPE_MAX][PLAYER_ANIMTYPE_MAX] = { + { PLAYER_ITEM_CHG_8, -PLAYER_ITEM_CHG_5, -PLAYER_ITEM_CHG_3, -PLAYER_ITEM_CHG_6, PLAYER_ITEM_CHG_8, + PLAYER_ITEM_CHG_11 }, + { PLAYER_ITEM_CHG_5, PLAYER_ITEM_CHG_0, -PLAYER_ITEM_CHG_1, PLAYER_ITEM_CHG_4, PLAYER_ITEM_CHG_5, + PLAYER_ITEM_CHG_9 }, + { PLAYER_ITEM_CHG_3, PLAYER_ITEM_CHG_1, PLAYER_ITEM_CHG_0, PLAYER_ITEM_CHG_2, PLAYER_ITEM_CHG_3, + PLAYER_ITEM_CHG_9 }, + { PLAYER_ITEM_CHG_6, -PLAYER_ITEM_CHG_4, -PLAYER_ITEM_CHG_2, PLAYER_ITEM_CHG_7, PLAYER_ITEM_CHG_6, + PLAYER_ITEM_CHG_10 }, + { PLAYER_ITEM_CHG_8, -PLAYER_ITEM_CHG_5, -PLAYER_ITEM_CHG_3, -PLAYER_ITEM_CHG_6, PLAYER_ITEM_CHG_8, + PLAYER_ITEM_CHG_11 }, + { PLAYER_ITEM_CHG_8, -PLAYER_ITEM_CHG_5, -PLAYER_ITEM_CHG_3, -PLAYER_ITEM_CHG_6, PLAYER_ITEM_CHG_8, + PLAYER_ITEM_CHG_11 }, }; static ExplosiveInfo sExplosiveInfos[] = { @@ -1526,7 +1551,7 @@ static LinkAnimationHeader* D_80854378[] = { static u8 D_80854380[2] = { PLAYER_MWA_SPIN_ATTACK_1H, PLAYER_MWA_SPIN_ATTACK_2H }; static u8 D_80854384[2] = { PLAYER_MWA_BIG_SPIN_1H, PLAYER_MWA_BIG_SPIN_2H }; -static u16 D_80854388[] = { BTN_B, BTN_CLEFT, BTN_CDOWN, BTN_CRIGHT }; +static u16 sItemButtons[] = { BTN_B, BTN_CLEFT, BTN_CDOWN, BTN_CRIGHT }; static u8 sMagicSpellCosts[] = { 12, 24, 24, 12, 24, 12 }; @@ -1628,7 +1653,7 @@ void func_80832340(PlayState* play, Player* this) { this->stateFlags2 &= ~(PLAYER_STATE2_10 | PLAYER_STATE2_11); } -void func_808323B4(PlayState* play, Player* this) { +void Player_DetachHeldActor(PlayState* play, Player* this) { Actor* heldActor = this->heldActor; if ((heldActor != NULL) && !Player_HoldsHookshot(this)) { @@ -1640,7 +1665,7 @@ void func_808323B4(PlayState* play, Player* this) { } if (Player_GetExplosiveHeld(this) >= 0) { - func_8083399C(play, this, PLAYER_IA_NONE); + Player_InitItemAction(play, this, PLAYER_IA_NONE); this->heldItemId = ITEM_NONE_FE; } } @@ -1674,7 +1699,7 @@ void func_80832440(PlayState* play, Player* this) { s32 func_80832528(PlayState* play, Player* this) { if (this->heldItemAction >= PLAYER_IA_FISHING_POLE) { - func_80835F44(play, this, ITEM_NONE); + Player_UseItem(play, this, ITEM_NONE); return 1; } else { return 0; @@ -1683,7 +1708,7 @@ s32 func_80832528(PlayState* play, Player* this) { void func_80832564(PlayState* play, Player* this) { func_80832440(play, this); - func_808323B4(play, this); + Player_DetachHeldActor(play, this); } s32 func_80832594(Player* this, s32 arg1, s32 arg2) { @@ -2090,31 +2115,31 @@ LinkAnimationHeader* func_808335F4(Player* this) { } } -void func_80833638(Player* this, PlayerFunc82C arg1) { - this->func_82C = arg1; +void Player_SetItemActionFunc(Player* this, ItemActionFunc itemActionFunc) { + this->itemActionFunc = itemActionFunc; this->unk_836 = 0; - this->unk_830 = 0.0f; + this->skelAnimeUpperBlendWeight = 0.0f; func_808326F0(this); } -void func_80833664(PlayState* play, Player* this, s8 itemAction) { +void Player_InitItemActionWithAnim(PlayState* play, Player* this, s8 itemAction) { LinkAnimationHeader* current = this->skelAnime.animation; LinkAnimationHeader** iter = D_80853914 + this->modelAnimType; - u32 i; + u32 animGroup; this->stateFlags1 &= ~(PLAYER_STATE1_3 | PLAYER_STATE1_24); - for (i = 0; i < PLAYER_ANIMGROUP_MAX; i++) { + for (animGroup = 0; animGroup < PLAYER_ANIMGROUP_MAX; animGroup++) { if (current == *iter) { break; } iter += PLAYER_ANIMTYPE_MAX; } - func_8083399C(play, this, itemAction); + Player_InitItemAction(play, this, itemAction); - if (i < PLAYER_ANIMGROUP_MAX) { - this->skelAnime.animation = GET_PLAYER_ANIM(i, this->modelAnimType); + if (animGroup < PLAYER_ANIMGROUP_MAX) { + this->skelAnime.animation = GET_PLAYER_ANIM(animGroup, this->modelAnimType); } } @@ -2197,7 +2222,7 @@ void func_80833984(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_24; } -void func_8083399C(PlayState* play, Player* this, s8 itemAction) { +void Player_InitItemAction(PlayState* play, Player* this, s8 itemAction) { this->unk_860 = 0; this->unk_85C = 0.0f; this->unk_858 = 0.0f; @@ -2207,7 +2232,7 @@ void func_8083399C(PlayState* play, Player* this, s8 itemAction) { this->stateFlags1 &= ~(PLAYER_STATE1_3 | PLAYER_STATE1_24); - D_80853FE8[itemAction](play, this); + sItemActionInitFuncs[itemAction](play, this); Player_SetModelGroup(this, this->modelGroup); } @@ -2284,23 +2309,23 @@ void func_80833C3C(Player* this) { this->unk_870 = this->unk_874 = 0.0f; } -s32 func_80833C50(Player* this, s32 item) { +s32 Player_ItemIsInUse(Player* this, s32 item) { if ((item < ITEM_NONE_FE) && (Player_ItemToItemAction(item) == this->itemAction)) { - return 1; + return true; } else { - return 0; + return false; } } -s32 func_80833C98(s32 item1, s32 itemAction) { +s32 Player_ItemIsItemAction(s32 item1, s32 itemAction) { if ((item1 < ITEM_NONE_FE) && (Player_ItemToItemAction(item1) == itemAction)) { - return 1; + return true; } else { - return 0; + return false; } } -s32 func_80833CDC(PlayState* play, s32 index) { +s32 Player_GetItemOnButton(PlayState* play, s32 index) { if (index >= 4) { return ITEM_NONE; } else if (play->bombchuBowlingStatus != 0) { @@ -2316,114 +2341,129 @@ s32 func_80833CDC(PlayState* play, s32 index) { } } -void func_80833DF8(Player* this, PlayState* play) { +/** + * Handles the high level item usage and changing process based on the B and C buttons. + * + * Tasks include: + * - Put away a mask if it is not present on any C button + * - Put away an item if it is not present on the B button or any C button + * - Use an item on the B button or any C button if the corresponding button is pressed + * - Keep track of the current item button being held down + */ +void Player_ProcessItemButtons(Player* this, PlayState* play) { s32 maskItemAction; s32 item; s32 i; if (this->currentMask != PLAYER_MASK_NONE) { maskItemAction = this->currentMask - 1 + PLAYER_IA_MASK_KEATON; - if (!func_80833C98(C_BTN_ITEM(0), maskItemAction) && !func_80833C98(C_BTN_ITEM(1), maskItemAction) && - !func_80833C98(C_BTN_ITEM(2), maskItemAction)) { + + if (!Player_ItemIsItemAction(C_BTN_ITEM(0), maskItemAction) && + !Player_ItemIsItemAction(C_BTN_ITEM(1), maskItemAction) && + !Player_ItemIsItemAction(C_BTN_ITEM(2), maskItemAction)) { this->currentMask = PLAYER_MASK_NONE; } } if (!(this->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_29)) && !func_8008F128(this)) { if (this->itemAction >= PLAYER_IA_FISHING_POLE) { - if (!func_80833C50(this, B_BTN_ITEM) && !func_80833C50(this, C_BTN_ITEM(0)) && - !func_80833C50(this, C_BTN_ITEM(1)) && !func_80833C50(this, C_BTN_ITEM(2))) { - func_80835F44(play, this, ITEM_NONE); + if (!Player_ItemIsInUse(this, B_BTN_ITEM) && !Player_ItemIsInUse(this, C_BTN_ITEM(0)) && + !Player_ItemIsInUse(this, C_BTN_ITEM(1)) && !Player_ItemIsInUse(this, C_BTN_ITEM(2))) { + Player_UseItem(play, this, ITEM_NONE); return; } } - for (i = 0; i < ARRAY_COUNT(D_80854388); i++) { - if (CHECK_BTN_ALL(sControlInput->press.button, D_80854388[i])) { + for (i = 0; i < ARRAY_COUNT(sItemButtons); i++) { + if (CHECK_BTN_ALL(sControlInput->press.button, sItemButtons[i])) { break; } } - item = func_80833CDC(play, i); + item = Player_GetItemOnButton(play, i); + if (item >= ITEM_NONE_FE) { - for (i = 0; i < ARRAY_COUNT(D_80854388); i++) { - if (CHECK_BTN_ALL(sControlInput->cur.button, D_80854388[i])) { + for (i = 0; i < ARRAY_COUNT(sItemButtons); i++) { + if (CHECK_BTN_ALL(sControlInput->cur.button, sItemButtons[i])) { break; } } - item = func_80833CDC(play, i); + item = Player_GetItemOnButton(play, i); + if ((item < ITEM_NONE_FE) && (Player_ItemToItemAction(item) == this->heldItemAction)) { - D_80853618 = true; + sHeldItemButtonIsHeldDown = true; } } else { this->heldItemButton = i; - func_80835F44(play, this, item); + Player_UseItem(play, this, item); } } } -void func_808340DC(Player* this, PlayState* play) { +void Player_StartChangingHeldItem(Player* this, PlayState* play) { LinkAnimationHeader* anim; - f32 phi_f2; - f32 phi_f12; - f32 phi_f14; - f32 phi_f0; - s32 sp38; - s8 sp37; + f32 endFrameTemp; + f32 startFrame; + f32 endFrame; + f32 playSpeed; + s32 itemChangeType; + s8 heldItemAction; s32 nextAnimType; - sp37 = Player_ItemToItemAction(this->heldItemId); - func_80833638(this, func_80834A2C); + heldItemAction = Player_ItemToItemAction(this->heldItemId); + + Player_SetItemActionFunc(this, Player_IA_ChangeHeldItem); nextAnimType = gPlayerModelTypes[this->nextModelGroup][PLAYER_MODELGROUPENTRY_ANIM]; - sp38 = D_80854164[gPlayerModelTypes[this->modelGroup][PLAYER_MODELGROUPENTRY_ANIM]][nextAnimType]; - if ((sp37 == PLAYER_IA_BOTTLE) || (sp37 == PLAYER_IA_BOOMERANG) || - ((sp37 == PLAYER_IA_NONE) && + itemChangeType = sItemChangeTypes[gPlayerModelTypes[this->modelGroup][PLAYER_MODELGROUPENTRY_ANIM]][nextAnimType]; + + if ((heldItemAction == PLAYER_IA_BOTTLE) || (heldItemAction == PLAYER_IA_BOOMERANG) || + ((heldItemAction == PLAYER_IA_NONE) && ((this->heldItemAction == PLAYER_IA_BOTTLE) || (this->heldItemAction == PLAYER_IA_BOOMERANG)))) { - sp38 = (sp37 == PLAYER_IA_NONE) ? -PLAYER_D_808540F4_13 : PLAYER_D_808540F4_13; + itemChangeType = (heldItemAction == PLAYER_IA_NONE) ? -PLAYER_ITEM_CHG_13 : PLAYER_ITEM_CHG_13; } - this->unk_15A = ABS(sp38); + this->itemChangeType = ABS(itemChangeType); + anim = sItemChangeInfo[this->itemChangeType].anim; - anim = D_808540F4[this->unk_15A].anim; if ((anim == &gPlayerAnim_link_normal_fighter2free) && (this->currentShield == PLAYER_SHIELD_NONE)) { anim = &gPlayerAnim_link_normal_free2fighter_free; } - phi_f2 = Animation_GetLastFrame(anim); - phi_f14 = phi_f2; + endFrameTemp = Animation_GetLastFrame(anim); + endFrame = endFrameTemp; - if (sp38 >= 0) { - phi_f0 = 1.2f; - phi_f12 = 0.0f; + if (itemChangeType >= 0) { + playSpeed = 1.2f; + startFrame = 0.0f; } else { - phi_f14 = 0.0f; - phi_f0 = -1.2f; - phi_f12 = phi_f2; + endFrame = 0.0f; + playSpeed = -1.2f; + startFrame = endFrameTemp; } - if (sp37 != PLAYER_IA_NONE) { - phi_f0 *= 2.0f; + if (heldItemAction != PLAYER_IA_NONE) { + playSpeed *= 2.0f; } - LinkAnimation_Change(play, &this->skelAnime2, anim, phi_f0, phi_f12, phi_f14, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnimeUpper, anim, playSpeed, startFrame, endFrame, ANIMMODE_ONCE, 0.0f); - this->stateFlags1 &= ~PLAYER_STATE1_8; + this->stateFlags1 &= ~PLAYER_STATE1_START_CHANGING_HELD_ITEM; } -void func_80834298(Player* this, PlayState* play) { - if ((this->actor.category == ACTORCAT_PLAYER) && !(this->stateFlags1 & PLAYER_STATE1_8) && +void Player_UpdateItems(Player* this, PlayState* play) { + if ((this->actor.category == ACTORCAT_PLAYER) && !(this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) && ((this->heldItemAction == this->itemAction) || (this->stateFlags1 & PLAYER_STATE1_22)) && (gSaveContext.save.info.playerData.health != 0) && (play->csCtx.state == CS_STATE_IDLE) && (this->csMode == PLAYER_CSMODE_NONE) && (play->shootingGalleryStatus == 0) && (play->activeCamId == CAM_ID_MAIN) && (play->transitionTrigger != TRANS_TRIGGER_START) && (gSaveContext.timerState != TIMER_STATE_STOP)) { - func_80833DF8(this, play); + Player_ProcessItemButtons(this, play); } - if (this->stateFlags1 & PLAYER_STATE1_8) { - func_808340DC(this, play); + if (this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) { + Player_StartChangingHeldItem(this, play); } } @@ -2458,7 +2498,7 @@ s32 func_8083442C(Player* this, PlayState* play) { (gSaveContext.magicState != MAGIC_STATE_IDLE)) { Sfx_PlaySfxCentered(NA_SE_SY_ERROR); } else { - func_80833638(this, func_808351D4); + Player_SetItemActionFunc(this, func_808351D4); this->stateFlags1 |= PLAYER_STATE1_9; this->unk_834 = 14; @@ -2488,7 +2528,7 @@ s32 func_8083442C(Player* this, PlayState* play) { return 0; } -void func_80834594(PlayState* play, Player* this) { +void Player_FinishItemChange(PlayState* play, Player* this) { if (this->heldItemAction != PLAYER_IA_NONE) { if (func_8008F2BC(this, this->heldItemAction) >= 0) { func_808328EC(this, NA_SE_IT_SWORD_PUTAWAY); @@ -2497,7 +2537,7 @@ void func_80834594(PlayState* play, Player* this) { } } - func_80835F44(play, this, this->heldItemId); + Player_UseItem(play, this, this->heldItemId); if (func_8008F2BC(this, this->heldItemAction) >= 0) { func_808328EC(this, NA_SE_IT_SWORD_PICKOUT); @@ -2507,20 +2547,20 @@ void func_80834594(PlayState* play, Player* this) { } void func_80834644(PlayState* play, Player* this) { - if (func_80834A2C == this->func_82C) { - func_80834594(play, this); + if (Player_IA_ChangeHeldItem == this->itemActionFunc) { + Player_FinishItemChange(play, this); } - func_80833638(this, D_80853EDC[this->heldItemAction]); + Player_SetItemActionFunc(this, sItemActionUpdateFuncs[this->heldItemAction]); this->unk_834 = 0; this->unk_6AC = 0; - func_808323B4(play, this); - this->stateFlags1 &= ~PLAYER_STATE1_8; + Player_DetachHeldActor(play, this); + this->stateFlags1 &= ~PLAYER_STATE1_START_CHANGING_HELD_ITEM; } LinkAnimationHeader* func_808346C4(PlayState* play, Player* this) { - func_80833638(this, func_80834B5C); - func_808323B4(play, this); + Player_SetItemActionFunc(this, func_80834B5C); + Player_DetachHeldActor(play, this); if (this->unk_870 < 0.5f) { return D_808543A4[Player_HoldsTwoHandedWeapon(this)]; @@ -2540,7 +2580,7 @@ s32 func_80834758(PlayState* play, Player* this) { anim = func_808346C4(play, this); frame = Animation_GetLastFrame(anim); - LinkAnimation_Change(play, &this->skelAnime2, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnimeUpper, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); Player_PlaySfx(this, NA_SE_IT_SHIELD_POSTURE); return 1; @@ -2558,33 +2598,33 @@ s32 func_8083485C(Player* this, PlayState* play) { } void func_80834894(Player* this) { - func_80833638(this, func_80834C74); + Player_SetItemActionFunc(this, func_80834C74); if (this->itemAction < 0) { func_8008EC70(this); } - Animation_Reverse(&this->skelAnime2); + Animation_Reverse(&this->skelAnimeUpper); Player_PlaySfx(this, NA_SE_IT_SHIELD_REMOVE); } -void func_808348EC(PlayState* play, Player* this) { - struct_808540F4* ptr = &D_808540F4[this->unk_15A]; - f32 temp; +void Player_WaitToFinishItemChange(PlayState* play, Player* this) { + ItemChangeInfo* itemChangeEntry = &sItemChangeInfo[this->itemChangeType]; + f32 changeFrame; - temp = ptr->unk_04; - temp = (this->skelAnime2.playSpeed < 0.0f) ? temp - 1.0f : temp; + changeFrame = itemChangeEntry->changeFrame; + changeFrame = (this->skelAnimeUpper.playSpeed < 0.0f) ? changeFrame - 1.0f : changeFrame; - if (LinkAnimation_OnFrame(&this->skelAnime2, temp)) { - func_80834594(play, this); + if (LinkAnimation_OnFrame(&this->skelAnimeUpper, changeFrame)) { + Player_FinishItemChange(play, this); } func_80833B54(this); } s32 func_8083499C(Player* this, PlayState* play) { - if (this->stateFlags1 & PLAYER_STATE1_8) { - func_808340DC(this, play); + if (this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) { + Player_StartChangingHeldItem(this, play); } else { return 0; } @@ -2600,31 +2640,31 @@ s32 func_808349DC(Player* this, PlayState* play) { } } -s32 func_80834A2C(Player* this, PlayState* play) { - if (LinkAnimation_Update(play, &this->skelAnime2) || +s32 Player_IA_ChangeHeldItem(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnimeUpper) || ((Player_ItemToItemAction(this->heldItemId) == this->heldItemAction) && - (D_80853614 = - (D_80853614 || ((this->modelAnimType != PLAYER_ANIMTYPE_3) && (play->shootingGalleryStatus == 0)))))) { - func_80833638(this, D_80853EDC[this->heldItemAction]); + (sUseHeldItem = + (sUseHeldItem || ((this->modelAnimType != PLAYER_ANIMTYPE_3) && (play->shootingGalleryStatus == 0)))))) { + Player_SetItemActionFunc(this, sItemActionUpdateFuncs[this->heldItemAction]); this->unk_834 = 0; this->unk_6AC = 0; - D_80853618 = D_80853614; - return this->func_82C(this, play); + sHeldItemButtonIsHeldDown = sUseHeldItem; + return this->itemActionFunc(this, play); } if (func_80833350(this) != 0) { - func_808348EC(play, this); + Player_WaitToFinishItemChange(play, this); Player_AnimPlayOnce(play, this, func_80833338(this)); this->unk_6AC = 0; } else { - func_808348EC(play, this); + Player_WaitToFinishItemChange(play, this); } return 1; } s32 func_80834B5C(Player* this, PlayState* play) { - LinkAnimation_Update(play, &this->skelAnime2); + LinkAnimation_Update(play, &this->skelAnimeUpper); if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { func_80834894(this); @@ -2640,10 +2680,10 @@ s32 func_80834BD4(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 frame; - if (LinkAnimation_Update(play, &this->skelAnime2)) { + if (LinkAnimation_Update(play, &this->skelAnimeUpper)) { anim = func_808346C4(play, this); frame = Animation_GetLastFrame(anim); - LinkAnimation_Change(play, &this->skelAnime2, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnimeUpper, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); } this->stateFlags1 |= PLAYER_STATE1_22; @@ -2653,13 +2693,14 @@ s32 func_80834BD4(Player* this, PlayState* play) { } s32 func_80834C74(Player* this, PlayState* play) { - D_80853614 = D_80853618; + sUseHeldItem = sHeldItemButtonIsHeldDown; - if (D_80853614 || LinkAnimation_Update(play, &this->skelAnime2)) { - func_80833638(this, D_80853EDC[this->heldItemAction]); - LinkAnimation_PlayLoop(play, &this->skelAnime2, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType)); + if (sUseHeldItem || LinkAnimation_Update(play, &this->skelAnimeUpper)) { + Player_SetItemActionFunc(this, sItemActionUpdateFuncs[this->heldItemAction]); + LinkAnimation_PlayLoop(play, &this->skelAnimeUpper, + GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType)); this->unk_6AC = 0; - this->func_82C(this, play); + this->itemActionFunc(this, play); return 0; } @@ -2679,11 +2720,11 @@ s32 func_80834D2C(Player* this, PlayState* play) { } else { anim = &gPlayerAnim_link_hook_shot_ready; } - LinkAnimation_PlayOnce(play, &this->skelAnime2, anim); + LinkAnimation_PlayOnce(play, &this->skelAnimeUpper, anim); } else { - func_80833638(this, func_80835884); + Player_SetItemActionFunc(this, func_80835884); this->unk_834 = 10; - LinkAnimation_PlayOnce(play, &this->skelAnime2, &gPlayerAnim_link_boom_throw_wait2waitR); + LinkAnimation_PlayOnce(play, &this->skelAnimeUpper, &gPlayerAnim_link_boom_throw_wait2waitR); } if (this->stateFlags1 & PLAYER_STATE1_23) { @@ -2719,7 +2760,7 @@ s32 func_80834EB8(Player* this, PlayState* play) { s32 func_80834F2C(Player* this, PlayState* play) { if ((this->doorType == PLAYER_DOORTYPE_NONE) && !(this->stateFlags1 & PLAYER_STATE1_25)) { - if (D_80853614 || func_80834E44(play)) { + if (sUseHeldItem || func_80834E44(play)) { if (func_80834D2C(this, play)) { return func_80834EB8(this, play); } @@ -2808,10 +2849,10 @@ s32 func_808351D4(Player* this, PlayState* play) { if ((this->unk_836 == 0) && (func_80833350(this) == 0) && (this->skelAnime.animation == &gPlayerAnim_link_bow_side_walk)) { - LinkAnimation_PlayOnce(play, &this->skelAnime2, D_808543CC[sp2C]); + LinkAnimation_PlayOnce(play, &this->skelAnimeUpper, D_808543CC[sp2C]); this->unk_836 = -1; - } else if (LinkAnimation_Update(play, &this->skelAnime2)) { - LinkAnimation_PlayLoop(play, &this->skelAnime2, D_808543D4[sp2C]); + } else if (LinkAnimation_Update(play, &this->skelAnimeUpper)) { + LinkAnimation_PlayLoop(play, &this->skelAnimeUpper, D_808543D4[sp2C]); this->unk_836 = 1; } else if (this->unk_836 == 1) { this->unk_836 = 2; @@ -2823,8 +2864,8 @@ s32 func_808351D4(Player* this, PlayState* play) { func_80834EB8(this, play); - if ((this->unk_836 > 0) && ((this->unk_860 < 0) || (!D_80853618 && !func_80834E7C(play)))) { - func_80833638(this, func_808353D8); + if ((this->unk_836 > 0) && ((this->unk_860 < 0) || (!sHeldItemButtonIsHeldDown && !func_80834E7C(play)))) { + Player_SetItemActionFunc(this, func_808353D8); if (this->unk_860 >= 0) { if (sp2C == 0) { if (!func_808350A4(play, this)) { @@ -2844,20 +2885,21 @@ s32 func_808351D4(Player* this, PlayState* play) { } s32 func_808353D8(Player* this, PlayState* play) { - LinkAnimation_Update(play, &this->skelAnime2); + LinkAnimation_Update(play, &this->skelAnimeUpper); if (Player_HoldsHookshot(this) && !func_80834FBC(this)) { return 1; } - if (!func_80834758(play, this) && (D_80853614 || ((this->unk_860 < 0) && D_80853618) || func_80834E44(play))) { + if (!func_80834758(play, this) && + (sUseHeldItem || ((this->unk_860 < 0) && sHeldItemButtonIsHeldDown) || func_80834E44(play))) { this->unk_860 = ABS(this->unk_860); if (func_8083442C(this, play)) { if (Player_HoldsHookshot(this)) { this->unk_836 = 1; } else { - LinkAnimation_PlayOnce(play, &this->skelAnime2, &gPlayerAnim_link_bow_bow_shoot_next); + LinkAnimation_PlayOnce(play, &this->skelAnimeUpper, &gPlayerAnim_link_bow_bow_shoot_next); } } } else { @@ -2873,10 +2915,10 @@ s32 func_808353D8(Player* this, PlayState* play) { } if (Player_HoldsHookshot(this)) { - func_80833638(this, func_8083501C); + Player_SetItemActionFunc(this, func_8083501C); } else { - func_80833638(this, func_80835588); - LinkAnimation_PlayOnce(play, &this->skelAnime2, &gPlayerAnim_link_bow_bow_shoot_end); + Player_SetItemActionFunc(this, func_80835588); + LinkAnimation_PlayOnce(play, &this->skelAnimeUpper, &gPlayerAnim_link_bow_bow_shoot_end); } this->unk_834 = 0; @@ -2886,8 +2928,8 @@ s32 func_808353D8(Player* this, PlayState* play) { } s32 func_80835588(Player* this, PlayState* play) { - if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || LinkAnimation_Update(play, &this->skelAnime2)) { - func_80833638(this, func_8083501C); + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || LinkAnimation_Update(play, &this->skelAnimeUpper)) { + Player_SetItemActionFunc(this, func_8083501C); } return 1; @@ -2916,8 +2958,8 @@ s32 func_80835644(PlayState* play, Player* this, Actor* arg2) { void func_80835688(Player* this, PlayState* play) { if (!func_80835644(play, this, this->heldActor)) { - func_80833638(this, func_808356E8); - LinkAnimation_PlayLoop(play, &this->skelAnime2, &gPlayerAnim_link_normal_carryB_wait); + Player_SetItemActionFunc(this, func_808356E8); + LinkAnimation_PlayLoop(play, &this->skelAnimeUpper, &gPlayerAnim_link_normal_carryB_wait); } } @@ -2933,8 +2975,8 @@ s32 func_808356E8(Player* this, PlayState* play) { } if (this->stateFlags1 & PLAYER_STATE1_11) { - if (LinkAnimation_Update(play, &this->skelAnime2)) { - LinkAnimation_PlayLoop(play, &this->skelAnime2, &gPlayerAnim_link_normal_carryB_wait); + if (LinkAnimation_Update(play, &this->skelAnimeUpper)) { + LinkAnimation_PlayLoop(play, &this->skelAnimeUpper, &gPlayerAnim_link_normal_carryB_wait); } if ((heldActor->id == ACTOR_EN_NIW) && (this->actor.velocity.y <= 0.0f)) { @@ -2959,7 +3001,7 @@ s32 func_80835800(Player* this, PlayState* play) { } if (this->stateFlags1 & PLAYER_STATE1_25) { - func_80833638(this, func_80835B60); + Player_SetItemActionFunc(this, func_80835B60); } else if (func_80834F2C(this, play)) { return 1; } @@ -2968,9 +3010,9 @@ s32 func_80835800(Player* this, PlayState* play) { } s32 func_80835884(Player* this, PlayState* play) { - if (LinkAnimation_Update(play, &this->skelAnime2)) { - func_80833638(this, func_808358F0); - LinkAnimation_PlayLoop(play, &this->skelAnime2, &gPlayerAnim_link_boom_throw_waitR); + if (LinkAnimation_Update(play, &this->skelAnimeUpper)) { + Player_SetItemActionFunc(this, func_808358F0); + LinkAnimation_PlayLoop(play, &this->skelAnimeUpper, &gPlayerAnim_link_boom_throw_waitR); } func_80834EB8(this, play); @@ -2983,17 +3025,17 @@ s32 func_808358F0(Player* this, PlayState* play) { if ((func_808334E4(this) == animSeg) || (func_80833528(this) == animSeg) || (func_808335B0(this) == animSeg) || (func_808335F4(this) == animSeg)) { - AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime2.jointTable, + AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnimeUpper.jointTable, this->skelAnime.jointTable); } else { - LinkAnimation_Update(play, &this->skelAnime2); + LinkAnimation_Update(play, &this->skelAnimeUpper); } func_80834EB8(this, play); - if (!D_80853618) { - func_80833638(this, func_808359FC); - LinkAnimation_PlayOnce(play, &this->skelAnime2, + if (!sHeldItemButtonIsHeldDown) { + Player_SetItemActionFunc(this, func_808359FC); + LinkAnimation_PlayOnce(play, &this->skelAnimeUpper, (this->unk_870 < 0.5f) ? &gPlayerAnim_link_boom_throwR : &gPlayerAnim_link_boom_throwL); } @@ -3001,10 +3043,10 @@ s32 func_808358F0(Player* this, PlayState* play) { } s32 func_808359FC(Player* this, PlayState* play) { - if (LinkAnimation_Update(play, &this->skelAnime2)) { - func_80833638(this, func_80835B60); + if (LinkAnimation_Update(play, &this->skelAnimeUpper)) { + Player_SetItemActionFunc(this, func_80835B60); this->unk_834 = 0; - } else if (LinkAnimation_OnFrame(&this->skelAnime2, 6.0f)) { + } else if (LinkAnimation_OnFrame(&this->skelAnimeUpper, 6.0f)) { f32 posX = (Math_SinS(this->actor.shape.rot.y) * 10.0f) + this->actor.world.pos.x; f32 posZ = (Math_CosS(this->actor.shape.rot.y) * 10.0f) + this->actor.world.pos.z; s32 yaw = (this->unk_664 != NULL) ? this->actor.shape.rot.y + 14000 : this->actor.shape.rot.y; @@ -3035,8 +3077,8 @@ s32 func_80835B60(Player* this, PlayState* play) { } if (!(this->stateFlags1 & PLAYER_STATE1_25)) { - func_80833638(this, func_80835C08); - LinkAnimation_PlayOnce(play, &this->skelAnime2, &gPlayerAnim_link_boom_catch); + Player_SetItemActionFunc(this, func_80835C08); + LinkAnimation_PlayOnce(play, &this->skelAnimeUpper, &gPlayerAnim_link_boom_catch); func_808357E8(this, gPlayerLeftHandBoomerangDLs); Player_PlaySfx(this, NA_SE_PL_CATCH_BOOMERANG); func_80832698(this, NA_SE_VO_LI_SWORD_N); @@ -3047,8 +3089,8 @@ s32 func_80835B60(Player* this, PlayState* play) { } s32 func_80835C08(Player* this, PlayState* play) { - if (!func_80835800(this, play) && LinkAnimation_Update(play, &this->skelAnime2)) { - func_80833638(this, func_80835800); + if (!func_80835800(this, play) && LinkAnimation_Update(play, &this->skelAnimeUpper)) { + Player_SetItemActionFunc(this, func_80835800); } return 1; @@ -3130,7 +3172,7 @@ void func_80835EA4(PlayState* play, s32 arg1) { Camera_SetCameraData(Play_GetCamera(play, CAM_ID_MAIN), 4, NULL, NULL, arg1, 0, 0); } -void func_80835EFC(Player* this) { +void Player_DestroyHookshot(Player* this) { if (Player_HoldsHookshot(this)) { Actor* heldActor = this->heldActor; @@ -3142,7 +3184,7 @@ void func_80835EFC(Player* this) { } } -void func_80835F44(PlayState* play, Player* this, s32 item) { +void Player_UseItem(PlayState* play, Player* this, s32 item) { s8 itemAction; s32 temp; s32 nextAnimType; @@ -3164,8 +3206,11 @@ void func_80835F44(PlayState* play, Player* this, s32 item) { (temp = Player_ActionToExplosive(this, itemAction), ((temp >= 0) && ((AMMO(sExplosiveInfos[temp].itemId) == 0) || (play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length >= 3)))))) { + // Prevent some items from being used if player is out of ammo. + // Also prevent explosives from being used if there are 3 or more active (outside of bombchu bowling) Sfx_PlaySfxCentered(NA_SE_SY_ERROR); } else if (itemAction == PLAYER_IA_LENS_OF_TRUTH) { + // Handle Lens of Truth if (Magic_RequestChange(play, 0, MAGIC_CONSUME_LENS)) { if (play->actorCtx.lensActive) { Actor_DisableLens(play); @@ -3178,12 +3223,14 @@ void func_80835F44(PlayState* play, Player* this, s32 item) { Sfx_PlaySfxCentered(NA_SE_SY_ERROR); } } else if (itemAction == PLAYER_IA_DEKU_NUT) { + // Handle Deku Nuts if (AMMO(ITEM_DEKU_NUT) != 0) { func_8083C61C(play, this); } else { Sfx_PlaySfxCentered(NA_SE_SY_ERROR); } } else if ((temp = Player_ActionToMagicSpell(this, itemAction)) >= 0) { + // Handle magic spells if (((itemAction == PLAYER_IA_FARORES_WIND) && (gSaveContext.respawn[RESPAWN_MODE_TOP].data > 0)) || ((gSaveContext.magicCapacity != 0) && (gSaveContext.magicState == MAGIC_STATE_IDLE) && (gSaveContext.save.info.playerData.magic >= sMagicSpellCosts[temp]))) { @@ -3193,6 +3240,7 @@ void func_80835F44(PlayState* play, Player* this, s32 item) { Sfx_PlaySfxCentered(NA_SE_SY_ERROR); } } else if (itemAction >= PLAYER_IA_MASK_KEATON) { + // Handle wearable masks if (this->currentMask != PLAYER_MASK_NONE) { this->currentMask = PLAYER_MASK_NONE; } else { @@ -3202,6 +3250,7 @@ void func_80835F44(PlayState* play, Player* this, s32 item) { func_808328EC(this, NA_SE_PL_CHANGE_ARMS); } else if (((itemAction >= PLAYER_IA_OCARINA_FAIRY) && (itemAction <= PLAYER_IA_OCARINA_OF_TIME)) || (itemAction >= PLAYER_IA_BOTTLE_FISH)) { + // Handle "cutscene items" if (!func_8008E9C4(this) || ((itemAction >= PLAYER_IA_BOTTLE_POTION_RED) && (itemAction <= PLAYER_IA_BOTTLE_FAIRY))) { TitleCard_Clear(play, &play->actorCtx.titleCtx); @@ -3210,22 +3259,26 @@ void func_80835F44(PlayState* play, Player* this, s32 item) { } } else if ((itemAction != this->heldItemAction) || ((this->heldActor == NULL) && (Player_ActionToExplosive(this, itemAction) >= 0))) { + // Handle using a new held item this->nextModelGroup = Player_ActionToModelGroup(this, itemAction); nextAnimType = gPlayerModelTypes[this->nextModelGroup][PLAYER_MODELGROUPENTRY_ANIM]; if ((this->heldItemAction >= 0) && (Player_ActionToMagicSpell(this, itemAction) < 0) && (item != this->heldItemId) && - (D_80854164[gPlayerModelTypes[this->modelGroup][PLAYER_MODELGROUPENTRY_ANIM]][nextAnimType] != - PLAYER_D_808540F4_0)) { + (sItemChangeTypes[gPlayerModelTypes[this->modelGroup][PLAYER_MODELGROUPENTRY_ANIM]][nextAnimType] != + PLAYER_ITEM_CHG_0)) { + // Start the held item change process this->heldItemId = item; - this->stateFlags1 |= PLAYER_STATE1_8; + this->stateFlags1 |= PLAYER_STATE1_START_CHANGING_HELD_ITEM; } else { - func_80835EFC(this); - func_808323B4(play, this); - func_80833664(play, this, itemAction); + // Init new held item for use + Player_DestroyHookshot(this); + Player_DetachHeldActor(play, this); + Player_InitItemActionWithAnim(play, this, itemAction); } } else { - D_80853614 = D_80853618 = true; + // Handle using the held item already in hand + sUseHeldItem = sHeldItemButtonIsHeldDown = true; } } } @@ -3267,14 +3320,15 @@ void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) { } } -s32 func_808365C8(Player* this) { +s32 Player_CanUpdateItems(Player* this) { return (!(Player_Action_808458D0 == this->actionFunc) || - ((this->stateFlags1 & PLAYER_STATE1_8) && + ((this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) && ((this->heldItemId == ITEM_LAST_USED) || (this->heldItemId == ITEM_NONE)))) && - (!(func_80834A2C == this->func_82C) || (Player_ItemToItemAction(this->heldItemId) == this->heldItemAction)); + (!(Player_IA_ChangeHeldItem == this->itemActionFunc) || + (Player_ItemToItemAction(this->heldItemId) == this->heldItemAction)); } -s32 func_80836670(Player* this, PlayState* play) { +s32 Player_UpdateUpperBody(Player* this, PlayState* play) { if (!(this->stateFlags1 & PLAYER_STATE1_23) && (this->actor.parent != NULL) && Player_HoldsHookshot(this)) { Player_SetupAction(play, this, Player_Action_80850AEC, 1); this->stateFlags3 |= PLAYER_STATE3_7; @@ -3291,31 +3345,31 @@ s32 func_80836670(Player* this, PlayState* play) { return 1; } - if (func_808365C8(this)) { - func_80834298(this, play); + if (Player_CanUpdateItems(this)) { + Player_UpdateItems(this, play); if (Player_Action_8084E604 == this->actionFunc) { return 1; } } - if (!this->func_82C(this, play)) { + if (!this->itemActionFunc(this, play)) { return 0; } - if (this->unk_830 != 0.0f) { + if (this->skelAnimeUpperBlendWeight != 0.0f) { if ((func_80833350(this) == 0) || (this->speedXZ != 0.0f)) { - AnimationContext_SetCopyFalse(play, this->skelAnime.limbCount, this->skelAnime2.jointTable, - this->skelAnime.jointTable, D_80853410); + AnimationContext_SetCopyFalse(play, this->skelAnime.limbCount, this->skelAnimeUpper.jointTable, + this->skelAnime.jointTable, sUpperBodyLimbCopyMap); } - Math_StepToF(&this->unk_830, 0.0f, 0.25f); + Math_StepToF(&this->skelAnimeUpperBlendWeight, 0.0f, 0.25f); AnimationContext_SetInterp(play, this->skelAnime.limbCount, this->skelAnime.jointTable, - this->skelAnime2.jointTable, 1.0f - this->unk_830); + this->skelAnimeUpper.jointTable, 1.0f - this->skelAnimeUpperBlendWeight); } else if ((func_80833350(this) == 0) || (this->speedXZ != 0.0f)) { AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, - this->skelAnime2.jointTable, D_80853410); + this->skelAnimeUpper.jointTable, sUpperBodyLimbCopyMap); } else { AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.jointTable, - this->skelAnime2.jointTable); + this->skelAnimeUpper.jointTable); } return 1; @@ -3589,7 +3643,7 @@ s32 func_80837348(PlayState* play, Player* this, s8* arg2, s32 arg3) { if (!(this->stateFlags1 & (PLAYER_STATE1_0 | PLAYER_STATE1_7 | PLAYER_STATE1_29))) { if (arg3 != 0) { - D_808535E0 = func_80836670(this, play); + D_808535E0 = Player_UpdateUpperBody(this, play); if (Player_Action_8084E604 == this->actionFunc) { return 1; } @@ -3600,7 +3654,8 @@ s32 func_80837348(PlayState* play, Player* this, s8* arg2, s32 arg3) { return 1; } - if (!(this->stateFlags1 & PLAYER_STATE1_8) && (func_80834A2C != this->func_82C)) { + if (!(this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) && + (Player_IA_ChangeHeldItem != this->itemActionFunc)) { while (*arg2 >= 0) { if (D_80854448[*arg2](this, play)) { return 1; @@ -4130,14 +4185,14 @@ s32 func_808382DC(Player* this, PlayState* play) { } if (!(this->actionVar1 = sp54)) { - func_80833638(this, func_80834BD4); + Player_SetItemActionFunc(this, func_80834BD4); if (this->unk_870 < 0.5f) { anim = D_808543BC[Player_HoldsTwoHandedWeapon(this)]; } else { anim = D_808543B4[Player_HoldsTwoHandedWeapon(this)]; } - LinkAnimation_PlayOnce(play, &this->skelAnime2, anim); + LinkAnimation_PlayOnce(play, &this->skelAnimeUpper, anim); } else { Player_AnimPlayOnce(play, this, D_808543C4[Player_HoldsTwoHandedWeapon(this)]); } @@ -5508,7 +5563,7 @@ void func_8083BA90(PlayState* play, Player* this, s32 arg2, f32 xzSpeed, f32 yVe s32 func_8083BB20(Player* this) { if (!(this->stateFlags1 & PLAYER_STATE1_22) && (Player_GetMeleeWeaponHeld(this) != 0)) { - if (D_80853614 || + if (sUseHeldItem || ((this->actor.category != ACTORCAT_PLAYER) && CHECK_BTN_ALL(sControlInput->press.button, BTN_B))) { return 1; } @@ -5575,7 +5630,7 @@ s32 func_8083BDBC(Player* this, PlayState* play) { func_8083BC04(this, play); } } else { - if ((Player_GetMeleeWeaponHeld(this) != 0) && func_808365C8(this)) { + if ((Player_GetMeleeWeaponHeld(this) != 0) && Player_CanUpdateItems(this)) { func_8083BA90(play, this, PLAYER_MWA_JUMPSLASH_START, 5.0f, 5.0f); } else { func_8083BC04(this, play); @@ -5656,7 +5711,7 @@ s32 func_8083C1DC(Player* this, PlayState* play) { return 1; } if ((this->unk_837 == 0) && (this->heldItemAction >= PLAYER_IA_SWORD_MASTER)) { - func_80835F44(play, this, ITEM_NONE); + Player_UseItem(play, this, ITEM_NONE); } else { this->stateFlags2 ^= PLAYER_STATE2_20; } @@ -5674,7 +5729,7 @@ s32 func_8083C2B0(Player* this, PlayState* play) { (Player_IsChildWithHylianShield(this) || (!func_80833B2C(this) && (this->unk_664 == NULL)))) { func_80832318(this); - func_808323B4(play, this); + Player_DetachHeldActor(play, this); if (Player_SetupAction(play, this, Player_Action_80843188, 0)) { this->stateFlags1 |= PLAYER_STATE1_22; @@ -5770,7 +5825,7 @@ static struct_80854554 D_80854554[] = { s32 func_8083C6B8(PlayState* play, Player* this) { Vec3f sp24; - if (D_80853614) { + if (sUseHeldItem) { if (Player_GetBottleHeld(this) >= 0) { Player_SetupAction(play, this, Player_Action_8084ECA4, 0); @@ -6466,7 +6521,7 @@ s32 func_8083E5A8(Player* this, PlayState* play) { if ((Item_CheckObtainability(giEntry->itemId) == ITEM_NONE) || (play->sceneId == SCENE_BOMBCHU_BOWLING_ALLEY)) { - func_808323B4(play, this); + Player_DetachHeldActor(play, this); func_8083AE40(this, giEntry->objectId); if (!(this->stateFlags2 & PLAYER_STATE2_10) || (this->currentBoots == PLAYER_BOOTS_IRON)) { @@ -6535,9 +6590,9 @@ s32 func_8083E5A8(Player* this, PlayState* play) { if (sp24 == PLAYER_IA_SWORD_MASTER) { this->nextModelGroup = Player_ActionToModelGroup(this, PLAYER_IA_LAST_USED); - func_8083399C(play, this, PLAYER_IA_LAST_USED); + Player_InitItemAction(play, this, PLAYER_IA_LAST_USED); } else { - func_80835F44(play, this, ITEM_LAST_USED); + Player_UseItem(play, this, ITEM_LAST_USED); } } else { s32 strength = Player_GetStrength(); @@ -7190,7 +7245,7 @@ void Player_Action_80840450(Player* this, PlayState* play) { func_8083721C(this); if (!func_80837348(play, this, D_808543E0, 1)) { - if (!func_80833B54(this) && (!func_80833B2C(this) || (func_80834B5C != this->func_82C))) { + if (!func_80833B54(this) && (!func_80833B2C(this) || (func_80834B5C != this->itemActionFunc))) { func_8083CF10(this, play); return; } @@ -7267,7 +7322,7 @@ void Player_Action_808407CC(Player* this, PlayState* play) { return; } - if (func_80834B5C == this->func_82C) { + if (func_80834B5C == this->itemActionFunc) { func_8083CEAC(this, play); return; } @@ -7737,7 +7792,7 @@ void Player_Action_80841BA8(Player* this, PlayState* play) { AnimationContext_SetLoadFrame(play, func_80833338(this), 0, this->skelAnime.limbCount, this->skelAnime.morphTable); AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, - this->skelAnime.morphTable, D_80853410); + this->skelAnime.morphTable, sUpperBodyLimbCopyMap); } func_80837268(this, &sp34, &sp32, 0.018f, play); @@ -8015,7 +8070,7 @@ s32 func_8084285C(Player* this, f32 arg1, f32 arg2, f32 arg3) { } s32 func_808428D8(Player* this, PlayState* play) { - if (!Player_IsChildWithHylianShield(this) && (Player_GetMeleeWeaponHeld(this) != 0) && D_80853614) { + if (!Player_IsChildWithHylianShield(this) && (Player_GetMeleeWeaponHeld(this) != 0) && sUseHeldItem) { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_defense_kiru); this->actionVar1 = 1; this->meleeWeaponAnimation = PLAYER_MWA_STAB_1H; @@ -8047,7 +8102,7 @@ void func_80842A28(PlayState* play, Player* this) { void func_80842A88(PlayState* play, Player* this) { Inventory_ChangeAmmo(ITEM_DEKU_STICK, -1); - func_80835F44(play, this, ITEM_NONE); + Player_UseItem(play, this, ITEM_NONE); } s32 func_80842AC4(PlayState* play, Player* this) { @@ -8228,7 +8283,7 @@ void Player_Action_80843188(Player* this, PlayState* play) { if (!Player_IsChildWithHylianShield(this)) { this->stateFlags1 |= PLAYER_STATE1_22; - func_80836670(this, play); + Player_UpdateUpperBody(this, play); this->stateFlags1 &= ~PLAYER_STATE1_22; } @@ -8313,8 +8368,8 @@ void Player_Action_808435C4(Player* this, PlayState* play) { func_8083721C(this); if (this->actionVar1 == 0) { - D_808535E0 = func_80836670(this, play); - if ((func_80834B5C == this->func_82C) || (func_808374A0(play, this, &this->skelAnime2, 4.0f) > 0)) { + D_808535E0 = Player_UpdateUpperBody(this, play); + if ((func_80834B5C == this->itemActionFunc) || (func_808374A0(play, this, &this->skelAnimeUpper, 4.0f) > 0)) { Player_SetupAction(play, this, Player_Action_80840450, 1); } } else { @@ -8618,7 +8673,7 @@ void Player_Action_8084411C(Player* this, PlayState* play) { func_8083DFE0(this, &sp4C, &sp4A); } - func_80836670(this, play); + Player_UpdateUpperBody(this, play); if (((this->stateFlags2 & PLAYER_STATE2_19) && (this->actionVar1 == 2)) || !func_8083BBA0(this, play)) { if (this->actor.velocity.y < 0.0f) { @@ -9142,7 +9197,7 @@ void Player_Action_808458D0(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); if (((this->stateFlags1 & PLAYER_STATE1_11) && (this->heldActor != NULL) && (this->getItemId == GI_NONE)) || - !func_80836670(this, play)) { + !Player_UpdateUpperBody(this, play)) { this->func_A74(play, this); } } @@ -9273,7 +9328,7 @@ void Player_Action_80845CA4(Player* this, PlayState* play) { } if (this->stateFlags1 & PLAYER_STATE1_11) { - func_80836670(this, play); + Player_UpdateUpperBody(this, play); } } @@ -9283,7 +9338,7 @@ void Player_Action_80845EF8(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; sp2C = LinkAnimation_Update(play, &this->skelAnime); - func_80836670(this, play); + Player_UpdateUpperBody(this, play); if (sp2C) { if (this->actionVar2 == 0) { @@ -9364,7 +9419,7 @@ void Player_Action_80846120(Player* this, PlayState* play) { heldActor->velocity.y = Math_CosS(heldActor->shape.rot.x) * 40.0f; heldActor->gravity = -2.0f; heldActor->minVelocityY = -30.0f; - func_808323B4(play, this); + Player_DetachHeldActor(play, this); return; } @@ -9560,13 +9615,13 @@ void func_80846720(PlayState* play, Player* this, s32 arg2) { s32 item = D_808546F0[(void)0, gSaveContext.save.linkAge]; s32 itemAction = sItemActions[item]; - func_80835EFC(this); - func_808323B4(play, this); + Player_DestroyHookshot(this); + Player_DetachHeldActor(play, this); this->heldItemId = item; this->nextModelGroup = Player_ActionToModelGroup(this, itemAction); - func_8083399C(play, this, itemAction); + Player_InitItemAction(play, this, itemAction); func_80834644(play, this); if (arg2 != 0) { @@ -9639,7 +9694,7 @@ static EffectBlureInit2 D_8085470C = { 0, 2, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, }; -static Vec3s D_80854730 = { -57, 3377, 0 }; +static Vec3s sSkeletonBaseTransl = { -57, 3377, 0 }; void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHeader) { this->ageProperties = &sAgeProperties[gSaveContext.save.linkAge]; @@ -9650,10 +9705,10 @@ void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHe SkelAnime_InitLink(play, &this->skelAnime, skelHeader, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType), 9, this->jointTable, this->morphTable, PLAYER_LIMB_MAX); - this->skelAnime.baseTransl = D_80854730; - SkelAnime_InitLink(play, &this->skelAnime2, skelHeader, func_80833338(this), 9, this->jointTable2, - this->morphTable2, PLAYER_LIMB_MAX); - this->skelAnime2.baseTransl = D_80854730; + this->skelAnime.baseTransl = sSkeletonBaseTransl; + SkelAnime_InitLink(play, &this->skelAnimeUpper, skelHeader, func_80833338(this), 9, this->jointTableUpper, + this->morphTableUpper, PLAYER_LIMB_MAX); + this->skelAnimeUpper.baseTransl = sSkeletonBaseTransl; Effect_Add(play, &this->meleeWeaponEffectIndex, EFFECT_BLURE2, 0, 0, &D_8085470C); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, this->ageProperties->unk_04); @@ -9716,7 +9771,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { this->itemAction = this->heldItemAction = -1; this->heldItemId = ITEM_NONE; - func_80835F44(play, this, ITEM_NONE); + Player_UseItem(play, this, ITEM_NONE); Player_SetEquipmentData(play, this); this->prevBoots = this->currentBoots; Player_InitCommon(this, play, gPlayerSkelHeaders[((void)0, gSaveContext.save.linkAge)]); @@ -10423,7 +10478,7 @@ void func_80848A04(PlayState* play, Player* this) { f32 temp; if (this->unk_85C == 0.0f) { - func_80835F44(play, this, 0xFF); + Player_UseItem(play, this, 0xFF); return; } @@ -10880,7 +10935,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { } D_808535EC = 1.0f / D_808535E8; - D_80853614 = D_80853618 = 0; + sUseHeldItem = sHeldItemButtonIsHeldDown = 0; D_80858AA4 = this->currentMask; if (!(this->stateFlags3 & PLAYER_STATE3_2)) { @@ -11018,7 +11073,7 @@ void Player_Update(Actor* thisx, PlayState* play) { } if ((this->heldActor != NULL) && (this->heldActor->update == NULL)) { - func_808323B4(play, this); + Player_DetachHeldActor(play, this); } if (this->stateFlags1 & (PLAYER_STATE1_5 | PLAYER_STATE1_29)) { @@ -11375,7 +11430,7 @@ void Player_Action_8084B1D8(Player* this, PlayState* play) { } if ((this->unk_6AD == 2) && (func_8002DD6C(this) || func_808332E4(this))) { - func_80836670(this, play); + Player_UpdateUpperBody(this, play); } if ((this->csMode != PLAYER_CSMODE_NONE) || (this->unk_6AD == 0) || (this->unk_6AD >= 4) || func_80833B54(this) || @@ -11404,7 +11459,7 @@ s32 func_8084B3CC(PlayState* play, Player* this) { Player_SetupAction(play, this, Player_Action_8084FA54, 0); if (!func_8002DD6C(this) || Player_HoldsHookshot(this)) { - func_80835F44(play, this, 3); + Player_UseItem(play, this, 3); } this->stateFlags1 |= PLAYER_STATE1_20; @@ -11436,7 +11491,7 @@ s32 func_8084B4D4(PlayState* play, Player* this) { void Player_Action_8084B530(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; - func_80836670(this, play); + Player_UpdateUpperBody(this, play); if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~ACTOR_FLAG_8; @@ -12165,7 +12220,7 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { this->unk_6AD = 0; this->actionVar1 = 0; } else if ((this->actionVar2 < 2) || (this->actionVar2 >= 4)) { - D_808535E0 = func_80836670(this, play); + D_808535E0 = Player_UpdateUpperBody(this, play); if (D_808535E0 != 0) { this->actionVar1 = 0; } @@ -12182,27 +12237,27 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { !func_8083C1DC(this, play))) { if (D_808535E0 == 0) { if (this->actionVar1 != 0) { - if (LinkAnimation_Update(play, &this->skelAnime2)) { + if (LinkAnimation_Update(play, &this->skelAnimeUpper)) { rideActor->stateFlags &= ~ENHORSE_FLAG_8; this->actionVar1 = 0; } - if (this->skelAnime2.animation == &gPlayerAnim_link_uma_stop_muti) { - if (LinkAnimation_OnFrame(&this->skelAnime2, 23.0f)) { + if (this->skelAnimeUpper.animation == &gPlayerAnim_link_uma_stop_muti) { + if (LinkAnimation_OnFrame(&this->skelAnimeUpper, 23.0f)) { Player_PlaySfx(this, NA_SE_IT_LASH); func_80832698(this, NA_SE_VO_LI_LASH); } AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.jointTable, - this->skelAnime2.jointTable); + this->skelAnimeUpper.jointTable); } else { - if (LinkAnimation_OnFrame(&this->skelAnime2, 10.0f)) { + if (LinkAnimation_OnFrame(&this->skelAnimeUpper, 10.0f)) { Player_PlaySfx(this, NA_SE_IT_LASH); func_80832698(this, NA_SE_VO_LI_LASH); } AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, - this->skelAnime2.jointTable, D_80853410); + this->skelAnimeUpper.jointTable, sUpperBodyLimbCopyMap); } } else { LinkAnimationHeader* anim = NULL; @@ -12216,7 +12271,7 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { } if (anim != NULL) { - LinkAnimation_PlayOnce(play, &this->skelAnime2, anim); + LinkAnimation_PlayOnce(play, &this->skelAnimeUpper, anim); this->actionVar1 = 1; } } @@ -12467,7 +12522,7 @@ void Player_Action_8084DC48(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; this->actor.gravity = 0.0f; - func_80836670(this, play); + Player_UpdateUpperBody(this, play); if (!func_8083B040(this, play)) { if (this->currentBoots == PLAYER_BOOTS_IRON) { @@ -13240,7 +13295,7 @@ void Player_Action_8084FA54(Player* this, PlayState* play) { func_8083AD4C(play, this); LinkAnimation_Update(play, &this->skelAnime); - func_80836670(this, play); + Player_UpdateUpperBody(this, play); this->unk_6BE = func_8084ABD8(play, this, 1, 0) - this->actor.shape.rot.y; this->unk_6AE |= 0x80; @@ -13528,7 +13583,7 @@ void Player_Action_8085063C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; LinkAnimation_Update(play, &this->skelAnime); - func_80836670(this, play); + Player_UpdateUpperBody(this, play); if (this->actionVar2 == 0) { Message_StartTextbox(play, 0x3B, &this->actor); @@ -14156,7 +14211,7 @@ void func_808514C0(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimation_Update(play, &this->skelAnime); if (func_8008F128(this) || (this->stateFlags1 & PLAYER_STATE1_11)) { - func_80836670(this, play); + Player_UpdateUpperBody(this, play); return; } @@ -14205,7 +14260,7 @@ void func_80851688(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimation_Update(play, &this->skelAnime); if (func_8008F128(this) || (this->stateFlags1 & PLAYER_STATE1_11)) { - func_80836670(this, play); + Player_UpdateUpperBody(this, play); } } } @@ -14769,7 +14824,7 @@ void func_80852B4C(PlayState* play, Player* this, CsCmdActorCue* cue, struct_808 void func_80852C0C(PlayState* play, Player* this, s32 csMode) { if ((csMode != PLAYER_CSMODE_1) && (csMode != PLAYER_CSMODE_8) && (csMode != PLAYER_CSMODE_49) && (csMode != PLAYER_CSMODE_7)) { - func_808323B4(play, this); + Player_DetachHeldActor(play, this); } } @@ -14841,7 +14896,7 @@ s32 Player_StartFishing(PlayState* play) { Player* this = GET_PLAYER(play); func_80832564(play, this); - func_80835F44(play, this, ITEM_FISHING_POLE); + Player_UseItem(play, this, ITEM_FISHING_POLE); return 1; } From 83a13a64c710e8a0e418ec469c2550ebfb9ca345 Mon Sep 17 00:00:00 2001 From: fig02 Date: Tue, 19 Sep 2023 13:23:56 -0400 Subject: [PATCH 13/29] Document niche magic spell bug (#1526) * document magic spell bug * Update src/overlays/actors/ovl_player_actor/z_player.c Co-authored-by: Dragorn421 * adjust comment * fix renamed func and reformat --------- Co-authored-by: Dragorn421 --- src/overlays/actors/ovl_player_actor/z_player.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 39e915695..7519787de 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -5239,6 +5239,14 @@ void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) { func_80835DE4(play, this, Player_Action_808507F4, 0); this->actionVar1 = magicSpell - 3; + + //! @bug `MAGIC_CONSUME_WAIT_PREVIEW` is not guaranteed to succeed. + //! Ideally, the return value of `Magic_RequestChange` should be checked before allowing the process of + //! using a spell to continue. If the magic state change request fails, `gSaveContext.magicTarget` will + //! never be set correctly. + //! When `MAGIC_STATE_CONSUME_SETUP` is set in `Player_Action_808507F4`, magic will eventually be + //! consumed to a stale target value. If that stale target value is higher than the current + //! magic value, it will be consumed to zero. Magic_RequestChange(play, sMagicSpellCosts[magicSpell], MAGIC_CONSUME_WAIT_PREVIEW); LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_link_magic_tame, 0.83f); From 57ce0cf8d9827e1c88013a318f35e9677167d900 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Tue, 19 Sep 2023 20:10:12 +0200 Subject: [PATCH 14/29] Doc/Cleanup pass on object handling (#1227) * `Object_InitBank` -> `Object_InitContext` * Add and use `OBJECT_SPACE_SIZE_BASE` * Remove `OBJECT_EXCHANGE_BANK_MAX` -> use `ARRAY_COUNT()` instead * "object status" -> "object load entry" * Misc. cleanup/renames * Partial docs and way too much batch renaming and cleanup for a single commit * ctrl shift h * format * format clang-11.1 * fix regressions * Improve a `@bug` comment * Move `OBJECT_SPACE_SIZE_BASE` from header to near `Object_InitContext` * "objectID" -> "objectId" * Revert iterator index to `i` in `Actor_KillActorsWithUnloadedObject` * "object load entry index" -> "object entry" * `Object_UpdateLoadEntries` -> `Object_UpdateEntries` * Run format.sh * "object entry" -> "object slot" (except internal usage) * Proper `Object_SpawnPersistent` doc Co-authored-by: fig02 * fixup one comment "object bank index" -> "object slot" * Amend `Object_SpawnPersistent` comment to mention running out of free slots * `Actor_KillActorsWithUnloadedObject` -> `Actor_KillAllWithMissingObject` * Remove useless mention of what uses `Object_SpawnPersistent` * Fix mistake on `Object_SpawnPersistent` doing sync dma, not async * run formatter * `Object_InitContext` -> `Object_Init` * `waitObjectSlot` -> `requiredObjectSlot` * `Object_Init` -> `func_80097DD8` * one objectIndex -> objectSlot * Remove `OBJECT_SPACE_SIZE_BASE` * light fix on the merge (rm OBJECT_EXCHANGE_BANK_MAX) * `func_80097DD8` -> `Object_InitContext` --------- Co-authored-by: fig02 --- include/functions.h | 11 +- include/z64actor.h | 6 +- include/z64effect.h | 2 +- include/z64object.h | 28 ++- src/code/z_actor.c | 58 +++--- src/code/z_effect_soft_sprite_old_init.c | 6 +- src/code/z_en_item00.c | 12 +- src/code/z_kankyo.c | 2 +- src/code/z_play.c | 24 +-- src/code/z_player_lib.c | 2 +- src/code/z_scene.c | 188 ++++++++++-------- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.c | 10 +- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.h | 2 +- .../ovl_Bg_Haka_Megane/z_bg_haka_megane.c | 10 +- .../ovl_Bg_Haka_Megane/z_bg_haka_megane.h | 2 +- .../ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c | 10 +- .../ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h | 2 +- .../actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c | 12 +- .../actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h | 2 +- .../ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c | 22 +- .../ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h | 2 +- src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c | 20 +- src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h | 2 +- .../ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c | 8 +- .../ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h | 2 +- .../ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c | 8 +- .../ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h | 2 +- .../ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c | 8 +- .../ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h | 2 +- .../ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c | 8 +- .../ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h | 2 +- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c | 60 +++--- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h | 6 +- .../ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c | 8 +- .../ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h | 2 +- .../z_bg_mori_kaitenkabe.c | 8 +- .../z_bg_mori_kaitenkabe.h | 2 +- .../z_bg_mori_rakkatenjo.c | 8 +- .../z_bg_mori_rakkatenjo.h | 2 +- .../z_bg_spot01_objects2.c | 10 +- .../z_bg_spot01_objects2.h | 2 +- .../z_bg_spot16_bombstone.c | 8 +- .../z_bg_spot16_bombstone.h | 2 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 40 ++-- .../actors/ovl_Boss_Ganon/z_boss_ganon.h | 2 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 20 +- .../actors/ovl_Boss_Goma/z_boss_goma.c | 2 +- src/overlays/actors/ovl_Demo_6K/z_demo_6k.c | 22 +- src/overlays/actors/ovl_Demo_6K/z_demo_6k.h | 2 +- src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c | 27 +-- src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h | 4 +- .../actors/ovl_Demo_Effect/z_demo_effect.c | 24 +-- .../actors/ovl_Demo_Effect/z_demo_effect.h | 2 +- .../actors/ovl_Demo_Geff/z_demo_geff.c | 18 +- .../actors/ovl_Demo_Geff/z_demo_geff.h | 2 +- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 18 +- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.h | 2 +- .../actors/ovl_Door_Killer/z_door_killer.c | 31 +-- .../actors/ovl_Door_Killer/z_door_killer.h | 2 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 15 +- .../actors/ovl_Door_Shutter/z_door_shutter.h | 2 +- src/overlays/actors/ovl_En_Bb/z_en_bb.c | 2 +- src/overlays/actors/ovl_En_Cs/z_en_cs.c | 8 +- .../actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c | 20 +- .../actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h | 4 +- src/overlays/actors/ovl_En_Door/z_en_door.c | 18 +- src/overlays/actors/ovl_En_Door/z_en_door.h | 2 +- .../actors/ovl_En_Encount2/z_en_encount2.c | 8 +- .../actors/ovl_En_Ex_Item/z_en_ex_item.c | 26 +-- .../actors/ovl_En_Ex_Item/z_en_ex_item.h | 4 +- src/overlays/actors/ovl_En_Fr/z_en_fr.c | 6 +- src/overlays/actors/ovl_En_Fr/z_en_fr.h | 2 +- .../actors/ovl_En_G_Switch/z_en_g_switch.c | 14 +- .../actors/ovl_En_G_Switch/z_en_g_switch.h | 4 +- src/overlays/actors/ovl_En_GirlA/z_en_girla.c | 14 +- src/overlays/actors/ovl_En_GirlA/z_en_girla.h | 2 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 10 +- src/overlays/actors/ovl_En_Gm/z_en_gm.h | 2 +- src/overlays/actors/ovl_En_Guest/z_en_guest.c | 10 +- src/overlays/actors/ovl_En_Guest/z_en_guest.h | 2 +- .../actors/ovl_En_Heishi2/z_en_heishi2.c | 10 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 6 +- src/overlays/actors/ovl_En_Horse/z_en_horse.h | 2 +- src/overlays/actors/ovl_En_Hy/z_en_hy.c | 46 ++--- src/overlays/actors/ovl_En_Hy/z_en_hy.h | 8 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 3 +- src/overlays/actors/ovl_En_In/z_en_in.c | 20 +- src/overlays/actors/ovl_En_In/z_en_in.h | 2 +- src/overlays/actors/ovl_En_Ko/z_en_ko.c | 42 ++-- src/overlays/actors/ovl_En_Ko/z_en_ko.h | 8 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 20 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.h | 2 +- src/overlays/actors/ovl_En_Mag/z_en_mag.c | 2 +- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 10 +- .../actors/ovl_En_Niw_Lady/z_en_niw_lady.c | 22 +- .../actors/ovl_En_Niw_Lady/z_en_niw_lady.h | 4 +- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 10 +- .../actors/ovl_En_Nutsball/z_en_nutsball.h | 2 +- src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 36 ++-- src/overlays/actors/ovl_En_Ossan/z_en_ossan.h | 6 +- src/overlays/actors/ovl_En_Poh/z_en_poh.c | 16 +- src/overlays/actors/ovl_En_Poh/z_en_poh.h | 2 +- src/overlays/actors/ovl_En_Sb/z_en_sb.c | 2 +- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 4 +- src/overlays/actors/ovl_En_Sth/z_en_sth.c | 26 +-- src/overlays/actors/ovl_En_Sth/z_en_sth.h | 2 +- src/overlays/actors/ovl_En_Test/z_en_test.c | 2 +- src/overlays/actors/ovl_En_Tite/z_en_tite.c | 2 +- .../actors/ovl_En_Viewer/z_en_viewer.c | 20 +- .../actors/ovl_En_Viewer/z_en_viewer.h | 2 +- src/overlays/actors/ovl_En_Zl2/z_en_zl2.c | 12 +- src/overlays/actors/ovl_En_Zl2/z_en_zl2.h | 2 +- src/overlays/actors/ovl_En_Zl3/z_en_zl3.c | 14 +- src/overlays/actors/ovl_En_Zl3/z_en_zl3.h | 2 +- .../ovl_Item_Etcetera/z_item_etcetera.c | 20 +- .../ovl_Item_Etcetera/z_item_etcetera.h | 2 +- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 8 +- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.h | 2 +- .../ovl_Object_Kankyo/z_object_kankyo.c | 18 +- .../ovl_Object_Kankyo/z_object_kankyo.h | 2 +- .../actors/ovl_player_actor/z_player.c | 2 +- .../ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c | 20 +- .../ovl_Effect_Ss_Extra/z_eff_ss_extra.c | 18 +- .../z_eff_ss_fhg_flash.c | 26 +-- .../z_eff_ss_g_magma2.c | 18 +- .../z_eff_ss_g_splash.c | 2 +- .../ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c | 10 +- .../z_eff_ss_ice_smoke.c | 38 ++-- .../ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c | 10 +- .../ovl_Effect_Ss_Stick/z_eff_ss_stick.c | 8 +- 130 files changed, 789 insertions(+), 770 deletions(-) diff --git a/include/functions.h b/include/functions.h index 73ec1d5c7..1456c40c3 100644 --- a/include/functions.h +++ b/include/functions.h @@ -458,7 +458,7 @@ void Enemy_StartFinishingBlow(PlayState* play, Actor* actor); s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3); void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play); void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s32 maxLimbIndex, u32 count, Gfx** dList, - s16 objectId); + s16 objectSlot); s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s16 type); void Actor_SpawnFloorDustRing(PlayState* play, Actor* actor, Vec3f* posXZ, f32 radius, s32 amountMinusOne, f32 randAccelWeight, s16 scale, s16 scaleStep, u8 useLighting); @@ -1106,11 +1106,10 @@ void Sample_Init(GameState* thisx); void Inventory_ChangeEquipment(s16 equipment, u16 value); u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment); void Inventory_ChangeUpgrade(s16 upgrade, s16 value); -s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId); -void Object_InitBank(PlayState* play, ObjectContext* objectCtx); -void Object_UpdateBank(ObjectContext* objectCtx); -s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId); -s32 Object_IsLoaded(ObjectContext* objectCtx, s32 bankIndex); +void Object_InitContext(PlayState* play, ObjectContext* objectCtx); +void Object_UpdateEntries(ObjectContext* objectCtx); +s32 Object_GetSlot(ObjectContext* objectCtx, s16 objectId); +s32 Object_IsLoaded(ObjectContext* objectCtx, s32 slot); void func_800981B8(ObjectContext* objectCtx); s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd); void TransitionActor_InitContext(GameState* state, TransitionActorContext* transiActorCtx); diff --git a/include/z64actor.h b/include/z64actor.h index 4c1d0ec68..8fdbbf1db 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -199,7 +199,7 @@ typedef struct Actor { /* 0x004 */ u32 flags; // Flags used for various purposes /* 0x008 */ PosRot home; // Initial position/rotation when spawned. Can be used for other purposes /* 0x01C */ s16 params; // Configurable variable set by the actor's spawn data; original name: "args_data" - /* 0x01E */ s8 objBankIndex; // Object bank index of the actor's object dependency; original name: "bank" + /* 0x01E */ s8 objectSlot; // Object slot (in ObjectContext) corresponding to the actor's object; original name: "bank" /* 0x01F */ s8 targetMode; // Controls how far the actor can be targeted from and how far it can stay locked on /* 0x020 */ u16 sfx; // SFX ID to play. Sfx plays when value is set, then is cleared the following update cycle /* 0x024 */ PosRot world; // Position/rotation in the world @@ -287,14 +287,14 @@ typedef struct DynaPolyActor { typedef struct { /* 0x00 */ MtxF* matrices; - /* 0x04 */ s16* objectIds; + /* 0x04 */ s16* objectSlots; /* 0x08 */ s16 count; /* 0x0C */ Gfx** dLists; /* 0x10 */ s32 val; // used for various purposes: both a status indicator and counter /* 0x14 */ s32 prevLimbIndex; } BodyBreak; -#define BODYBREAK_OBJECT_DEFAULT -1 // use the same object as the actor +#define BODYBREAK_OBJECT_SLOT_DEFAULT -1 // use the same object as the actor #define BODYBREAK_STATUS_READY -1 #define BODYBREAK_STATUS_FINISHED 0 diff --git a/include/z64effect.h b/include/z64effect.h index e0dca34c0..4189edc5b 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -246,7 +246,7 @@ typedef struct { #define rgEnvColorG regs[8] #define rgEnvColorB regs[9] #define rgEnvColorA regs[10] -#define rgObjBankIdx regs[11] +#define rgObjectSlot regs[11] #define DEFINE_EFFECT_SS(_0, enum) enum, #define DEFINE_EFFECT_SS_UNSET(enum) enum, diff --git a/include/z64object.h b/include/z64object.h index 3f80fee7a..aa7c2a85e 100644 --- a/include/z64object.h +++ b/include/z64object.h @@ -4,24 +4,22 @@ #include "ultra64.h" #include "z64dma.h" -#define OBJECT_EXCHANGE_BANK_MAX 19 - typedef struct { - /* 0x00 */ s16 id; - /* 0x04 */ void* segment; - /* 0x08 */ DmaRequest dmaRequest; + /* 0x00 */ s16 id; + /* 0x04 */ void* segment; + /* 0x08 */ DmaRequest dmaRequest; /* 0x28 */ OSMesgQueue loadQueue; - /* 0x40 */ OSMesg loadMsg; -} ObjectStatus; // size = 0x44 + /* 0x40 */ OSMesg loadMsg; +} ObjectEntry; // size = 0x44 typedef struct { - /* 0x0000 */ void* spaceStart; - /* 0x0004 */ void* spaceEnd; // original name: "endSegment" - /* 0x0008 */ u8 num; // number of objects in bank - /* 0x0009 */ u8 unk_09; - /* 0x000A */ u8 mainKeepIndex; // "gameplay_keep" index in bank - /* 0x000B */ u8 subKeepIndex; // "gameplay_field_keep" or "gameplay_dangeon_keep" index in bank - /* 0x000C */ ObjectStatus status[OBJECT_EXCHANGE_BANK_MAX]; + /* 0x0000 */ void* spaceStart; + /* 0x0004 */ void* spaceEnd; // original name: "endSegment" + /* 0x0008 */ u8 numEntries; // total amount of used entries + /* 0x0009 */ u8 numPersistentEntries; // amount of entries that won't be reused when loading a new object list (when loading a new room) + /* 0x000A */ u8 mainKeepSlot; // "gameplay_keep" slot + /* 0x000B */ u8 subKeepSlot; // "gameplay_field_keep" or "gameplay_dangeon_keep" slot + /* 0x000C */ ObjectEntry slots[19]; } ObjectContext; // size = 0x518 #define DEFINE_OBJECT(_0, enum) enum, @@ -31,7 +29,7 @@ typedef struct { typedef enum { #include "tables/object_table.h" /* 0x0192 */ OBJECT_ID_MAX -} ObjectID; +} ObjectId; #undef DEFINE_OBJECT #undef DEFINE_OBJECT_NULL diff --git a/src/code/z_actor.c b/src/code/z_actor.c index aa1f16291..4ef0bf10f 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -799,7 +799,7 @@ void Actor_SetScale(Actor* actor, f32 scale) { } void Actor_SetObjectDependency(PlayState* play, Actor* actor) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[actor->objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[actor->objectSlot].segment); } void Actor_Init(Actor* actor, PlayState* play) { @@ -818,7 +818,7 @@ void Actor_Init(Actor* actor, PlayState* play) { CollisionCheck_InitInfo(&actor->colChkInfo); actor->floorBgId = BGCHECK_SCENE; ActorShape_Init(&actor->shape, 0.0f, NULL, 0.0f); - if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, actor->objectSlot)) { Actor_SetObjectDependency(play, actor); actor->init(actor, play); actor->init = NULL; @@ -2143,13 +2143,13 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { actor->sfx = 0; if (actor->init != NULL) { - if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, actor->objectSlot)) { Actor_SetObjectDependency(play, actor); actor->init(actor, play); actor->init = NULL; } actor = actor->next; - } else if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { + } else if (!Object_IsLoaded(&play->objectCtx, actor->objectSlot)) { Actor_Kill(actor); actor = actor->next; } else if ((requiredActorFlag && !(actor->flags & requiredActorFlag)) || @@ -2272,8 +2272,8 @@ void Actor_Draw(PlayState* play, Actor* actor) { Matrix_Scale(actor->scale.x, actor->scale.y, actor->scale.z, MTXMODE_APPLY); Actor_SetObjectDependency(play, actor); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[actor->objBankIndex].segment); - gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[actor->objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[actor->objectSlot].segment); + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.slots[actor->objectSlot].segment); if (actor->colorFilterTimer != 0) { Color_RGBA8 color = { 0, 0, 0, 255 }; @@ -2570,7 +2570,7 @@ void Actor_KillAllWithMissingObject(PlayState* play, ActorContext* actorCtx) { for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) { actor = actorCtx->actorLists[i].head; while (actor != NULL) { - if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { + if (!Object_IsLoaded(&play->objectCtx, actor->objectSlot)) { Actor_Kill(actor); } actor = actor->next; @@ -2745,7 +2745,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos s32 pad; Actor* actor; ActorInit* actorInit; - s32 objBankIndex; + s32 objectSlot; ActorOverlay* overlayEntry; uintptr_t temp; char* name; @@ -2828,13 +2828,13 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos : NULL); } - objBankIndex = Object_GetIndex(&play->objectCtx, actorInit->objectId); + objectSlot = Object_GetSlot(&play->objectCtx, actorInit->objectId); - if ((objBankIndex < 0) || + if ((objectSlot < 0) || ((actorInit->category == ACTORCAT_ENEMY) && Flags_GetClear(play, play->roomCtx.curRoom.num))) { // "No data bank!! (profilep->bank=%d)" osSyncPrintf(VT_COL(RED, WHITE) "データバンク無し!!<データバンク=%d>(profilep->bank=%d)\n" VT_RST, - objBankIndex, actorInit->objectId); + objectSlot, actorInit->objectId); Actor_FreeOverlay(overlayEntry); return NULL; } @@ -2864,10 +2864,10 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos actor->flags = actorInit->flags; if (actorInit->id == ACTOR_EN_PART) { - actor->objBankIndex = rotZ; + actor->objectSlot = rotZ; rotZ = 0; } else { - actor->objBankIndex = objBankIndex; + actor->objectSlot = objectSlot; } actor->init = actorInit->init; @@ -3155,7 +3155,7 @@ s16 func_80032D60(s16* arg0, s16 arg1, s16 arg2, s16 arg3) { void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play) { u32 matricesSize; u32 dListsSize; - u32 objectIdsSize; + u32 objectSlotsSize; matricesSize = (count + 1) * sizeof(*bodyBreak->matrices); bodyBreak->matrices = ZeldaArena_MallocDebug(matricesSize, "../z_actor.c", 7540); @@ -3165,13 +3165,13 @@ void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play) { bodyBreak->dLists = ZeldaArena_MallocDebug(dListsSize, "../z_actor.c", 7543); if (bodyBreak->dLists != NULL) { - objectIdsSize = (count + 1) * sizeof(*bodyBreak->objectIds); - bodyBreak->objectIds = ZeldaArena_MallocDebug(objectIdsSize, "../z_actor.c", 7546); + objectSlotsSize = (count + 1) * sizeof(*bodyBreak->objectSlots); + bodyBreak->objectSlots = ZeldaArena_MallocDebug(objectSlotsSize, "../z_actor.c", 7546); - if (bodyBreak->objectIds != NULL) { + if (bodyBreak->objectSlots != NULL) { Lib_MemSet((u8*)bodyBreak->matrices, matricesSize, 0); Lib_MemSet((u8*)bodyBreak->dLists, dListsSize, 0); - Lib_MemSet((u8*)bodyBreak->objectIds, objectIdsSize, 0); + Lib_MemSet((u8*)bodyBreak->objectSlots, objectSlotsSize, 0); bodyBreak->val = 1; return; } @@ -3186,20 +3186,20 @@ void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play) { ZeldaArena_FreeDebug(bodyBreak->dLists, "../z_actor.c", 7561); } - if (bodyBreak->objectIds != NULL) { - ZeldaArena_FreeDebug(bodyBreak->objectIds, "../z_actor.c", 7564); + if (bodyBreak->objectSlots != NULL) { + ZeldaArena_FreeDebug(bodyBreak->objectSlots, "../z_actor.c", 7564); } } void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s32 maxLimbIndex, u32 count, Gfx** dList, - s16 objectId) { + s16 objectSlot) { PlayState* play = Effect_GetPlayState(); if ((play->actorCtx.freezeFlashTimer == 0) && (bodyBreak->val > 0)) { if ((limbIndex >= minLimbIndex) && (limbIndex <= maxLimbIndex) && (*dList != NULL)) { bodyBreak->dLists[bodyBreak->val] = *dList; Matrix_Get(&bodyBreak->matrices[bodyBreak->val]); - bodyBreak->objectIds[bodyBreak->val] = objectId; + bodyBreak->objectSlots[bodyBreak->val] = objectSlot; bodyBreak->val++; } @@ -3219,7 +3219,7 @@ void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s3 s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s16 type) { EnPart* spawnedEnPart; MtxF* mtx; - s16 objBankIndex; + s16 objectSlot; if (bodyBreak->val != BODYBREAK_STATUS_READY) { return false; @@ -3231,17 +3231,17 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s1 Matrix_Get(&bodyBreak->matrices[bodyBreak->count]); if (1) { - if (bodyBreak->objectIds[bodyBreak->count] >= 0) { - objBankIndex = bodyBreak->objectIds[bodyBreak->count]; + if (bodyBreak->objectSlots[bodyBreak->count] > BODYBREAK_OBJECT_SLOT_DEFAULT) { + objectSlot = bodyBreak->objectSlots[bodyBreak->count]; } else { - objBankIndex = actor->objBankIndex; + objectSlot = actor->objectSlot; } } mtx = &bodyBreak->matrices[bodyBreak->count]; spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, mtx->xw, mtx->yw, - mtx->zw, 0, 0, objBankIndex, type); + mtx->zw, 0, 0, objectSlot, type); if (spawnedEnPart != NULL) { Matrix_MtxFToYXZRotS(&bodyBreak->matrices[bodyBreak->count], &spawnedEnPart->actor.shape.rot, 0); @@ -3256,7 +3256,7 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s1 ZeldaArena_FreeDebug(bodyBreak->matrices, "../z_actor.c", 7678); ZeldaArena_FreeDebug(bodyBreak->dLists, "../z_actor.c", 7679); - ZeldaArena_FreeDebug(bodyBreak->objectIds, "../z_actor.c", 7680); + ZeldaArena_FreeDebug(bodyBreak->objectSlots, "../z_actor.c", 7680); return true; } @@ -4329,7 +4329,7 @@ Actor* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3, EnPart* spawnedEnPart; spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, spawnPos->x, spawnPos->y, - spawnPos->z, spawnRot->x, spawnRot->y, actor->objBankIndex, params); + spawnPos->z, spawnRot->x, spawnRot->y, actor->objectSlot, params); if (spawnedEnPart != NULL) { spawnedEnPart->actor.scale = actor->scale; spawnedEnPart->actor.speed = arg3[0]; diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index f2d7d0a54..253996b62 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -49,7 +49,7 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) { MtxF mfTransBillboard; s32 pad1; Mtx* mtx; - void* object = play->objectCtx.status[this->rgObjBankIdx].segment; + void* objectPtr = play->objectCtx.slots[this->rgObjectSlot].segment; OPEN_DISPS(gfxCtx, "../z_effect_soft_sprite_old_init.c", 196); @@ -58,8 +58,8 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) { SkinMatrix_SetScale(&mfScale, scale, scale, scale); SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard); SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult); - gSegments[6] = VIRTUAL_TO_PHYSICAL(object); - gSPSegment(POLY_XLU_DISP++, 0x06, object); + gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 2755c0565..b7b9e79cd 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -236,7 +236,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { this->scale = 0.01f; break; case ITEM00_SHIELD_DEKU: - this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_1); + this->actor.objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GI_SHIELD_1); Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, 0.5f); this->scale = 0.5f; @@ -245,7 +245,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { this->actor.world.rot.x = 0x4000; break; case ITEM00_SHIELD_HYLIAN: - this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_2); + this->actor.objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GI_SHIELD_2); Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, 0.5f); this->scale = 0.5f; @@ -255,7 +255,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { break; case ITEM00_TUNIC_ZORA: case ITEM00_TUNIC_GORON: - this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_CLOTHES); + this->actor.objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GI_CLOTHES); Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, 0.5f); this->scale = 0.5f; @@ -765,10 +765,10 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) { case ITEM00_RECOVERY_HEART: if (this->despawnTimer < 0) { if (this->despawnTimer == -1) { - s8 bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEART); + s8 objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GI_HEART); - if (Object_IsLoaded(&play->objectCtx, bankIndex)) { - this->actor.objBankIndex = bankIndex; + if (Object_IsLoaded(&play->objectCtx, objectSlot)) { + this->actor.objectSlot = objectSlot; Actor_SetObjectDependency(play, &this->actor); this->despawnTimer = -2; } diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 0cd66f64d..6fffcaf97 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -432,7 +432,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused) play->csCtx.actorCues[i] = NULL; } - if (Object_GetIndex(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) < 0 && !play->envCtx.sunMoonDisabled) { + if (Object_GetSlot(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) < 0 && !play->envCtx.sunMoonDisabled) { play->envCtx.sunMoonDisabled = true; // "Sun setting other than field keep! So forced release!" osSyncPrintf(VT_COL(YELLOW, BLACK) "\n\nフィールド常駐以外、太陽設定!よって強制解除!\n" VT_RST); diff --git a/src/code/z_play.c b/src/code/z_play.c index c4d891548..2ece8f970 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -482,8 +482,8 @@ void Play_Update(PlayState* this) { ActorOverlayTable_LogPrint(); } - gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.mainKeepIndex].segment); - gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.subKeepIndex].segment); + gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); + gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment); if (FrameAdvance_Update(&this->frameAdvCtx, &input[1])) { @@ -855,7 +855,7 @@ void Play_Update(PlayState* this) { AnimationContext_Reset(&this->animationCtx); PLAY_LOG(3561); - Object_UpdateBank(&this->objectCtx); + Object_UpdateEntries(&this->objectCtx); PLAY_LOG(3577); @@ -1035,21 +1035,21 @@ void Play_Draw(PlayState* this) { OPEN_DISPS(gfxCtx, "../z_play.c", 3907); - gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.mainKeepIndex].segment); - gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.subKeepIndex].segment); + gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); + gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment); gSPSegment(POLY_OPA_DISP++, 0x00, NULL); gSPSegment(POLY_XLU_DISP++, 0x00, NULL); gSPSegment(OVERLAY_DISP++, 0x00, NULL); - gSPSegment(POLY_OPA_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment); - gSPSegment(POLY_XLU_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment); - gSPSegment(OVERLAY_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x04, this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); + gSPSegment(POLY_XLU_DISP++, 0x04, this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); + gSPSegment(OVERLAY_DISP++, 0x04, this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); - gSPSegment(POLY_OPA_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment); - gSPSegment(POLY_XLU_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment); - gSPSegment(OVERLAY_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x05, this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); + gSPSegment(POLY_XLU_DISP++, 0x05, this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); + gSPSegment(OVERLAY_DISP++, 0x05, this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); gSPSegment(POLY_OPA_DISP++, 0x02, this->sceneSegment); gSPSegment(POLY_XLU_DISP++, 0x02, this->sceneSegment); @@ -1434,7 +1434,7 @@ void Play_InitScene(PlayState* this, s32 spawn) { this->numActorEntries = 0; - Object_InitBank(this, &this->objectCtx); + Object_InitContext(this, &this->objectCtx); LightContext_Init(this, &this->lightCtx); TransitionActor_InitContext(&this->state, &this->transiActorCtx); func_80096FD4(this, &this->roomCtx.curRoom); diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index ad90fed5a..57fdfd532 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1370,7 +1370,7 @@ void Player_DrawHookshotReticle(PlayState* play, Player* this, f32 arg2) { gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_player_lib.c", 2587), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(OVERLAY_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(OVERLAY_DISP++, 0x06, play->objectCtx.slots[this->actor.objectSlot].segment); gSPDisplayList(OVERLAY_DISP++, gLinkAdultHookshotReticleDL); CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2592); diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 7de8b3a22..72d77af17 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -3,64 +3,77 @@ RomFile sNaviQuestHintFiles[]; -s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId) { +/** + * Spawn an object file of a specified ID that will persist through room changes. + * + * This waits for the file to be fully loaded, the data is available when the function returns. + * + * @return The new object slot corresponding to the requested object ID. + * + * @note This function is not meant to be called externally to spawn object files on the fly. + * When an object is spawned with this function, all objects that come before it in the entry list will be treated as + * persistent, which will likely cause either the amount of free slots or object space memory to run out. + * This function is only meant to be called internally on scene load, before the object list from any room is processed. + */ +s32 Object_SpawnPersistent(ObjectContext* objectCtx, s16 objectId) { u32 size; - objectCtx->status[objectCtx->num].id = objectId; + objectCtx->slots[objectCtx->numEntries].id = objectId; size = gObjectTable[objectId].vromEnd - gObjectTable[objectId].vromStart; - osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", objectId, size / 1024.0f, objectCtx->status[objectCtx->num].segment); + osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", objectId, size / 1024.0f, + objectCtx->slots[objectCtx->numEntries].segment); - osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->num, (uintptr_t)objectCtx->status[objectCtx->num].segment + size, - objectCtx->spaceEnd); + osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->numEntries, + (uintptr_t)objectCtx->slots[objectCtx->numEntries].segment + size, objectCtx->spaceEnd); - ASSERT(((objectCtx->num < OBJECT_EXCHANGE_BANK_MAX) && - (((uintptr_t)objectCtx->status[objectCtx->num].segment + size) < (uintptr_t)objectCtx->spaceEnd)), + ASSERT(((objectCtx->numEntries < ARRAY_COUNT(objectCtx->slots)) && + (((uintptr_t)objectCtx->slots[objectCtx->numEntries].segment + size) < (uintptr_t)objectCtx->spaceEnd)), "this->num < OBJECT_EXCHANGE_BANK_MAX && (this->status[this->num].Segment + size) < this->endSegment", "../z_scene.c", 142); - DmaMgr_RequestSyncDebug(objectCtx->status[objectCtx->num].segment, gObjectTable[objectId].vromStart, size, + DmaMgr_RequestSyncDebug(objectCtx->slots[objectCtx->numEntries].segment, gObjectTable[objectId].vromStart, size, "../z_scene.c", 145); - if (objectCtx->num < OBJECT_EXCHANGE_BANK_MAX - 1) { - objectCtx->status[objectCtx->num + 1].segment = - (void*)ALIGN16((uintptr_t)objectCtx->status[objectCtx->num].segment + size); + if (objectCtx->numEntries < (ARRAY_COUNT(objectCtx->slots) - 1)) { + objectCtx->slots[objectCtx->numEntries + 1].segment = + (void*)ALIGN16((uintptr_t)objectCtx->slots[objectCtx->numEntries].segment + size); } - objectCtx->num++; - objectCtx->unk_09 = objectCtx->num; + objectCtx->numEntries++; + objectCtx->numPersistentEntries = objectCtx->numEntries; - return objectCtx->num - 1; + return objectCtx->numEntries - 1; } -void Object_InitBank(PlayState* play, ObjectContext* objectCtx) { - PlayState* play2 = play; // Needs to be a new variable to match (possibly a sub struct?) +void Object_InitContext(PlayState* play, ObjectContext* objectCtx) { + PlayState* play2 = play; u32 spaceSize; s32 i; if (play2->sceneId == SCENE_HYRULE_FIELD) { - spaceSize = 1024000; + spaceSize = 1000 * 1024; } else if (play2->sceneId == SCENE_GANON_BOSS) { if (gSaveContext.sceneLayer != 4) { - spaceSize = 1177600; + spaceSize = 1150 * 1024; } else { - spaceSize = 1024000; + spaceSize = 1000 * 1024; } } else if (play2->sceneId == SCENE_SPIRIT_TEMPLE_BOSS) { - spaceSize = 1075200; + spaceSize = 1050 * 1024; } else if (play2->sceneId == SCENE_CHAMBER_OF_THE_SAGES) { - spaceSize = 1075200; + spaceSize = 1050 * 1024; } else if (play2->sceneId == SCENE_GANONDORF_BOSS) { - spaceSize = 1075200; + spaceSize = 1050 * 1024; } else { - spaceSize = 1024000; + spaceSize = 1000 * 1024; } - objectCtx->num = objectCtx->unk_09 = 0; - objectCtx->mainKeepIndex = objectCtx->subKeepIndex = 0; + objectCtx->numEntries = objectCtx->numPersistentEntries = 0; + objectCtx->mainKeepSlot = objectCtx->subKeepSlot = 0; - for (i = 0; i < OBJECT_EXCHANGE_BANK_MAX; i++) { - objectCtx->status[i].id = OBJECT_INVALID; + for (i = 0; i < ARRAY_COUNT(objectCtx->slots); i++) { + objectCtx->slots[i].id = OBJECT_INVALID; } osSyncPrintf(VT_FGCOL(GREEN)); @@ -68,42 +81,43 @@ void Object_InitBank(PlayState* play, ObjectContext* objectCtx) { osSyncPrintf("オブジェクト入れ替えバンク情報 %8.3fKB\n", spaceSize / 1024.0f); osSyncPrintf(VT_RST); - objectCtx->spaceStart = objectCtx->status[0].segment = - GameState_Alloc(&play->state, spaceSize, "../z_scene.c", 219); + objectCtx->spaceStart = objectCtx->slots[0].segment = GameState_Alloc(&play->state, spaceSize, "../z_scene.c", 219); objectCtx->spaceEnd = (void*)((uintptr_t)objectCtx->spaceStart + spaceSize); - objectCtx->mainKeepIndex = Object_Spawn(objectCtx, OBJECT_GAMEPLAY_KEEP); - gSegments[4] = VIRTUAL_TO_PHYSICAL(objectCtx->status[objectCtx->mainKeepIndex].segment); + objectCtx->mainKeepSlot = Object_SpawnPersistent(objectCtx, OBJECT_GAMEPLAY_KEEP); + gSegments[4] = VIRTUAL_TO_PHYSICAL(objectCtx->slots[objectCtx->mainKeepSlot].segment); } -void Object_UpdateBank(ObjectContext* objectCtx) { +void Object_UpdateEntries(ObjectContext* objectCtx) { s32 i; - ObjectStatus* status = &objectCtx->status[0]; + ObjectEntry* entry = &objectCtx->slots[0]; RomFile* objectFile; u32 size; - for (i = 0; i < objectCtx->num; i++) { - if (status->id < 0) { - if (status->dmaRequest.vromAddr == 0) { - osCreateMesgQueue(&status->loadQueue, &status->loadMsg, 1); - objectFile = &gObjectTable[-status->id]; + for (i = 0; i < objectCtx->numEntries; i++) { + if (entry->id < 0) { + if (entry->dmaRequest.vromAddr == 0) { + osCreateMesgQueue(&entry->loadQueue, &entry->loadMsg, 1); + objectFile = &gObjectTable[-entry->id]; size = objectFile->vromEnd - objectFile->vromStart; - osSyncPrintf("OBJECT EXCHANGE BANK-%2d SIZE %8.3fK SEG=%08x\n", i, size / 1024.0f, status->segment); - DmaMgr_RequestAsync(&status->dmaRequest, status->segment, objectFile->vromStart, size, 0, - &status->loadQueue, NULL, "../z_scene.c", 266); - } else if (osRecvMesg(&status->loadQueue, NULL, OS_MESG_NOBLOCK) == 0) { - status->id = -status->id; + + osSyncPrintf("OBJECT EXCHANGE BANK-%2d SIZE %8.3fK SEG=%08x\n", i, size / 1024.0f, entry->segment); + + DmaMgr_RequestAsync(&entry->dmaRequest, entry->segment, objectFile->vromStart, size, 0, + &entry->loadQueue, NULL, "../z_scene.c", 266); + } else if (osRecvMesg(&entry->loadQueue, NULL, OS_MESG_NOBLOCK) == 0) { + entry->id = -entry->id; } } - status++; + entry++; } } -s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId) { +s32 Object_GetSlot(ObjectContext* objectCtx, s16 objectId) { s32 i; - for (i = 0; i < objectCtx->num; i++) { - if (ABS(objectCtx->status[i].id) == objectId) { + for (i = 0; i < objectCtx->numEntries; i++) { + if (ABS(objectCtx->slots[i].id) == objectId) { return i; } } @@ -111,8 +125,8 @@ s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId) { return -1; } -s32 Object_IsLoaded(ObjectContext* objectCtx, s32 bankIndex) { - if (objectCtx->status[bankIndex].id > 0) { +s32 Object_IsLoaded(ObjectContext* objectCtx, s32 slot) { + if (objectCtx->slots[slot].id > 0) { return true; } else { return false; @@ -124,30 +138,30 @@ void func_800981B8(ObjectContext* objectCtx) { s32 id; u32 size; - for (i = 0; i < objectCtx->num; i++) { - id = objectCtx->status[i].id; + for (i = 0; i < objectCtx->numEntries; i++) { + id = objectCtx->slots[i].id; size = gObjectTable[id].vromEnd - gObjectTable[id].vromStart; - osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", objectCtx->status[i].id, size / 1024.0f, - objectCtx->status[i].segment); - osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->num, (uintptr_t)objectCtx->status[i].segment + size, + osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", objectCtx->slots[i].id, size / 1024.0f, + objectCtx->slots[i].segment); + osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->numEntries, (uintptr_t)objectCtx->slots[i].segment + size, objectCtx->spaceEnd); - DmaMgr_RequestSyncDebug(objectCtx->status[i].segment, gObjectTable[id].vromStart, size, "../z_scene.c", 342); + DmaMgr_RequestSyncDebug(objectCtx->slots[i].segment, gObjectTable[id].vromStart, size, "../z_scene.c", 342); } } -void* func_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId) { - ObjectStatus* status = &objectCtx->status[bankIndex]; +void* func_800982FC(ObjectContext* objectCtx, s32 slot, s16 objectId) { + ObjectEntry* entry = &objectCtx->slots[slot]; RomFile* objectFile = &gObjectTable[objectId]; u32 size; void* nextPtr; - status->id = -objectId; - status->dmaRequest.vromAddr = 0; + entry->id = -objectId; + entry->dmaRequest.vromAddr = 0; size = objectFile->vromEnd - objectFile->vromStart; - osSyncPrintf("OBJECT EXCHANGE NO=%2d BANK=%3d SIZE=%8.3fK\n", bankIndex, objectId, size / 1024.0f); + osSyncPrintf("OBJECT EXCHANGE NO=%2d BANK=%3d SIZE=%8.3fK\n", slot, objectId, size / 1024.0f); - nextPtr = (void*)ALIGN16((uintptr_t)status->segment + size); + nextPtr = (void*)ALIGN16((uintptr_t)entry->segment + size); ASSERT(nextPtr < objectCtx->spaceEnd, "nextptr < this->endSegment", "../z_scene.c", 381); @@ -191,7 +205,7 @@ void Scene_CommandPlayerEntryList(PlayState* play, SceneCmd* cmd) { linkObjectId = gLinkObjectIds[((void)0, gSaveContext.save.linkAge)]; gActorOverlayTable[playerEntry->id].initInfo->objectId = linkObjectId; - Object_Spawn(&play->objectCtx, linkObjectId); + Object_SpawnPersistent(&play->objectCtx, linkObjectId); } void Scene_CommandActorEntryList(PlayState* play, SceneCmd* cmd) { @@ -226,8 +240,8 @@ void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) { void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) { if (cmd->specialFiles.keepObjectId != OBJECT_INVALID) { - play->objectCtx.subKeepIndex = Object_Spawn(&play->objectCtx, cmd->specialFiles.keepObjectId); - gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment); + play->objectCtx.subKeepSlot = Object_SpawnPersistent(&play->objectCtx, cmd->specialFiles.keepObjectId); + gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[play->objectCtx.subKeepSlot].segment); } if (cmd->specialFiles.naviQuestHintFileId != NAVI_QUEST_HINTS_NONE) { @@ -250,25 +264,27 @@ void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) { s32 i; s32 j; s32 k; - ObjectStatus* status; - ObjectStatus* status2; - ObjectStatus* firstStatus; - s16* objectEntry = SEGMENTED_TO_VIRTUAL(cmd->objectList.data); + ObjectEntry* entry; + ObjectEntry* invalidatedEntry; + ObjectEntry* entries; + s16* objectListEntry = SEGMENTED_TO_VIRTUAL(cmd->objectList.data); void* nextPtr; k = 0; - i = play->objectCtx.unk_09; - firstStatus = &play->objectCtx.status[0]; - status = &play->objectCtx.status[i]; + i = play->objectCtx.numPersistentEntries; + entries = play->objectCtx.slots; + entry = &play->objectCtx.slots[i]; - while (i < play->objectCtx.num) { - if (status->id != *objectEntry) { - status2 = &play->objectCtx.status[i]; - for (j = i; j < play->objectCtx.num; j++) { - status2->id = OBJECT_INVALID; - status2++; + while (i < play->objectCtx.numEntries) { + if (entry->id != *objectListEntry) { + + invalidatedEntry = &play->objectCtx.slots[i]; + for (j = i; j < play->objectCtx.numEntries; j++) { + invalidatedEntry->id = OBJECT_INVALID; + invalidatedEntry++; } - play->objectCtx.num = i; + + play->objectCtx.numEntries = i; Actor_KillAllWithMissingObject(play, &play->actorCtx); continue; @@ -276,24 +292,24 @@ void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) { i++; k++; - objectEntry++; - status++; + objectListEntry++; + entry++; } - ASSERT(cmd->objectList.length <= OBJECT_EXCHANGE_BANK_MAX, + ASSERT(cmd->objectList.length <= ARRAY_COUNT(play->objectCtx.slots), "scene_info->object_bank.num <= OBJECT_EXCHANGE_BANK_MAX", "../z_scene.c", 705); while (k < cmd->objectList.length) { - nextPtr = func_800982FC(&play->objectCtx, i, *objectEntry); - if (i < OBJECT_EXCHANGE_BANK_MAX - 1) { - firstStatus[i + 1].segment = nextPtr; + nextPtr = func_800982FC(&play->objectCtx, i, *objectListEntry); + if (i < (ARRAY_COUNT(play->objectCtx.slots) - 1)) { + entries[i + 1].segment = nextPtr; } i++; k++; - objectEntry++; + objectListEntry++; } - play->objectCtx.num = i; + play->objectCtx.numEntries = i; } void Scene_CommandLightList(PlayState* play, SceneCmd* cmd) { diff --git a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c index bf72c4ce4..45ab8be19 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c @@ -103,10 +103,10 @@ void BgBreakwall_Init(Actor* thisx, PlayState* play) { this->dyna.actor.world.pos.y -= 40.0f; } - this->bankIndex = (wallType >= BWALL_KD_FLOOR) ? Object_GetIndex(&play->objectCtx, OBJECT_KINGDODONGO) - : Object_GetIndex(&play->objectCtx, OBJECT_BWALL); + this->requiredObjectSlot = (wallType >= BWALL_KD_FLOOR) ? Object_GetSlot(&play->objectCtx, OBJECT_KINGDODONGO) + : Object_GetSlot(&play->objectCtx, OBJECT_BWALL); - if (this->bankIndex < 0) { + if (this->requiredObjectSlot < 0) { Actor_Kill(&this->dyna.actor); } else { BgBreakwall_SetupAction(this, BgBreakwall_WaitForObject); @@ -201,11 +201,11 @@ Actor* BgBreakwall_SpawnFragments(PlayState* play, BgBreakwall* this, Vec3f* pos * Sets up the collision model as well is the object dependency and action function to use. */ void BgBreakwall_WaitForObject(BgBreakwall* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { CollisionHeader* colHeader = NULL; s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF; - this->dyna.actor.objBankIndex = this->bankIndex; + this->dyna.actor.objectSlot = this->requiredObjectSlot; Actor_SetObjectDependency(play, &this->dyna.actor); this->dyna.actor.flags &= ~ACTOR_FLAG_4; this->dyna.actor.draw = BgBreakwall_Draw; diff --git a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h index 022a439f2..6880026c2 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h @@ -12,7 +12,7 @@ typedef struct BgBreakwall { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ Gfx* bombableWallDList; /* 0x0168 */ s8 colType; - /* 0x0169 */ s8 bankIndex; + /* 0x0169 */ s8 requiredObjectSlot; /* 0x016C */ ColliderQuad collider; /* 0x01EC */ BgBreakwallActionFunc actionFunc; } BgBreakwall; // size = 0x01F0 diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index 2c1b5ca9b..e734780de 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -66,12 +66,12 @@ void BgHakaMegane_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); if (thisx->params < 3) { - this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKACH_OBJECTS); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_HAKACH_OBJECTS); } else { - this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_HAKA_OBJECTS); } - if (this->objBankIndex < 0) { + if (this->requiredObjectSlot < 0) { Actor_Kill(thisx); } else { this->actionFunc = func_8087DB24; @@ -88,8 +88,8 @@ void func_8087DB24(BgHakaMegane* this, PlayState* play) { CollisionHeader* colHeader; CollisionHeader* collision; - if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { - this->dyna.actor.objBankIndex = this->objBankIndex; + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { + this->dyna.actor.objectSlot = this->requiredObjectSlot; this->dyna.actor.draw = BgHakaMegane_Draw; Actor_SetObjectDependency(play, &this->dyna.actor); if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h index 9de05508f..e82c0a97c 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h @@ -12,7 +12,7 @@ typedef struct BgHakaMegane { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgHakaMeganeActionFunc actionFunc; /* 0x0168 */ char unk_168[0x1]; - /* 0x0169 */ s8 objBankIndex; + /* 0x0169 */ s8 requiredObjectSlot; /* 0x016A */ char unk_16A[0x2]; } BgHakaMegane; // size = 0x016C diff --git a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index 9e76939f4..9dcf1f52c 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -169,16 +169,16 @@ void BgHakaSgami_Init(Actor* thisx, PlayState* play) { Effect_Add(play, &this->blureEffectIndex[1], EFFECT_BLURE1, 0, 0, &blureInit); if (thisx->params == SCYTHE_TRAP_SHADOW_TEMPLE) { - this->requiredObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_HAKA_OBJECTS); thisx->flags &= ~ACTOR_FLAG_0; } else { - this->requiredObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_ICE_OBJECTS); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_ICE_OBJECTS); this->colliderScytheCenter.dim.radius = 30; this->colliderScytheCenter.dim.height = 70; Actor_SetFocus(thisx, 40.0f); } - if (this->requiredObjBankIndex < 0) { + if (this->requiredObjectSlot < 0) { Actor_Kill(thisx); return; } @@ -196,8 +196,8 @@ void BgHakaSgami_Destroy(Actor* thisx, PlayState* play) { } void BgHakaSgami_SetupSpin(BgHakaSgami* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { - this->actor.objBankIndex = this->requiredObjBankIndex; + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { + this->actor.objectSlot = this->requiredObjectSlot; this->actor.draw = BgHakaSgami_Draw; this->timer = SCYTHE_SPIN_TIME; this->actor.flags &= ~ACTOR_FLAG_4; diff --git a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h index 6f140a39c..d13418053 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h +++ b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h @@ -11,7 +11,7 @@ typedef void (*BgHakaSgamiActionFunc)(struct BgHakaSgami*, PlayState*); typedef struct BgHakaSgami { /* 0x0000 */ Actor actor; /* 0x014C */ BgHakaSgamiActionFunc actionFunc; - /* 0x0150 */ s8 requiredObjBankIndex; + /* 0x0150 */ s8 requiredObjectSlot; /* 0x0151 */ s8 unk_151; /* 0x0152 */ s16 timer; /* 0x0154 */ s32 blureEffectIndex[2]; diff --git a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c index 4286c35b3..bccdea961 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c +++ b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c @@ -102,11 +102,11 @@ void BgHakaZou_Init(Actor* thisx, PlayState* play) { } } - this->requiredObjBankIndex = (thisx->params == STA_BOMBABLE_RUBBLE) - ? Object_GetIndex(&play->objectCtx, OBJECT_HAKACH_OBJECTS) - : Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS); + this->requiredObjectSlot = (thisx->params == STA_BOMBABLE_RUBBLE) + ? Object_GetSlot(&play->objectCtx, OBJECT_HAKACH_OBJECTS) + : Object_GetSlot(&play->objectCtx, OBJECT_HAKA_OBJECTS); - if (this->requiredObjBankIndex < 0) { + if (this->requiredObjectSlot < 0) { Actor_Kill(thisx); } else if ((thisx->params != STA_UNKNOWN) && Flags_GetSwitch(play, this->switchFlag)) { if (thisx->params != STA_GIANT_BIRD_STATUE) { @@ -158,8 +158,8 @@ void func_808828F4(BgHakaZou* this, PlayState* play) { void BgHakaZou_Wait(BgHakaZou* this, PlayState* play) { CollisionHeader* colHeader; - if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { - this->dyna.actor.objBankIndex = this->requiredObjBankIndex; + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { + this->dyna.actor.objectSlot = this->requiredObjectSlot; this->dyna.actor.draw = BgHakaZou_Draw; if (this->dyna.actor.params == STA_UNKNOWN) { diff --git a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h index b5fe2a2fd..6eb5ddcae 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h +++ b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h @@ -11,7 +11,7 @@ typedef void (*BgHakaZouActionFunc)(struct BgHakaZou*, PlayState*); typedef struct BgHakaZou { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgHakaZouActionFunc actionFunc; - /* 0x0168 */ s8 requiredObjBankIndex; + /* 0x0168 */ s8 requiredObjectSlot; /* 0x0169 */ u8 switchFlag; /* 0x016A */ s16 timer; /* 0x016C */ ColliderCylinder collider; diff --git a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c index 87376ca9d..a5ca45520 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c @@ -117,8 +117,8 @@ void BgJyaBigmirror_SetBombiwaFlag(Actor* thisx, PlayState* play) { } void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) { - static s16 sMirRayParamss[] = { 0x0005, 0x0007, 0x0008 }; - static Vec3f sMirRayPoss[] = { + static s16 sMirRayParamsVals[] = { 0x0005, 0x0007, 0x0008 }; + static Vec3f sMirRayPositions[] = { { 60.0f, 1802.0f, -1102.0f }, { -560.0f, 1800.0f, -310.0f }, { 60.0f, 1800.0f, -310.0f }, @@ -127,11 +127,11 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) { s32 puzzleSolved; s32 lightBeamToggles[3]; s32 i; - s32 objBankIndex; + s32 mirRayObjectSlot; - objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_MIR_RAY); + mirRayObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MIR_RAY); - if ((objBankIndex < 0) || (objBankIndex != this->mirRayObjIndex)) { + if ((mirRayObjectSlot < 0) || (mirRayObjectSlot != this->mirRayObjectSlot)) { this->lightBeams[2] = NULL; this->lightBeams[1] = NULL; this->lightBeams[0] = NULL; @@ -152,9 +152,11 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) { for (i = 0; i < 3; i++) { if (lightBeamToggles[i]) { - if ((this->lightBeams[i] == NULL) && Object_IsLoaded(&play->objectCtx, objBankIndex)) { - this->lightBeams[i] = Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, sMirRayPoss[i].x, - sMirRayPoss[i].y, sMirRayPoss[i].z, 0, 0, 0, sMirRayParamss[i]); + if ((this->lightBeams[i] == NULL) && Object_IsLoaded(&play->objectCtx, mirRayObjectSlot)) { + + this->lightBeams[i] = + Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, sMirRayPositions[i].x, sMirRayPositions[i].y, + sMirRayPositions[i].z, 0, 0, 0, sMirRayParamsVals[i]); if (this->lightBeams[i] == NULL) { // "Mir Ray generation failed" @@ -169,7 +171,7 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) { } } } - this->mirRayObjIndex = objBankIndex; + this->mirRayObjectSlot = mirRayObjectSlot; } void BgJyaBigmirror_Init(Actor* thisx, PlayState* play) { @@ -186,7 +188,7 @@ void BgJyaBigmirror_Init(Actor* thisx, PlayState* play) { this->actor.room = -1; sIsSpawned = true; this->spawned = true; - this->mirRayObjIndex = -1; + this->mirRayObjectSlot = -1; // "jya Bigmirror" osSyncPrintf("(jya 大鏡)(arg_data 0x%04x)\n", this->actor.params); diff --git a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h index 298d95692..90647a7a8 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h +++ b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h @@ -25,7 +25,7 @@ typedef struct BgJyaBigmirror { /* 0x015C */ u8 puzzleFlags; /* 0x015D */ u8 spawned; /* 0x0160 */ Actor* lightBeams[3]; - /* 0x016C */ s32 mirRayObjIndex; + /* 0x016C */ s32 mirRayObjectSlot; /* 0x0170 */ f32 liftHeight; } BgJyaBigmirror; // size = 0x0174 diff --git a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c index a7ea7b0b5..5f13fd87a 100644 --- a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c +++ b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c @@ -45,7 +45,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_STOP), }; -static s16 sObjectIDs[] = { OBJECT_MJIN_FLASH, OBJECT_MJIN_DARK, OBJECT_MJIN_FLAME, +static s16 sObjectIds[] = { OBJECT_MJIN_FLASH, OBJECT_MJIN_DARK, OBJECT_MJIN_FLAME, OBJECT_MJIN_ICE, OBJECT_MJIN_SOUL, OBJECT_MJIN_WIND }; void BgMjin_SetupAction(BgMjin* this, BgMjinActionFunc actionFunc) { @@ -54,12 +54,12 @@ void BgMjin_SetupAction(BgMjin* this, BgMjinActionFunc actionFunc) { void BgMjin_Init(Actor* thisx, PlayState* play) { BgMjin* this = (BgMjin*)thisx; - s8 objBankIndex; + s8 objectSlot; Actor_ProcessInitChain(thisx, sInitChain); - objBankIndex = Object_GetIndex(&play->objectCtx, (thisx->params != 0 ? OBJECT_MJIN : OBJECT_MJIN_OKA)); - this->objBankIndex = objBankIndex; - if (objBankIndex < 0) { + objectSlot = Object_GetSlot(&play->objectCtx, (thisx->params != 0 ? OBJECT_MJIN : OBJECT_MJIN_OKA)); + this->requiredObjectSlot = objectSlot; + if (objectSlot < 0) { Actor_Kill(thisx); } else { BgMjin_SetupAction(this, func_808A0850); @@ -76,10 +76,10 @@ void func_808A0850(BgMjin* this, PlayState* play) { CollisionHeader* colHeader; CollisionHeader* collision; - if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { colHeader = NULL; this->dyna.actor.flags &= ~ACTOR_FLAG_4; - this->dyna.actor.objBankIndex = this->objBankIndex; + this->dyna.actor.objectSlot = this->requiredObjectSlot; Actor_SetObjectDependency(play, &this->dyna.actor); DynaPolyActor_Init(&this->dyna, 0); collision = this->dyna.actor.params != 0 ? &gWarpPadCol : &gOcarinaWarpPadCol; @@ -106,10 +106,10 @@ void BgMjin_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_mjin.c", 250); if (thisx->params != 0) { - s32 objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIDs[thisx->params - 1]); + s32 objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[thisx->params - 1]); - if (objBankIndex >= 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment); + if (objectSlot >= 0) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&D_06000000)); diff --git a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h index 415625574..03e18fbb7 100644 --- a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h +++ b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h @@ -10,7 +10,7 @@ typedef void (*BgMjinActionFunc)(struct BgMjin*, PlayState*); typedef struct BgMjin { /* 0x0000 */ DynaPolyActor dyna; - /* 0x0164 */ s8 objBankIndex; + /* 0x0164 */ s8 requiredObjectSlot; /* 0x0168 */ BgMjinActionFunc actionFunc; } BgMjin; // size = 0x016C diff --git a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c index 9f10928f1..5e27a7fc0 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c +++ b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c @@ -77,8 +77,8 @@ void BgMoriBigst_Init(Actor* thisx, PlayState* play) { GET_PLAYER(play)->actor.world.pos.y); BgMoriBigst_InitDynapoly(this, play, &gMoriBigstCol, 0); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); - if (this->moriTexObjIndex < 0) { + this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); + if (this->moriTexObjectSlot < 0) { // "【Big Stalfos key ceiling】 bank danger!" osSyncPrintf("【ビッグスタルフォス鍵型天井】 バンク危険!\n"); osSyncPrintf("%s %d\n", "../z_bg_mori_bigst.c", 234); @@ -108,7 +108,7 @@ void BgMoriBigst_SetupWaitForMoriTex(BgMoriBigst* this, PlayState* play) { void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, PlayState* play) { Actor* thisx = &this->dyna.actor; - if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) { thisx->draw = BgMoriBigst_Draw; if (Flags_GetClear(play, thisx->room) && (GET_PLAYER(play)->actor.world.pos.y > 700.0f)) { if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { @@ -248,7 +248,7 @@ void BgMoriBigst_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_bigst.c", 541); Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_bigst.c", 548), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h index c2a97444e..c71eac7ab 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h +++ b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h @@ -12,7 +12,7 @@ typedef struct BgMoriBigst { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgMoriBigstActionFunc actionFunc; /* 0x0168 */ s16 waitTimer; - /* 0x016A */ s8 moriTexObjIndex; + /* 0x016A */ s8 moriTexObjectSlot; } BgMoriBigst; // size = 0x016C #endif diff --git a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c index 146c9d2fc..1fbbe33c8 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c +++ b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c @@ -87,8 +87,8 @@ void BgMoriElevator_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; this->unk_172 = sIsSpawned; - this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); - if (this->moriTexObjIndex < 0) { + this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); + if (this->moriTexObjectSlot < 0) { Actor_Kill(thisx); // "Forest Temple obj elevator Bank Danger!" osSyncPrintf("Error : 森の神殿 obj elevator バンク危険!(%s %d)\n", "../z_bg_mori_elevator.c", 277); @@ -134,7 +134,7 @@ void BgMoriElevator_SetupWaitAfterInit(BgMoriElevator* this) { } void BgMoriElevator_WaitAfterInit(BgMoriElevator* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) { if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { if (play->roomCtx.curRoom.num == 2) { this->dyna.actor.world.pos.y = 73.0f; @@ -255,7 +255,7 @@ void BgMoriElevator_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_elevator.c", 575); Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_elevator.c", 580), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gMoriElevatorDL); diff --git a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h index a981c71dd..e7bcc5018 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h +++ b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h @@ -14,7 +14,7 @@ typedef struct BgMoriElevator { /* 0x0168 */ f32 targetY; /* 0x016C */ s32 unk_16C; /* 0x0170 */ u8 unk_170; - /* 0x0171 */ s8 moriTexObjIndex; + /* 0x0171 */ s8 moriTexObjectSlot; /* 0x0172 */ s16 unk_172; } BgMoriElevator; // size = 0x0174 diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c index aecc6935e..cc6d15db2 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c @@ -164,8 +164,8 @@ void BgMoriHashigo_Init(Actor* thisx, PlayState* play) { return; } } - this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); - if (this->moriTexObjIndex < 0) { + this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); + if (this->moriTexObjectSlot < 0) { // "Bank danger!" osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", this->dyna.actor.params, "../z_bg_mori_hashigo.c", 312); @@ -194,7 +194,7 @@ void BgMoriHashigo_SetupWaitForMoriTex(BgMoriHashigo* this) { } void BgMoriHashigo_WaitForMoriTex(BgMoriHashigo* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) { if (this->dyna.actor.params == HASHIGO_CLASP) { BgMoriHashigo_SetupClasp(this); } else if (this->dyna.actor.params == HASHIGO_LADDER) { @@ -285,7 +285,7 @@ void BgMoriHashigo_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_hashigo.c", 516); Gfx_SetupDL_25Opa(play->state.gfxCtx); if (1) {} - gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hashigo.c", 521), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h index fc5d99cc3..5e957f403 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h +++ b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h @@ -15,7 +15,7 @@ typedef struct BgMoriHashigo { /* 0x01C4 */ BgMoriHashigoActionFunc actionFunc; /* 0x01C8 */ s16 hitTimer; /* 0x01CA */ s16 bounceCounter; - /* 0x01CC */ s8 moriTexObjIndex; + /* 0x01CC */ s8 moriTexObjectSlot; } BgMoriHashigo; // size = 0x01D0 typedef enum { diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c index d43569075..a44854df6 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c @@ -78,8 +78,8 @@ void BgMoriHashira4_Init(Actor* thisx, PlayState* play) { BgMoriHashira4_InitDynaPoly(this, play, &gMoriHashira2Col, 0); } Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); - if (this->moriTexObjIndex < 0) { + this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); + if (this->moriTexObjectSlot < 0) { Actor_Kill(&this->dyna.actor); // "Bank danger!" osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", this->dyna.actor.params, @@ -109,7 +109,7 @@ void BgMoriHashira4_SetupWaitForMoriTex(BgMoriHashira4* this) { } void BgMoriHashira4_WaitForMoriTex(BgMoriHashira4* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) { this->gateTimer = 0; if (this->dyna.actor.params == 0) { BgMoriHashira4_SetupPillarsRotate(this); @@ -163,7 +163,7 @@ void BgMoriHashira4_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_hashira4.c", 339); Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hashira4.c", 344), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h index 797688bdb..a36a6ef36 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h +++ b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h @@ -11,7 +11,7 @@ typedef void (*BgMoriHashira4ActionFunc)(struct BgMoriHashira4*, PlayState*); typedef struct BgMoriHashira4 { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgMoriHashira4ActionFunc actionFunc; - /* 0x0168 */ s8 moriTexObjIndex; + /* 0x0168 */ s8 moriTexObjectSlot; /* 0x0169 */ s8 switchFlag; /* 0x016A */ s16 gateTimer; } BgMoriHashira4; // size = 0x016C diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c index 79fbaaa3d..43f17618f 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c @@ -54,7 +54,7 @@ static Gfx* sDLists[] = { void BgMoriHineri_Init(Actor* thisx, PlayState* play) { BgMoriHineri* this = (BgMoriHineri*)thisx; - s8 moriHineriObjIdx; + s8 objectSlot; u32 switchFlagParam; s32 t6; @@ -78,26 +78,26 @@ void BgMoriHineri_Init(Actor* thisx, PlayState* play) { this->dyna.actor.params = 3; } } - this->boxObjIdx = -1; + this->boxObjectSlot = -1; if (this->dyna.actor.params == 0) { - this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1); + this->moriHineriObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI1); if (t6 == 0) { - this->boxObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_BOX); + this->boxObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_BOX); } } else { if (this->dyna.actor.params == 1) { - moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1A); + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI1A); } else { - moriHineriObjIdx = (this->dyna.actor.params == 2) ? Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2) - : Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2A); + objectSlot = (this->dyna.actor.params == 2) ? Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI2) + : Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI2A); } - this->moriHineriObjIdx = moriHineriObjIdx; + this->moriHineriObjectSlot = objectSlot; } - this->moriTexObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); if (t6 != 0) { this->dyna.actor.params += 4; } - if ((this->moriHineriObjIdx < 0) || (this->moriTexObjIdx < 0)) { + if ((this->moriHineriObjectSlot < 0) || (this->moriTexObjectSlot < 0)) { Actor_Kill(&this->dyna.actor); } else { this->actionFunc = func_808A39FC; @@ -112,22 +112,22 @@ void BgMoriHineri_Destroy(Actor* thisx, PlayState* play) { void func_808A39FC(BgMoriHineri* this, PlayState* play) { CollisionHeader* colHeader; - if (Object_IsLoaded(&play->objectCtx, this->moriHineriObjIdx) && - Object_IsLoaded(&play->objectCtx, this->moriTexObjIdx) && - ((this->boxObjIdx < 0) || Object_IsLoaded(&play->objectCtx, this->boxObjIdx))) { - this->dyna.actor.objBankIndex = this->moriHineriObjIdx; + if (Object_IsLoaded(&play->objectCtx, this->moriHineriObjectSlot) && + Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot) && + ((this->boxObjectSlot < 0) || Object_IsLoaded(&play->objectCtx, this->boxObjectSlot))) { + this->dyna.actor.objectSlot = this->moriHineriObjectSlot; if (this->dyna.actor.params >= 4) { this->dyna.actor.params -= 4; if (this->dyna.actor.params == 0) { - this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1A); + this->moriHineriObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI1A); } else if (this->dyna.actor.params == 1) { - this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1); + this->moriHineriObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI1); } else { - this->moriHineriObjIdx = (this->dyna.actor.params == 2) - ? Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2A) - : Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2); + this->moriHineriObjectSlot = (this->dyna.actor.params == 2) + ? Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI2A) + : Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI2); } - if (this->moriHineriObjIdx < 0) { + if (this->moriHineriObjectSlot < 0) { Actor_Kill(&this->dyna.actor); } else { this->actionFunc = func_808A3D58; @@ -194,13 +194,13 @@ void func_808A3D58(BgMoriHineri* this, PlayState* play) { } void func_808A3E54(BgMoriHineri* this, PlayState* play) { - s8 objBankIndex; + s8 objectSlot; if (play->activeCamId == sSubCamId) { if (sSubCamId != SUB_CAM_ID_DONE) { - objBankIndex = this->dyna.actor.objBankIndex; - this->dyna.actor.objBankIndex = this->moriHineriObjIdx; - this->moriHineriObjIdx = objBankIndex; + objectSlot = this->dyna.actor.objectSlot; + this->dyna.actor.objectSlot = this->moriHineriObjectSlot; + this->moriHineriObjectSlot = objectSlot; this->dyna.actor.params ^= 1; sSubCamId = SUB_CAM_ID_DONE; Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); @@ -223,17 +223,17 @@ void BgMoriHineri_Update(Actor* thisx, PlayState* play) { void BgMoriHineri_DrawHallAndRoom(Actor* thisx, PlayState* play) { BgMoriHineri* this = (BgMoriHineri*)thisx; - s8 objIndex; + s32 pad; MtxF mtx; OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_hineri.c", 611); Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hineri.c", 618), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sDLists[this->dyna.actor.params]); - if (this->boxObjIdx > 0) { + if (this->boxObjectSlot > 0) { Matrix_Get(&mtx); } if ((this->actionFunc == func_808A3C8C) && (this->dyna.actor.shape.rot.z != 0)) { @@ -249,9 +249,9 @@ void BgMoriHineri_DrawHallAndRoom(Actor* thisx, PlayState* play) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDungeonDoorDL); } - if ((this->boxObjIdx > 0) && ((this->boxObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_BOX)) > 0) && - Object_IsLoaded(&play->objectCtx, this->boxObjIdx)) { - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->boxObjIdx].segment); + if ((this->boxObjectSlot > 0) && ((this->boxObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_BOX)) > 0) && + Object_IsLoaded(&play->objectCtx, this->boxObjectSlot)) { + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->boxObjectSlot].segment); gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); Matrix_Put(&mtx); Matrix_Translate(147.0f, -245.0f, -453.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h index e42c23a43..8d4323e63 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h @@ -11,9 +11,9 @@ typedef void (*BgMoriHineriActionFunc)(struct BgMoriHineri*, PlayState*); typedef struct BgMoriHineri { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgMoriHineriActionFunc actionFunc; - /* 0x0168 */ s8 moriHineriObjIdx; - /* 0x0169 */ s8 moriTexObjIdx; - /* 0x016A */ s8 boxObjIdx; + /* 0x0168 */ s8 moriHineriObjectSlot; + /* 0x0169 */ s8 moriTexObjectSlot; + /* 0x016A */ s8 boxObjectSlot; /* 0x016B */ s8 switchFlag; } BgMoriHineri; // size = 0x016C diff --git a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c index ea2254170..40735aab0 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c +++ b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c @@ -66,8 +66,8 @@ void BgMoriIdomizu_Init(Actor* thisx, PlayState* play) { this->actor.world.pos.y = 184.0f; BgMoriIdomizu_SetWaterLevel(play, 184); } - this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); - if (this->moriTexObjIndex < 0) { + this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); + if (this->moriTexObjectSlot < 0) { Actor_Kill(&this->actor); // "Bank danger!" osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", this->actor.params, "../z_bg_mori_idomizu.c", @@ -96,7 +96,7 @@ void BgMoriIdomizu_SetupWaitForMoriTex(BgMoriIdomizu* this) { } void BgMoriIdomizu_WaitForMoriTex(BgMoriIdomizu* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) { BgMoriIdomizu_SetupMain(this); this->actor.draw = BgMoriIdomizu_Draw; } @@ -169,7 +169,7 @@ void BgMoriIdomizu_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_idomizu.c", 360), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_XLU_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_XLU_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 128); diff --git a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h index d2e6f173a..3e7036ec4 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h +++ b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h @@ -15,7 +15,7 @@ typedef struct BgMoriIdomizu { /* 0x0154 */ s32 prevSwitchFlagSet; /* 0x0158 */ s16 isLoaded; /* 0x015A */ s16 drainTimer; - /* 0x015C */ s8 moriTexObjIndex; + /* 0x015C */ s8 moriTexObjectSlot; } BgMoriIdomizu; // size = 0x0160 #endif diff --git a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c index 07276e6e6..c3c4c391c 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c +++ b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c @@ -56,8 +56,8 @@ void BgMoriKaitenkabe_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gMoriKaitenkabeCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); - if (this->moriTexObjIndex < 0) { + this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); + if (this->moriTexObjectSlot < 0) { Actor_Kill(&this->dyna.actor); // "【Rotating wall】 Bank danger!" osSyncPrintf("【回転壁】 バンク危険!(%s %d)\n", "../z_bg_mori_kaitenkabe.c", 176); @@ -74,7 +74,7 @@ void BgMoriKaitenkabe_Destroy(Actor* thisx, PlayState* play) { } void BgMoriKaitenkabe_WaitForMoriTex(BgMoriKaitenkabe* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) { BgMoriKaitenkabe_SetupWait(this); this->dyna.actor.draw = BgMoriKaitenkabe_Draw; } @@ -163,7 +163,7 @@ void BgMoriKaitenkabe_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_kaitenkabe.c", 347); Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_kaitenkabe.c", 352), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h index 05272c6f2..7bd6939d3 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h +++ b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h @@ -16,7 +16,7 @@ typedef struct BgMoriKaitenkabe { /* 0x0170 */ f32 rotSpeed; /* 0x0174 */ f32 rotYdeg; /* 0x0178 */ Vec3f lockedPlayerPos; - /* 0x0184 */ s8 moriTexObjIndex; + /* 0x0184 */ s8 moriTexObjectSlot; } BgMoriKaitenkabe; // size = 0x0188 #endif diff --git a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c index 1ec1cc9a5..f737bdfbc 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c @@ -64,8 +64,8 @@ void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play) { // "The set Angle has changed. Let's fix the program." osSyncPrintf("Warning : セット Angle が変更されています。プログラムを修正しましょう。\n"); } - this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); - if (this->moriTexObjIndex < 0) { + this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); + if (this->moriTexObjectSlot < 0) { // "Forest Temple obj Falling Ceiling Bank Danger!" osSyncPrintf("Error : 森の神殿 obj 落下天井 バンク危険!(%s %d)\n", "../z_bg_mori_rakkatenjo.c", 205); Actor_Kill(&this->dyna.actor); @@ -102,7 +102,7 @@ void BgMoriRakkatenjo_SetupWaitForMoriTex(BgMoriRakkatenjo* this) { } void BgMoriRakkatenjo_WaitForMoriTex(BgMoriRakkatenjo* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) { BgMoriRakkatenjo_SetupWait(this); this->dyna.actor.draw = BgMoriRakkatenjo_Draw; } @@ -226,7 +226,7 @@ void BgMoriRakkatenjo_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_rakkatenjo.c", 497); Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_rakkatenjo.c", 502), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h index b263892f0..97bdbc0bf 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h +++ b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h @@ -14,7 +14,7 @@ typedef struct BgMoriRakkatenjo { /* 0x0168 */ s32 timer; /* 0x016C */ s32 bounceCount; /* 0x0170 */ s32 fallCount; - /* 0x0174 */ s8 moriTexObjIndex; + /* 0x0174 */ s8 moriTexObjectSlot; } BgMoriRakkatenjo; // size = 0x0178 #endif diff --git a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c index 4fec9780c..4b723b551 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c @@ -59,8 +59,8 @@ void BgSpot01Objects2_Init(Actor* thisx, PlayState* play) { } if (this->objectId >= 0) { - this->objBankIndex = Object_GetIndex(&play->objectCtx, this->objectId); - if (this->objBankIndex < 0) { + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, this->objectId); + if (this->requiredObjectSlot < 0) { // "There was no bank setting." osSyncPrintf("-----------------------------バンク設定ありませんでした."); Actor_Kill(&this->dyna.actor); @@ -91,12 +91,12 @@ void func_808AC2BC(BgSpot01Objects2* this, PlayState* play) { s32 pad; Vec3f position; - if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { // "---- Successful bank switching!!" osSyncPrintf("-----バンク切り換え成功!!\n"); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); - this->dyna.actor.objBankIndex = this->objBankIndex; + this->dyna.actor.objectSlot = this->requiredObjectSlot; DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); switch (this->dyna.actor.params & 7) { diff --git a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h index 1da5f4f3f..d1d96d045 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h +++ b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h @@ -13,7 +13,7 @@ typedef struct BgSpot01Objects2 { /* 0x0164 */ BgSpot01Objects2ActionFunc actionFunc; /* 0x0168 */ char unk_168[0x10]; /* 0x0178 */ s32 objectId; - /* 0x017C */ s8 objBankIndex; + /* 0x017C */ s8 requiredObjectSlot; } BgSpot01Objects2; // size = 0x0180 #endif diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index 10d105999..5064684c3 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -218,9 +218,9 @@ s32 func_808B4E58(BgSpot16Bombstone* this, PlayState* play) { actor->shape.rot.z = D_808B5DD8[actor->params][9]; this->dList = object_bombiwa_DL_0009E0; - this->bombiwaBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_BOMBIWA); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_BOMBIWA); - if (this->bombiwaBankIndex < 0) { + if (this->requiredObjectSlot < 0) { osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", actor->params, "../z_bg_spot16_bombstone.c", 589); return false; @@ -486,7 +486,7 @@ void func_808B5AF0(BgSpot16Bombstone* this) { } void func_808B5B04(BgSpot16Bombstone* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->bombiwaBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { func_808B5B58(this); this->actor.draw = BgSpot16Bombstone_Draw; } @@ -546,7 +546,7 @@ void BgSpot16Bombstone_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_OPA_DISP++, this->dList); } else { // The boulder is debris - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->bombiwaBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->requiredObjectSlot].segment); gSPDisplayList(POLY_OPA_DISP++, this->dList); } diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h index 499b01031..01fb4cc3e 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h @@ -22,7 +22,7 @@ typedef struct BgSpot16Bombstone { /* 0x01C4 */ ColliderCylinder colliderCylinder; /* 0x0210 */ s16 unk_210; /* 0x0212 */ s16 unk_212; - /* 0x0214 */ s8 bombiwaBankIndex; + /* 0x0214 */ s8 requiredObjectSlot; } BgSpot16Bombstone; // size = 0x0218 #endif diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 32c4cbd2c..b9d7cb617 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -321,8 +321,8 @@ void BossGanon_SetColliderPos(Vec3f* pos, ColliderCylinder* collider) { } void BossGanon_SetAnimationObject(BossGanon* this, PlayState* play, s32 objectId) { - this->animBankIndex = Object_GetIndex(&play->objectCtx, objectId); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment); + this->animObjectSlot = Object_GetSlot(&play->objectCtx, objectId); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); } static InitChainEntry sInitChain[] = { @@ -474,18 +474,18 @@ void BossGanon_Destroy(Actor* thisx, PlayState* play) { void BossGanon_SetupIntroCutscene(BossGanon* this, PlayState* play) { s32 pad; - s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2); + s32 animObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON_ANIME2); - if (animBankIndex < 0) { + if (animObjectSlot < 0) { Actor_Kill(&this->actor); return; } - if (Object_IsLoaded(&play->objectCtx, animBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, animObjectSlot)) { this->actionFunc = BossGanon_IntroCutscene; this->unk_198 = 1; - this->animBankIndex = animBankIndex; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment); + this->animObjectSlot = animObjectSlot; + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); Animation_MorphToLoop(&this->skelAnime, &gGanondorfPlayOrganAnim, 0.0f); } else { this->actionFunc = BossGanon_SetupIntroCutscene; @@ -533,7 +533,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { f32 cos; Camera* mainCam; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); sCape->backPush = -2.0f; sCape->backSwayMagnitude = 0.25f; @@ -1079,8 +1079,8 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { } if (this->csTimer == 50) { - gSegments[6] = VIRTUAL_TO_PHYSICAL( - play->objectCtx.status[Object_GetIndex(&play->objectCtx, OBJECT_GANON)].segment); + gSegments[6] = + VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[Object_GetSlot(&play->objectCtx, OBJECT_GANON)].segment); if (!GET_EVENTCHKINF(EVENTCHKINF_78)) { TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gGanondorfTitleCardTex), @@ -1163,14 +1163,14 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { void BossGanon_SetupDeathCutscene(BossGanon* this, PlayState* play) { s32 pad; - s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2); + s32 animObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON_ANIME2); - if (Object_IsLoaded(&play->objectCtx, animBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, animObjectSlot)) { this->actionFunc = BossGanon_DeathAndTowerCutscene; this->csTimer = this->csState = 0; this->unk_198 = 1; - this->animBankIndex = animBankIndex; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment); + this->animObjectSlot = animObjectSlot; + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfDefeatedStartAnim, 0.0f); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfDefeatedStartAnim); this->unk_508 = 0.0f; @@ -1179,11 +1179,11 @@ void BossGanon_SetupDeathCutscene(BossGanon* this, PlayState* play) { void BossGanon_SetupTowerCutscene(BossGanon* this, PlayState* play) { s32 pad; - s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2); + s32 animObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON_ANIME2); - if (Object_IsLoaded(&play->objectCtx, animBankIndex)) { - this->animBankIndex = animBankIndex; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment); + if (Object_IsLoaded(&play->objectCtx, animObjectSlot)) { + this->animObjectSlot = animObjectSlot; + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfDefeatedStartAnim, 0.0f); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfDefeatedStartAnim); this->actionFunc = BossGanon_DeathAndTowerCutscene; @@ -1226,7 +1226,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { Camera* mainCam; Vec3f sp64; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); this->csTimer++; SkelAnime_Update(&this->skelAnime); @@ -2796,7 +2796,7 @@ void BossGanon_Update(Actor* thisx, PlayState* play2) { if ((this->actionFunc != BossGanon_IntroCutscene) && (this->actionFunc != BossGanon_DeathAndTowerCutscene)) { BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); } else { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); } if (this->windowShatterState != GDF_WINDOW_SHATTER_OFF) { diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h index c1db63792..85bbc27f1 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h @@ -85,7 +85,7 @@ typedef enum { typedef struct BossGanon { /* 0x0000 */ Actor actor; - /* 0x014C */ s32 animBankIndex; + /* 0x014C */ s32 animObjectSlot; /* 0x0150 */ SkelAnime skelAnime; /* 0x0194 */ BossGanonActionFunc actionFunc; /* 0x0198 */ u8 unk_198; diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 04c71324a..4189fffdb 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -78,15 +78,15 @@ void func_808FD080(s32 idx, ColliderJntSph* collider, Vec3f* arg2) { void BossGanon2_SetObjectSegment(BossGanon2* this, PlayState* play, s32 objectId, u8 setRSPSegment) { s32 pad; - s32 objectIdx = Object_GetIndex(&play->objectCtx, objectId); + s32 objectSlot = Object_GetSlot(&play->objectCtx, objectId); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIdx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); if (setRSPSegment) { OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 790); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objectIdx].segment); - gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[objectIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment); + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment); CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 799); } @@ -183,7 +183,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { s16 pad; u8 sp8D; Player* player; - s32 objectIdx; + s32 objectSlot; s32 zero = 0; s32 pad2; @@ -193,8 +193,8 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { switch (this->unk_39C) { case 0: - objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME3); - if (Object_IsLoaded(&play->objectCtx, objectIdx)) { + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON_ANIME3); + if (Object_IsLoaded(&play->objectCtx, objectSlot)) { Cutscene_StartManual(play, &play->csCtx); func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); this->subCamId = Play_CreateSubCamera(play); @@ -1040,10 +1040,10 @@ void func_808FFCFC(BossGanon2* this, PlayState* play) { void func_808FFDB0(BossGanon2* this, PlayState* play) { s32 sp28; - s32 objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GANON2); + s32 objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON2); - if (Object_IsLoaded(&play->objectCtx, objectIdx)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIdx].segment); + if (Object_IsLoaded(&play->objectCtx, objectSlot)) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); Animation_MorphToLoop(&this->skelAnime, &gGanonGuardIdleAnim, -10.0f); this->actionFunc = func_808FFEBC; diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index 463c45a73..106e44a15 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -2083,7 +2083,7 @@ void BossGoma_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r sDeadLimbLifetime[limbIndex] + 100); if (babyGohma != NULL) { babyGohma->bossLimbDL = *dList; - babyGohma->actor.objBankIndex = this->actor.objBankIndex; + babyGohma->actor.objectSlot = this->actor.objectSlot; } } diff --git a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index 7bc4fee6a..83f03c30e 100644 --- a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -17,7 +17,7 @@ void Demo6K_Init(Actor* thisx, PlayState* play); void Demo6K_Destroy(Actor* thisx, PlayState* play); void Demo6K_Update(Actor* thisx, PlayState* play); -void func_80966DB0(Demo6K* this, PlayState* play); +void Demo6K_WaitForObject(Demo6K* this, PlayState* play); void func_80966E04(Demo6K* this, PlayState* play); void func_80966E98(Demo6K* this, PlayState* play); void func_80966F84(Demo6K* this, PlayState* play); @@ -69,26 +69,26 @@ void Demo6K_Init(Actor* thisx, PlayState* play) { Demo6K* this = (Demo6K*)thisx; s32 pad; s32 params = this->actor.params; - s32 objBankIndex; + s32 objectSlot; s32 i; osSyncPrintf("no = %d\n", params); if (sObjectIds[params] != OBJECT_GAMEPLAY_KEEP) { - objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[params]); + objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[params]); } else { - objBankIndex = 0; + objectSlot = 0; } - osSyncPrintf("bank_ID = %d\n", objBankIndex); + osSyncPrintf("bank_ID = %d\n", objectSlot); - if (objBankIndex < 0) { + if (objectSlot < 0) { ASSERT(0, "0", "../z_demo_6k.c", 334); } else { - this->objBankIndex = objBankIndex; + this->requiredObjectSlot = objectSlot; } - Demo6K_SetupAction(this, func_80966DB0); + Demo6K_SetupAction(this, Demo6K_WaitForObject); this->timer1 = 0; this->flags = 0; this->timer2 = 0; @@ -197,9 +197,9 @@ void Demo6K_Destroy(Actor* thisx, PlayState* play) { LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -void func_80966DB0(Demo6K* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { - this->actor.objBankIndex = this->objBankIndex; +void Demo6K_WaitForObject(Demo6K* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { + this->actor.objectSlot = this->requiredObjectSlot; this->actor.draw = this->drawFunc; this->actionFunc = this->initActionFunc; } diff --git a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h index 5d6a5367a..09d9c175f 100644 --- a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h +++ b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h @@ -27,7 +27,7 @@ typedef struct Demo6K { /* 0x028C */ u16 flags; /* 0x028E */ u16 timer1; /* 0x0290 */ u16 timer2; - /* 0x0292 */ u8 objBankIndex; + /* 0x0292 */ u8 requiredObjectSlot; /* 0x0293 */ u8 unk_293; } Demo6K; // size = 0x0294 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 176ea5615..fd63ace9f 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -314,22 +314,22 @@ void DemoEc_DrawSkeletonCustomColor(DemoEc* this, PlayState* play, Gfx* arg2, Gf void DemoEc_UseDrawObject(DemoEc* this, PlayState* play) { s32 pad[2]; - s32 drawObjBankIndex = this->drawObjBankIndex; + s32 drawObjectSlot = this->drawObjectSlot; GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_demo_ec.c", 662); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[drawObjBankIndex].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[drawObjBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[drawObjectSlot].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[drawObjectSlot].segment); if (!play) {} CLOSE_DISPS(gfxCtx, "../z_demo_ec.c", 670); } void DemoEc_UseAnimationObject(DemoEc* this, PlayState* play) { - s32 animObjBankIndex = this->animObjBankIndex; + s32 animObjectSlot = this->animObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animObjBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); } CsCmdActorCue* DemoEc_GetCue(PlayState* play, s32 cueChannel) { @@ -1261,26 +1261,27 @@ void DemoEc_InitCommon(DemoEc* this, PlayState* play) { s32 type; s16 pad2; s16 sp28; - s32 primaryBankIndex; - s32 secondaryBankIndex; + s32 primaryObjectSlot; + s32 secondaryObjectSlot; type = this->actor.params; primary = sDrawObjects[type]; sp28 = sAnimationObjects[type]; - primaryBankIndex = Object_GetIndex(&play->objectCtx, primary); - secondaryBankIndex = Object_GetIndex(&play->objectCtx, sp28); + primaryObjectSlot = Object_GetSlot(&play->objectCtx, primary); + secondaryObjectSlot = Object_GetSlot(&play->objectCtx, sp28); - if ((secondaryBankIndex < 0) || (primaryBankIndex < 0)) { + if ((secondaryObjectSlot < 0) || (primaryObjectSlot < 0)) { // "Demo_Ec_main_bank: Bank unreadable arg_data = %d!" osSyncPrintf(VT_FGCOL(RED) "Demo_Ec_main_bank:バンクを読めない arg_data = %d!\n" VT_RST, type); Actor_Kill(&this->actor); return; } - if (Object_IsLoaded(&play->objectCtx, primaryBankIndex) && Object_IsLoaded(&play->objectCtx, secondaryBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, primaryObjectSlot) && + Object_IsLoaded(&play->objectCtx, secondaryObjectSlot)) { - this->drawObjBankIndex = primaryBankIndex; - this->animObjBankIndex = secondaryBankIndex; + this->drawObjectSlot = primaryObjectSlot; + this->animObjectSlot = secondaryObjectSlot; DemoEc_InitNpc(this, play); } diff --git a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h index a93a8589a..fe7148350 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h @@ -18,8 +18,8 @@ typedef struct DemoEc { /* 0x0194 */ s32 updateMode; /* 0x0198 */ s32 drawConfig; /* 0x019C */ s32 cueId; - /* 0x01A0 */ s32 drawObjBankIndex; - /* 0x01A4 */ s32 animObjBankIndex; + /* 0x01A0 */ s32 drawObjectSlot; + /* 0x01A4 */ s32 animObjectSlot; } DemoEc; // size = 0x01A8 #endif diff --git a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c index 7b6a93278..3456f28f1 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -28,7 +28,7 @@ void DemoEffect_DrawLightEffect(Actor* thisx, PlayState* play); void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play); void DemoEffect_DrawJewel(Actor* thisx, PlayState* play2); -void DemoEffect_Wait(DemoEffect* this, PlayState* play); +void DemoEffect_WaitForObject(DemoEffect* this, PlayState* play); void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play); void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, PlayState* play); void DemoEffect_InitCreationFireball(DemoEffect* this, PlayState* play); @@ -166,7 +166,7 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) { DemoEffect* this = (DemoEffect*)thisx; s32 effectType; s32 lightEffect; - s32 objectIndex; + s32 objectSlot; DemoEffect* crystalLight; DemoEffect* lightRing; @@ -175,16 +175,16 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) { osSyncPrintf(VT_FGCOL(CYAN) " no = %d\n" VT_RST, effectType); - objectIndex = sEffectTypeObjects[effectType] == OBJECT_GAMEPLAY_KEEP - ? 0 - : Object_GetIndex(&play->objectCtx, sEffectTypeObjects[effectType]); + objectSlot = sEffectTypeObjects[effectType] == OBJECT_GAMEPLAY_KEEP + ? 0 + : Object_GetSlot(&play->objectCtx, sEffectTypeObjects[effectType]); - osSyncPrintf(VT_FGCOL(CYAN) " bank_ID = %d\n" VT_RST, objectIndex); + osSyncPrintf(VT_FGCOL(CYAN) " bank_ID = %d\n" VT_RST, objectSlot); - if (objectIndex < 0) { + if (objectSlot < 0) { ASSERT(0, "0", "../z_demo_effect.c", 723); } else { - this->initObjectBankIndex = objectIndex; + this->requiredObjectSlot = objectSlot; } this->effectFlags = 0; @@ -499,7 +499,7 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) { } ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); - DemoEffect_SetupUpdate(this, DemoEffect_Wait); + DemoEffect_SetupUpdate(this, DemoEffect_WaitForObject); } void DemoEffect_Destroy(Actor* thisx, PlayState* play) { @@ -518,9 +518,9 @@ void DemoEffect_Destroy(Actor* thisx, PlayState* play) { * They are copied to actor.draw and updateFunc. * initUpdateFunc/initDrawFunc are set during initialization and are NOT executed. */ -void DemoEffect_Wait(DemoEffect* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->initObjectBankIndex)) { - this->actor.objBankIndex = this->initObjectBankIndex; +void DemoEffect_WaitForObject(DemoEffect* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { + this->actor.objectSlot = this->requiredObjectSlot; this->actor.draw = this->initDrawFunc; this->updateFunc = this->initUpdateFunc; diff --git a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h index 8dea6944c..2e7263e58 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h @@ -79,7 +79,7 @@ typedef struct { typedef struct DemoEffect { /* 0x0000 */ Actor actor; /* 0x014C */ SkelCurve skelCurve; - /* 0x016C */ u8 initObjectBankIndex; + /* 0x016C */ u8 requiredObjectSlot; /* 0x0170 */ Gfx* jewelDisplayList; /* 0x0174 */ Gfx* jewelHolderDisplayList; /* 0x0178 */ u8 primXluColor[3]; diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c index 6bfc52a26..6ce5d38ab 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c @@ -23,7 +23,7 @@ void func_80978308(DemoGeff* this, PlayState* play); void func_809784D4(DemoGeff* this, PlayState* play); void func_80978344(DemoGeff* this, PlayState* play); -static s16 sObjectIDs[] = { +static s16 sObjectIds[] = { OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, }; @@ -86,13 +86,13 @@ void func_80977EA8(PlayState* play, Gfx* dlist) { void func_80977F80(DemoGeff* this, PlayState* play) { s32 pad[2]; - s32 objBankIndex = this->objBankIndex; + s32 objectSlot = this->objectSlot; GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_demo_geff.c", 204); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objBankIndex].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); // Necessary to match if (!play) {} @@ -188,17 +188,17 @@ void func_809783D4(DemoGeff* this, PlayState* play) { ObjectContext* objCtx = &play->objectCtx; Actor* thisx = &this->actor; s32 params = thisx->params; - s16 objectId = sObjectIDs[params]; - s32 objBankIndex = Object_GetIndex(objCtx, objectId); + s16 objectId = sObjectIds[params]; + s32 objectSlot = Object_GetSlot(objCtx, objectId); s32 pad; - if (objBankIndex < 0) { + if (objectSlot < 0) { osSyncPrintf(VT_FGCOL(RED) "Demo_Geff_main_bank:バンクを読めない arg_data = %d!\n" VT_RST, params); Actor_Kill(thisx); return; } - if (Object_IsLoaded(objCtx, objBankIndex)) { - this->objBankIndex = objBankIndex; + if (Object_IsLoaded(objCtx, objectSlot)) { + this->objectSlot = objectSlot; func_80978370(this, play); } } diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h index a21eb64a2..ca719594a 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h @@ -16,7 +16,7 @@ typedef struct DemoGeff { /* 0x0000 */ Actor actor; /* 0x014C */ s32 action; /* 0x0150 */ s32 drawConfig; - /* 0x0154 */ s32 objBankIndex; + /* 0x0154 */ s32 objectSlot; /* 0x0158 */ DemoGt* demoGt; /* 0x015C */ f32 deltaPosX; /* 0x0160 */ f32 deltaPosY; diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index e677fd350..7d392ba0a 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -52,7 +52,7 @@ ActorInit Demo_Kankyo_InitVars = { (ActorFunc)DemoKankyo_Draw, }; -static s16 sObjIds[] = { +static s16 sObjectIds[] = { OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD, OBJECT_GAMEPLAY_KEEP, OBJECT_GI_MELODY, OBJECT_GI_MELODY, OBJECT_GI_MELODY, OBJECT_GI_MELODY, OBJECT_GI_MELODY, OBJECT_TOKI_OBJECTS, OBJECT_TOKI_OBJECTS, @@ -181,13 +181,13 @@ void DemoKankyo_SetupAction(DemoKankyo* this, DemoKankyoActionFunc actionFunc) { void DemoKankyo_Init(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; s16 i; - s32 objBankIndex = Object_GetIndex(&play->objectCtx, sObjIds[this->actor.params]); + s32 objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[this->actor.params]); - osSyncPrintf("bank_ID = %d\n", objBankIndex); - if (objBankIndex < 0) { + osSyncPrintf("bank_ID = %d\n", objectSlot); + if (objectSlot < 0) { ASSERT(0, "0", "../z_demo_kankyo.c", 521); } else { - this->objBankIndex = objBankIndex; + this->requiredObjectSlot = objectSlot; } switch (this->actor.params) { @@ -279,7 +279,7 @@ void DemoKankyo_SetupType(DemoKankyo* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 temp; - if (this->actor.objBankIndex == this->objBankIndex) { + if (this->actor.objectSlot == this->requiredObjectSlot) { switch (this->actor.params) { case DEMOKANKYO_ROCK_1: case DEMOKANKYO_ROCK_2: @@ -432,7 +432,7 @@ void DemoKankyo_Update(Actor* thisx, PlayState* play) { void DemoKankyo_Draw(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; - if (this->actor.objBankIndex == this->objBankIndex) { + if (this->actor.objectSlot == this->requiredObjectSlot) { switch (this->actor.params) { case DEMOKANKYO_BLUE_RAIN: case DEMOKANKYO_BLUE_RAIN_2: @@ -480,8 +480,8 @@ void DemoKankyo_Draw(Actor* thisx, PlayState* play) { break; } } - if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { - this->actor.objBankIndex = this->objBankIndex; + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { + this->actor.objectSlot = this->requiredObjectSlot; } } diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h index 89ad474b3..0103812c6 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h @@ -42,7 +42,7 @@ typedef struct { typedef struct DemoKankyo { /* 0x0000 */ Actor actor; - /* 0x014C */ u8 objBankIndex; + /* 0x014C */ u8 requiredObjectSlot; /* 0x014D */ u8 sparkleCounter; /* 0x014E */ u8 warpTimer; /* 0x0150 */ DemoKankyoUnk150 unk_150[30]; diff --git a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c index bff036cc7..9e4225ea9 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c @@ -25,7 +25,7 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2); void DoorKiller_Destroy(Actor* thisx, PlayState* play); void DoorKiller_Update(Actor* thisx, PlayState* play); void DoorKiller_Wait(DoorKiller* this, PlayState* play); -void DoorKiller_SetProperties(DoorKiller* this, PlayState* play); +void DoorKiller_WaitForObject(DoorKiller* this, PlayState* play); void DoorKiller_DrawDoor(Actor* thisx, PlayState* play); void DoorKiller_DrawRubble(Actor* thisx, PlayState* play); @@ -99,18 +99,19 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; f32 randF; DoorKiller* this = (DoorKiller*)thisx; - s32 bankIndex; + s32 objectSlot; s32 i; // Look in the object bank for one of the four objects containing door textures - bankIndex = -1; - for (i = 0; bankIndex < 0; i++) { - bankIndex = Object_GetIndex(&play->objectCtx, sDoorTextures[i].objectId); + objectSlot = -1; + //! @bug If no objectSlot is found, `sDoorTextures` will be read out of bounds + for (i = 0; objectSlot < 0; i++) { + objectSlot = Object_GetSlot(&play->objectCtx, sDoorTextures[i].objectId); this->textureEntryIndex = i; } - osSyncPrintf("bank_ID = %d\n", bankIndex); + osSyncPrintf("bank_ID = %d\n", objectSlot); osSyncPrintf("status = %d\n", this->textureEntryIndex); - this->doorObjBankIndex = bankIndex; + this->requiredObjectSlot = objectSlot; this->texture = sDoorTextures[this->textureEntryIndex].texture; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); @@ -126,8 +127,8 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) { // play any animations it does not cause problems, but it would need to be changed otherwise. SkelAnime_InitFlex(play, &this->skelAnime, &object_door_killer_Skel_001BC8, NULL, this->jointTable, this->jointTable, 9); - this->actionFunc = DoorKiller_SetProperties; - DoorKiller_SetProperties(this, play); + this->actionFunc = DoorKiller_WaitForObject; + DoorKiller_WaitForObject(this, play); // manually set the overall rotation of the door this->jointTable[1].x = this->jointTable[1].z = 0x4000; @@ -152,8 +153,8 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) { case DOOR_KILLER_RUBBLE_PIECE_2: case DOOR_KILLER_RUBBLE_PIECE_3: case DOOR_KILLER_RUBBLE_PIECE_4: - this->actionFunc = DoorKiller_SetProperties; - DoorKiller_SetProperties(this, play); + this->actionFunc = DoorKiller_WaitForObject; + DoorKiller_WaitForObject(this, play); this->actor.gravity = -0.6f; this->actor.minVelocityY = -6.0f; @@ -459,17 +460,17 @@ void DoorKiller_Wait(DoorKiller* this, PlayState* play) { void DoorKiller_UpdateTexture(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->doorObjBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); this->texture = SEGMENTED_TO_VIRTUAL(this->texture); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[thisx->objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); } /** * Gets the correct door texture, defines the appropriate draw fucntion and action function based on type behaviour * (door or rubble). */ -void DoorKiller_SetProperties(DoorKiller* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->doorObjBankIndex)) { +void DoorKiller_WaitForObject(DoorKiller* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { DoorKiller_UpdateTexture(&this->actor, play); switch (this->actor.params & 0xFF) { case DOOR_KILLER_DOOR: diff --git a/src/overlays/actors/ovl_Door_Killer/z_door_killer.h b/src/overlays/actors/ovl_Door_Killer/z_door_killer.h index 37865805e..1b3256450 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.h +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.h @@ -25,7 +25,7 @@ typedef struct DoorKiller { /* 0x0214 */ void* texture; /* 0x0218 */ u16 hasHitPlayerOrGround; /* 0x021A */ u16 timer; - /* 0x021C */ u8 doorObjBankIndex; + /* 0x021C */ u8 requiredObjectSlot; /* 0x021D */ u8 textureEntryIndex; /* 0x0220 */ ColliderJntSph colliderJntSph; /* 0x0240 */ ColliderJntSphElement colliderJntSphItems[1]; diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 750480a5e..8cbe2cd2e 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -402,7 +402,7 @@ void DoorShutter_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; s32 styleType; s32 pad; - s32 objectIndex; + s32 objectSlot; s32 i; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -432,9 +432,8 @@ void DoorShutter_Init(Actor* thisx, PlayState* play2) { } else { // DOORSHUTTER_STYLE_PHANTOM_GANON, DOORSHUTTER_STYLE_GOHMA_BLOCK this->dyna.actor.room = -1; } - - if (this->requiredObjBankIndex = objectIndex = Object_GetIndex(&play->objectCtx, sStyleInfo[styleType].objectId), - (s8)objectIndex < 0) { + if (this->requiredObjectSlot = objectSlot = Object_GetSlot(&play->objectCtx, sStyleInfo[styleType].objectId), + (s8)objectSlot < 0) { Actor_Kill(&this->dyna.actor); return; } @@ -468,8 +467,8 @@ void DoorShutter_Destroy(Actor* thisx, PlayState* play) { } void DoorShutter_WaitForObject(DoorShutter* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { - this->dyna.actor.objBankIndex = this->requiredObjBankIndex; + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { + this->dyna.actor.objectSlot = this->requiredObjectSlot; if (this->doorType == SHUTTER_PG_BARS || this->doorType == SHUTTER_GOHMA_BLOCK) { // Init dynapoly for shutters of the type that uses it CollisionHeader* colHeader = NULL; @@ -977,7 +976,7 @@ void DoorShutter_Draw(Actor* thisx, PlayState* play) { DoorShutter* this = (DoorShutter*)thisx; //! @bug This actor is not fully initialized until the required object dependency is loaded. - //! In most cases, the check for objBankIndex to equal requiredObjBankIndex prevents the actor + //! In most cases, the check for objectSlot to equal requiredObjectSlot prevents the actor //! from drawing until initialization is complete. However if the required object is the same as the //! object dependency listed in init vars (gameplay_keep in this case), the check will pass even though //! initialization has not completed. When this happens, it will try to draw the display list of the @@ -988,7 +987,7 @@ void DoorShutter_Draw(Actor* thisx, PlayState* play) { //! The best way to fix this issue (and what was done in Majora's Mask) is to null out the draw function in //! the init vars for the actor, and only set draw after initialization is complete. - if (this->dyna.actor.objBankIndex == this->requiredObjBankIndex && + if (this->dyna.actor.objectSlot == this->requiredObjectSlot && (this->styleType == DOORSHUTTER_STYLE_PHANTOM_GANON || DoorShutter_ShouldDraw(this, play))) { s32 pad[2]; DoorShutterGfxInfo* gfxInfo = &sGfxInfo[this->gfxType]; diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h index 4dd268ea8..3eb39148c 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h @@ -48,7 +48,7 @@ typedef struct DoorShutter { /* 0x016A */ u8 doorType; /* 0x016B */ u8 styleType; /* 0x016C */ u8 gfxType; - /* 0x016D */ s8 requiredObjBankIndex; + /* 0x016D */ s8 requiredObjectSlot; /* 0x016E */ s8 unlockTimer; // non-0 if the door is locked, ticks down while the door is unlocking /* 0x016F */ s8 actionTimer; /* 0x0170 */ f32 barsClosedAmount; // Ranges from 0.0f (unbarred) to 1.0f (barred) diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index b7bafb238..c431e53e6 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -1267,7 +1267,7 @@ void EnBb_Update(Actor* thisx, PlayState* play2) { void EnBb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnBb* this = (EnBb*)thisx; - BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 4, 15, 15, dList, BODYBREAK_OBJECT_DEFAULT); + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 4, 15, 15, dList, BODYBREAK_OBJECT_SLOT_DEFAULT); } static Vec3f sFireIceOffsets[] = { diff --git a/src/overlays/actors/ovl_En_Cs/z_en_cs.c b/src/overlays/actors/ovl_En_Cs/z_en_cs.c index 8e5c50068..1268c9446 100644 --- a/src/overlays/actors/ovl_En_Cs/z_en_cs.c +++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.c @@ -470,18 +470,18 @@ void EnCs_Draw(Actor* thisx, PlayState* play) { EnCs_OverrideLimbDraw, EnCs_PostLimbDraw, &this->actor); if (GET_ITEMGETINF(ITEMGETINF_3A)) { - s32 childLinkObjectIndex = Object_GetIndex(&play->objectCtx, OBJECT_LINK_CHILD); + s32 linkChildObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_LINK_CHILD); // Handle attaching the Spooky Mask to the boy's face - if (childLinkObjectIndex >= 0) { + if (linkChildObjectSlot >= 0) { Mtx* mtx; Matrix_Put(&this->spookyMaskMtx); mtx = Matrix_NewMtx(play->state.gfxCtx, "../z_en_cs.c", 1000); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[childLinkObjectIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[linkChildObjectSlot].segment); gSPSegment(POLY_OPA_DISP++, 0x0D, mtx - 7); gSPDisplayList(POLY_OPA_DISP++, gLinkChildSpookyMaskDL); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->actor.objectSlot].segment); } } diff --git a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c index b1ddf0335..2645f0134 100644 --- a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c +++ b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c @@ -124,7 +124,7 @@ void EnDntNomal_Init(Actor* thisx, PlayState* play) { } this->actor.flags &= ~ACTOR_FLAG_0; this->actor.colChkInfo.mass = 0xFF; - this->objId = -1; + this->objectId = -1; if (this->type == ENDNTNOMAL_TARGET) { osSyncPrintf("\n\n"); // "Deku Scrub target" @@ -132,21 +132,21 @@ void EnDntNomal_Init(Actor* thisx, PlayState* play) { Collider_InitQuad(play, &this->targetQuad); Collider_SetQuad(play, &this->targetQuad, &this->actor, &sTargetQuadInit); this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - this->objId = OBJECT_HINTNUTS; + this->objectId = OBJECT_HINTNUTS; } else { osSyncPrintf("\n\n"); // "Deku Scrub mask show audience" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ デグナッツお面品評会一般人 ☆☆☆☆☆ \n" VT_RST); Collider_InitCylinder(play, &this->bodyCyl); Collider_SetCylinder(play, &this->bodyCyl, &this->actor, &sBodyCylinderInit); - this->objId = OBJECT_DNK; + this->objectId = OBJECT_DNK; } - if (this->objId >= 0) { - this->objIndex = Object_GetIndex(&play->objectCtx, this->objId); - if (this->objIndex < 0) { + if (this->objectId >= 0) { + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, this->objectId); + if (this->requiredObjectSlot < 0) { Actor_Kill(&this->actor); // "What?" - osSyncPrintf(VT_FGCOL(MAGENTA) " なにみの? %d\n" VT_RST "\n", this->objIndex); + osSyncPrintf(VT_FGCOL(MAGENTA) " なにみの? %d\n" VT_RST "\n", this->requiredObjectSlot); // "Bank is funny" osSyncPrintf(VT_FGCOL(CYAN) " バンクおかしいしぞ!%d\n" VT_RST "\n", this->actor.params); return; @@ -169,9 +169,9 @@ void EnDntNomal_Destroy(Actor* thisx, PlayState* play) { } void EnDntNomal_WaitForObject(EnDntNomal* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objIndex].segment); - this->actor.objBankIndex = this->objIndex; + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); + this->actor.objectSlot = this->requiredObjectSlot; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); this->actor.gravity = -2.0f; Actor_SetScale(&this->actor, 0.01f); diff --git a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h index 0b5c6f12e..13974bb1b 100644 --- a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h +++ b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h @@ -24,7 +24,7 @@ typedef struct EnDntNomal { /* 0x0260 */ s16 blinkTimer; /* 0x0262 */ s16 unkCounter; /* 0x0264 */ s16 timer3; - /* 0x0266 */ s16 objId; + /* 0x0266 */ s16 objectId; /* 0x0268 */ s16 eyeState; /* 0x026A */ s16 type; /* 0x026C */ s16 hitCounter; @@ -35,7 +35,7 @@ typedef struct EnDntNomal { /* 0x0276 */ u8 ignore; /* 0x0277 */ u8 spawnedItem; /* 0x0278 */ u8 stagePrize; - /* 0x0279 */ s8 objIndex; + /* 0x0279 */ s8 requiredObjectSlot; /* 0x027C */ Vec3f mouthPos; /* 0x0288 */ Vec3f targetPos; /* 0x0294 */ ColliderQuad targetQuad; diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 2f9247262..c3216cdc8 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -111,7 +111,7 @@ void EnDoor_Init(Actor* thisx, PlayState* play2) { EnDoor* this = (EnDoor*)thisx; EnDoorInfo* objectInfo; s32 i; - s32 objBankIndex; + s32 objectSlot; f32 xOffset; f32 zOffset; @@ -124,20 +124,20 @@ void EnDoor_Init(Actor* thisx, PlayState* play2) { break; } } - if (i >= ARRAY_COUNT(sDoorInfo) - 2 && Object_GetIndex(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) >= 0) { + if (i >= ARRAY_COUNT(sDoorInfo) - 2 && Object_GetSlot(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) >= 0) { objectInfo++; } this->dListIndex = objectInfo->dListIndex; - objBankIndex = Object_GetIndex(&play->objectCtx, objectInfo->objectId); - if (objBankIndex < 0) { + objectSlot = Object_GetSlot(&play->objectCtx, objectInfo->objectId); + if (objectSlot < 0) { Actor_Kill(&this->actor); return; } - this->requiredObjBankIndex = objBankIndex; + this->requiredObjectSlot = objectSlot; this->dListIndex = objectInfo->dListIndex; - if (this->actor.objBankIndex == this->requiredObjBankIndex) { + if (this->actor.objectSlot == this->requiredObjectSlot) { EnDoor_SetupType(this, play); } else { this->actionFunc = EnDoor_SetupType; @@ -175,10 +175,10 @@ void EnDoor_Destroy(Actor* thisx, PlayState* play) { void EnDoor_SetupType(EnDoor* this, PlayState* play) { s32 doorType; - if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { doorType = ENDOOR_GET_TYPE(&this->actor); this->actor.flags &= ~ACTOR_FLAG_4; - this->actor.objBankIndex = this->requiredObjBankIndex; + this->actor.objectSlot = this->requiredObjectSlot; this->actionFunc = EnDoor_Idle; if (doorType == DOOR_EVENING) { doorType = (gSaveContext.save.dayTime > CLOCK_TIME(18, 0) && gSaveContext.save.dayTime < CLOCK_TIME(21, 0)) @@ -360,7 +360,7 @@ s32 EnDoor_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* void EnDoor_Draw(Actor* thisx, PlayState* play) { EnDoor* this = (EnDoor*)thisx; - if (this->actor.objBankIndex == this->requiredObjBankIndex) { + if (this->actor.objectSlot == this->requiredObjectSlot) { OPEN_DISPS(play->state.gfxCtx, "../z_en_door.c", 910); Gfx_SetupDL_25Opa(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.h b/src/overlays/actors/ovl_En_Door/z_en_door.h index 05c41e16c..58ff784ee 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.h +++ b/src/overlays/actors/ovl_En_Door/z_en_door.h @@ -49,7 +49,7 @@ typedef void (*EnDoorActionFunc)(struct EnDoor*, PlayState*); typedef struct EnDoor { /* 0x0000 */ DOOR_ACTOR_BASE; /* 0x0192 */ u8 unk_192; - /* 0x0193 */ s8 requiredObjBankIndex; + /* 0x0193 */ s8 requiredObjectSlot; /* 0x0194 */ s8 dListIndex; /* 0x0196 */ s16 lockTimer; /* 0x0198 */ Vec3s jointTable[5]; diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index d8a342d42..432534d3b 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -342,15 +342,15 @@ void EnEncount2_DrawEffects(Actor* thisx, PlayState* play) { EnEncount2Effect* effect = this->effects; GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; - s32 objBankIndex; + s32 objectSlot; OPEN_DISPS(gfxCtx, "../z_en_encount2.c", 642); - objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_EFC_STAR_FIELD); + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_EFC_STAR_FIELD); - if (objBankIndex >= 0) { + if (objectSlot >= 0) { gDPPipeSync(POLY_XLU_DISP++); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment); for (i = 0; i < EN_ENCOUNT2_EFFECT_COUNT; effect++, i++) { if (effect->isAlive) { diff --git a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c index bb0b388f5..349632c02 100644 --- a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c +++ b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c @@ -60,23 +60,23 @@ void EnExItem_Init(Actor* thisx, PlayState* play) { // "What will come out?" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ なにがでるかな? ☆☆☆☆☆ %d\n" VT_RST, this->unusedParam); this->initPos = this->actor.world.pos; - this->getItemObjId = -1; + this->getItemObjectId = -1; switch (this->type) { case EXITEM_BOMB_BAG_BOWLING: case EXITEM_BOMB_BAG_COUNTER: - this->getItemObjId = OBJECT_GI_BOMBPOUCH; + this->getItemObjectId = OBJECT_GI_BOMBPOUCH; break; case EXITEM_HEART_PIECE_BOWLING: case EXITEM_HEART_PIECE_COUNTER: - this->getItemObjId = OBJECT_GI_HEARTS; + this->getItemObjectId = OBJECT_GI_HEARTS; break; case EXITEM_BOMBCHUS_BOWLING: case EXITEM_BOMBCHUS_COUNTER: - this->getItemObjId = OBJECT_GI_BOMB_2; + this->getItemObjectId = OBJECT_GI_BOMB_2; break; case EXITEM_BOMBS_BOWLING: case EXITEM_BOMBS_COUNTER: - this->getItemObjId = OBJECT_GI_BOMB_1; + this->getItemObjectId = OBJECT_GI_BOMB_1; break; case EXITEM_PURPLE_RUPEE_BOWLING: case EXITEM_PURPLE_RUPEE_COUNTER: @@ -85,7 +85,7 @@ void EnExItem_Init(Actor* thisx, PlayState* play) { case EXITEM_RED_RUPEE_CHEST: case EXITEM_13: case EXITEM_14: - this->getItemObjId = OBJECT_GI_RUPY; + this->getItemObjectId = OBJECT_GI_RUPY; break; case EXITEM_SMALL_KEY_CHEST: this->scale = 0.05f; @@ -96,16 +96,16 @@ void EnExItem_Init(Actor* thisx, PlayState* play) { case EXITEM_MAGIC_FIRE: case EXITEM_MAGIC_WIND: case EXITEM_MAGIC_DARK: - this->getItemObjId = OBJECT_GI_GODDESS; + this->getItemObjectId = OBJECT_GI_GODDESS; break; case EXITEM_BULLET_BAG: - this->getItemObjId = OBJECT_GI_DEKUPOUCH; + this->getItemObjectId = OBJECT_GI_DEKUPOUCH; } - if (this->getItemObjId >= 0) { - this->objectIdx = Object_GetIndex(&play->objectCtx, this->getItemObjId); + if (this->getItemObjectId >= 0) { + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, this->getItemObjectId); this->actor.draw = NULL; - if (this->objectIdx < 0) { + if (this->requiredObjectSlot < 0) { Actor_Kill(&this->actor); // "What?" osSyncPrintf("なにみの? %d\n", this->actor.params); @@ -120,14 +120,14 @@ void EnExItem_Init(Actor* thisx, PlayState* play) { void EnExItem_WaitForObject(EnExItem* this, PlayState* play) { s32 onCounter; - if (Object_IsLoaded(&play->objectCtx, this->objectIdx)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { // "End of transfer" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this); osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this); osSyncPrintf(VT_FGCOL(BLUE) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this); osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this); osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n\n" VT_RST, this->actor.params, this); - this->actor.objBankIndex = this->objectIdx; + this->actor.objectSlot = this->requiredObjectSlot; this->actor.draw = EnExItem_Draw; this->stopRotate = false; onCounter = false; diff --git a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h index b8e4d2712..6c6ff404a 100644 --- a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h +++ b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h @@ -12,7 +12,7 @@ typedef void (*EnExItemLightFunc)(Actor*, PlayState*, s32); typedef struct EnExItem { /* 0x0000 */ Actor actor; /* 0x014C */ EnExItemActionFunc actionFunc; - /* 0x0150 */ s16 getItemObjId; + /* 0x0150 */ s16 getItemObjectId; /* 0x0152 */ s16 type; /* 0x0152 */ s16 unusedParam; /* 0x0156 */ s16 giDrawId; @@ -23,7 +23,7 @@ typedef struct EnExItem { /* 0x0160 */ s16 killItem; /* 0x0164 */ f32 scale; /* 0x0168 */ f32 unkFloat; // set to the same value as scale, but unused - /* 0x016C */ s8 objectIdx; + /* 0x016C */ s8 requiredObjectSlot; /* 0x0170 */ Vec3f initPos; // unused /* 0x017C */ EnExItemLightFunc unk_17C; /* 0x0180 */ EnExItemLightFunc unk_180; diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 5958f28a1..d7e4830e4 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -250,8 +250,8 @@ void EnFr_Init(Actor* thisx, PlayState* play) { ASSERT(0, "0", "../z_en_fr.c", 372); } - this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP); - if (this->objBankIndex < 0) { + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP); + if (this->requiredObjectSlot < 0) { Actor_Kill(&this->actor); osSyncPrintf(VT_COL(RED, WHITE)); // "There is no bank!!" @@ -277,7 +277,7 @@ void EnFr_Update(Actor* thisx, PlayState* play) { s32 frogIndex; s32 pad2; - if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { this->actor.flags &= ~ACTOR_FLAG_4; frogIndex = this->actor.params - 1; sEnFrPointers.frogs[frogIndex] = this; diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.h b/src/overlays/actors/ovl_En_Fr/z_en_fr.h index c5425e6b2..530bb8f66 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.h +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.h @@ -39,7 +39,7 @@ typedef struct EnFr { /* 0x0354 */ EnFrActionFunc actionFunc; /* 0x0358 */ LightNode* lightNode; // Frogs light up during the Frog Song, specifically the frog with the next note. /* 0x035C */ LightInfo lightInfo; - /* 0x036A */ s8 objBankIndex; + /* 0x036A */ s8 requiredObjectSlot; /* 0x036C */ s32 jumpCounter; // cyclic clock used to time celebratory frog jumps every 4 frames when child song is played. /* 0x0370 */ s32 blinkTimer; // blinking timer /* 0x0374 */ EnFrBlinkFunc blinkFunc; // unique case of using a function pointer for blinking diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index c50826e47..347f0749a 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -136,12 +136,12 @@ void EnGSwitch_Init(Actor* thisx, PlayState* play) { this->actor.scale.y = 0.45f; this->actor.scale.z = 0.25f; this->collider.info.bumper.dmgFlags = DMG_ARROW; - this->objId = OBJECT_TSUBO; - this->objIndex = Object_GetIndex(&play->objectCtx, this->objId); - if (this->objIndex < 0) { + this->objectId = OBJECT_TSUBO; + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, this->objectId); + if (this->requiredObjectSlot < 0) { Actor_Kill(&this->actor); // "what?" - osSyncPrintf(VT_FGCOL(MAGENTA) " なにみの? %d\n" VT_RST "\n", this->objIndex); + osSyncPrintf(VT_FGCOL(MAGENTA) " なにみの? %d\n" VT_RST "\n", this->requiredObjectSlot); // "bank is funny" osSyncPrintf(VT_FGCOL(CYAN) " バンクおかしいしぞ!%d\n" VT_RST "\n", this->actor.params); } @@ -197,9 +197,9 @@ void EnGSwitch_Break(EnGSwitch* this, PlayState* play) { } void EnGSwitch_WaitForObject(EnGSwitch* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objIndex].segment); - this->actor.objBankIndex = this->objIndex; + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); + this->actor.objectSlot = this->requiredObjectSlot; this->actor.draw = EnGSwitch_DrawPot; this->actionFunc = EnGSwitch_ArcheryPot; } diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h index b79c6e456..3631d1170 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h @@ -46,7 +46,7 @@ typedef struct EnGSwitch { /* 0x0158 */ s16 colorIdx; /* 0x015A */ s16 broken; /* 0x015C */ s16 numEffects; - /* 0x015E */ s16 objId; + /* 0x015E */ s16 objectId; /* 0x0160 */ s16 index; // first or second rupee in two-rupee patterns /* 0x0162 */ s16 delayTimer; // delay between the two blue rupees appearing /* 0x0164 */ s16 waitTimer; // time rupee waits before retreating @@ -54,7 +54,7 @@ typedef struct EnGSwitch { /* 0x0168 */ s16 moveState; // Appear or retreat (for blue rupees and the stationary green one) /* 0x016A */ s16 noteIndex; /* 0x016C */ Vec3f targetPos; - /* 0x0178 */ s8 objIndex; + /* 0x0178 */ s8 requiredObjectSlot; /* 0x017C */ ColliderCylinder collider; /* 0x01C8 */ EnGSwitchEffect effects[EN_GSWITCH_EFFECT_COUNT]; } EnGSwitch; // size = 0x12F8 diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 6dee49a5a..1a93d1a42 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -15,7 +15,7 @@ void EnGirlA_Update(Actor* thisx, PlayState* play); void EnGirlA_SetItemOutOfStock(PlayState* play, EnGirlA* this); void EnGirlA_UpdateStockedItem(PlayState* play, EnGirlA* this); -void EnGirlA_InitializeItemAction(EnGirlA* this, PlayState* play); +void EnGirlA_WaitForObject(EnGirlA* this, PlayState* play); void EnGirlA_Update2(EnGirlA* this, PlayState* play); void func_80A3C498(Actor* thisx, PlayState* play, s32 flags); void EnGirlA_Draw(Actor* thisx, PlayState* play); @@ -387,9 +387,9 @@ void EnGirlA_InitItem(EnGirlA* this, PlayState* play) { return; } - this->objBankIndex = Object_GetIndex(&play->objectCtx, shopItemEntries[params].objID); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, shopItemEntries[params].objID); - if (this->objBankIndex < 0) { + if (this->requiredObjectSlot < 0) { Actor_Kill(&this->actor); osSyncPrintf(VT_COL(RED, WHITE)); osSyncPrintf("バンクが無いよ!!(%s)\n", sShopItemDescriptions[params]); @@ -399,7 +399,7 @@ void EnGirlA_InitItem(EnGirlA* this, PlayState* play) { } this->actor.params = params; - this->actionFunc2 = EnGirlA_InitializeItemAction; + this->actionFunc2 = EnGirlA_WaitForObject; } void EnGirlA_Init(Actor* thisx, PlayState* play) { @@ -976,13 +976,13 @@ s32 EnGirlA_TrySetMaskItemDescription(EnGirlA* this, PlayState* play) { return false; } -void EnGirlA_InitializeItemAction(EnGirlA* this, PlayState* play) { +void EnGirlA_WaitForObject(EnGirlA* this, PlayState* play) { s16 params = this->actor.params; ShopItemEntry* itemEntry = &shopItemEntries[params]; - if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { this->actor.flags &= ~ACTOR_FLAG_4; - this->actor.objBankIndex = this->objBankIndex; + this->actor.objectSlot = this->requiredObjectSlot; switch (this->actor.params) { case SI_KEATON_MASK: if (GET_ITEMGETINF(ITEMGETINF_38)) { diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.h b/src/overlays/actors/ovl_En_GirlA/z_en_girla.h index 29d5d6682..65725c5c1 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.h +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.h @@ -15,7 +15,7 @@ typedef struct EnGirlA { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnGirlAActionFunc actionFunc; - /* 0x0194 */ s8 objBankIndex; + /* 0x0194 */ s8 requiredObjectSlot; /* 0x0198 */ EnGirlAActionFunc actionFunc2; /* 0x019C */ s32 isInitialized; /* 0x01A0 */ s16 itemBuyPromptTextId; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 4ce4f4837..9a22b0c50 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -70,9 +70,9 @@ void EnGm_Init(Actor* thisx, PlayState* play) { // "Medi Goron" osSyncPrintf(VT_FGCOL(GREEN) "%s[%d] : 中ゴロン[%d]" VT_RST "\n", "../z_en_gm.c", 133, this->actor.params); - this->objGmBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GM); + this->gmObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GM); - if (this->objGmBankIndex < 0) { + if (this->gmObjectSlot < 0) { osSyncPrintf(VT_COL(RED, WHITE)); // "There is no model bank! !! (Medi Goron)" osSyncPrintf("モデル バンクが無いよ!!(中ゴロン)\n"); @@ -102,10 +102,10 @@ s32 func_80A3D7C8(void) { } void func_80A3D838(EnGm* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->objGmBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->gmObjectSlot)) { this->actor.flags &= ~ACTOR_FLAG_4; SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, 18); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objGmBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->gmObjectSlot].segment); Animation_Change(&this->skelAnime, &object_gm_Anim_0002B8, 1.0f, 0.0f, Animation_GetLastFrame(&object_gm_Anim_0002B8), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnGm_Draw; @@ -274,7 +274,7 @@ void func_80A3DF60(EnGm* this, PlayState* play) { } void func_80A3DFBC(EnGm* this, PlayState* play) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objGmBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->gmObjectSlot].segment); this->timer++; this->actionFunc(this, play); this->actor.focus.rot.x = this->actor.world.rot.x; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.h b/src/overlays/actors/ovl_En_Gm/z_en_gm.h index fd699d518..3cfedca01 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.h +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.h @@ -17,7 +17,7 @@ typedef struct EnGm { /* 0x0268 */ EnGmUpdateFunc updateFunc; /* 0x026C */ EnGmActionFunc actionFunc; /* 0x0270 */ ColliderCylinder collider; - /* 0x02BC */ s8 objGmBankIndex; + /* 0x02BC */ s8 gmObjectSlot; /* 0x02BE */ s16 timer; /* 0x02C0 */ s16 blinkTimer; /* 0x02C2 */ u8 eyeTexIndex; diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c index 332638be1..e624d6720 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -55,8 +55,8 @@ void EnGuest_Init(Actor* thisx, PlayState* play) { if (GET_INFTABLE(INFTABLE_76)) { Actor_Kill(&this->actor); } else { - this->osAnimeBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME); - if (this->osAnimeBankIndex < 0) { + this->osAnimeObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_OS_ANIME); + if (this->osAnimeObjectSlot < 0) { osSyncPrintf(VT_COL(RED, WHITE)); // "No such bank!!" osSyncPrintf("%s[%d] : バンクが無いよ!!\n", "../z_en_guest.c", 129); @@ -76,13 +76,13 @@ void EnGuest_Update(Actor* thisx, PlayState* play) { EnGuest* this = (EnGuest*)thisx; s32 pad; - if (Object_IsLoaded(&play->objectCtx, this->osAnimeBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->osAnimeObjectSlot)) { this->actor.flags &= ~ACTOR_FLAG_4; Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_0000F0, NULL, this->jointTable, this->morphTable, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); Animation_Change(&this->skelAnime, &gObjOsAnim_42AC, 1.0f, 0.0f, Animation_GetLastFrame(&gObjOsAnim_42AC), ANIMMODE_LOOP, 0.0f); @@ -160,7 +160,7 @@ void func_80A505CC(Actor* thisx, PlayState* play) { func_80034F54(play, this->unk_2CC, this->unk_2EC, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); SkelAnime_Update(&this->skelAnime); Actor_SetFocus(&this->actor, 60.0f); diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.h b/src/overlays/actors/ovl_En_Guest/z_en_guest.h index 2835a6d8c..6633f2741 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.h +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.h @@ -20,7 +20,7 @@ typedef struct EnGuest { /* 0x02CA */ s16 unk_2CA; /* 0x02CC */ s16 unk_2CC[16]; /* 0x02EC */ s16 unk_2EC[16]; - /* 0x030C */ s8 osAnimeBankIndex; + /* 0x030C */ s8 osAnimeObjectSlot; /* 0x030D */ u8 unk_30D; /* 0x030E */ u8 unk_30E; } EnGuest; // size = 0x0310 diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index 33febb17a..66e1679bf 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -838,7 +838,7 @@ void EnHeishi2_DrawKingGuard(Actor* thisx, PlayState* play) { void EnHeishi2_Draw(Actor* thisx, PlayState* play) { EnHeishi2* this = (EnHeishi2*)thisx; Mtx* mtx; - s32 linkObjBankIndex; + s32 linkChildObjectSlot; OPEN_DISPS(play->state.gfxCtx, "../z_en_heishi2.c", 1792); @@ -847,17 +847,17 @@ void EnHeishi2_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi2_OverrideLimbDraw, EnHeishi2_PostLimbDraw, this); if ((this->type == 5) && GET_INFTABLE(INFTABLE_77)) { - linkObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_LINK_CHILD); - if (linkObjBankIndex >= 0) { + linkChildObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_LINK_CHILD); + if (linkChildObjectSlot >= 0) { Matrix_Put(&this->mtxf_330); Matrix_Translate(-570.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(70), MTXMODE_APPLY); mtx = Matrix_NewMtx(play->state.gfxCtx, "../z_en_heishi2.c", 1820) - 7; - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[linkObjBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[linkChildObjectSlot].segment); gSPSegment(POLY_OPA_DISP++, 0x0D, mtx); gSPDisplayList(POLY_OPA_DISP++, gLinkChildKeatonMaskDL); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->actor.objectSlot].segment); } } diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index cd87b114a..3dd8a99fe 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -757,15 +757,15 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { this->actor.params &= ~0x8000; this->type = HORSE_HNI; - if ((this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HNI)) < 0) { + if ((this->hniObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_HNI)) < 0) { Actor_Kill(&this->actor); return; } do { - } while (!Object_IsLoaded(&play->objectCtx, this->bankIndex)); + } while (!Object_IsLoaded(&play->objectCtx, this->hniObjectSlot)); - this->actor.objBankIndex = this->bankIndex; + this->actor.objectSlot = this->hniObjectSlot; Actor_SetObjectDependency(play, &this->actor); this->boostSpeed = 12; } else { diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.h b/src/overlays/actors/ovl_En_Horse/z_en_horse.h index 5a2f47f1b..785ddc8a9 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.h +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.h @@ -97,7 +97,7 @@ typedef struct EnHorse { /* 0x0150 */ s32 noInputTimer; /* 0x0154 */ s32 noInputTimerMax; /* 0x0158 */ s32 type; - /* 0x015C */ s8 bankIndex; + /* 0x015C */ s8 hniObjectSlot; /* 0x0160 */ Skin skin; /* 0x01F0 */ u32 stateFlags; /* 0x01F4 */ Vec3f lastPos; diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index e2d76dc0a..aa149275c 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -207,9 +207,9 @@ static AnimationInfo sAnimationInfo[] = { typedef struct { /* 0x00 */ u8 headInfoIndex; // EnHyHeadIndex - /* 0x01 */ u8 skelInfoIndex2; // EnHySkeletonIndex, see EnHy.objBankIndexSkel2 + /* 0x01 */ u8 skelInfoIndex2; // EnHySkeletonIndex, see EnHy.objectSlotSkel2 /* 0x02 */ Color_RGBA8 envColorSeg8; - /* 0x06 */ u8 skelInfoIndex1; // EnHySkeletonIndex, see EnHy.objBankIndexSkel1 + /* 0x06 */ u8 skelInfoIndex1; // EnHySkeletonIndex, see EnHy.objectSlotSkel1 /* 0x07 */ Color_RGBA8 envColorSeg9; /* 0x0B */ u8 animInfoIndex; // EnHyAnimationIndex } EnHyModelInfo; // size = 0xC @@ -356,18 +356,18 @@ s32 EnHy_FindSkelAndHeadObjects(EnHy* this, PlayState* play) { u8 skelInfoIndex2 = sModelInfo[this->actor.params & 0x7F].skelInfoIndex2; u8 skelInfoIndex1 = sModelInfo[this->actor.params & 0x7F].skelInfoIndex1; - this->objBankIndexSkel1 = Object_GetIndex(&play->objectCtx, sSkeletonInfo[skelInfoIndex1].objectId); - if (this->objBankIndexSkel1 < 0) { + this->objectSlotSkel1 = Object_GetSlot(&play->objectCtx, sSkeletonInfo[skelInfoIndex1].objectId); + if (this->objectSlotSkel1 < 0) { return false; } - this->objBankIndexSkel2 = Object_GetIndex(&play->objectCtx, sSkeletonInfo[skelInfoIndex2].objectId); - if (this->objBankIndexSkel2 < 0) { + this->objectSlotSkel2 = Object_GetSlot(&play->objectCtx, sSkeletonInfo[skelInfoIndex2].objectId); + if (this->objectSlotSkel2 < 0) { return false; } - this->objBankIndexHead = Object_GetIndex(&play->objectCtx, sHeadInfo[headInfoIndex].objectId); - if (this->objBankIndexHead < 0) { + this->objectSlotHead = Object_GetSlot(&play->objectCtx, sHeadInfo[headInfoIndex].objectId); + if (this->objectSlotHead < 0) { return false; } @@ -375,15 +375,15 @@ s32 EnHy_FindSkelAndHeadObjects(EnHy* this, PlayState* play) { } s32 EnHy_AreSkelAndHeadObjectsLoaded(EnHy* this, PlayState* play) { - if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexSkel1)) { + if (!Object_IsLoaded(&play->objectCtx, this->objectSlotSkel1)) { return false; } - if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexSkel2)) { + if (!Object_IsLoaded(&play->objectCtx, this->objectSlotSkel2)) { return false; } - if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexHead)) { + if (!Object_IsLoaded(&play->objectCtx, this->objectSlotHead)) { return false; } @@ -391,9 +391,9 @@ s32 EnHy_AreSkelAndHeadObjectsLoaded(EnHy* this, PlayState* play) { } s32 EnHy_FindOsAnimeObject(EnHy* this, PlayState* play) { - this->objBankIndexOsAnime = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME); + this->objectSlotOsAnime = Object_GetSlot(&play->objectCtx, OBJECT_OS_ANIME); - if (this->objBankIndexOsAnime < 0) { + if (this->objectSlotOsAnime < 0) { return false; } @@ -401,7 +401,7 @@ s32 EnHy_FindOsAnimeObject(EnHy* this, PlayState* play) { } s32 EnHy_IsOsAnimeObjectLoaded(EnHy* this, PlayState* play) { - if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexOsAnime)) { + if (!Object_IsLoaded(&play->objectCtx, this->objectSlotOsAnime)) { return false; } @@ -898,13 +898,13 @@ void EnHy_Destroy(Actor* thisx, PlayState* play) { void EnHy_InitImpl(EnHy* this, PlayState* play) { if (EnHy_IsOsAnimeObjectLoaded(this, play) && EnHy_AreSkelAndHeadObjectsLoaded(this, play)) { - this->actor.objBankIndex = this->objBankIndexSkel1; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->actor.objBankIndex].segment); + this->actor.objectSlot = this->objectSlotSkel1; + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); SkelAnime_InitFlex(play, &this->skelAnime, sSkeletonInfo[sModelInfo[this->actor.params & 0x7F].skelInfoIndex1].skeleton, NULL, this->jointTable, this->morphTable, 16); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexOsAnime].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotOsAnime].segment); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sColCylInit); EnHy_InitCollider(this); @@ -1082,7 +1082,7 @@ void EnHy_Update(Actor* thisx, PlayState* play) { EnHy* this = (EnHy*)thisx; if (this->actionFunc != EnHy_InitImpl) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexOsAnime].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotOsAnime].segment); SkelAnime_Update(&this->skelAnime); EnHy_UpdateEyes(this); @@ -1110,8 +1110,8 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po OPEN_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2170); if (limbIndex == 15) { - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objBankIndexHead].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexHead].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlotHead].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotHead].segment); i = sModelInfo[this->actor.params & 0x7F].headInfoIndex; *dList = sHeadInfo[i].headDList; @@ -1120,7 +1120,7 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(ptr)); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexSkel1].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotSkel1].segment); } if (limbIndex == 15) { @@ -1155,8 +1155,8 @@ void EnHy_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, OPEN_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2255); if (limbIndex == 7) { - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objBankIndexSkel2].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexSkel2].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlotSkel2].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotSkel2].segment); } if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_3 && limbIndex == 8) { diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.h b/src/overlays/actors/ovl_En_Hy/z_en_hy.h index 086a4bf2e..760ed9dfe 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.h +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.h @@ -39,10 +39,10 @@ typedef struct EnHy { /* 0x0190 */ EnHyActionFunc actionFunc; /* 0x0194 */ char unk_194; // unused /* 0x0195 */ u8 pathReverse; - /* 0x0196 */ s8 objBankIndexHead; - /* 0x0197 */ s8 objBankIndexSkel2; // 7 < limb < 15 (upper part?) (always same as objBankIndexSkel1) - /* 0x0198 */ s8 objBankIndexSkel1; // sets the object used when drawing the skeleton for limb <= 7 (lower part?) - /* 0x0199 */ s8 objBankIndexOsAnime; + /* 0x0196 */ s8 objectSlotHead; + /* 0x0197 */ s8 objectSlotSkel2; // 7 < limb < 15 (upper part?) (always same as objectSlotSkel1) + /* 0x0198 */ s8 objectSlotSkel1; // sets the object used when drawing the skeleton for limb <= 7 (lower part?) + /* 0x0199 */ s8 objectSlotOsAnime; /* 0x019C */ ColliderCylinder collider; /* 0x01E8 */ NpcInteractInfo interactInfo; /* 0x0210 */ Path* path; diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index e1e9d5822..3ef6332ef 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -928,7 +928,8 @@ void EnIk_PostLimbDrawEnemy(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* if (this->armorStatusFlag & ARMOR_BROKEN) { BodyBreak_SetInfo(&this->bodyBreak, limbIndex, IRON_KNUCKLE_LIMB_CHEST_ARMOR_FRONT, - IRON_KNUCKLE_LIMB_CHEST_ARMOR_BACK, IRON_KNUCKLE_LIMB_TORSO, dList, BODYBREAK_OBJECT_DEFAULT); + IRON_KNUCKLE_LIMB_CHEST_ARMOR_BACK, IRON_KNUCKLE_LIMB_TORSO, dList, + BODYBREAK_OBJECT_SLOT_DEFAULT); } if (limbIndex == IRON_KNUCKLE_LIMB_HELMET_ARMOR) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ik_inFight.c", 1217), diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 9b31fbc2f..73698fd4a 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -9,7 +9,7 @@ void EnIn_Destroy(Actor* thisx, PlayState* play); void EnIn_Update(Actor* thisx, PlayState* play); void EnIn_Draw(Actor* thisx, PlayState* play); -void func_80A79FB0(EnIn* this, PlayState* play); +void EnIn_WaitForObject(EnIn* this, PlayState* play); void func_80A7A304(EnIn* this, PlayState* play); void func_80A7A4C8(EnIn* this, PlayState* play); void func_80A7A568(EnIn* this, PlayState* play); @@ -481,8 +481,8 @@ void EnIn_Init(Actor* thisx, PlayState* play) { RespawnData* respawn = &gSaveContext.respawn[RESPAWN_MODE_DOWN]; Vec3f respawnPos; - this->ingoObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_IN); - if (this->ingoObjBankIndex < 0 && this->actor.params > 0) { + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_IN); + if (this->requiredObjectSlot < 0 && this->actor.params > 0) { this->actionFunc = NULL; Actor_Kill(&this->actor); return; @@ -493,21 +493,23 @@ void EnIn_Init(Actor* thisx, PlayState* play) { gSaveContext.eventInf[EVENTINF_HORSES_INDEX] = 0; D_80A7B998 = 1; } - this->actionFunc = func_80A79FB0; + this->actionFunc = EnIn_WaitForObject; } void EnIn_Destroy(Actor* thisx, PlayState* play) { EnIn* this = (EnIn*)thisx; - if (this->actionFunc != NULL && this->actionFunc != func_80A79FB0) { + if (this->actionFunc != NULL && this->actionFunc != EnIn_WaitForObject) { Collider_DestroyCylinder(play, &this->collider); } } -void func_80A79FB0(EnIn* this, PlayState* play) { +// This function does not actually wait since it waits for OBJECT_IN, +// but the object is already loaded at this point from being set in the ActorInit data +void EnIn_WaitForObject(EnIn* this, PlayState* play) { s32 sp3C = 0; - if (Object_IsLoaded(&play->objectCtx, this->ingoObjBankIndex) || this->actor.params <= 0) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot) || this->actor.params <= 0) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gIngoSkel, NULL, this->jointTable, this->morphTable, 20); Collider_InitCylinder(play, &this->collider); @@ -911,7 +913,7 @@ void EnIn_Update(Actor* thisx, PlayState* play) { ColliderCylinder* collider; EnIn* this = (EnIn*)thisx; - if (this->actionFunc == func_80A79FB0) { + if (this->actionFunc == EnIn_WaitForObject) { this->actionFunc(this, play); return; } @@ -1000,7 +1002,7 @@ void EnIn_Draw(Actor* thisx, PlayState* play) { EnIn* this = (EnIn*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_in.c", 2384); - if (this->actionFunc != func_80A79FB0) { + if (this->actionFunc != EnIn_WaitForObject) { Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gIngoHeadGradient2Tex)); diff --git a/src/overlays/actors/ovl_En_In/z_en_in.h b/src/overlays/actors/ovl_En_In/z_en_in.h index 2cf2668a4..57baa280d 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.h +++ b/src/overlays/actors/ovl_En_In/z_en_in.h @@ -38,7 +38,7 @@ typedef struct EnIn { /* 0x0190 */ EnInActionFunc actionFunc; /* 0x0194 */ ColliderCylinder collider; /* 0x01E0 */ f32 unk_1E0; - /* 0x01E4 */ s8 ingoObjBankIndex; + /* 0x01E4 */ s8 requiredObjectSlot; /* 0x01E6 */ s16 animationIdx; /* 0x01E8 */ s16 unk_1E8; /* 0x01EA */ s16 blinkTimer; diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index d0f6538da..a1be751ed 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -259,46 +259,46 @@ s32 EnKo_AreObjectsAvailable(EnKo* this, PlayState* play) { u8 bodyId = sModelInfo[ENKO_TYPE].bodyId; u8 legsId = sModelInfo[ENKO_TYPE].legsId; - this->legsObjectBankIdx = Object_GetIndex(&play->objectCtx, sSkeleton[legsId].objectId); - if (this->legsObjectBankIdx < 0) { + this->legsObjectSlot = Object_GetSlot(&play->objectCtx, sSkeleton[legsId].objectId); + if (this->legsObjectSlot < 0) { return false; } - this->bodyObjectBankIdx = Object_GetIndex(&play->objectCtx, sSkeleton[bodyId].objectId); - if (this->bodyObjectBankIdx < 0) { + this->bodyObjectSlot = Object_GetSlot(&play->objectCtx, sSkeleton[bodyId].objectId); + if (this->bodyObjectSlot < 0) { return false; } - this->headObjectBankIdx = Object_GetIndex(&play->objectCtx, sHead[headId].objectId); - if (this->headObjectBankIdx < 0) { + this->headObjectSlot = Object_GetSlot(&play->objectCtx, sHead[headId].objectId); + if (this->headObjectSlot < 0) { return false; } return true; } s32 EnKo_AreObjectsLoaded(EnKo* this, PlayState* play) { - if (!Object_IsLoaded(&play->objectCtx, this->legsObjectBankIdx)) { + if (!Object_IsLoaded(&play->objectCtx, this->legsObjectSlot)) { return false; } - if (!Object_IsLoaded(&play->objectCtx, this->bodyObjectBankIdx)) { + if (!Object_IsLoaded(&play->objectCtx, this->bodyObjectSlot)) { return false; } - if (!Object_IsLoaded(&play->objectCtx, this->headObjectBankIdx)) { + if (!Object_IsLoaded(&play->objectCtx, this->headObjectSlot)) { return false; } return true; } s32 EnKo_IsOsAnimeAvailable(EnKo* this, PlayState* play) { - this->osAnimeBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME); - if (this->osAnimeBankIndex < 0) { + this->osAnimeObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_OS_ANIME); + if (this->osAnimeObjectSlot < 0) { return false; } return true; } s32 EnKo_IsOsAnimeLoaded(EnKo* this, PlayState* play) { - if (!Object_IsLoaded(&play->objectCtx, this->osAnimeBankIndex)) { + if (!Object_IsLoaded(&play->objectCtx, this->osAnimeObjectSlot)) { return false; } return true; @@ -1150,12 +1150,12 @@ void EnKo_Destroy(Actor* thisx, PlayState* play) { void func_80A99048(EnKo* this, PlayState* play) { if (EnKo_IsOsAnimeLoaded(this, play) && EnKo_AreObjectsLoaded(this, play)) { this->actor.flags &= ~ACTOR_FLAG_4; - this->actor.objBankIndex = this->legsObjectBankIdx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->actor.objBankIndex].segment); + this->actor.objectSlot = this->legsObjectSlot; + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); SkelAnime_InitFlex(play, &this->skelAnime, sSkeleton[sModelInfo[ENKO_TYPE].legsId].flexSkeletonHeader, NULL, this->jointTable, this->morphTable, 16); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); @@ -1270,7 +1270,7 @@ void EnKo_Update(Actor* thisx, PlayState* play) { if (this->actionFunc != func_80A99048) { if ((s32)this->modelAlpha != 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); SkelAnime_Update(&this->skelAnime); func_80A98DB4(this, play); EnKo_Blink(this); @@ -1302,8 +1302,8 @@ s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po s32 pad; if (limbIndex == 15) { - gSPSegment((*gfx)++, 0x06, play->objectCtx.status[this->headObjectBankIdx].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->headObjectBankIdx].segment); + gSPSegment((*gfx)++, 0x06, play->objectCtx.slots[this->headObjectSlot].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->headObjectSlot].segment); headId = sModelInfo[ENKO_TYPE].headId; *dList = sHead[headId].dList; @@ -1311,7 +1311,7 @@ s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po eyeTexture = sHead[headId].eyeTextures[this->eyeTextureIndex]; gSPSegment((*gfx)++, 0x0A, SEGMENTED_TO_VIRTUAL(eyeTexture)); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->legsObjectBankIdx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->legsObjectSlot].segment); } if (limbIndex == 8) { limbRot = this->interactInfo.torsoRot; @@ -1338,8 +1338,8 @@ void EnKo_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot, Vec3f D_80A9A774 = { 0.0f, 0.0f, 0.0f }; if (limbIndex == 7) { - gSPSegment((*gfx)++, 0x06, play->objectCtx.status[this->bodyObjectBankIdx].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->bodyObjectBankIdx].segment); + gSPSegment((*gfx)++, 0x06, play->objectCtx.slots[this->bodyObjectSlot].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->bodyObjectSlot].segment); } if (limbIndex == 15) { Matrix_MultVec3f(&D_80A9A774, &this->actor.focus.pos); diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.h b/src/overlays/actors/ovl_En_Ko/z_en_ko.h index 2828b067b..a33ac3e38 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.h +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.h @@ -12,10 +12,10 @@ typedef struct EnKo { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnKoActionFunc actionFunc; - /* 0x0194 */ s8 headObjectBankIdx; - /* 0x0195 */ s8 bodyObjectBankIdx; - /* 0x0196 */ s8 legsObjectBankIdx; - /* 0x0197 */ s8 osAnimeBankIndex; + /* 0x0194 */ s8 headObjectSlot; + /* 0x0195 */ s8 bodyObjectSlot; + /* 0x0196 */ s8 legsObjectSlot; + /* 0x0197 */ s8 osAnimeObjectSlot; /* 0x0198 */ ColliderCylinder collider; /* 0x01E4 */ Path* path; /* 0x01E8 */ NpcInteractInfo interactInfo; diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index 48d8cefdc..193725512 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -20,7 +20,7 @@ void EnKusa_Update(Actor* thisx, PlayState* play); void EnKusa_Draw(Actor* thisx, PlayState* play); void EnKusa_SetupLiftedUp(EnKusa* this); -void EnKusa_SetupWaitObject(EnKusa* this); +void EnKusa_SetupWaitForObject(EnKusa* this); void EnKusa_SetupMain(EnKusa* this); void EnKusa_SetupFall(EnKusa* this); void EnKusa_SetupCut(EnKusa* this); @@ -28,7 +28,7 @@ void EnKusa_SetupUprootedWaitRegrow(EnKusa* this); void EnKusa_SetupRegrow(EnKusa* this); void EnKusa_Fall(EnKusa* this, PlayState* play); -void EnKusa_WaitObject(EnKusa* this, PlayState* play); +void EnKusa_WaitForObject(EnKusa* this, PlayState* play); void EnKusa_Main(EnKusa* this, PlayState* play); void EnKusa_LiftedUp(EnKusa* this, PlayState* play); void EnKusa_CutWaitRegrow(EnKusa* this, PlayState* play); @@ -253,16 +253,16 @@ void EnKusa_Init(Actor* thisx, PlayState* play) { return; } - this->objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[thisx->params & 3]); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[thisx->params & 3]); - if (this->objBankIndex < 0) { + if (this->requiredObjectSlot < 0) { // "Bank danger!" osSyncPrintf("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", thisx->params, "../z_en_kusa.c", 561); Actor_Kill(&this->actor); return; } - EnKusa_SetupWaitObject(this); + EnKusa_SetupWaitForObject(this); } void EnKusa_Destroy(Actor* thisx, PlayState* play2) { @@ -272,12 +272,12 @@ void EnKusa_Destroy(Actor* thisx, PlayState* play2) { Collider_DestroyCylinder(play, &this->collider); } -void EnKusa_SetupWaitObject(EnKusa* this) { - EnKusa_SetupAction(this, EnKusa_WaitObject); +void EnKusa_SetupWaitForObject(EnKusa* this) { + EnKusa_SetupAction(this, EnKusa_WaitForObject); } -void EnKusa_WaitObject(EnKusa* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { +void EnKusa_WaitForObject(EnKusa* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { if (this->actor.flags & ACTOR_FLAG_ENKUSA_CUT) { EnKusa_SetupCut(this); } else { @@ -285,7 +285,7 @@ void EnKusa_WaitObject(EnKusa* this, PlayState* play) { } this->actor.draw = EnKusa_Draw; - this->actor.objBankIndex = this->objBankIndex; + this->actor.objectSlot = this->requiredObjectSlot; this->actor.flags &= ~ACTOR_FLAG_4; } } diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h index 3a922ebce..8c8423223 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h @@ -19,7 +19,7 @@ typedef struct EnKusa { /* 0x014C */ EnKusaActionFunc actionFunc; /* 0x0150 */ ColliderCylinder collider; /* 0x019C */ s16 timer; - /* 0x019E */ s8 objBankIndex; + /* 0x019E */ s8 requiredObjectSlot; } EnKusa; // size = 0x01A0 #endif diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 164252b17..30ccb46ab 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -394,7 +394,7 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) { u16 rectLeft; u16 rectTop; - gSPSegment(gfx++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(gfx++, 0x06, play->objectCtx.slots[this->actor.objectSlot].segment); Gfx_SetupDL_39Ptr(&gfx); diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index a37c364aa..2245d1984 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -179,7 +179,7 @@ void EnMm_Init(Actor* thisx, PlayState* play) { this->actor.targetMode = 2; this->actor.gravity = -1.0f; this->speedXZ = 3.0f; - this->unk_204 = this->actor.objBankIndex; + this->unk_204 = this->actor.objectSlot; if (func_80AADA70() == 1) { this->mouthTexIndex = RM_MOUTH_OPEN; @@ -524,10 +524,10 @@ void EnMm_Draw(Actor* thisx, PlayState* play) { EnMm_OverrideLimbDraw, EnMm_PostLimbDraw, this); if (GET_ITEMGETINF(ITEMGETINF_3B)) { - s32 linkChildObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_LINK_CHILD); + s32 linkChildObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_LINK_CHILD); // Draw Bunny Hood - if (linkChildObjBankIndex >= 0) { + if (linkChildObjectSlot >= 0) { Mtx* mtx; Vec3s earRot; Mtx* mtx2; @@ -537,7 +537,7 @@ void EnMm_Draw(Actor* thisx, PlayState* play) { Matrix_Put(&this->unk_208); mtx2 = Matrix_NewMtx(play->state.gfxCtx, "../z_en_mm.c", 1111); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[linkChildObjBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[linkChildObjectSlot].segment); gSPSegment(POLY_OPA_DISP++, 0x0B, mtx); gSPSegment(POLY_OPA_DISP++, 0x0D, mtx2 - 7); @@ -558,7 +558,7 @@ void EnMm_Draw(Actor* thisx, PlayState* play) { Matrix_ToMtx(mtx, "../z_en_mm.c", 1131); gSPDisplayList(POLY_OPA_DISP++, gLinkChildBunnyHoodDL); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->actor.objectSlot].segment); } } diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index 0d66faf11..313def754 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -70,9 +70,9 @@ void EnNiwLady_Init(Actor* thisx, PlayState* play) { s32 pad; EnNiwLady* this = (EnNiwLady*)thisx; - this->objectAneIndex = Object_GetIndex(&play->objectCtx, OBJECT_ANE); - this->objectOsAnimeIndex = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME); - if ((this->objectOsAnimeIndex < 0) || (this->objectAneIndex < 0)) { + this->aneObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_ANE); + this->osAnimeObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_OS_ANIME); + if ((this->osAnimeObjectSlot < 0) || (this->aneObjectSlot < 0)) { Actor_Kill(thisx); return; } @@ -153,11 +153,11 @@ void func_80AB9F24(EnNiwLady* this, PlayState* play) { f32 frames; s32 pad; - if (Object_IsLoaded(&play->objectCtx, this->objectAneIndex) && - Object_IsLoaded(&play->objectCtx, this->objectOsAnimeIndex)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectAneIndex].segment); + if (Object_IsLoaded(&play->objectCtx, this->aneObjectSlot) && + Object_IsLoaded(&play->objectCtx, this->osAnimeObjectSlot)) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->aneObjectSlot].segment); SkelAnime_InitFlex(play, &this->skelAnime, &gCuccoLadySkel, NULL, this->jointTable, this->morphTable, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectOsAnimeIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); this->unk_27E = 1; this->actor.gravity = -3.0f; Actor_SetScale(&this->actor, 0.01f); @@ -507,8 +507,8 @@ void EnNiwLady_Update(Actor* thisx, PlayState* play) { if (this->unk_276 == 0) { Math_SmoothStepToS(&this->headRot.y, 0, 5, 3000, 0); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectOsAnimeIndex].segment); - if (this->objectOsAnimeIndex >= 0) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); + if (this->osAnimeObjectSlot >= 0) { if (this->unk_27E != 0) { if (this->unk_26E != 0) { this->unk_26E--; @@ -517,8 +517,8 @@ void EnNiwLady_Update(Actor* thisx, PlayState* play) { } SkelAnime_Update(&this->skelAnime); } - this->objectAneIndex = Object_GetIndex(&play->objectCtx, OBJECT_ANE); - if (this->objectAneIndex >= 0) { + this->aneObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_ANE); + if (this->aneObjectSlot >= 0) { this->actionFunc(this, play); if (this->unusedTimer2 != 0) { this->unusedTimer2--; diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h index f50f66494..7ecb165cc 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h @@ -35,8 +35,8 @@ typedef struct EnNiwLady { /* 0x027A */ s16 unk_27A; /* 0x027C */ s16 faceState; /* 0x027E */ s16 unk_27E; - /* 0x0280 */ s8 objectAneIndex; - /* 0x0281 */ s8 objectOsAnimeIndex; + /* 0x0280 */ s8 aneObjectSlot; + /* 0x0281 */ s8 osAnimeObjectSlot; /* 0x0284 */ s32 getItemId; /* 0x0288 */ NpcInteractInfo interactInfo; /* 0x02B0 */ ColliderCylinder collider; diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 5f553dd55..5df876058 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -54,7 +54,7 @@ static ColliderCylinderInit sCylinderInit = { { 13, 13, 0, { 0 } }, }; -static s16 sObjectIDs[] = { +static s16 sObjectIds[] = { OBJECT_DEKUNUTS, OBJECT_HINTNUTS, OBJECT_SHOPNUTS, OBJECT_DNS, OBJECT_DNK, }; @@ -69,9 +69,9 @@ void EnNutsball_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 400.0f, ActorShadow_DrawCircle, 13.0f); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIDs[this->actor.params]); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[this->actor.params]); - if (this->objBankIndex < 0) { + if (this->requiredObjectSlot < 0) { Actor_Kill(&this->actor); } else { this->actionFunc = func_80ABBB34; @@ -85,8 +85,8 @@ void EnNutsball_Destroy(Actor* thisx, PlayState* play) { } void func_80ABBB34(EnNutsball* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { - this->actor.objBankIndex = this->objBankIndex; + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { + this->actor.objectSlot = this->requiredObjectSlot; this->actor.draw = EnNutsball_Draw; this->actor.shape.rot.y = 0; this->timer = 30; diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h index 5a59e27d9..4dff4fa55 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h @@ -11,7 +11,7 @@ typedef void (*EnNutsballActionFunc)(struct EnNutsball*, PlayState*); typedef struct EnNutsball { /* 0x0000 */ Actor actor; /* 0x014C */ EnNutsballActionFunc actionFunc; - /* 0x0150 */ s8 objBankIndex; + /* 0x0150 */ s8 requiredObjectSlot; /* 0x0152 */ s16 timer; /* 0x0154 */ ColliderCylinder collider; } EnNutsball; // size = 0x01A0 diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 79f00094f..4e133aea4 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -549,20 +549,20 @@ void EnOssan_UpdateCameraDirection(EnOssan* this, PlayState* play, f32 cameraFac s32 EnOssan_TryGetObjBankIndices(EnOssan* this, PlayState* play, s16* objectIds) { if (objectIds[1] != OBJECT_ID_MAX) { - this->objBankIndex2 = Object_GetIndex(&play->objectCtx, objectIds[1]); - if (this->objBankIndex2 < 0) { + this->objectSlot2 = Object_GetSlot(&play->objectCtx, objectIds[1]); + if (this->objectSlot2 < 0) { return false; } } else { - this->objBankIndex2 = -1; + this->objectSlot2 = -1; } if (objectIds[2] != OBJECT_ID_MAX) { - this->objBankIndex3 = Object_GetIndex(&play->objectCtx, objectIds[2]); - if (this->objBankIndex3 < 0) { + this->objectSlot3 = Object_GetSlot(&play->objectCtx, objectIds[2]); + if (this->objectSlot3 < 0) { return false; } } else { - this->objBankIndex3 = -1; + this->objectSlot3 = -1; } return true; } @@ -604,9 +604,9 @@ void EnOssan_Init(Actor* thisx, PlayState* play) { } objectIds = sShopkeeperObjectIds[this->actor.params]; - this->objBankIndex1 = Object_GetIndex(&play->objectCtx, objectIds[0]); + this->objectSlot1 = Object_GetSlot(&play->objectCtx, objectIds[0]); - if (this->objBankIndex1 < 0) { + if (this->objectSlot1 < 0) { Actor_Kill(&this->actor); osSyncPrintf(VT_COL(RED, WHITE)); osSyncPrintf("バンクが無いよ!!(%s)\n", sShopkeeperPrintName[this->actor.params]); @@ -1970,11 +1970,11 @@ void EnOssan_Blink(EnOssan* this) { } s32 EnOssan_AreShopkeeperObjectsLoaded(EnOssan* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->objBankIndex1)) { - if (this->objBankIndex2 >= 0 && !Object_IsLoaded(&play->objectCtx, this->objBankIndex2)) { + if (Object_IsLoaded(&play->objectCtx, this->objectSlot1)) { + if (this->objectSlot2 >= 0 && !Object_IsLoaded(&play->objectCtx, this->objectSlot2)) { return false; } - if (this->objBankIndex3 >= 0 && !Object_IsLoaded(&play->objectCtx, this->objBankIndex3)) { + if (this->objectSlot3 >= 0 && !Object_IsLoaded(&play->objectCtx, this->objectSlot3)) { return false; } return true; @@ -1990,7 +1990,7 @@ void EnOssan_InitBazaarShopkeeper(EnOssan* this, PlayState* play) { void EnOssan_InitKokiriShopkeeper(EnOssan* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gKm1Skel, NULL, NULL, NULL, 0); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex3].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); Animation_Change(&this->skelAnime, &object_masterkokiri_Anim_0004A8, 1.0f, 0.0f, Animation_GetLastFrame(&object_masterkokiri_Anim_0004A8), 0, 0.0f); this->actor.draw = EnOssan_DrawKokiriShopkeeper; @@ -2001,7 +2001,7 @@ void EnOssan_InitKokiriShopkeeper(EnOssan* this, PlayState* play) { void EnOssan_InitGoronShopkeeper(EnOssan* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, NULL, NULL, 0); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex3].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); Animation_Change(&this->skelAnime, &gGoronShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGoronShopkeeperAnim), 0, 0.0f); this->actor.draw = EnOssan_DrawGoronShopkeeper; @@ -2010,7 +2010,7 @@ void EnOssan_InitGoronShopkeeper(EnOssan* this, PlayState* play) { void EnOssan_InitZoraShopkeeper(EnOssan* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, NULL, NULL, 0); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex3].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); Animation_Change(&this->skelAnime, &gZoraShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gZoraShopkeeperAnim), 0, 0.0f); this->actor.draw = EnOssan_DrawZoraShopkeeper; @@ -2103,7 +2103,7 @@ void EnOssan_InitActionFunc(EnOssan* this, PlayState* play) { if (EnOssan_AreShopkeeperObjectsLoaded(this, play)) { this->actor.flags &= ~ACTOR_FLAG_4; - this->actor.objBankIndex = this->objBankIndex1; + this->actor.objectSlot = this->objectSlot1; Actor_SetObjectDependency(play, &this->actor); this->shelves = (EnTana*)Actor_Find(&play->actorCtx, ACTOR_EN_TANA, ACTORCAT_PROP); @@ -2193,7 +2193,7 @@ void EnOssan_InitActionFunc(EnOssan* this, PlayState* play) { } void EnOssan_Obj3ToSeg6(EnOssan* this, PlayState* play) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex3].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); } void EnOssan_MainActionFunc(EnOssan* this, PlayState* play) { @@ -2360,8 +2360,8 @@ s32 EnOssan_OverrideLimbDrawKokiriShopkeeper(PlayState* play, s32 limbIndex, Gfx OPEN_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4354); if (limbIndex == 15) { - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objBankIndex2].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex2].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlot2].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot2].segment); *dList = gKokiriShopkeeperHeadDL; gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sKokiriShopkeeperEyeTextures[this->eyeTextureIdx])); } diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h index 03538fbb6..236e47e86 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h @@ -41,9 +41,9 @@ typedef struct EnOssan { /* 0x0198 */ ColliderCylinder collider; // unused /* 0x01E4 */ s16 timer; /* 0x01E6 */ s16 delayTimer; - /* 0x01E8 */ s8 objBankIndex1; - /* 0x01E9 */ s8 objBankIndex2; - /* 0x01EA */ s8 objBankIndex3; + /* 0x01E8 */ s8 objectSlot1; + /* 0x01E9 */ s8 objectSlot2; + /* 0x01EA */ s8 objectSlot3; /* 0x01EB */ u8 happyMaskShopState; /* 0x01EC */ u8 happyMaskShopkeeperEyeIdx; /* 0x01EE */ s16 headRot; diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index 62f3b6835..d07b2cb35 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -230,16 +230,16 @@ void EnPoh_Init(Actor* thisx, PlayState* play) { } } if (this->actor.params < EN_POH_SHARP) { - this->objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_POH); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_POH); this->infoIdx = EN_POH_INFO_NORMAL; this->actor.naviEnemyId = NAVI_ENEMY_POE; } else { - this->objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_PO_COMPOSER); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_PO_COMPOSER); this->infoIdx = EN_POH_INFO_COMPOSER; this->actor.naviEnemyId = NAVI_ENEMY_POE_COMPOSER; } this->info = &sPoeInfo[this->infoIdx]; - if (this->objectIdx < 0) { + if (this->requiredObjectSlot < 0) { Actor_Kill(&this->actor); } } @@ -712,14 +712,14 @@ void func_80ADF894(EnPoh* this, PlayState* play) { } void EnPoh_Death(EnPoh* this, PlayState* play) { - s32 objId; + s32 objectId; if (this->unk_198 != 0) { this->unk_198--; } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - objId = (this->infoIdx == EN_POH_INFO_COMPOSER) ? OBJECT_PO_COMPOSER : OBJECT_POH; - EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, objId, 10, + objectId = (this->infoIdx == EN_POH_INFO_COMPOSER) ? OBJECT_PO_COMPOSER : OBJECT_POH; + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, objectId, 10, this->info->lanternDisplayList); func_80ADE6D4(this); } else if (this->unk_198 == 0) { @@ -906,8 +906,8 @@ void EnPoh_UpdateVisibility(EnPoh* this) { void EnPoh_Update(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; - if (Object_IsLoaded(&play->objectCtx, this->objectIdx)) { - this->actor.objBankIndex = this->objectIdx; + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { + this->actor.objectSlot = this->requiredObjectSlot; this->actor.update = EnPoh_UpdateLiving; Actor_SetObjectDependency(play, &this->actor); if (this->infoIdx == EN_POH_INFO_NORMAL) { diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.h b/src/overlays/actors/ovl_En_Poh/z_en_poh.h index 8c57fd512..1a44a60e8 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.h +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.h @@ -41,7 +41,7 @@ typedef struct EnPoh { /* 0x0190 */ EnPohActionFunc actionFunc; /* 0x0194 */ u8 unk_194; /* 0x0195 */ u8 unk_195; - /* 0x0196 */ s8 objectIdx; + /* 0x0196 */ s8 requiredObjectSlot; /* 0x0197 */ u8 infoIdx; /* 0x0198 */ s16 unk_198; /* 0x019A */ s16 visibilityTimer; diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index 10831f79d..fb61fbf8c 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -476,7 +476,7 @@ void EnSb_Update(Actor* thisx, PlayState* play) { void EnSb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnSb* this = (EnSb*)thisx; - BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 6, 8, dList, BODYBREAK_OBJECT_DEFAULT); + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 6, 8, dList, BODYBREAK_OBJECT_SLOT_DEFAULT); } void EnSb_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 89b99aace..bac933385 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -558,9 +558,9 @@ void EnSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Collider_UpdateSpheres(limbIndex, &this->collider); if ((this->breakFlags ^ 1) == 0) { - BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 11, 12, 18, dList, BODYBREAK_OBJECT_DEFAULT); + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 11, 12, 18, dList, BODYBREAK_OBJECT_SLOT_DEFAULT); } else if ((this->breakFlags ^ (this->breakFlags | 4)) == 0) { - BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 18, 18, dList, BODYBREAK_OBJECT_DEFAULT); + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 18, 18, dList, BODYBREAK_OBJECT_SLOT_DEFAULT); } } diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index dd3863f26..3e07652e5 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -17,7 +17,7 @@ void EnSth_Update(Actor* thisx, PlayState* play); void EnSth_Update2(Actor* thisx, PlayState* play); void EnSth_Draw(Actor* thisx, PlayState* play); -void EnSth_WaitForObjectLoaded(EnSth* this, PlayState* play); +void EnSth_WaitForObject(EnSth* this, PlayState* play); void EnSth_ParentRewardObtainedWait(EnSth* this, PlayState* play); void EnSth_RewardUnobtainedWait(EnSth* this, PlayState* play); void EnSth_ChildRewardObtainedWait(EnSth* this, PlayState* play); @@ -97,7 +97,7 @@ void EnSth_Init(Actor* thisx, PlayState* play) { s16 objectId; s32 params = this->actor.params; - s32 objectBankIdx; + s32 objectSlot; osSyncPrintf(VT_FGCOL(BLUE) "金スタル屋 no = %d\n" VT_RST, params); // "Gold Skulltula Shop" if (this->actor.params == 0) { @@ -116,19 +116,19 @@ void EnSth_Init(Actor* thisx, PlayState* play) { objectId = sObjectIds[params]; if (objectId != 1) { - objectBankIdx = Object_GetIndex(&play->objectCtx, objectId); + objectSlot = Object_GetSlot(&play->objectCtx, objectId); } else { - objectBankIdx = 0; + objectSlot = 0; } - osSyncPrintf("bank_ID = %d\n", objectBankIdx); - if (objectBankIdx < 0) { + osSyncPrintf("bank_ID = %d\n", objectSlot); + if (objectSlot < 0) { ASSERT(0, "0", "../z_en_sth.c", 1564); } - this->objectBankIdx = objectBankIdx; + this->requiredObjectSlot = objectSlot; this->drawFunc = EnSth_Draw; Actor_SetScale(&this->actor, 0.01f); - EnSth_SetupAction(this, EnSth_WaitForObjectLoaded); + EnSth_SetupAction(this, EnSth_WaitForObject); this->actor.draw = NULL; this->unk_2B2 = 0; this->actor.targetMode = 6; @@ -150,7 +150,7 @@ void EnSth_SetupAfterObjectLoaded(EnSth* this, PlayState* play) { s16* params; EnSth_SetupShapeColliderUpdate2AndDraw(this, play); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectBankIdx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); SkelAnime_InitFlex(play, &this->skelAnime, sSkeletons[this->actor.params], NULL, this->jointTable, this->morphTable, 16); Animation_PlayLoop(&this->skelAnime, sAnimations[this->actor.params]); @@ -170,9 +170,9 @@ void EnSth_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void EnSth_WaitForObjectLoaded(EnSth* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->objectBankIdx)) { - this->actor.objBankIndex = this->objectBankIdx; +void EnSth_WaitForObject(EnSth* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { + this->actor.objectSlot = this->requiredObjectSlot; this->actionFunc = EnSth_SetupAfterObjectLoaded; } } @@ -389,7 +389,7 @@ void EnSth_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_sth.c", 2133); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectBankIdx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); Gfx_SetupDL_37Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.h b/src/overlays/actors/ovl_En_Sth/z_en_sth.h index dec16c4e1..9408c542d 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.h +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.h @@ -16,7 +16,7 @@ typedef struct EnSth { /* 0x023C */ Vec3s morphTable[16]; /* 0x029C */ u16 eventFlag; /* 0x02A0 */ ActorFunc drawFunc; - /* 0x02A4 */ u8 objectBankIdx; + /* 0x02A4 */ u8 requiredObjectSlot; /* 0x02A6 */ Vec3s headRot; /* 0x02AC */ Vec3s unk_2AC; /* 0x02B2 */ u16 unk_2B2; diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.c b/src/overlays/actors/ovl_En_Test/z_en_test.c index a51c4d133..4717547c8 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -1865,7 +1865,7 @@ void EnTest_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot s32 pad; Vec3f sp50; - BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 60, 60, dList, BODYBREAK_OBJECT_DEFAULT); + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 60, 60, dList, BODYBREAK_OBJECT_SLOT_DEFAULT); if (limbIndex == STALFOS_LIMB_SWORD) { Matrix_MultVec3f(&D_8086467C, &this->swordCollider.dim.quad[1]); diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index 2f5d32da8..b43c735d4 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -980,7 +980,7 @@ void EnTite_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** limbDList, Vec3s* break; } - BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 24, 24, limbDList, BODYBREAK_OBJECT_DEFAULT); + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 24, 24, limbDList, BODYBREAK_OBJECT_SLOT_DEFAULT); } void EnTite_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index 6c9d9b724..9e3736d0f 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -123,7 +123,7 @@ void EnViewer_InitAnimGanondorfOrZelda(EnViewer* this, PlayState* play, void* sk SkelAnime_Init(play, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animObjBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF || type == ENVIEWER_TYPE_9_GANONDORF) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, anim, 1.0f); @@ -134,7 +134,7 @@ void EnViewer_InitAnimGanondorfOrZelda(EnViewer* this, PlayState* play, void* sk void EnViewer_InitAnimImpa(EnViewer* this, PlayState* play, void* skeletonHeaderSeg, AnimationHeader* anim) { SkelAnime_InitFlex(play, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animObjBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); Animation_PlayLoopSetSpeed(&this->skin.skelAnime, anim, 3.0f); } @@ -167,21 +167,21 @@ static ActorShadowFunc sShadowDrawFuncs[] = { void EnViewer_InitImpl(EnViewer* this, PlayState* play) { EnViewerInitData* initData = &sInitData[this->actor.params >> 8]; - s32 skelObjBankIndex = Object_GetIndex(&play->objectCtx, initData->skeletonObject); + s32 skelObjectSlot = Object_GetSlot(&play->objectCtx, initData->skeletonObject); - ASSERT(skelObjBankIndex >= 0, "bank_ID >= 0", "../z_en_viewer.c", 576); + ASSERT(skelObjectSlot >= 0, "bank_ID >= 0", "../z_en_viewer.c", 576); - this->animObjBankIndex = Object_GetIndex(&play->objectCtx, initData->animObject); - ASSERT(this->animObjBankIndex >= 0, "this->anime_bank_ID >= 0", "../z_en_viewer.c", 579); + this->animObjectSlot = Object_GetSlot(&play->objectCtx, initData->animObject); + ASSERT(this->animObjectSlot >= 0, "this->anime_bank_ID >= 0", "../z_en_viewer.c", 579); - if (!Object_IsLoaded(&play->objectCtx, skelObjBankIndex) || - !Object_IsLoaded(&play->objectCtx, this->animObjBankIndex)) { + if (!Object_IsLoaded(&play->objectCtx, skelObjectSlot) || + !Object_IsLoaded(&play->objectCtx, this->animObjectSlot)) { this->actor.flags &= ~ACTOR_FLAG_6; return; } this->isVisible = true; - this->actor.objBankIndex = skelObjBankIndex; + this->actor.objectSlot = skelObjectSlot; Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, initData->scale / 100.0f); ActorShape_Init(&this->actor.shape, initData->yOffset * 100, sShadowDrawFuncs[initData->shadowType], @@ -487,7 +487,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { void EnViewer_Update(Actor* thisx, PlayState* play) { EnViewer* this = (EnViewer*)thisx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animObjBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h index c24e0ff83..fee5fe762 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h @@ -89,7 +89,7 @@ typedef enum { typedef struct EnViewer { /* 0x0000 */ Actor actor; /* 0x014C */ Skin skin; - /* 0x01DC */ s8 animObjBankIndex; + /* 0x01DC */ s8 animObjectSlot; /* 0x01DD */ u8 drawFuncIndex; /* 0x01E0 */ EnViewerActionFunc actionFunc; /* 0x01E4 */ u8 unused; diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index cbc290de7..5af5e26df 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -559,9 +559,9 @@ void EnZl2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, } void func_80B4FCCC(EnZl2* this, PlayState* play) { - s32 unk_274 = this->unk_274; + s32 objectSlot = this->zl2Anime1ObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[unk_274].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } void func_80B4FD00(EnZl2* this, AnimationHeader* animation, u8 arg2, f32 morphFrames, s32 arg4) { @@ -1575,16 +1575,16 @@ void func_80B52114(EnZl2* this, PlayState* play) { void func_80B521A0(EnZl2* this, PlayState* play) { s32 pad; ObjectContext* objectCtx = &play->objectCtx; - s32 bankIndex = Object_GetIndex(objectCtx, OBJECT_ZL2_ANIME1); + s32 objectSlot = Object_GetSlot(objectCtx, OBJECT_ZL2_ANIME1); s32 pad2; - if (bankIndex < 0) { + if (objectSlot < 0) { osSyncPrintf(VT_FGCOL(RED) "En_Zl2_main_bankアニメーションのバンクを読めない!!!!!!!!!!!!\n" VT_RST); return; } - if (Object_IsLoaded(objectCtx, bankIndex)) { - this->unk_274 = bankIndex; + if (Object_IsLoaded(objectCtx, objectSlot)) { + this->zl2Anime1ObjectSlot = objectSlot; func_80B4FCCC(this, play); this->unk_278 = Animation_GetLastFrame(&gZelda2Anime1Anim_0022D0); func_80B52114(this, play); diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h index 51a620c54..c477ea57e 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h @@ -35,7 +35,7 @@ typedef struct EnZl2 { /* 0x0258 */ char unk_258[0xC]; /* 0x0264 */ s32 overrideLimbDrawConfig; /* 0x0268 */ char unk_268[0xC]; - /* 0x0274 */ s32 unk_274; + /* 0x0274 */ s32 zl2Anime1ObjectSlot; /* 0x0278 */ f32 unk_278; /* 0x027C */ f32 unk_27C; } EnZl2; // size = 0x0280 diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index 517dbc58a..3449464d0 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -726,9 +726,9 @@ s32 func_80B54DD4(EnZl3* this) { } void func_80B54DE0(EnZl3* this, PlayState* play) { - s32 idx = this->unk_318; + s32 objectSlot = this->zl2Anime2ObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[idx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } void func_80B54E14(EnZl3* this, AnimationHeader* animation, u8 arg2, f32 morphFrames, s32 arg4) { @@ -2612,17 +2612,17 @@ void func_80B59B6C(EnZl3* this, PlayState* play) { void func_80B59DB8(EnZl3* this, PlayState* play) { s32 pad; - ObjectContext* objCtx = &play->objectCtx; - s32 objIndex = Object_GetIndex(objCtx, OBJECT_ZL2_ANIME2); + ObjectContext* objectCtx = &play->objectCtx; + s32 objectSlot = Object_GetSlot(objectCtx, OBJECT_ZL2_ANIME2); s32 pad2; - if (objIndex < 0) { + if (objectSlot < 0) { osSyncPrintf(VT_FGCOL(RED) "En_Zl3_main_bankアニメーションのバンクを読めない!!!!!!!!!!!!\n" VT_RST); return; } - if (Object_IsLoaded(objCtx, objIndex)) { - this->unk_318 = objIndex; + if (Object_IsLoaded(objectCtx, objectSlot)) { + this->zl2Anime2ObjectSlot = objectSlot; func_80B54DE0(this, play); func_80B59B6C(this, play); } diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h index e7634ec6f..25c336f42 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h @@ -36,7 +36,7 @@ typedef struct EnZl3 { /* 0x030C */ Path* unk_30C; /* 0x0310 */ s32 unk_310; /* 0x0314 */ s32 unk_314; - /* 0x0318 */ s32 unk_318; + /* 0x0318 */ s32 zl2Anime2ObjectSlot; /* 0x031C */ Vec3f unk_31C; /* 0x0328 */ s32 unk_328; /* 0x032C */ Vec3f unk_32C; diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index a59f8f4ec..b3fa044e5 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -14,7 +14,7 @@ void ItemEtcetera_Update(Actor* thisx, PlayState* play); void ItemEtcetera_DrawThroughLens(Actor* thisx, PlayState* play); void ItemEtcetera_Draw(Actor* thisx, PlayState* play); -void func_80B857D0(ItemEtcetera* this, PlayState* play); +void ItemEtcetera_WaitForObject(ItemEtcetera* this, PlayState* play); void func_80B85824(ItemEtcetera* this, PlayState* play); void func_80B858B4(ItemEtcetera* this, PlayState* play); void ItemEtcetera_SpawnSparkles(ItemEtcetera* this, PlayState* play); @@ -94,23 +94,23 @@ void ItemEtcetera_Init(Actor* thisx, PlayState* play) { ItemEtcetera* this = (ItemEtcetera*)thisx; s32 pad; s32 type; - s32 objBankIndex; + s32 objectSlot; type = this->actor.params & 0xFF; osSyncPrintf("no = %d\n", type); - objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[type]); - osSyncPrintf("bank_ID = %d\n", objBankIndex); - if (objBankIndex < 0) { + objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[type]); + osSyncPrintf("bank_ID = %d\n", objectSlot); + if (objectSlot < 0) { ASSERT(0, "0", "../z_item_etcetera.c", 241); } else { - this->objBankIndex = objBankIndex; + this->requiredObjectSlot = objectSlot; } this->giDrawId = sDrawItemIndices[type]; this->getItemId = sGetItemIds[type]; this->futureActionFunc = func_80B85824; this->drawFunc = ItemEtcetera_Draw; Actor_SetScale(&this->actor, 0.25f); - ItemEtcetera_SetupAction(this, func_80B857D0); + ItemEtcetera_SetupAction(this, ItemEtcetera_WaitForObject); switch (type) { case ITEM_ETC_LETTER: Actor_SetScale(&this->actor, 0.5f); @@ -142,9 +142,9 @@ void ItemEtcetera_Init(Actor* thisx, PlayState* play) { void ItemEtcetera_Destroy(Actor* thisx, PlayState* play) { } -void func_80B857D0(ItemEtcetera* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { - this->actor.objBankIndex = this->objBankIndex; +void ItemEtcetera_WaitForObject(ItemEtcetera* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { + this->actor.objectSlot = this->requiredObjectSlot; this->actor.draw = this->drawFunc; this->actionFunc = this->futureActionFunc; } diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h index cb881828e..a77192c79 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h @@ -13,7 +13,7 @@ typedef struct ItemEtcetera { /* 0x014C */ ItemEtceteraActionFunc futureActionFunc; /* 0x0150 */ s16 giDrawId; /* 0x0152 */ s16 getItemId; - /* 0x0154 */ u8 objBankIndex; + /* 0x0154 */ u8 requiredObjectSlot; /* 0x0158 */ ActorFunc drawFunc; /* 0x015C */ ItemEtceteraActionFunc actionFunc; } ItemEtcetera; // size = 0x0160 diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index d720145e2..f6c7f8004 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -135,8 +135,8 @@ void ObjTsubo_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); return; } - this->objTsuboBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[(this->actor.params >> 8) & 1]); - if (this->objTsuboBankIndex < 0) { + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[(this->actor.params >> 8) & 1]); + if (this->requiredObjectSlot < 0) { osSyncPrintf("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", this->actor.params, "../z_obj_tsubo.c", 410); Actor_Kill(&this->actor); } else { @@ -221,9 +221,9 @@ void ObjTsubo_SetupWaitForObject(ObjTsubo* this) { } void ObjTsubo_WaitForObject(ObjTsubo* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->objTsuboBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { this->actor.draw = ObjTsubo_Draw; - this->actor.objBankIndex = this->objTsuboBankIndex; + this->actor.objectSlot = this->requiredObjectSlot; ObjTsubo_SetupIdle(this); this->actor.flags &= ~ACTOR_FLAG_4; } diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h index 62ea296f8..aa30398c7 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h @@ -12,7 +12,7 @@ typedef struct ObjTsubo { /* 0x0000 */ Actor actor; /* 0x014C */ ObjTsuboActionFunc actionFunc; /* 0x0150 */ ColliderCylinder collider; - /* 0x019C */ s8 objTsuboBankIndex; + /* 0x019C */ s8 requiredObjectSlot; } ObjTsubo; // size = 0x01A0 #endif diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index bb9e3d5e3..48e1a1ebb 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -776,21 +776,21 @@ void ObjectKankyo_DrawLightning(Actor* thisx, PlayState* play) { } void ObjectKankyo_SunGraveSparkInit(ObjectKankyo* this, PlayState* play) { - s32 objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_SPOT02_OBJECTS); + s32 objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_SPOT02_OBJECTS); - if (objBankIndex < 0) { + if (objectSlot < 0) { ASSERT(0, "0", "../z_object_kankyo.c", 1251); } else { - this->requiredObjBankIndex = objBankIndex; + this->requiredObjectSlot = objectSlot; } ObjectKankyo_SetupAction(this, ObjectKankyo_WaitForSunGraveSparkObject); } void ObjectKankyo_WaitForSunGraveSparkObject(ObjectKankyo* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { this->requiredObjectLoaded = true; this->effects[0].alpha = 0; - this->actor.objBankIndex = this->requiredObjBankIndex; + this->actor.objectSlot = this->requiredObjectSlot; this->effects[0].size = 7.0f; ObjectKankyo_SetupAction(this, ObjectKankyo_SunGraveSpark); } @@ -875,20 +875,20 @@ void ObjectKankyo_DrawSunGraveSpark(Actor* thisx, PlayState* play2) { } void ObjectKankyo_InitBeams(ObjectKankyo* this, PlayState* play) { - s32 objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_DEMO_KEKKAI); + s32 objectIndex = Object_GetSlot(&play->objectCtx, OBJECT_DEMO_KEKKAI); if (objectIndex < 0) { ASSERT(0, "0", "../z_object_kankyo.c", 1449); } else { - this->requiredObjBankIndex = objectIndex; + this->requiredObjectSlot = objectIndex; } ObjectKankyo_SetupAction(this, ObjectKankyo_WaitForBeamObject); } void ObjectKankyo_WaitForBeamObject(ObjectKankyo* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { this->requiredObjectLoaded = true; - this->actor.objBankIndex = this->requiredObjBankIndex; + this->actor.objectSlot = this->requiredObjectSlot; ObjectKankyo_SetupAction(this, ObjectKankyo_Beams); } } diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h index 48a2c9d27..4449fa013 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h @@ -30,7 +30,7 @@ typedef struct ObjectKankyo { /* 0x0000 */ Actor actor; /* 0x014C */ ObjectKankyoEffect effects[64]; /* 0x164C */ Vec3f prevEyePos; - /* 0x1658 */ u8 requiredObjBankIndex; + /* 0x1658 */ u8 requiredObjectSlot; /* 0x1659 */ u8 requiredObjectLoaded; /* 0x165C */ ObjectKankyoActionFunc actionFunc; } ObjectKankyo; // size = 0x1660 diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 7519787de..befd4adfb 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -11061,7 +11061,7 @@ void Player_Update(Actor* thisx, PlayState* play) { if (func_8084FCAC(this, play)) { if (gSaveContext.dogParams < 0) { - if (Object_GetIndex(&play->objectCtx, OBJECT_DOG) < 0) { + if (Object_GetSlot(&play->objectCtx, OBJECT_DOG) < 0) { gSaveContext.dogParams = 0; } else { gSaveContext.dogParams &= 0x7FFF; diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c index b52bdfb79..1ba2d700e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c @@ -15,7 +15,7 @@ #define rPrimColorA regs[5] #define rFadeDelay regs[6] #define rScaleStep regs[9] -#define rObjBankIdx regs[10] +#define rObjectSlot regs[10] #define rYAccelStep regs[11] // has no effect due to how it's implemented u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); @@ -29,9 +29,9 @@ EffectSsInit Effect_Ss_D_Fire_InitVars = { u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsDFireInitParams* initParams = (EffectSsDFireInitParams*)initParamsx; - s32 objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_DODONGO); + s32 objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_DODONGO); - if (objBankIndex >= 0) { + if (objectSlot >= 0) { this->pos = initParams->pos; this->velocity = initParams->velocity; this->accel = initParams->accel; @@ -45,7 +45,7 @@ u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initPar this->rScale = initParams->scale; this->rScaleStep = initParams->scaleStep; this->rYAccelStep = 0; - this->rObjBankIdx = objBankIndex; + this->rObjectSlot = objectSlot; this->draw = EffectSsDFire_Draw; this->update = EffectSsDFire_Update; this->rTexIndex = ((s16)(play->state.frames % 4) ^ 3); @@ -70,17 +70,17 @@ void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) { MtxF mfResult; MtxF mfTransBillboard; s32 pad; - void* object; + void* objectPtr; Mtx* mtx; f32 scale; - object = play->objectCtx.status[this->rObjBankIdx].segment; + objectPtr = play->objectCtx.slots[this->rObjectSlot].segment; OPEN_DISPS(gfxCtx, "../z_eff_ss_d_fire.c", 276); - if (Object_GetIndex(&play->objectCtx, OBJECT_DODONGO) > -1) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(object); - gSPSegment(POLY_XLU_DISP++, 0x06, object); + if (Object_GetSlot(&play->objectCtx, OBJECT_DODONGO) >= 0) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); scale = this->rScale / 100.0f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); @@ -95,7 +95,7 @@ void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, this->rPrimColorA); - gSegments[6] = VIRTUAL_TO_PHYSICAL(object); + gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sTextures[this->rTexIndex])); gSPDisplayList(POLY_XLU_DISP++, this->gfx); } diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c index fc096037e..b1e14efde 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c @@ -7,7 +7,7 @@ #include "z_eff_ss_extra.h" #include "assets/objects/object_yabusame_point/object_yabusame_point.h" -#define rObjBankIdx regs[0] +#define rObjectSlot regs[0] #define rTimer regs[1] #define rScoreIdx regs[2] #define rScale regs[3] @@ -26,14 +26,14 @@ EffectSsInit Effect_Ss_Extra_InitVars = { u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsExtraInitParams* initParams = (EffectSsExtraInitParams*)initParamsx; s32 pad; - s32 objBankIndex; + s32 objectSlot; uintptr_t oldSeg6; - objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_YABUSAME_POINT); + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_YABUSAME_POINT); - if ((objBankIndex >= 0) && Object_IsLoaded(&play->objectCtx, objBankIndex)) { + if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { oldSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); this->pos = initParams->pos; this->velocity = initParams->velocity; this->accel = initParams->accel; @@ -43,7 +43,7 @@ u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initPar this->rScoreIdx = initParams->scoreIdx; this->rScale = initParams->scale; this->rTimer = 5; - this->rObjBankIdx = objBankIndex; + this->rObjectSlot = objectSlot; gSegments[6] = oldSeg6; return 1; @@ -61,12 +61,12 @@ static void* sTextures[] = { void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; f32 scale = this->rScale / 100.0f; - void* object = play->objectCtx.status[this->rObjBankIdx].segment; + void* objectPtr = play->objectCtx.slots[this->rObjectSlot].segment; OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_extra.c", 168); - gSegments[6] = VIRTUAL_TO_PHYSICAL(object); - gSPSegment(POLY_XLU_DISP++, 0x06, object); + gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); Gfx_SetupDL_25Xlu(play->state.gfxCtx); diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index 29451fdb4..96e789c79 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -9,7 +9,7 @@ #include "assets/objects/object_fhg/object_fhg.h" #define rAlpha regs[0] -#define rObjBankIdx regs[2] +#define rObjectSlot regs[2] #define rXZRot regs[3] #define rParam regs[4] #define rScale regs[8] @@ -32,18 +32,18 @@ static Gfx sShockDL[15]; u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsFhgFlashInitParams* initParams = (EffectSsFhgFlashInitParams*)initParamsx; s32 pad; - s32 objBankIdx; + s32 objectSlot; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f farAwayVec = { 0.0f, -1000.0f, 0.0f }; - uintptr_t oldSeg6; + uintptr_t prevSeg6; if (initParams->type == FHGFLASH_LIGHTBALL) { - objBankIdx = Object_GetIndex(&play->objectCtx, OBJECT_FHG); + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_FHG); - if ((objBankIdx > -1) && Object_IsLoaded(&play->objectCtx, objBankIdx)) { - oldSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIdx].segment); - this->rObjBankIdx = objBankIdx; + if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { + prevSeg6 = gSegments[6]; + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + this->rObjectSlot = objectSlot; this->pos = initParams->pos; this->velocity = initParams->velocity; this->accel = initParams->accel; @@ -54,7 +54,7 @@ u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* init this->draw = EffectSsFhgFlash_DrawLightBall; this->update = EffectSsFhgFlash_UpdateLightBall; this->gfx = SEGMENTED_TO_VIRTUAL(gPhantomEnergyBallDL); - gSegments[6] = oldSeg6; + gSegments[6] = prevSeg6; } else { osSyncPrintf("Effect_Ss_Fhg_Flash_ct():pffd->modeエラー\n"); return 0; @@ -89,17 +89,17 @@ void EffectSsFhgFlash_DrawLightBall(PlayState* play, u32 index, EffectSs* this) GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale; - void* object; + void* objectPtr; scale = this->rScale / 100.0f; - object = play->objectCtx.status[this->rObjBankIdx].segment; + objectPtr = play->objectCtx.slots[this->rObjectSlot].segment; OPEN_DISPS(gfxCtx, "../z_eff_fhg_flash.c", 268); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSegments[6] = VIRTUAL_TO_PHYSICAL(object); - gSPSegment(POLY_XLU_DISP++, 0x06, object); + gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); Gfx_SetupDL_25Xlu(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, this->rAlpha); gDPSetEnvColor(POLY_XLU_DISP++, sLightBallColors[this->rParam].r, sLightBallColors[this->rParam].g, diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c index b7cda8ced..244e9791b 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c @@ -17,7 +17,7 @@ #define rTimer regs[7] #define rUpdateRate regs[8] #define rDrawMode regs[9] -#define rObjBankIdx regs[10] +#define rObjectSlot regs[10] #define rScale regs[11] u32 EffectSsGMagma2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); @@ -38,15 +38,15 @@ EffectSsInit Effect_Ss_G_Magma2_InitVars = { }; u32 EffectSsGMagma2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { - s32 objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_KINGDODONGO); + s32 objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_KINGDODONGO); s32 pad; - if ((objBankIndex >= 0) && Object_IsLoaded(&play->objectCtx, objBankIndex)) { + if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; EffectSsGMagma2InitParams* initParams = (EffectSsGMagma2InitParams*)initParamsx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment); - this->rObjBankIdx = objBankIndex; + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + this->rObjectSlot = objectSlot; this->pos = initParams->pos; this->velocity = zeroVec; this->accel = zeroVec; @@ -75,17 +75,17 @@ void EffectSsGMagma2_Draw(PlayState* play, u32 index, EffectSs* this) { GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale; - void* object; + void* objectPtr; scale = this->rScale / 100.0f; - object = play->objectCtx.status[this->rObjBankIdx].segment; + objectPtr = play->objectCtx.slots[this->rObjectSlot].segment; OPEN_DISPS(gfxCtx, "../z_eff_ss_g_magma2.c", 261); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSegments[6] = VIRTUAL_TO_PHYSICAL(object); - gSPSegment(POLY_XLU_DISP++, 0x06, object); + gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_ss_g_magma2.c", 282), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c index 3315b5c0a..fe65984f5 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c @@ -7,7 +7,7 @@ #include "z_eff_ss_g_splash.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -//! @bug the reuse of regs[11] means that EffectSs_DrawGEffect will treat the type as an object bank index +//! @bug the reuse of regs[11] means that EffectSs_DrawGEffect will treat the type as an object slot (`rgObjectSlot`) // this ends up having no effect because the texture provided does not use segment 6 #define rType regs[11] diff --git a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c index a07d92482..951ab2406 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c +++ b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c @@ -12,7 +12,7 @@ #define rUnused regs[2] #define rScale regs[3] #define rObjId regs[4] -#define rObjBankIdx regs[5] +#define rObjectSlot regs[5] #define rMinLife regs[6] u32 EffectSsHahen_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); @@ -26,8 +26,8 @@ EffectSsInit Effect_Ss_Hahen_InitVars = { }; void EffectSsHahen_CheckForObject(EffectSs* this, PlayState* play) { - if (((this->rObjBankIdx = Object_GetIndex(&play->objectCtx, this->rObjId)) < 0) || - !Object_IsLoaded(&play->objectCtx, this->rObjBankIdx)) { + if (((this->rObjectSlot = Object_GetSlot(&play->objectCtx, this->rObjId)) < 0) || + !Object_IsLoaded(&play->objectCtx, this->rObjectSlot)) { this->life = -1; this->draw = NULL; } @@ -74,7 +74,7 @@ void EffectSsHahen_Draw(PlayState* play, u32 index, EffectSs* this) { OPEN_DISPS(gfxCtx, "../z_eff_hahen.c", 208); if (this->rObjId != -1) { - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->rObjectSlot].segment); } Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); @@ -98,7 +98,7 @@ void EffectSsHahen_DrawGray(PlayState* play, u32 index, EffectSs* this) { OPEN_DISPS(gfxCtx, "../z_eff_hahen.c", 253); if (this->rObjId != -1) { - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->rObjectSlot].segment); } Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c index b9693e1ec..8301fee44 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c @@ -7,7 +7,7 @@ #include "z_eff_ss_ice_smoke.h" #include "assets/objects/object_fz/object_fz.h" -#define rObjBankIdx regs[0] +#define rObjectSlot regs[0] #define rAlpha regs[1] #define rScale regs[2] @@ -23,24 +23,24 @@ EffectSsInit Effect_Ss_Ice_Smoke_InitVars = { u32 EffectSsIceSmoke_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsIceSmokeInitParams* initParams = (EffectSsIceSmokeInitParams*)initParamsx; s32 pad; - s32 objBankIdx; - uintptr_t oldSeg6; + s32 objectSlot; + uintptr_t prevSeg6; - objBankIdx = Object_GetIndex(&play->objectCtx, OBJECT_FZ); + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_FZ); - if ((objBankIdx > -1) && Object_IsLoaded(&play->objectCtx, objBankIdx)) { - oldSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIdx].segment); + if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { + prevSeg6 = gSegments[6]; + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); Math_Vec3f_Copy(&this->pos, &initParams->pos); Math_Vec3f_Copy(&this->velocity, &initParams->velocity); Math_Vec3f_Copy(&this->accel, &initParams->accel); - this->rObjBankIdx = objBankIdx; + this->rObjectSlot = objectSlot; this->rAlpha = 0; this->rScale = initParams->scale; this->life = 50; this->draw = EffectSsIceSmoke_Draw; this->update = EffectSsIceSmoke_Update; - gSegments[6] = oldSeg6; + gSegments[6] = prevSeg6; return 1; } @@ -52,22 +52,22 @@ u32 EffectSsIceSmoke_Init(PlayState* play, u32 index, EffectSs* this, void* init void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; - void* object; + void* objectPtr; Mtx* mtx; f32 scale; - s32 objBankIdx; + s32 objectSlot; - object = play->objectCtx.status[this->rObjBankIdx].segment; + objectPtr = play->objectCtx.slots[this->rObjectSlot].segment; OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_ice_smoke.c", 155); - objBankIdx = Object_GetIndex(&play->objectCtx, OBJECT_FZ); + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_FZ); - if ((objBankIdx > -1) && Object_IsLoaded(&play->objectCtx, objBankIdx)) { + if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { gDPPipeSync(POLY_XLU_DISP++); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - gSegments[6] = VIRTUAL_TO_PHYSICAL(object); - gSPSegment(POLY_XLU_DISP++, 0x06, object); + gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gFreezardSteamStartDL)); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 235, 235, this->rAlpha); @@ -93,11 +93,11 @@ void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this) { } void EffectSsIceSmoke_Update(PlayState* play, u32 index, EffectSs* this) { - s32 objBankIdx; + s32 objectSlot; - objBankIdx = Object_GetIndex(&play->objectCtx, OBJECT_FZ); + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_FZ); - if ((objBankIdx > -1) && Object_IsLoaded(&play->objectCtx, objBankIdx)) { + if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { if (this->rAlpha < 100) { this->rAlpha += 10; } diff --git a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c index 8a2d92418..ed7d96a72 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c +++ b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c @@ -17,7 +17,7 @@ #define rReg8 regs[8] #define rReg9 regs[9] #define rObjId regs[10] -#define rObjBankIdx regs[11] +#define rObjectSlot regs[11] #define rColorIdx regs[12] u32 EffectSsKakera_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); @@ -100,9 +100,9 @@ void EffectSsKakera_Draw(PlayState* play, u32 index, EffectSs* this) { if (this->rObjId != KAKERA_OBJECT_DEFAULT) { if ((((this->rReg4 >> 7) & 1) << 7) == 0x80) { - gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.slots[this->rObjectSlot].segment); } else { - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->rObjectSlot].segment); } } @@ -137,9 +137,9 @@ void EffectSsKakera_Draw(PlayState* play, u32 index, EffectSs* this) { } void func_809A9BA8(EffectSs* this, PlayState* play) { - this->rObjBankIdx = Object_GetIndex(&play->objectCtx, this->rObjId); + this->rObjectSlot = Object_GetSlot(&play->objectCtx, this->rObjId); - if ((this->rObjBankIdx < 0) || !Object_IsLoaded(&play->objectCtx, this->rObjBankIdx)) { + if ((this->rObjectSlot < 0) || !Object_IsLoaded(&play->objectCtx, this->rObjectSlot)) { this->life = 0; this->draw = NULL; } diff --git a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c index 44a3b42be..0c9f8b379 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c @@ -8,7 +8,7 @@ #include "assets/objects/object_link_boy/object_link_boy.h" #include "assets/objects/object_link_child/object_link_child.h" -#define rObjBankIdx regs[0] +#define rObjectSlot regs[0] #define rYaw regs[1] u32 EffectSsStick_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); @@ -21,7 +21,7 @@ EffectSsInit Effect_Ss_Stick_InitVars = { }; typedef struct { - /* 0x00 */ s16 objectID; + /* 0x00 */ s16 objectId; /* 0x04 */ Gfx* displayList; } StickDrawInfo; @@ -33,7 +33,7 @@ u32 EffectSsStick_Init(PlayState* play, u32 index, EffectSs* this, void* initPar StickDrawInfo* ageInfoEntry = gSaveContext.save.linkAge + drawInfo; EffectSsStickInitParams* initParams = (EffectSsStickInitParams*)initParamsx; - this->rObjBankIdx = Object_GetIndex(&play->objectCtx, ageInfoEntry->objectID); + this->rObjectSlot = Object_GetSlot(&play->objectCtx, ageInfoEntry->objectId); this->gfx = ageInfoEntry->displayList; this->vec = this->pos = initParams->pos; this->rYaw = initParams->yaw; @@ -67,7 +67,7 @@ void EffectSsStick_Draw(PlayState* play, u32 index, EffectSs* this) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_ss_stick.c", 176), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Gfx_SetupDL_25Opa(gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->rObjectSlot].segment); gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList); gSPDisplayList(POLY_OPA_DISP++, this->gfx); From 185c9cbf1aed3190f335fe6745cd220d2e0b2b62 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Tue, 19 Sep 2023 21:01:00 +0200 Subject: [PATCH 15/29] Run formatter (#1541) --- src/gcc_fix/missing_gcc_functions.c | 16 +++++----- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 3 +- .../ovl_En_Syateki_Niw/z_en_syateki_niw.c | 5 ++-- src/overlays/actors/ovl_Fishing/z_fishing.c | 29 ++++++++++--------- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/gcc_fix/missing_gcc_functions.c b/src/gcc_fix/missing_gcc_functions.c index c62418c7b..b4d87a892 100644 --- a/src/gcc_fix/missing_gcc_functions.c +++ b/src/gcc_fix/missing_gcc_functions.c @@ -47,7 +47,7 @@ u64 __fixunssfdi(f32 a) { u64 i; } m; - __asm__ ("cvt.l.s %0, %1" : "=f"(m.f) : "f"(a)); + __asm__("cvt.l.s %0, %1" : "=f"(m.f) : "f"(a)); return m.i; } return 0; @@ -61,7 +61,7 @@ u64 __fixunsdfdi(f64 a) { u64 i; } m; - __asm__ ("cvt.l.d %0, %1" : "=f"(m.f) : "f"(a)); + __asm__("cvt.l.d %0, %1" : "=f"(m.f) : "f"(a)); return m.i; } return 0; @@ -74,7 +74,7 @@ s64 __fixsfdi(f32 c) { s64 i; } m; - __asm__ ("cvt.l.s %0, %1" : "=f"(m.f) : "f"(c)); + __asm__("cvt.l.s %0, %1" : "=f"(m.f) : "f"(c)); return m.i; } @@ -85,7 +85,7 @@ s64 __fixdfdi(f64 c) { s64 i; } m; - __asm__ ("cvt.l.d %0, %1" : "=f"(m.f) : "f"(c)); + __asm__("cvt.l.d %0, %1" : "=f"(m.f) : "f"(c)); return m.i; } @@ -98,7 +98,7 @@ f32 __floatdisf(s64 c) { register f32 v; m.i = c; - __asm__ ("cvt.s.l %0, %1" : "=f"(v) : "f"(m.f)); + __asm__("cvt.s.l %0, %1" : "=f"(v) : "f"(m.f)); return v; } @@ -111,7 +111,7 @@ f64 __floatdidf(s64 c) { register f64 v; m.i = c; - __asm__ ("cvt.d.l %0, %1" : "=f"(v) : "f"(m.f)); + __asm__("cvt.d.l %0, %1" : "=f"(v) : "f"(m.f)); return v; } @@ -124,7 +124,7 @@ f32 __floatundisf(u64 c) { register f32 v; m.i = c; - __asm__ ("cvt.s.l %0, %1" : "=f"(v) : "f"(m.f)); + __asm__("cvt.s.l %0, %1" : "=f"(v) : "f"(m.f)); if ((s64)c < 0) { // cvt.s.l assumes signed input, adjust output v += 4294967296.0f; // 2^32 @@ -141,7 +141,7 @@ f64 __floatundidf(u64 c) { register f64 v; m.i = c; - __asm__ ("cvt.d.l %0, %1" : "=f"(v) : "f"(m.f)); + __asm__("cvt.d.l %0, %1" : "=f"(v) : "f"(m.f)); if ((s64)c < 0) { // cvt.d.l assumes signed input, adjust output v += 18446744073709551616.0; // 2^64 diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 2a5ee19bc..8fe6dfbb4 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -69,8 +69,7 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play2) { for (i = 0; i < 2; i++) { cucco = (EnSyatekiNiw*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SYATEKI_NIW, cuccoSpawnPos[i].x, - cuccoSpawnPos[i].y, cuccoSpawnPos[i].z, 0, 0, 0, - SYATEKI_MINIGAME_ALLEY); + cuccoSpawnPos[i].y, cuccoSpawnPos[i].z, 0, 0, 0, SYATEKI_MINIGAME_ALLEY); if (cucco != NULL) { cucco->scale = cuccoScales[i]; cucco->collider.dim.radius = (s16)cuccoColliderDims[i][0]; diff --git a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c index ff0f5f324..2393a679f 100644 --- a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c +++ b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c @@ -497,9 +497,8 @@ void EnSyatekiNiw_SetupRemove(EnSyatekiNiw* this, PlayState* play) { Actor_SetFocus(&this->actor, this->focusYOffset); Actor_GetScreenPos(play, &this->actor, &screenX, &screenY); - if ((this->actor.projectedPos.z > 200.0f) && (this->actor.projectedPos.z < 800.0f) - && (screenX > 0) && (screenX < SCREEN_WIDTH) && (screenY > 0) - && (screenY < SCREEN_HEIGHT)) { + if ((this->actor.projectedPos.z > 200.0f) && (this->actor.projectedPos.z < 800.0f) && (screenX > 0) && + (screenX < SCREEN_WIDTH) && (screenY > 0) && (screenY < SCREEN_HEIGHT)) { this->actor.speed = 5.0f; this->rotYFlip = Rand_ZeroFloat(1.99f); this->removeStateYaw = Rand_CenteredFloat(8000.0f) + -10000.0f; diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index ff5ed8eb4..e80494fd5 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -165,7 +165,7 @@ typedef enum { 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 u8 sIsOwnersHatSunk = false; // hat is sinking into pond. static s16 sRodCastState = 0; @@ -986,7 +986,7 @@ void Fishing_Init(Actor* thisx, PlayState* play2) { SkelAnime_Update(&this->skelAnime); - if (thisx->params == EN_FISH_AQUARIUM) { + if (thisx->params == EN_FISH_AQUARIUM) { this->fishState = 100; Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_PROP); thisx->targetMode = 0; @@ -2175,8 +2175,8 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { D_80B7E148 = 520.0f; sRodLineSpooled = 195.0f; - sRodCastState = sLureEquipped = sLureTimer = D_80B7E0B0 = D_80B7E0B2 = sRodCastTimer = sWiggleAttraction = D_80B7E114 = - D_80B7E150 = 0; + sRodCastState = sLureEquipped = sLureTimer = D_80B7E0B0 = D_80B7E0B2 = sRodCastTimer = sWiggleAttraction = + D_80B7E114 = D_80B7E150 = 0; sLure1Rotate = sReelLinePosStep = sLurePosZOffset = 0.0f; sLureLineSegPosDelta = zeroVec; @@ -2493,7 +2493,7 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { sLureRot.x = 0.0f; // lure hopping on land if (CHECK_BTN_ALL(input->press.button, BTN_B)) { - sRodLineSpooled += 6.0f; + sRodLineSpooled += 6.0f; Sfx_PlaySfxAtPos(&sSoundPos, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_SAND); } } else { @@ -2770,7 +2770,8 @@ void func_80B70ED4(Fishing* this, Input* input) { this->rotationStep = 28672.0f; this->speedTarget = 5.0f; } else { - if ((CHECK_BTN_ALL(input->cur.button, BTN_A) || (sLureWigglePosY > 1.0f)) && (lineLengthSQ < SQ(120.0f))) { + if ((CHECK_BTN_ALL(input->cur.button, BTN_A) || (sLureWigglePosY > 1.0f)) && + (lineLengthSQ < SQ(120.0f))) { this->fishState = 2; this->unk_15E = 0; this->timerArray[0] = 0; @@ -3061,7 +3062,8 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { Fishing_SpawnBubble(NULL, play->specialEffects, &bubblePos, Rand_ZeroFloat(0.02f) + 0.03f, 1); } - Math_ApproachS(&this->fishLimbEFRotYDelta, (Math_SinS(this->stateAndTimer * 0x800) * 2500.0f) + 2500.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; @@ -3907,12 +3909,12 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { 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 + targetPosOffset.y, 1.0f, - 6.0f); - Math_ApproachF(&this->actor.world.pos.z, player->bodyPartsPos[PLAYER_BODYPART_R_HAND].z + targetPosOffset.z, 1.0f, - 6.0f); + 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 + targetPosOffset.y, + 1.0f, 6.0f); + Math_ApproachF(&this->actor.world.pos.z, player->bodyPartsPos[PLAYER_BODYPART_R_HAND].z + targetPosOffset.z, + 1.0f, 6.0f); sRodLineSpooled = 188.0f; @@ -4175,7 +4177,6 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { Actor_PlaySfx(&this->actor, NA_SE_EV_FISH_LEAP); Fishing_SplashBySize2(this, play); - if (Rand_ZeroOne() < 0.5f) { this->rotationTarget.z = 0x4000; } else { From da3f4718f07bdf5af91ebf3dc5da190245ace2f9 Mon Sep 17 00:00:00 2001 From: fig02 Date: Tue, 19 Sep 2023 21:37:03 -0400 Subject: [PATCH 16/29] Player docs: Control Stick Input and Movement (#1539) * document input stuff and movement speed+yaw * curve -> curved, and other cleanups * fix + format * function declaration * name arguments * add mode descriptions * fix typos * move comment down --- include/functions.h | 2 +- include/z64player.h | 4 +- src/code/z_lib.c | 8 +- .../actors/ovl_player_actor/z_player.c | 528 ++++++++++-------- 4 files changed, 297 insertions(+), 245 deletions(-) diff --git a/include/functions.h b/include/functions.h index 1456c40c3..8ce39ff86 100644 --- a/include/functions.h +++ b/include/functions.h @@ -856,7 +856,7 @@ s32 Math_StepUntilS(s16* pValue, s16 limit, s16 step); s32 Math_StepToAngleS(s16* pValue, s16 target, s16 step); s32 Math_StepUntilF(f32* pValue, f32 limit, f32 step); s32 Math_AsymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep); -void func_80077D10(f32* arg0, s16* arg1, Input* input); +void Lib_GetControlStickData(f32* outMagnitude, s16* outAngle, Input* input); s16 Rand_S16Offset(s16 base, s16 range); void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src); void Math_Vec3s_ToVec3f(Vec3f* dest, Vec3s* src); diff --git a/include/z64player.h b/include/z64player.h index 7acac60ab..1796b47d8 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -758,8 +758,8 @@ typedef struct Player { /* 0x0A79 */ u8 floorTypeTimer; // counts up every frame the current floor type is the same as the last frame /* 0x0A7A */ u8 floorProperty; /* 0x0A7B */ u8 prevFloorType; - /* 0x0A7C */ f32 unk_A7C; - /* 0x0A80 */ s16 unk_A80; + /* 0x0A7C */ f32 prevControlStickMagnitude; + /* 0x0A80 */ s16 prevControlStickAngle; /* 0x0A82 */ u16 prevFloorSfxOffset; /* 0x0A84 */ s16 unk_A84; /* 0x0A86 */ s8 unk_A86; diff --git a/src/code/z_lib.c b/src/code/z_lib.c index 2e00bcd59..9857097a5 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -219,14 +219,14 @@ s32 Math_AsymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep) { return 0; } -void func_80077D10(f32* arg0, s16* arg1, Input* input) { +void Lib_GetControlStickData(f32* outMagnitude, s16* outAngle, Input* input) { f32 relX = input->rel.stick_x; f32 relY = input->rel.stick_y; - *arg0 = sqrtf(SQ(relX) + SQ(relY)); - *arg0 = (60.0f < *arg0) ? 60.0f : *arg0; + *outMagnitude = sqrtf(SQ(relX) + SQ(relY)); + *outMagnitude = (60.0f < *outMagnitude) ? 60.0f : *outMagnitude; - *arg1 = Math_Atan2S(relY, -relX); + *outAngle = Math_Atan2S(relY, -relX); } s16 Rand_S16Offset(s16 base, s16 range) { diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index befd4adfb..2123cbeb0 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -486,8 +486,8 @@ static PlayerAgeProperties sAgeProperties[] = { }; static u32 D_808535D0 = false; -static f32 D_808535D4 = 0.0f; -static s16 D_808535D8 = 0; +static f32 sControlStickMagnitude = 0.0f; +static s16 sControlStickAngle = 0; static s16 D_808535DC = 0; static s32 D_808535E0 = 0; static s32 sFloorType = FLOOR_TYPE_0; @@ -1712,9 +1712,10 @@ void func_80832564(PlayState* play, Player* this) { } s32 func_80832594(Player* this, s32 arg1, s32 arg2) { - s16 temp = this->unk_A80 - D_808535D8; + s16 controlStickAngleDiff = this->prevControlStickAngle - sControlStickAngle; - this->actionVar2 += arg1 + (s16)(ABS(temp) * fabsf(D_808535D4) * 2.5415802156203426e-06f); + this->actionVar2 += + arg1 + (s16)(ABS(controlStickAngleDiff) * fabsf(sControlStickMagnitude) * 2.5415802156203426e-06f); if (CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B)) { this->actionVar2 += 5; @@ -1991,24 +1992,24 @@ void Player_AnimReplaceNormalPlayLoopAdjusted(PlayState* play, Player* this, Lin ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE); } -void func_8083315C(PlayState* play, Player* this) { +void Player_ProcessControlStick(PlayState* play, Player* this) { s8 phi_v1; s8 phi_v0; - this->unk_A7C = D_808535D4; - this->unk_A80 = D_808535D8; + this->prevControlStickMagnitude = sControlStickMagnitude; + this->prevControlStickAngle = sControlStickAngle; - func_80077D10(&D_808535D4, &D_808535D8, sControlInput); + Lib_GetControlStickData(&sControlStickMagnitude, &sControlStickAngle, sControlInput); - D_808535DC = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)) + D_808535D8; + D_808535DC = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)) + sControlStickAngle; this->unk_846 = (this->unk_846 + 1) % 4; - if (D_808535D4 < 55.0f) { + if (sControlStickMagnitude < 55.0f) { phi_v0 = -1; phi_v1 = -1; } else { - phi_v1 = (u16)(D_808535D8 + 0x2000) >> 9; + phi_v1 = (u16)(sControlStickAngle + 0x2000) >> 9; phi_v0 = (u16)((s16)(D_808535DC - this->actor.shape.rot.y) + 0x2000) >> 14; } @@ -3549,75 +3550,124 @@ void func_80836BEC(Player* this, PlayState* play) { } } -s32 func_80836FAC(PlayState* play, Player* this, f32* arg2, s16* arg3, f32 arg4) { - f32 temp_f2; - f32 temp_f0; - f32 temp_f14; - f32 temp_f12; +/** + * These defines exist to simplify the variable used to toggle the different speed modes. + * While the `speedMode` variable is a float and can contain a non-boolean value, + * `Player_CalcSpeedAndYawFromControlStick` never actually uses the value for anything. + * It simply checks if the value is non-zero to toggle the "curved" mode. + * In practice, 0.0f or 0.018f are the only values passed to this function. + * + * It's clear that this value was intended to mean something in the curved mode calculation at + * some point in development, but was either never implemented or removed. + * + * To see the difference between linear and curved mode, with interactive toggles for + * speed cap and floor pitch, see the following desmos graph: https://www.desmos.com/calculator/hri7dcws4c + */ + +// Linear mode is a straight line, increasing target speed at a steady rate relative to the control stick magnitude +#define SPEED_MODE_LINEAR 0.0f + +// Curved mode drops any input below 20 units of magnitude, resulting in zero for target speed. +// Beyond 20 units, a gradual curve slowly moves up until around the 40 unit mark +// when target speed ramps up very quickly. +#define SPEED_MODE_CURVED 0.018f + +/** + * Calculates target speed and yaw based on input from the control stick. + * See `Player_GetMovementSpeedAndYaw` for detailed argument descriptions. + * + * @return true if the control stick has any magnitude, false otherwise. + */ +s32 Player_CalcSpeedAndYawFromControlStick(PlayState* play, Player* this, f32* outSpeedTarget, s16* outYawTarget, + f32 speedMode) { + f32 temp; + f32 sinFloorPitch; + f32 floorPitchInfluence; + f32 speedCap; if ((this->unk_6AD != 0) || (play->transitionTrigger == TRANS_TRIGGER_START) || (this->stateFlags1 & PLAYER_STATE1_0)) { - *arg2 = 0.0f; - *arg3 = this->actor.shape.rot.y; + *outSpeedTarget = 0.0f; + *outYawTarget = this->actor.shape.rot.y; } else { - *arg2 = D_808535D4; - *arg3 = D_808535D8; + *outSpeedTarget = sControlStickMagnitude; + *outYawTarget = sControlStickAngle; - if (arg4 != 0.0f) { - *arg2 -= 20.0f; - if (*arg2 < 0.0f) { - *arg2 = 0.0f; + // The value of `speedMode` is never actually used. It only toggles this condition. + // See the definition of `SPEED_MODE_LINEAR` and `SPEED_MODE_CURVED` for more information. + if (speedMode != SPEED_MODE_LINEAR) { + *outSpeedTarget -= 20.0f; + + if (*outSpeedTarget < 0.0f) { + // If control stick magnitude is below 20, return zero speed. + *outSpeedTarget = 0.0f; } else { - temp_f2 = 1.0f - Math_CosS(*arg2 * 450.0f); - *arg2 = ((temp_f2 * temp_f2) * 30.0f) + 7.0f; + // Cosine of the control stick magnitude isn't exactly meaningful, but + // it happens to give a desirable curve for grounded movement speed relative + // to control stick magnitude. + temp = 1.0f - Math_CosS(*outSpeedTarget * 450.0f); + *outSpeedTarget = (SQ(temp) * 30.0f) + 7.0f; } } else { - *arg2 *= 0.8f; + // Speed increases linearly relative to control stick magnitude + *outSpeedTarget *= 0.8f; } - if (D_808535D4 != 0.0f) { - temp_f0 = Math_SinS(this->floorPitch); - temp_f12 = this->unk_880; - temp_f14 = CLAMP(temp_f0, 0.0f, 0.6f); + if (sControlStickMagnitude != 0.0f) { + sinFloorPitch = Math_SinS(this->floorPitch); + speedCap = this->unk_880; + floorPitchInfluence = CLAMP(sinFloorPitch, 0.0f, 0.6f); if (this->unk_6C4 != 0.0f) { - temp_f12 = temp_f12 - (this->unk_6C4 * 0.008f); - if (temp_f12 < 2.0f) { - temp_f12 = 2.0f; - } + speedCap -= this->unk_6C4 * 0.008f; + speedCap = CLAMP_MIN(speedCap, 2.0f); } - *arg2 = (*arg2 * 0.14f) - (8.0f * temp_f14 * temp_f14); - *arg2 = CLAMP(*arg2, 0.0f, temp_f12); + *outSpeedTarget = (*outSpeedTarget * 0.14f) - (8.0f * floorPitchInfluence * floorPitchInfluence); + *outSpeedTarget = CLAMP(*outSpeedTarget, 0.0f, speedCap); - return 1; + return true; } } - return 0; + return false; } s32 func_8083721C(Player* this) { return Math_StepToF(&this->speedXZ, 0.0f, REG(43) / 100.0f); } -s32 func_80837268(Player* this, f32* arg1, s16* arg2, f32 arg3, PlayState* play) { - if (!func_80836FAC(play, this, arg1, arg2, arg3)) { - *arg2 = this->actor.shape.rot.y; +/** + * Gets target speed and yaw values for movement based on control stick input. + * Control stick magnitude and angle are processed in `Player_CalcSpeedAndYawFromControlStick` to get target values. + * Additionally, this function does extra processing on the target yaw value if the control stick is neutral. + * + * @param outSpeedTarget a pointer to the variable that will hold the resulting target speed value + * @param outYawTarget a pointer to the variable that will hold the resulting target yaw value + * @param speedMode toggles between a linear and curved mode for the speed value + * + * @see Player_CalcSpeedAndYawFromControlStick for more information on the linear vs curved speed mode. + * + * @return true if the control stick has any magnitude, false otherwise. + */ +s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYawTarget, f32 speedMode, + PlayState* play) { + if (!Player_CalcSpeedAndYawFromControlStick(play, this, outSpeedTarget, outYawTarget, speedMode)) { + *outYawTarget = this->actor.shape.rot.y; if (this->unk_664 != NULL) { if ((play->actorCtx.targetCtx.unk_4B != 0) && !(this->stateFlags2 & PLAYER_STATE2_6)) { - *arg2 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos); - return 0; + *outYawTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos); + return false; } } else if (func_80833B2C(this)) { - *arg2 = this->zTargetYaw; + *outYawTarget = this->zTargetYaw; } - return 0; + return false; } else { - *arg2 += Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); - return 1; + *outYawTarget += Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); + return true; } } @@ -3673,15 +3723,15 @@ s32 func_80837348(PlayState* play, Player* this, s8* arg2, s32 arg3) { } s32 func_808374A0(PlayState* play, Player* this, SkelAnime* skelAnime, f32 arg3) { - f32 sp24; - s16 sp22; + f32 speedTarget; + s16 yawTarget; if ((skelAnime->endFrame - arg3) <= skelAnime->curFrame) { if (func_80837348(play, this, D_80854418, 1)) { return 0; } - if (func_80837268(this, &sp24, &sp22, 0.018f, play)) { + if (Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play)) { return 1; } } @@ -7223,8 +7273,8 @@ void func_8084029C(Player* this, f32 arg1) { } void Player_Action_80840450(Player* this, PlayState* play) { - f32 sp44; - s16 sp42; + f32 speedTarget; + s16 yawTarget; s32 temp1; u32 temp2; s16 temp3; @@ -7258,27 +7308,27 @@ void Player_Action_80840450(Player* this, PlayState* play) { return; } - func_80837268(this, &sp44, &sp42, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - temp1 = func_8083FC68(this, sp44, sp42); + temp1 = func_8083FC68(this, speedTarget, yawTarget); if (temp1 > 0) { - func_8083C8DC(this, play, sp42); + func_8083C8DC(this, play, yawTarget); return; } if (temp1 < 0) { - func_8083CBF0(this, sp42, play); + func_8083CBF0(this, yawTarget, play); return; } - if (sp44 > 4.0f) { + if (speedTarget > 4.0f) { func_8083CC9C(this, play); return; } func_8084029C(this, (this->speedXZ * 0.3f) + 1.0f); - func_80840138(this, sp44, sp42); + func_80840138(this, speedTarget, yawTarget); temp2 = this->unk_868; if ((temp2 < 6) || ((temp2 - 0xE) < 6)) { @@ -7286,27 +7336,27 @@ void Player_Action_80840450(Player* this, PlayState* play) { return; } - temp3 = sp42 - this->yaw; + temp3 = yawTarget - this->yaw; temp4 = ABS(temp3); if (temp4 > 0x4000) { if (Math_StepToF(&this->speedXZ, 0.0f, 1.5f)) { - this->yaw = sp42; + this->yaw = yawTarget; } return; } - Math_AsymStepToF(&this->speedXZ, sp44 * 0.3f, 2.0f, 1.5f); + Math_AsymStepToF(&this->speedXZ, speedTarget * 0.3f, 2.0f, 1.5f); if (!(this->stateFlags3 & PLAYER_STATE3_3)) { - Math_ScaledStepToS(&this->yaw, sp42, temp4 * 0.1f); + Math_ScaledStepToS(&this->yaw, yawTarget, temp4 * 0.1f); } } } void Player_Action_808407CC(Player* this, PlayState* play) { - f32 sp3C; - s16 sp3A; + f32 speedTarget; + s16 yawTarget; s32 temp1; s16 temp2; s32 temp3; @@ -7335,35 +7385,35 @@ void Player_Action_808407CC(Player* this, PlayState* play) { return; } - func_80837268(this, &sp3C, &sp3A, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - temp1 = func_8083FD78(this, &sp3C, &sp3A, play); + temp1 = func_8083FD78(this, &speedTarget, &yawTarget, play); if (temp1 > 0) { - func_8083C8DC(this, play, sp3A); + func_8083C8DC(this, play, yawTarget); return; } if (temp1 < 0) { - func_8083CB2C(this, sp3A, play); + func_8083CB2C(this, yawTarget, play); return; } - if (sp3C > 4.9f) { + if (speedTarget > 4.9f) { func_8083CC9C(this, play); func_80833C3C(this); return; } - if (sp3C != 0.0f) { + if (speedTarget != 0.0f) { func_8083CB94(this, play); return; } - temp2 = sp3A - this->actor.shape.rot.y; + temp2 = yawTarget - this->actor.shape.rot.y; temp3 = ABS(temp2); if (temp3 > 800) { - func_8083CD54(play, this, sp3A); + func_8083CD54(play, this, yawTarget); } } } @@ -7419,8 +7469,8 @@ void func_808409CC(PlayState* play, Player* this) { void Player_Action_80840BC8(Player* this, PlayState* play) { s32 sp44; s32 sp40; - f32 sp3C; - s16 sp3A; + f32 speedTarget; + s16 yawTarget; s16 temp; sp44 = func_80833350(this); @@ -7457,20 +7507,20 @@ void Player_Action_80840BC8(Player* this, PlayState* play) { return; } - func_80837268(this, &sp3C, &sp3A, 0.018f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); - if (sp3C != 0.0f) { - func_8083C8DC(this, play, sp3A); + if (speedTarget != 0.0f) { + func_8083C8DC(this, play, yawTarget); return; } - temp = sp3A - this->actor.shape.rot.y; + temp = yawTarget - this->actor.shape.rot.y; if (ABS(temp) > 800) { - func_8083CD54(play, this, sp3A); + func_8083CD54(play, this, yawTarget); return; } - Math_ScaledStepToS(&this->actor.shape.rot.y, sp3A, 1200); + Math_ScaledStepToS(&this->actor.shape.rot.y, yawTarget, 1200); this->yaw = this->actor.shape.rot.y; if (func_80833338(this) == this->skelAnime.animation) { func_8083DC54(this, play); @@ -7482,8 +7532,8 @@ void Player_Action_80840BC8(Player* this, PlayState* play) { void Player_Action_80840DE4(Player* this, PlayState* play) { f32 frames; f32 coeff; - f32 sp44; - s16 sp42; + f32 speedTarget; + s16 yawTarget; s32 temp1; s16 temp2; s32 temp3; @@ -7530,42 +7580,42 @@ void Player_Action_80840DE4(Player* this, PlayState* play) { return; } - func_80837268(this, &sp44, &sp42, 0.0f, play); - temp1 = func_8083FD78(this, &sp44, &sp42, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + temp1 = func_8083FD78(this, &speedTarget, &yawTarget, play); if (temp1 > 0) { - func_8083C8DC(this, play, sp42); + func_8083C8DC(this, play, yawTarget); return; } if (temp1 < 0) { - func_8083CB2C(this, sp42, play); + func_8083CB2C(this, yawTarget, play); return; } - if (sp44 > 4.9f) { + if (speedTarget > 4.9f) { func_8083CC9C(this, play); func_80833C3C(this); return; } - if ((sp44 == 0.0f) && (this->speedXZ == 0.0f)) { + if ((speedTarget == 0.0f) && (this->speedXZ == 0.0f)) { func_80839F30(this, play); return; } - temp2 = sp42 - this->yaw; + temp2 = yawTarget - this->yaw; temp3 = ABS(temp2); if (temp3 > 0x4000) { if (Math_StepToF(&this->speedXZ, 0.0f, 1.5f)) { - this->yaw = sp42; + this->yaw = yawTarget; } return; } - Math_AsymStepToF(&this->speedXZ, sp44 * 0.4f, 1.5f, 1.5f); - Math_ScaledStepToS(&this->yaw, sp42, temp3 * 0.1f); + Math_AsymStepToF(&this->speedXZ, speedTarget * 0.4f, 1.5f, 1.5f); + Math_ScaledStepToS(&this->yaw, yawTarget, temp3 * 0.1f); } } @@ -7634,8 +7684,8 @@ s32 func_80841458(Player* this, f32* arg1, s16* arg2, PlayState* play) { } void Player_Action_808414F8(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; + f32 speedTarget; + s16 yawTarget; s32 sp2C; s16 sp2A; @@ -7647,26 +7697,26 @@ void Player_Action_808414F8(Player* this, PlayState* play) { return; } - func_80837268(this, &sp34, &sp32, 0.0f, play); - sp2C = func_8083FD78(this, &sp34, &sp32, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + sp2C = func_8083FD78(this, &speedTarget, &yawTarget, play); if (sp2C >= 0) { - if (!func_80841458(this, &sp34, &sp32, play)) { + if (!func_80841458(this, &speedTarget, &yawTarget, play)) { if (sp2C != 0) { func_8083C858(this, play); - } else if (sp34 > 4.9f) { + } else if (speedTarget > 4.9f) { func_8083CC9C(this, play); } else { func_8083CB94(this, play); } } } else { - sp2A = sp32 - this->yaw; + sp2A = yawTarget - this->yaw; - Math_AsymStepToF(&this->speedXZ, sp34 * 1.5f, 1.5f, 2.0f); - Math_ScaledStepToS(&this->yaw, sp32, sp2A * 0.1f); + Math_AsymStepToF(&this->speedXZ, speedTarget * 1.5f, 1.5f, 2.0f); + Math_ScaledStepToS(&this->yaw, yawTarget, sp2A * 0.1f); - if ((sp34 == 0.0f) && (this->speedXZ == 0.0f)) { + if ((speedTarget == 0.0f) && (this->speedXZ == 0.0f)) { func_80839F30(this, play); } } @@ -7680,21 +7730,21 @@ void func_808416C0(Player* this, PlayState* play) { void Player_Action_8084170C(Player* this, PlayState* play) { s32 sp34; - f32 sp30; - s16 sp2E; + f32 speedTarget; + s16 yawTarget; sp34 = LinkAnimation_Update(play, &this->skelAnime); func_8083721C(this); if (!func_80837348(play, this, D_80854400, 1)) { - func_80837268(this, &sp30, &sp2E, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (this->speedXZ == 0.0f) { this->yaw = this->actor.shape.rot.y; - if (func_8083FD78(this, &sp30, &sp2E, play) > 0) { + if (func_8083FD78(this, &speedTarget, &yawTarget, play) > 0) { func_8083C858(this, play); - } else if ((sp30 != 0.0f) || (sp34 != 0)) { + } else if ((speedTarget != 0.0f) || (sp34 != 0)) { func_808416C0(this, play); } } @@ -7727,8 +7777,8 @@ void func_80841860(PlayState* play, Player* this) { } void Player_Action_8084193C(Player* this, PlayState* play) { - f32 sp3C; - s16 sp3A; + f32 speedTarget; + s16 yawTarget; s32 temp1; s16 temp2; s32 temp3; @@ -7741,12 +7791,12 @@ void Player_Action_8084193C(Player* this, PlayState* play) { return; } - func_80837268(this, &sp3C, &sp3A, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (func_80833B2C(this)) { - temp1 = func_8083FD78(this, &sp3C, &sp3A, play); + temp1 = func_8083FD78(this, &speedTarget, &yawTarget, play); } else { - temp1 = func_8083FC68(this, sp3C, sp3A); + temp1 = func_8083FC68(this, speedTarget, yawTarget); } if (temp1 > 0) { @@ -7756,14 +7806,14 @@ void Player_Action_8084193C(Player* this, PlayState* play) { if (temp1 < 0) { if (func_80833B2C(this)) { - func_8083CB2C(this, sp3A, play); + func_8083CB2C(this, yawTarget, play); } else { - func_8083CBF0(this, sp3A, play); + func_8083CBF0(this, yawTarget, play); } return; } - if ((this->speedXZ < 3.6f) && (sp3C < 4.0f)) { + if ((this->speedXZ < 3.6f) && (speedTarget < 4.0f)) { if (!func_8008E9C4(this) && func_80833B2C(this)) { func_8083CB94(this, play); } else { @@ -7772,27 +7822,27 @@ void Player_Action_8084193C(Player* this, PlayState* play) { return; } - func_80840138(this, sp3C, sp3A); + func_80840138(this, speedTarget, yawTarget); - temp2 = sp3A - this->yaw; + temp2 = yawTarget - this->yaw; temp3 = ABS(temp2); if (temp3 > 0x4000) { if (Math_StepToF(&this->speedXZ, 0.0f, 3.0f) != 0) { - this->yaw = sp3A; + this->yaw = yawTarget; } return; } - sp3C *= 0.9f; - Math_AsymStepToF(&this->speedXZ, sp3C, 2.0f, 3.0f); - Math_ScaledStepToS(&this->yaw, sp3A, temp3 * 0.1f); + speedTarget *= 0.9f; + Math_AsymStepToF(&this->speedXZ, speedTarget, 2.0f, 3.0f); + Math_ScaledStepToS(&this->yaw, yawTarget, temp3 * 0.1f); } } void Player_Action_80841BA8(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; + f32 speedTarget; + s16 yawTarget; LinkAnimation_Update(play, &this->skelAnime); @@ -7803,13 +7853,13 @@ void Player_Action_80841BA8(Player* this, PlayState* play) { this->skelAnime.morphTable, sUpperBodyLimbCopyMap); } - func_80837268(this, &sp34, &sp32, 0.018f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); if (!func_80837348(play, this, D_80854414, 1)) { - if (sp34 != 0.0f) { - this->actor.shape.rot.y = sp32; + if (speedTarget != 0.0f) { + this->actor.shape.rot.y = yawTarget; func_8083C858(this, play); - } else if (Math_ScaledStepToS(&this->actor.shape.rot.y, sp32, this->unk_87E)) { + } else if (Math_ScaledStepToS(&this->actor.shape.rot.y, yawTarget, this->unk_87E)) { func_8083C0E8(this, play); } @@ -7915,8 +7965,8 @@ void func_80841EE4(Player* this, PlayState* play) { } void Player_Action_80842180(Player* this, PlayState* play) { - f32 sp2C; - s16 sp2A; + f32 speedTarget; + s16 yawTarget; this->stateFlags2 |= PLAYER_STATE2_5; func_80841EE4(this, play); @@ -7927,13 +7977,13 @@ void Player_Action_80842180(Player* this, PlayState* play) { return; } - func_80837268(this, &sp2C, &sp2A, 0.018f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); - if (!func_8083C484(this, &sp2C, &sp2A)) { - func_8083DF68(this, sp2C, sp2A); + if (!func_8083C484(this, &speedTarget, &yawTarget)) { + func_8083DF68(this, speedTarget, yawTarget); func_8083DDC8(this, play); - if ((this->speedXZ == 0.0f) && (sp2C == 0.0f)) { + if ((this->speedXZ == 0.0f) && (speedTarget == 0.0f)) { func_8083C0B8(this, play); } } @@ -7941,8 +7991,8 @@ void Player_Action_80842180(Player* this, PlayState* play) { } void Player_Action_8084227C(Player* this, PlayState* play) { - f32 sp2C; - s16 sp2A; + f32 speedTarget; + s16 yawTarget; this->stateFlags2 |= PLAYER_STATE2_5; func_80841EE4(this, play); @@ -7953,19 +8003,20 @@ void Player_Action_8084227C(Player* this, PlayState* play) { return; } - func_80837268(this, &sp2C, &sp2A, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - if (!func_8083C484(this, &sp2C, &sp2A)) { - if ((func_80833B2C(this) && (sp2C != 0.0f) && (func_8083FD78(this, &sp2C, &sp2A, play) <= 0)) || - (!func_80833B2C(this) && (func_8083FC68(this, sp2C, sp2A) <= 0))) { + if (!func_8083C484(this, &speedTarget, &yawTarget)) { + if ((func_80833B2C(this) && (speedTarget != 0.0f) && + (func_8083FD78(this, &speedTarget, &yawTarget, play) <= 0)) || + (!func_80833B2C(this) && (func_8083FC68(this, speedTarget, yawTarget) <= 0))) { func_80839F90(this, play); return; } - func_8083DF68(this, sp2C, sp2A); + func_8083DF68(this, speedTarget, yawTarget); func_8083DDC8(this, play); - if ((this->speedXZ == 0) && (sp2C == 0)) { + if ((this->speedXZ == 0) && (speedTarget == 0)) { func_80839F90(this, play); } } @@ -7974,8 +8025,8 @@ void Player_Action_8084227C(Player* this, PlayState* play) { void Player_Action_808423EC(Player* this, PlayState* play) { s32 sp34; - f32 sp30; - s16 sp2E; + f32 speedTarget; + s16 yawTarget; sp34 = LinkAnimation_Update(play, &this->skelAnime); @@ -7985,13 +8036,13 @@ void Player_Action_808423EC(Player* this, PlayState* play) { return; } - func_80837268(this, &sp30, &sp2E, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if ((this->skelAnime.morphWeight == 0.0f) && (this->skelAnime.curFrame > 5.0f)) { func_8083721C(this); - if ((this->skelAnime.curFrame > 10.0f) && (func_8083FC68(this, sp30, sp2E) < 0)) { - func_8083CBF0(this, sp2E, play); + if ((this->skelAnime.curFrame > 10.0f) && (func_8083FC68(this, speedTarget, yawTarget) < 0)) { + func_8083CBF0(this, yawTarget, play); return; } @@ -8004,25 +8055,25 @@ void Player_Action_808423EC(Player* this, PlayState* play) { void Player_Action_8084251C(Player* this, PlayState* play) { s32 sp34; - f32 sp30; - s16 sp2E; + f32 speedTarget; + s16 yawTarget; sp34 = LinkAnimation_Update(play, &this->skelAnime); func_8083721C(this); if (!func_80837348(play, this, D_80854440, 1)) { - func_80837268(this, &sp30, &sp2E, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (this->speedXZ == 0.0f) { this->yaw = this->actor.shape.rot.y; - if (func_8083FC68(this, sp30, sp2E) > 0) { + if (func_8083FC68(this, speedTarget, yawTarget) > 0) { func_8083C858(this, play); return; } - if ((sp30 != 0.0f) || (sp34 != 0)) { + if ((speedTarget != 0.0f) || (sp34 != 0)) { func_80839F90(this, play); } } @@ -8654,8 +8705,8 @@ void func_8084409C(PlayState* play, Player* this, f32 speedXZ, f32 velocityY) { } void Player_Action_8084411C(Player* this, PlayState* play) { - f32 sp4C; - s16 sp4A; + f32 speedTarget; + s16 yawTarget; if (gSaveContext.respawn[RESPAWN_MODE_TOP].data > 40) { this->actor.gravity = 0.0f; @@ -8663,7 +8714,7 @@ void Player_Action_8084411C(Player* this, PlayState* play) { this->actor.gravity = -1.2f; } - func_80837268(this, &sp4C, &sp4A, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->stateFlags1 & PLAYER_STATE1_11) { @@ -8678,7 +8729,7 @@ void Player_Action_8084411C(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); if (!(this->stateFlags2 & PLAYER_STATE2_19)) { - func_8083DFE0(this, &sp4C, &sp4A); + func_8083DFE0(this, &speedTarget, &yawTarget); } Player_UpdateUpperBody(this, play); @@ -8779,8 +8830,8 @@ void Player_Action_80844708(Player* this, PlayState* play) { s32 sp44; DynaPolyActor* wallPolyActor; s32 pad; - f32 sp38; - s16 sp36; + f32 speedTarget; + s16 yawTarget; this->stateFlags2 |= PLAYER_STATE2_5; @@ -8834,14 +8885,14 @@ void Player_Action_80844708(Player* this, PlayState* play) { return; } - func_80837268(this, &sp38, &sp36, 0.018f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); - sp38 *= 1.5f; - if ((sp38 < 3.0f) || (this->unk_84B[this->unk_846] != 0)) { - sp38 = 3.0f; + speedTarget *= 1.5f; + if ((speedTarget < 3.0f) || (this->unk_84B[this->unk_846] != 0)) { + speedTarget = 3.0f; } - func_8083DF68(this, sp38, this->actor.shape.rot.y); + func_8083DF68(this, speedTarget, this->actor.shape.rot.y); if (func_8084269C(play, this)) { func_8002F8F0(&this->actor, NA_SE_PL_ROLL_DUST - SFX_FLAG); @@ -8869,8 +8920,8 @@ void Player_Action_80844A44(Player* this, PlayState* play) { } void Player_Action_80844AF4(Player* this, PlayState* play) { - f32 sp2C; - s16 sp2A; + f32 speedTarget; + s16 yawTarget; this->stateFlags2 |= PLAYER_STATE2_5; @@ -8881,8 +8932,8 @@ void Player_Action_80844AF4(Player* this, PlayState* play) { func_8084285C(this, 6.0f, 7.0f, 99.0f); if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - func_80837268(this, &sp2C, &sp2A, 0.0f, play); - func_8083DFE0(this, &sp2C, &this->yaw); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + func_8083DFE0(this, &speedTarget, &this->yaw); return; } @@ -8950,8 +9001,8 @@ void func_80844E3C(Player* this) { } void Player_Action_80844E68(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; + f32 speedTarget; + s16 yawTarget; s32 temp; this->stateFlags1 |= PLAYER_STATE1_12; @@ -8977,9 +9028,9 @@ void Player_Action_80844E68(Player* this, PlayState* play) { func_80844D68(this, play); } } else if (!func_80844BE4(this, play)) { - func_80837268(this, &sp34, &sp32, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - temp = func_80840058(this, &sp34, &sp32, play); + temp = func_80840058(this, &speedTarget, &yawTarget, play); if (temp > 0) { func_80844CF8(this, play); } else if (temp < 0) { @@ -8994,8 +9045,8 @@ void Player_Action_80845000(Player* this, PlayState* play) { s32 temp2; f32 sp5C; f32 sp58; - f32 sp54; - s16 sp52; + f32 speedTarget; + s16 yawTarget; s32 temp4; s16 temp5; s32 sp44; @@ -9024,9 +9075,9 @@ void Player_Action_80845000(Player* this, PlayState* play) { if (!func_80842964(this, play) && !func_80844BE4(this, play)) { func_80844E3C(this); - func_80837268(this, &sp54, &sp52, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - temp4 = func_80840058(this, &sp54, &sp52, play); + temp4 = func_80840058(this, &speedTarget, &yawTarget, play); if (temp4 < 0) { func_80844D30(this, play); @@ -9034,24 +9085,24 @@ void Player_Action_80845000(Player* this, PlayState* play) { } if (temp4 == 0) { - sp54 = 0.0f; - sp52 = this->yaw; + speedTarget = 0.0f; + yawTarget = this->yaw; } - temp5 = sp52 - this->yaw; + temp5 = yawTarget - this->yaw; sp44 = ABS(temp5); if (sp44 > 0x4000) { if (Math_StepToF(&this->speedXZ, 0.0f, 1.0f)) { - this->yaw = sp52; + this->yaw = yawTarget; } return; } - Math_AsymStepToF(&this->speedXZ, sp54 * 0.2f, 1.0f, 0.5f); - Math_ScaledStepToS(&this->yaw, sp52, sp44 * 0.1f); + Math_AsymStepToF(&this->speedXZ, speedTarget * 0.2f, 1.0f, 0.5f); + Math_ScaledStepToS(&this->yaw, yawTarget, sp44 * 0.1f); - if ((sp54 == 0.0f) && (this->speedXZ == 0.0f)) { + if ((speedTarget == 0.0f) && (this->speedXZ == 0.0f)) { func_80844DC8(this, play); } } @@ -9060,8 +9111,8 @@ void Player_Action_80845000(Player* this, PlayState* play) { void Player_Action_80845308(Player* this, PlayState* play) { f32 sp5C; f32 sp58; - f32 sp54; - s16 sp52; + f32 speedTarget; + s16 yawTarget; s32 temp4; s16 temp5; s32 sp44; @@ -9092,9 +9143,9 @@ void Player_Action_80845308(Player* this, PlayState* play) { if (!func_80842964(this, play) && !func_80844BE4(this, play)) { func_80844E3C(this); - func_80837268(this, &sp54, &sp52, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - temp4 = func_80840058(this, &sp54, &sp52, play); + temp4 = func_80840058(this, &speedTarget, &yawTarget, play); if (temp4 > 0) { func_80844CF8(this, play); @@ -9102,24 +9153,24 @@ void Player_Action_80845308(Player* this, PlayState* play) { } if (temp4 == 0) { - sp54 = 0.0f; - sp52 = this->yaw; + speedTarget = 0.0f; + yawTarget = this->yaw; } - temp5 = sp52 - this->yaw; + temp5 = yawTarget - this->yaw; sp44 = ABS(temp5); if (sp44 > 0x4000) { if (Math_StepToF(&this->speedXZ, 0.0f, 1.0f)) { - this->yaw = sp52; + this->yaw = yawTarget; } return; } - Math_AsymStepToF(&this->speedXZ, sp54 * 0.2f, 1.0f, 0.5f); - Math_ScaledStepToS(&this->yaw, sp52, sp44 * 0.1f); + Math_AsymStepToF(&this->speedXZ, speedTarget * 0.2f, 1.0f, 0.5f); + Math_ScaledStepToS(&this->yaw, yawTarget, sp44 * 0.1f); - if ((sp54 == 0.0f) && (this->speedXZ == 0.0f) && (sp5C == 0.0f)) { + if ((speedTarget == 0.0f) && (this->speedXZ == 0.0f) && (sp5C == 0.0f)) { func_80844DC8(this, play); } } @@ -9522,13 +9573,14 @@ void Player_Action_808464B0(Player* this, PlayState* play) { } void Player_Action_80846578(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; + f32 speedTarget; + s16 yawTarget; func_8083721C(this); if (LinkAnimation_Update(play, &this->skelAnime) || - ((this->skelAnime.curFrame >= 8.0f) && func_80837268(this, &sp34, &sp32, 0.018f, play))) { + ((this->skelAnime.curFrame >= 8.0f) && + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play))) { func_80839F90(this, play); return; } @@ -10934,7 +10986,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->stateFlags3 &= ~PLAYER_STATE3_4; func_80847298(this); - func_8083315C(play, this); + Player_ProcessControlStick(play, this); if (this->stateFlags1 & PLAYER_STATE1_27) { D_808535E8 = 0.5f; @@ -11551,8 +11603,8 @@ void Player_Action_8084B530(Player* this, PlayState* play) { } void Player_Action_8084B78C(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; + f32 speedTarget; + s16 yawTarget; s32 temp; this->stateFlags2 |= PLAYER_STATE2_0 | PLAYER_STATE2_6 | PLAYER_STATE2_8; @@ -11560,8 +11612,8 @@ void Player_Action_8084B78C(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (!func_8083F9D0(play, this)) { - func_80837268(this, &sp34, &sp32, 0.0f, play); - temp = func_8083FFB8(this, &sp34, &sp32); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + temp = func_8083FFB8(this, &speedTarget, &yawTarget); if (temp > 0) { func_8083FAB8(this, play); } else if (temp < 0) { @@ -11587,8 +11639,8 @@ static struct_80832924 D_80854870[] = { }; void Player_Action_8084B898(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; + f32 speedTarget; + s16 yawTarget; s32 temp; this->stateFlags2 |= PLAYER_STATE2_0 | PLAYER_STATE2_6 | PLAYER_STATE2_8; @@ -11605,8 +11657,8 @@ void Player_Action_8084B898(Player* this, PlayState* play) { func_8083F524(play, this); if (!func_8083F9D0(play, this)) { - func_80837268(this, &sp34, &sp32, 0.0f, play); - temp = func_8083FFB8(this, &sp34, &sp32); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + temp = func_8083FFB8(this, &speedTarget, &yawTarget); if (temp < 0) { func_8083FB14(this, play); } else if (temp == 0) { @@ -11631,8 +11683,8 @@ static Vec3f D_80854880 = { 0.0f, 26.0f, -40.0f }; void Player_Action_8084B9E4(Player* this, PlayState* play) { LinkAnimationHeader* anim; - f32 sp70; - s16 sp6E; + f32 speedTarget; + s16 yawTarget; s32 temp1; Vec3f sp5C; f32 temp2; @@ -11659,8 +11711,8 @@ void Player_Action_8084B9E4(Player* this, PlayState* play) { func_8083F524(play, this); if (!func_8083F9D0(play, this)) { - func_80837268(this, &sp70, &sp6E, 0.0f, play); - temp1 = func_8083FFB8(this, &sp70, &sp6E); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + temp1 = func_8083FFB8(this, &speedTarget, &yawTarget); if (temp1 > 0) { func_8083FAB8(this, play); } else if (temp1 == 0) { @@ -11686,8 +11738,8 @@ void Player_Action_8084B9E4(Player* this, PlayState* play) { } void Player_Action_8084BBE4(Player* this, PlayState* play) { - f32 sp3C; - s16 sp3A; + f32 speedTarget; + s16 yawTarget; LinkAnimationHeader* anim; f32 temp; @@ -11717,7 +11769,7 @@ void Player_Action_8084BBE4(Player* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->yaw, 0x800); if (this->actionVar1 != 0) { - func_80837268(this, &sp3C, &sp3A, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (this->unk_847[this->unk_846] >= 0) { if (this->actionVar1 > 0) { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_fall_up, this->modelAnimType); @@ -12377,8 +12429,8 @@ void func_8084D5CC(PlayState* play, Player* this) { } void Player_Action_8084D610(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; + f32 speedTarget; + s16 yawTarget; func_80832CB0(play, this, &gPlayerAnim_link_swimer_swim_wait); func_8084B000(this); @@ -12390,18 +12442,18 @@ void Player_Action_8084D610(Player* this, PlayState* play) { } if (this->currentBoots == PLAYER_BOOTS_IRON) { - sp34 = 0.0f; - sp32 = this->actor.shape.rot.y; + speedTarget = 0.0f; + yawTarget = this->actor.shape.rot.y; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_short_landing, this->modelAnimType), play); func_808328A0(this); } } else { - func_80837268(this, &sp34, &sp32, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - if (sp34 != 0.0f) { - s16 temp = this->actor.shape.rot.y - sp32; + if (speedTarget != 0.0f) { + s16 temp = this->actor.shape.rot.y - yawTarget; if ((ABS(temp) > 0x6000) && !Math_StepToF(&this->speedXZ, 0.0f, 1.0f)) { return; @@ -12410,12 +12462,12 @@ void Player_Action_8084D610(Player* this, PlayState* play) { if (func_80833C04(this)) { func_8084D5CC(play, this); } else { - func_8084D574(play, this, sp32); + func_8084D574(play, this, yawTarget); } } } - func_8084AEEC(this, &this->speedXZ, sp34, sp32); + func_8084AEEC(this, &this->speedXZ, speedTarget, yawTarget); } } @@ -12433,8 +12485,8 @@ void Player_Action_8084D7C4(Player* this, PlayState* play) { } void Player_Action_8084D84C(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; + f32 speedTarget; + s16 yawTarget; s16 temp; this->stateFlags2 |= PLAYER_STATE2_5; @@ -12443,16 +12495,16 @@ void Player_Action_8084D84C(Player* this, PlayState* play) { func_8084B000(this); if (!func_80837348(play, this, D_80854444, 1) && !func_8083D12C(play, this, sControlInput)) { - func_80837268(this, &sp34, &sp32, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - temp = this->actor.shape.rot.y - sp32; - if ((sp34 == 0.0f) || (ABS(temp) > 0x6000) || (this->currentBoots == PLAYER_BOOTS_IRON)) { + temp = this->actor.shape.rot.y - yawTarget; + if ((speedTarget == 0.0f) || (ABS(temp) > 0x6000) || (this->currentBoots == PLAYER_BOOTS_IRON)) { func_80838F18(play, this); } else if (func_80833C04(this)) { func_8084D5CC(play, this); } - func_8084D530(this, &this->speedXZ, sp34, sp32); + func_8084D530(this, &this->speedXZ, speedTarget, yawTarget); } } @@ -12495,33 +12547,33 @@ s32 func_8084D980(PlayState* play, Player* this, f32* arg2, s16* arg3) { } void Player_Action_8084DAB4(Player* this, PlayState* play) { - f32 sp2C; - s16 sp2A; + f32 speedTarget; + s16 yawTarget; func_8084B158(play, this, sControlInput, this->speedXZ); func_8084B000(this); if (!func_80837348(play, this, D_80854444, 1) && !func_8083D12C(play, this, sControlInput)) { - func_80837268(this, &sp2C, &sp2A, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - if (sp2C == 0.0f) { + if (speedTarget == 0.0f) { func_80838F18(play, this); } else if (!func_80833C04(this)) { - func_8084D574(play, this, sp2A); + func_8084D574(play, this, yawTarget); } else { - func_8084D980(play, this, &sp2C, &sp2A); + func_8084D980(play, this, &speedTarget, &yawTarget); } - func_8084D530(this, &this->speedXZ, sp2C, sp2A); + func_8084D530(this, &this->speedXZ, speedTarget, yawTarget); } } void func_8084DBC4(PlayState* play, Player* this, f32 arg2) { - f32 sp2C; - s16 sp2A; + f32 speedTarget; + s16 yawTarget; - func_80837268(this, &sp2C, &sp2A, 0.0f, play); - func_8084AEEC(this, &this->speedXZ, sp2C * 0.5f, sp2A); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + func_8084AEEC(this, &this->speedXZ, speedTarget * 0.5f, yawTarget); func_8084AEEC(this, &this->actor.velocity.y, arg2, this->yaw); } From 107c0288cc46e378c67dc4ae2e39cfd2e5fcbc25 Mon Sep 17 00:00:00 2001 From: Billy <1184136+philtyl@users.noreply.github.com> Date: Wed, 20 Sep 2023 01:41:42 +0000 Subject: [PATCH 17/29] Dekunut Salesman Docs (#1493) * Dekunut Salesman Docs * Update src/overlays/actors/ovl_En_Dns/z_en_dns.c Remove extra param from debug logging Co-authored-by: Dragorn421 * * Full Deku/Potion name usage * Dialog -> CanBuy * Revert debug logging symbols * Proper declaration spacing * Fix en_shopnuts header doc * Biz -> Business * Fix missed deku prefix's * Synchronize CanBuy sticks and nuts * Fix enum naming * Clarified CanBuy success values * anon review * fig review * macro changes * fix macro usage --------- Co-authored-by: Dragorn421 Co-authored-by: fig02 --- assets/xml/objects/object_shopnuts.xml | 46 +- include/z64save.h | 6 +- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 410 ++++++++++-------- src/overlays/actors/ovl_En_Dns/z_en_dns.h | 47 +- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 8 +- .../actors/ovl_En_Nutsball/z_en_nutsball.h | 10 + .../actors/ovl_En_Shopnuts/z_en_shopnuts.c | 91 ++-- .../actors/ovl_En_Shopnuts/z_en_shopnuts.h | 8 +- 8 files changed, 363 insertions(+), 263 deletions(-) diff --git a/assets/xml/objects/object_shopnuts.xml b/assets/xml/objects/object_shopnuts.xml index a4e12e38a..105ce8824 100644 --- a/assets/xml/objects/object_shopnuts.xml +++ b/assets/xml/objects/object_shopnuts.xml @@ -1,26 +1,26 @@ - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -54,14 +54,14 @@ - - + + - - - + + + diff --git a/include/z64save.h b/include/z64save.h index 3e006fa1e..4b2ca8e41 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -580,7 +580,7 @@ typedef enum { #define ITEMGETINF_08 0x08 #define ITEMGETINF_09 0x09 #define ITEMGETINF_0A 0x0A -#define ITEMGETINF_0B 0x0B +#define ITEMGETINF_DEKU_HEART_PIECE 0x0B #define ITEMGETINF_0C 0x0C #define ITEMGETINF_0D 0x0D #define ITEMGETINF_0E 0x0E @@ -750,8 +750,8 @@ typedef enum { #define INFTABLE_17F 0x17F #define INFTABLE_190 0x190 #define INFTABLE_191 0x191 -#define INFTABLE_192 0x192 -#define INFTABLE_193 0x193 +#define INFTABLE_HAS_DEKU_STICK_UPGRADE 0x192 +#define INFTABLE_HAS_DEKU_NUT_UPGRADE 0x193 #define INFTABLE_195 0x195 #define INFTABLE_196 0x196 #define INFTABLE_197 0x197 diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 124bf4e0e..67727d95f 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -1,11 +1,10 @@ /* * File: z_en_dns.c * Overlay: En_Dns - * Description: Deku Salesman + * Description: Deku Salesman - Sale Phase */ #include "z_en_dns.h" -#include "assets/objects/object_shopnuts/object_shopnuts.h" #include "terminal.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) @@ -15,33 +14,33 @@ void EnDns_Destroy(Actor* thisx, PlayState* play); void EnDns_Update(Actor* thisx, PlayState* play); void EnDns_Draw(Actor* thisx, PlayState* play); -u32 func_809EF5A4(EnDns* this); -u32 func_809EF658(EnDns* this); -u32 func_809EF70C(EnDns* this); -u32 func_809EF73C(EnDns* this); -u32 func_809EF800(EnDns* this); -u32 func_809EF854(EnDns* this); -u32 func_809EF8F4(EnDns* this); -u32 func_809EF9A4(EnDns* this); +u32 EnDns_CanBuyPrice(EnDns* this); +u32 EnDns_CanBuyDekuNuts(EnDns* this); +u32 EnDns_CanBuyDekuSticks(EnDns* this); +u32 EnDns_CanBuyDekuSeeds(EnDns* this); +u32 EnDns_CanBuyDekuShield(EnDns* this); +u32 EnDns_CanBuyBombs(EnDns* this); +u32 EnDns_CanBuyArrows(EnDns* this); +u32 EnDns_CanBuyBottle(EnDns* this); -void func_809EF9F8(EnDns* this); -void func_809EFA28(EnDns* this); -void func_809EFA58(EnDns* this); -void func_809EFA9C(EnDns* this); -void func_809EFACC(EnDns* this); -void func_809EFAFC(EnDns* this); -void func_809EFB40(EnDns* this); +void EnDns_PayPrice(EnDns* this); +void EnDns_PayForDekuNuts(EnDns* this); +void EnDns_PayForHeartPiece(EnDns* this); +void EnDns_PayForBombs(EnDns* this); +void EnDns_PayForArrows(EnDns* this); +void EnDns_PayForDekuStickUpgrade(EnDns* this); +void EnDns_PayForDekuNutUpgrade(EnDns* this); -void EnDns_SetupWait(EnDns* this, PlayState* play); -void EnDns_Wait(EnDns* this, PlayState* play); +void EnDns_SetupIdle(EnDns* this, PlayState* play); +void EnDns_Idle(EnDns* this, PlayState* play); void EnDns_Talk(EnDns* this, PlayState* play); -void func_809EFDD0(EnDns* this, PlayState* play); -void func_809EFEE8(EnDns* this, PlayState* play); -void func_809EFF50(EnDns* this, PlayState* play); -void func_809EFF98(EnDns* this, PlayState* play); -void func_809F008C(EnDns* this, PlayState* play); +void EnDns_OfferSaleItem(EnDns* this, PlayState* play); +void EnDns_SetupSale(EnDns* this, PlayState* play); +void EnDns_Sale(EnDns* this, PlayState* play); void EnDns_SetupBurrow(EnDns* this, PlayState* play); +void EnDns_SetupNoSaleBurrow(EnDns* this, PlayState* play); void EnDns_Burrow(EnDns* this, PlayState* play); +void EnDns_PostBurrow(EnDns* this, PlayState* play); ActorInit En_Dns_InitVars = { ACTOR_EN_DNS, @@ -74,44 +73,42 @@ static ColliderCylinderInitType1 sCylinderInit = { { 18, 32, 0, { 0, 0, 0 } }, }; -static u16 D_809F040C[] = { +static u16 sStartingTextIds[] = { 0x10A0, 0x10A1, 0x10A2, 0x10CA, 0x10CB, 0x10CC, 0x10CD, 0x10CE, 0x10CF, 0x10DC, 0x10DD, }; -// Debug text: "sells" { "Deku Nuts", "Deku Sticks", "Piece of Heart", "Deku Seeds", -// "Deku Shield", "Bombs", "Arrows", "Red Potion", -// "Green Potion", "Deku Stick Upgrade", "Deku Nut Upgrade" } -static char* D_809F0424[] = { - "デクの実売り ", "デクの棒売り ", "ハートの欠片売り ", "デクの種売り ", - "デクの盾売り ", "バクダン売り ", "矢売り ", "赤のくすり売り ", - "緑のくすり売り ", "デクの棒持てる数を増やす", "デクの実持てる数を増やす", +static char* sItemDebugTxt[] = { + "デクの実売り ", // "Deku Nuts" + "デクの棒売り ", // "Deku Sticks" + "ハートの欠片売り ", // "Piece of Heart" + "デクの種売り ", // "Deku Seeds" + "デクの盾売り ", // "Deku Shield" + "バクダン売り ", // "Bombs" + "矢売り ", // "Arrows" + "赤のくすり売り ", // "Red Potion" + "緑のくすり売り ", // "Green Potion" + "デクの棒持てる数を増やす", // "Deku Stick Upgrade" + "デクの実持てる数を増やす", // "Deku Nut Upgrade" }; -static DnsItemEntry D_809F0450 = { 20, 5, GI_DEKU_NUTS_5_2, func_809EF5A4, func_809EFA28 }; +static DnsItemEntry sItemDekuNuts = { 20, 5, GI_DEKU_NUTS_5_2, EnDns_CanBuyDekuNuts, EnDns_PayForDekuNuts }; +static DnsItemEntry sItemDekuSticks = { 15, 1, GI_DEKU_STICKS_1, EnDns_CanBuyDekuSticks, EnDns_PayPrice }; +static DnsItemEntry sItemHeartPiece = { 10, 1, GI_HEART_PIECE, EnDns_CanBuyPrice, EnDns_PayForHeartPiece }; +static DnsItemEntry sItemDekuSeeds = { 40, 30, GI_DEKU_SEEDS_30, EnDns_CanBuyDekuSeeds, EnDns_PayPrice }; +static DnsItemEntry sItemDekuShield = { 50, 1, GI_SHIELD_DEKU, EnDns_CanBuyDekuShield, EnDns_PayPrice }; +static DnsItemEntry sItemBombs = { 40, 5, GI_BOMBS_5, EnDns_CanBuyBombs, EnDns_PayForBombs }; +static DnsItemEntry sItemArrows = { 70, 20, GI_ARROWS_30, EnDns_CanBuyArrows, EnDns_PayForArrows }; +static DnsItemEntry sItemRedPotion = { 40, 1, GI_BOTTLE_POTION_RED, EnDns_CanBuyBottle, EnDns_PayPrice }; +static DnsItemEntry sItemGreenPotion = { 40, 1, GI_BOTTLE_POTION_GREEN, EnDns_CanBuyBottle, EnDns_PayPrice }; -static DnsItemEntry D_809F0460 = { 15, 1, GI_DEKU_STICKS_1, func_809EF658, func_809EF9F8 }; - -static DnsItemEntry D_809F0470 = { 10, 1, GI_HEART_PIECE, func_809EF70C, func_809EFA58 }; - -static DnsItemEntry D_809F0480 = { 40, 30, GI_DEKU_SEEDS_30, func_809EF73C, func_809EF9F8 }; - -static DnsItemEntry D_809F0490 = { 50, 1, GI_SHIELD_DEKU, func_809EF800, func_809EF9F8 }; - -static DnsItemEntry D_809F04A0 = { 40, 5, GI_BOMBS_5, func_809EF854, func_809EFA9C }; - -static DnsItemEntry D_809F04B0 = { 70, 20, GI_ARROWS_30, func_809EF8F4, func_809EFACC }; - -static DnsItemEntry D_809F04C0 = { 40, 1, GI_BOTTLE_POTION_RED, func_809EF9A4, func_809EF9F8 }; - -static DnsItemEntry D_809F04D0 = { 40, 1, GI_BOTTLE_POTION_GREEN, func_809EF9A4, func_809EF9F8 }; - -static DnsItemEntry D_809F04E0 = { 40, 1, GI_DEKU_STICK_UPGRADE_20, func_809EF70C, func_809EFAFC }; - -static DnsItemEntry D_809F04F0 = { 40, 1, GI_DEKU_NUT_UPGRADE_30, func_809EF70C, func_809EFB40 }; +static DnsItemEntry sItemDekuStickUpgrade = { 40, 1, GI_DEKU_STICK_UPGRADE_20, EnDns_CanBuyPrice, + EnDns_PayForDekuStickUpgrade }; +static DnsItemEntry sItemDekuNutUpgrade = { 40, 1, GI_DEKU_NUT_UPGRADE_30, EnDns_CanBuyPrice, + EnDns_PayForDekuNutUpgrade }; static DnsItemEntry* sItemEntries[] = { - &D_809F0450, &D_809F0460, &D_809F0470, &D_809F0480, &D_809F0490, &D_809F04A0, - &D_809F04B0, &D_809F04C0, &D_809F04D0, &D_809F04E0, &D_809F04F0, + &sItemDekuNuts, &sItemDekuSticks, &sItemHeartPiece, &sItemDekuSeeds, &sItemDekuShield, &sItemBombs, + &sItemArrows, &sItemRedPotion, &sItemGreenPotion, &sItemDekuStickUpgrade, &sItemDekuNutUpgrade, }; static InitChainEntry sInitChain[] = { @@ -120,51 +117,52 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; -typedef enum { - /* 0 */ ENDNS_ANIM_0, - /* 1 */ ENDNS_ANIM_1, - /* 2 */ ENDNS_ANIM_2 -} EnDnsAnimation; - static AnimationMinimalInfo sAnimationInfo[] = { { &gBusinessScrubNervousIdleAnim, ANIMMODE_LOOP, 0.0f }, - { &gBusinessScrubAnim_4404, ANIMMODE_ONCE, 0.0f }, + { &gBusinessScrubLeaveBurrowAnim, ANIMMODE_ONCE, 0.0f }, { &gBusinessScrubNervousTransitionAnim, ANIMMODE_ONCE, 0.0f }, }; void EnDns_Init(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; - if (this->actor.params < 0) { + if (DNS_GET_TYPE(&this->actor) < 0) { // "Function Error (Deku Salesman)" osSyncPrintf(VT_FGCOL(RED) "引数エラー(売りナッツ)[ arg_data = %d ]" VT_RST "\n", this->actor.params); Actor_Kill(&this->actor); return; } + // Sell Seeds instead of Arrows if Link is child - if ((this->actor.params == 0x0006) && (LINK_AGE_IN_YEARS == YEARS_CHILD)) { - this->actor.params = 0x0003; + if ((DNS_GET_TYPE(&this->actor) == DNS_TYPE_ARROWS_30) && (LINK_AGE_IN_YEARS == YEARS_CHILD)) { + DNS_GET_TYPE(&this->actor) = DNS_TYPE_DEKU_SEEDS_30; } + // "Deku Salesman" - osSyncPrintf(VT_FGCOL(GREEN) "◆◆◆ 売りナッツ『%s』 ◆◆◆" VT_RST "\n", D_809F0424[this->actor.params], - this->actor.params); + osSyncPrintf(VT_FGCOL(GREEN) "◆◆◆ 売りナッツ『%s』 ◆◆◆" VT_RST "\n", sItemDebugTxt[DNS_GET_TYPE(&this->actor)]); + Actor_ProcessInitChain(&this->actor, sInitChain); + SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim, - this->jointTable, this->morphTable, 18); + this->jointTable, this->morphTable, BUSINESS_SCRUB_LIMB_MAX); + Collider_InitCylinder(play, &this->collider); Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); - this->actor.textId = D_809F040C[this->actor.params]; + this->actor.textId = sStartingTextIds[DNS_GET_TYPE(&this->actor)]; Actor_SetScale(&this->actor, 0.01f); + this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->maintainCollider = 1; - this->standOnGround = 1; - this->dropCollectible = 0; + this->bumpOn = true; + this->standOnGround = true; + this->dropCollectible = false; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->actor.gravity = -1.0f; - this->dnsItemEntry = sItemEntries[this->actor.params]; - this->actionFunc = EnDns_SetupWait; + this->dnsItemEntry = sItemEntries[DNS_GET_TYPE(&this->actor)]; + + this->actionFunc = EnDns_SetupIdle; } void EnDns_Destroy(Actor* thisx, PlayState* play) { @@ -174,154 +172,175 @@ void EnDns_Destroy(Actor* thisx, PlayState* play) { } void EnDns_ChangeAnim(EnDns* this, u8 index) { - s16 frameCount; + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[index].animation); - frameCount = Animation_GetLastFrame(sAnimationInfo[index].animation); - this->unk_2BA = index; // Not used anywhere else? - Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, (f32)frameCount, + this->animIndex = index; + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, frameCount, sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } /* Item give checking functions */ -u32 func_809EF5A4(EnDns* this) { +u32 EnDns_CanBuyDekuNuts(EnDns* this) { if ((CUR_CAPACITY(UPG_DEKU_NUTS) != 0) && (AMMO(ITEM_DEKU_NUT) >= CUR_CAPACITY(UPG_DEKU_NUTS))) { - return 1; + return DNS_CANBUY_RESULT_CAPACITY_FULL; } + if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { - return 0; + return DNS_CANBUY_RESULT_NEED_RUPEES; } + if (Item_CheckObtainability(ITEM_DEKU_NUT) == ITEM_NONE) { - return 2; + return DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM; } - return 4; + + return DNS_CANBUY_RESULT_SUCCESS; } -u32 func_809EF658(EnDns* this) { +u32 EnDns_CanBuyDekuSticks(EnDns* this) { if ((CUR_CAPACITY(UPG_DEKU_STICKS) != 0) && (AMMO(ITEM_DEKU_STICK) >= CUR_CAPACITY(UPG_DEKU_STICKS))) { - return 1; + return DNS_CANBUY_RESULT_CAPACITY_FULL; } + if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { - return 0; + return DNS_CANBUY_RESULT_NEED_RUPEES; } + if (Item_CheckObtainability(ITEM_DEKU_STICK) == ITEM_NONE) { - return 2; + return DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM; } - return 4; + + return DNS_CANBUY_RESULT_SUCCESS; } -u32 func_809EF70C(EnDns* this) { +u32 EnDns_CanBuyPrice(EnDns* this) { if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { - return 0; + return DNS_CANBUY_RESULT_NEED_RUPEES; } - return 4; + + return DNS_CANBUY_RESULT_SUCCESS; } -u32 func_809EF73C(EnDns* this) { +u32 EnDns_CanBuyDekuSeeds(EnDns* this) { if (INV_CONTENT(ITEM_SLINGSHOT) == ITEM_NONE) { - return 3; + return DNS_CANBUY_RESULT_CANT_GET_NOW; } + if (AMMO(ITEM_SLINGSHOT) >= CUR_CAPACITY(UPG_BULLET_BAG)) { - return 1; + return DNS_CANBUY_RESULT_CAPACITY_FULL; } + if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { - return 0; + return DNS_CANBUY_RESULT_NEED_RUPEES; } + if (Item_CheckObtainability(ITEM_DEKU_SEEDS) == ITEM_NONE) { - return 2; + return DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM; } - return 4; + + return DNS_CANBUY_RESULT_SUCCESS; } -u32 func_809EF800(EnDns* this) { +u32 EnDns_CanBuyDekuShield(EnDns* this) { if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, EQUIP_INV_SHIELD_DEKU)) { - return 1; + return DNS_CANBUY_RESULT_CAPACITY_FULL; } + if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { - return 0; + return DNS_CANBUY_RESULT_NEED_RUPEES; } - return 4; + + return DNS_CANBUY_RESULT_SUCCESS; } -u32 func_809EF854(EnDns* this) { +u32 EnDns_CanBuyBombs(EnDns* this) { if (!CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { - return 3; + return DNS_CANBUY_RESULT_CANT_GET_NOW; } + if (AMMO(ITEM_BOMB) >= CUR_CAPACITY(UPG_BOMB_BAG)) { - return 1; + return DNS_CANBUY_RESULT_CAPACITY_FULL; } + if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { - return 0; + return DNS_CANBUY_RESULT_NEED_RUPEES; } - return 4; + + return DNS_CANBUY_RESULT_SUCCESS; } -u32 func_809EF8F4(EnDns* this) { +u32 EnDns_CanBuyArrows(EnDns* this) { if (Item_CheckObtainability(ITEM_BOW) == ITEM_NONE) { - return 3; + return DNS_CANBUY_RESULT_CANT_GET_NOW; } + if (AMMO(ITEM_BOW) >= CUR_CAPACITY(UPG_QUIVER)) { - return 1; + return DNS_CANBUY_RESULT_CAPACITY_FULL; } + if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { - return 0; + return DNS_CANBUY_RESULT_NEED_RUPEES; } - return 4; + + return DNS_CANBUY_RESULT_SUCCESS; } -u32 func_809EF9A4(EnDns* this) { +u32 EnDns_CanBuyBottle(EnDns* this) { if (!Inventory_HasEmptyBottle()) { - return 1; + return DNS_CANBUY_RESULT_CAPACITY_FULL; } + if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { - return 0; + return DNS_CANBUY_RESULT_NEED_RUPEES; } - return 4; + + return DNS_CANBUY_RESULT_SUCCESS; } /* Paying and flagging functions */ -void func_809EF9F8(EnDns* this) { +void EnDns_PayPrice(EnDns* this) { Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); } -void func_809EFA28(EnDns* this) { +void EnDns_PayForDekuNuts(EnDns* this) { Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); } -void func_809EFA58(EnDns* this) { - SET_ITEMGETINF(ITEMGETINF_0B); +void EnDns_PayForHeartPiece(EnDns* this) { + SET_ITEMGETINF(ITEMGETINF_DEKU_HEART_PIECE); Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); } -void func_809EFA9C(EnDns* this) { +void EnDns_PayForBombs(EnDns* this) { Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); } -void func_809EFACC(EnDns* this) { +void EnDns_PayForArrows(EnDns* this) { Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); } -void func_809EFAFC(EnDns* this) { - SET_INFTABLE(INFTABLE_192); +void EnDns_PayForDekuStickUpgrade(EnDns* this) { + SET_INFTABLE(INFTABLE_HAS_DEKU_STICK_UPGRADE); Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); } -void func_809EFB40(EnDns* this) { - SET_INFTABLE(INFTABLE_193); +void EnDns_PayForDekuNutUpgrade(EnDns* this) { + SET_INFTABLE(INFTABLE_HAS_DEKU_NUT_UPGRADE); Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); } -void EnDns_SetupWait(EnDns* this, PlayState* play) { +void EnDns_SetupIdle(EnDns* this, PlayState* play) { if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - this->actionFunc = EnDns_Wait; - EnDns_ChangeAnim(this, ENDNS_ANIM_0); + this->actionFunc = EnDns_Idle; + EnDns_ChangeAnim(this, DNS_ANIM_IDLE); } } -void EnDns_Wait(EnDns* this, PlayState* play) { +void EnDns_Idle(EnDns* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 2000, 0); this->actor.world.rot.y = this->actor.shape.rot.y; + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnDns_Talk; } else { @@ -340,41 +359,45 @@ void EnDns_Talk(EnDns* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: // OK - switch (this->dnsItemEntry->purchaseableCheck(this)) { - case 0: + switch (this->dnsItemEntry->canBuy(this)) { + case DNS_CANBUY_RESULT_NEED_RUPEES: Message_ContinueTextbox(play, 0x10A5); - this->actionFunc = func_809F008C; + this->actionFunc = EnDns_SetupNoSaleBurrow; break; - case 1: + + case DNS_CANBUY_RESULT_CAPACITY_FULL: Message_ContinueTextbox(play, 0x10A6); - this->actionFunc = func_809F008C; + this->actionFunc = EnDns_SetupNoSaleBurrow; break; - case 3: + + case DNS_CANBUY_RESULT_CANT_GET_NOW: Message_ContinueTextbox(play, 0x10DE); - this->actionFunc = func_809F008C; + this->actionFunc = EnDns_SetupNoSaleBurrow; break; - case 2: - case 4: + + case DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM: + case DNS_CANBUY_RESULT_SUCCESS: Message_ContinueTextbox(play, 0x10A7); - this->actionFunc = func_809EFEE8; + this->actionFunc = EnDns_SetupSale; break; } break; - case 1: // No way + + case 1: // "No" Message_ContinueTextbox(play, 0x10A4); - this->actionFunc = func_809F008C; + this->actionFunc = EnDns_SetupNoSaleBurrow; } } } -void func_809EFDD0(EnDns* this, PlayState* play) { - if (this->actor.params == 0x9) { +void EnDns_OfferSaleItem(EnDns* this, PlayState* play) { + if (DNS_GET_TYPE(&this->actor) == DNS_TYPE_DEKU_STICK_UPGRADE) { if (CUR_UPG_VALUE(UPG_DEKU_STICKS) < 2) { Actor_OfferGetItem(&this->actor, play, GI_DEKU_STICK_UPGRADE_20, 130.0f, 100.0f); } else { Actor_OfferGetItem(&this->actor, play, GI_DEKU_STICK_UPGRADE_30, 130.0f, 100.0f); } - } else if (this->actor.params == 0xA) { + } else if (DNS_GET_TYPE(&this->actor) == DNS_TYPE_DEKU_NUT_UPGRADE) { if (CUR_UPG_VALUE(UPG_DEKU_NUTS) < 2) { Actor_OfferGetItem(&this->actor, play, GI_DEKU_NUT_UPGRADE_30, 130.0f, 100.0f); } else { @@ -385,84 +408,85 @@ void func_809EFDD0(EnDns* this, PlayState* play) { } } -void func_809EFEE8(EnDns* this, PlayState* play) { +void EnDns_SetupSale(EnDns* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - func_809EFDD0(this, play); - this->actionFunc = func_809EFF50; + EnDns_OfferSaleItem(this, play); + this->actionFunc = EnDns_Sale; } } -void func_809EFF50(EnDns* this, PlayState* play) { +void EnDns_Sale(EnDns* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - this->actionFunc = func_809EFF98; - } else { - func_809EFDD0(this, play); - } -} - -void func_809EFF98(EnDns* this, PlayState* play) { - Player* player = GET_PLAYER(play); - - if (player->stateFlags1 & PLAYER_STATE1_10) { - if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - this->dnsItemEntry->setRupeesAndFlags(this); - this->dropCollectible = 1; - this->maintainCollider = 0; - this->actor.flags &= ~ACTOR_FLAG_0; - EnDns_ChangeAnim(this, ENDNS_ANIM_1); - this->actionFunc = EnDns_SetupBurrow; - } - } else { - this->dnsItemEntry->setRupeesAndFlags(this); - this->dropCollectible = 1; - this->maintainCollider = 0; - this->actor.flags &= ~ACTOR_FLAG_0; - EnDns_ChangeAnim(this, ENDNS_ANIM_1); - this->actionFunc = EnDns_SetupBurrow; - } -} - -void func_809F008C(EnDns* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - this->maintainCollider = 0; - this->actor.flags &= ~ACTOR_FLAG_0; - EnDns_ChangeAnim(this, ENDNS_ANIM_1); this->actionFunc = EnDns_SetupBurrow; + } else { + EnDns_OfferSaleItem(this, play); } } void EnDns_SetupBurrow(EnDns* this, PlayState* play) { - f32 frameCount = Animation_GetLastFrame(&gBusinessScrubAnim_4404); + Player* player = GET_PLAYER(play); - if (this->skelAnime.curFrame == frameCount) { - Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + if (player->stateFlags1 & PLAYER_STATE1_10) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { + this->dnsItemEntry->payment(this); + this->dropCollectible = true; + this->bumpOn = false; + this->actor.flags &= ~ACTOR_FLAG_0; + EnDns_ChangeAnim(this, DNS_ANIM_BURROW); + this->actionFunc = EnDns_Burrow; + } + } else { + this->dnsItemEntry->payment(this); + this->dropCollectible = true; + this->bumpOn = false; + this->actor.flags &= ~ACTOR_FLAG_0; + EnDns_ChangeAnim(this, DNS_ANIM_BURROW); + this->actionFunc = EnDns_Burrow; + } +} + +void EnDns_SetupNoSaleBurrow(EnDns* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { + this->bumpOn = false; + this->actor.flags &= ~ACTOR_FLAG_0; + EnDns_ChangeAnim(this, DNS_ANIM_BURROW); this->actionFunc = EnDns_Burrow; - this->standOnGround = 0; - this->yInitPos = this->actor.world.pos.y; } } void EnDns_Burrow(EnDns* this, PlayState* play) { - f32 depth; + f32 frameCount = Animation_GetLastFrame(&gBusinessScrubLeaveBurrowAnim); + + if (this->skelAnime.curFrame == frameCount) { + Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + this->actionFunc = EnDns_PostBurrow; + this->standOnGround = false; + this->yInitPos = this->actor.world.pos.y; + } +} + +void EnDns_PostBurrow(EnDns* this, PlayState* play) { + f32 depthInGround = this->yInitPos - this->actor.world.pos.y; Vec3f initPos; s32 i; - depth = this->yInitPos - this->actor.world.pos.y; if ((this->dustTimer & 3) == 0) { initPos.x = this->actor.world.pos.x; initPos.y = this->yInitPos; initPos.z = this->actor.world.pos.z; func_80028990(play, 20.0f, &initPos); } + this->actor.shape.rot.y += 0x2000; - // Drops only if you bought its item - if (depth > 400.0f) { + + if (depthInGround > 400.0f) { if (this->dropCollectible) { initPos.x = this->actor.world.pos.x; initPos.y = this->yInitPos; initPos.z = this->actor.world.pos.z; + for (i = 0; i < 3; i++) { Item_DropCollectible(play, &initPos, ITEM00_RECOVERY_HEART); } @@ -476,16 +500,20 @@ void EnDns_Update(Actor* thisx, PlayState* play) { s16 pad; this->dustTimer++; - this->actor.textId = D_809F040C[this->actor.params]; + this->actor.textId = sStartingTextIds[DNS_GET_TYPE(&this->actor)]; + Actor_SetFocus(&this->actor, 60.0f); Actor_SetScale(&this->actor, 0.01f); SkelAnime_Update(&this->skelAnime); Actor_MoveXZGravity(&this->actor); + this->actionFunc(this, play); + if (this->standOnGround) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_2); } - if (this->maintainCollider) { + + if (this->bumpOn) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.h b/src/overlays/actors/ovl_En_Dns/z_en_dns.h index 97acf8241..fe931bec3 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.h +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.h @@ -3,31 +3,62 @@ #include "ultra64.h" #include "global.h" +#include "assets/objects/object_shopnuts/object_shopnuts.h" + +#define DNS_GET_TYPE(thisx) ((thisx)->params) + +typedef enum { + /* 0 */ DNS_TYPE_DEKU_NUTS_5, + /* 1 */ DNS_TYPE_DEKU_STICKS_1, + /* 2 */ DNS_TYPE_HEART_PIECE, + /* 3 */ DNS_TYPE_DEKU_SEEDS_30, + /* 4 */ DNS_TYPE_DEKU_SHIELD, + /* 5 */ DNS_TYPE_BOMBS_5, + /* 6 */ DNS_TYPE_ARROWS_30, + /* 7 */ DNS_TYPE_RED_POTION, + /* 8 */ DNS_TYPE_GREEN_POTION, + /* 9 */ DNS_TYPE_DEKU_STICK_UPGRADE, + /* 10 */ DNS_TYPE_DEKU_NUT_UPGRADE +} EnDnsType; + +typedef enum { + /* 0 */ DNS_CANBUY_RESULT_NEED_RUPEES, + /* 1 */ DNS_CANBUY_RESULT_CAPACITY_FULL, + /* 2 */ DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM, + /* 3 */ DNS_CANBUY_RESULT_CANT_GET_NOW, + /* 4 */ DNS_CANBUY_RESULT_SUCCESS +} EnDnsCanBuyResult; + +typedef enum { + /* 0 */ DNS_ANIM_IDLE, + /* 1 */ DNS_ANIM_BURROW, + /* 2 */ DNS_ANIM_IDLE_TRANSITION +} EnDnsAnimation; struct EnDns; typedef void (*EnDnsActionFunc)(struct EnDns*, PlayState*); -typedef u32 (*EnDnsPurchaseableCheck)(struct EnDns*); -typedef void (*EnDnsSetRupeesAndFlags)(struct EnDns*); +typedef u32 (*EnDnsCanBuyFunc)(struct EnDns*); +typedef void (*EnDnsPaymentFunc)(struct EnDns*); typedef struct { /* 0x00 */ s16 itemPrice; /* 0x02 */ u16 itemAmount; /* 0x04 */ s32 getItemId; - /* 0x08 */ EnDnsPurchaseableCheck purchaseableCheck; - /* 0x0C */ EnDnsSetRupeesAndFlags setRupeesAndFlags; + /* 0x08 */ EnDnsCanBuyFunc canBuy; + /* 0x0C */ EnDnsPaymentFunc payment; } DnsItemEntry; // size = 0x10 typedef struct EnDns { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ Vec3s jointTable[18]; - /* 0x01FC */ Vec3s morphTable[18]; + /* 0x0190 */ Vec3s jointTable[BUSINESS_SCRUB_LIMB_MAX]; + /* 0x01FC */ Vec3s morphTable[BUSINESS_SCRUB_LIMB_MAX]; /* 0x0268 */ EnDnsActionFunc actionFunc; /* 0x026C */ ColliderCylinder collider; /* 0x02B8 */ s16 dustTimer; - /* 0x02BA */ u8 unk_2BA; - /* 0x02BB */ u8 maintainCollider; + /* 0x02BA */ u8 animIndex; // set but not read + /* 0x02BB */ u8 bumpOn; /* 0x02BC */ u8 standOnGround; /* 0x02BD */ u8 dropCollectible; /* 0x02C0 */ DnsItemEntry* dnsItemEntry; diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 5df876058..3e4902057 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -69,7 +69,7 @@ void EnNutsball_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 400.0f, ActorShadow_DrawCircle, 13.0f); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[this->actor.params]); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[NUTSBALL_GET_TYPE(&this->actor)]); if (this->requiredObjectSlot < 0) { Actor_Kill(&this->actor); @@ -165,16 +165,16 @@ void EnNutsball_Update(Actor* thisx, PlayState* play) { } void EnNutsball_Draw(Actor* thisx, PlayState* play) { - s32 pad; + EnNutsball* this = (EnNutsball*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_nutsball.c", 327); Gfx_SetupDL_25Opa(play->state.gfxCtx); Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - Matrix_RotateZ(thisx->home.rot.z * 9.58738e-05f, MTXMODE_APPLY); + Matrix_RotateZ(this->actor.home.rot.z * 9.58738e-05f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_nutsball.c", 333), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(POLY_OPA_DISP++, sDLists[thisx->params]); + gSPDisplayList(POLY_OPA_DISP++, sDLists[NUTSBALL_GET_TYPE(&this->actor)]); CLOSE_DISPS(play->state.gfxCtx, "../z_en_nutsball.c", 337); } diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h index 4dff4fa55..aaf85a657 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h @@ -4,6 +4,16 @@ #include "ultra64.h" #include "global.h" +#define NUTSBALL_GET_TYPE(thisx) ((thisx)->params) + +typedef enum { + /* 0 */ EN_NUTSBALL_TYPE_DEKUNUTS, + /* 1 */ EN_NUTSBALL_TYPE_HINTNUTS, + /* 2 */ EN_NUTSBALL_TYPE_SHOPNUTS, + /* 3 */ EN_NUTSBALL_TYPE_DNS, + /* 4 */ EN_NUTSBALL_TYPE_DNK +} EnNutsballType; + struct EnNutsball; typedef void (*EnNutsballActionFunc)(struct EnNutsball*, PlayState*); diff --git a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c index b6ed3d4ee..402d932c8 100644 --- a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c +++ b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c @@ -1,5 +1,10 @@ +/* + * File: z_en_shopnuts.c + * Overlay: En_Shopnuts + * Description: Deku Salesman - Attack Phase + */ + #include "z_en_shopnuts.h" -#include "assets/objects/object_shopnuts/object_shopnuts.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) @@ -8,10 +13,10 @@ void EnShopnuts_Destroy(Actor* thisx, PlayState* play); void EnShopnuts_Update(Actor* thisx, PlayState* play); void EnShopnuts_Draw(Actor* thisx, PlayState* play); -void EnShopnuts_SetupWait(EnShopnuts* this); -void EnShopnuts_Wait(EnShopnuts* this, PlayState* play); +void EnShopnuts_SetupIdle(EnShopnuts* this); +void EnShopnuts_Idle(EnShopnuts* this, PlayState* play); void EnShopnuts_LookAround(EnShopnuts* this, PlayState* play); -void EnShopnuts_Stand(EnShopnuts* this, PlayState* play); +void EnShopnuts_Peek(EnShopnuts* this, PlayState* play); void EnShopnuts_ThrowNut(EnShopnuts* this, PlayState* play); void EnShopnuts_Burrow(EnShopnuts* this, PlayState* play); void EnShopnuts_SpawnSalesman(EnShopnuts* this, PlayState* play); @@ -48,7 +53,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 40, 0, { 0, 0, 0 } }, }; -static CollisionCheckInfoInit sColChkInfoInit = { 1, 20, 40, 0xFE }; +static CollisionCheckInfoInit sColChkInfoInit = { 1, 20, 40, MASS_HEAVY }; static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BUSINESS_SCRUB, ICHAIN_CONTINUE), @@ -61,19 +66,23 @@ void EnShopnuts_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubAnim_4574, this->jointTable, - this->morphTable, 18); + + SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubPeekAnim, this->jointTable, + this->morphTable, BUSINESS_SCRUB_LIMB_MAX); + Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); Collider_UpdateCylinder(&this->actor, &this->collider); - if (((this->actor.params == 0x0002) && GET_ITEMGETINF(ITEMGETINF_0B)) || - ((this->actor.params == 0x0009) && GET_INFTABLE(INFTABLE_192)) || - ((this->actor.params == 0x000A) && GET_INFTABLE(INFTABLE_193))) { + if (((SHOPNUTS_GET_TYPE(&this->actor) == DNS_TYPE_HEART_PIECE) && GET_ITEMGETINF(ITEMGETINF_DEKU_HEART_PIECE)) || + ((SHOPNUTS_GET_TYPE(&this->actor) == DNS_TYPE_DEKU_STICK_UPGRADE) && + GET_INFTABLE(INFTABLE_HAS_DEKU_STICK_UPGRADE)) || + ((SHOPNUTS_GET_TYPE(&this->actor) == DNS_TYPE_DEKU_NUT_UPGRADE) && + GET_INFTABLE(INFTABLE_HAS_DEKU_NUT_UPGRADE))) { Actor_Kill(&this->actor); } else { - EnShopnuts_SetupWait(this); + EnShopnuts_SetupIdle(this); } } @@ -83,12 +92,12 @@ void EnShopnuts_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void EnShopnuts_SetupWait(EnShopnuts* this) { - Animation_PlayOnceSetSpeed(&this->skelAnime, &gBusinessScrubAnim_139C, 0.0f); +void EnShopnuts_SetupIdle(EnShopnuts* this) { + Animation_PlayOnceSetSpeed(&this->skelAnime, &gBusinessScrubInitialAnim, 0.0f); this->animFlagAndTimer = Rand_S16Offset(100, 50); this->collider.dim.height = 5; this->collider.base.acFlags &= ~AC_ON; - this->actionFunc = EnShopnuts_Wait; + this->actionFunc = EnShopnuts_Idle; } void EnShopnuts_SetupLookAround(EnShopnuts* this) { @@ -98,22 +107,24 @@ void EnShopnuts_SetupLookAround(EnShopnuts* this) { } void EnShopnuts_SetupThrowNut(EnShopnuts* this) { - Animation_PlayOnce(&this->skelAnime, &gBusinessScrubAnim_1EC); + Animation_PlayOnce(&this->skelAnime, &gBusinessScrubThrowNutAnim); this->actionFunc = EnShopnuts_ThrowNut; } -void EnShopnuts_SetupStand(EnShopnuts* this) { - Animation_MorphToLoop(&this->skelAnime, &gBusinessScrubAnim_4574, -3.0f); +void EnShopnuts_SetupPeek(EnShopnuts* this) { + Animation_MorphToLoop(&this->skelAnime, &gBusinessScrubPeekAnim, -3.0f); + if (this->actionFunc == EnShopnuts_ThrowNut) { this->animFlagAndTimer = 2 | 0x1000; // sets timer and flag } else { this->animFlagAndTimer = 1; } - this->actionFunc = EnShopnuts_Stand; + + this->actionFunc = EnShopnuts_Peek; } void EnShopnuts_SetupBurrow(EnShopnuts* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gBusinessScrubAnim_39C, -5.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &gBusinessScrubPeekBurrowAnim, -5.0f); Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DOWN); this->actionFunc = EnShopnuts_Burrow; } @@ -125,15 +136,17 @@ void EnShopnuts_SetupSpawnSalesman(EnShopnuts* this) { this->actionFunc = EnShopnuts_SpawnSalesman; } -void EnShopnuts_Wait(EnShopnuts* this, PlayState* play) { +void EnShopnuts_Idle(EnShopnuts* this, PlayState* play) { s32 hasSlowPlaybackSpeed = false; if (this->skelAnime.playSpeed < 0.5f) { hasSlowPlaybackSpeed = true; } + if (hasSlowPlaybackSpeed && (this->animFlagAndTimer != 0)) { this->animFlagAndTimer--; } + if (Animation_OnFrame(&this->skelAnime, 9.0f)) { this->collider.base.acFlags |= AC_ON; } else if (Animation_OnFrame(&this->skelAnime, 8.0f)) { @@ -149,7 +162,7 @@ void EnShopnuts_Wait(EnShopnuts* this, PlayState* play) { } else if ((this->animFlagAndTimer == 0) && (this->actor.xzDistToPlayer > 320.0f)) { EnShopnuts_SetupLookAround(this); } else { - EnShopnuts_SetupStand(this); + EnShopnuts_SetupPeek(this); } } if (hasSlowPlaybackSpeed && @@ -161,22 +174,27 @@ void EnShopnuts_Wait(EnShopnuts* this, PlayState* play) { void EnShopnuts_LookAround(EnShopnuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); + if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->animFlagAndTimer != 0)) { this->animFlagAndTimer--; } + if ((this->actor.xzDistToPlayer < 120.0f) || (this->animFlagAndTimer == 0)) { EnShopnuts_SetupBurrow(this); } } -void EnShopnuts_Stand(EnShopnuts* this, PlayState* play) { +void EnShopnuts_Peek(EnShopnuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); + if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->animFlagAndTimer != 0)) { this->animFlagAndTimer--; } + if (!(this->animFlagAndTimer & 0x1000)) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); } + if ((this->actor.xzDistToPlayer < 120.0f) || (this->animFlagAndTimer == 0x1000)) { EnShopnuts_SetupBurrow(this); } else if (this->animFlagAndTimer == 0) { @@ -188,16 +206,19 @@ void EnShopnuts_ThrowNut(EnShopnuts* this, PlayState* play) { Vec3f spawnPos; Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); + if (this->actor.xzDistToPlayer < 120.0f) { EnShopnuts_SetupBurrow(this); } else if (SkelAnime_Update(&this->skelAnime)) { - EnShopnuts_SetupStand(this); + EnShopnuts_SetupPeek(this); } else if (Animation_OnFrame(&this->skelAnime, 6.0f)) { spawnPos.x = this->actor.world.pos.x + (Math_SinS(this->actor.shape.rot.y) * 23.0f); spawnPos.y = this->actor.world.pos.y + 12.0f; spawnPos.z = this->actor.world.pos.z + (Math_CosS(this->actor.shape.rot.y) * 23.0f); + if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NUTSBALL, spawnPos.x, spawnPos.y, spawnPos.z, - this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 2) != NULL) { + this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, + EN_NUTSBALL_TYPE_SHOPNUTS) != NULL) { Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_THROW); } } @@ -205,10 +226,11 @@ void EnShopnuts_ThrowNut(EnShopnuts* this, PlayState* play) { void EnShopnuts_Burrow(EnShopnuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - EnShopnuts_SetupWait(this); + EnShopnuts_SetupIdle(this); } else { this->collider.dim.height = ((4.0f - CLAMP_MAX(this->skelAnime.curFrame, 4.0f)) * 10.0f) + 5.0f; } + if (Animation_OnFrame(&this->skelAnime, 4.0f)) { this->collider.base.acFlags &= ~AC_ON; } @@ -218,7 +240,7 @@ void EnShopnuts_SpawnSalesman(EnShopnuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_DNS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, - this->actor.params); + SHOPNUTS_GET_TYPE(&this->actor)); Actor_Kill(&this->actor); } else { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); @@ -239,18 +261,23 @@ void EnShopnuts_Update(Actor* thisx, PlayState* play) { EnShopnuts* this = (EnShopnuts*)thisx; EnShopnuts_ColliderCheck(this, play); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, UPDBGCHECKINFO_FLAG_2); + if (this->collider.base.acFlags & AC_ON) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - if (this->actionFunc == EnShopnuts_Wait) { + + if (this->actionFunc == EnShopnuts_Idle) { Actor_SetFocus(&this->actor, this->skelAnime.curFrame); } else if (this->actionFunc == EnShopnuts_Burrow) { - Actor_SetFocus(&this->actor, - 20.0f - ((this->skelAnime.curFrame * 20.0f) / Animation_GetLastFrame(&gBusinessScrubAnim_39C))); + Actor_SetFocus(&this->actor, 20.0f - ((this->skelAnime.curFrame * 20.0f) / + Animation_GetLastFrame(&gBusinessScrubPeekBurrowAnim))); } else { Actor_SetFocus(&this->actor, 20.0f); } @@ -259,21 +286,21 @@ void EnShopnuts_Update(Actor* thisx, PlayState* play) { s32 EnShopnuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnShopnuts* this = (EnShopnuts*)thisx; - if ((limbIndex == 9) && (this->actionFunc == EnShopnuts_ThrowNut)) { + if ((limbIndex == BUSINESS_SCRUB_LIMB_NOSE) && (this->actionFunc == EnShopnuts_ThrowNut)) { *dList = NULL; } + return 0; } void EnShopnuts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnShopnuts* this = (EnShopnuts*)thisx; - f32 curFrame; f32 x; f32 y; f32 z; - if ((limbIndex == 9) && (this->actionFunc == EnShopnuts_ThrowNut)) { + if ((limbIndex == BUSINESS_SCRUB_LIMB_NOSE) && (this->actionFunc == EnShopnuts_ThrowNut)) { OPEN_DISPS(play->state.gfxCtx, "../z_en_shopnuts.c", 682); curFrame = this->skelAnime.curFrame; if (curFrame <= 6.0f) { diff --git a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h index 6ebfeabf3..33971269f 100644 --- a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h +++ b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h @@ -3,9 +3,13 @@ #include "ultra64.h" #include "global.h" +#include "overlays/actors/ovl_En_Dns/z_en_dns.h" +#include "overlays/actors/ovl_En_Nutsball/z_en_nutsball.h" struct EnShopnuts; +#define SHOPNUTS_GET_TYPE(thisx) ((thisx)->params) + typedef void (*EnShopnutsActionFunc)(struct EnShopnuts*, PlayState*); typedef struct EnShopnuts { @@ -13,8 +17,8 @@ typedef struct EnShopnuts { /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnShopnutsActionFunc actionFunc; /* 0x0194 */ s16 animFlagAndTimer; // 0x1000 bit denotes that projectile has been thrown - /* 0x0196 */ Vec3s jointTable[18]; - /* 0x0202 */ Vec3s morphTable[18]; + /* 0x0196 */ Vec3s jointTable[BUSINESS_SCRUB_LIMB_MAX]; + /* 0x0202 */ Vec3s morphTable[BUSINESS_SCRUB_LIMB_MAX]; /* 0x0270 */ ColliderCylinder collider; } EnShopnuts; // size = 0x02BC From a8d670fe5c774a7259fb88045baaf878cfcff6af Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Thu, 21 Sep 2023 00:41:03 +1000 Subject: [PATCH 18/29] improve matches (#1542) --- .../actors/ovl_Demo_Kekkai/z_demo_kekkai.c | 85 ++++++++++--------- src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c | 79 ++++++++--------- src/overlays/actors/ovl_En_Fd/z_en_fd.c | 75 ++++++++-------- src/overlays/actors/ovl_En_Fw/z_en_fw.c | 41 ++++----- .../ovl_En_Ganon_Mant/z_en_ganon_mant.c | 6 +- 5 files changed, 146 insertions(+), 140 deletions(-) diff --git a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c index cd4597ecd..5cbb131e8 100644 --- a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c +++ b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c @@ -277,47 +277,52 @@ void DemoKekkai_DrawTrialBarrier(Actor* thisx, PlayState* play2) { Vtx* energyVtx = SEGMENTED_TO_VIRTUAL(gTrialBarrierEnergyVtx); s32 i; - if (this->orbScale != 0.0f) { - if (1) {} - alphas[2] = (s32)(this->energyAlpha * 202.0f); - alphas[1] = (s32)(this->energyAlpha * 126.0f); - alphas[0] = 0; - for (i = 0; i < 102; i++) { - energyVtx[i].v.cn[3] = alphas[alphaIndex[i]]; - } - colorIndex = (this->actor.params - 1) * 6; - OPEN_DISPS(play->state.gfxCtx, "../z_demo_kekkai.c", 632); - Gfx_SetupDL_25Xlu(play->state.gfxCtx); - Matrix_Push(); - Matrix_Translate(0.0f, 1200.0f, 0.0f, MTXMODE_APPLY); - Matrix_Scale(this->orbScale, this->orbScale, this->orbScale, MTXMODE_APPLY); - Matrix_Translate(0.0f, -1200.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kekkai.c", 639), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, frames * 5, frames * -10, 0x20, 0x20, 1, - frames * 5, frames * -10, 0x20, 0x20)); - gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierOrbDL); - Matrix_Pop(); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kekkai.c", 656), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 50, 0, 100, 255); - gSPSegment( - POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, frames, frames, 0x20, 0x20)); - gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierFloorDL); - gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, sEnergyColors[colorIndex + 0], sEnergyColors[colorIndex + 1], - sEnergyColors[colorIndex + 2], 255); - gDPSetEnvColor(POLY_XLU_DISP++, sEnergyColors[colorIndex + 3], sEnergyColors[colorIndex + 4], - sEnergyColors[colorIndex + 5], 128); - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, frames * 5, frames * -10, 0x20, 0x20, 1, - frames * 5, frames * -10, 0x20, 0x40)); - gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierEnergyDL); - CLOSE_DISPS(play->state.gfxCtx, "../z_demo_kekkai.c", 696); + if (this->orbScale == 0.0f) { + return; } + + alphas[2] = (s32)(this->energyAlpha * 202.0f); + alphas[1] = (s32)(this->energyAlpha * 126.0f); + alphas[0] = 0; + + for (i = 0; i < 102; i++) { + energyVtx[i].v.cn[3] = alphas[alphaIndex[i]]; + } + + colorIndex = (this->actor.params - 1) * 6; + + OPEN_DISPS(play->state.gfxCtx, "../z_demo_kekkai.c", 632); + + Gfx_SetupDL_25Xlu(play->state.gfxCtx); + Matrix_Push(); + Matrix_Translate(0.0f, 1200.0f, 0.0f, MTXMODE_APPLY); + Matrix_Scale(this->orbScale, this->orbScale, this->orbScale, MTXMODE_APPLY); + Matrix_Translate(0.0f, -1200.0f, 0.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kekkai.c", 639), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(POLY_XLU_DISP++, 0x09, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, frames * 5, frames * -10, 0x20, 0x20, 1, + frames * 5, frames * -10, 0x20, 0x20)); + gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierOrbDL); + Matrix_Pop(); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kekkai.c", 656), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPPipeSync(POLY_XLU_DISP++); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 50, 0, 100, 255); + gSPSegment(POLY_XLU_DISP++, 0x0A, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, frames, frames, 0x20, 0x20)); + gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierFloorDL); + gDPPipeSync(POLY_XLU_DISP++); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, sEnergyColors[colorIndex + 0], sEnergyColors[colorIndex + 1], + sEnergyColors[colorIndex + 2], 255); + gDPSetEnvColor(POLY_XLU_DISP++, sEnergyColors[colorIndex + 3], sEnergyColors[colorIndex + 4], + sEnergyColors[colorIndex + 5], 128); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, frames * 5, frames * -10, 0x20, 0x20, 1, + frames * 5, frames * -10, 0x20, 0x40)); + gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierEnergyDL); + + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_kekkai.c", 696); } void DemoKekkai_DrawTowerBarrier(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index 172dd438e..96c95aa74 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -281,26 +281,23 @@ void EffDust_DrawFunc_8099E4F4(Actor* thisx, PlayState* play2) { gSPSegment(POLY_XLU_DISP++, 0x08, sEmptyDL); - for (i = 0; i < 64; i++) { - if (*distanceTraveled < 1.0f) { - aux = 1.0f - (*distanceTraveled * *distanceTraveled); - Matrix_Translate(this->actor.world.pos.x + (initialPositions->x * ((this->dx * aux) + (1.0f - this->dx))), - this->actor.world.pos.y + (initialPositions->y * ((this->dy * aux) + (1.0f - this->dy))), - this->actor.world.pos.z + (initialPositions->z * ((this->dz * aux) + (1.0f - this->dz))), - MTXMODE_NEW); - - Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, MTXMODE_APPLY); - Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_dust.c", 449), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); + for (i = 0; i < 64; i++, initialPositions++, distanceTraveled++) { + if (!(*distanceTraveled < 1.0f)) { + continue; } - initialPositions++; - distanceTraveled++; - // Needed for matching. - if (0) {} + aux = 1.0f - SQ(*distanceTraveled); + Matrix_Translate(this->actor.world.pos.x + (initialPositions->x * ((this->dx * aux) + (1.0f - this->dx))), + this->actor.world.pos.y + (initialPositions->y * ((this->dy * aux) + (1.0f - this->dy))), + this->actor.world.pos.z + (initialPositions->z * ((this->dz * aux) + (1.0f - this->dz))), + MTXMODE_NEW); + + Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_dust.c", 449), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); } CLOSE_DISPS(gfxCtx, "../z_eff_dust.c", 458); @@ -333,33 +330,29 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, PlayState* play2) { gSPSegment(POLY_XLU_DISP++, 0x08, sEmptyDL); - for (i = 0; i < 64; i++) { - if (*distanceTraveled < 1.0f) { - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, *distanceTraveled * 255); - - // Needed to match. - if (!this) {} - - aux = 1.0f - (*distanceTraveled * *distanceTraveled); - - Matrix_Mult(&player->mf_9E0, MTXMODE_NEW); - - Matrix_Translate(initialPositions->x * ((this->dx * aux) + (1.0f - this->dx)), - initialPositions->y * (1.0f - *distanceTraveled) + 320.0f, - initialPositions->z * (1.0f - *distanceTraveled) + -20.0f, MTXMODE_APPLY); - - Matrix_Scale(*distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, - *distanceTraveled * this->scalingFactor, MTXMODE_APPLY); - - Matrix_ReplaceRotation(&play->billboardMtxF); - - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_dust.c", 506), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); + for (i = 0; i < 64; i++, initialPositions++, distanceTraveled++) { + if (!(*distanceTraveled < 1.0f)) { + continue; } - initialPositions++; - distanceTraveled++; + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, *distanceTraveled * 255); + + aux = 1.0f - SQ(*distanceTraveled); + + Matrix_Mult(&player->mf_9E0, MTXMODE_NEW); + + Matrix_Translate(initialPositions->x * ((this->dx * aux) + (1.0f - this->dx)), + initialPositions->y * (1.0f - *distanceTraveled) + 320.0f, + initialPositions->z * (1.0f - *distanceTraveled) + -20.0f, MTXMODE_APPLY); + + Matrix_Scale(*distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, + *distanceTraveled * this->scalingFactor, MTXMODE_APPLY); + + Matrix_ReplaceRotation(&play->billboardMtxF); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_dust.c", 506), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); } CLOSE_DISPS(gfxCtx, "../z_eff_dust.c", 515); diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 7f5acb843..0f93c90ea 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -881,29 +881,34 @@ void EnFd_DrawEffectsFlames(EnFd* this, PlayState* play) { EnFdEffect* eff = this->effects; OPEN_DISPS(play->state.gfxCtx, "../z_en_fd.c", 1969); + materialFlag = false; - if (1) {} Gfx_SetupDL_25Xlu(play->state.gfxCtx); + for (i = 0; i < EN_FD_EFFECT_COUNT; i++, eff++) { - if (eff->type == FD_EFFECT_FLAME) { - if (!materialFlag) { - POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); - gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_7928); - gDPSetEnvColor(POLY_XLU_DISP++, 255, 10, 0, (u8)((this->fadeAlpha / 255.0f) * 255)); - materialFlag = true; - } - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, (u8)((this->fadeAlpha / 255.0f) * 255)); - gDPPipeSync(POLY_XLU_DISP++); - Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fd.c", 2006), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - idx = eff->timer * (8.0f / eff->initialTimer); - gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(dustTextures[idx])); - gSPDisplayList(POLY_XLU_DISP++, gFlareDancerSquareParticleDL); + if (eff->type != FD_EFFECT_FLAME) { + continue; } + + if (!materialFlag) { + POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); + gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_7928); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 10, 0, (u8)((this->fadeAlpha / 255.0f) * 255)); + materialFlag = true; + } + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, (u8)((this->fadeAlpha / 255.0f) * 255)); + gDPPipeSync(POLY_XLU_DISP++); + Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fd.c", 2006), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + idx = eff->timer * (8.0f / eff->initialTimer); + gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(dustTextures[idx])); + gSPDisplayList(POLY_XLU_DISP++, gFlareDancerSquareParticleDL); } + CLOSE_DISPS(play->state.gfxCtx, "../z_en_fd.c", 2020); } @@ -918,23 +923,25 @@ void EnFd_DrawEffectsDots(EnFd* this, PlayState* play) { Gfx_SetupDL_25Xlu(play->state.gfxCtx); for (i = 0; i < EN_FD_EFFECT_COUNT; i++, eff++) { - if (eff->type == FD_EFFECT_DOT) { - if (!materialFlag) { - Gfx_SetupDL_25Xlu(play->state.gfxCtx); - gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_79F8); - materialFlag = true; - } - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, eff->color.r, eff->color.g, eff->color.b, - (u8)(eff->color.a * (this->fadeAlpha / 255.0f))); - gDPPipeSync(POLY_XLU_DISP++); - if (1) {} - Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fd.c", 2064), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gFlareDancerTriangleParticleDL); + if (eff->type != FD_EFFECT_DOT) { + continue; } + + if (!materialFlag) { + Gfx_SetupDL_25Xlu(play->state.gfxCtx); + gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_79F8); + materialFlag = true; + } + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, eff->color.r, eff->color.g, eff->color.b, + (u8)(eff->color.a * (this->fadeAlpha / 255.0f))); + gDPPipeSync(POLY_XLU_DISP++); + Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fd.c", 2064), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gFlareDancerTriangleParticleDL); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_fd.c", 2071); diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/src/overlays/actors/ovl_En_Fw/z_en_fw.c index d85580457..06f60dd9e 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -461,29 +461,30 @@ void EnFw_DrawEffects(EnFw* this, PlayState* play) { materialFlag = false; Gfx_SetupDL_25Xlu(play->state.gfxCtx); - if (1) {} for (i = 0; i < EN_FW_EFFECT_COUNT; i++, eff++) { - if (eff->type != 0) { - if (!materialFlag) { - POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); - gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_7928); - gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0); - materialFlag = true; - } - - alpha = eff->timer * (255.0f / eff->initialTimer); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); - gDPPipeSync(POLY_XLU_DISP++); - Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fw.c", 1229), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - idx = eff->timer * (8.0f / eff->initialTimer); - gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(dustTextures[idx])); - gSPDisplayList(POLY_XLU_DISP++, gFlareDancerSquareParticleDL); + if (eff->type == 0) { + continue; } + + if (!materialFlag) { + POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); + gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_7928); + gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0); + materialFlag = true; + } + + alpha = eff->timer * (255.0f / eff->initialTimer); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); + gDPPipeSync(POLY_XLU_DISP++); + Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fw.c", 1229), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + idx = eff->timer * (8.0f / eff->initialTimer); + gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(dustTextures[idx])); + gSPDisplayList(POLY_XLU_DISP++, gFlareDancerSquareParticleDL); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_fw.c", 1243); diff --git a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c index 1fdb8edea..fdf3df221 100644 --- a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c +++ b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c @@ -129,12 +129,12 @@ void EnGanonMant_Tear(EnGanonMant* this) { for (i = 0; i < count; i++) { if ((0 <= tx && tx < MANT_TEX_WIDTH) && (0 <= ty && ty < MANT_TEX_HEIGHT)) { for (areaX = 0; areaX <= tearAreaSizes[i]; areaX++) { - if (1) {} for (areaY = 0; areaY <= tearAreaSizes[i]; areaY++) { texIdx = (s16)((s16)tx + ((s16)ty * MANT_TEX_WIDTH)) + ((s16)areaX + ((s16)areaY * MANT_TEX_WIDTH)); - if (texIdx < MANT_TEX_WIDTH * MANT_TEX_HEIGHT) { - ((u16*)gMantTex)[texIdx] = 0; + if (texIdx >= MANT_TEX_WIDTH * MANT_TEX_HEIGHT) { + continue; } + ((u16*)gMantTex)[texIdx] = 0; } } } From 72334df180964f28ea911728011f8b386512ed1f Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Thu, 21 Sep 2023 00:54:44 +1000 Subject: [PATCH 19/29] improve matching (#1543) --- src/overlays/actors/ovl_En_Go/z_en_go.c | 45 +++++++++--------- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 41 +++++++++-------- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 25 +++++----- src/overlays/actors/ovl_En_In/z_en_in.c | 27 ++++++----- src/overlays/actors/ovl_En_Mm2/z_en_mm2.c | 31 +++++++------ .../actors/ovl_En_Niw_Lady/z_en_niw_lady.c | 46 ++++++++++--------- 6 files changed, 114 insertions(+), 101 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index e22c8177c..a58b58e02 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1200,29 +1200,32 @@ void EnGo_DrawEffects(EnGo* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_go.c", 2626); materialFlag = false; Gfx_SetupDL_25Xlu(play->state.gfxCtx); - if (1) {} + for (i = 0; i < EN_GO_EFFECT_COUNT; i++, dustEffect++) { - if (dustEffect->type) { - if (!materialFlag) { - POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); - gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD40); - gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0); - materialFlag = true; - } - - alpha = dustEffect->timer * (255.0f / dustEffect->initialTimer); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); - gDPPipeSync(POLY_XLU_DISP++); - Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go.c", 2664), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - - index = dustEffect->timer * (8.0f / dustEffect->initialTimer); - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(dustTex[index])); - gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); + if (dustEffect->type == 0) { + continue; } + + if (!materialFlag) { + POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); + gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD40); + gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0); + materialFlag = true; + } + + alpha = dustEffect->timer * (255.0f / dustEffect->initialTimer); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); + gDPPipeSync(POLY_XLU_DISP++); + Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go.c", 2664), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + index = dustEffect->timer * (8.0f / dustEffect->initialTimer); + gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(dustTex[index])); + gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); } + CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2678); } diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 1fa9e0891..c19355cbd 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -225,29 +225,30 @@ void EnGo2_DrawEffects(EnGo2* this, PlayState* play) { materialFlag = false; Gfx_SetupDL_25Xlu(play->state.gfxCtx); - if (1) {} for (i = 0; i < EN_GO2_EFFECT_COUNT; i++, dustEffect++) { - if (dustEffect->type) { - if (!materialFlag) { - POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); - gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD40); - gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0); - materialFlag = true; - } - - alpha = dustEffect->timer * (255.0f / dustEffect->initialTimer); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); - gDPPipeSync(POLY_XLU_DISP++); - Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go2_eff.c", 137), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - index = dustEffect->timer * (8.0f / dustEffect->initialTimer); - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sDustTex[index])); - gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); + if (dustEffect->type == 0) { + continue; } + + if (!materialFlag) { + POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); + gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD40); + gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0); + materialFlag = true; + } + + alpha = dustEffect->timer * (255.0f / dustEffect->initialTimer); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); + gDPPipeSync(POLY_XLU_DISP++); + Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go2_eff.c", 137), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + index = dustEffect->timer * (8.0f / dustEffect->initialTimer); + gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sDustTex[index])); + gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2_eff.c", 151); diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 3dd8a99fe..6af9eed0a 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -686,19 +686,20 @@ s32 EnHorse_Spawn(EnHorse* this, PlayState* play) { spawnPos.z = sHorseSpawns[i].pos.z; dist = Math3D_Vec3f_DistXYZ(&player->actor.world.pos, &spawnPos); - if (play->sceneId) {} - if (!((minDist < dist) || func_80A5BBBC(play, this, &spawnPos))) { - minDist = dist; - this->actor.world.pos.x = sHorseSpawns[i].pos.x; - this->actor.world.pos.y = sHorseSpawns[i].pos.y; - this->actor.world.pos.z = sHorseSpawns[i].pos.z; - this->actor.prevPos = this->actor.world.pos; - this->actor.world.rot.y = sHorseSpawns[i].angle; - this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); - spawn = true; - SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->actor.world.pos, - &this->actor.projectedPos, &this->actor.projectedW); + if ((minDist < dist) || func_80A5BBBC(play, this, &spawnPos)) { + continue; } + + minDist = dist; + this->actor.world.pos.x = sHorseSpawns[i].pos.x; + this->actor.world.pos.y = sHorseSpawns[i].pos.y; + this->actor.world.pos.z = sHorseSpawns[i].pos.z; + this->actor.prevPos = this->actor.world.pos; + this->actor.world.rot.y = sHorseSpawns[i].angle; + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); + spawn = true; + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->actor.world.pos, + &this->actor.projectedPos, &this->actor.projectedW); } } } diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 73698fd4a..6c81b313c 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -894,19 +894,22 @@ void func_80A7B024(EnIn* this, PlayState* play) { player->rideActor->freezeTimer = 10; } player->actor.freezeTimer = 10; - if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) { - if (1) {} - if (!GET_EVENTCHKINF(EVENTCHKINF_1B) && GET_INFTABLE(INFTABLE_AB)) { - SET_EVENTCHKINF(EVENTCHKINF_1B); - SET_INFTABLE(INFTABLE_AB); - } - func_80A79BAC(this, play, 0, TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST)); - SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0); - SET_EVENTINF_HORSES_0F(1); - play->msgCtx.stateTimer = 4; - play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; - this->interactInfo.talkState = NPC_TALK_STATE_IDLE; + + if (this->interactInfo.talkState != NPC_TALK_STATE_ACTION) { + return; } + + if (!GET_EVENTCHKINF(EVENTCHKINF_1B) && GET_INFTABLE(INFTABLE_AB)) { + SET_EVENTCHKINF(EVENTCHKINF_1B); + SET_INFTABLE(INFTABLE_AB); + } + + func_80A79BAC(this, play, 0, TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST)); + SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0); + SET_EVENTINF_HORSES_0F(1); + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + this->interactInfo.talkState = NPC_TALK_STATE_IDLE; } void EnIn_Update(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index be1f73d52..ea7d525d2 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -215,14 +215,15 @@ void func_80AAF3C0(EnMm2* this, PlayState* play) { Message_ContinueTextbox(play, 0x6080); this->actor.textId = 0x6080; break; - }; + } + if (this->unk_1F4 & 4) { - if (1) {} this->unk_1F4 &= ~4; HIGH_SCORE(HS_MARATHON)++; } } - return; + break; + case 0x6081: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk_1F4 |= 4; @@ -230,18 +231,20 @@ void func_80AAF3C0(EnMm2* this, PlayState* play) { Message_ContinueTextbox(play, 0x607E); this->actor.textId = 0x607E; } - return; - } + break; - if (Actor_TextboxIsClosing(&this->actor, play)) { - if (this->actor.textId == 0x607F) { - Interface_SetSubTimer(0); - this->actionFunc = func_80AAF57C; - } else { - this->actionFunc = func_80AAF57C; - } - this->actionFunc = func_80AAF57C; - func_80AAEF70(this, play); + default: + if (Actor_TextboxIsClosing(&this->actor, play)) { + if (this->actor.textId == 0x607F) { + Interface_SetSubTimer(0); + this->actionFunc = func_80AAF57C; + } else { + this->actionFunc = func_80AAF57C; + } + this->actionFunc = func_80AAF57C; + func_80AAEF70(this, play); + } + break; } } diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index 313def754..efd92c36d 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -518,29 +518,31 @@ void EnNiwLady_Update(Actor* thisx, PlayState* play) { SkelAnime_Update(&this->skelAnime); } this->aneObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_ANE); - if (this->aneObjectSlot >= 0) { - this->actionFunc(this, play); - if (this->unusedTimer2 != 0) { - this->unusedTimer2--; - } - if (this->unusedRandomTimer != 0) { - this->unusedRandomTimer--; - } - this->unusedTimer++; - if (this->unusedRandomTimer == 0) { - this->faceState++; - if (this->faceState >= 3) { - this->faceState = 0; - this->unusedRandomTimer = ((s16)Rand_ZeroFloat(60.0f) + 0x14); - } - } - Actor_UpdateBgCheckInfo(play, thisx, 20.0f, 20.0f, 60.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | - UPDBGCHECKINFO_FLAG_4); - Collider_UpdateCylinder(thisx, &this->collider); - if (1) {} - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + if (this->aneObjectSlot < 0) { + return; } + + this->actionFunc(this, play); + + if (this->unusedTimer2 != 0) { + this->unusedTimer2--; + } + if (this->unusedRandomTimer != 0) { + this->unusedRandomTimer--; + } + this->unusedTimer++; + if (this->unusedRandomTimer == 0) { + this->faceState++; + if (this->faceState >= 3) { + this->faceState = 0; + this->unusedRandomTimer = ((s16)Rand_ZeroFloat(60.0f) + 0x14); + } + } + Actor_UpdateBgCheckInfo(play, thisx, 20.0f, 20.0f, 60.0f, + UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | + UPDBGCHECKINFO_FLAG_4); + Collider_UpdateCylinder(thisx, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } From d7f6961918f6ad9d53fb6cf465aee2db0845d0ea Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Thu, 21 Sep 2023 02:41:47 +1000 Subject: [PATCH 20/29] Improve Matches: Part 3 (#1544) * improve matchings * spacing --- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 32 ++-- src/overlays/actors/ovl_En_Sda/z_en_sda.c | 6 +- .../actors/ovl_En_Shopnuts/z_en_shopnuts.c | 49 +++--- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 19 ++- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 52 +++--- src/overlays/actors/ovl_En_Tk/z_en_tk.c | 51 +++--- .../actors/ovl_En_Viewer/z_en_viewer.c | 47 +++--- src/overlays/actors/ovl_En_Zo/z_en_zo.c | 158 +++++++++--------- src/overlays/actors/ovl_Fishing/z_fishing.c | 41 +++-- 9 files changed, 234 insertions(+), 221 deletions(-) diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index bba861737..c424d5124 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -852,7 +852,7 @@ void EnRr_Draw(Actor* thisx, PlayState* play) { Mtx* segMtx = Graph_Alloc(play->state.gfxCtx, 4 * sizeof(Mtx)); OPEN_DISPS(play->state.gfxCtx, "../z_en_rr.c", 1478); - if (1) {} + Gfx_SetupDL_25Xlu(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x0C, segMtx); gSPSegment(POLY_XLU_DISP++, 0x08, @@ -867,9 +867,11 @@ void EnRr_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_rr.c", 1501), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Matrix_Pop(); + zeroVec.x = 0.0f; zeroVec.y = 0.0f; zeroVec.z = 0.0f; + for (i = 1; i < 5; i++) { Matrix_Translate(0.0f, this->bodySegs[i].height + 1000.0f, 0.0f, MTXMODE_APPLY); @@ -883,28 +885,34 @@ void EnRr_Draw(Actor* thisx, PlayState* play) { segMtx++; Matrix_MultVec3f(&zeroVec, &this->effectPos[i]); } + this->effectPos[0] = this->actor.world.pos; Matrix_MultVec3f(&zeroVec, &this->mouthPos); gSPDisplayList(POLY_XLU_DISP++, gLikeLikeDL); CLOSE_DISPS(play->state.gfxCtx, "../z_en_rr.c", 1551); + if (this->effectTimer != 0) { Vec3f effectPos; s16 effectTimer = this->effectTimer - 1; + s32 segIndex; + s32 offIndex; this->actor.colorFilterTimer++; - if ((effectTimer & 1) == 0) { - s32 segIndex = 4 - (effectTimer >> 2); - s32 offIndex = (effectTimer >> 1) & 3; + if ((effectTimer & 1) != 0) { + return; + } - effectPos.x = this->effectPos[segIndex].x + sEffectOffsets[offIndex].x + Rand_CenteredFloat(10.0f); - effectPos.y = this->effectPos[segIndex].y + sEffectOffsets[offIndex].y + Rand_CenteredFloat(10.0f); - effectPos.z = this->effectPos[segIndex].z + sEffectOffsets[offIndex].z + Rand_CenteredFloat(10.0f); - if (this->actor.colorFilterParams & 0x4000) { - EffectSsEnFire_SpawnVec3f(play, &this->actor, &effectPos, 100, 0, 0, -1); - } else { - EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &effectPos, 150, 150, 150, 250, 235, 245, 255, 3.0f); - } + segIndex = 4 - (effectTimer >> 2); + offIndex = (effectTimer >> 1) & 3; + + effectPos.x = this->effectPos[segIndex].x + sEffectOffsets[offIndex].x + Rand_CenteredFloat(10.0f); + effectPos.y = this->effectPos[segIndex].y + sEffectOffsets[offIndex].y + Rand_CenteredFloat(10.0f); + effectPos.z = this->effectPos[segIndex].z + sEffectOffsets[offIndex].z + Rand_CenteredFloat(10.0f); + if (this->actor.colorFilterParams & 0x4000) { + EffectSsEnFire_SpawnVec3f(play, &this->actor, &effectPos, 100, 0, 0, -1); + } else { + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &effectPos, 150, 150, 150, 250, 235, 245, 255, 3.0f); } } } diff --git a/src/overlays/actors/ovl_En_Sda/z_en_sda.c b/src/overlays/actors/ovl_En_Sda/z_en_sda.c index 3e2099123..3777d4420 100644 --- a/src/overlays/actors/ovl_En_Sda/z_en_sda.c +++ b/src/overlays/actors/ovl_En_Sda/z_en_sda.c @@ -290,7 +290,6 @@ void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, PlayState* pl Matrix_RotateX(BINANG_TO_RAD_ALT(sp178.x), MTXMODE_APPLY); for (i = 0; i < 22; i++) { Matrix_MultVec3f(&D_80AFA180[i], &sp188); - if (1) {} sp64[i].x = (((KREG(82) / 100.0f) + 4.0f) * sp188.x) + sp16C.x; sp64[i].y = (((KREG(82) / 100.0f) + 4.0f) * sp188.y) + sp16C.y; sp64[i].z = (((KREG(82) / 100.0f) + 4.0f) * sp188.z) + sp16C.z; @@ -306,7 +305,7 @@ void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, PlayState* pl temp_t0 = sp188.x + 32.0f; temp_t1 = (s16)sp188.y << 6; - do { + for (j = 0; j < 6; j++) { for (j = 0, phi_a3 = -0xC0; j < 7; j++, phi_a3 += 0x40) { for (phi_a0 = -D_80AFA0E8[j]; phi_a0 < D_80AFA0E8[j] - 1; phi_a0++) { temp_v0 = temp_t0 + phi_a0; @@ -318,8 +317,7 @@ void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, PlayState* pl } } } - j++; - } while (j < 6); + } } } if (BREG(61) == 1) { diff --git a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c index 402d932c8..119f3f702 100644 --- a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c +++ b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c @@ -300,30 +300,33 @@ void EnShopnuts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* f32 y; f32 z; - if ((limbIndex == BUSINESS_SCRUB_LIMB_NOSE) && (this->actionFunc == EnShopnuts_ThrowNut)) { - OPEN_DISPS(play->state.gfxCtx, "../z_en_shopnuts.c", 682); - curFrame = this->skelAnime.curFrame; - if (curFrame <= 6.0f) { - y = 1.0f - (curFrame * 0.0833f); - x = z = (curFrame * 0.1167f) + 1.0f; - } else if (curFrame <= 7.0f) { - curFrame -= 6.0f; - y = 0.5f + curFrame; - x = z = 1.7f - (curFrame * 0.7f); - } else if (curFrame <= 10.0f) { - y = 1.5f - ((curFrame - 7.0f) * 0.1667f); - x = z = 1.0f; - } else { - x = y = z = 1.0f; - } - - Matrix_Scale(x, y, z, MTXMODE_APPLY); - if (1) {} - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_shopnuts.c", 714), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, gBusinessScrubNoseDL); - CLOSE_DISPS(play->state.gfxCtx, "../z_en_shopnuts.c", 717); + if ((limbIndex != BUSINESS_SCRUB_LIMB_NOSE) || (this->actionFunc != EnShopnuts_ThrowNut)) { + return; } + + OPEN_DISPS(play->state.gfxCtx, "../z_en_shopnuts.c", 682); + + curFrame = this->skelAnime.curFrame; + if (curFrame <= 6.0f) { + y = 1.0f - (curFrame * 0.0833f); + x = z = (curFrame * 0.1167f) + 1.0f; + } else if (curFrame <= 7.0f) { + curFrame -= 6.0f; + y = 0.5f + curFrame; + x = z = 1.7f - (curFrame * 0.7f); + } else if (curFrame <= 10.0f) { + y = 1.5f - ((curFrame - 7.0f) * 0.1667f); + x = z = 1.0f; + } else { + x = y = z = 1.0f; + } + + Matrix_Scale(x, y, z, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_shopnuts.c", 714), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gBusinessScrubNoseDL); + + CLOSE_DISPS(play->state.gfxCtx, "../z_en_shopnuts.c", 717); } void EnShopnuts_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index fabcfb21d..4d0bb1fbc 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -182,7 +182,6 @@ s32 func_80B0C0CC(EnSw* this, PlayState* play, s32 arg2) { if (phi_s1 == 0) { sp78.x = sp84.x - (this->unk_37C.x * 24.0f); sp78.y = sp84.y - (this->unk_37C.y * 24.0f); - if (0) {} sp78.z = sp84.z - (this->unk_37C.z * 24.0f); } else if (phi_s1 == 1) { sp78.x = sp84.x + (this->unk_370.x * 24.0f); @@ -194,15 +193,17 @@ s32 func_80B0C0CC(EnSw* this, PlayState* play, s32 arg2) { sp78.z = sp84.z - (this->unk_370.z * 24.0f); } temp_v0_2 = func_80B0C020(play, &sp84, &sp78, &sp9C, &sp6C); - if (temp_v0_2 != NULL) { - if (arg2 == 1) { - func_80B0BE20(this, temp_v0_2); - this->actor.world.pos = sp9C; - this->actor.floorBgId = sp6C; - } - sp64 = 1; - break; + if (temp_v0_2 == NULL) { + continue; } + + if (arg2 == 1) { + func_80B0BE20(this, temp_v0_2); + this->actor.world.pos = sp9C; + this->actor.floorBgId = sp6C; + } + sp64 = 1; + break; } } diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 7e22bb4e1..5f9336d91 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -287,33 +287,35 @@ void EnSyatekiMan_WaitForGame(EnSyatekiMan* this, PlayState* play) { EnSyatekiItm* gallery; SkelAnime_Update(&this->skelAnime); - if (1) {} + gallery = ((EnSyatekiItm*)this->actor.parent); - if ((gallery->actor.update != NULL) && (gallery->signal == ENSYATEKI_END)) { - this->subCamId = OnePointCutscene_Init(play, 8002, -99, &this->actor, CAM_ID_MAIN); - switch (gallery->hitCount) { - case 10: - this->gameResult = SYATEKI_RESULT_WINNER; - this->actor.textId = 0x71AF; - break; - case 8: - case 9: - this->gameResult = SYATEKI_RESULT_ALMOST; - this->actor.textId = 0x71AE; - break; - default: - this->gameResult = SYATEKI_RESULT_FAILURE; - this->actor.textId = 0x71AD; - if (play->shootingGalleryStatus == 15 + 1) { - this->gameResult = SYATEKI_RESULT_REFUSE; - this->actor.textId = 0x2D; - } - break; - } - play->shootingGalleryStatus = -2; - Message_StartTextbox(play, this->actor.textId, NULL); - this->actionFunc = EnSyatekiMan_EndGame; + if ((gallery->actor.update == NULL) || (gallery->signal != ENSYATEKI_END)) { + return; } + + this->subCamId = OnePointCutscene_Init(play, 8002, -99, &this->actor, CAM_ID_MAIN); + switch (gallery->hitCount) { + case 10: + this->gameResult = SYATEKI_RESULT_WINNER; + this->actor.textId = 0x71AF; + break; + case 8: + case 9: + this->gameResult = SYATEKI_RESULT_ALMOST; + this->actor.textId = 0x71AE; + break; + default: + this->gameResult = SYATEKI_RESULT_FAILURE; + this->actor.textId = 0x71AD; + if (play->shootingGalleryStatus == 15 + 1) { + this->gameResult = SYATEKI_RESULT_REFUSE; + this->actor.textId = 0x2D; + } + break; + } + play->shootingGalleryStatus = -2; + Message_StartTextbox(play, this->actor.textId, NULL); + this->actionFunc = EnSyatekiMan_EndGame; } void EnSyatekiMan_EndGame(EnSyatekiMan* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 0e45881ee..a73569f62 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -93,33 +93,32 @@ void EnTkEff_Draw(EnTk* this, PlayState* play) { Gfx_SetupDL_25Xlu(play->state.gfxCtx); - if (1) {} - - for (i = 0; i < ARRAY_COUNT(this->eff); i++) { - if (eff->active != 0) { - if (gfxSetup == 0) { - POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); - gSPDisplayList(POLY_XLU_DISP++, gDampeEff1DL); - gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0); - gfxSetup = 1; - } - - alpha = eff->timeLeft * (255.0f / eff->timeTotal); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); - - gDPPipeSync(POLY_XLU_DISP++); - Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(eff->size, eff->size, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_tk_eff.c", 140), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - - imageIdx = eff->timeLeft * ((f32)ARRAY_COUNT(dustTextures) / eff->timeTotal); - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(dustTextures[imageIdx])); - - gSPDisplayList(POLY_XLU_DISP++, gDampeEff2DL); + for (i = 0; i < ARRAY_COUNT(this->eff); i++, eff++) { + if (eff->active == 0) { + continue; } - eff++; + + if (gfxSetup == 0) { + POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); + gSPDisplayList(POLY_XLU_DISP++, gDampeEff1DL); + gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0); + gfxSetup = 1; + } + + alpha = eff->timeLeft * (255.0f / eff->timeTotal); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); + + gDPPipeSync(POLY_XLU_DISP++); + Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_Scale(eff->size, eff->size, 1.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_tk_eff.c", 140), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + imageIdx = eff->timeLeft * ((f32)ARRAY_COUNT(dustTextures) / eff->timeTotal); + gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(dustTextures[imageIdx])); + + gSPDisplayList(POLY_XLU_DISP++, gDampeEff2DL); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_tk_eff.c", 154); diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index 9e3736d0f..d78835a74 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -872,28 +872,29 @@ void EnViewer_UpdateGanondorfCape(PlayState* play, EnViewer* this) { Vec3f forearmModelOffset; Vec3f forearmWorldOffset; - if ((this->actor.params >> 8) == ENVIEWER_TYPE_5_GANONDORF) { - if (1) {} - sGanondorfCape->backPush = BREG(54) / 10.0f; - sGanondorfCape->backSwayMagnitude = (BREG(60) + 25) / 100.0f; - sGanondorfCape->sideSwayMagnitude = (BREG(55) - 45) / 10.0f; - sGanondorfCape->minY = -10000.0f; - sGanondorfCape->minDist = 0.0f; - sGanondorfCape->gravity = (BREG(67) - 10) / 10.0f; - forearmModelOffset.x = KREG(16) - 13.0f; - forearmModelOffset.y = KREG(17) + 3.0f + Math_SinS(yOscillationPhase) * KREG(20); - forearmModelOffset.z = KREG(18) - 10.0f; - yOscillationPhase += KREG(19) * 0x1000 + 0x2000; - - Matrix_RotateY(BINANG_TO_RAD_ALT(this->actor.shape.rot.y), MTXMODE_NEW); - Matrix_MultVec3f(&forearmModelOffset, &forearmWorldOffset); - sGanondorfCape->rightForearmPos.x = sGanondorfNeckWorldPos.x + forearmWorldOffset.x; - sGanondorfCape->rightForearmPos.y = sGanondorfNeckWorldPos.y + forearmWorldOffset.y; - sGanondorfCape->rightForearmPos.z = sGanondorfNeckWorldPos.z + forearmWorldOffset.z; - forearmModelOffset.x = -(KREG(16) - 13.0f); - Matrix_MultVec3f(&forearmModelOffset, &forearmWorldOffset); - sGanondorfCape->leftForearmPos.x = sGanondorfNeckWorldPos.x + forearmWorldOffset.x; - sGanondorfCape->leftForearmPos.y = sGanondorfNeckWorldPos.y + forearmWorldOffset.y; - sGanondorfCape->leftForearmPos.z = sGanondorfNeckWorldPos.z + forearmWorldOffset.z; + if ((this->actor.params >> 8) != ENVIEWER_TYPE_5_GANONDORF) { + return; } + + sGanondorfCape->backPush = BREG(54) / 10.0f; + sGanondorfCape->backSwayMagnitude = (BREG(60) + 25) / 100.0f; + sGanondorfCape->sideSwayMagnitude = (BREG(55) - 45) / 10.0f; + sGanondorfCape->minY = -10000.0f; + sGanondorfCape->minDist = 0.0f; + sGanondorfCape->gravity = (BREG(67) - 10) / 10.0f; + forearmModelOffset.x = KREG(16) - 13.0f; + forearmModelOffset.y = KREG(17) + 3.0f + Math_SinS(yOscillationPhase) * KREG(20); + forearmModelOffset.z = KREG(18) - 10.0f; + yOscillationPhase += KREG(19) * 0x1000 + 0x2000; + + Matrix_RotateY(BINANG_TO_RAD_ALT(this->actor.shape.rot.y), MTXMODE_NEW); + Matrix_MultVec3f(&forearmModelOffset, &forearmWorldOffset); + sGanondorfCape->rightForearmPos.x = sGanondorfNeckWorldPos.x + forearmWorldOffset.x; + sGanondorfCape->rightForearmPos.y = sGanondorfNeckWorldPos.y + forearmWorldOffset.y; + sGanondorfCape->rightForearmPos.z = sGanondorfNeckWorldPos.z + forearmWorldOffset.z; + forearmModelOffset.x = -(KREG(16) - 13.0f); + Matrix_MultVec3f(&forearmModelOffset, &forearmWorldOffset); + sGanondorfCape->leftForearmPos.x = sGanondorfNeckWorldPos.x + forearmWorldOffset.x; + sGanondorfCape->leftForearmPos.y = sGanondorfNeckWorldPos.y + forearmWorldOffset.y; + sGanondorfCape->leftForearmPos.z = sGanondorfNeckWorldPos.z + forearmWorldOffset.z; } diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index cf2f997b0..dd29c0ad4 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -55,20 +55,21 @@ void EnZo_SpawnBubble(EnZo* this, Vec3f* pos) { f32 waterSurface; effect = this->effects; - for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) { - if (1) {} - if (effect->type == ENZO_EFFECT_NONE) { - waterSurface = this->actor.world.pos.y + this->actor.yDistToWater; - if (!(waterSurface <= pos->y)) { - effect->type = ENZO_EFFECT_BUBBLE; - effect->pos = *pos; - effect->vec = *pos; - effect->vel = vel; - effect->scale = ((Rand_ZeroOne() - 0.5f) * 0.02f) + 0.12f; - break; - } + for (i = 0; i < EN_ZO_EFFECT_COUNT; i++, effect++) { + if (effect->type != ENZO_EFFECT_NONE) { + continue; + } + + waterSurface = this->actor.world.pos.y + this->actor.yDistToWater; + + if (!(waterSurface <= pos->y)) { + effect->type = ENZO_EFFECT_BUBBLE; + effect->pos = *pos; + effect->vec = *pos; + effect->vel = vel; + effect->scale = ((Rand_ZeroOne() - 0.5f) * 0.02f) + 0.12f; + break; } - effect++; } } @@ -78,18 +79,17 @@ void EnZo_SpawnSplash(EnZo* this, Vec3f* pos, Vec3f* vel, f32 scale) { s16 i; effect = this->effects; - for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) { - if (1) {} - if (effect->type != ENZO_EFFECT_SPLASH) { - effect->type = ENZO_EFFECT_SPLASH; - effect->pos = *pos; - effect->vec = accel; - effect->vel = *vel; - effect->color.a = (Rand_ZeroOne() * 100.0f) + 100.0f; - effect->scale = scale; - break; + for (i = 0; i < EN_ZO_EFFECT_COUNT; i++, effect++) { + if (effect->type == ENZO_EFFECT_SPLASH) { + continue; } - effect++; + effect->type = ENZO_EFFECT_SPLASH; + effect->pos = *pos; + effect->vec = accel; + effect->vel = *vel; + effect->color.a = (Rand_ZeroOne() * 100.0f) + 100.0f; + effect->scale = scale; + break; } } @@ -178,25 +178,27 @@ void EnZo_DrawEffectsRipples(EnZo* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_zo_eff.c", 217); materialFlag = false; Gfx_SetupDL_25Xlu(play->state.gfxCtx); - for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) { - if (effect->type == ENZO_EFFECT_RIPPLE) { - if (!materialFlag) { - if (1) {} - gDPPipeSync(POLY_XLU_DISP++); - gSPDisplayList(POLY_XLU_DISP++, gZoraRipplesMaterialDL); - gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 155, 0); - materialFlag = true; - } - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, effect->color.a); - Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_Scale(effect->scale, 1.0f, effect->scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_zo_eff.c", 242), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gZoraRipplesModelDL); + for (i = 0; i < EN_ZO_EFFECT_COUNT; i++, effect++) { + if (effect->type != ENZO_EFFECT_RIPPLE) { + continue; } - effect++; + + if (!materialFlag) { + gDPPipeSync(POLY_XLU_DISP++); + gSPDisplayList(POLY_XLU_DISP++, gZoraRipplesMaterialDL); + gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 155, 0); + materialFlag = true; + } + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, effect->color.a); + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); + Matrix_Scale(effect->scale, 1.0f, effect->scale, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_zo_eff.c", 242), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gZoraRipplesModelDL); } + CLOSE_DISPS(play->state.gfxCtx, "../z_en_zo_eff.c", 248); } @@ -208,27 +210,28 @@ void EnZo_DrawEffectsBubbles(EnZo* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_zo_eff.c", 260); materialFlag = false; Gfx_SetupDL_25Xlu(play->state.gfxCtx); - for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) { - if (effect->type == ENZO_EFFECT_BUBBLE) { - if (!materialFlag) { - if (1) {} - gSPDisplayList(POLY_XLU_DISP++, gZoraBubblesMaterialDL); - gDPPipeSync(POLY_XLU_DISP++); - gDPSetEnvColor(POLY_XLU_DISP++, 150, 150, 150, 0); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); - materialFlag = true; - } - - Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); - - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_zo_eff.c", 281), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gZoraBubblesModelDL); + for (i = 0; i < EN_ZO_EFFECT_COUNT; i++, effect++) { + if (effect->type != ENZO_EFFECT_BUBBLE) { + continue; } - effect++; + + if (!materialFlag) { + gSPDisplayList(POLY_XLU_DISP++, gZoraBubblesMaterialDL); + gDPPipeSync(POLY_XLU_DISP++); + gDPSetEnvColor(POLY_XLU_DISP++, 150, 150, 150, 0); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); + + materialFlag = true; + } + + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_zo_eff.c", 281), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gZoraBubblesModelDL); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_zo_eff.c", 286); } @@ -242,26 +245,25 @@ void EnZo_DrawEffectsSplashes(EnZo* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_zo_eff.c", 298); materialFlag = false; Gfx_SetupDL_25Xlu(play->state.gfxCtx); - for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) { - if (effect->type == ENZO_EFFECT_SPLASH) { - if (!materialFlag) { - if (1) {} - gSPDisplayList(POLY_XLU_DISP++, gZoraSplashesMaterialDL); - gDPPipeSync(POLY_XLU_DISP++); - gDPSetEnvColor(POLY_XLU_DISP++, 200, 200, 200, 0); - materialFlag = true; - } - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 180, 180, 180, effect->color.a); - - Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_zo_eff.c", 325), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - - gSPDisplayList(POLY_XLU_DISP++, gZoraSplashesModelDL); + for (i = 0; i < EN_ZO_EFFECT_COUNT; i++, effect++) { + if (effect->type != ENZO_EFFECT_SPLASH) { + continue; } - effect++; + if (!materialFlag) { + gSPDisplayList(POLY_XLU_DISP++, gZoraSplashesMaterialDL); + gDPPipeSync(POLY_XLU_DISP++); + gDPSetEnvColor(POLY_XLU_DISP++, 200, 200, 200, 0); + materialFlag = true; + } + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 180, 180, 180, effect->color.a); + + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_zo_eff.c", 325), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gSPDisplayList(POLY_XLU_DISP++, gZoraSplashesModelDL); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_zo_eff.c", 331); } diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index e80494fd5..34642308c 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -4709,30 +4709,29 @@ void Fishing_DrawGroupFishes(PlayState* play) { scale = 0.00475f; } - if (1) {} - OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 8048); - for (i = 0; i < GROUP_FISH_COUNT; i++) { - if (fish->type != FS_GROUP_FISH_NONE) { - if (materialFlag == 0) { - gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishMaterialDL); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 155, 155, 155, 255); - materialFlag++; - } - - if (fish->shouldDraw) { - 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->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); - gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishModelDL); - } + for (i = 0; i < GROUP_FISH_COUNT; i++, fish++) { + if (fish->type == FS_GROUP_FISH_NONE) { + continue; + } + + if (!materialFlag) { + gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishMaterialDL); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 155, 155, 155, 255); + materialFlag++; + } + + if (fish->shouldDraw) { + 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->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); + gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishModelDL); } - fish++; } CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 8099); From dc010abf7a3173a18289161aa275204e38b262fb Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Fri, 22 Sep 2023 08:40:19 -0700 Subject: [PATCH 21/29] Rename master to main (#1536) * Jenkinsfile master -> main * Missed some instances of master --- Jenkinsfile | 8 ++++---- README.md | 4 ++-- docs/tutorial/merging.md | 8 ++++---- docs/tutorial/pre-decomp.md | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b4c23f20a..0d2d74fbc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { } stage('Build (qemu-irix)') { when { - branch 'master' + branch 'main' } steps { sh 'ORIG_COMPILER=1 make -j' @@ -26,7 +26,7 @@ pipeline { stage('Build') { when { not { - branch 'master' + branch 'main' } } steps { @@ -35,7 +35,7 @@ pipeline { } stage('Report Progress') { when { - branch 'master' + branch 'main' } steps { sh 'mkdir reports' @@ -47,7 +47,7 @@ pipeline { } stage('Update Progress') { when { - branch 'master' + branch 'main' } agent { label 'zeldaret_website' diff --git a/README.md b/README.md index c034dac25..6fe29f6b8 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ [![Build Status][jenkins-badge]][jenkins] [![Decompilation Progress][progress-badge]][progress] [![Contributors][contributors-badge]][contributors] [![Discord Channel][discord-badge]][discord] -[jenkins]: https://jenkins.deco.mp/job/OOT/job/master -[jenkins-badge]: https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fjenkins.deco.mp%2Fjob%2FOOT%2Fjob%2Fmaster +[jenkins]: https://jenkins.deco.mp/job/OOT/job/main +[jenkins-badge]: https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fjenkins.deco.mp%2Fjob%2FOOT%2Fjob%2Fmain [progress]: https://zelda64.dev/games/oot [progress-badge]: https://img.shields.io/endpoint?url=https://zelda64.dev/assets/csv/progress-oot-shield.json diff --git a/docs/tutorial/merging.md b/docs/tutorial/merging.md index a5e7b66f6..8ba1aa5cb 100644 --- a/docs/tutorial/merging.md +++ b/docs/tutorial/merging.md @@ -61,9 +61,9 @@ If you can't match a function even with everyone's, don't worry overlong about i Run the formatting script `format.py`, to format the C files in the standard way we use. -### Merge master +### Merge main -To make sure the PR builds correctly with the current master, you need to merge `upstream/master` before you make the PR. This tends to break things, that you have to fix to get it to compile correctly again. +To make sure the PR builds correctly with the current main, you need to merge `upstream/main` before you make the PR. This tends to break things, that you have to fix to get it to compile correctly again. ## Pull Requests @@ -81,7 +81,7 @@ and so on, although these four tend to cover most cases. Feel free to add a comm Pull requests may be reviewed by anyone (who knows enough about the conventions of the project), but all are usually reviewed by Fig and Roman. -To implement suggestions made in reviews, it is generally easier to be consistent if you push more commits from your local branch. It is quite possible that in the meantime some other PR has gone in, and git will ask you to merge master before you add more commits. This is normally fairly painless, although often you have to resolve merge conflicts. If in doubt, backup your work before doing anything, and ask in Discord before doing anything drastic, or if you don't understand what git is telling you. +To implement suggestions made in reviews, it is generally easier to be consistent if you push more commits from your local branch. It is quite possible that in the meantime some other PR has gone in, and git will ask you to merge main before you add more commits. This is normally fairly painless, although often you have to resolve merge conflicts. If in doubt, backup your work before doing anything, and ask in Discord before doing anything drastic, or if you don't understand what git is telling you. There is no need to wait for your PR to be approved and committed before working on your next actor. @@ -94,4 +94,4 @@ It's helpful to use the labels on Trello. - Matched for when it is totally decompiled and matching - Documented if at least everything is named and odd code is commented. We'll likely wipe these and start over when proper documentation begins. -We now have a PR label on the Trello that you can use to indicate your actor is in a PR. When the actor is committed to master, you can move the actor into the `Decompiled Files (Overlays)` column: it goes at the top if there is a non-matching, and below if not. +We now have a PR label on the Trello that you can use to indicate your actor is in a PR. When the actor is committed to main, you can move the actor into the `Decompiled Files (Overlays)` column: it goes at the top if there is a non-matching, and below if not. diff --git a/docs/tutorial/pre-decomp.md b/docs/tutorial/pre-decomp.md index ebd722fbd..4ad66b76f 100644 --- a/docs/tutorial/pre-decomp.md +++ b/docs/tutorial/pre-decomp.md @@ -10,7 +10,7 @@ This is covered on the main page of the repository. First, make a GitHub fork of the repository, then clone it into a git-enabled local folder. -Once you have decided on an actor, you should make a new git branch to work on: your master branch is meant to stay level with the main repository. Name it something sensible: my `EnFirefly` branch is called "en_firefly", for example, but you may prefer to use a more descriptive name: "Dark_Link" is rather more suggestive than "en_torch2", for example. You work on the branch, commit changes, and periodically push them to GitHub, if only for backup purposes. +Once you have decided on an actor, you should make a new git branch to work on: your main branch is meant to stay level with the main repository. Name it something sensible: my `EnFirefly` branch is called "en_firefly", for example, but you may prefer to use a more descriptive name: "Dark_Link" is rather more suggestive than "en_torch2", for example. You work on the branch, commit changes, and periodically push them to GitHub, if only for backup purposes. Once you have finished an actor, you submit a pull request for other people to check your work complies with the project's conventions, and once it is deemed satisfactory, it will be merged in to the main repository. From c73e2ab72618b01c96f63868a8f1001e86eaa461 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 22 Sep 2023 17:50:44 +0200 Subject: [PATCH 22/29] Make macros for age reqs data and access (#1549) * Make macros for age reqs data and access * line breaks for readability --- .../ovl_kaleido_scope/z_kaleido_equipment.c | 11 +- .../misc/ovl_kaleido_scope/z_kaleido_item.c | 11 +- .../misc/ovl_kaleido_scope/z_kaleido_scope.h | 14 ++ .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 146 ++++++++++++++++-- 4 files changed, 157 insertions(+), 25 deletions(-) diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index e3e5997a5..1af28c4a7 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -441,9 +441,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { osSyncPrintf("kscope->select_name[Display_Equipment] = %d\n", pauseCtx->cursorItem[PAUSE_EQUIP]); - if (!((gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == 9) || - (gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == - ((void)0, gSaveContext.save.linkAge)))) { + if (!CHECK_AGE_REQ_EQUIP(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP])) { pauseCtx->nameColorSet = 1; } @@ -473,9 +471,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { (pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && CHECK_BTN_ALL(input->press.button, BTN_A) && (pauseCtx->cursorX[PAUSE_EQUIP] != 0)) { - if ((gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == 9) || - (gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == - ((void)0, gSaveContext.save.linkAge))) { + if (CHECK_AGE_REQ_EQUIP(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP])) { Inventory_ChangeEquipment(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP]); if (pauseCtx->cursorY[PAUSE_EQUIP] == 0) { @@ -529,8 +525,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { for (k = 0, temp = rowStart + 1, bit = rowStart, j = point; k < 3; k++, bit++, j += 4, temp++) { if ((gBitFlags[bit] & gSaveContext.save.info.inventory.equipment) && (pauseCtx->cursorSpecialPos == 0)) { - if ((gEquipAgeReqs[i][k + 1] == 9) || - (gEquipAgeReqs[i][k + 1] == ((void)0, gSaveContext.save.linkAge))) { + if (CHECK_AGE_REQ_EQUIP(i, k + 1)) { if (temp == cursorSlot) { pauseCtx->equipVtx[j].v.ob[0] = pauseCtx->equipVtx[j + 2].v.ob[0] = pauseCtx->equipVtx[j].v.ob[0] - 2; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index 5294bfdcb..6d8a846c9 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -24,7 +24,7 @@ void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, gDPPipeSync(POLY_OPA_DISP++); - if (!((gSlotAgeReqs[SLOT(item)] == 9) || gSlotAgeReqs[SLOT(item)] == ((void)0, gSaveContext.save.linkAge))) { + if (!CHECK_AGE_REQ_SLOT(SLOT(item))) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 100, 100, pauseCtx->alpha); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); @@ -340,8 +340,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { pauseCtx->cursorItem[PAUSE_ITEM] = cursorItem; pauseCtx->cursorSlot[PAUSE_ITEM] = cursorSlot; - if (!((gSlotAgeReqs[cursorSlot] == 9) || - (gSlotAgeReqs[cursorSlot] == ((void)0, gSaveContext.save.linkAge)))) { + if (!CHECK_AGE_REQ_SLOT(cursorSlot)) { pauseCtx->nameColorSet = 1; } @@ -351,9 +350,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { if ((pauseCtx->debugState == 0) && (pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0)) { if (CHECK_BTN_ANY(input->press.button, BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) { - if (((gSlotAgeReqs[cursorSlot] == 9) || - (gSlotAgeReqs[cursorSlot] == ((void)0, gSaveContext.save.linkAge))) && - (cursorItem != ITEM_SOLD_OUT)) { + if (CHECK_AGE_REQ_SLOT(cursorSlot) && (cursorItem != ITEM_SOLD_OUT)) { if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { pauseCtx->equipTargetCBtn = 0; } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) { @@ -438,7 +435,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { if (gSaveContext.save.info.inventory.items[i] != ITEM_NONE) { if ((pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM) && (pauseCtx->cursorSpecialPos == 0)) { - if ((gSlotAgeReqs[i] == 9) || (gSlotAgeReqs[i] == ((void)0, gSaveContext.save.linkAge))) { + if (CHECK_AGE_REQ_SLOT(i)) { if ((sEquipState == 2) && (i == 3)) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, magicArrowEffectsR[pauseCtx->equipTargetItem - 0xBF], magicArrowEffectsG[pauseCtx->equipTargetItem - 0xBF], diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h index e8d8af8e4..d352ad678 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h @@ -9,8 +9,22 @@ extern s16 D_8082AAEC[]; extern s16 D_8082AB2C[]; extern u8 gSlotAgeReqs[]; extern u8 gEquipAgeReqs[EQUIP_TYPE_MAX][4]; +extern u8 gItemAgeReqs[]; extern u8 gAreaGsFlags[]; +#define AGE_REQ_ADULT LINK_AGE_ADULT +#define AGE_REQ_CHILD LINK_AGE_CHILD +#define AGE_REQ_NONE 9 + +#define CHECK_AGE_REQ_SLOT(slot) \ + ((gSlotAgeReqs[slot] == AGE_REQ_NONE) || gSlotAgeReqs[slot] == ((void)0, gSaveContext.save.linkAge)) + +#define CHECK_AGE_REQ_EQUIP(y, x) \ + ((gEquipAgeReqs[y][x] == AGE_REQ_NONE) || (gEquipAgeReqs[y][x] == ((void)0, gSaveContext.save.linkAge))) + +#define CHECK_AGE_REQ_ITEM(item) \ + ((gItemAgeReqs[item] == AGE_REQ_NONE) || (gItemAgeReqs[item] == ((void)0, gSaveContext.save.linkAge))) + void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx); s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point); void KaleidoScope_DrawDebugEditor(PlayState* play); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 0ea6f38ed..839372999 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -168,20 +168,146 @@ static u16 D_8082ABEC[] = { }; u8 gSlotAgeReqs[] = { - 1, 9, 9, 0, 0, 9, 1, 9, 9, 0, 0, 9, 1, 9, 1, 0, 0, 9, 9, 9, 9, 9, 0, 1, + AGE_REQ_CHILD, // SLOT_DEKU_STICK + AGE_REQ_NONE, // SLOT_DEKU_NUT + AGE_REQ_NONE, // SLOT_BOMB + AGE_REQ_ADULT, // SLOT_BOW + AGE_REQ_ADULT, // SLOT_ARROW_FIRE + AGE_REQ_NONE, // SLOT_DINS_FIRE + AGE_REQ_CHILD, // SLOT_SLINGSHOT + AGE_REQ_NONE, // SLOT_OCARINA + AGE_REQ_NONE, // SLOT_BOMBCHU + AGE_REQ_ADULT, // SLOT_HOOKSHOT + AGE_REQ_ADULT, // SLOT_ARROW_ICE + AGE_REQ_NONE, // SLOT_FARORES_WIND + AGE_REQ_CHILD, // SLOT_BOOMERANG + AGE_REQ_NONE, // SLOT_LENS_OF_TRUTH + AGE_REQ_CHILD, // SLOT_MAGIC_BEAN + AGE_REQ_ADULT, // SLOT_HAMMER + AGE_REQ_ADULT, // SLOT_ARROW_LIGHT + AGE_REQ_NONE, // SLOT_NAYRUS_LOVE + AGE_REQ_NONE, // SLOT_BOTTLE_1 + AGE_REQ_NONE, // SLOT_BOTTLE_2 + AGE_REQ_NONE, // SLOT_BOTTLE_3 + AGE_REQ_NONE, // SLOT_BOTTLE_4 + AGE_REQ_ADULT, // SLOT_TRADE_ADULT + AGE_REQ_CHILD, // SLOT_TRADE_CHILD }; -u8 gEquipAgeReqs[EQUIP_TYPE_MAX][4] = { - { 0, 1, 0, 0 }, - { 9, 1, 9, 0 }, - { 0, 9, 0, 0 }, - { 9, 9, 0, 0 }, +u8 gEquipAgeReqs[4][4] = { + { + AGE_REQ_ADULT, // 0 UPG_QUIVER + AGE_REQ_CHILD, // EQUIP_TYPE_SWORD EQUIP_VALUE_SWORD_KOKIRI + AGE_REQ_ADULT, // EQUIP_TYPE_SWORD EQUIP_VALUE_SWORD_MASTER + AGE_REQ_ADULT, // EQUIP_TYPE_SWORD EQUIP_VALUE_SWORD_BIGGORON + }, + { + AGE_REQ_NONE, // 0 UPG_BOMB_BAG + AGE_REQ_CHILD, // EQUIP_TYPE_SHIELD EQUIP_VALUE_SHIELD_DEKU + AGE_REQ_NONE, // EQUIP_TYPE_SHIELD EQUIP_VALUE_SHIELD_HYLIAN + AGE_REQ_ADULT, // EQUIP_TYPE_SHIELD EQUIP_VALUE_SHIELD_MIRROR + }, + { + AGE_REQ_ADULT, // 0 UPG_STRENGTH + AGE_REQ_NONE, // EQUIP_TYPE_TUNIC EQUIP_VALUE_TUNIC_KOKIRI + AGE_REQ_ADULT, // EQUIP_TYPE_TUNIC EQUIP_VALUE_TUNIC_GORON + AGE_REQ_ADULT, // EQUIP_TYPE_TUNIC EQUIP_VALUE_TUNIC_ZORA + }, + { + AGE_REQ_NONE, // 0 UPG_SCALE + AGE_REQ_NONE, // EQUIP_TYPE_BOOTS EQUIP_VALUE_BOOTS_KOKIRI + AGE_REQ_ADULT, // EQUIP_TYPE_BOOTS EQUIP_VALUE_BOOTS_IRON + AGE_REQ_ADULT, // EQUIP_TYPE_BOOTS EQUIP_VALUE_BOOTS_HOVER + }, }; u8 gItemAgeReqs[] = { - 1, 9, 9, 0, 0, 9, 1, 9, 9, 9, 0, 0, 0, 9, 1, 9, 1, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 1, 9, 0, 9, 0, 0, 9, 0, 0, 1, 1, 1, 0, 0, 0, 9, 9, 9, 1, 0, 0, 9, 9, 0, + AGE_REQ_CHILD, // ITEM_DEKU_STICK + AGE_REQ_NONE, // ITEM_DEKU_NUT + AGE_REQ_NONE, // ITEM_BOMB + AGE_REQ_ADULT, // ITEM_BOW + AGE_REQ_ADULT, // ITEM_ARROW_FIRE + AGE_REQ_NONE, // ITEM_DINS_FIRE + AGE_REQ_CHILD, // ITEM_SLINGSHOT + AGE_REQ_NONE, // ITEM_OCARINA_FAIRY + AGE_REQ_NONE, // ITEM_OCARINA_OF_TIME + AGE_REQ_NONE, // ITEM_BOMBCHU + AGE_REQ_ADULT, // ITEM_HOOKSHOT + AGE_REQ_ADULT, // ITEM_LONGSHOT + AGE_REQ_ADULT, // ITEM_ARROW_ICE + AGE_REQ_NONE, // ITEM_FARORES_WIND + AGE_REQ_CHILD, // ITEM_BOOMERANG + AGE_REQ_NONE, // ITEM_LENS_OF_TRUTH + AGE_REQ_CHILD, // ITEM_MAGIC_BEAN + AGE_REQ_ADULT, // ITEM_HAMMER + AGE_REQ_ADULT, // ITEM_ARROW_LIGHT + AGE_REQ_NONE, // ITEM_NAYRUS_LOVE + AGE_REQ_NONE, // ITEM_BOTTLE_EMPTY + AGE_REQ_NONE, // ITEM_BOTTLE_POTION_RED + AGE_REQ_NONE, // ITEM_BOTTLE_POTION_GREEN + AGE_REQ_NONE, // ITEM_BOTTLE_POTION_BLUE + AGE_REQ_NONE, // ITEM_BOTTLE_FAIRY + AGE_REQ_NONE, // ITEM_BOTTLE_FISH + AGE_REQ_NONE, // ITEM_BOTTLE_MILK_FULL + AGE_REQ_NONE, // ITEM_BOTTLE_RUTOS_LETTER + AGE_REQ_NONE, // ITEM_BOTTLE_BLUE_FIRE + AGE_REQ_NONE, // ITEM_BOTTLE_BUG + AGE_REQ_NONE, // ITEM_BOTTLE_BIG_POE + AGE_REQ_NONE, // ITEM_BOTTLE_MILK_HALF + AGE_REQ_NONE, // ITEM_BOTTLE_POE + AGE_REQ_CHILD, // ITEM_WEIRD_EGG + AGE_REQ_CHILD, // ITEM_CHICKEN + AGE_REQ_CHILD, // ITEM_ZELDAS_LETTER + AGE_REQ_CHILD, // ITEM_MASK_KEATON + AGE_REQ_CHILD, // ITEM_MASK_SKULL + AGE_REQ_CHILD, // ITEM_MASK_SPOOKY + AGE_REQ_CHILD, // ITEM_MASK_BUNNY_HOOD + AGE_REQ_CHILD, // ITEM_MASK_GORON + AGE_REQ_CHILD, // ITEM_MASK_ZORA + AGE_REQ_CHILD, // ITEM_MASK_GERUDO + AGE_REQ_CHILD, // ITEM_MASK_TRUTH + AGE_REQ_CHILD, // ITEM_SOLD_OUT + AGE_REQ_ADULT, // ITEM_POCKET_EGG + AGE_REQ_ADULT, // ITEM_POCKET_CUCCO + AGE_REQ_ADULT, // ITEM_COJIRO + AGE_REQ_ADULT, // ITEM_ODD_MUSHROOM + AGE_REQ_ADULT, // ITEM_ODD_POTION + AGE_REQ_ADULT, // ITEM_POACHERS_SAW + AGE_REQ_ADULT, // ITEM_BROKEN_GORONS_SWORD + AGE_REQ_ADULT, // ITEM_PRESCRIPTION + AGE_REQ_ADULT, // ITEM_EYEBALL_FROG + AGE_REQ_ADULT, // ITEM_EYE_DROPS + AGE_REQ_ADULT, // ITEM_CLAIM_CHECK + AGE_REQ_ADULT, // ITEM_BOW_FIRE + AGE_REQ_ADULT, // ITEM_BOW_ICE + AGE_REQ_ADULT, // ITEM_BOW_LIGHT + AGE_REQ_CHILD, // ITEM_SWORD_KOKIRI + AGE_REQ_ADULT, // ITEM_SWORD_MASTER + AGE_REQ_ADULT, // ITEM_SWORD_BIGGORON + AGE_REQ_CHILD, // ITEM_SHIELD_DEKU + AGE_REQ_NONE, // ITEM_SHIELD_HYLIAN + AGE_REQ_ADULT, // ITEM_SHIELD_MIRROR + AGE_REQ_NONE, // ITEM_TUNIC_KOKIRI + AGE_REQ_ADULT, // ITEM_TUNIC_GORON + AGE_REQ_ADULT, // ITEM_TUNIC_ZORA + AGE_REQ_NONE, // ITEM_BOOTS_KOKIRI + AGE_REQ_ADULT, // ITEM_BOOTS_IRON + AGE_REQ_ADULT, // ITEM_BOOTS_HOVER + AGE_REQ_CHILD, // ITEM_BULLET_BAG_30 + AGE_REQ_CHILD, // ITEM_BULLET_BAG_40 + AGE_REQ_CHILD, // ITEM_BULLET_BAG_50 + AGE_REQ_ADULT, // ITEM_QUIVER_30 + AGE_REQ_ADULT, // ITEM_QUIVER_40 + AGE_REQ_ADULT, // ITEM_QUIVER_50 + AGE_REQ_NONE, // ITEM_BOMB_BAG_20 + AGE_REQ_NONE, // ITEM_BOMB_BAG_30 + AGE_REQ_NONE, // ITEM_BOMB_BAG_40 + AGE_REQ_CHILD, // ITEM_STRENGTH_GORONS_BRACELET + AGE_REQ_ADULT, // ITEM_STRENGTH_SILVER_GAUNTLETS + AGE_REQ_ADULT, // ITEM_STRENGTH_GOLD_GAUNTLETS + AGE_REQ_NONE, // ITEM_SCALE_SILVER + AGE_REQ_NONE, // ITEM_SCALE_GOLDEN + AGE_REQ_ADULT, // ITEM_GIANTS_KNIFE }; u8 gAreaGsFlags[] = { @@ -2557,7 +2683,7 @@ void KaleidoScope_Update(PlayState* play) { gSegments[8] = VIRTUAL_TO_PHYSICAL(pauseCtx->iconItemSegment); for (i = 0; i < ARRAY_COUNTU(gItemAgeReqs); i++) { - if ((gItemAgeReqs[i] != 9) && (gItemAgeReqs[i] != ((void)0, gSaveContext.save.linkAge))) { + if (!CHECK_AGE_REQ_ITEM(i)) { KaleidoScope_GrayOutTextureRGBA32(SEGMENTED_TO_VIRTUAL(gItemIcons[i]), ITEM_ICON_WIDTH * ITEM_ICON_HEIGHT); } From 4842f62833eda04e3883c9ddb4cff133cea27cb0 Mon Sep 17 00:00:00 2001 From: Nuss <67802335+hack-nuss@users.noreply.github.com> Date: Fri, 22 Sep 2023 18:13:26 +0200 Subject: [PATCH 23/29] wrong path (#1548) --- docs/tutorial/contents.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/contents.md b/docs/tutorial/contents.md index 477dc3bc6..c3279a437 100644 --- a/docs/tutorial/contents.md +++ b/docs/tutorial/contents.md @@ -6,7 +6,7 @@ ## Pre-decompilation - Building the repo (follow the instructions in the README.md) -- Most of us use VSCode. (You can watch Fig's video to get an idea of how this can be used). Some useful information is [here](vscode.md). +- Most of us use VSCode. (You can watch Fig's video to get an idea of how this can be used). Some useful information is [here](../vscode.md). - Choosing a first actor (You want something small that has simple interactions with the environment. But OoT is far enough in that there are basically no unreserved actors left anyway now.) ## Decompilation From fefeb369dd19172d5eb419f8c8373cfb10d59d19 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 22 Sep 2023 20:48:09 +0200 Subject: [PATCH 24/29] Name the main pause state and add placeholder enum for main (sub)states (#1551) --- include/z64pause.h | 18 ++- src/code/z_kaleido_scope_call.c | 4 +- src/code/z_kaleido_setup.c | 4 +- src/code/z_parameter.c | 2 +- .../ovl_kaleido_scope/z_kaleido_collect.c | 48 ++++---- .../ovl_kaleido_scope/z_kaleido_equipment.c | 15 +-- .../misc/ovl_kaleido_scope/z_kaleido_item.c | 15 ++- .../ovl_kaleido_scope/z_kaleido_map_PAL.c | 6 +- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 107 ++++++++++-------- 9 files changed, 125 insertions(+), 94 deletions(-) diff --git a/include/z64pause.h b/include/z64pause.h index f25d5c6ed..1cc810c31 100644 --- a/include/z64pause.h +++ b/include/z64pause.h @@ -33,7 +33,7 @@ typedef enum { /* 3 */ PAUSE_STATE_INIT, // Load data and initialize/setup various things. /* 4 */ PAUSE_STATE_OPENING_1, // Animate the pause menu coming together with rotations and other animations. /* 5 */ PAUSE_STATE_OPENING_2, // Finish some animations for opening the menu. - /* 6 */ PAUSE_STATE_6, // Pause menu ready for player inputs. + /* 6 */ PAUSE_STATE_MAIN, // Pause menu ready for player inputs. /* 7 */ PAUSE_STATE_SAVE_PROMPT, // Save prompt in the pause menu /* 8 */ PAUSE_STATE_8, /* 9 */ PAUSE_STATE_9, @@ -55,6 +55,20 @@ typedef enum { #define IS_PAUSED(pauseCtx) \ (((pauseCtx)->state != PAUSE_STATE_OFF) || ((pauseCtx)->debugState != 0)) +// Sub-states of PAUSE_STATE_MAIN +typedef enum { + /* 0 */ PAUSE_MAIN_STATE_IDLE, + /* 1 */ PAUSE_MAIN_STATE_1, + /* 2 */ PAUSE_MAIN_STATE_2, + /* 3 */ PAUSE_MAIN_STATE_3, + /* 4 */ PAUSE_MAIN_STATE_4, + /* 5 */ PAUSE_MAIN_STATE_5, + /* 6 */ PAUSE_MAIN_STATE_6, + /* 7 */ PAUSE_MAIN_STATE_7, + /* 8 */ PAUSE_MAIN_STATE_8, + /* 9 */ PAUSE_MAIN_STATE_9 +} PauseMainState; + typedef struct { /* 0x0000 */ View view; /* 0x0128 */ u8* iconItemSegment; @@ -83,7 +97,7 @@ typedef struct { /* 0x01D4 */ u16 state; /* 0x01D6 */ u16 debugState; /* 0x01D8 */ Vec3f eye; - /* 0x01E4 */ u16 unk_1E4; + /* 0x01E4 */ u16 mainState; /* 0x01E6 */ u16 mode; /* 0x01E8 */ u16 pageIndex; // "kscp_pos" /* 0x01EA */ u16 unk_1EA; diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 4278b12ef..c61eb3354 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -62,7 +62,7 @@ void KaleidoScopeCall_Update(PlayState* play) { R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_LOG_MODE = 3; R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->unk_1EC = 0; pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_WAIT_BG_PRERENDER } @@ -70,7 +70,7 @@ void KaleidoScopeCall_Update(PlayState* play) { R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_LOG_MODE = 3; R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->unk_1EC = 0; pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_9 } else if ((pauseCtx->state == PAUSE_STATE_WAIT_BG_PRERENDER) || (pauseCtx->state == PAUSE_STATE_9)) { diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 554282ba1..9f264378b 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -31,7 +31,7 @@ void KaleidoSetup_Update(PlayState* play) { WREG(17) = 155; pauseCtx->unk_1EA = 0; - pauseCtx->unk_1E4 = 1; + pauseCtx->mainState = PAUSE_MAIN_STATE_1; if (ZREG(48) == 0) { pauseCtx->eye.x = sKaleidoSetupEyeX0[pauseCtx->pageIndex]; @@ -71,7 +71,7 @@ void KaleidoSetup_Init(PlayState* play) { pauseCtx->debugState = 0; pauseCtx->alpha = 0; pauseCtx->unk_1EA = 0; - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->mode = 0; pauseCtx->pageIndex = PAUSE_ITEM; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 28a7ef06e..86687ca92 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -3371,7 +3371,7 @@ void Interface_Draw(PlayState* play) { func_8008A994(interfaceCtx); - if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 3)) { + if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_3)) { // Inventory Equip Effects gSPSegment(OVERLAY_DISP++, 0x08, pauseCtx->iconItemSegment); Gfx_SetupDL_42Overlay(play->state.gfxCtx); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index 77cd9b4e1..bad87200a 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -79,14 +79,15 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx, "../z_kaleido_collect.c", 248); - if ((((u32)pauseCtx->unk_1E4 == 0) || (pauseCtx->unk_1E4 == 5) || (pauseCtx->unk_1E4 == 8)) && + if ((((u32)pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (pauseCtx->mainState == PAUSE_MAIN_STATE_5) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_8)) && (pauseCtx->pageIndex == PAUSE_QUEST)) { pauseCtx->cursorColorSet = 0; if (pauseCtx->cursorSpecialPos == 0) { pauseCtx->nameColorSet = 0; - if ((pauseCtx->state != PAUSE_STATE_6) || ((pauseCtx->stickAdjX == 0) && (pauseCtx->stickAdjY == 0))) { + if ((pauseCtx->state != PAUSE_STATE_MAIN) || ((pauseCtx->stickAdjX == 0) && (pauseCtx->stickAdjY == 0))) { sp216 = pauseCtx->cursorSlot[PAUSE_QUEST]; } else { phi_s3 = pauseCtx->cursorPoint[PAUSE_QUEST]; @@ -95,7 +96,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { phi_s0 = D_8082A1AC[phi_s3][2]; if (phi_s0 == -3) { KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; } else { while (phi_s0 >= 0) { if ((s16)KaleidoScope_UpdateQuestStatusPoint(pauseCtx, phi_s0) != 0) { @@ -108,7 +109,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { phi_s0 = D_8082A1AC[phi_s3][3]; if (phi_s0 == -2) { KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; } else { while (phi_s0 >= 0) { if ((s16)KaleidoScope_UpdateQuestStatusPoint(pauseCtx, phi_s0) != 0) { @@ -138,7 +139,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { } if (phi_s3 != pauseCtx->cursorPoint[PAUSE_QUEST]) { - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } @@ -178,7 +179,8 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { KaleidoScope_SetCursorVtx(pauseCtx, sp216 * 4, pauseCtx->questVtx); - if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->cursorSpecialPos == 0)) { + if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && + (pauseCtx->cursorSpecialPos == 0)) { if ((sp216 >= QUEST_SONG_MINUET) && (sp216 < QUEST_KOKIRI_EMERALD)) { if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) { sp216 = pauseCtx->cursorSlot[PAUSE_QUEST]; @@ -201,19 +203,19 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { VREG(23) = -49; VREG(24) = -46; VREG(25) = -41; - pauseCtx->unk_1E4 = 8; + pauseCtx->mainState = PAUSE_MAIN_STATE_8; AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } } - } else if (pauseCtx->unk_1E4 == 5) { + } else if (pauseCtx->mainState == PAUSE_MAIN_STATE_5) { if ((pauseCtx->stickAdjX != 0) || (pauseCtx->stickAdjY != 0)) { - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } - } else if (pauseCtx->unk_1E4 == 8) { + } else if (pauseCtx->mainState == PAUSE_MAIN_STATE_8) { if (CHECK_BTN_ALL(input->press.button, BTN_A) && (sp216 >= QUEST_SONG_MINUET) && (sp216 < QUEST_KOKIRI_EMERALD)) { - pauseCtx->unk_1E4 = 9; + pauseCtx->mainState = PAUSE_MAIN_STATE_9; D_8082A120 = 10; } } @@ -262,7 +264,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { } } else { - if (pauseCtx->unk_1E4 == 9) { + if (pauseCtx->mainState == PAUSE_MAIN_STATE_9) { pauseCtx->cursorColorSet = 8; if (--D_8082A120 == 0) { @@ -282,7 +284,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); pauseCtx->ocarinaSongIdx = gOcarinaSongItemMap[sp216 - QUEST_SONG_MINUET]; AudioOcarina_SetPlaybackSong(pauseCtx->ocarinaSongIdx + 1, 1); - pauseCtx->unk_1E4 = 2; + pauseCtx->mainState = PAUSE_MAIN_STATE_2; pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); pauseCtx->ocarinaStaff->pos = 0; sp216 = pauseCtx->cursorSlot[PAUSE_QUEST]; @@ -462,23 +464,24 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { 48, 48, 0); } - if (pauseCtx->state == PAUSE_STATE_6) { + if (pauseCtx->state == PAUSE_STATE_MAIN) { gDPPipeSync(POLY_OPA_DISP++); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); sp21A += 4; if ((pauseCtx->cursorSpecialPos == 0) && (sp216 >= 6) && (sp216 < 0x12)) { - if ((pauseCtx->unk_1E4 < 3) || (pauseCtx->unk_1E4 == 5) || (pauseCtx->unk_1E4 == 8)) { + if ((pauseCtx->mainState < PAUSE_MAIN_STATE_3) || (pauseCtx->mainState == PAUSE_MAIN_STATE_5) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_8)) { if (pauseCtx->cursorItem[pauseCtx->pageIndex] != PAUSE_ITEM_NONE) { pauseCtx->cursorColorSet = 8; - if ((pauseCtx->unk_1E4 >= 2) && (pauseCtx->unk_1E4 < 7)) { + if ((pauseCtx->mainState >= PAUSE_MAIN_STATE_2) && (pauseCtx->mainState < PAUSE_MAIN_STATE_7)) { pauseCtx->cursorColorSet = 0; } } } } - if (pauseCtx->unk_1E4 == 2) { + if (pauseCtx->mainState == PAUSE_MAIN_STATE_2) { pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); if (pauseCtx->ocarinaStaff->pos != 0) { @@ -523,7 +526,8 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); } } - } else if (((pauseCtx->unk_1E4 >= 4) && (pauseCtx->unk_1E4 <= 6)) || (pauseCtx->unk_1E4 == 8)) { + } else if (((pauseCtx->mainState >= PAUSE_MAIN_STATE_4) && (pauseCtx->mainState <= PAUSE_MAIN_STATE_6)) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_8)) { sp224 = pauseCtx->ocarinaSongIdx; sp226 = gOcarinaSongButtons[sp224].numButtons; @@ -536,7 +540,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gDPPipeSync(POLY_OPA_DISP++); - if (pauseCtx->unk_1E4 == 8) { + if (pauseCtx->mainState == PAUSE_MAIN_STATE_8) { if (gOcarinaSongButtons[sp224].buttonsIndex[phi_s3] == OCARINA_BTN_A) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 80, 255, 150, 200); } else { @@ -557,7 +561,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); } - if (pauseCtx->unk_1E4 != 8) { + if (pauseCtx->mainState != PAUSE_MAIN_STATE_8) { pauseCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); if (pauseCtx->ocarinaStaff->pos != 0) { @@ -609,7 +613,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); } - if (pauseCtx->unk_1E4 == 4) { + if (pauseCtx->mainState == PAUSE_MAIN_STATE_4) { for (phi_s3 = 0; phi_s3 < 8; phi_s3++) { D_8082A124[phi_s3] = 0xFF; D_8082A150[phi_s3] = 0; @@ -621,7 +625,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); pauseCtx->ocarinaStaff->pos = 0; pauseCtx->ocarinaStaff->state = 0xFE; - pauseCtx->unk_1E4 = 5; + pauseCtx->mainState = PAUSE_MAIN_STATE_5; } } } diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index 1af28c4a7..3dd50e6fa 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -152,7 +152,8 @@ void KaleidoScope_DrawEquipment(PlayState* play) { } } - if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_EQUIP)) { + if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && + (pauseCtx->pageIndex == PAUSE_EQUIP)) { oldCursorPoint = pauseCtx->cursorPoint[PAUSE_EQUIP]; pauseCtx->cursorColorSet = 0; @@ -468,7 +469,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { KaleidoScope_SetCursorVtx(pauseCtx, cursorSlot * 4, pauseCtx->equipVtx); if ((pauseCtx->cursorSpecialPos == 0) && (cursorItem != PAUSE_ITEM_NONE) && - (pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && + (pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && CHECK_BTN_ALL(input->press.button, BTN_A) && (pauseCtx->cursorX[PAUSE_EQUIP] != 0)) { if (CHECK_AGE_REQ_EQUIP(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP])) { @@ -498,7 +499,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - pauseCtx->unk_1E4 = 7; + pauseCtx->mainState = PAUSE_MAIN_STATE_7; sEquipTimer = 10; } else { Audio_PlaySfxGeneral(NA_SE_SY_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -510,13 +511,13 @@ void KaleidoScope_DrawEquipment(PlayState* play) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - } else if ((pauseCtx->unk_1E4 == 7) && (pauseCtx->pageIndex == PAUSE_EQUIP)) { + } else if ((pauseCtx->mainState == PAUSE_MAIN_STATE_7) && (pauseCtx->pageIndex == PAUSE_EQUIP)) { KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_EQUIP] * 4, pauseCtx->equipVtx); pauseCtx->cursorColorSet = 8; sEquipTimer--; if (sEquipTimer == 0) { - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; } } @@ -586,11 +587,11 @@ void KaleidoScope_DrawEquipment(PlayState* play) { KaleidoScope_DrawPlayerWork(play); - if ((pauseCtx->unk_1E4 == 7) && (sEquipTimer == 10)) { + if ((pauseCtx->mainState == PAUSE_MAIN_STATE_7) && (sEquipTimer == 10)) { KaleidoScope_SetupPlayerPreRender(play); } - if ((pauseCtx->unk_1E4 == 7) && (sEquipTimer == 9)) { + if ((pauseCtx->mainState == PAUSE_MAIN_STATE_7) && (sEquipTimer == 9)) { //! @bug: This function shouldn't take any arguments KaleidoScope_ProcessPlayerPreRender(play); } diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index 6d8a846c9..7a0c99503 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -103,7 +103,8 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { pauseCtx->cursorColorSet = 0; pauseCtx->nameColorSet = 0; - if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM)) { + if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && + (pauseCtx->pageIndex == PAUSE_ITEM)) { moveCursorResult = 0; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; @@ -348,7 +349,8 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { index = cursorSlot * 4; // required to match? KaleidoScope_SetCursorVtx(pauseCtx, index, pauseCtx->itemVtx); - if ((pauseCtx->debugState == 0) && (pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0)) { + if ((pauseCtx->debugState == 0) && (pauseCtx->state == PAUSE_STATE_MAIN) && + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { if (CHECK_BTN_ANY(input->press.button, BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) { if (CHECK_AGE_REQ_SLOT(cursorSlot) && (cursorItem != ITEM_SOLD_OUT)) { if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { @@ -361,7 +363,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { pauseCtx->equipTargetItem = cursorItem; pauseCtx->equipTargetSlot = cursorSlot; - pauseCtx->unk_1E4 = 3; + pauseCtx->mainState = PAUSE_MAIN_STATE_3; pauseCtx->equipAnimX = pauseCtx->itemVtx[index].v.ob[0] * 10; pauseCtx->equipAnimY = pauseCtx->itemVtx[index].v.ob[1] * 10; pauseCtx->equipAnimAlpha = 255; @@ -410,7 +412,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - } else if ((pauseCtx->unk_1E4 == 3) && (pauseCtx->pageIndex == PAUSE_ITEM)) { + } else if ((pauseCtx->mainState == PAUSE_MAIN_STATE_3) && (pauseCtx->pageIndex == PAUSE_ITEM)) { KaleidoScope_SetCursorVtx(pauseCtx, cursorSlot * 4, pauseCtx->itemVtx); pauseCtx->cursorColorSet = 4; } @@ -434,7 +436,8 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); if (gSaveContext.save.info.inventory.items[i] != ITEM_NONE) { - if ((pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM) && (pauseCtx->cursorSpecialPos == 0)) { + if ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && (pauseCtx->pageIndex == PAUSE_ITEM) && + (pauseCtx->cursorSpecialPos == 0)) { if (CHECK_AGE_REQ_SLOT(i)) { if ((sEquipState == 2) && (i == 3)) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, magicArrowEffectsR[pauseCtx->equipTargetItem - 0xBF], @@ -815,7 +818,7 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { gSaveContext.save.info.equips.cButtonSlots[2]); } - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; sEquipMoveTimer = 10; WREG(90) = 320; WREG(87) = WREG(91); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c index b14003eed..91ed62d4b 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c @@ -46,7 +46,8 @@ void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx, "../z_kaleido_map_PAL.c", 123); - if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) { + if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && + (pauseCtx->pageIndex == PAUSE_MAP)) { pauseCtx->cursorColorSet = 0; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_MAP]; @@ -410,7 +411,8 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx, "../z_kaleido_map_PAL.c", 556); - if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) { + if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && + (pauseCtx->pageIndex == PAUSE_MAP)) { pauseCtx->cursorColorSet = 0; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 839372999..8b54f595e 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -491,7 +491,7 @@ void KaleidoScope_SetDefaultCursor(PlayState* play) { } void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 pt) { - pauseCtx->unk_1E4 = 1; + pauseCtx->mainState = PAUSE_MAIN_STATE_1; pauseCtx->unk_1EA = 0; if (!pt) { @@ -560,10 +560,12 @@ void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex) { OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 955); - temp = pauseCtx->unk_1E4; + temp = pauseCtx->mainState; - if ((((pauseCtx->unk_1E4 == 0) || (temp == 8)) && (pauseCtx->state == PAUSE_STATE_6)) || - ((pauseCtx->pageIndex == PAUSE_QUEST) && ((temp < 3) || (temp == 5) || (temp == 8)))) { + if ((((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (temp == PAUSE_MAIN_STATE_8)) && + (pauseCtx->state == PAUSE_STATE_MAIN)) || + ((pauseCtx->pageIndex == PAUSE_QUEST) && + ((temp < PAUSE_MAIN_STATE_3) || (temp == PAUSE_MAIN_STATE_5) || (temp == PAUSE_MAIN_STATE_8)))) { if (pauseCtx->pageIndex == pageIndex) { s16 i; @@ -1153,7 +1155,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { pauseCtx->infoPanelVtx[5].v.ob[0] = pauseCtx->infoPanelVtx[7].v.ob[0] = pauseCtx->infoPanelVtx[4].v.ob[0] + 72; - if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) && (pauseCtx->unk_1E4 == 0)) { + if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { pauseCtx->infoPanelVtx[8].v.ob[0] = pauseCtx->infoPanelVtx[10].v.ob[0] = WREG(16); pauseCtx->infoPanelVtx[9].v.ob[0] = pauseCtx->infoPanelVtx[11].v.ob[0] = pauseCtx->infoPanelVtx[8].v.ob[0] + 24; @@ -1173,7 +1175,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { pauseCtx->infoPanelVtx[8].v.ob[1] - 26; } - if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) && (pauseCtx->unk_1E4 == 0)) { + if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { pauseCtx->infoPanelVtx[12].v.ob[0] = pauseCtx->infoPanelVtx[14].v.ob[0] = WREG(17); pauseCtx->infoPanelVtx[13].v.ob[0] = pauseCtx->infoPanelVtx[15].v.ob[0] = @@ -1214,7 +1216,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { gSPDisplayList(POLY_OPA_DISP++, gItemNamePanelDL); - if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) && (pauseCtx->unk_1E4 == 0)) { + if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, D_808321A0, D_808321A2, D_808321A4, D_808321A6); } @@ -1222,7 +1224,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 180, 210, 255, 220); - if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) && (pauseCtx->unk_1E4 == 0)) { + if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, D_808321A0, D_808321A2, D_808321A4, D_808321A6); } @@ -1247,13 +1249,15 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); gDPSetEnvColor(POLY_OPA_DISP++, 20, 30, 40, 0); - if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->namedItem != PAUSE_ITEM_NONE) && + if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->namedItem != PAUSE_ITEM_NONE) && (pauseCtx->nameDisplayTimer < WREG(89)) && - (((u32)pauseCtx->unk_1E4 == 0) || (pauseCtx->unk_1E4 == 2) || - ((pauseCtx->unk_1E4 >= 4) && (pauseCtx->unk_1E4 <= 7)) || (pauseCtx->unk_1E4 == 8)) && + (((u32)pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (pauseCtx->mainState == PAUSE_MAIN_STATE_2) || + ((pauseCtx->mainState >= PAUSE_MAIN_STATE_4) && (pauseCtx->mainState <= PAUSE_MAIN_STATE_7)) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_8)) && (pauseCtx->cursorSpecialPos == 0)) { - if (((u32)pauseCtx->unk_1E4 == 0) || (pauseCtx->unk_1E4 == 2) || - ((pauseCtx->unk_1E4 >= 4) && (pauseCtx->unk_1E4 <= 7)) || (pauseCtx->unk_1E4 == 8)) { + if (((u32)pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (pauseCtx->mainState == PAUSE_MAIN_STATE_2) || + ((pauseCtx->mainState >= PAUSE_MAIN_STATE_4) && (pauseCtx->mainState <= PAUSE_MAIN_STATE_7)) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_8)) { pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = -63; pauseCtx->infoPanelVtx[17].v.ob[0] = pauseCtx->infoPanelVtx[19].v.ob[0] = @@ -1317,7 +1321,8 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { QUEST_ICON_HEIGHT, 0); } } - } else if ((pauseCtx->unk_1E4 < 3) || (pauseCtx->unk_1E4 == 7) || (pauseCtx->unk_1E4 == 8)) { + } else if ((pauseCtx->mainState < PAUSE_MAIN_STATE_3) || (pauseCtx->mainState == PAUSE_MAIN_STATE_7) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_8)) { pauseCtx->infoPanelVtx[20].v.ob[1] = pauseCtx->infoPanelVtx[21].v.ob[1] = temp; pauseCtx->infoPanelVtx[22].v.ob[1] = pauseCtx->infoPanelVtx[23].v.ob[1] = @@ -1352,7 +1357,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, D_8082AD60[gSaveContext.language], D_8082ADE0[gSaveContext.language], 16, 4); } else if (pauseCtx->cursorSpecialPos != 0) { - if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0)) { + if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = -63; pauseCtx->infoPanelVtx[17].v.ob[0] = pauseCtx->infoPanelVtx[19].v.ob[0] = @@ -1509,7 +1514,7 @@ void KaleidoScope_UpdateNamePanel(PlayState* play) { } } else if (pauseCtx->nameColorSet == 0) { if (((pauseCtx->pageIndex == PAUSE_QUEST) && (pauseCtx->cursorSlot[PAUSE_QUEST] >= 6) && - (pauseCtx->cursorSlot[PAUSE_QUEST] <= 0x11) && (pauseCtx->unk_1E4 == 8)) || + (pauseCtx->cursorSlot[PAUSE_QUEST] <= 0x11) && (pauseCtx->mainState == PAUSE_MAIN_STATE_8)) || (pauseCtx->pageIndex == PAUSE_ITEM) || ((pauseCtx->pageIndex == PAUSE_EQUIP) && (pauseCtx->cursorX[PAUSE_EQUIP] != 0))) { if (pauseCtx->namedItem != ITEM_SOLD_OUT) { @@ -1553,7 +1558,7 @@ void func_808237B4(PlayState* play, Input* input) { if (pauseCtx->unk_1EA == 64) { pauseCtx->unk_1EA = 0; pauseCtx->pageIndex = D_8082ABEC[pauseCtx->mode]; - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; } } } @@ -2479,8 +2484,8 @@ void KaleidoScope_UpdateOpening(PlayState* play) { gSaveContext.buttonStatus[3] = D_8082AB6C[pauseCtx->pageIndex][3]; gSaveContext.buttonStatus[4] = D_8082AB6C[pauseCtx->pageIndex][4]; pauseCtx->pageIndex = D_8082ABEC[pauseCtx->mode]; - pauseCtx->unk_1E4 = 0; - pauseCtx->state++; // PAUSE_STATE_6 + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; + pauseCtx->state++; // PAUSE_STATE_MAIN pauseCtx->alpha = 255; Interface_LoadActionLabelB(play, DO_ACTION_SAVE); } else if (pauseCtx->unk_1EA == 64) { @@ -2613,7 +2618,7 @@ void KaleidoScope_UpdateDungeonMap(PlayState* play) { } void KaleidoScope_Update(PlayState* play) { - static s16 D_8082B258 = 0; + static s16 D_8082B258 = PAUSE_MAIN_STATE_IDLE; static s16 D_8082B25C = 10; static s16 D_8082B260 = 0; PauseContext* pauseCtx = &play->pauseCtx; @@ -2636,16 +2641,18 @@ void KaleidoScope_Update(PlayState* play) { (((pauseCtx->state >= PAUSE_STATE_OPENING_1) && (pauseCtx->state <= PAUSE_STATE_SAVE_PROMPT)) || ((pauseCtx->state >= PAUSE_STATE_10) && (pauseCtx->state <= PAUSE_STATE_CLOSING)))) { - if ((((u32)pauseCtx->unk_1E4 == 0) || (pauseCtx->unk_1E4 == 8)) && (pauseCtx->state == PAUSE_STATE_6)) { + if ((((u32)pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (pauseCtx->mainState == PAUSE_MAIN_STATE_8)) && + (pauseCtx->state == PAUSE_STATE_MAIN)) { pauseCtx->stickAdjX = input->rel.stick_x; pauseCtx->stickAdjY = input->rel.stick_y; KaleidoScope_UpdateCursorSize(play); KaleidoScope_HandlePageToggles(pauseCtx, input); - } else if ((pauseCtx->pageIndex == PAUSE_QUEST) && ((pauseCtx->unk_1E4 < 3) || (pauseCtx->unk_1E4 == 5))) { + } else if ((pauseCtx->pageIndex == PAUSE_QUEST) && + ((pauseCtx->mainState < PAUSE_MAIN_STATE_3) || (pauseCtx->mainState == PAUSE_MAIN_STATE_5))) { KaleidoScope_UpdateCursorSize(play); } - if (pauseCtx->state == PAUSE_STATE_6) { + if (pauseCtx->state == PAUSE_STATE_MAIN) { KaleidoScope_UpdateNamePanel(play); } } @@ -3052,14 +3059,14 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->alpha += (u16)(255 / (WREG(6) + WREG(4))); KaleidoScope_UpdateOpening(play); - if (pauseCtx->state == PAUSE_STATE_6) { + if (pauseCtx->state == PAUSE_STATE_MAIN) { KaleidoScope_UpdateNamePanel(play); } break; - case PAUSE_STATE_6: - switch (pauseCtx->unk_1E4) { - case 0: + case PAUSE_STATE_MAIN: + switch (pauseCtx->mainState) { + case PAUSE_MAIN_STATE_IDLE: if (CHECK_BTN_ALL(input->press.button, BTN_START)) { Interface_SetDoAction(play, DO_ACTION_NONE); pauseCtx->state = PAUSE_STATE_CLOSING; @@ -3080,26 +3087,26 @@ void KaleidoScope_Update(PlayState* play) { } break; - case 1: + case PAUSE_MAIN_STATE_1: func_808237B4(play, play->state.input); break; - case 2: + case PAUSE_MAIN_STATE_2: pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); if (pauseCtx->ocarinaStaff->state == 0) { - pauseCtx->unk_1E4 = 4; + pauseCtx->mainState = PAUSE_MAIN_STATE_4; AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } break; - case 3: + case PAUSE_MAIN_STATE_3: KaleidoScope_UpdateItemEquip(play); break; - case 4: + case PAUSE_MAIN_STATE_4: break; - case 5: + case PAUSE_MAIN_STATE_5: pauseCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); if (CHECK_BTN_ALL(input->press.button, BTN_START)) { @@ -3108,11 +3115,11 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->state = PAUSE_STATE_CLOSING; WREG(2) = -6240; func_800F64E0(0); - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; break; } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->mode = 0; pauseCtx->promptChoice = 0; Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -3127,42 +3134,42 @@ void KaleidoScope_Update(PlayState* play) { } else if (pauseCtx->ocarinaStaff->state == pauseCtx->ocarinaSongIdx) { Audio_PlaySfxGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - D_8082B258 = 0; + D_8082B258 = PAUSE_MAIN_STATE_IDLE; D_8082B25C = 30; - pauseCtx->unk_1E4 = 6; + pauseCtx->mainState = PAUSE_MAIN_STATE_6; } else if (pauseCtx->ocarinaStaff->state == 0xFF) { Audio_PlaySfxGeneral(NA_SE_SY_OCARINA_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - D_8082B258 = 4; + D_8082B258 = PAUSE_MAIN_STATE_4; D_8082B25C = 20; - pauseCtx->unk_1E4 = 6; + pauseCtx->mainState = PAUSE_MAIN_STATE_6; } break; - case 6: + case PAUSE_MAIN_STATE_6: D_8082B25C--; if (D_8082B25C == 0) { - pauseCtx->unk_1E4 = D_8082B258; - if (pauseCtx->unk_1E4 == 0) { + pauseCtx->mainState = D_8082B258; + if (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } } break; - case 7: + case PAUSE_MAIN_STATE_7: break; - case 8: + case PAUSE_MAIN_STATE_8: if (CHECK_BTN_ALL(input->press.button, BTN_START)) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); Interface_SetDoAction(play, DO_ACTION_NONE); pauseCtx->state = PAUSE_STATE_CLOSING; WREG(2) = -6240; func_800F64E0(0); - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->mode = 0; pauseCtx->promptChoice = 0; Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -3177,11 +3184,11 @@ void KaleidoScope_Update(PlayState* play) { } break; - case 9: + case PAUSE_MAIN_STATE_9: break; default: - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; break; } break; @@ -3255,7 +3262,7 @@ void KaleidoScope_Update(PlayState* play) { WREG(16) += WREG(25) / WREG(6); WREG(17) += WREG(26) / WREG(6); if (pauseCtx->unk_204 >= -314.0f) { - pauseCtx->state = PAUSE_STATE_6; + pauseCtx->state = PAUSE_STATE_MAIN; pauseCtx->unk_1EC = 0; pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 = 0.0f; pauseCtx->unk_204 = -314.0f; @@ -3281,7 +3288,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->state = PAUSE_STATE_RESUME_GAMEPLAY; pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 = 160.0f; pauseCtx->namedItem = PAUSE_ITEM_NONE; - pauseCtx->unk_1E4 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->unk_204 = -434.0f; } break; From 873c55faad48a67f7544be713cc115e2b858a4e8 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Mon, 25 Sep 2023 01:51:03 +1000 Subject: [PATCH 25/29] Improve Matches: Part 4 (#1545) * more improvements * small cleanup * PR Review --- .../actors/ovl_Arrow_Fire/z_arrow_fire.c | 92 ++--- .../actors/ovl_Arrow_Ice/z_arrow_ice.c | 93 ++--- .../actors/ovl_Arrow_Light/z_arrow_light.c | 93 ++--- .../ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c | 7 +- .../ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c | 7 +- .../actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c | 34 +- .../z_bg_spot00_hanebasi.c | 28 +- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.c | 6 +- .../actors/ovl_Boss_Goma/z_boss_goma.c | 20 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 20 +- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 110 +++--- src/overlays/actors/ovl_Boss_Va/z_boss_va.c | 329 +++++++++--------- 12 files changed, 426 insertions(+), 413 deletions(-) diff --git a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index 7dd457a30..22352d127 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -200,50 +200,54 @@ void ArrowFire_Draw(Actor* thisx, PlayState* play2) { stateFrames = play->state.frames; arrow = (EnArrow*)this->actor.parent; - if (1) {} - if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { - if (1) {} - transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor; - - OPEN_DISPS(play->state.gfxCtx, "../z_arrow_fire.c", 618); - - Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW); - Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY); - Matrix_RotateX(BINANG_TO_RAD(transform->shape.rot.x), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD(transform->shape.rot.z), MTXMODE_APPLY); - Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - - // Draw red effect over the screen when arrow hits - if (this->unk_15C > 0) { - POLY_XLU_DISP = Gfx_SetupDL_57(POLY_XLU_DISP); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s32)(40.0f * this->unk_15C) & 0xFF, 0, 0, - (s32)(150.0f * this->unk_15C) & 0xFF); - gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE); - gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE); - gDPFillRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); - } - - // Draw fire on the arrow - Gfx_SetupDL_25Xlu(play->state.gfxCtx); - gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, this->alpha); - gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128); - Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); - if (this->timer != 0) { - Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); - } else { - Matrix_Translate(0.0f, 1500.0f, 0.0f, MTXMODE_APPLY); - } - Matrix_Scale(this->radius * 0.2f, this->unk_158 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY); - Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arrow_fire.c", 666), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 255 - (stateFrames * 2) % 256, 0, 64, 32, - 1, 255 - stateFrames % 256, 511 - (stateFrames * 10) % 512, 64, 64)); - gSPDisplayList(POLY_XLU_DISP++, sModelDL); - - CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_fire.c", 682); + if ((arrow == NULL) || (arrow->actor.update == NULL)) { + return; } + + if (this->timer >= 255) { + return; + } + + transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor; + + OPEN_DISPS(play->state.gfxCtx, "../z_arrow_fire.c", 618); + + Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW); + Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD(transform->shape.rot.x), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD(transform->shape.rot.z), MTXMODE_APPLY); + Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); + + // Draw red effect over the screen when arrow hits + if (this->unk_15C > 0) { + POLY_XLU_DISP = Gfx_SetupDL_57(POLY_XLU_DISP); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s32)(40.0f * this->unk_15C) & 0xFF, 0, 0, + (s32)(150.0f * this->unk_15C) & 0xFF); + gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE); + gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE); + gDPFillRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); + } + + // Draw fire on the arrow + Gfx_SetupDL_25Xlu(play->state.gfxCtx); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, this->alpha); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128); + Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); + if (this->timer != 0) { + Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); + } else { + Matrix_Translate(0.0f, 1500.0f, 0.0f, MTXMODE_APPLY); + } + Matrix_Scale(this->radius * 0.2f, this->unk_158 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY); + Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arrow_fire.c", 666), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); + gSPDisplayList(POLY_XLU_DISP++, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 255 - (stateFrames * 2) % 256, 0, 64, 32, 1, + 255 - stateFrames % 256, 511 - (stateFrames * 10) % 512, 64, 64)); + gSPDisplayList(POLY_XLU_DISP++, sModelDL); + + CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_fire.c", 682); } diff --git a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c index 42394e71a..9ce232206 100644 --- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c +++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c @@ -199,50 +199,53 @@ void ArrowIce_Draw(Actor* thisx, PlayState* play) { u32 stateFrames = play->state.frames; EnArrow* arrow = (EnArrow*)this->actor.parent; - if (1) {} - - if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { - if (1) {} - transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor; - - OPEN_DISPS(play->state.gfxCtx, "../z_arrow_ice.c", 610); - - Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW); - Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY); - Matrix_RotateX(BINANG_TO_RAD(transform->shape.rot.x), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD(transform->shape.rot.z), MTXMODE_APPLY); - Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - - // Draw blue effect over the screen when arrow hits - if (this->unk_164 > 0) { - POLY_XLU_DISP = Gfx_SetupDL_57(POLY_XLU_DISP); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, (s32)(10.0f * this->unk_164) & 0xFF, - (s32)(50.0f * this->unk_164) & 0xFF, (s32)(150.0f * this->unk_164) & 0xFF); - gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE); - gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE); - gDPFillRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); - } - - // Draw ice on the arrow - Gfx_SetupDL_25Xlu(play->state.gfxCtx); - gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 170, 255, 255, this->alpha); - gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 128); - Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); - if (this->timer != 0) { - Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); - } else { - Matrix_Translate(0.0f, 1500.0f, 0.0f, MTXMODE_APPLY); - } - Matrix_Scale(this->radius * 0.2f, this->unk_160 * 3.0f, this->radius * 0.2f, MTXMODE_APPLY); - Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arrow_ice.c", 660), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 511 - (stateFrames * 5) % 512, 0, 128, 32, - 1, 511 - (stateFrames * 10) % 512, 511 - (stateFrames * 10) % 512, 4, 16)); - gSPDisplayList(POLY_XLU_DISP++, sModelDL); - - CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_ice.c", 676); + if ((arrow == NULL) || (arrow->actor.update == NULL)) { + return; } + + if (this->timer >= 255) { + return; + } + + transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor; + + OPEN_DISPS(play->state.gfxCtx, "../z_arrow_ice.c", 610); + + Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW); + Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD(transform->shape.rot.x), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD(transform->shape.rot.z), MTXMODE_APPLY); + Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); + + // Draw blue effect over the screen when arrow hits + if (this->unk_164 > 0) { + POLY_XLU_DISP = Gfx_SetupDL_57(POLY_XLU_DISP); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, (s32)(10.0f * this->unk_164) & 0xFF, + (s32)(50.0f * this->unk_164) & 0xFF, (s32)(150.0f * this->unk_164) & 0xFF); + gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE); + gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE); + gDPFillRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); + } + + // Draw ice on the arrow + Gfx_SetupDL_25Xlu(play->state.gfxCtx); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 170, 255, 255, this->alpha); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 128); + Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); + if (this->timer != 0) { + Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); + } else { + Matrix_Translate(0.0f, 1500.0f, 0.0f, MTXMODE_APPLY); + } + Matrix_Scale(this->radius * 0.2f, this->unk_160 * 3.0f, this->radius * 0.2f, MTXMODE_APPLY); + Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arrow_ice.c", 660), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); + gSPDisplayList(POLY_XLU_DISP++, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 511 - (stateFrames * 5) % 512, 0, 128, 32, 1, + 511 - (stateFrames * 10) % 512, 511 - (stateFrames * 10) % 512, 4, 16)); + gSPDisplayList(POLY_XLU_DISP++, sModelDL); + + CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_ice.c", 676); } diff --git a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c index 1be30f4fe..b0bd02d3e 100644 --- a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c +++ b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c @@ -197,50 +197,53 @@ void ArrowLight_Draw(Actor* thisx, PlayState* play) { EnArrow* arrow = (EnArrow*)this->actor.parent; Actor* transform; - if (1) {} - - if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { - if (1) {} - transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor; - - OPEN_DISPS(play->state.gfxCtx, "../z_arrow_light.c", 598); - - Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW); - Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY); - Matrix_RotateX(BINANG_TO_RAD(transform->shape.rot.x), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD(transform->shape.rot.z), MTXMODE_APPLY); - Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - - // Draw yellow effect over the screen when arrow hits - if (this->unk_164 > 0) { - POLY_XLU_DISP = Gfx_SetupDL_57(POLY_XLU_DISP); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s32)(30.0f * this->unk_164) & 0xFF, - (s32)(40.0f * this->unk_164) & 0xFF, 0, (s32)(150.0f * this->unk_164) & 0xFF); - gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE); - gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE); - gDPFillRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); - } - - // Draw light on the arrow - Gfx_SetupDL_25Xlu(play->state.gfxCtx); - gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, this->alpha); - gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 128); - Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); - if (this->timer != 0) { - Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); - } else { - Matrix_Translate(0.0f, 1500.0f, 0.0f, MTXMODE_APPLY); - } - Matrix_Scale(this->radius * 0.2f, this->unk_160 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY); - Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arrow_light.c", 648), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 511 - (stateFrames * 5) % 512, 0, 4, 32, 1, - 511 - (stateFrames * 10) % 512, 511 - (stateFrames * 30) % 512, 8, 16)); - gSPDisplayList(POLY_XLU_DISP++, sModelDL); - - CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_light.c", 664); + if ((arrow == NULL) || (arrow->actor.update == NULL)) { + return; } + + if (this->timer >= 255) { + return; + } + + transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor; + + OPEN_DISPS(play->state.gfxCtx, "../z_arrow_light.c", 598); + + Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW); + Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD(transform->shape.rot.x), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD(transform->shape.rot.z), MTXMODE_APPLY); + Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); + + // Draw yellow effect over the screen when arrow hits + if (this->unk_164 > 0) { + POLY_XLU_DISP = Gfx_SetupDL_57(POLY_XLU_DISP); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s32)(30.0f * this->unk_164) & 0xFF, (s32)(40.0f * this->unk_164) & 0xFF, + 0, (s32)(150.0f * this->unk_164) & 0xFF); + gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE); + gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE); + gDPFillRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); + } + + // Draw light on the arrow + Gfx_SetupDL_25Xlu(play->state.gfxCtx); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, this->alpha); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 128); + Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); + if (this->timer != 0) { + Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); + } else { + Matrix_Translate(0.0f, 1500.0f, 0.0f, MTXMODE_APPLY); + } + Matrix_Scale(this->radius * 0.2f, this->unk_160 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY); + Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arrow_light.c", 648), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); + gSPDisplayList(POLY_XLU_DISP++, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 511 - (stateFrames * 5) % 512, 0, 4, 32, 1, + 511 - (stateFrames * 10) % 512, 511 - (stateFrames * 30) % 512, 8, 16)); + gSPDisplayList(POLY_XLU_DISP++, sModelDL); + + CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_light.c", 664); } diff --git a/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c b/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c index 8fe9a62d8..4f405b689 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c @@ -100,10 +100,11 @@ void BgGndDarkmeiro_Destroy(Actor* thisx, PlayState* play2) { PlayState* play = play2; BgGndDarkmeiro* this = (BgGndDarkmeiro*)thisx; - if ((this->dyna.actor.params & 0xFF) == 1) { - if (1) {} - DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + if ((this->dyna.actor.params & 0xFF) != 1) { + return; } + + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void BgGndDarkmeiro_Noop(BgGndDarkmeiro* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c b/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c index 3c83c2ef2..d8b5a0835 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c @@ -51,10 +51,11 @@ void BgGndFiremeiro_Destroy(Actor* thisx, PlayState* play2) { PlayState* play = play2; BgGndFiremeiro* this = (BgGndFiremeiro*)thisx; - if (this->dyna.actor.params == 0) { - if (1) {} - DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + if (this->dyna.actor.params != 0) { + return; } + + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void BgGndFiremeiro_Sink(BgGndFiremeiro* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c index df60eae99..f8a45cfc3 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c +++ b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c @@ -298,15 +298,16 @@ void BgJyaCobra_UpdateShadowFromSide(BgJyaCobra* this) { z = (88.0f - spBC.z) * 0.64f + 0.5f; for (k = 0; k < 11; k++) { temp_z = z - 5 + k; - if (!(temp_z & ~0x3F)) { - temp_z *= 0x40; - for (l = 0; l < 11; l++) { - temp_x = x - 5 + l; - if (!(temp_x & ~0x3F)) { - shadowTex[temp_z + temp_x] |= D_8089731C[k][l]; - } - if (1) {} + if (temp_z & ~0x3F) { + continue; + } + temp_z *= 0x40; + for (l = 0; l < 11; l++) { + temp_x = x - 5 + l; + if (temp_x & ~0x3F) { + continue; } + shadowTex[temp_z + temp_x] |= D_8089731C[k][l]; } } } @@ -326,14 +327,16 @@ void BgJyaCobra_UpdateShadowFromSide(BgJyaCobra* this) { z = (s32)(((88.0f - spBC.z) * 0.64f) + 0.5f); for (k = 0; k < 3; k++) { temp_z = z - 1 + k; - if (!(temp_z & ~0x3F)) { - temp_z *= 0x40; - for (l = 0; l < 3; l++) { - temp_x = x - 1 + l; - if (!(temp_x & ~0x3F)) { - shadowTex[temp_z + temp_x] |= D_80897398[k][l]; - } + if (temp_z & ~0x3F) { + continue; + } + temp_z *= 0x40; + for (l = 0; l < 3; l++) { + temp_x = x - 1 + l; + if (temp_x & ~0x3F) { + continue; } + shadowTex[temp_z + temp_x] |= D_80897398[k][l]; } } } @@ -348,7 +351,6 @@ void BgJyaCobra_UpdateShadowFromSide(BgJyaCobra* this) { shadowTex[j * 0x40 + 0] = 0; shadowTex[j * 0x40 + 0x3F] = 0; } - if (D_80897398[0][0]) {} } /* diff --git a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c index 7eec7fd17..13b2b4e20 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c +++ b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c @@ -137,23 +137,19 @@ void BgSpot00Hanebasi_Destroy(Actor* thisx, PlayState* play) { void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, PlayState* play) { BgSpot00Hanebasi* child = (BgSpot00Hanebasi*)this->dyna.actor.child; - if (IS_CUTSCENE_LAYER || !CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) || !CHECK_QUEST_ITEM(QUEST_GORON_RUBY) || - !CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) || GET_EVENTCHKINF(EVENTCHKINF_80)) { - if (this->dyna.actor.shape.rot.x != 0) { - if (CutsceneFlags_Get(play, 0) || (!IS_CUTSCENE_LAYER && IS_DAY)) { - this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall; - this->destAngle = 0; - child->destAngle = 0; - return; - } + if (!IS_CUTSCENE_LAYER && CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) && + CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) && !GET_EVENTCHKINF(EVENTCHKINF_80)) { + return; + } - if (this) {} // required to match - } - if ((this->dyna.actor.shape.rot.x == 0) && !IS_CUTSCENE_LAYER && !LINK_IS_ADULT && !IS_DAY) { - this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall; - this->destAngle = -0x4000; - child->destAngle = -0xFE0; - } + if ((this->dyna.actor.shape.rot.x != 0) && (CutsceneFlags_Get(play, 0) || (!IS_CUTSCENE_LAYER && IS_DAY))) { + this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall; + this->destAngle = 0; + child->destAngle = 0; + } else if ((this->dyna.actor.shape.rot.x == 0) && !IS_CUTSCENE_LAYER && !LINK_IS_ADULT && !IS_DAY) { + this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall; + this->destAngle = -0x4000; + child->destAngle = -0xFE0; } } diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 6f7efefd9..d8ab06a05 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -932,7 +932,6 @@ void BossDodongo_Update(Actor* thisx, PlayState* play2) { } else if (this->unk_224 > 1.7f) { phi_s0_3 = 3; sp90 = 1; - if (play) {} magma2DrawMode = 0; } else if (this->unk_224 > 1.4f) { phi_s0_3 = 7; @@ -1025,9 +1024,10 @@ void BossDodongo_Update(Actor* thisx, PlayState* play2) { this->collider.elements[0].dim.scale = (this->actionFunc == BossDodongo_Inhale) ? 0.0f : 1.0f; for (i = 6; i < 19; i++) { - if (i != 12) { - this->collider.elements[i].dim.scale = (this->actionFunc == BossDodongo_Roll) ? 0.0f : 1.0f; + if (i == 12) { + continue; } + this->collider.elements[i].dim.scale = (this->actionFunc == BossDodongo_Roll) ? 0.0f : 1.0f; } if (this->unk_244 != 0) { diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index 106e44a15..1fd4e00a8 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -1914,8 +1914,6 @@ void BossGoma_Update(Actor* thisx, PlayState* play) { this->sfxFaintTimer--; } - if (1) {} - this->eyeState = EYESTATE_IRIS_FOLLOW_BONUS_IFRAMES; this->actionFunc(this, play); this->actor.shape.rot.y = this->actor.world.rot.y; @@ -1937,15 +1935,17 @@ void BossGoma_Update(Actor* thisx, PlayState* play) { BossGoma_UpdateEyeEnvColor(this); BossGoma_UpdateTailLimbsScale(this); - if (!this->disableGameplayLogic) { - BossGoma_UpdateHit(this, play); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + if (this->disableGameplayLogic) { + return; + } - if (this->actionFunc != BossGoma_FloorStunned && this->actionFunc != BossGoma_FloorDamaged && - (this->actionFunc != BossGoma_FloorMain || this->timer == 0)) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); - } + BossGoma_UpdateHit(this, play); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + + if (this->actionFunc != BossGoma_FloorStunned && this->actionFunc != BossGoma_FloorDamaged && + (this->actionFunc != BossGoma_FloorMain || this->timer == 0)) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index d2bfcdf05..7806a63da 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -920,7 +920,6 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_0; Math_ApproachF(&this->baseAlpha, 0.0, 1.0f, 5.0f); for (indS1 = 0; indS1 < 40; indS1++) { - if (sMorphaTent2->tentSpawnPos) {} indT5 = Rand_ZeroFloat(20.9f); indS0 = sTentSpawnIndex[indT5]; spFC.x = 0; @@ -930,16 +929,17 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Matrix_MultVec3f(&spFC, &spF0); spF0.x = player->actor.world.pos.x + spF0.x; spF0.z = player->actor.world.pos.z + spF0.z; - if ((fabsf(spF0.x - sTentSpawnPos[indS0].x) <= 320) && - (fabsf(spF0.z - sTentSpawnPos[indS0].y) <= 320) && - ((sMorphaTent2 == NULL) || (sMorphaTent2->tentSpawnPos != indS0))) { - this->targetPos.x = sTentSpawnPos[indS0].x; - this->targetPos.z = sTentSpawnPos[indS0].y; - this->tentSpawnPos = indS0; - this->timers[0] = (s16)Rand_ZeroFloat(20.0f) + 30; - this->work[MO_TENT_ACTION_STATE] = MO_TENT_DESPAWN; - break; + if (!(fabsf(spF0.x - sTentSpawnPos[indS0].x) <= 320) || + !(fabsf(spF0.z - sTentSpawnPos[indS0].y) <= 320) || + ((sMorphaTent2 != NULL) && (sMorphaTent2->tentSpawnPos == indS0))) { + continue; } + this->targetPos.x = sTentSpawnPos[indS0].x; + this->targetPos.z = sTentSpawnPos[indS0].y; + this->tentSpawnPos = indS0; + this->timers[0] = (s16)Rand_ZeroFloat(20.0f) + 30; + this->work[MO_TENT_ACTION_STATE] = MO_TENT_DESPAWN; + break; } } if ((this == sMorphaTent1) && (sMorphaCore->hitCount >= 3) && (sMorphaTent2 == NULL)) { diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 1d3e2bd39..df398b097 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -2863,9 +2863,6 @@ void BossTw_Update(Actor* thisx, PlayState* play) { this->blastTailPos[this->work[TAIL_IDX]] = this->actor.world.pos; - if (1) {} - if (1) {} - for (i = 0; i < 5; i++) { if (this->timers[i] != 0) { this->timers[i]--; @@ -2890,68 +2887,62 @@ void BossTw_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (this->actionFunc != BossTw_Wait) { - this->collider.dim.radius = 45; + if (this->actionFunc == BossTw_Wait) { + return; + } - if (this->actionFunc == BossTw_Spin) { - this->collider.dim.radius *= 2; + this->collider.dim.radius = 45; + + if (this->actionFunc == BossTw_Spin) { + this->collider.dim.radius *= 2; + } + + this->collider.dim.height = 120; + this->collider.dim.yShift = -30; + + if (this->work[INVINC_TIMER] == 0) { + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; } - this->collider.dim.height = 120; - this->collider.dim.yShift = -30; + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + } - if (this->work[INVINC_TIMER] == 0) { - if (this->collider.base.acFlags & AC_HIT) { - this->collider.base.acFlags &= ~AC_HIT; - } + if (this->actor.params == TW_KOTAKE) { + this->workf[OUTR_CRWN_TX_X2] += 1.0f; + this->workf[OUTR_CRWN_TX_Y2] -= 7.0f; + this->workf[INNR_CRWN_TX_Y1] += 1.0f; + } else { + this->workf[OUTR_CRWN_TX_X2] += 0.0f; + this->workf[INNR_CRWN_TX_X2] += 0.0f; + this->workf[OUTR_CRWN_TX_Y2] += -15.0f; + this->workf[INNR_CRWN_TX_Y2] += -10.0f; + } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); - } + if (((this->work[CS_TIMER_2] % 32) == 0) && (Rand_ZeroOne() < 0.3f)) { + this->work[BLINK_IDX] = 4; + } - if (this->actor.params == TW_KOTAKE) { - this->workf[OUTR_CRWN_TX_X2] += 1.0f; - this->workf[OUTR_CRWN_TX_Y2] -= 7.0f; - this->workf[INNR_CRWN_TX_Y1] += 1.0f; - } else { - this->workf[OUTR_CRWN_TX_X2] += 0.0f; - this->workf[INNR_CRWN_TX_X2] += 0.0f; - this->workf[OUTR_CRWN_TX_Y2] += -15.0f; - this->workf[INNR_CRWN_TX_Y2] += -10.0f; - } + this->eyeTexIdx = D_8094A900[this->work[BLINK_IDX]]; - if (((this->work[CS_TIMER_2] % 32) == 0) && (Rand_ZeroOne() < 0.3f)) { - this->work[BLINK_IDX] = 4; - } + if (this->work[BLINK_IDX] != 0) { + this->work[BLINK_IDX]--; + } - this->eyeTexIdx = D_8094A900[this->work[BLINK_IDX]]; + if ((this->actionFunc == BossTw_MergeCS) || (this->unk_5F8 == 0)) { + return; + } - if (this->work[BLINK_IDX] != 0) { - this->work[BLINK_IDX]--; - } - - if (this->actionFunc != BossTw_MergeCS && this->unk_5F8 != 0) { - Vec3f pos; - Vec3f velocity = { 0.0f, 0.0f, 0.0f }; - Vec3f accel = { 0.0f, 0.0f, 0.0f }; - - if (this->scepterAlpha > 0.0f) { - for (i = 0; i <= 0; i++) { - pos = this->scepterFlamePos[0]; - pos.x += Rand_CenteredFloat(70.0f); - pos.y += Rand_CenteredFloat(70.0f); - pos.z += Rand_CenteredFloat(70.0f); - accel.y = 0.4f; - accel.x = Rand_CenteredFloat(0.5f); - accel.z = Rand_CenteredFloat(0.5f); - BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, - this->actor.params, 37); - } - } + { + Vec3f pos; + Vec3f velocity = { 0.0f, 0.0f, 0.0f }; + Vec3f accel = { 0.0f, 0.0f, 0.0f }; + if (this->scepterAlpha > 0.0f) { for (i = 0; i <= 0; i++) { - pos = this->crownPos; + pos = this->scepterFlamePos[0]; pos.x += Rand_CenteredFloat(70.0f); pos.y += Rand_CenteredFloat(70.0f); pos.z += Rand_CenteredFloat(70.0f); @@ -2962,6 +2953,17 @@ void BossTw_Update(Actor* thisx, PlayState* play) { 37); } } + + for (i = 0; i <= 0; i++) { + pos = this->crownPos; + pos.x += Rand_CenteredFloat(70.0f); + pos.y += Rand_CenteredFloat(70.0f); + pos.z += Rand_CenteredFloat(70.0f); + accel.y = 0.4f; + accel.x = Rand_CenteredFloat(0.5f); + accel.z = Rand_CenteredFloat(0.5f); + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, this->actor.params, 37); + } } } diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 9a7d0c55b..1e32443a6 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -3285,201 +3285,202 @@ void BossVa_UpdateEffects(PlayState* play) { BossVa* refActor; for (i = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) { - if (effect->type != VA_NONE) { - effect->timer--; + if (effect->type == VA_NONE) { + continue; + } - effect->pos.x += effect->velocity.x; - effect->pos.y += effect->velocity.y; - effect->pos.z += effect->velocity.z; + effect->timer--; - effect->velocity.x += effect->accel.x; - effect->velocity.y += effect->accel.y; - effect->velocity.z += effect->accel.z; + effect->pos.x += effect->velocity.x; + effect->pos.y += effect->velocity.y; + effect->pos.z += effect->velocity.z; - if ((effect->type == VA_LARGE_SPARK) || (effect->type == VA_SMALL_SPARK)) { - refActor = effect->parent; + effect->velocity.x += effect->accel.x; + effect->velocity.y += effect->accel.y; + effect->velocity.z += effect->accel.z; - effect->rot.z += (s16)(Rand_ZeroOne() * 0x4E20) + 0x2000; - effect->rot.y += (s16)(Rand_ZeroOne() * 0x2710) + 0x2000; + if ((effect->type == VA_LARGE_SPARK) || (effect->type == VA_SMALL_SPARK)) { + refActor = effect->parent; - if ((effect->mode == SPARK_TETHER) || (effect->mode == SPARK_UNUSED)) { - pitch = effect->rot.x - Math_Vec3f_Pitch(&refActor->actor.world.pos, &GET_BODY(refActor)->unk_1D8); - spAC = Math_SinS(refActor->actor.world.rot.y); - effect->pos.x = refActor->actor.world.pos.x - (effect->offset.x * spAC); - spB0 = Math_CosS(refActor->actor.world.rot.y); - effect->pos.z = refActor->actor.world.pos.z - (effect->offset.x * spB0); - spB0 = Math_CosS(-pitch); - effect->pos.y = (effect->offset.y * spB0) + refActor->actor.world.pos.y; - } else if ((effect->mode == SPARK_BARI) || (effect->mode == SPARK_BODY)) { - effect->pos.x = effect->offset.x + refActor->actor.world.pos.x; - effect->pos.y = effect->offset.y + refActor->actor.world.pos.y; - effect->pos.z = effect->offset.z + refActor->actor.world.pos.z; - } else { - spB6 = Rand_ZeroFloat(PLAYER_BODYPART_MAX - 0.1f); - effect->pos.x = player->bodyPartsPos[spB6].x + Rand_CenteredFloat(10.0f); - effect->pos.y = player->bodyPartsPos[spB6].y + Rand_CenteredFloat(15.0f); - effect->pos.z = player->bodyPartsPos[spB6].z + Rand_CenteredFloat(10.0f); - } + effect->rot.z += (s16)(Rand_ZeroOne() * 0x4E20) + 0x2000; + effect->rot.y += (s16)(Rand_ZeroOne() * 0x2710) + 0x2000; - if (effect->timer < 100) { - effect->primColor[3] -= 50; - if (effect->primColor[3] < 0) { - effect->primColor[3] = 0; - effect->timer = 0; - effect->type = VA_NONE; - } - } + if ((effect->mode == SPARK_TETHER) || (effect->mode == SPARK_UNUSED)) { + pitch = effect->rot.x - Math_Vec3f_Pitch(&refActor->actor.world.pos, &GET_BODY(refActor)->unk_1D8); + spAC = Math_SinS(refActor->actor.world.rot.y); + effect->pos.x = refActor->actor.world.pos.x - (effect->offset.x * spAC); + spB0 = Math_CosS(refActor->actor.world.rot.y); + effect->pos.z = refActor->actor.world.pos.z - (effect->offset.x * spB0); + spB0 = Math_CosS(-pitch); + effect->pos.y = (effect->offset.y * spB0) + refActor->actor.world.pos.y; + } else if ((effect->mode == SPARK_BARI) || (effect->mode == SPARK_BODY)) { + effect->pos.x = effect->offset.x + refActor->actor.world.pos.x; + effect->pos.y = effect->offset.y + refActor->actor.world.pos.y; + effect->pos.z = effect->offset.z + refActor->actor.world.pos.z; + } else { + spB6 = Rand_ZeroFloat(PLAYER_BODYPART_MAX - 0.1f); + effect->pos.x = player->bodyPartsPos[spB6].x + Rand_CenteredFloat(10.0f); + effect->pos.y = player->bodyPartsPos[spB6].y + Rand_CenteredFloat(15.0f); + effect->pos.z = player->bodyPartsPos[spB6].z + Rand_CenteredFloat(10.0f); } - if (effect->type == VA_BLAST_SPARK) { - effect->rot.z += (s16)(Rand_ZeroOne() * 0x4E20) + 0x4000; - if (effect->timer < 100) { - effect->primColor[3] -= 50; - if (effect->primColor[3] < 0) { - effect->primColor[3] = 0; - effect->timer = 0; - effect->type = VA_NONE; - } - } - } - - if (effect->type == VA_SPARK_BALL) { - refActor2 = effect->parent; - - effect->rot.z += (s16)(Rand_ZeroOne() * 0x2710) + 0x24A8; - effect->pos.x = effect->offset.x + refActor2->actor.world.pos.x; - effect->pos.y = - refActor2->actor.world.pos.y + 310.0f + (refActor2->actor.shape.yOffset * refActor2->actor.scale.y); - effect->pos.z = effect->offset.z + refActor2->actor.world.pos.z; - effect->mode = (effect->mode + 1) & 7; - - if (effect->timer < 100) { - effect->primColor[3] -= 50; - if (effect->primColor[3] < 0) { - effect->primColor[3] = 0; - effect->timer = 0; - effect->type = VA_NONE; - } - } - } - - if (effect->type == VA_ZAP_CHARGE) { - effect->mode = (effect->mode + 1) & 7; - effect->primColor[3] -= 20; - if (effect->primColor[3] <= 0) { + if (effect->timer < 100) { + effect->primColor[3] -= 50; + if (effect->primColor[3] < 0) { effect->primColor[3] = 0; effect->timer = 0; effect->type = VA_NONE; } } + } - if (effect->type == VA_BLOOD) { - if (effect->mode < BLOOD_SPOT) { - Vec3f checkPos; - CollisionPoly* groundPoly; - f32 floorY; + if (effect->type == VA_BLAST_SPARK) { + effect->rot.z += (s16)(Rand_ZeroOne() * 0x4E20) + 0x4000; + if (effect->timer < 100) { + effect->primColor[3] -= 50; + if (effect->primColor[3] < 0) { + effect->primColor[3] = 0; + effect->timer = 0; + effect->type = VA_NONE; + } + } + } - checkPos = effect->pos; - checkPos.y -= effect->velocity.y + 4.0f; - floorY = BgCheck_EntityRaycastDown1(&play->colCtx, &groundPoly, &checkPos); - if ((groundPoly != NULL) && (effect->pos.y <= floorY)) { - effect->mode = BLOOD_SPOT; - effect->pos.y = floorY + 1.0f; - if (sCsState <= DEATH_SHELL_BURST) { - effect->timer = 80; - } else { - effect->timer = 60000; - } + if (effect->type == VA_SPARK_BALL) { + refActor2 = effect->parent; - effect->accel = effect->velocity = sZeroVec; - } - if (!effect->timer) { - effect->type = VA_NONE; - } - } else { - if (effect->timer < 20) { - effect->envColor[3] = effect->timer * 5; - effect->primColor[3] = effect->timer * 10; - } else if (effect->timer > 50000) { - effect->timer++; + effect->rot.z += (s16)(Rand_ZeroOne() * 0x2710) + 0x24A8; + effect->pos.x = effect->offset.x + refActor2->actor.world.pos.x; + effect->pos.y = + refActor2->actor.world.pos.y + 310.0f + (refActor2->actor.shape.yOffset * refActor2->actor.scale.y); + effect->pos.z = effect->offset.z + refActor2->actor.world.pos.z; + effect->mode = (effect->mode + 1) & 7; + + if (effect->timer < 100) { + effect->primColor[3] -= 50; + if (effect->primColor[3] < 0) { + effect->primColor[3] = 0; + effect->timer = 0; + effect->type = VA_NONE; + } + } + } + + if (effect->type == VA_ZAP_CHARGE) { + effect->mode = (effect->mode + 1) & 7; + effect->primColor[3] -= 20; + if (effect->primColor[3] <= 0) { + effect->primColor[3] = 0; + effect->timer = 0; + effect->type = VA_NONE; + } + } + + if (effect->type == VA_BLOOD) { + if (effect->mode < BLOOD_SPOT) { + Vec3f checkPos; + CollisionPoly* groundPoly; + f32 floorY; + + checkPos = effect->pos; + checkPos.y -= effect->velocity.y + 4.0f; + floorY = BgCheck_EntityRaycastDown1(&play->colCtx, &groundPoly, &checkPos); + if ((groundPoly != NULL) && (effect->pos.y <= floorY)) { + effect->mode = BLOOD_SPOT; + effect->pos.y = floorY + 1.0f; + if (sCsState <= DEATH_SHELL_BURST) { + effect->timer = 80; + } else { + effect->timer = 60000; } + + effect->accel = effect->velocity = sZeroVec; + } + if (!effect->timer) { + effect->type = VA_NONE; + } + } else { + if (effect->timer < 20) { + effect->envColor[3] = effect->timer * 5; + effect->primColor[3] = effect->timer * 10; + } else if (effect->timer > 50000) { + effect->timer++; + } + } + + if (!effect->timer) { + effect->type = VA_NONE; + } + } + + if (effect->type == VA_GORE) { + if (effect->mode == GORE_PERMANENT) { + Vec3f checkPos; + CollisionPoly* groundPoly; + f32 floorY; + + checkPos = effect->pos; + checkPos.y -= effect->velocity.y + 4.0f; + effect->rot.x += 0x1770; + floorY = BgCheck_EntityRaycastDown1(&play->colCtx, &groundPoly, &checkPos); + if ((groundPoly != NULL) && (effect->pos.y <= floorY)) { + effect->mode = GORE_FLOOR; + effect->timer = 30; + effect->pos.y = floorY + 1.0f; + effect->accel = effect->velocity = sZeroVec; + effect->rot.x = -0x4000; } if (!effect->timer) { effect->type = VA_NONE; } + + } else if (effect->mode == GORE_FADING) { + if (effect->timer == 0) { + effect->type = VA_NONE; + if (1) {} + } + + } else { + Math_SmoothStepToF(&effect->scaleMod, 0.075f, 1.0f, 0.005f, 0.0f); + Math_SmoothStepToF(&effect->vaGorePulseRate, 0.0f, 0.6f, 0.005f, 0.0013f); + if ((play->gameplayFrames % 4) == 0) { + Math_SmoothStepToS(&effect->primColor[0], 95, 1, 1, 0); + } } + effect->vaGorePulse += effect->vaGorePulseRate; + } - if (effect->type == VA_GORE) { - if (effect->mode == GORE_PERMANENT) { - Vec3f checkPos; - CollisionPoly* groundPoly; - f32 floorY; + if (effect->type == VA_TUMOR) { + s16 yaw; - checkPos = effect->pos; - checkPos.y -= effect->velocity.y + 4.0f; - effect->rot.x += 0x1770; - floorY = BgCheck_EntityRaycastDown1(&play->colCtx, &groundPoly, &checkPos); - if ((groundPoly != NULL) && (effect->pos.y <= floorY)) { - effect->mode = GORE_FLOOR; - effect->timer = 30; - effect->pos.y = floorY + 1.0f; - effect->accel = effect->velocity = sZeroVec; - effect->rot.x = -0x4000; - } + refActor = effect->parent; - if (!effect->timer) { - effect->type = VA_NONE; - } + effect->rot.z += 0x157C; + effect->envColor[3] = (s16)(Math_SinS(effect->rot.z) * 50.0f) + 80; + Math_SmoothStepToF(&effect->scale, effect->scaleMod, 1.0f, 0.01f, 0.005f); + effect->pos.x = effect->offset.x + refActor->actor.world.pos.x; + effect->pos.y = effect->offset.y + refActor->actor.world.pos.y; + effect->pos.z = effect->offset.z + refActor->actor.world.pos.z; - } else if (effect->mode == GORE_FADING) { + switch (effect->mode) { + case TUMOR_UNUSED: if (effect->timer == 0) { + yaw = Math_Vec3f_Yaw(&refActor->actor.world.pos, &effect->pos); effect->type = VA_NONE; - if (1) {} + BossVa_BloodSplatter(play, effect, yaw, effect->scale * 4500.0f, 1); + BossVa_Gore(play, effect, yaw, effect->scale * 1.2f); } - - } else { - Math_SmoothStepToF(&effect->scaleMod, 0.075f, 1.0f, 0.005f, 0.0f); - Math_SmoothStepToF(&effect->vaGorePulseRate, 0.0f, 0.6f, 0.005f, 0.0013f); - if ((play->gameplayFrames % 4) == 0) { - Math_SmoothStepToS(&effect->primColor[0], 95, 1, 1, 0); + break; + case TUMOR_BODY: + case TUMOR_ARM: + if (refActor->burst) { + effect->type = VA_NONE; + yaw = Math_Vec3f_Yaw(&refActor->actor.world.pos, &effect->pos); + BossVa_BloodSplatter(play, effect, yaw, effect->scale * 4500.0f, 1); + BossVa_Gore(play, effect, yaw, effect->scale * 1.2f); } - } - effect->vaGorePulse += effect->vaGorePulseRate; - } - - if (effect->type == VA_TUMOR) { - s16 yaw; - - refActor = effect->parent; - - effect->rot.z += 0x157C; - effect->envColor[3] = (s16)(Math_SinS(effect->rot.z) * 50.0f) + 80; - Math_SmoothStepToF(&effect->scale, effect->scaleMod, 1.0f, 0.01f, 0.005f); - effect->pos.x = effect->offset.x + refActor->actor.world.pos.x; - effect->pos.y = effect->offset.y + refActor->actor.world.pos.y; - effect->pos.z = effect->offset.z + refActor->actor.world.pos.z; - - switch (effect->mode) { - case TUMOR_UNUSED: - if (effect->timer == 0) { - yaw = Math_Vec3f_Yaw(&refActor->actor.world.pos, &effect->pos); - effect->type = VA_NONE; - BossVa_BloodSplatter(play, effect, yaw, effect->scale * 4500.0f, 1); - BossVa_Gore(play, effect, yaw, effect->scale * 1.2f); - } - break; - case TUMOR_BODY: - case TUMOR_ARM: - if (refActor->burst) { - effect->type = VA_NONE; - yaw = Math_Vec3f_Yaw(&refActor->actor.world.pos, &effect->pos); - BossVa_BloodSplatter(play, effect, yaw, effect->scale * 4500.0f, 1); - BossVa_Gore(play, effect, yaw, effect->scale * 1.2f); - } - break; - } - if (1) {} + break; } } } From 4d7558df0d8fe489870e8619e0b3672104c04d4f Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Mon, 25 Sep 2023 03:29:15 -0700 Subject: [PATCH 26/29] Speedmeter Small cleanup (#1554) * Small cleanup * x --- include/speedmeter.h | 17 +---------------- src/code/speed_meter.c | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/include/speedmeter.h b/include/speedmeter.h index 02409ba93..ec4c3f799 100644 --- a/include/speedmeter.h +++ b/include/speedmeter.h @@ -8,28 +8,13 @@ struct GameState; typedef struct { /* 0x00 */ char unk_00[0x18]; - /* 0x18 */ s32 unk_18; + /* 0x18 */ s32 x; // Unused /* 0x1C */ s32 y; } SpeedMeter; // size = 0x20 -typedef struct { - /* 0x00 */ s32 maxval; - /* 0x04 */ s32 val; - /* 0x08 */ u16 backColor; - /* 0x0A */ u16 foreColor; - /* 0x0C */ s32 ulx; - /* 0x10 */ s32 lrx; - /* 0x14 */ s32 uly; - /* 0x18 */ s32 lry; -} SpeedMeterAllocEntry; // size = 0x1C - -void SpeedMeter_InitImpl(SpeedMeter* this, u32 arg1, u32 y); void SpeedMeter_Init(SpeedMeter* this); void SpeedMeter_Destroy(SpeedMeter* this); void SpeedMeter_DrawTimeEntries(SpeedMeter* this, struct GraphicsContext* gfxCtx); -void SpeedMeter_InitAllocEntry(SpeedMeterAllocEntry* this, u32 maxval, u32 val, u16 backColor, u16 foreColor, u32 ulx, - u32 lrx, u32 uly, u32 lry); -void SpeedMeter_DrawAllocEntry(SpeedMeterAllocEntry* this, struct GraphicsContext* gfxCtx); void SpeedMeter_DrawAllocEntries(SpeedMeter* meter, struct GraphicsContext* gfxCtx, struct GameState* state); #endif diff --git a/src/code/speed_meter.c b/src/code/speed_meter.c index dc1bc0596..660a2ab64 100644 --- a/src/code/speed_meter.c +++ b/src/code/speed_meter.c @@ -74,15 +74,26 @@ SpeedMeterTimeEntry sSpeedMeterTimeEntryArray[] = { { &gGraphUpdatePeriod, 0, 10, GPACK_RGBA5551(255, 0, 255, 1) }, }; +typedef struct { + /* 0x00 */ s32 maxval; + /* 0x04 */ s32 val; + /* 0x08 */ u16 backColor; + /* 0x0A */ u16 foreColor; + /* 0x0C */ s32 ulx; + /* 0x10 */ s32 lrx; + /* 0x14 */ s32 uly; + /* 0x18 */ s32 lry; +} SpeedMeterAllocEntry; // size = 0x1C + #define gDrawRect(gfx, color, ulx, uly, lrx, lry) \ gDPPipeSync(gfx); \ gDPSetFillColor(gfx, ((color) << 16) | (color)); \ gDPFillRectangle(gfx, (ulx), (uly), (lrx), (lry)); \ gDPPipeSync(gfx) -void SpeedMeter_InitImpl(SpeedMeter* this, u32 arg1, u32 y) { +void SpeedMeter_InitImpl(SpeedMeter* this, u32 x, u32 y) { LogUtils_CheckNullPointer("this", this, "../speed_meter.c", 181); - this->unk_18 = arg1; + this->x = x; this->y = y; } @@ -207,7 +218,7 @@ void SpeedMeter_DrawAllocEntries(SpeedMeter* meter, GraphicsContext* gfxCtx, Gam u32 ulx = 30; u32 lrx = 290; SpeedMeterAllocEntry entry; - u32 pad2; + TwoHeadArena* tha; s32 y; TwoHeadGfxArena* thga; u32 zeldaFreeMax; @@ -237,10 +248,9 @@ void SpeedMeter_DrawAllocEntries(SpeedMeter* meter, GraphicsContext* gfxCtx, Gam y++; } - thga = (TwoHeadGfxArena*)&state->tha; - //! @bug THA_GetRemaining call should be THGA_GetRemaining like the others below, harmless as-is - SpeedMeter_InitAllocEntry(&entry, thga->size, thga->size - THA_GetRemaining(&thga->tha), - GPACK_RGBA5551(0, 0, 255, 1), GPACK_RGBA5551(0, 255, 0, 1), ulx, lrx, y, y); + tha = &state->tha; + SpeedMeter_InitAllocEntry(&entry, tha->size, tha->size - THA_GetRemaining(tha), GPACK_RGBA5551(0, 0, 255, 1), + GPACK_RGBA5551(0, 255, 0, 1), ulx, lrx, y, y); SpeedMeter_DrawAllocEntry(&entry, gfxCtx); y++; From 092f6026384b193df93a9836548bc788dec7c81c Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:40:55 +0100 Subject: [PATCH 27/29] Fix gamestate overlay table size declaration (#1555) --- include/variables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/variables.h b/include/variables.h index b57e8f7d7..12b8e734b 100644 --- a/include/variables.h +++ b/include/variables.h @@ -56,7 +56,7 @@ extern Gfx D_80116280[]; extern ActorOverlay gActorOverlayTable[ACTOR_ID_MAX]; // original name: "actor_dlftbls" 801162A0 extern s32 gMaxActorId; // original name: "MaxProfile" extern s32 gDebugCamEnabled; -extern GameStateOverlay gGameStateOverlayTable[6]; +extern GameStateOverlay gGameStateOverlayTable[GAMESTATE_ID_MAX]; extern u8 gWeatherMode; extern u8 gLightConfigAfterUnderwater; extern u8 gInterruptSongOfStorms; From 2cb4ff4fd3d36157dd03d68321dbeb99ba5c6845 Mon Sep 17 00:00:00 2001 From: fig02 Date: Tue, 26 Sep 2023 12:48:41 -0400 Subject: [PATCH 28/29] Player Docs: csMode -> csAction (#1547) * csmode -> cs action * format --- include/functions.h | 4 +- include/z64.h | 2 +- include/z64camera.h | 2 +- include/z64player.h | 214 +++---- src/code/z_actor.c | 10 +- src/code/z_camera.c | 18 +- src/code/z_onepointdemo.c | 96 +-- src/code/z_onepointdemo_data.inc.c | 126 ++-- src/code/z_parameter.c | 2 +- src/code/z_player_lib.c | 4 +- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.c | 2 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 18 +- .../ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c | 8 +- .../ovl_Bg_Heavy_Block/z_bg_heavy_block.c | 2 +- .../ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c | 4 +- .../ovl_Bg_Ice_Objects/z_bg_ice_objects.c | 6 +- .../ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c | 2 +- .../z_bg_mori_kaitenkabe.c | 4 +- .../actors/ovl_Bg_Po_Event/z_bg_po_event.c | 4 +- .../z_bg_spot00_hanebasi.c | 2 +- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.c | 14 +- src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c | 12 +- src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c | 6 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 32 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 56 +- .../ovl_Boss_Ganondrof/z_boss_ganondrof.c | 4 +- .../actors/ovl_Boss_Goma/z_boss_goma.c | 14 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 20 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 8 +- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 18 +- src/overlays/actors/ovl_Boss_Va/z_boss_va.c | 20 +- src/overlays/actors/ovl_Demo_Im/z_demo_im.c | 2 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 4 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 6 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 10 +- .../ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c | 8 +- src/overlays/actors/ovl_En_Daiku/z_en_daiku.c | 4 +- .../ovl_En_Diving_Game/z_en_diving_game.c | 16 +- .../actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c | 4 +- .../actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c | 6 +- src/overlays/actors/ovl_En_Du/z_en_du.c | 8 +- .../actors/ovl_En_Ex_Item/z_en_ex_item.c | 2 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 4 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 2 +- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 2 +- src/overlays/actors/ovl_En_GeldB/z_en_geldb.c | 2 +- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 4 +- .../actors/ovl_En_Heishi1/z_en_heishi1.c | 4 +- .../actors/ovl_En_Heishi2/z_en_heishi2.c | 14 +- .../actors/ovl_En_Heishi3/z_en_heishi3.c | 4 +- .../actors/ovl_En_Heishi4/z_en_heishi4.c | 4 +- src/overlays/actors/ovl_En_In/z_en_in.c | 4 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 6 +- .../actors/ovl_En_Kakasi3/z_en_kakasi3.c | 10 +- src/overlays/actors/ovl_En_Kz/z_en_kz.c | 4 +- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 6 +- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 4 +- src/overlays/actors/ovl_En_Ta/z_en_ta.c | 8 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 2 +- .../actors/ovl_En_Wallmas/z_en_wallmas.c | 2 +- .../ovl_En_Wonder_Talk2/z_en_wonder_talk2.c | 4 +- src/overlays/actors/ovl_En_Zl1/z_en_zl1.c | 4 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 8 +- src/overlays/actors/ovl_En_fHG/z_en_fhg.c | 8 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 10 +- .../actors/ovl_player_actor/z_player.c | 547 +++++++++--------- 66 files changed, 737 insertions(+), 734 deletions(-) diff --git a/include/functions.h b/include/functions.h index 8ce39ff86..479281d03 100644 --- a/include/functions.h +++ b/include/functions.h @@ -385,8 +385,8 @@ void func_8002DE74(PlayState* play, Player* player); void Actor_MountHorse(PlayState* play, Player* player, Actor* horse); s32 func_8002DEEC(Player* player); void func_8002DF18(PlayState* play, Player* player); -s32 func_8002DF38(PlayState* play, Actor* actor, u8 csMode); -s32 func_8002DF54(PlayState* play, Actor* actor, u8 csMode); +s32 func_8002DF38(PlayState* play, Actor* actor, u8 csAction); +s32 func_8002DF54(PlayState* play, Actor* actor, u8 csAction); void func_8002DF90(DynaPolyActor* dynaActor); void func_8002DFA4(DynaPolyActor* dynaActor, f32 arg1, s16 arg2); s32 Player_IsFacingActor(Actor* actor, s16 maxAngle, PlayState* play); diff --git a/include/z64.h b/include/z64.h index 0e7698115..e962e4f33 100644 --- a/include/z64.h +++ b/include/z64.h @@ -402,7 +402,7 @@ typedef struct PlayState { /* 0x11D44 */ s32 (*isPlayerDroppingFish)(struct PlayState* play); /* 0x11D48 */ s32 (*startPlayerFishing)(struct PlayState* play); /* 0x11D4C */ s32 (*grabPlayer)(struct PlayState* play, Player* player); - /* 0x11D50 */ s32 (*startPlayerCutscene)(struct PlayState* play, Actor* actor, s32 csMode); + /* 0x11D50 */ s32 (*startPlayerCutscene)(struct PlayState* play, Actor* actor, s32 csAction); /* 0x11D54 */ void (*func_11D54)(Player* player, struct PlayState* play); /* 0x11D58 */ s32 (*damagePlayer)(struct PlayState* play, s32 damage); /* 0x11D5C */ void (*talkWithPlayer)(struct PlayState* play, Actor* actor); diff --git a/include/z64camera.h b/include/z64camera.h index 48d4f1cc7..f6c458918 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -1254,7 +1254,7 @@ typedef enum { #define ONEPOINT_CS_INIT_FIELD_NONE 0xFF #define ONEPOINT_CS_INIT_FIELD_ACTORCAT(actorCat) (0x80 | ((actorCat) & 0x0F)) #define ONEPOINT_CS_INIT_FIELD_HUD_VISIBILITY(camHudVisibility) (0xC0 | ((camHudVisibility) & 0x0F)) -#define ONEPOINT_CS_INIT_FIELD_PLAYER_CS(csMode) ((csMode) & 0x7F) +#define ONEPOINT_CS_INIT_FIELD_PLAYER_CS(csAction) ((csAction) & 0x7F) #define ONEPOINT_CS_INIT_FIELD_IS_TYPE_ACTORCAT(field) ((field & 0xF0) == 0x80) #define ONEPOINT_CS_INIT_FIELD_IS_TYPE_HUD_VISIBILITY(field) ((field & 0xF0) == 0xC0) diff --git a/include/z64player.h b/include/z64player.h index 1796b47d8..ae497a395 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -353,111 +353,111 @@ typedef enum { #define PLAYER_LIMB_BUF_COUNT LIMB_BUF_COUNT(PLAYER_LIMB_MAX) typedef enum { - /* 0x00 */ PLAYER_CSMODE_NONE, - /* 0x01 */ PLAYER_CSMODE_1, - /* 0x02 */ PLAYER_CSMODE_2, - /* 0x03 */ PLAYER_CSMODE_3, - /* 0x04 */ PLAYER_CSMODE_4, - /* 0x05 */ PLAYER_CSMODE_5, - /* 0x06 */ PLAYER_CSMODE_6, - /* 0x07 */ PLAYER_CSMODE_7, - /* 0x08 */ PLAYER_CSMODE_8, - /* 0x09 */ PLAYER_CSMODE_9, - /* 0x0A */ PLAYER_CSMODE_10, - /* 0x0B */ PLAYER_CSMODE_11, - /* 0x0C */ PLAYER_CSMODE_12, - /* 0x0D */ PLAYER_CSMODE_13, - /* 0x0E */ PLAYER_CSMODE_14, - /* 0x0F */ PLAYER_CSMODE_15, - /* 0x10 */ PLAYER_CSMODE_16, - /* 0x11 */ PLAYER_CSMODE_17, - /* 0x12 */ PLAYER_CSMODE_18, - /* 0x13 */ PLAYER_CSMODE_19, - /* 0x14 */ PLAYER_CSMODE_20, - /* 0x15 */ PLAYER_CSMODE_21, - /* 0x16 */ PLAYER_CSMODE_22, - /* 0x17 */ PLAYER_CSMODE_23, - /* 0x18 */ PLAYER_CSMODE_24, - /* 0x19 */ PLAYER_CSMODE_25, - /* 0x1A */ PLAYER_CSMODE_26, - /* 0x1B */ PLAYER_CSMODE_27, - /* 0x1C */ PLAYER_CSMODE_28, - /* 0x1D */ PLAYER_CSMODE_29, - /* 0x1E */ PLAYER_CSMODE_30, - /* 0x1F */ PLAYER_CSMODE_31, - /* 0x20 */ PLAYER_CSMODE_32, - /* 0x21 */ PLAYER_CSMODE_33, - /* 0x22 */ PLAYER_CSMODE_34, - /* 0x23 */ PLAYER_CSMODE_35, - /* 0x24 */ PLAYER_CSMODE_36, - /* 0x25 */ PLAYER_CSMODE_37, - /* 0x26 */ PLAYER_CSMODE_38, - /* 0x27 */ PLAYER_CSMODE_39, - /* 0x28 */ PLAYER_CSMODE_40, - /* 0x29 */ PLAYER_CSMODE_41, - /* 0x2A */ PLAYER_CSMODE_42, - /* 0x2B */ PLAYER_CSMODE_43, - /* 0x2C */ PLAYER_CSMODE_44, - /* 0x2D */ PLAYER_CSMODE_45, - /* 0x2E */ PLAYER_CSMODE_46, - /* 0x2F */ PLAYER_CSMODE_47, - /* 0x30 */ PLAYER_CSMODE_48, - /* 0x31 */ PLAYER_CSMODE_49, - /* 0x32 */ PLAYER_CSMODE_50, - /* 0x33 */ PLAYER_CSMODE_51, - /* 0x34 */ PLAYER_CSMODE_52, - /* 0x35 */ PLAYER_CSMODE_53, - /* 0x36 */ PLAYER_CSMODE_54, - /* 0x37 */ PLAYER_CSMODE_55, - /* 0x38 */ PLAYER_CSMODE_56, - /* 0x39 */ PLAYER_CSMODE_57, - /* 0x3A */ PLAYER_CSMODE_58, - /* 0x3B */ PLAYER_CSMODE_59, - /* 0x3C */ PLAYER_CSMODE_60, - /* 0x3D */ PLAYER_CSMODE_61, - /* 0x3E */ PLAYER_CSMODE_62, - /* 0x3F */ PLAYER_CSMODE_63, - /* 0x40 */ PLAYER_CSMODE_64, - /* 0x41 */ PLAYER_CSMODE_65, - /* 0x42 */ PLAYER_CSMODE_66, - /* 0x43 */ PLAYER_CSMODE_67, - /* 0x44 */ PLAYER_CSMODE_68, - /* 0x45 */ PLAYER_CSMODE_69, - /* 0x46 */ PLAYER_CSMODE_70, - /* 0x47 */ PLAYER_CSMODE_71, - /* 0x48 */ PLAYER_CSMODE_72, - /* 0x49 */ PLAYER_CSMODE_73, - /* 0x4A */ PLAYER_CSMODE_74, - /* 0x4B */ PLAYER_CSMODE_75, - /* 0x4C */ PLAYER_CSMODE_76, - /* 0x4D */ PLAYER_CSMODE_77, - /* 0x4E */ PLAYER_CSMODE_78, - /* 0x4F */ PLAYER_CSMODE_79, - /* 0x50 */ PLAYER_CSMODE_80, - /* 0x51 */ PLAYER_CSMODE_81, - /* 0x52 */ PLAYER_CSMODE_82, - /* 0x53 */ PLAYER_CSMODE_83, - /* 0x54 */ PLAYER_CSMODE_84, - /* 0x55 */ PLAYER_CSMODE_85, - /* 0x56 */ PLAYER_CSMODE_86, - /* 0x57 */ PLAYER_CSMODE_87, - /* 0x58 */ PLAYER_CSMODE_88, - /* 0x59 */ PLAYER_CSMODE_89, - /* 0x5A */ PLAYER_CSMODE_90, - /* 0x5B */ PLAYER_CSMODE_91, - /* 0x5C */ PLAYER_CSMODE_92, - /* 0x5D */ PLAYER_CSMODE_93, - /* 0x5E */ PLAYER_CSMODE_94, - /* 0x5F */ PLAYER_CSMODE_95, - /* 0x60 */ PLAYER_CSMODE_96, - /* 0x61 */ PLAYER_CSMODE_97, - /* 0x62 */ PLAYER_CSMODE_98, - /* 0x63 */ PLAYER_CSMODE_99, - /* 0x64 */ PLAYER_CSMODE_100, - /* 0x65 */ PLAYER_CSMODE_101, - /* 0x66 */ PLAYER_CSMODE_102, - /* 0x67 */ PLAYER_CSMODE_MAX -} PlayerCutsceneMode; + /* 0x00 */ PLAYER_CSACTION_NONE, + /* 0x01 */ PLAYER_CSACTION_1, + /* 0x02 */ PLAYER_CSACTION_2, + /* 0x03 */ PLAYER_CSACTION_3, + /* 0x04 */ PLAYER_CSACTION_4, + /* 0x05 */ PLAYER_CSACTION_5, + /* 0x06 */ PLAYER_CSACTION_6, + /* 0x07 */ PLAYER_CSACTION_7, + /* 0x08 */ PLAYER_CSACTION_8, + /* 0x09 */ PLAYER_CSACTION_9, + /* 0x0A */ PLAYER_CSACTION_10, + /* 0x0B */ PLAYER_CSACTION_11, + /* 0x0C */ PLAYER_CSACTION_12, + /* 0x0D */ PLAYER_CSACTION_13, + /* 0x0E */ PLAYER_CSACTION_14, + /* 0x0F */ PLAYER_CSACTION_15, + /* 0x10 */ PLAYER_CSACTION_16, + /* 0x11 */ PLAYER_CSACTION_17, + /* 0x12 */ PLAYER_CSACTION_18, + /* 0x13 */ PLAYER_CSACTION_19, + /* 0x14 */ PLAYER_CSACTION_20, + /* 0x15 */ PLAYER_CSACTION_21, + /* 0x16 */ PLAYER_CSACTION_22, + /* 0x17 */ PLAYER_CSACTION_23, + /* 0x18 */ PLAYER_CSACTION_24, + /* 0x19 */ PLAYER_CSACTION_25, + /* 0x1A */ PLAYER_CSACTION_26, + /* 0x1B */ PLAYER_CSACTION_27, + /* 0x1C */ PLAYER_CSACTION_28, + /* 0x1D */ PLAYER_CSACTION_29, + /* 0x1E */ PLAYER_CSACTION_30, + /* 0x1F */ PLAYER_CSACTION_31, + /* 0x20 */ PLAYER_CSACTION_32, + /* 0x21 */ PLAYER_CSACTION_33, + /* 0x22 */ PLAYER_CSACTION_34, + /* 0x23 */ PLAYER_CSACTION_35, + /* 0x24 */ PLAYER_CSACTION_36, + /* 0x25 */ PLAYER_CSACTION_37, + /* 0x26 */ PLAYER_CSACTION_38, + /* 0x27 */ PLAYER_CSACTION_39, + /* 0x28 */ PLAYER_CSACTION_40, + /* 0x29 */ PLAYER_CSACTION_41, + /* 0x2A */ PLAYER_CSACTION_42, + /* 0x2B */ PLAYER_CSACTION_43, + /* 0x2C */ PLAYER_CSACTION_44, + /* 0x2D */ PLAYER_CSACTION_45, + /* 0x2E */ PLAYER_CSACTION_46, + /* 0x2F */ PLAYER_CSACTION_47, + /* 0x30 */ PLAYER_CSACTION_48, + /* 0x31 */ PLAYER_CSACTION_49, + /* 0x32 */ PLAYER_CSACTION_50, + /* 0x33 */ PLAYER_CSACTION_51, + /* 0x34 */ PLAYER_CSACTION_52, + /* 0x35 */ PLAYER_CSACTION_53, + /* 0x36 */ PLAYER_CSACTION_54, + /* 0x37 */ PLAYER_CSACTION_55, + /* 0x38 */ PLAYER_CSACTION_56, + /* 0x39 */ PLAYER_CSACTION_57, + /* 0x3A */ PLAYER_CSACTION_58, + /* 0x3B */ PLAYER_CSACTION_59, + /* 0x3C */ PLAYER_CSACTION_60, + /* 0x3D */ PLAYER_CSACTION_61, + /* 0x3E */ PLAYER_CSACTION_62, + /* 0x3F */ PLAYER_CSACTION_63, + /* 0x40 */ PLAYER_CSACTION_64, + /* 0x41 */ PLAYER_CSACTION_65, + /* 0x42 */ PLAYER_CSACTION_66, + /* 0x43 */ PLAYER_CSACTION_67, + /* 0x44 */ PLAYER_CSACTION_68, + /* 0x45 */ PLAYER_CSACTION_69, + /* 0x46 */ PLAYER_CSACTION_70, + /* 0x47 */ PLAYER_CSACTION_71, + /* 0x48 */ PLAYER_CSACTION_72, + /* 0x49 */ PLAYER_CSACTION_73, + /* 0x4A */ PLAYER_CSACTION_74, + /* 0x4B */ PLAYER_CSACTION_75, + /* 0x4C */ PLAYER_CSACTION_76, + /* 0x4D */ PLAYER_CSACTION_77, + /* 0x4E */ PLAYER_CSACTION_78, + /* 0x4F */ PLAYER_CSACTION_79, + /* 0x50 */ PLAYER_CSACTION_80, + /* 0x51 */ PLAYER_CSACTION_81, + /* 0x52 */ PLAYER_CSACTION_82, + /* 0x53 */ PLAYER_CSACTION_83, + /* 0x54 */ PLAYER_CSACTION_84, + /* 0x55 */ PLAYER_CSACTION_85, + /* 0x56 */ PLAYER_CSACTION_86, + /* 0x57 */ PLAYER_CSACTION_87, + /* 0x58 */ PLAYER_CSACTION_88, + /* 0x59 */ PLAYER_CSACTION_89, + /* 0x5A */ PLAYER_CSACTION_90, + /* 0x5B */ PLAYER_CSACTION_91, + /* 0x5C */ PLAYER_CSACTION_92, + /* 0x5D */ PLAYER_CSACTION_93, + /* 0x5E */ PLAYER_CSACTION_94, + /* 0x5F */ PLAYER_CSACTION_95, + /* 0x60 */ PLAYER_CSACTION_96, + /* 0x61 */ PLAYER_CSACTION_97, + /* 0x62 */ PLAYER_CSACTION_98, + /* 0x63 */ PLAYER_CSACTION_99, + /* 0x64 */ PLAYER_CSACTION_100, + /* 0x65 */ PLAYER_CSACTION_101, + /* 0x66 */ PLAYER_CSACTION_102, + /* 0x67 */ PLAYER_CSACTION_MAX +} PlayerCsAction; typedef enum { /* 0 */ PLAYER_LEDGE_CLIMB_NONE, @@ -640,8 +640,8 @@ typedef struct Player { /* 0x043C */ s8 mountSide; /* 0x043D */ char unk_43D[0x003]; /* 0x0440 */ Actor* rideActor; - /* 0x0444 */ u8 csMode; - /* 0x0445 */ u8 prevCsMode; + /* 0x0444 */ u8 csAction; + /* 0x0445 */ u8 prevCsAction; /* 0x0446 */ u8 cueId; /* 0x0447 */ u8 unk_447; /* 0x0448 */ Actor* unk_448; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 4ef0bf10f..3edfbaeee 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1050,27 +1050,27 @@ void Actor_MountHorse(PlayState* play, Player* player, Actor* horse) { } s32 func_8002DEEC(Player* player) { - return (player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (player->csMode != PLAYER_CSMODE_NONE); + return (player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (player->csAction != PLAYER_CSACTION_NONE); } void func_8002DF18(PlayState* play, Player* player) { func_8006DC68(play, player); } -s32 func_8002DF38(PlayState* play, Actor* actor, u8 csMode) { +s32 func_8002DF38(PlayState* play, Actor* actor, u8 csAction) { Player* player = GET_PLAYER(play); - player->csMode = csMode; + player->csAction = csAction; player->unk_448 = actor; player->doorBgCamIndex = 0; return true; } -s32 func_8002DF54(PlayState* play, Actor* actor, u8 csMode) { +s32 func_8002DF54(PlayState* play, Actor* actor, u8 csAction) { Player* player = GET_PLAYER(play); - func_8002DF38(play, actor, csMode); + func_8002DF38(play, actor, csAction); player->doorBgCamIndex = 1; return true; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 9858cfdfa..d62b94596 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -5263,10 +5263,10 @@ s32 Camera_Unique9(Camera* camera) { } else if (ONEPOINT_CS_INIT_FIELD_IS_TYPE_HUD_VISIBILITY(rwData->curKeyFrame->initField)) { Camera_UpdateInterface( CAM_INTERFACE_FIELD(CAM_LETTERBOX_IGNORE, rwData->curKeyFrame->initField, 0)); - } else { // initField is of type PlayerCsMode + } else { // initField is a PlayerCsAction if ((camera->player->stateFlags1 & PLAYER_STATE1_27) && (player->currentBoots != PLAYER_BOOTS_IRON)) { - func_8002DF38(camera->play, camera->target, PLAYER_CSMODE_8); + func_8002DF38(camera->play, camera->target, PLAYER_CSACTION_8); osSyncPrintf("camera: demo: player demo set WAIT\n"); } else { osSyncPrintf("camera: demo: player demo set %d\n", rwData->curKeyFrame->initField); @@ -6236,14 +6236,14 @@ s32 Camera_Demo5(Camera* camera) { framesDiff = camera->play->state.frames - sDemo5PrevAction12Frame; if (player->stateFlags1 & PLAYER_STATE1_11) { // holding object over head. - func_8002DF54(camera->play, camera->target, PLAYER_CSMODE_8); + func_8002DF54(camera->play, camera->target, PLAYER_CSACTION_8); } else if (ABS(framesDiff) > 3000) { - func_8002DF54(camera->play, camera->target, PLAYER_CSMODE_12); + func_8002DF54(camera->play, camera->target, PLAYER_CSACTION_12); } else { - func_8002DF54(camera->play, camera->target, PLAYER_CSMODE_69); + func_8002DF54(camera->play, camera->target, PLAYER_CSACTION_69); } } else { - func_8002DF54(camera->play, camera->target, PLAYER_CSMODE_1); + func_8002DF54(camera->play, camera->target, PLAYER_CSACTION_1); } } @@ -6305,7 +6305,7 @@ s32 Camera_Demo6(Camera* camera) { FALLTHROUGH; case 1: if (stateTimers[camera->animState] < rwData->animTimer) { - func_8002DF54(camera->play, &camera->player->actor, PLAYER_CSMODE_8); + func_8002DF54(camera->play, &camera->player->actor, PLAYER_CSACTION_8); Actor_GetWorld(&focusPosRot, camFocus); rwData->atTarget.x = focusPosRot.pos.x; rwData->atTarget.y = focusPosRot.pos.y - 20.0f; @@ -7841,8 +7841,8 @@ void Camera_Finish(Camera* camera) { player->actor.freezeTimer = 0; player->stateFlags1 &= ~PLAYER_STATE1_29; - if (player->csMode != PLAYER_CSMODE_NONE) { - func_8002DF54(camera->play, &player->actor, PLAYER_CSMODE_7); + if (player->csAction != PLAYER_CSACTION_NONE) { + func_8002DF54(camera->play, &player->actor, PLAYER_CSACTION_7); osSyncPrintf("camera: player demo end!!\n"); } diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index 61548559a..fc7f7a5d4 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -278,7 +278,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act case 2290: { Actor* rideActor = player->rideActor; - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); if (rideActor != NULL) { rideActor->freezeTimer = 180; } @@ -290,7 +290,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act } break; case 5120: - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); csInfo->keyFrames = D_80121314; csInfo->keyFrameCount = ARRAY_COUNT(D_80121314); @@ -301,7 +301,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act case 4510: D_8012133C[0].eyeTargetInit = actor->world.pos; D_8012133C[0].eyeTargetInit.y = player->actor.world.pos.y + 40.0f; - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); csInfo->keyFrames = D_8012133C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012133C); @@ -320,7 +320,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0); Play_ChangeCameraSetting(play, subCamId, CAM_SET_FREE2); Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); subCam->roll = 0; subCam->fov = 50.0f; if (subCam->childCamId != CAM_ID_MAIN) { @@ -335,7 +335,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act if (Rand_ZeroOne() < 0.0f) { D_801213B4[3].eyeTargetInit.x = -D_801213B4[3].eyeTargetInit.x; } - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); csInfo->keyFrames = D_801213B4; csInfo->keyFrameCount = ARRAY_COUNT(D_801213B4); @@ -382,11 +382,11 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 6; subCam->fov = 75.0f; - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); break; case 3040: - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); D_8012151C[0].timerInit = timer - 1; csInfo->keyFrames = D_8012151C; @@ -411,7 +411,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrameCount = ARRAY_COUNT(D_8012156C); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); break; case 3010: @@ -443,7 +443,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act break; case 3090: - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); csInfo->keyFrames = D_80121814; csInfo->keyFrameCount = ARRAY_COUNT(D_80121814); @@ -460,7 +460,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 70.0f; - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); break; case 3380: @@ -468,7 +468,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_801218B4; csInfo->keyFrameCount = ARRAY_COUNT(D_801218B4); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_1); @@ -481,13 +481,13 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80121904; csInfo->keyFrameCount = ARRAY_COUNT(D_80121904); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; case 3050: Play_ChangeCameraSetting(play, subCamId, CAM_SET_CS_3); - func_8002DF54(play, &player->actor, PLAYER_CSMODE_5); + func_8002DF54(play, &player->actor, PLAYER_CSACTION_5); OnePointCutscene_SetCsCamPoints(subCam, D_80120304 | 0x2000, D_80120300, D_8012013C, D_8012021C); Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); OnePointCutscene_Vec3sToVec3f(&mainCam->at, &D_8012013C[D_801202FC - 2].pos); @@ -517,7 +517,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act subCam->stateFlags |= CAM_STATE_1; csInfo->keyFrameCount = ARRAY_COUNT(D_80121954[0]); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; @@ -525,7 +525,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80121A44; csInfo->keyFrameCount = ARRAY_COUNT(D_80121A44); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); subCam->stateFlags |= CAM_STATE_1; break; @@ -552,7 +552,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0x50; subCam->fov = 55.0f; - func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF38(play, &player->actor, PLAYER_CSACTION_8); break; case 3170: @@ -569,7 +569,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_CopyCamera(play, CAM_ID_MAIN, subCamId); subCam->roll = -1; subCam->fov = 55.0f; - func_8002DF38(play, actor, PLAYER_CSMODE_1); + func_8002DF38(play, actor, PLAYER_CSACTION_1); break; case 3160: @@ -583,7 +583,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 55.0f; - func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF38(play, &player->actor, PLAYER_CSACTION_8); break; case 3180: @@ -598,13 +598,13 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 60.0f; - func_8002DF38(play, actor, PLAYER_CSMODE_1); + func_8002DF38(play, actor, PLAYER_CSACTION_1); break; case 3190: Play_ChangeCameraSetting(play, subCamId, CAM_SET_FOREST_DEFEAT_POE); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_8002DF38(play, actor, PLAYER_CSMODE_12); + func_8002DF38(play, actor, PLAYER_CSACTION_12); break; case 3230: @@ -618,7 +618,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0x1E; subCam->fov = 75.0f; - func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF38(play, &player->actor, PLAYER_CSACTION_8); Actor_GetWorldPosShapeRot(&spA0, actor); Actor_GetFocus(&sp8C, &player->actor); spC0.x = sp8C.pos.x; @@ -648,7 +648,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 45.0f; - func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF38(play, &player->actor, PLAYER_CSACTION_8); break; case 3220: @@ -665,7 +665,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act subCam->roll = 0; subCam->fov = 75.0f; player->actor.shape.rot.y = player->actor.world.rot.y = player->yaw = spD0.yaw + 0x7FFF; - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); break; case 3240: @@ -674,13 +674,13 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80121D3C; csInfo->keyFrameCount = ARRAY_COUNT(D_80121D3C); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; case 6001: Play_ChangeCameraSetting(play, subCamId, CAM_SET_CS_3); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Actor_GetWorld(&spA0, actor); if (spA0.pos.z > -750.0f) { OnePointCutscene_SetCsCamPoints(subCam, D_801208E8, D_801208E4, D_801206A0, D_80120820); @@ -696,7 +696,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act case 3400: Play_ChangeCameraSetting(play, subCamId, CAM_SET_CS_3); - func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF38(play, &player->actor, PLAYER_CSACTION_8); OnePointCutscene_SetCsCamPoints(subCam, D_8012069C | 0x2000, D_80120698, D_801204D4, D_801205B4); OnePointCutscene_Vec3sToVec3f(&mainCam->eye, &D_801205B4[D_80120694 - 2].pos); OnePointCutscene_Vec3sToVec3f(&mainCam->at, &D_801204D4[D_80120694 - 2].pos); @@ -713,13 +713,13 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80121DB4; csInfo->keyFrameCount = ARRAY_COUNT(D_80121DB4); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; case 3310: Play_ChangeCameraSetting(play, subCamId, CAM_SET_FIRE_STAIRCASE); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Play_CopyCamera(play, subCamId, CAM_ID_MAIN); i = Quake_Request(subCam, QUAKE_TYPE_1); @@ -754,7 +754,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80121FBC; csInfo->keyFrameCount = ARRAY_COUNT(D_80121FBC); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_3); @@ -767,7 +767,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_8012205C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012205C); - func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF38(play, &player->actor, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; @@ -783,7 +783,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act D_801220D4[1].eyeTargetInit.y = 80.0f; D_801220D4[1].eyeTargetInit.x = -D_801220D4[1].eyeTargetInit.x; } - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); csInfo->keyFrames = D_801220D4; csInfo->keyFrameCount = ARRAY_COUNT(D_801220D4); @@ -795,7 +795,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_8012219C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012219C); - func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF38(play, &player->actor, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; @@ -803,7 +803,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_801222B4; csInfo->keyFrameCount = ARRAY_COUNT(D_801222B4); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_1); @@ -816,7 +816,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_8012237C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012237C); - func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF38(play, &player->actor, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_1); @@ -829,7 +829,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_801223CC; csInfo->keyFrameCount = ARRAY_COUNT(D_801223CC); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); player->stateFlags1 |= PLAYER_STATE1_29; player->actor.freezeTimer = 90; @@ -844,7 +844,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_801224BC; csInfo->keyFrameCount = ARRAY_COUNT(D_801224BC); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_1); @@ -859,19 +859,19 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act player->actor.shape.rot.y = player->actor.world.rot.y = player->yaw = 0x3FFC; Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); break; case 4110: csInfo->keyFrames = D_8012269C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012269C); - func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF38(play, &player->actor, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; case 4120: - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); D_80122714[1].timerInit = 80; csInfo->keyFrames = D_80122714; csInfo->keyFrameCount = ARRAY_COUNT(D_80122714); @@ -891,7 +891,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_801228A4; csInfo->keyFrameCount = ARRAY_COUNT(D_801228A4); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; @@ -900,7 +900,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_8012296C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012296C); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; @@ -909,7 +909,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80122A0C; csInfo->keyFrameCount = ARRAY_COUNT(D_80122A0C); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; @@ -918,7 +918,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80122A5C; csInfo->keyFrameCount = ARRAY_COUNT(D_80122A5C); - func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF38(play, &player->actor, PLAYER_CSACTION_8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; @@ -927,7 +927,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80122B9C; csInfo->keyFrameCount = ARRAY_COUNT(D_80122B9C); - func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF38(play, &player->actor, PLAYER_CSACTION_8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; @@ -951,7 +951,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrameCount = ARRAY_COUNT(D_80122C3C); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); - func_8002DF38(play, &player->actor, PLAYER_CSMODE_1); + func_8002DF38(play, &player->actor, PLAYER_CSACTION_1); i = Quake_Request(subCam, QUAKE_TYPE_3); Quake_SetSpeed(i, 12000); @@ -963,12 +963,12 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80122C8C; csInfo->keyFrameCount = ARRAY_COUNT(D_80122C8C); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; case 3260: - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); D_80122CB4[1].timerInit = timer - 5; csInfo->keyFrames = D_80122CB4; @@ -978,7 +978,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act break; case 3261: - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); D_80122D04[1].timerInit = timer - 10; csInfo->keyFrames = D_80122D04; diff --git a/src/code/z_onepointdemo_data.inc.c b/src/code/z_onepointdemo_data.inc.c index f88e9e39b..be16be1ce 100644 --- a/src/code/z_onepointdemo_data.inc.c +++ b/src/code/z_onepointdemo_data.inc.c @@ -121,7 +121,7 @@ static s16 D_801208E8 = 8; static OnePointCsFull D_801208EC[3] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_8), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), 0x0101, 1, 0, @@ -182,7 +182,7 @@ static OnePointCsFull D_80120964[2] = { static OnePointCsFull D_801209B4[4] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_8), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), 0x0101, 1, 0, @@ -193,7 +193,7 @@ static OnePointCsFull D_801209B4[4] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x0100, 29, 0, @@ -287,7 +287,7 @@ static OnePointCsFull D_80120ACC[5] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x0442, 10, 0, @@ -323,7 +323,7 @@ static OnePointCsFull D_80120ACC[5] = { static OnePointCsFull D_80120B94[11] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x2142, 1, 0, @@ -447,7 +447,7 @@ static OnePointCsFull D_80120B94[11] = { static OnePointCsFull D_80120D4C[7] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x2142, 1, 0, @@ -527,7 +527,7 @@ static OnePointCsFull D_80120D4C[7] = { static OnePointCsFull D_80120E64[8] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x2142, 20, 0, @@ -618,7 +618,7 @@ static OnePointCsFull D_80120E64[8] = { static OnePointCsFull D_80120FA4[6] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x2143, 30, 0, @@ -687,7 +687,7 @@ static OnePointCsFull D_80120FA4[6] = { static OnePointCsFull D_80121094[3] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_8), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), 0x2101, 20, 0, @@ -698,7 +698,7 @@ static OnePointCsFull D_80121094[3] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x2101, 50, 0, @@ -723,7 +723,7 @@ static OnePointCsFull D_80121094[3] = { static OnePointCsFull D_8012110C[3] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_5), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), 0x2142, 1, 0, @@ -759,7 +759,7 @@ static OnePointCsFull D_8012110C[3] = { static OnePointCsFull D_80121184[2] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x0101, 40, 0, @@ -784,7 +784,7 @@ static OnePointCsFull D_80121184[2] = { static OnePointCsFull D_801211D4[2] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_8), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), 0x0101, 50, 0, @@ -809,7 +809,7 @@ static OnePointCsFull D_801211D4[2] = { static OnePointCsFull D_80121224[6] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x4141, 2, 0, @@ -831,7 +831,7 @@ static OnePointCsFull D_80121224[6] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_52), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_52), 0x4104, 80, 0, @@ -842,7 +842,7 @@ static OnePointCsFull D_80121224[6] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x0000, 20, 0, @@ -878,7 +878,7 @@ static OnePointCsFull D_80121224[6] = { static OnePointCsFull D_80121314[1] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_8), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), 0x4141, 1000, 0, @@ -892,7 +892,7 @@ static OnePointCsFull D_80121314[1] = { static OnePointCsFull D_8012133C[3] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x0141, 40, 0, @@ -928,7 +928,7 @@ static OnePointCsFull D_8012133C[3] = { static OnePointCsFull D_801213B4[5] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_8), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), 0xC2C2, 40, 0, @@ -939,7 +939,7 @@ static OnePointCsFull D_801213B4[5] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0xC2C2, 120, 0, @@ -950,7 +950,7 @@ static OnePointCsFull D_801213B4[5] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_83), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_83), 0xC2C2, 30, 0, @@ -961,7 +961,7 @@ static OnePointCsFull D_801213B4[5] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_69), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_69), 0x4222, 30, 0, @@ -986,7 +986,7 @@ static OnePointCsFull D_801213B4[5] = { static OnePointCsFull D_8012147C[4] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x0101, 40, 0, @@ -997,7 +997,7 @@ static OnePointCsFull D_8012147C[4] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x0142, 1, 0, @@ -1008,7 +1008,7 @@ static OnePointCsFull D_8012147C[4] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_8), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), 0x0142, 89, -4, @@ -1033,7 +1033,7 @@ static OnePointCsFull D_8012147C[4] = { static OnePointCsFull D_8012151C[2] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x0101, 29, 0, @@ -1058,7 +1058,7 @@ static OnePointCsFull D_8012151C[2] = { static OnePointCsFull D_8012156C[2] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_77), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_77), 0x4242, 1, 0, @@ -1097,7 +1097,7 @@ static OnePointCsFull D_801215BC[1] = { static OnePointCsFull D_801215E4[10] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_8), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), 0x4141, 20, 0, @@ -1108,7 +1108,7 @@ static OnePointCsFull D_801215E4[10] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x0101, 1, 4, @@ -1141,7 +1141,7 @@ static OnePointCsFull D_801215E4[10] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_9), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_9), 0x0101, 40, -5, @@ -1152,7 +1152,7 @@ static OnePointCsFull D_801215E4[10] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x0101, 1, 0, @@ -1210,7 +1210,7 @@ static OnePointCsFull D_801215E4[10] = { static OnePointCsFull D_80121774[4] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_8), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), 0x0101, 1, -2, @@ -1221,7 +1221,7 @@ static OnePointCsFull D_80121774[4] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x0142, 39, 2, @@ -1232,7 +1232,7 @@ static OnePointCsFull D_80121774[4] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_5), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), 0x0121, 20, 0, @@ -1257,7 +1257,7 @@ static OnePointCsFull D_80121774[4] = { static OnePointCsFull D_80121814[4] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_76), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_76), 0x0101, 5, 0, @@ -1429,7 +1429,7 @@ static OnePointCsFull D_80121954[3][2] = { static OnePointCsFull D_80121A44[12] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_5), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), 0x2121, 10, 0, @@ -1440,7 +1440,7 @@ static OnePointCsFull D_80121A44[12] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x4242, 30, 0, @@ -1462,7 +1462,7 @@ static OnePointCsFull D_80121A44[12] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_5), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), 0x2222, 40, 5, @@ -1473,7 +1473,7 @@ static OnePointCsFull D_80121A44[12] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x4242, 40, 5, @@ -1517,7 +1517,7 @@ static OnePointCsFull D_80121A44[12] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x2242, 40, 0, @@ -1528,7 +1528,7 @@ static OnePointCsFull D_80121A44[12] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x22C2, 140, 0, @@ -1564,7 +1564,7 @@ static OnePointCsFull D_80121A44[12] = { static OnePointCsFull D_80121C24[7] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_5), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), 0x0101, 1, 0, @@ -1586,7 +1586,7 @@ static OnePointCsFull D_80121C24[7] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_8), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), 0x0101, 40, 4, @@ -1724,7 +1724,7 @@ static OnePointCsFull D_80121DB4[9] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_57), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_57), 0x2121, 1, 8, @@ -1746,7 +1746,7 @@ static OnePointCsFull D_80121DB4[9] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_9, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_56), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_56), 0x2121, 149, -20, @@ -1782,7 +1782,7 @@ static OnePointCsFull D_80121DB4[9] = { static OnePointCsFull D_80121F1C[4] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_8), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), 0x0101, 10, 0, @@ -1804,7 +1804,7 @@ static OnePointCsFull D_80121F1C[4] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_2), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_2), 0x2121, 23, 0, @@ -1898,7 +1898,7 @@ static OnePointCsFull D_8012205C[3] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x21A1, 10, 0, @@ -1912,7 +1912,7 @@ static OnePointCsFull D_8012205C[3] = { static OnePointCsFull D_801220D4[5] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x0101, 5, 0, @@ -2282,7 +2282,7 @@ static OnePointCsFull D_801224BC[7] = { static OnePointCsFull D_801225D4[5] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_8), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), 0x0101, 1, 0, @@ -2293,7 +2293,7 @@ static OnePointCsFull D_801225D4[5] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_59), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_59), 0x0101, 60, 4, @@ -2315,7 +2315,7 @@ static OnePointCsFull D_801225D4[5] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_8), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), 0x2323, 2, 0, @@ -2492,7 +2492,7 @@ static OnePointCsFull D_801227B4[6] = { static OnePointCsFull D_801228A4[5] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x0101, 20, 5, @@ -2514,7 +2514,7 @@ static OnePointCsFull D_801228A4[5] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_8), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), 0x0101, 90, 2, @@ -2972,7 +2972,7 @@ static OnePointCsFull D_80122E44[2][7] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x4343, 160, 10, @@ -3051,7 +3051,7 @@ static OnePointCsFull D_80122E44[2][7] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x4343, 160, -10, @@ -3254,7 +3254,7 @@ static OnePointCsFull D_80123254[2] = { static OnePointCsFull D_801232A4[1] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_69), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_69), 0x0101, 9999, 0, @@ -3384,7 +3384,7 @@ static OnePointCsFull D_80123394[5] = { static OnePointCsFull D_8012345C[4] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x4242, 40, 0, @@ -3395,7 +3395,7 @@ static OnePointCsFull D_8012345C[4] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_77), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_77), 0x4242, 40, 0, @@ -3406,7 +3406,7 @@ static OnePointCsFull D_8012345C[4] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x2121, 10, 0, @@ -3431,7 +3431,7 @@ static OnePointCsFull D_8012345C[4] = { static OnePointCsFull D_801234FC[5] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_5), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), 0x0441, 10, 0, @@ -3453,7 +3453,7 @@ static OnePointCsFull D_801234FC[5] = { }, { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x0000, 1, 0, @@ -3489,7 +3489,7 @@ static OnePointCsFull D_801234FC[5] = { static OnePointCsFull D_801235C4[5] = { { ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSMODE_1), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), 0x4141, 1, 0, diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 86687ca92..42644bbda 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -3816,7 +3816,7 @@ void Interface_Draw(PlayState* play) { gSaveContext.subTimerState = SUBTIMER_STATE_RESPAWN; gSaveContext.save.cutsceneIndex = 0; Message_StartTextbox(play, 0x71B0, NULL); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); } else { sSubTimerStateTimer = 40; gSaveContext.subTimerState = SUBTIMER_STATE_STOP; diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 57fdfd532..a14934d2c 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -488,7 +488,7 @@ void Player_SetBootData(PlayState* play, Player* this) { } s32 Player_InBlockingCsMode(PlayState* play, Player* this) { - return (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->csMode != PLAYER_CSMODE_NONE) || + return (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->csAction != PLAYER_CSACTION_NONE) || (play->transitionTrigger == TRANS_TRIGGER_START) || (this->stateFlags1 & PLAYER_STATE1_0) || (this->stateFlags3 & PLAYER_STATE3_7) || ((gSaveContext.magicState != MAGIC_STATE_IDLE) && (Player_ActionToMagicSpell(this, this->itemAction) >= 0)); @@ -578,7 +578,7 @@ void func_8008EC70(Player* this) { } void Player_SetEquipmentData(PlayState* play, Player* this) { - if (this->csMode != PLAYER_CSMODE_86) { + if (this->csAction != PLAYER_CSACTION_86) { this->currentShield = SHIELD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD)); this->currentTunic = TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC)); this->currentBoots = BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS)); diff --git a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c index 45ab8be19..bbc736e66 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c @@ -254,7 +254,7 @@ void BgBreakwall_Wait(BgBreakwall* this, PlayState* play) { gSaveContext.cutsceneTrigger = 1; Audio_PlaySfxGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_8002DF54(play, NULL, PLAYER_CSMODE_49); + func_8002DF54(play, NULL, PLAYER_CSACTION_49); } if (this->dyna.actor.params < 0) { diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index 4104790c8..3b669514a 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -191,7 +191,7 @@ void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, PlayState* play) { return; } } - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); this->actionFunc = BgDyYoseizo_ChooseType; } } @@ -199,7 +199,7 @@ void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, PlayState* play) { void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) { s32 givingReward; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); // "Mode" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ もうど ☆☆☆☆☆ %d\n" VT_RST, play->msgCtx.ocarinaMode); givingReward = false; @@ -315,12 +315,12 @@ void BgDyYoseizo_SetupSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) { } Actor_PlaySfx(&this->actor, NA_SE_VO_FR_LAUGH_0); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); this->actionFunc = BgDyYoseizo_SpinGrow_NoReward; } void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); Math_ApproachF(&this->actor.world.pos.y, this->grownHeight, this->heightFraction, 100.0f); Math_ApproachF(&this->scale, 0.035f, this->scaleFraction, 0.005f); Math_ApproachF(&this->heightFraction, 0.8f, 0.1f, 0.02f); @@ -346,7 +346,7 @@ void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) { void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); if ((this->frameCount * 1273.0f) <= this->bobTimer) { this->bobTimer = 0.0f; @@ -360,7 +360,7 @@ void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) { } void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { this->frameCount = Animation_GetLastFrame(&gGreatFairySittingAnim); @@ -380,7 +380,7 @@ void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { } void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); this->bobTimer = this->skelAnime.curFrame * 1273.0f; if ((this->frameCount * 1273.0f) <= this->bobTimer) { @@ -548,7 +548,7 @@ void BgDyYoseizo_Vanish(BgDyYoseizo* this, PlayState* play) { Actor* findOcarinaSpot; if (this->vanishTimer == 0) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); play->envCtx.lightSettingOverride = 0; findOcarinaSpot = play->actorCtx.actorLists[ACTORCAT_PROP].head; @@ -570,7 +570,7 @@ void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { if ((play->csCtx.actorCues[0] != NULL) && (play->csCtx.actorCues[0]->id == 2)) { this->actor.draw = BgDyYoseizo_Draw; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); this->finishedSpinGrow = false; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { diff --git a/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c b/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c index e9e5dd715..101216e21 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c @@ -239,7 +239,7 @@ void BgGndIceblock_Idle(BgGndIceblock* this, PlayState* play) { if (this->dyna.unk_150 > 0.0f) { BgGndIceblock_SetNextPosition(this); if (Actor_WorldDistXZToPoint(&this->dyna.actor, &this->targetPos) > 1.0f) { - func_8002DF54(play, &this->dyna.actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->dyna.actor, PLAYER_CSACTION_8); this->actionFunc = BgGndIceblock_Slide; } } @@ -280,7 +280,7 @@ void BgGndIceblock_Fall(BgGndIceblock* this, PlayState* play) { thisx->world.pos.y = thisx->home.pos.y - 100.0f; thisx->world.pos.z = thisx->home.pos.z; if (Player_InCsMode(play)) { - func_8002DF54(play, thisx, PLAYER_CSMODE_7); + func_8002DF54(play, thisx, PLAYER_CSACTION_7); } this->actionFunc = BgGndIceblock_Reset; } @@ -293,7 +293,7 @@ void BgGndIceblock_Hole(BgGndIceblock* this, PlayState* play) { if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y - 100.0f, thisx->velocity.y)) { thisx->velocity.y = 0.0f; if (Player_InCsMode(play)) { - func_8002DF54(play, thisx, PLAYER_CSMODE_7); + func_8002DF54(play, thisx, PLAYER_CSACTION_7); } this->actionFunc = BgGndIceblock_Idle; } @@ -317,7 +317,7 @@ void BgGndIceblock_Slide(BgGndIceblock* this, PlayState* play) { switch (BgGndIceblock_NextAction(this)) { case GNDICE_IDLE: this->actionFunc = BgGndIceblock_Idle; - func_8002DF54(play, thisx, PLAYER_CSMODE_7); + func_8002DF54(play, thisx, PLAYER_CSACTION_7); break; case GNDICE_FALL: this->actionFunc = BgGndIceblock_Fall; diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index 100f84233..ca244bdff 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -367,7 +367,7 @@ void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, PlayState* play) { this->timer++; - func_8002DF54(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &player->actor, PLAYER_CSACTION_8); // if parent is NULL, link threw it if (Actor_HasNoParent(&this->dyna.actor, play)) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c index b1367ae25..f02871bc7 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c @@ -138,7 +138,7 @@ void BgHidanDalm_Wait(BgHidanDalm* this, PlayState* play) { this->dyna.actor.world.pos.x += 32.5f * Math_SinS(this->dyna.actor.world.rot.y); this->dyna.actor.world.pos.z += 32.5f * Math_CosS(this->dyna.actor.world.rot.y); - func_8002DF54(play, &this->dyna.actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->dyna.actor, PLAYER_CSACTION_8); this->dyna.actor.flags |= ACTOR_FLAG_4; this->actionFunc = BgHidanDalm_Shrink; this->dyna.actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; @@ -159,7 +159,7 @@ void BgHidanDalm_Shrink(BgHidanDalm* this, PlayState* play) { Vec3f pos; if (Math_StepToF(&this->dyna.actor.scale.x, 0.0f, 0.004f)) { - func_8002DF54(play, &this->dyna.actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->dyna.actor, PLAYER_CSACTION_7); Actor_Kill(&this->dyna.actor); } diff --git a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c index ab05a463f..c6ff42fdf 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c +++ b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c @@ -125,7 +125,7 @@ void BgIceObjects_CheckPits(BgIceObjects* this, PlayState* play) { thisx->world.pos.y = thisx->home.pos.y - 60.0f; thisx->world.pos.z = thisx->home.pos.z; if (thisx->params != 0) { - func_8002DF54(play, thisx, PLAYER_CSMODE_7); + func_8002DF54(play, thisx, PLAYER_CSACTION_7); } this->actionFunc = BgIceObjects_Reset; } @@ -142,7 +142,7 @@ void BgIceObjects_Idle(BgIceObjects* this, PlayState* play) { BgIceObjects_SetNextTarget(this, play); if (Actor_WorldDistXZToPoint(thisx, &this->targetPos) > 1.0f) { thisx->flags |= ACTOR_FLAG_4; - func_8002DF54(play, thisx, PLAYER_CSMODE_8); + func_8002DF54(play, thisx, PLAYER_CSACTION_8); thisx->params = 1; this->actionFunc = BgIceObjects_Slide; } @@ -172,7 +172,7 @@ void BgIceObjects_Slide(BgIceObjects* this, PlayState* play) { thisx->flags &= ~ACTOR_FLAG_4; } thisx->params = 0; - func_8002DF54(play, thisx, PLAYER_CSMODE_7); + func_8002DF54(play, thisx, PLAYER_CSACTION_7); Actor_PlaySfx(thisx, NA_SE_EV_BLOCK_BOUND); if ((fabsf(thisx->world.pos.x + 1387.0f) < 1.0f) && (fabsf(thisx->world.pos.z + 260.0f) < 1.0f)) { this->actionFunc = BgIceObjects_Stuck; diff --git a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c index 5e27a7fc0..df798ea9e 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c +++ b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c @@ -164,7 +164,7 @@ void BgMoriBigst_Fall(BgMoriBigst* this, PlayState* play) { BgMoriBigst_SetupLanding(this, play); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_STONE_BOUND); OnePointCutscene_Init(play, 1020, 8, &this->dyna.actor, CAM_ID_MAIN); - func_8002DF38(play, NULL, PLAYER_CSMODE_60); + func_8002DF38(play, NULL, PLAYER_CSACTION_60); } } diff --git a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c index c3c4c391c..efade085a 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c +++ b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c @@ -95,7 +95,7 @@ void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, PlayState* play) { this->timer++; if ((this->timer > 28) && !Player_InCsMode(play)) { BgMoriKaitenkabe_SetupRotate(this); - func_8002DF54(play, &this->dyna.actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->dyna.actor, PLAYER_CSACTION_8); Math_Vec3f_Copy(&this->lockedPlayerPos, &player->actor.world.pos); push.x = Math_SinS(this->dyna.unk_158); push.y = 0.0f; @@ -129,7 +129,7 @@ void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play) { Math_StepToF(&this->rotSpeed, 0.6f, 0.02f); if (Math_StepToF(&this->rotYdeg, this->rotDirection * 45.0f, this->rotSpeed)) { BgMoriKaitenkabe_SetupWait(this); - func_8002DF54(play, thisx, PLAYER_CSMODE_7); + func_8002DF54(play, thisx, PLAYER_CSACTION_7); if (this->rotDirection > 0.0f) { thisx->home.rot.y += 0x2000; } else { diff --git a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index af1e47252..d73e74c9f 100644 --- a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -320,7 +320,7 @@ void BgPoEvent_BlockFall(BgPoEvent* this, PlayState* play) { if (firstFall == 0) { firstFall = 1; } else { - func_8002DF54(play, &GET_PLAYER(play)->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &GET_PLAYER(play)->actor, PLAYER_CSACTION_7); } } this->direction = 0; @@ -356,7 +356,7 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, PlayState* play) { if (sPuzzleState == 0x10) { sPuzzleState = 0x40; Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_RISING); - func_8002DF54(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &player->actor, PLAYER_CSACTION_8); } } else if (this->dyna.unk_150 != 0.0f) { if (this->direction == 0) { diff --git a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c index 13b2b4e20..a9268e1dc 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c +++ b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c @@ -214,7 +214,7 @@ void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) { SET_EVENTCHKINF(EVENTCHKINF_80); Flags_SetEventChkInf(EVENTCHKINF_82); this->actionFunc = BgSpot00Hanebasi_DoNothing; - func_8002DF54(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &player->actor, PLAYER_CSACTION_8); play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; gSaveContext.nextCutsceneIndex = 0xFFF1; play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index d8ab06a05..6ad24aa7d 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -269,7 +269,7 @@ void BossDodongo_IntroCutscene(BossDodongo* this, PlayState* play) { break; case 1: Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); Play_ClearAllSubCameras(play); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); @@ -297,11 +297,11 @@ void BossDodongo_IntroCutscene(BossDodongo* this, PlayState* play) { } if (this->unk_198 == 110) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_9); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_9); } if (this->unk_198 == 5) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_12); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_12); } if (this->unk_198 < 6) { @@ -416,7 +416,7 @@ void BossDodongo_IntroCutscene(BossDodongo* this, PlayState* play) { Play_ReturnToMainCam(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); BossDodongo_SetupWalk(this); this->unk_1DA = 50; this->unk_1BC = 0; @@ -948,7 +948,7 @@ void BossDodongo_Update(Actor* thisx, PlayState* play2) { magmaScale = ((s16)(Rand_ZeroOne() * 50)) - 50; } - if (player2->csMode >= PLAYER_CSMODE_10) { + if (player2->csAction >= PLAYER_CSACTION_10) { phi_s0_3 = -1; } @@ -1302,7 +1302,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, PlayState* play) { case 0: this->csState = 5; Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_UNK3); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); @@ -1612,7 +1612,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, PlayState* play) { this->csState = 100; Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, -890.0f, -1523.76f, -3304.0f, 0, 0, 0, WARP_DUNGEON_CHILD); this->skelAnime.playSpeed = 0.0f; diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index bb739b45b..bbc6c678d 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -312,7 +312,7 @@ void BossFd_Fly(BossFd* this, PlayState* play) { this->introState = BFD_CS_START; Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); @@ -389,7 +389,7 @@ void BossFd_Fly(BossFd* this, PlayState* play) { Math_ApproachF(&this->subCamShake, 2.0f, 1.0f, 0.8 * 0.01f); } if (this->timers[0] == 40) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_19); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_19); } if (this->timers[0] == 0) { this->introState = BFD_CS_LOOK_GROUND; @@ -418,7 +418,7 @@ void BossFd_Fly(BossFd* this, PlayState* play) { this->timers[0] = 170; this->subCamVelFactor = 0.0f; this->subCamAccel = 0.0f; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_20); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_20); } break; case BFD_CS_COLLAPSE: @@ -468,7 +468,7 @@ void BossFd_Fly(BossFd* this, PlayState* play) { if (this->timers[3] == 190) { this->subCamAtMaxVelFrac.x = this->subCamAtMaxVelFrac.y = this->subCamAtMaxVelFrac.z = 0.05f; this->platformSignal = VBSIMA_KILL; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); } if (this->actor.world.pos.y > 120.0f) { this->subCamAtNext = this->actor.world.pos; @@ -538,7 +538,7 @@ void BossFd_Fly(BossFd* this, PlayState* play) { // BFD_CS_NONE / BOSSFD_FLY_MAIN / SUB_CAM_ID_DONE this->introState = this->introFlyState = this->subCamId = 0; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); this->actionFunc = BossFd_Wait; this->handoffSignal = FD2_SIGNAL_GROUND; SET_EVENTCHKINF(EVENTCHKINF_73); @@ -847,7 +847,7 @@ void BossFd_Fly(BossFd* this, PlayState* play) { Audio_PlaySfxGeneral(NA_SE_EN_VALVAISA_LAND2, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_5); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_5); for (i1 = 0; i1 < 15; i1++) { Vec3f sp144 = { 0.0f, 0.0f, 0.0f }; Vec3f sp138 = { 0.0f, 0.0f, 0.0f }; diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index 727d00ef1..6839fb7a2 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -653,7 +653,7 @@ void BossFd2_Death(BossFd2* this, PlayState* play) { case DEATH_START: this->deathState = DEATH_RETREAT; Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); @@ -747,7 +747,7 @@ void BossFd2_Death(BossFd2* this, PlayState* play) { this->work[FD2_ACTION_STATE]++; this->subCamVelFactor = 0.0f; this->subCamAccel = 0.02f; - func_8002DF54(play, &bossFd->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &bossFd->actor, PLAYER_CSACTION_1); } } if ((bossFd->work[BFD_ACTION_STATE] == BOSSFD_BONES_FALL) && (bossFd->timers[0] == 5)) { @@ -781,7 +781,7 @@ void BossFd2_Death(BossFd2* this, PlayState* play) { Play_ReturnToMainCam(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, 100.0f, 0.0f, 0, 0, 0, WARP_DUNGEON_ADULT); Flags_SetClear(play, play->roomCtx.curRoom.num); diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index b9d7cb617..1254786bd 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -558,7 +558,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { this->actor.shape.rot.y = 0; Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); this->csCamIndex = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->csCamIndex, CAM_STAT_ACTIVE); @@ -600,7 +600,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { BossGanon_SetIntroCsCamera(this, 1); if (this->csTimer == 10) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_5); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_5); } if (this->csTimer == 13) { @@ -633,7 +633,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { break; } - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); this->csState = 4; BossGanon_SetIntroCsCamera(this, 2); this->csTimer = 0; @@ -665,7 +665,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { } if (this->csTimer == 10) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_75); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_75); } if (this->csTimer == 70) { @@ -731,7 +731,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { this->csState = 9; this->csTimer = 0; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); sZelda->unk_3C8 = 0; this->triforceType = GDF_TRIFORCE_ZELDA; this->fwork[GDF_TRIFORCE_SCALE] = 10.0f; @@ -785,7 +785,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { player->actor.world.pos.z = 20.0f; if (this->csTimer == 20) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_23); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_23); Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS); } @@ -1005,7 +1005,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { } if (this->csTimer == 30) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_74); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_74); } if (this->csTimer <= 50) { @@ -1128,7 +1128,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { Play_ReturnToMainCam(play, this->csCamIndex, 0); this->csState = this->csCamIndex = 0; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); BossGanon_SetupWait(this, play); } @@ -1234,7 +1234,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { switch (this->csState) { case 0: Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); this->csCamIndex = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->csCamIndex, CAM_STAT_ACTIVE); @@ -1469,7 +1469,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_GANON_BODY_SPARK - SFX_FLAG); if (this->csTimer == 2) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_57); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_57); } if (this->csTimer > 50) { @@ -1505,7 +1505,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { case 100: Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); this->csCamIndex = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->csCamIndex, CAM_STAT_ACTIVE); @@ -1594,11 +1594,11 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { this->csCamAt.z = -135.0f; if (this->csTimer == 5) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_76); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_76); } if (this->csTimer == 70) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_77); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_77); } if (this->csTimer == 90) { @@ -1683,7 +1683,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { if (this->csTimer == 20) { sZelda->unk_3C8 = 5; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_57); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_57); } if (this->csTimer == 40) { @@ -1750,7 +1750,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { this->csState = 107; this->csTimer = 0; Message_StartTextbox(play, 0x70D2, NULL); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_57); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_57); } break; @@ -1792,7 +1792,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { this->csState = 109; this->csCamIndex = 0; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); Flags_SetSwitch(play, 0x37); } break; diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 4189fffdb..23a08ace9 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -196,7 +196,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON_ANIME3); if (Object_IsLoaded(&play->objectCtx, objectSlot)) { Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); @@ -267,11 +267,11 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { } if (this->unk_398 == 40) { sZelda->unk_3C8 = 1; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_78); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_78); } if (this->unk_398 == 85) { sZelda->unk_3C8 = 2; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_79); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_79); } this->subCamEye.x = 930.0f; this->subCamEye.y = 1129.0f; @@ -300,14 +300,14 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { } if (this->unk_398 == 20) { sZelda->unk_3C8 = 3; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_80); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_80); } if (this->unk_398 == 55) { this->unk_39C = 4; this->unk_398 = 0; this->unk_410.x = 0.0f; sZelda->unk_3C8 = 4; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_80); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_80); } break; case 4: @@ -324,7 +324,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { Play_ReturnToMainCam(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); this->unk_39C = 5; this->unk_398 = 0; } @@ -371,7 +371,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { } if (this->unk_398 == 30) { sZelda->unk_3C8 = 5; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_81); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_81); } if (this->unk_398 == 50) { this->unk_398 = 0; @@ -402,7 +402,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { Sfx_PlaySfxCentered(NA_SE_EV_STONE_BOUND); } if (this->unk_398 == 30) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_82); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_82); } if (this->unk_398 == 50) { this->unk_398 = 0; @@ -469,7 +469,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { this->subCamAt.y = player->actor.world.pos.y; this->subCamAt.z = player->actor.world.pos.z - 200.0f; if (this->unk_398 == 20) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_30); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_30); } if (this->unk_398 == 60) { this->subCamEye.x = (this->actor.world.pos.x + 200.0f) - 154.0f; @@ -558,7 +558,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { SkelAnime_Free(&this->skelAnime, play); SkelAnime_InitFlex(play, &this->skelAnime, &gGanonSkel, NULL, NULL, NULL, 0); BossGanon2_SetObjectSegment(this, play, OBJECT_GANON_ANIME3, false); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_84); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_84); this->unk_314 = 3; } // fake, tricks the compiler into using stack the way we need it to @@ -614,7 +614,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { this->actor.world.pos.x += 250; this->actor.world.pos.y = 1886.0f; this->unk_394 = 0.0f; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_83); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_83); this->unk_30C = 5.0f; this->unk_228 = 1.0f; } @@ -699,7 +699,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { if (this->unk_398 == 215) { this->unk_39C = 23; this->unk_224 = 0.0f; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_85); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_85); } break; case 23: @@ -719,7 +719,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { this->subCamAt.z = player->actor.world.pos.z; if (this->unk_398 == 228) { Sfx_PlaySfxCentered(NA_SE_IT_SHIELD_REFLECT_SW); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_86); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_86); Rumble_Override(0.0f, 255, 10, 50); } if (this->unk_398 >= 229) { @@ -756,7 +756,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { Sfx_PlaySfxCentered(NA_SE_IT_SWORD_SWING); } if (this->unk_398 == 25) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_87); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_87); this->unk_39C = 25; this->unk_398 = 0; } @@ -804,7 +804,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { case 27: this->subCamUp.z = 0.0f; if (this->unk_398 == 4) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_88); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_88); } this->subCamEye.x = player->actor.world.pos.x - 20.0f; this->subCamEye.y = player->actor.world.pos.y + 50.0f; @@ -877,7 +877,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { Play_ReturnToMainCam(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); this->unk_39C = 0; this->unk_337 = 1; func_808FFDB0(this, play); @@ -1299,7 +1299,7 @@ void func_80900890(BossGanon2* this, PlayState* play) { this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); this->unk_39C = 1; this->subCamEye = mainCam1->eye; this->subCamAt = mainCam1->at; @@ -1348,7 +1348,7 @@ void func_80900890(BossGanon2* this, PlayState* play) { Play_ReturnToMainCam(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); this->unk_39C = 3; } break; @@ -1359,7 +1359,7 @@ void func_80900890(BossGanon2* this, PlayState* play) { Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->unk_39C = 11; this->unk_334 = 1; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_96); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_96); this->unk_398 = 0; FALLTHROUGH; case 11: @@ -1381,7 +1381,7 @@ void func_80900890(BossGanon2* this, PlayState* play) { Play_ReturnToMainCam(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); } break; } @@ -1485,7 +1485,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) { this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); this->unk_39C = 1; this->unk_398 = 0; sZelda->unk_3C8 = 9; @@ -1522,7 +1522,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) { this->skelAnime.playSpeed = 3.0f; } if (this->unk_398 == 120) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_99); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_99); } this->actor.world.rot.y = 0x4000; this->actor.world.pos.x = this->actor.world.pos.z = 0.0f; @@ -1590,7 +1590,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) { this->unk_39C = 5; this->unk_398 = 40; this->skelAnime.playSpeed = 1.0f; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_100); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_100); } break; case 5: @@ -1604,10 +1604,10 @@ void func_8090120C(BossGanon2* this, PlayState* play) { Math_ApproachZeroF(&this->unk_38C, 1.0f, 8.0f); } if (this->unk_398 == 70) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_101); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_101); } if (this->unk_398 == 150) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_102); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_102); } this->unk_30C = 10.0f; player->actor.world.pos.x = 250.0f; @@ -1626,7 +1626,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) { Play_ReturnToMainCam(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); this->unk_39C = 6; } break; @@ -1645,7 +1645,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) { this->unk_398 = 0; Animation_MorphToPlayOnce(&this->skelAnime, &gGanonFinalBlowAnim, 0.0f); this->unk_194 = Animation_GetLastFrame(&gGanonFinalBlowAnim); - play->startPlayerCutscene(play, &this->actor, PLAYER_CSMODE_97); + play->startPlayerCutscene(play, &this->actor, PLAYER_CSACTION_97); } else { break; } @@ -1712,7 +1712,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) { if (this->unk_398 == 55) { Animation_MorphToPlayOnce(&this->skelAnime, &gGanonDeadStartAnim, 0.0f); this->unk_194 = Animation_GetLastFrame(&gGanonDeadStartAnim); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_98); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_98); this->unk_39C = 8; this->unk_398 = 1000; } diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index 9e2cb7d8c..054a90c2f 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -956,7 +956,7 @@ void BossGanondrof_Death(BossGanondrof* this, PlayState* play) { switch (this->deathState) { case DEATH_START: Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); osSyncPrintf("7\n"); @@ -1118,7 +1118,7 @@ void BossGanondrof_Death(BossGanondrof* this, PlayState* play) { Play_ReturnToMainCam(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, GND_BOSSROOM_CENTER_X, GND_BOSSROOM_CENTER_Y, GND_BOSSROOM_CENTER_Z + 200.0f, 0, 0, 0, 0); this->actor.child = &horse->actor; diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index 1fd4e00a8..760a43701 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -629,7 +629,7 @@ void BossGoma_SetupEncounterState4(BossGoma* this, PlayState* play) { this->actionState = 4; this->actor.flags |= ACTOR_FLAG_0; Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_UNK3); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); @@ -686,7 +686,7 @@ void BossGoma_Encounter(BossGoma* this, PlayState* play) { Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_SHUTTER, 164.72f, -480.0f, 397.68002f, 0, -0x705C, 0, DOORSHUTTER_PARAMS(SHUTTER_GOHMA_BLOCK, 0)); } else { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); this->actionState = 1; } } @@ -757,7 +757,7 @@ void BossGoma_Encounter(BossGoma* this, PlayState* play) { } if (this->frameCount == 190) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_2); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_2); } if (this->frameCount >= 228) { @@ -768,7 +768,7 @@ void BossGoma_Encounter(BossGoma* this, PlayState* play) { Play_ReturnToMainCam(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); this->actionState = 3; } break; @@ -964,7 +964,7 @@ void BossGoma_Encounter(BossGoma* this, PlayState* play) { this->disableGameplayLogic = false; this->patienceTimer = 200; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); } break; } @@ -1053,7 +1053,7 @@ void BossGoma_Defeated(BossGoma* this, PlayState* play) { case 0: this->actionState = 1; Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_UNK3); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); @@ -1181,7 +1181,7 @@ void BossGoma_Defeated(BossGoma* this, PlayState* play) { Play_ReturnToMainCam(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 7806a63da..0262a6ad5 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -835,7 +835,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { if (&this->actor == player->actor.parent) { player->actionVar2 = 0x65; player->actor.parent = NULL; - player->csMode = PLAYER_CSMODE_NONE; + player->csAction = PLAYER_CSACTION_NONE; if (this->timers[0] == 0) { func_8002F6D4(play, &this->actor, 20.0f, this->actor.shape.rot.y + 0x8000, 10.0f, 0); } @@ -865,7 +865,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { if (&this->actor == player->actor.parent) { player->actionVar2 = 0x65; player->actor.parent = NULL; - player->csMode = PLAYER_CSMODE_NONE; + player->csAction = PLAYER_CSACTION_NONE; } Math_ApproachF(&this->tentRippleSize, 0.15f, 0.5f, 0.01); if (this->meltIndex < 41) { @@ -1225,7 +1225,7 @@ void BossMo_IntroCs(BossMo* this, PlayState* play) { (fabsf(player->actor.world.pos.x - -180.0f) < 40.0f))) { // checks if Link is on one of the four platforms Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); @@ -1333,11 +1333,11 @@ void BossMo_IntroCs(BossMo* this, PlayState* play) { Math_ApproachF(&this->actor.speed, sp80, 1.0f, sp78); Math_ApproachF(&this->subCamYawRate, sp7C, 1.0f, 128.0f); if (this->work[MO_TENT_MOVE_TIMER] == 525) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_2); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_2); } if (this->work[MO_TENT_MOVE_TIMER] > 540) { this->csState = MO_INTRO_REVEAL; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); sMorphaTent1->drawActor = true; player->actor.world.pos.x = 180.0f; player->actor.world.pos.z = -210.0f; @@ -1446,7 +1446,7 @@ void BossMo_IntroCs(BossMo* this, PlayState* play) { // MO_BATTLE / SUB_CAM_ID_DONE this->csState = this->subCamId = 0; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); } break; } @@ -1511,7 +1511,7 @@ void BossMo_DeathCs(BossMo* this, PlayState* play) { switch (this->csState) { case MO_DEATH_START: Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); @@ -1681,7 +1681,7 @@ void BossMo_DeathCs(BossMo* this, PlayState* play) { Play_ReturnToMainCam(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); sMorphaTent1->actor.world.pos.y = -1000.0f; } } else { @@ -1786,7 +1786,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) { if (player->actor.parent != NULL) { player->actionVar2 = 0x65; player->actor.parent = NULL; - player->csMode = PLAYER_CSMODE_NONE; + player->csAction = PLAYER_CSACTION_NONE; } } else { this->actor.colChkInfo.health = 1; @@ -1805,7 +1805,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) { if (player->actor.parent == &sMorphaTent1->actor) { player->actionVar2 = 0x65; player->actor.parent = NULL; - player->csMode = PLAYER_CSMODE_NONE; + player->csAction = PLAYER_CSACTION_NONE; } } this->work[MO_TENT_ACTION_STATE] = MO_CORE_STUNNED; diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index e26d4b410..53012fe9e 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -371,7 +371,7 @@ void BossSst_HeadSetupIntro(BossSst* this, PlayState* play) { player->stateFlags1 |= PLAYER_STATE1_5; Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); sSubCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); @@ -404,7 +404,7 @@ void BossSst_HeadIntro(BossSst* this, PlayState* play) { sHands[LEFT]->actor.flags |= ACTOR_FLAG_0; player->stateFlags1 &= ~PLAYER_STATE1_5; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); sSubCamAt.y += 30.0f; sSubCamAt.z += 300.0f; Play_SetCameraAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); @@ -1024,7 +1024,7 @@ void BossSst_HeadSetupDeath(BossSst* this, PlayState* play) { Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); Play_CopyCamera(play, sSubCamId, CAM_ID_MAIN); - func_8002DF54(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &player->actor, PLAYER_CSACTION_8); Cutscene_StartManual(play, &play->csCtx); Math_Vec3f_Copy(&sSubCamEye, &GET_ACTIVE_CAM(play)->eye); this->actionFunc = BossSst_HeadDeath; @@ -1187,7 +1187,7 @@ void BossSst_HeadFinish(BossSst* this, PlayState* play) { Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); Play_ClearCamera(play, sSubCamId); - func_8002DF54(play, &GET_PLAYER(play)->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &GET_PLAYER(play)->actor, PLAYER_CSACTION_7); Cutscene_StopManual(play, &play->csCtx); Actor_Kill(&this->actor); Actor_Kill(&sHands[LEFT]->actor); diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index df398b097..bec9deb5e 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -1499,7 +1499,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, PlayState* play) { case 0: this->csState2 = 1; Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_57); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_57); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); @@ -1639,7 +1639,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gTwinrovaIntroAnim, 0.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&gTwinrovaIntroAnim); this->timers[0] = 50; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_2); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_2); Actor_PlaySfx(&this->actor, NA_SE_EN_TWINROBA_TRANSFORM); SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS); } @@ -1682,7 +1682,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, PlayState* play) { } if (this->timers[3] == 19) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_5); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_5); } if (this->timers[3] == 16) { @@ -1715,7 +1715,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, PlayState* play) { this->subCamId = SUB_CAM_ID_DONE; this->csState2 = this->subCamId; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); this->work[TW_PLLR_IDX] = 0; this->targetPos = sTwinrovaPillarPos[0]; BossTw_TwinrovaSetupFly(this, play); @@ -1795,7 +1795,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, PlayState* play) { player->actor.world.pos.x = player->actor.world.pos.z = .0f; this->csState2 = 1; Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_57); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_57); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); @@ -2278,7 +2278,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, PlayState* play) { this->subCamId = SUB_CAM_ID_DONE; this->csState2 = this->subCamId; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); BossTw_SetupWait(this, play); } break; @@ -2682,7 +2682,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, PlayState* play) { case 0: this->csState2 = 1; Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); @@ -2721,7 +2721,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, PlayState* play) { sKoumePtr->actor.world.pos.z = sKotakePtr->actor.world.pos.z; sKoumePtr->work[YAW_TGT] = sKotakePtr->work[YAW_TGT] = sKoumePtr->actor.shape.rot.x = sKotakePtr->actor.shape.rot.x = sKoumePtr->actor.shape.rot.y = sKotakePtr->actor.shape.rot.y = 0; - func_8002DF54(play, &sKoumePtr->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &sKoumePtr->actor, PLAYER_CSACTION_1); sKoumePtr->actor.flags |= ACTOR_FLAG_0; } break; @@ -2810,7 +2810,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, PlayState* play) { this->csState2 = 4; this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS_CLEAR); Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 600.0f, 230.0f, 0.0f, 0, 0, 0, WARP_DUNGEON_ADULT); diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 1e32443a6..65a892b1a 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -640,7 +640,7 @@ void BossVa_Init(Actor* thisx, PlayState* play2) { if (GET_EVENTCHKINF(EVENTCHKINF_76)) { sCsState = INTRO_CALL_BARI; sDoorState = 100; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); play->envCtx.screenFillColor[0] = 0xDC; play->envCtx.screenFillColor[1] = 0xDC; play->envCtx.screenFillColor[2] = 0xBE; @@ -781,7 +781,7 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) { play->envCtx.screenFillColor[1] = 0xDC; play->envCtx.screenFillColor[2] = 0xBE; play->envCtx.screenFillColor[3] = 0xD2; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); player->actor.world.rot.y = player->actor.shape.rot.y = 0x7FFF; sCsState++; break; @@ -809,7 +809,7 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) { case INTRO_CLOSE_DOOR: this->timer--; if (this->timer == 0) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_2); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_2); sCsState++; this->timer = 30; } @@ -824,7 +824,7 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) { } break; case INTRO_CRACKLE: - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); sCsState++; break; case INTRO_SPAWN_BARI: @@ -955,7 +955,7 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) { sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac; if (this->timer >= 45000) { play->envCtx.lightSettingOverride = 1; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); } else if (this->timer >= 35000) { SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS); } @@ -1012,7 +1012,7 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) { sSubCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); sCsState++; SET_EVENTCHKINF(EVENTCHKINF_76); player->actor.shape.rot.y = player->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; @@ -1530,7 +1530,7 @@ void BossVa_BodyDeath(BossVa* this, PlayState* play) { switch (sCsState) { case DEATH_START: - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); Cutscene_StartManual(play, &play->csCtx); sSubCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); @@ -1592,7 +1592,7 @@ void BossVa_BodyDeath(BossVa* this, PlayState* play) { EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_BALINADE_DEAD, 1, 1, 0x28); this->onCeiling = 2; // Not used by body BossVa_SetDeathEnv(play); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); } break; case DEATH_CORE_BURST: @@ -1633,7 +1633,7 @@ void BossVa_BodyDeath(BossVa* this, PlayState* play) { mainCam->at = sSubCamAt; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); sCsState++; Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, this->actor.world.pos.x, this->actor.world.pos.y, @@ -2417,7 +2417,7 @@ void BossVa_BariIntro(BossVa* this, PlayState* play) { switch (sCsState) { case INTRO_LOOK_BARI: if (this->actor.params == BOSSVA_BARI_UPPER_1) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); if (Math_SmoothStepToF(&this->actor.world.pos.y, 60.0f, 0.3f, 1.0f, 0.15f) == 0.0f) { this->timer--; if (this->timer == 0) { diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index ced65628f..cd1a897fb 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -869,7 +869,7 @@ void func_80986B2C(PlayState* play) { play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; - func_8002DF54(play, &player->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &player->actor, PLAYER_CSACTION_8); } } diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 8cbe2cd2e..1a412a642 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -819,7 +819,7 @@ void DoorShutter_SetupClosed(DoorShutter* this, PlayState* play) { if (DoorShutter_SetupDoor(this, play) && !(player->stateFlags1 & PLAYER_STATE1_11)) { // The door is barred behind the player DoorShutter_SetupAction(this, DoorShutter_WaitPlayerSurprised); - func_8002DF54(play, NULL, PLAYER_CSMODE_2); + func_8002DF54(play, NULL, PLAYER_CSACTION_2); } } @@ -859,7 +859,7 @@ void DoorShutter_JabuDoorClose(DoorShutter* this, PlayState* play) { void DoorShutter_WaitPlayerSurprised(DoorShutter* this, PlayState* play) { if (this->actionTimer++ > 30) { - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); DoorShutter_SetupDoor(this, play); } } diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index 927521804..e936df2fa 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -466,7 +466,7 @@ void DoorWarp1_ChildWarpIdle(DoorWarp1* this, PlayState* play) { Audio_PlaySfxGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); OnePointCutscene_Init(play, 0x25E7, 999, &this->actor, CAM_ID_MAIN); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_10); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_10); player->unk_450.x = this->actor.world.pos.x; player->unk_450.z = this->actor.world.pos.z; @@ -542,7 +542,7 @@ void DoorWarp1_RutoWarpIdle(DoorWarp1* this, PlayState* play) { if (this->rutoWarpState != WARP_BLUE_RUTO_STATE_INITIAL && DoorWarp1_PlayerInRange(this, play)) { this->rutoWarpState = WARP_BLUE_RUTO_STATE_ENTERED; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_10); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_10); this->unk_1B2 = 1; DoorWarp1_SetupAction(this, func_80999EE0); } @@ -650,7 +650,7 @@ void DoorWarp1_AdultWarpIdle(DoorWarp1* this, PlayState* play) { player = GET_PLAYER(play); OnePointCutscene_Init(play, 0x25E8, 999, &this->actor, CAM_ID_MAIN); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_10); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_10); player->unk_450.x = this->actor.world.pos.x; player->unk_450.z = this->actor.world.pos.z; this->unk_1B2 = 20; diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 8fe6dfbb4..d808adbbb 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -261,7 +261,7 @@ void EnBomBowMan_RunGame(EnBomBowlMan* this, PlayState* play) { Message_StartTextbox(play, this->actor.textId, NULL); if (this->gameResult == 2) { - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); } this->actionFunc = EnBomBowlMan_HandlePlayChoice; } else { @@ -306,7 +306,7 @@ void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, PlayState* play) { Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; OnePointCutscene_Init(play, 8010, -99, NULL, CAM_ID_MAIN); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actionFunc = EnBomBowMan_SetupChooseShowPrize; } } else { @@ -342,11 +342,11 @@ void func_809C41FC(EnBomBowlMan* this, PlayState* play) { Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; OnePointCutscene_Init(play, 8010, -99, NULL, CAM_ID_MAIN); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actionFunc = EnBomBowMan_SetupChooseShowPrize; } else { if (this->gameResult == 2) { - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); } this->actionFunc = EnBomBowMan_SetupRunGame; } @@ -458,7 +458,7 @@ void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, PlayState* play) { // "Wow" osSyncPrintf(VT_FGCOL(YELLOW) "☆ わー ☆ %d\n" VT_RST, play->bombchuBowlingStatus); - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->actionFunc = EnBomBowMan_SetupRunGame; } } diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c index ff3a23313..9ef043526 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c @@ -67,7 +67,7 @@ void EnBomBowlPit_DetectHit(EnBomBowlPit* this, PlayState* play) { if (((fabsf(chuPosDiff.x) < 40.0f) || (BREG(2))) && ((fabsf(chuPosDiff.y) < 40.0f) || (BREG(2))) && ((fabsf(chuPosDiff.z) < 40.0f) || (BREG(2)))) { - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); chu->timer = 1; this->subCamId = Play_CreateSubCamera(play); @@ -106,7 +106,7 @@ void EnBomBowlPit_DetectHit(EnBomBowlPit* this, PlayState* play) { Message_StartTextbox(play, this->actor.textId, NULL); this->unk_154 = TEXT_STATE_EVENT; Sfx_PlaySfxCentered(NA_SE_EV_HIT_SOUND); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->status = 1; this->actionFunc = EnBomBowlPit_CameraDollyIn; break; @@ -169,7 +169,7 @@ void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, PlayState* play) { Play_ClearCamera(play, this->subCamId); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actionFunc = EnBomBowlPit_GivePrize; } } @@ -177,7 +177,7 @@ void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, PlayState* play) { void EnBomBowlPit_GivePrize(EnBomBowlPit* this, PlayState* play) { Player* player = GET_PLAYER(play); - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->getItemId = sGetItemIds[this->prizeIndex]; if ((this->getItemId == GI_BOMB_BAG_30) && (CUR_CAPACITY(UPG_BOMB_BAG) == 30)) { diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index 88022903f..510a64851 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -469,7 +469,7 @@ void EnDaiku_InitSubCamera(EnDaiku* this, PlayState* play) { Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); Play_SetCameraFov(play, this->subCamId, play->mainCamera.fov); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); } void EnDaiku_UpdateSubCamera(EnDaiku* this, PlayState* play) { @@ -505,7 +505,7 @@ void EnDaiku_EscapeSuccess(EnDaiku* this, PlayState* play) { Actor_Kill(&this->actor); } } else { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); } } diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index f1156ee07..99e2cfd78 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -134,7 +134,7 @@ s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, PlayState* play) { Message_StartTextbox(play, this->actor.textId, NULL); this->unk_292 = TEXT_STATE_EVENT; this->allRupeesThrown = this->state = this->phase = this->unk_2A2 = this->grabbedRupeesCounter = 0; - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actionFunc = func_809EE048; return true; } else { @@ -159,7 +159,7 @@ s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, PlayState* play) { this->unk_292 = TEXT_STATE_EVENT; func_800F5B58(); Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); if (!GET_EVENTCHKINF(EVENTCHKINF_38)) { this->actionFunc = func_809EE96C; } else { @@ -187,7 +187,7 @@ void EnDivingGame_Talk(EnDivingGame* this, PlayState* play) { if (this->unk_292 != TEXT_STATE_DONE) { switch (this->state) { case ENDIVINGGAME_STATE_NOTPLAYING: - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actionFunc = EnDivingGame_HandlePlayChoice; break; case ENDIVINGGAME_STATE_AWARDPRIZE: @@ -254,7 +254,7 @@ void EnDivingGame_HandlePlayChoice(EnDivingGame* this, PlayState* play) { this->actionFunc = func_809EE048; } else { play->msgCtx.msgMode = MSGMODE_PAUSED; - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actionFunc = func_809EE0FC; } } @@ -266,11 +266,11 @@ void func_809EE048(EnDivingGame* this, PlayState* play) { if (this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { if (this->phase == ENDIVINGGAME_PHASE_ENDED) { Message_CloseTextbox(play); - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->actionFunc = func_809EDCB0; } else { play->msgCtx.msgMode = MSGMODE_PAUSED; - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actionFunc = func_809EE0FC; } } @@ -423,7 +423,7 @@ void func_809EE800(EnDivingGame* this, PlayState* play) { Interface_SetTimer(50 + BREG(2)); } func_800F5ACC(NA_BGM_TIMED_MINI_GAME); - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->actor.textId = 0x405B; this->unk_292 = TEXT_STATE_EVENT; this->state = ENDIVINGGAME_STATE_PLAYING; @@ -446,7 +446,7 @@ void func_809EE96C(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play))) { Message_CloseTextbox(play); - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->actor.textId = 0x4056; this->unk_292 = TEXT_STATE_EVENT; this->state = ENDIVINGGAME_STATE_AWARDPRIZE; diff --git a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c index f4286012c..bbe10cbbc 100644 --- a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c +++ b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c @@ -119,7 +119,7 @@ void EnDntJiji_Wait(EnDntJiji* this, PlayState* play) { !(player->stateFlags1 & PLAYER_STATE1_11)) { OnePointCutscene_Init(play, 2230, -99, &this->actor, CAM_ID_MAIN); this->timer = 0; - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actionFunc = EnDntJiji_SetupUnburrow; } } @@ -253,7 +253,7 @@ void EnDntJiji_Talk(EnDntJiji* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { func_8005B1A4(GET_ACTIVE_CAM(play)); Message_CloseTextbox(play); - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->actor.parent = NULL; Actor_OfferGetItem(&this->actor, play, this->getItemId, 400.0f, 200.0f); this->actionFunc = EnDntJiji_SetupGivePrize; diff --git a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c index 2645f0134..b862034fb 100644 --- a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c +++ b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c @@ -250,7 +250,7 @@ void EnDntNomal_TargetWait(EnDntNomal* this, PlayState* play) { this->hitCounter++; if (this->hitCounter >= 3) { OnePointCutscene_Init(play, 4140, -99, &this->actor, CAM_ID_MAIN); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); this->timer4 = 50; this->actionFunc = EnDntNomal_SetupTargetUnburrow; } @@ -339,7 +339,7 @@ void EnDntNomal_TargetTalk(EnDntNomal* this, PlayState* play) { Message_CloseTextbox(play); func_8005B1A4(GET_ACTIVE_CAM(play)); GET_ACTIVE_CAM(play)->csId = 0; - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actionFunc = EnDntNomal_SetupTargetGivePrize; } } @@ -361,7 +361,7 @@ void EnDntNomal_TargetGivePrize(EnDntNomal* this, PlayState* play) { if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, itemX, itemY, itemZ, 0, 0, 0, EXITEM_BULLET_BAG) == NULL) { - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); Actor_Kill(&this->actor); } this->spawnedItem = true; diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index a80886e34..6d2993886 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -328,7 +328,7 @@ void func_809FE3C0(EnDu* this, PlayState* play) { return; } if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); this->interactInfo.talkState = NPC_TALK_STATE_IDLE; } if (this->actor.xzDistToPlayer < 116.0f + this->collider.dim.radius) { @@ -423,7 +423,7 @@ void func_809FE890(EnDu* this, PlayState* play) { CsCmdActorCue* cue; if (play->csCtx.state == CS_STATE_IDLE) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); EnDu_SetupAction(this, func_809FEB08); return; } @@ -503,7 +503,7 @@ void func_809FEB08(EnDu* this, PlayState* play) { this->unk_1EE = 0; if (this->unk_1E8 == 1) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDU_ANIM_1); EnDu_SetupAction(this, func_809FE3C0); return; @@ -522,7 +522,7 @@ void func_809FEB08(EnDu* this, PlayState* play) { void func_809FEC14(EnDu* this, PlayState* play) { if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); EnDu_SetupAction(this, func_809FEC70); func_809FEC70(this, play); } diff --git a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c index 349632c02..92a040e67 100644 --- a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c +++ b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c @@ -386,7 +386,7 @@ void EnExItem_TargetPrizeApproach(EnExItem* this, PlayState* play) { s32 getItemId; this->actor.draw = NULL; - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->actor.parent = NULL; if (CUR_UPG_VALUE(UPG_BULLET_BAG) == 1) { getItemId = GI_BULLET_BAG_40; diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 8d636accb..97ad57936 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -242,7 +242,7 @@ void EnGe1_KickPlayer(EnGe1* this, PlayState* play) { void EnGe1_SpotPlayer(EnGe1* this, PlayState* play) { this->cutsceneTimer = 30; this->actionFunc = EnGe1_KickPlayer; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_95); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_95); Sfx_PlaySfxCentered(NA_SE_SY_FOUND); Message_StartTextbox(play, 0x6000, &this->actor); } @@ -586,7 +586,7 @@ void EnGe1_BeginGame_Archery(EnGe1* this, PlayState* play) { SET_EVENTCHKINF(EVENTCHKINF_68); if (!(player->stateFlags1 & PLAYER_STATE1_23)) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); } else { horse = Actor_FindNearby(play, &player->actor, ACTOR_EN_HORSE, ACTORCAT_BG, 1200.0f); player->actor.freezeTimer = 1200; diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 512eba214..f0da96875 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -480,7 +480,7 @@ void EnGe2_SetupCapturePlayer(EnGe2* this, PlayState* play) { this->stateFlags |= GE2_STATE_CAPTURING; this->actor.speed = 0.0f; EnGe2_ChangeAction(this, GE2_ACTION_CAPTURETURN); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_95); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_95); Sfx_PlaySfxCentered(NA_SE_SY_FOUND); Message_StartTextbox(play, 0x6000, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index c1dab4443..3713dd0f0 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -159,7 +159,7 @@ void EnGe3_ForceTalk(EnGe3* this, PlayState* play) { this->actionFunc = EnGe3_GiveCard; } else { if (!(this->unk_30C & 4)) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); this->unk_30C |= 4; } this->actor.textId = 0x6004; diff --git a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c index 96a7ad999..507eb4552 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -919,7 +919,7 @@ void EnGeldB_SpinAttack(EnGeldB* this, PlayState* play) { if (&player->actor == this->swordCollider.base.at) { func_8002F71C(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); this->spinAttackState = 2; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_24); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_24); Message_StartTextbox(play, 0x6003, &this->actor); this->timer = 30; this->actor.speed = 0.0f; diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index c19355cbd..2a9a5fc4b 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1925,7 +1925,7 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) { (f32)((Math_SinS(this->actor.world.rot.y) * -30.0f) + this->actor.world.pos.x); player->actor.world.pos.z = (f32)((Math_CosS(this->actor.world.rot.y) * -30.0f) + this->actor.world.pos.z); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); Audio_PlayFanfare(NA_BGM_APPEAR); } break; @@ -1962,7 +1962,7 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) { case 4: // Finalize walking away Message_CloseTextbox(play); EnGo2_GoronFireClearCamera(this, play); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); Actor_Kill(&this->actor); break; case 1: diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index 3cf619fd8..1b2f38f74 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -372,7 +372,7 @@ void EnHeishi1_WaitNight(EnHeishi1* this, PlayState* play) { Message_StartTextbox(play, 0x702D, &this->actor); Sfx_PlaySfxCentered(NA_SE_SY_FOUND); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); // "Discovered!" - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); this->actionFunc = EnHeishi1_SetupKick; } } @@ -456,7 +456,7 @@ void EnHeishi1_Update(Actor* thisx, PlayState* play) { Sfx_PlaySfxCentered(NA_SE_SY_FOUND); // "Discovered!" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); sPlayerIsCaught = true; this->actionFunc = EnHeishi1_SetupMoveToLink; } diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index 66e1679bf..4a21b2851 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -111,7 +111,7 @@ void EnHeishi2_Init(Actor* thisx, PlayState* play) { this->actor.world.pos.z += 90.0f; this->actor.shape.rot.y = this->actor.world.rot.y; Collider_DestroyCylinder(play, &this->collider); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_4; this->actionFunc = func_80A544AC; } @@ -262,7 +262,7 @@ void func_80A5344C(EnHeishi2* this, PlayState* play) { void func_80A53538(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_300 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = func_80A535BC; } @@ -334,7 +334,7 @@ void func_80A53850(EnHeishi2* this, PlayState* play) { Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); Message_CloseTextbox(play); this->unk_30C = 1; - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->actionFunc = func_80A531E4; } } @@ -423,7 +423,7 @@ void func_80A53AD4(EnHeishi2* this, PlayState* play) { void func_80A53C0C(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->unk_300 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = func_80A53C90; } @@ -507,7 +507,7 @@ void func_80A53F30(EnHeishi2* this, PlayState* play) { this->actionFunc = func_80A54038; } else { Message_CloseTextbox(play); - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->actionFunc = func_80A53908; } } else { @@ -525,7 +525,7 @@ void func_80A54038(EnHeishi2* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { SET_INFTABLE(INFTABLE_76); Message_CloseTextbox(play); - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->actionFunc = func_80A53908; } } @@ -650,7 +650,7 @@ void func_80A5455C(EnHeishi2* this, PlayState* play) { EnBom* bomb; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); Message_CloseTextbox(play); pos.x = Rand_CenteredFloat(20.0f) + this->unk_274.x; diff --git a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c index c882d3479..167f976e8 100644 --- a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c +++ b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c @@ -133,7 +133,7 @@ void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, PlayState* play) { Message_StartTextbox(play, 0x702D, &this->actor); Sfx_PlaySfxCentered(NA_SE_SY_FOUND); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); // "Discovered!" - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); this->actionFunc = EnHeishi3_CatchStart; } } @@ -161,7 +161,7 @@ void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, PlayState* play) { Message_StartTextbox(play, 0x702D, &this->actor); Sfx_PlaySfxCentered(NA_SE_SY_FOUND); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); // "Discovered!" - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); this->actionFunc = EnHeishi3_CatchStart; } } diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index 5da716f96..463f7604c 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -266,7 +266,7 @@ void func_80A56994(EnHeishi4* this, PlayState* play) { if ((this->unk_282 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); SET_INFTABLE(INFTABLE_6C); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actionFunc = func_80A56A50; } } @@ -284,7 +284,7 @@ void func_80A56ACC(EnHeishi4* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_288 <= currentFrame) { - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->actionFunc = func_80A5673C; } } diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 6c81b313c..773f5a7e2 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -432,7 +432,7 @@ void func_80A79BAC(EnIn* this, PlayState* play, s32 index, u32 transitionType) { } play->transitionType = transitionType; play->transitionTrigger = TRANS_TRIGGER_START; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); if (index == 0) { AREG(6) = 0; @@ -859,7 +859,7 @@ void func_80A7ABD4(EnIn* this, PlayState* play) { void func_80A7AE84(EnIn* this, PlayState* play) { Play_ChangeCameraStatus(play, this->returnToCamId, CAM_STAT_ACTIVE); Play_ClearCamera(play, this->subCamId); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); this->actionFunc = func_80A7AEF0; } diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 2e2083e19..2f2381818 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -259,7 +259,7 @@ void func_80A8F8D0(EnKakasi* this, PlayState* play) { void func_80A8F9C8(EnKakasi* this, PlayState* play) { func_80A8F28C(this); SkelAnime_Update(&this->skelanime); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); if (this->unk_196 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { @@ -268,7 +268,7 @@ void func_80A8F9C8(EnKakasi* this, PlayState* play) { } this->subCamId = OnePointCutscene_Init(play, 2270, -99, &this->actor, CAM_ID_MAIN); play->msgCtx.msgMode = MSGMODE_PAUSED; - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); Message_StartOcarina(play, OCARINA_ACTION_SCARECROW_LONG_PLAYBACK); this->actionFunc = func_80A8FAA4; } @@ -307,7 +307,7 @@ void func_80A8FBB8(EnKakasi* this, PlayState* play) { if (this->unk_196 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { func_8005B1A4(play->cameraPtrs[this->subCamId]); Message_CloseTextbox(play); - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->actionFunc = func_80A8F660; } } diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c index 043b9fcbd..30e46b550 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -295,7 +295,7 @@ void func_80A91620(EnKakasi3* this, PlayState* play) { if (play->msgCtx.ocarinaMode == OCARINA_MODE_03 && play->msgCtx.msgMode == MSGMODE_NONE) { this->dialogState = TEXT_STATE_EVENT; Message_StartTextbox(play, 0x40A5, NULL); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actionFunc = func_80A91A90; return; } @@ -353,7 +353,7 @@ void func_80A918E4(EnKakasi3* this, PlayState* play) { this->dialogState = TEXT_STATE_EVENT; OnePointCutscene_EndCutscene(play, this->subCamId); this->subCamId = CAM_ID_NONE; - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actionFunc = func_80A91A90; return; } @@ -368,7 +368,7 @@ void func_80A918E4(EnKakasi3* this, PlayState* play) { this->unk_195 = true; Message_StartTextbox(play, 0x40A7, NULL); this->dialogState = TEXT_STATE_EVENT; - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actionFunc = func_80A91A90; return; } @@ -382,7 +382,7 @@ void func_80A918E4(EnKakasi3* this, PlayState* play) { void func_80A91A90(EnKakasi3* this, PlayState* play) { func_80A90E28(this); SkelAnime_Update(&this->skelAnime); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); if (this->dialogState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { if (this->unk_195) { @@ -398,7 +398,7 @@ void func_80A91A90(EnKakasi3* this, PlayState* play) { } Message_CloseTextbox(play); play->msgCtx.ocarinaMode = OCARINA_MODE_04; - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->actionFunc = func_80A911F0; } } diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index 1b9198b14..bf45ee5c8 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -382,7 +382,7 @@ void EnKz_SetupMweep(EnKz* this, PlayState* play) { subCamEye.y += -100.0f; subCamEye.z += 260.0f; Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); this->actor.speed = 0.1f; this->actionFunc = EnKz_Mweep; } @@ -414,7 +414,7 @@ void EnKz_Mweep(EnKz* this, PlayState* play) { void EnKz_StopMweep(EnKz* this, PlayState* play) { Play_ChangeCameraStatus(play, this->returnToCamId, CAM_STAT_ACTIVE); Play_ClearCamera(play, this->subCamId); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); this->actionFunc = EnKz_Wait; } diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index fd2912394..a4f1ab495 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -337,7 +337,7 @@ void func_80ACA71C(EnOwl* this) { } void func_80ACA76C(EnOwl* this, PlayState* play) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); if (Actor_TextboxIsClosing(&this->actor, play)) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); @@ -347,7 +347,7 @@ void func_80ACA76C(EnOwl* this, PlayState* play) { } void func_80ACA7E0(EnOwl* this, PlayState* play) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); if (Actor_TextboxIsClosing(&this->actor, play)) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); @@ -547,7 +547,7 @@ void EnOwl_WaitLakeHylia(EnOwl* this, PlayState* play) { } void func_80ACB03C(EnOwl* this, PlayState* play) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); if (Actor_TextboxIsClosing(&this->actor, play)) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 51d58798a..19e3a67cf 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -1074,7 +1074,7 @@ void EnSkj_SetupMaskTrade(EnSkj* this) { void EnSkj_StartMaskTrade(EnSkj* this, PlayState* play) { u8 sp1F = Message_GetState(&play->msgCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); if ((sp1F == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { EnSkj_JumpFromStump(this); } @@ -1172,7 +1172,7 @@ void EnSkj_SetupWaitForMaskTextClear(EnSkj* this) { void EnSkj_WaitForMaskTextClear(EnSkj* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); this->backflipFlag = 1; EnSkj_Backflip(this); } diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index dbaf08530..a685942b6 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -757,7 +757,7 @@ void EnTa_RunCuccoGame(EnTa* this, PlayState* play) { case 1: // Last cucco found, end the game gSaveContext.timerState = TIMER_STATE_OFF; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); Message_StartTextbox(play, 0x2084, &this->actor); this->actionFunc = EnTa_TalkCuccoGameEnd; @@ -805,7 +805,7 @@ void EnTa_RunCuccoGame(EnTa* this, PlayState* play) { this->stateFlags &= ~TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY; Sfx_PlaySfxCentered(NA_SE_SY_FOUND); gSaveContext.timerState = TIMER_STATE_OFF; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); // Time's up text Message_StartTextbox(play, 0x2081, &this->actor); @@ -868,7 +868,7 @@ void EnTa_ThrowSuperCuccos(EnTa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gTalonSitWakeUpAnim, 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim) - 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim), ANIMMODE_ONCE, 10.0f); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); } } @@ -885,7 +885,7 @@ void EnTa_StartingCuccoGame3(EnTa* this, PlayState* play) { func_800F5ACC(NA_BGM_TIMED_MINI_GAME); this->stateFlags |= TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY; Message_CloseTextbox(play); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index d6b89e44f..0bee2bad4 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -562,7 +562,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { // Handles Dark Link being damaged if ((this->actor.colChkInfo.health == 0) && sDeathFlag) { - this->csMode = PLAYER_CSMODE_24; + this->csAction = PLAYER_CSACTION_24; this->unk_448 = &player->actor; this->doorBgCamIndex = 1; sDeathFlag = false; diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 4b4d1f88f..cbba7d460 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -259,7 +259,7 @@ void EnWallmas_SetupTakePlayer(EnWallmas* this, PlayState* play) { this->actor.velocity.y = 0.0f; this->yTarget = this->actor.yDistToPlayer; - func_8002DF38(play, &this->actor, PLAYER_CSMODE_37); + func_8002DF38(play, &this->actor, PLAYER_CSACTION_37); OnePointCutscene_Init(play, 9500, 9999, &this->actor, CAM_ID_MAIN); } diff --git a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c index 96eaa97d2..d0366ca20 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c @@ -194,7 +194,7 @@ void func_80B3A3D4(EnWonderTalk2* this, PlayState* play) { this->unk_15A = true; } this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_4); - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->unk_156 = true; this->actionFunc = func_80B3A4F8; break; @@ -253,7 +253,7 @@ void func_80B3A4F8(EnWonderTalk2* this, PlayState* play) { this->unk_158 = 0; if (!this->unk_156) { Message_StartTextbox(play, this->actor.textId, NULL); - func_8002DF54(play, NULL, PLAYER_CSMODE_8); + func_8002DF54(play, NULL, PLAYER_CSACTION_8); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_4; this->actionFunc = func_80B3A3D4; } diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index 680d3183a..a66c5e7b8 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -429,7 +429,7 @@ void func_80B4BBC4(EnZl1* this, PlayState* play) { Player* player = GET_PLAYER(play); Animation_Change(&this->skelAnime, &gChildZelda1Anim_00438, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); Player_PlaySfx(player, NA_SE_VO_LI_SURPRISE_KID); this->actor.textId = 0x7039; Message_StartTextbox(play, this->actor.textId, NULL); @@ -570,7 +570,7 @@ void func_80B4BF2C(EnZl1* this, PlayState* play) { break; case 6: if (Actor_TextboxIsClosing(&this->actor, play)) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); this->actor.flags &= ~ACTOR_FLAG_8; this->unk_1E2 = 4; diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index 1d4f87d0e..5d9e230a9 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -320,7 +320,7 @@ s32 EnZl4_SetupFromLegendCs(EnZl4* this, PlayState* play) { Actor* playerx = &GET_PLAYER(play)->actor; s16 rotY; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); playerx->world.pos = this->actor.world.pos; rotY = this->actor.shape.rot.y; playerx->world.pos.x += 56.0f * Math_SinS(rotY); @@ -912,7 +912,7 @@ s32 EnZl4_CsLookWindow(EnZl4* this, PlayState* play) { play->csCtx.script = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardGanonCs); gSaveContext.cutsceneTrigger = 1; this->talkState++; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); } break; case 2: @@ -922,7 +922,7 @@ s32 EnZl4_CsLookWindow(EnZl4* this, PlayState* play) { } } else { Rumble_Request(0.0f, 160, 10, 40); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_1); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_1); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_30); EnZl4_SetActiveCamDir(play, 11); Message_StartTextbox(play, 0x7039, NULL); @@ -1193,7 +1193,7 @@ void EnZl4_Cutscene(EnZl4* this, PlayState* play) { break; case ZL4_CS_PLAN: if (EnZl4_CsMakePlan(this, play)) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL; SET_EVENTCHKINF(EVENTCHKINF_40); this->actionFunc = EnZl4_Idle; diff --git a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c index bcbf55800..2561813e9 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c @@ -151,7 +151,7 @@ void EnfHG_Intro(EnfHG* this, PlayState* play) { break; } Cutscene_StartManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); @@ -192,7 +192,7 @@ void EnfHG_Intro(EnfHG* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_GANON_HORSE_GROAN); } if (this->timers[0] == 20) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_9); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_9); } if (this->timers[0] == 1) { SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_OPENING_GANON); @@ -354,7 +354,7 @@ void EnfHG_Intro(EnfHG* this, PlayState* play) { this->bossGndSignal = FHG_FINISH; } if (this->timers[0] == 170) { - func_8002DF54(play, &this->actor, PLAYER_CSMODE_8); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_8); Actor_PlaySfx(&this->actor, NA_SE_EN_FANTOM_MASIC2); } Math_ApproachF(&this->subCamEye.z, this->subCamPanZ + (GND_BOSSROOM_CENTER_Z + 100.0f), 0.1f, @@ -400,7 +400,7 @@ void EnfHG_Intro(EnfHG* this, PlayState* play) { Play_ReturnToMainCam(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); this->actionFunc = EnfHG_Retreat; } break; diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 34642308c..808078fde 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -5392,7 +5392,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { sSubCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_5); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_5); mainCam = Play_GetCamera(play, CAM_ID_MAIN); sSubCamEye.x = mainCam->eye.x; sSubCamEye.y = mainCam->eye.y; @@ -5418,7 +5418,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { mainCam->at = sSubCamAt; Play_ReturnToMainCam(play, sSubCamId, 0); Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); sFishingPlayerCinematicState = 0; sSubCamId = SUB_CAM_ID_DONE; @@ -5435,7 +5435,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { sSubCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_5); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_5); mainCam = Play_GetCamera(play, CAM_ID_MAIN); sSubCamEye.x = mainCam->eye.x; sSubCamEye.y = mainCam->eye.y; @@ -5454,7 +5454,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { if ((sFishingCinematicTimer == 0) && Message_ShouldAdvance(play)) { sFishingPlayerCinematicState = 22; sFishingCinematicTimer = 40; - func_8002DF54(play, &this->actor, PLAYER_CSMODE_28); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_28); sSinkingLureHeldY = 0.0f; } break; @@ -5523,7 +5523,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { mainCam->at = sSubCamAt; Play_ReturnToMainCam(play, sSubCamId, 0); Cutscene_StopManual(play, &play->csCtx); - func_8002DF54(play, &this->actor, PLAYER_CSMODE_7); + func_8002DF54(play, &this->actor, PLAYER_CSACTION_7); sFishingPlayerCinematicState = 0; sSubCamId = SUB_CAM_ID_DONE; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 2123cbeb0..b224e07c6 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -251,7 +251,7 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cue); s32 Player_IsDroppingFish(PlayState* play); s32 Player_StartFishing(PlayState* play); s32 func_80852F38(PlayState* play, Player* this); -s32 func_80852FFC(PlayState* play, Actor* actor, s32 csMode); +s32 func_80852FFC(PlayState* play, Actor* actor, s32 csAction); void func_80853080(Player* this, PlayState* play); s32 Player_InflictDamage(PlayState* play, s32 damage); void func_80853148(PlayState* play, Actor* actor); @@ -2457,7 +2457,7 @@ void Player_UpdateItems(Player* this, PlayState* play) { if ((this->actor.category == ACTORCAT_PLAYER) && !(this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) && ((this->heldItemAction == this->itemAction) || (this->stateFlags1 & PLAYER_STATE1_22)) && (gSaveContext.save.info.playerData.health != 0) && (play->csCtx.state == CS_STATE_IDLE) && - (this->csMode == PLAYER_CSMODE_NONE) && (play->shootingGalleryStatus == 0) && + (this->csAction == PLAYER_CSACTION_NONE) && (play->shootingGalleryStatus == 0) && (play->activeCamId == CAM_ID_MAIN) && (play->transitionTrigger != TRANS_TRIGGER_START) && (gSaveContext.timerState != TIMER_STATE_STOP)) { Player_ProcessItemButtons(this, play); @@ -3458,7 +3458,7 @@ void func_80836BEC(Player* this, PlayState* play) { this->stateFlags1 &= ~PLAYER_STATE1_30; } - if ((play->csCtx.state != CS_STATE_IDLE) || (this->csMode != PLAYER_CSMODE_NONE) || + if ((play->csCtx.state != CS_STATE_IDLE) || (this->csAction != PLAYER_CSACTION_NONE) || (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->stateFlags3 & PLAYER_STATE3_7)) { this->unk_66C = 0; } else if (zTrigPressed || (this->stateFlags2 & PLAYER_STATE2_13) || (this->unk_684 != NULL)) { @@ -4262,7 +4262,7 @@ s32 func_808382DC(Player* this, PlayState* play) { } if ((this->unk_A87 != 0) || (this->invincibilityTimer > 0) || (this->stateFlags1 & PLAYER_STATE1_26) || - (this->csMode != PLAYER_CSMODE_NONE) || (this->meleeWeaponQuads[0].base.atFlags & AT_HIT) || + (this->csAction != PLAYER_CSACTION_NONE) || (this->meleeWeaponQuads[0].base.atFlags & AT_HIT) || (this->meleeWeaponQuads[1].base.atFlags & AT_HIT)) { return 0; } @@ -4534,7 +4534,7 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol exitIndex = 0; if (!(this->stateFlags1 & PLAYER_STATE1_7) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && - (this->csMode == PLAYER_CSMODE_NONE) && !(this->stateFlags1 & PLAYER_STATE1_0) && + (this->csAction == PLAYER_CSACTION_NONE) && !(this->stateFlags1 & PLAYER_STATE1_0) && (((poly != NULL) && (exitIndex = SurfaceType_GetExitIndex(&play->colCtx, poly, bgId), exitIndex != 0)) || (func_8083816C(sFloorType) && (this->floorProperty == FLOOR_PROPERTY_12)))) { @@ -10449,7 +10449,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { if (this->actor.category == ACTORCAT_PLAYER) { seqMode = SEQ_MODE_DEFAULT; - if (this->csMode != PLAYER_CSMODE_NONE) { + if (this->csAction != PLAYER_CSACTION_NONE) { Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_NORMAL); } else if (!(this->stateFlags1 & PLAYER_STATE1_20)) { if ((this->actor.parent != NULL) && (this->stateFlags3 & PLAYER_STATE3_7)) { @@ -10669,19 +10669,22 @@ void func_80848EF8(Player* this) { } static s8 D_808547C4[] = { - PLAYER_CSMODE_NONE, PLAYER_CSMODE_3, PLAYER_CSMODE_3, PLAYER_CSMODE_5, PLAYER_CSMODE_4, PLAYER_CSMODE_8, - PLAYER_CSMODE_9, PLAYER_CSMODE_13, PLAYER_CSMODE_14, PLAYER_CSMODE_15, PLAYER_CSMODE_16, PLAYER_CSMODE_17, - PLAYER_CSMODE_18, -PLAYER_CSMODE_22, PLAYER_CSMODE_23, PLAYER_CSMODE_24, PLAYER_CSMODE_25, PLAYER_CSMODE_26, - PLAYER_CSMODE_27, PLAYER_CSMODE_28, PLAYER_CSMODE_29, PLAYER_CSMODE_31, PLAYER_CSMODE_32, PLAYER_CSMODE_33, - PLAYER_CSMODE_34, -PLAYER_CSMODE_35, PLAYER_CSMODE_30, PLAYER_CSMODE_36, PLAYER_CSMODE_38, -PLAYER_CSMODE_39, - -PLAYER_CSMODE_40, -PLAYER_CSMODE_41, PLAYER_CSMODE_42, PLAYER_CSMODE_43, PLAYER_CSMODE_45, PLAYER_CSMODE_46, - PLAYER_CSMODE_NONE, PLAYER_CSMODE_NONE, PLAYER_CSMODE_NONE, PLAYER_CSMODE_67, PLAYER_CSMODE_48, PLAYER_CSMODE_47, - -PLAYER_CSMODE_50, PLAYER_CSMODE_51, -PLAYER_CSMODE_52, -PLAYER_CSMODE_53, PLAYER_CSMODE_54, PLAYER_CSMODE_55, - PLAYER_CSMODE_56, PLAYER_CSMODE_57, PLAYER_CSMODE_58, PLAYER_CSMODE_59, PLAYER_CSMODE_60, PLAYER_CSMODE_61, - PLAYER_CSMODE_62, PLAYER_CSMODE_63, PLAYER_CSMODE_64, -PLAYER_CSMODE_65, -PLAYER_CSMODE_66, PLAYER_CSMODE_68, - PLAYER_CSMODE_11, PLAYER_CSMODE_69, PLAYER_CSMODE_70, PLAYER_CSMODE_71, PLAYER_CSMODE_8, PLAYER_CSMODE_8, - PLAYER_CSMODE_72, PLAYER_CSMODE_73, PLAYER_CSMODE_78, PLAYER_CSMODE_79, PLAYER_CSMODE_80, PLAYER_CSMODE_89, - PLAYER_CSMODE_90, PLAYER_CSMODE_91, PLAYER_CSMODE_92, PLAYER_CSMODE_77, PLAYER_CSMODE_19, PLAYER_CSMODE_94, + PLAYER_CSACTION_NONE, PLAYER_CSACTION_3, PLAYER_CSACTION_3, PLAYER_CSACTION_5, PLAYER_CSACTION_4, + PLAYER_CSACTION_8, PLAYER_CSACTION_9, PLAYER_CSACTION_13, PLAYER_CSACTION_14, PLAYER_CSACTION_15, + PLAYER_CSACTION_16, PLAYER_CSACTION_17, PLAYER_CSACTION_18, -PLAYER_CSACTION_22, PLAYER_CSACTION_23, + PLAYER_CSACTION_24, PLAYER_CSACTION_25, PLAYER_CSACTION_26, PLAYER_CSACTION_27, PLAYER_CSACTION_28, + PLAYER_CSACTION_29, PLAYER_CSACTION_31, PLAYER_CSACTION_32, PLAYER_CSACTION_33, PLAYER_CSACTION_34, + -PLAYER_CSACTION_35, PLAYER_CSACTION_30, PLAYER_CSACTION_36, PLAYER_CSACTION_38, -PLAYER_CSACTION_39, + -PLAYER_CSACTION_40, -PLAYER_CSACTION_41, PLAYER_CSACTION_42, PLAYER_CSACTION_43, PLAYER_CSACTION_45, + PLAYER_CSACTION_46, PLAYER_CSACTION_NONE, PLAYER_CSACTION_NONE, PLAYER_CSACTION_NONE, PLAYER_CSACTION_67, + PLAYER_CSACTION_48, PLAYER_CSACTION_47, -PLAYER_CSACTION_50, PLAYER_CSACTION_51, -PLAYER_CSACTION_52, + -PLAYER_CSACTION_53, PLAYER_CSACTION_54, PLAYER_CSACTION_55, PLAYER_CSACTION_56, PLAYER_CSACTION_57, + PLAYER_CSACTION_58, PLAYER_CSACTION_59, PLAYER_CSACTION_60, PLAYER_CSACTION_61, PLAYER_CSACTION_62, + PLAYER_CSACTION_63, PLAYER_CSACTION_64, -PLAYER_CSACTION_65, -PLAYER_CSACTION_66, PLAYER_CSACTION_68, + PLAYER_CSACTION_11, PLAYER_CSACTION_69, PLAYER_CSACTION_70, PLAYER_CSACTION_71, PLAYER_CSACTION_8, + PLAYER_CSACTION_8, PLAYER_CSACTION_72, PLAYER_CSACTION_73, PLAYER_CSACTION_78, PLAYER_CSACTION_79, + PLAYER_CSACTION_80, PLAYER_CSACTION_89, PLAYER_CSACTION_90, PLAYER_CSACTION_91, PLAYER_CSACTION_92, + PLAYER_CSACTION_77, PLAYER_CSACTION_19, PLAYER_CSACTION_94, }; static Vec3f D_80854814 = { 0.0f, 0.0f, 200.0f }; @@ -10947,30 +10950,30 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { } } - if ((play->csCtx.state != CS_STATE_IDLE) && (this->csMode != PLAYER_CSMODE_6) && + if ((play->csCtx.state != CS_STATE_IDLE) && (this->csAction != PLAYER_CSACTION_6) && !(this->stateFlags1 & PLAYER_STATE1_23) && !(this->stateFlags2 & PLAYER_STATE2_7) && (this->actor.category == ACTORCAT_PLAYER)) { CsCmdActorCue* cue = play->csCtx.playerCue; - if ((cue != NULL) && (D_808547C4[cue->id] != PLAYER_CSMODE_NONE)) { - func_8002DF54(play, NULL, PLAYER_CSMODE_6); + if ((cue != NULL) && (D_808547C4[cue->id] != PLAYER_CSACTION_NONE)) { + func_8002DF54(play, NULL, PLAYER_CSACTION_6); Player_ZeroSpeedXZ(this); - } else if ((this->csMode == PLAYER_CSMODE_NONE) && !(this->stateFlags2 & PLAYER_STATE2_10) && + } else if ((this->csAction == PLAYER_CSACTION_NONE) && !(this->stateFlags2 & PLAYER_STATE2_10) && (play->csCtx.state != CS_STATE_STOP)) { - func_8002DF54(play, NULL, PLAYER_CSMODE_49); + func_8002DF54(play, NULL, PLAYER_CSACTION_49); Player_ZeroSpeedXZ(this); } } - if (this->csMode != PLAYER_CSMODE_NONE) { - if ((this->csMode != PLAYER_CSMODE_7) || + if (this->csAction != PLAYER_CSACTION_NONE) { + if ((this->csAction != PLAYER_CSACTION_7) || !(this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21 | PLAYER_STATE1_26))) { this->unk_6AD = 3; } else if (Player_Action_80852E14 != this->actionFunc) { func_80852944(play, this, NULL); } } else { - this->prevCsMode = PLAYER_CSMODE_NONE; + this->prevCsAction = PLAYER_CSACTION_NONE; } func_8083D6EC(play, this); @@ -11259,7 +11262,7 @@ void Player_Draw(Actor* thisx, PlayState* play2) { s32 lod; s32 pad; - if ((this->csMode != PLAYER_CSMODE_NONE) || (func_8008E9C4(this) && 0) || + if ((this->csAction != PLAYER_CSACTION_NONE) || (func_8008E9C4(this) && 0) || (this->actor.projectedPos.z < 160.0f)) { lod = 0; } else { @@ -11493,8 +11496,8 @@ void Player_Action_8084B1D8(Player* this, PlayState* play) { Player_UpdateUpperBody(this, play); } - if ((this->csMode != PLAYER_CSMODE_NONE) || (this->unk_6AD == 0) || (this->unk_6AD >= 4) || func_80833B54(this) || - (this->unk_664 != NULL) || !func_8083AD4C(play, this) || + if ((this->csAction != PLAYER_CSACTION_NONE) || (this->unk_6AD == 0) || (this->unk_6AD >= 4) || + func_80833B54(this) || (this->unk_664 != NULL) || !func_8083AD4C(play, this) || (((this->unk_6AD == 2) && (CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_R) || func_80833B2C(this) || (!func_8002DD78(this) && !func_808334B4(this)))) || ((this->unk_6AD == 1) && @@ -12273,9 +12276,9 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.morphTable, this->skelAnime.jointTable); - if ((play->csCtx.state != CS_STATE_IDLE) || (this->csMode != PLAYER_CSMODE_NONE)) { - if (this->csMode == PLAYER_CSMODE_7) { - this->csMode = PLAYER_CSMODE_NONE; + if ((play->csCtx.state != CS_STATE_IDLE) || (this->csAction != PLAYER_CSACTION_NONE)) { + if (this->csAction == PLAYER_CSACTION_7) { + this->csAction = PLAYER_CSACTION_NONE; } this->unk_6AD = 0; this->actionVar1 = 0; @@ -12292,7 +12295,7 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { this->yaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; - if ((this->csMode != PLAYER_CSMODE_NONE) || + if ((this->csAction != PLAYER_CSACTION_NONE) || (!func_8083224C(play) && ((rideActor->actor.speed != 0.0f) || !func_8083B644(this, play)) && !func_8083C1DC(this, play))) { if (D_808535E0 == 0) { @@ -12350,7 +12353,7 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { return; } - if ((this->csMode != PLAYER_CSMODE_NONE) || (!func_8084C9BC(this, play) && !func_8083B040(this, play))) { + if ((this->csAction != PLAYER_CSACTION_NONE) || (!func_8084C9BC(this, play) && !func_8083B040(this, play))) { if (this->unk_664 != NULL) { if (func_8002DD78(this) != 0) { this->unk_6BE = func_8083DB98(this, 1) - this->actor.shape.rot.y; @@ -12696,7 +12699,7 @@ s32 func_8084DFF4(PlayState* play, Player* this) { gSaveContext.nextCutsceneIndex = 0xFFF1; play->transitionType = TRANS_TYPE_SANDSTORM_END; this->stateFlags1 &= ~PLAYER_STATE1_29; - func_80852FFC(play, NULL, PLAYER_CSMODE_8); + func_80852FFC(play, NULL, PLAYER_CSACTION_8); } this->getItemId = GI_NONE; } @@ -12793,10 +12796,10 @@ void Player_Action_8084E3C4(Player* this, PlayState* play) { gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams = 0x5FF; gSaveContext.respawn[RESPAWN_MODE_RETURN].data = play->msgCtx.lastPlayedSong; - this->csMode = PLAYER_CSMODE_NONE; + this->csAction = PLAYER_CSACTION_NONE; this->stateFlags1 &= ~PLAYER_STATE1_29; - func_80852FFC(play, NULL, PLAYER_CSMODE_8); + func_80852FFC(play, NULL, PLAYER_CSACTION_8); play->mainCamera.stateFlags &= ~CAM_STATE_3; this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; @@ -13897,216 +13900,216 @@ static struct_80832924 D_80854B14[] = { { 0, -0x300A }, }; -static struct_80854B18 D_80854B18[PLAYER_CSMODE_MAX] = { - { 0, NULL }, // PLAYER_CSMODE_NONE - { -1, func_808515A4 }, // PLAYER_CSMODE_1 - { 2, &gPlayerAnim_link_demo_goma_furimuki }, // PLAYER_CSMODE_2 - { 0, NULL }, // PLAYER_CSMODE_3 - { 0, NULL }, // PLAYER_CSMODE_4 - { 3, &gPlayerAnim_link_demo_bikkuri }, // PLAYER_CSMODE_5 - { 0, NULL }, // PLAYER_CSMODE_6 - { 0, NULL }, // PLAYER_CSMODE_7 - { -1, func_808515A4 }, // PLAYER_CSMODE_8 - { 2, &gPlayerAnim_link_demo_furimuki }, // PLAYER_CSMODE_9 - { -1, func_80851788 }, // PLAYER_CSMODE_10 - { 3, &gPlayerAnim_link_demo_warp }, // PLAYER_CSMODE_11 - { -1, func_808518DC }, // PLAYER_CSMODE_12 - { 7, &gPlayerAnim_clink_demo_get1 }, // PLAYER_CSMODE_13 - { 5, &gPlayerAnim_clink_demo_get2 }, // PLAYER_CSMODE_14 - { 5, &gPlayerAnim_clink_demo_get3 }, // PLAYER_CSMODE_15 - { 5, &gPlayerAnim_clink_demo_standup }, // PLAYER_CSMODE_16 - { 7, &gPlayerAnim_clink_demo_standup_wait }, // PLAYER_CSMODE_17 - { -1, func_808519EC }, // PLAYER_CSMODE_18 - { 2, &gPlayerAnim_link_demo_baru_op1 }, // PLAYER_CSMODE_19 - { 2, &gPlayerAnim_link_demo_baru_op3 }, // PLAYER_CSMODE_20 - { 0, NULL }, // PLAYER_CSMODE_21 - { -1, func_80851B90 }, // PLAYER_CSMODE_22 - { 3, &gPlayerAnim_link_demo_jibunmiru }, // PLAYER_CSMODE_23 - { 9, &gPlayerAnim_link_normal_back_downA }, // PLAYER_CSMODE_24 - { 2, &gPlayerAnim_link_normal_back_down_wake }, // PLAYER_CSMODE_25 - { -1, func_80851D2C }, // PLAYER_CSMODE_26 - { 2, &gPlayerAnim_link_normal_okarina_end }, // PLAYER_CSMODE_27 - { 3, &gPlayerAnim_link_demo_get_itemA }, // PLAYER_CSMODE_28 - { -1, func_808515A4 }, // PLAYER_CSMODE_29 - { 2, &gPlayerAnim_link_normal_normal2fighter_free }, // PLAYER_CSMODE_30 - { 0, NULL }, // PLAYER_CSMODE_31 - { 0, NULL }, // PLAYER_CSMODE_32 - { 5, &gPlayerAnim_clink_demo_atozusari }, // PLAYER_CSMODE_33 - { -1, func_80851368 }, // PLAYER_CSMODE_34 - { -1, func_80851E64 }, // PLAYER_CSMODE_35 - { 5, &gPlayerAnim_clink_demo_bashi }, // PLAYER_CSMODE_36 - { 16, &gPlayerAnim_link_normal_hang_up_down }, // PLAYER_CSMODE_37 - { -1, func_80851F84 }, // PLAYER_CSMODE_38 - { -1, func_80851E90 }, // PLAYER_CSMODE_39 - { 6, &gPlayerAnim_clink_op3_okiagari }, // PLAYER_CSMODE_40 - { 6, &gPlayerAnim_clink_op3_tatiagari }, // PLAYER_CSMODE_41 - { -1, func_80852080 }, // PLAYER_CSMODE_42 - { 5, &gPlayerAnim_clink_demo_miokuri }, // PLAYER_CSMODE_43 - { -1, func_808521F4 }, // PLAYER_CSMODE_44 - { -1, func_8085225C }, // PLAYER_CSMODE_45 - { -1, func_80852280 }, // PLAYER_CSMODE_46 - { 5, &gPlayerAnim_clink_demo_nozoki }, // PLAYER_CSMODE_47 - { 5, &gPlayerAnim_clink_demo_koutai }, // PLAYER_CSMODE_48 - { -1, func_808515A4 }, // PLAYER_CSMODE_49 - { 5, &gPlayerAnim_clink_demo_koutai_kennuki }, // PLAYER_CSMODE_50 - { 5, &gPlayerAnim_link_demo_kakeyori }, // PLAYER_CSMODE_51 - { 5, &gPlayerAnim_link_demo_kakeyori_mimawasi }, // PLAYER_CSMODE_52 - { 5, &gPlayerAnim_link_demo_kakeyori_miokuri }, // PLAYER_CSMODE_53 - { 3, &gPlayerAnim_link_demo_furimuki2 }, // PLAYER_CSMODE_54 - { 3, &gPlayerAnim_link_demo_kaoage }, // PLAYER_CSMODE_55 - { 4, &gPlayerAnim_link_demo_kaoage_wait }, // PLAYER_CSMODE_56 - { 3, &gPlayerAnim_clink_demo_mimawasi }, // PLAYER_CSMODE_57 - { 3, &gPlayerAnim_link_demo_nozokikomi }, // PLAYER_CSMODE_58 - { 6, &gPlayerAnim_kolink_odoroki_demo }, // PLAYER_CSMODE_59 - { 6, &gPlayerAnim_link_shagamu_demo }, // PLAYER_CSMODE_60 - { 14, &gPlayerAnim_link_okiru_demo }, // PLAYER_CSMODE_61 - { 3, &gPlayerAnim_link_okiru_demo }, // PLAYER_CSMODE_62 - { 5, &gPlayerAnim_link_fighter_power_kiru_start }, // PLAYER_CSMODE_63 - { 16, &gPlayerAnim_demo_link_nwait }, // PLAYER_CSMODE_64 - { 15, &gPlayerAnim_demo_link_tewatashi }, // PLAYER_CSMODE_65 - { 15, &gPlayerAnim_demo_link_orosuu }, // PLAYER_CSMODE_66 - { 3, &gPlayerAnim_d_link_orooro }, // PLAYER_CSMODE_67 - { 3, &gPlayerAnim_d_link_imanodare }, // PLAYER_CSMODE_68 - { 3, &gPlayerAnim_link_hatto_demo }, // PLAYER_CSMODE_69 - { 6, &gPlayerAnim_o_get_mae }, // PLAYER_CSMODE_70 - { 6, &gPlayerAnim_o_get_ato }, // PLAYER_CSMODE_71 - { 6, &gPlayerAnim_om_get_mae }, // PLAYER_CSMODE_72 - { 6, &gPlayerAnim_nw_modoru }, // PLAYER_CSMODE_73 - { 3, &gPlayerAnim_link_demo_gurad }, // PLAYER_CSMODE_74 - { 3, &gPlayerAnim_link_demo_look_hand }, // PLAYER_CSMODE_75 - { 4, &gPlayerAnim_link_demo_sita_wait }, // PLAYER_CSMODE_76 - { 3, &gPlayerAnim_link_demo_ue }, // PLAYER_CSMODE_77 - { 3, &gPlayerAnim_Link_muku }, // PLAYER_CSMODE_78 - { 3, &gPlayerAnim_Link_miageru }, // PLAYER_CSMODE_79 - { 6, &gPlayerAnim_Link_ha }, // PLAYER_CSMODE_80 - { 3, &gPlayerAnim_L_1kyoro }, // PLAYER_CSMODE_81 - { 3, &gPlayerAnim_L_2kyoro }, // PLAYER_CSMODE_82 - { 3, &gPlayerAnim_L_sagaru }, // PLAYER_CSMODE_83 - { 3, &gPlayerAnim_L_bouzen }, // PLAYER_CSMODE_84 - { 3, &gPlayerAnim_L_kamaeru }, // PLAYER_CSMODE_85 - { 3, &gPlayerAnim_L_hajikareru }, // PLAYER_CSMODE_86 - { 3, &gPlayerAnim_L_ken_miru }, // PLAYER_CSMODE_87 - { 3, &gPlayerAnim_L_mukinaoru }, // PLAYER_CSMODE_88 - { -1, func_808524B0 }, // PLAYER_CSMODE_89 - { 3, &gPlayerAnim_link_wait_itemD1_20f }, // PLAYER_CSMODE_90 - { -1, func_80852544 }, // PLAYER_CSMODE_91 - { -1, func_80852564 }, // PLAYER_CSMODE_92 - { 3, &gPlayerAnim_link_normal_wait_typeB_20f }, // PLAYER_CSMODE_93 - { -1, func_80852608 }, // PLAYER_CSMODE_94 - { 3, &gPlayerAnim_link_demo_kousan }, // PLAYER_CSMODE_95 - { 3, &gPlayerAnim_link_demo_return_to_past }, // PLAYER_CSMODE_96 - { 3, &gPlayerAnim_link_last_hit_motion1 }, // PLAYER_CSMODE_97 - { 3, &gPlayerAnim_link_last_hit_motion2 }, // PLAYER_CSMODE_98 - { 3, &gPlayerAnim_link_demo_zeldamiru }, // PLAYER_CSMODE_99 - { 3, &gPlayerAnim_link_demo_kenmiru1 }, // PLAYER_CSMODE_100 - { 3, &gPlayerAnim_link_demo_kenmiru2 }, // PLAYER_CSMODE_101 - { 3, &gPlayerAnim_link_demo_kenmiru2_modori }, // PLAYER_CSMODE_102 +static struct_80854B18 D_80854B18[PLAYER_CSACTION_MAX] = { + { 0, NULL }, // PLAYER_CSACTION_NONE + { -1, func_808515A4 }, // PLAYER_CSACTION_1 + { 2, &gPlayerAnim_link_demo_goma_furimuki }, // PLAYER_CSACTION_2 + { 0, NULL }, // PLAYER_CSACTION_3 + { 0, NULL }, // PLAYER_CSACTION_4 + { 3, &gPlayerAnim_link_demo_bikkuri }, // PLAYER_CSACTION_5 + { 0, NULL }, // PLAYER_CSACTION_6 + { 0, NULL }, // PLAYER_CSACTION_7 + { -1, func_808515A4 }, // PLAYER_CSACTION_8 + { 2, &gPlayerAnim_link_demo_furimuki }, // PLAYER_CSACTION_9 + { -1, func_80851788 }, // PLAYER_CSACTION_10 + { 3, &gPlayerAnim_link_demo_warp }, // PLAYER_CSACTION_11 + { -1, func_808518DC }, // PLAYER_CSACTION_12 + { 7, &gPlayerAnim_clink_demo_get1 }, // PLAYER_CSACTION_13 + { 5, &gPlayerAnim_clink_demo_get2 }, // PLAYER_CSACTION_14 + { 5, &gPlayerAnim_clink_demo_get3 }, // PLAYER_CSACTION_15 + { 5, &gPlayerAnim_clink_demo_standup }, // PLAYER_CSACTION_16 + { 7, &gPlayerAnim_clink_demo_standup_wait }, // PLAYER_CSACTION_17 + { -1, func_808519EC }, // PLAYER_CSACTION_18 + { 2, &gPlayerAnim_link_demo_baru_op1 }, // PLAYER_CSACTION_19 + { 2, &gPlayerAnim_link_demo_baru_op3 }, // PLAYER_CSACTION_20 + { 0, NULL }, // PLAYER_CSACTION_21 + { -1, func_80851B90 }, // PLAYER_CSACTION_22 + { 3, &gPlayerAnim_link_demo_jibunmiru }, // PLAYER_CSACTION_23 + { 9, &gPlayerAnim_link_normal_back_downA }, // PLAYER_CSACTION_24 + { 2, &gPlayerAnim_link_normal_back_down_wake }, // PLAYER_CSACTION_25 + { -1, func_80851D2C }, // PLAYER_CSACTION_26 + { 2, &gPlayerAnim_link_normal_okarina_end }, // PLAYER_CSACTION_27 + { 3, &gPlayerAnim_link_demo_get_itemA }, // PLAYER_CSACTION_28 + { -1, func_808515A4 }, // PLAYER_CSACTION_29 + { 2, &gPlayerAnim_link_normal_normal2fighter_free }, // PLAYER_CSACTION_30 + { 0, NULL }, // PLAYER_CSACTION_31 + { 0, NULL }, // PLAYER_CSACTION_32 + { 5, &gPlayerAnim_clink_demo_atozusari }, // PLAYER_CSACTION_33 + { -1, func_80851368 }, // PLAYER_CSACTION_34 + { -1, func_80851E64 }, // PLAYER_CSACTION_35 + { 5, &gPlayerAnim_clink_demo_bashi }, // PLAYER_CSACTION_36 + { 16, &gPlayerAnim_link_normal_hang_up_down }, // PLAYER_CSACTION_37 + { -1, func_80851F84 }, // PLAYER_CSACTION_38 + { -1, func_80851E90 }, // PLAYER_CSACTION_39 + { 6, &gPlayerAnim_clink_op3_okiagari }, // PLAYER_CSACTION_40 + { 6, &gPlayerAnim_clink_op3_tatiagari }, // PLAYER_CSACTION_41 + { -1, func_80852080 }, // PLAYER_CSACTION_42 + { 5, &gPlayerAnim_clink_demo_miokuri }, // PLAYER_CSACTION_43 + { -1, func_808521F4 }, // PLAYER_CSACTION_44 + { -1, func_8085225C }, // PLAYER_CSACTION_45 + { -1, func_80852280 }, // PLAYER_CSACTION_46 + { 5, &gPlayerAnim_clink_demo_nozoki }, // PLAYER_CSACTION_47 + { 5, &gPlayerAnim_clink_demo_koutai }, // PLAYER_CSACTION_48 + { -1, func_808515A4 }, // PLAYER_CSACTION_49 + { 5, &gPlayerAnim_clink_demo_koutai_kennuki }, // PLAYER_CSACTION_50 + { 5, &gPlayerAnim_link_demo_kakeyori }, // PLAYER_CSACTION_51 + { 5, &gPlayerAnim_link_demo_kakeyori_mimawasi }, // PLAYER_CSACTION_52 + { 5, &gPlayerAnim_link_demo_kakeyori_miokuri }, // PLAYER_CSACTION_53 + { 3, &gPlayerAnim_link_demo_furimuki2 }, // PLAYER_CSACTION_54 + { 3, &gPlayerAnim_link_demo_kaoage }, // PLAYER_CSACTION_55 + { 4, &gPlayerAnim_link_demo_kaoage_wait }, // PLAYER_CSACTION_56 + { 3, &gPlayerAnim_clink_demo_mimawasi }, // PLAYER_CSACTION_57 + { 3, &gPlayerAnim_link_demo_nozokikomi }, // PLAYER_CSACTION_58 + { 6, &gPlayerAnim_kolink_odoroki_demo }, // PLAYER_CSACTION_59 + { 6, &gPlayerAnim_link_shagamu_demo }, // PLAYER_CSACTION_60 + { 14, &gPlayerAnim_link_okiru_demo }, // PLAYER_CSACTION_61 + { 3, &gPlayerAnim_link_okiru_demo }, // PLAYER_CSACTION_62 + { 5, &gPlayerAnim_link_fighter_power_kiru_start }, // PLAYER_CSACTION_63 + { 16, &gPlayerAnim_demo_link_nwait }, // PLAYER_CSACTION_64 + { 15, &gPlayerAnim_demo_link_tewatashi }, // PLAYER_CSACTION_65 + { 15, &gPlayerAnim_demo_link_orosuu }, // PLAYER_CSACTION_66 + { 3, &gPlayerAnim_d_link_orooro }, // PLAYER_CSACTION_67 + { 3, &gPlayerAnim_d_link_imanodare }, // PLAYER_CSACTION_68 + { 3, &gPlayerAnim_link_hatto_demo }, // PLAYER_CSACTION_69 + { 6, &gPlayerAnim_o_get_mae }, // PLAYER_CSACTION_70 + { 6, &gPlayerAnim_o_get_ato }, // PLAYER_CSACTION_71 + { 6, &gPlayerAnim_om_get_mae }, // PLAYER_CSACTION_72 + { 6, &gPlayerAnim_nw_modoru }, // PLAYER_CSACTION_73 + { 3, &gPlayerAnim_link_demo_gurad }, // PLAYER_CSACTION_74 + { 3, &gPlayerAnim_link_demo_look_hand }, // PLAYER_CSACTION_75 + { 4, &gPlayerAnim_link_demo_sita_wait }, // PLAYER_CSACTION_76 + { 3, &gPlayerAnim_link_demo_ue }, // PLAYER_CSACTION_77 + { 3, &gPlayerAnim_Link_muku }, // PLAYER_CSACTION_78 + { 3, &gPlayerAnim_Link_miageru }, // PLAYER_CSACTION_79 + { 6, &gPlayerAnim_Link_ha }, // PLAYER_CSACTION_80 + { 3, &gPlayerAnim_L_1kyoro }, // PLAYER_CSACTION_81 + { 3, &gPlayerAnim_L_2kyoro }, // PLAYER_CSACTION_82 + { 3, &gPlayerAnim_L_sagaru }, // PLAYER_CSACTION_83 + { 3, &gPlayerAnim_L_bouzen }, // PLAYER_CSACTION_84 + { 3, &gPlayerAnim_L_kamaeru }, // PLAYER_CSACTION_85 + { 3, &gPlayerAnim_L_hajikareru }, // PLAYER_CSACTION_86 + { 3, &gPlayerAnim_L_ken_miru }, // PLAYER_CSACTION_87 + { 3, &gPlayerAnim_L_mukinaoru }, // PLAYER_CSACTION_88 + { -1, func_808524B0 }, // PLAYER_CSACTION_89 + { 3, &gPlayerAnim_link_wait_itemD1_20f }, // PLAYER_CSACTION_90 + { -1, func_80852544 }, // PLAYER_CSACTION_91 + { -1, func_80852564 }, // PLAYER_CSACTION_92 + { 3, &gPlayerAnim_link_normal_wait_typeB_20f }, // PLAYER_CSACTION_93 + { -1, func_80852608 }, // PLAYER_CSACTION_94 + { 3, &gPlayerAnim_link_demo_kousan }, // PLAYER_CSACTION_95 + { 3, &gPlayerAnim_link_demo_return_to_past }, // PLAYER_CSACTION_96 + { 3, &gPlayerAnim_link_last_hit_motion1 }, // PLAYER_CSACTION_97 + { 3, &gPlayerAnim_link_last_hit_motion2 }, // PLAYER_CSACTION_98 + { 3, &gPlayerAnim_link_demo_zeldamiru }, // PLAYER_CSACTION_99 + { 3, &gPlayerAnim_link_demo_kenmiru1 }, // PLAYER_CSACTION_100 + { 3, &gPlayerAnim_link_demo_kenmiru2 }, // PLAYER_CSACTION_101 + { 3, &gPlayerAnim_link_demo_kenmiru2_modori }, // PLAYER_CSACTION_102 }; -static struct_80854B18 D_80854E50[PLAYER_CSMODE_MAX] = { - { 0, NULL }, // PLAYER_CSMODE_NONE - { -1, func_808514C0 }, // PLAYER_CSMODE_1 - { -1, func_8085157C }, // PLAYER_CSMODE_2 - { -1, func_80851998 }, // PLAYER_CSMODE_3 - { -1, func_808519C0 }, // PLAYER_CSMODE_4 - { 11, NULL }, // PLAYER_CSMODE_5 - { -1, func_80852C50 }, // PLAYER_CSMODE_6 - { -1, func_80852944 }, // PLAYER_CSMODE_7 - { -1, func_80851688 }, // PLAYER_CSMODE_8 - { -1, func_80851750 }, // PLAYER_CSMODE_9 - { -1, func_80851828 }, // PLAYER_CSMODE_10 - { -1, func_808521B8 }, // PLAYER_CSMODE_11 - { -1, func_8085190C }, // PLAYER_CSMODE_12 - { 11, NULL }, // PLAYER_CSMODE_13 - { 11, NULL }, // PLAYER_CSMODE_14 - { 11, NULL }, // PLAYER_CSMODE_15 - { 18, D_80854AF0 }, // PLAYER_CSMODE_16 - { 11, NULL }, // PLAYER_CSMODE_17 - { -1, func_80851A50 }, // PLAYER_CSMODE_18 - { 12, &gPlayerAnim_link_demo_baru_op2 }, // PLAYER_CSMODE_19 - { 11, NULL }, // PLAYER_CSMODE_20 - { 0, NULL }, // PLAYER_CSMODE_21 - { -1, func_80851BE8 }, // PLAYER_CSMODE_22 - { 11, NULL }, // PLAYER_CSMODE_23 - { -1, func_80851CA4 }, // PLAYER_CSMODE_24 - { 11, NULL }, // PLAYER_CSMODE_25 - { 17, &gPlayerAnim_link_normal_okarina_swing }, // PLAYER_CSMODE_26 - { 11, NULL }, // PLAYER_CSMODE_27 - { 11, NULL }, // PLAYER_CSMODE_28 - { 11, NULL }, // PLAYER_CSMODE_29 - { -1, func_80851D80 }, // PLAYER_CSMODE_30 - { -1, func_80851DEC }, // PLAYER_CSMODE_31 - { -1, func_80851E28 }, // PLAYER_CSMODE_32 - { 18, D_80854B00 }, // PLAYER_CSMODE_33 - { -1, func_808513BC }, // PLAYER_CSMODE_34 - { 11, NULL }, // PLAYER_CSMODE_35 - { 11, NULL }, // PLAYER_CSMODE_36 - { 11, NULL }, // PLAYER_CSMODE_37 - { 11, NULL }, // PLAYER_CSMODE_38 - { -1, func_80851ECC }, // PLAYER_CSMODE_39 - { -1, func_80851FB0 }, // PLAYER_CSMODE_40 - { -1, func_80852048 }, // PLAYER_CSMODE_41 - { -1, func_80852174 }, // PLAYER_CSMODE_42 - { 13, &gPlayerAnim_clink_demo_miokuri_wait }, // PLAYER_CSMODE_43 - { -1, func_80852234 }, // PLAYER_CSMODE_44 - { 0, NULL }, // PLAYER_CSMODE_45 - { 0, NULL }, // PLAYER_CSMODE_46 - { 11, NULL }, // PLAYER_CSMODE_47 - { -1, func_80852450 }, // PLAYER_CSMODE_48 - { -1, func_80851688 }, // PLAYER_CSMODE_49 - { -1, func_80852298 }, // PLAYER_CSMODE_50 - { 13, &gPlayerAnim_link_demo_kakeyori_wait }, // PLAYER_CSMODE_51 - { -1, func_80852480 }, // PLAYER_CSMODE_52 - { 13, &gPlayerAnim_link_demo_kakeyori_miokuri_wait }, // PLAYER_CSMODE_53 - { -1, func_80852328 }, // PLAYER_CSMODE_54 - { 11, NULL }, // PLAYER_CSMODE_55 - { 11, NULL }, // PLAYER_CSMODE_56 - { 12, &gPlayerAnim_clink_demo_mimawasi_wait }, // PLAYER_CSMODE_57 - { -1, func_80852358 }, // PLAYER_CSMODE_58 - { 11, NULL }, // PLAYER_CSMODE_59 - { 18, D_80854B14 }, // PLAYER_CSMODE_60 - { 11, NULL }, // PLAYER_CSMODE_61 - { 11, NULL }, // PLAYER_CSMODE_62 - { 11, NULL }, // PLAYER_CSMODE_63 - { 11, NULL }, // PLAYER_CSMODE_64 - { -1, func_80852388 }, // PLAYER_CSMODE_65 - { 17, &gPlayerAnim_demo_link_nwait }, // PLAYER_CSMODE_66 - { 12, &gPlayerAnim_d_link_orowait }, // PLAYER_CSMODE_67 - { 12, &gPlayerAnim_demo_link_nwait }, // PLAYER_CSMODE_68 - { 11, NULL }, // PLAYER_CSMODE_69 - { -1, func_808526EC }, // PLAYER_CSMODE_70 - { 17, &gPlayerAnim_sude_nwait }, // PLAYER_CSMODE_71 - { -1, func_808526EC }, // PLAYER_CSMODE_72 - { 17, &gPlayerAnim_sude_nwait }, // PLAYER_CSMODE_73 - { 12, &gPlayerAnim_link_demo_gurad_wait }, // PLAYER_CSMODE_74 - { 12, &gPlayerAnim_link_demo_look_hand_wait }, // PLAYER_CSMODE_75 - { 11, NULL }, // PLAYER_CSMODE_76 - { 12, &gPlayerAnim_link_demo_ue_wait }, // PLAYER_CSMODE_77 - { 12, &gPlayerAnim_Link_m_wait }, // PLAYER_CSMODE_78 - { 13, &gPlayerAnim_Link_ue_wait }, // PLAYER_CSMODE_79 - { 12, &gPlayerAnim_Link_otituku_w }, // PLAYER_CSMODE_80 - { 12, &gPlayerAnim_L_kw }, // PLAYER_CSMODE_81 - { 11, NULL }, // PLAYER_CSMODE_82 - { 11, NULL }, // PLAYER_CSMODE_83 - { 11, NULL }, // PLAYER_CSMODE_84 - { 11, NULL }, // PLAYER_CSMODE_85 - { -1, func_80852648 }, // PLAYER_CSMODE_86 - { 11, NULL }, // PLAYER_CSMODE_87 - { 12, &gPlayerAnim_L_kennasi_w }, // PLAYER_CSMODE_88 - { -1, func_808524D0 }, // PLAYER_CSMODE_89 - { -1, func_80852514 }, // PLAYER_CSMODE_90 - { -1, func_80852554 }, // PLAYER_CSMODE_91 - { -1, func_808525C0 }, // PLAYER_CSMODE_92 - { 11, NULL }, // PLAYER_CSMODE_93 - { 11, NULL }, // PLAYER_CSMODE_94 - { 11, NULL }, // PLAYER_CSMODE_95 - { -1, func_8085283C }, // PLAYER_CSMODE_96 - { -1, func_808528C8 }, // PLAYER_CSMODE_97 - { -1, func_808528C8 }, // PLAYER_CSMODE_98 - { 12, &gPlayerAnim_link_demo_zeldamiru_wait }, // PLAYER_CSMODE_99 - { 12, &gPlayerAnim_link_demo_kenmiru1_wait }, // PLAYER_CSMODE_100 - { 12, &gPlayerAnim_link_demo_kenmiru2_wait }, // PLAYER_CSMODE_101 - { 12, &gPlayerAnim_demo_link_nwait }, // PLAYER_CSMODE_102 +static struct_80854B18 D_80854E50[PLAYER_CSACTION_MAX] = { + { 0, NULL }, // PLAYER_CSACTION_NONE + { -1, func_808514C0 }, // PLAYER_CSACTION_1 + { -1, func_8085157C }, // PLAYER_CSACTION_2 + { -1, func_80851998 }, // PLAYER_CSACTION_3 + { -1, func_808519C0 }, // PLAYER_CSACTION_4 + { 11, NULL }, // PLAYER_CSACTION_5 + { -1, func_80852C50 }, // PLAYER_CSACTION_6 + { -1, func_80852944 }, // PLAYER_CSACTION_7 + { -1, func_80851688 }, // PLAYER_CSACTION_8 + { -1, func_80851750 }, // PLAYER_CSACTION_9 + { -1, func_80851828 }, // PLAYER_CSACTION_10 + { -1, func_808521B8 }, // PLAYER_CSACTION_11 + { -1, func_8085190C }, // PLAYER_CSACTION_12 + { 11, NULL }, // PLAYER_CSACTION_13 + { 11, NULL }, // PLAYER_CSACTION_14 + { 11, NULL }, // PLAYER_CSACTION_15 + { 18, D_80854AF0 }, // PLAYER_CSACTION_16 + { 11, NULL }, // PLAYER_CSACTION_17 + { -1, func_80851A50 }, // PLAYER_CSACTION_18 + { 12, &gPlayerAnim_link_demo_baru_op2 }, // PLAYER_CSACTION_19 + { 11, NULL }, // PLAYER_CSACTION_20 + { 0, NULL }, // PLAYER_CSACTION_21 + { -1, func_80851BE8 }, // PLAYER_CSACTION_22 + { 11, NULL }, // PLAYER_CSACTION_23 + { -1, func_80851CA4 }, // PLAYER_CSACTION_24 + { 11, NULL }, // PLAYER_CSACTION_25 + { 17, &gPlayerAnim_link_normal_okarina_swing }, // PLAYER_CSACTION_26 + { 11, NULL }, // PLAYER_CSACTION_27 + { 11, NULL }, // PLAYER_CSACTION_28 + { 11, NULL }, // PLAYER_CSACTION_29 + { -1, func_80851D80 }, // PLAYER_CSACTION_30 + { -1, func_80851DEC }, // PLAYER_CSACTION_31 + { -1, func_80851E28 }, // PLAYER_CSACTION_32 + { 18, D_80854B00 }, // PLAYER_CSACTION_33 + { -1, func_808513BC }, // PLAYER_CSACTION_34 + { 11, NULL }, // PLAYER_CSACTION_35 + { 11, NULL }, // PLAYER_CSACTION_36 + { 11, NULL }, // PLAYER_CSACTION_37 + { 11, NULL }, // PLAYER_CSACTION_38 + { -1, func_80851ECC }, // PLAYER_CSACTION_39 + { -1, func_80851FB0 }, // PLAYER_CSACTION_40 + { -1, func_80852048 }, // PLAYER_CSACTION_41 + { -1, func_80852174 }, // PLAYER_CSACTION_42 + { 13, &gPlayerAnim_clink_demo_miokuri_wait }, // PLAYER_CSACTION_43 + { -1, func_80852234 }, // PLAYER_CSACTION_44 + { 0, NULL }, // PLAYER_CSACTION_45 + { 0, NULL }, // PLAYER_CSACTION_46 + { 11, NULL }, // PLAYER_CSACTION_47 + { -1, func_80852450 }, // PLAYER_CSACTION_48 + { -1, func_80851688 }, // PLAYER_CSACTION_49 + { -1, func_80852298 }, // PLAYER_CSACTION_50 + { 13, &gPlayerAnim_link_demo_kakeyori_wait }, // PLAYER_CSACTION_51 + { -1, func_80852480 }, // PLAYER_CSACTION_52 + { 13, &gPlayerAnim_link_demo_kakeyori_miokuri_wait }, // PLAYER_CSACTION_53 + { -1, func_80852328 }, // PLAYER_CSACTION_54 + { 11, NULL }, // PLAYER_CSACTION_55 + { 11, NULL }, // PLAYER_CSACTION_56 + { 12, &gPlayerAnim_clink_demo_mimawasi_wait }, // PLAYER_CSACTION_57 + { -1, func_80852358 }, // PLAYER_CSACTION_58 + { 11, NULL }, // PLAYER_CSACTION_59 + { 18, D_80854B14 }, // PLAYER_CSACTION_60 + { 11, NULL }, // PLAYER_CSACTION_61 + { 11, NULL }, // PLAYER_CSACTION_62 + { 11, NULL }, // PLAYER_CSACTION_63 + { 11, NULL }, // PLAYER_CSACTION_64 + { -1, func_80852388 }, // PLAYER_CSACTION_65 + { 17, &gPlayerAnim_demo_link_nwait }, // PLAYER_CSACTION_66 + { 12, &gPlayerAnim_d_link_orowait }, // PLAYER_CSACTION_67 + { 12, &gPlayerAnim_demo_link_nwait }, // PLAYER_CSACTION_68 + { 11, NULL }, // PLAYER_CSACTION_69 + { -1, func_808526EC }, // PLAYER_CSACTION_70 + { 17, &gPlayerAnim_sude_nwait }, // PLAYER_CSACTION_71 + { -1, func_808526EC }, // PLAYER_CSACTION_72 + { 17, &gPlayerAnim_sude_nwait }, // PLAYER_CSACTION_73 + { 12, &gPlayerAnim_link_demo_gurad_wait }, // PLAYER_CSACTION_74 + { 12, &gPlayerAnim_link_demo_look_hand_wait }, // PLAYER_CSACTION_75 + { 11, NULL }, // PLAYER_CSACTION_76 + { 12, &gPlayerAnim_link_demo_ue_wait }, // PLAYER_CSACTION_77 + { 12, &gPlayerAnim_Link_m_wait }, // PLAYER_CSACTION_78 + { 13, &gPlayerAnim_Link_ue_wait }, // PLAYER_CSACTION_79 + { 12, &gPlayerAnim_Link_otituku_w }, // PLAYER_CSACTION_80 + { 12, &gPlayerAnim_L_kw }, // PLAYER_CSACTION_81 + { 11, NULL }, // PLAYER_CSACTION_82 + { 11, NULL }, // PLAYER_CSACTION_83 + { 11, NULL }, // PLAYER_CSACTION_84 + { 11, NULL }, // PLAYER_CSACTION_85 + { -1, func_80852648 }, // PLAYER_CSACTION_86 + { 11, NULL }, // PLAYER_CSACTION_87 + { 12, &gPlayerAnim_L_kennasi_w }, // PLAYER_CSACTION_88 + { -1, func_808524D0 }, // PLAYER_CSACTION_89 + { -1, func_80852514 }, // PLAYER_CSACTION_90 + { -1, func_80852554 }, // PLAYER_CSACTION_91 + { -1, func_808525C0 }, // PLAYER_CSACTION_92 + { 11, NULL }, // PLAYER_CSACTION_93 + { 11, NULL }, // PLAYER_CSACTION_94 + { 11, NULL }, // PLAYER_CSACTION_95 + { -1, func_8085283C }, // PLAYER_CSACTION_96 + { -1, func_808528C8 }, // PLAYER_CSACTION_97 + { -1, func_808528C8 }, // PLAYER_CSACTION_98 + { 12, &gPlayerAnim_link_demo_zeldamiru_wait }, // PLAYER_CSACTION_99 + { 12, &gPlayerAnim_link_demo_kenmiru1_wait }, // PLAYER_CSACTION_100 + { 12, &gPlayerAnim_link_demo_kenmiru2_wait }, // PLAYER_CSACTION_101 + { 12, &gPlayerAnim_demo_link_nwait }, // PLAYER_CSACTION_102 }; void Player_AnimChangeOnceMorphZeroRootYawSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim) { @@ -14307,8 +14310,8 @@ void func_808515A4(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80851688(PlayState* play, Player* this, CsCmdActorCue* cue) { if (func_8084B3CC(play, this) == 0) { - if ((this->csMode == PLAYER_CSMODE_49) && (play->csCtx.state == CS_STATE_IDLE)) { - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + if ((this->csAction == PLAYER_CSACTION_49) && (play->csCtx.state == CS_STATE_IDLE)) { + func_8002DF54(play, NULL, PLAYER_CSACTION_7); return; } @@ -14367,7 +14370,7 @@ void func_80851828(PlayState* play, Player* this, CsCmdActorCue* cue) { this->actionVar2++; if (this->actionVar2 > 20) { - this->csMode = PLAYER_CSMODE_11; + this->csAction = PLAYER_CSACTION_11; } } @@ -14837,7 +14840,7 @@ void func_80852944(PlayState* play, Player* this, CsCmdActorCue* cue) { } } - this->csMode = PLAYER_CSMODE_NONE; + this->csAction = PLAYER_CSACTION_NONE; this->unk_6AD = 0; } @@ -14881,9 +14884,9 @@ void func_80852B4C(PlayState* play, Player* this, CsCmdActorCue* cue, struct_808 } } -void func_80852C0C(PlayState* play, Player* this, s32 csMode) { - if ((csMode != PLAYER_CSMODE_1) && (csMode != PLAYER_CSMODE_8) && (csMode != PLAYER_CSMODE_49) && - (csMode != PLAYER_CSMODE_7)) { +void func_80852C0C(PlayState* play, Player* this, s32 csAction) { + if ((csAction != PLAYER_CSACTION_1) && (csAction != PLAYER_CSACTION_8) && (csAction != PLAYER_CSACTION_49) && + (csAction != PLAYER_CSACTION_7)) { Player_DetachHeldActor(play, this); } } @@ -14891,10 +14894,10 @@ void func_80852C0C(PlayState* play, Player* this, s32 csMode) { void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cueUnused) { CsCmdActorCue* cue = play->csCtx.playerCue; s32 pad; - s32 csMode; + s32 csAction; if (play->csCtx.state == CS_STATE_STOP) { - func_8002DF54(play, NULL, PLAYER_CSMODE_7); + func_8002DF54(play, NULL, PLAYER_CSACTION_7); this->cueId = 0; Player_ZeroSpeedXZ(this); return; @@ -14906,10 +14909,10 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cueUnused) { } if (this->cueId != cue->id) { - csMode = D_808547C4[cue->id]; + csAction = D_808547C4[cue->id]; - if (csMode >= PLAYER_CSMODE_NONE) { - if ((csMode == PLAYER_CSMODE_3) || (csMode == PLAYER_CSMODE_4)) { + if (csAction >= PLAYER_CSACTION_NONE) { + if ((csAction == PLAYER_CSACTION_3) || (csAction == PLAYER_CSACTION_4)) { func_80852A54(play, this, cue); } else { func_808529D0(play, this, cue); @@ -14919,31 +14922,31 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cueUnused) { D_80858AA0 = this->skelAnime.moveFlags; func_80832DBC(this); - osSyncPrintf("TOOL MODE=%d\n", csMode); - func_80852C0C(play, this, ABS(csMode)); - func_80852B4C(play, this, cue, &D_80854B18[ABS(csMode)]); + osSyncPrintf("TOOL MODE=%d\n", csAction); + func_80852C0C(play, this, ABS(csAction)); + func_80852B4C(play, this, cue, &D_80854B18[ABS(csAction)]); this->actionVar2 = 0; this->actionVar1 = 0; this->cueId = cue->id; } - csMode = D_808547C4[this->cueId]; - func_80852B4C(play, this, cue, &D_80854E50[ABS(csMode)]); + csAction = D_808547C4[this->cueId]; + func_80852B4C(play, this, cue, &D_80854E50[ABS(csAction)]); } void Player_Action_80852E14(Player* this, PlayState* play) { - if (this->csMode != this->prevCsMode) { + if (this->csAction != this->prevCsAction) { D_80858AA0 = this->skelAnime.moveFlags; func_80832DBC(this); - this->prevCsMode = this->csMode; - osSyncPrintf("DEMO MODE=%d\n", this->csMode); - func_80852C0C(play, this, this->csMode); - func_80852B4C(play, this, NULL, &D_80854B18[this->csMode]); + this->prevCsAction = this->csAction; + osSyncPrintf("DEMO MODE=%d\n", this->csAction); + func_80852C0C(play, this, this->csAction); + func_80852B4C(play, this, NULL, &D_80854B18[this->csAction]); } - func_80852B4C(play, this, NULL, &D_80854E50[this->csMode]); + func_80852B4C(play, this, NULL, &D_80854E50[this->csAction]); } s32 Player_IsDroppingFish(PlayState* play) { @@ -14976,13 +14979,13 @@ s32 func_80852F38(PlayState* play, Player* this) { } // Sets up player cutscene -s32 func_80852FFC(PlayState* play, Actor* actor, s32 csMode) { +s32 func_80852FFC(PlayState* play, Actor* actor, s32 csAction) { Player* this = GET_PLAYER(play); if (!Player_InBlockingCsMode(play, this)) { func_80832564(play, this); Player_SetupAction(play, this, Player_Action_80852E14, 0); - this->csMode = csMode; + this->csAction = csAction; this->unk_448 = actor; func_80832224(this); return 1; @@ -15022,7 +15025,7 @@ void func_80853148(PlayState* play, Actor* actor) { this->exchangeItemId = EXCH_ITEM_NONE; if (actor->textId == 0xFFFF) { - func_8002DF54(play, actor, PLAYER_CSMODE_1); + func_8002DF54(play, actor, PLAYER_CSACTION_1); actor->flags |= ACTOR_FLAG_8; func_80832528(play, this); } else { From c5e4357127fa9432213c1c758c020691e98a1171 Mon Sep 17 00:00:00 2001 From: fig02 Date: Wed, 27 Sep 2023 11:02:21 -0400 Subject: [PATCH 29/29] initial action-change-list docs (#1540) --- .../actors/ovl_player_actor/z_player.c | 288 ++++++++++++------ 1 file changed, 195 insertions(+), 93 deletions(-) diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index b224e07c6..a7d9c45e6 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -144,23 +144,10 @@ s32 func_80835B60(Player* this, PlayState* play); s32 func_80835C08(Player* this, PlayState* play); void Player_UseItem(PlayState* play, Player* this, s32 item); void func_80839F90(Player* this, PlayState* play); -s32 func_80838A14(Player* this, PlayState* play); -s32 func_80839800(Player* this, PlayState* play); -s32 func_8083B040(Player* this, PlayState* play); -s32 func_8083B998(Player* this, PlayState* play); -s32 func_8083B644(Player* this, PlayState* play); -s32 func_8083BDBC(Player* this, PlayState* play); -s32 func_8083C1DC(Player* this, PlayState* play); -s32 func_8083C2B0(Player* this, PlayState* play); -s32 func_8083C544(Player* this, PlayState* play); s32 func_8083C61C(PlayState* play, Player* this); void func_8083CA20(PlayState* play, Player* this); void func_8083CA54(PlayState* play, Player* this); void func_8083CA9C(PlayState* play, Player* this); -s32 func_8083E0FC(Player* this, PlayState* play); -s32 func_8083E5A8(Player* this, PlayState* play); -s32 func_8083EB44(Player* this, PlayState* play); -s32 func_8083F7BC(Player* this, PlayState* play); void func_80846648(PlayState* play, Player* this); void func_80846660(PlayState* play, Player* this); void func_808467D4(PlayState* play, Player* this); @@ -173,7 +160,6 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input); s32 func_8084FCAC(Player* this, PlayState* play); void func_8084FF7C(Player* this); void Player_UpdateBunnyEars(Player* this); -s32 func_80850224(Player* this, PlayState* play); void func_80851008(PlayState* play, Player* this, void* anim); void func_80851030(PlayState* play, Player* this, void* anim); void func_80851050(PlayState* play, Player* this, void* anim); @@ -3671,55 +3657,168 @@ s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYaw } } -static s8 D_808543E0[] = { 13, 2, 4, 9, 10, 11, 8, -7 }; -static s8 D_808543E8[] = { 13, 1, 2, 5, 3, 4, 9, 10, 11, 7, 8, -6 }; -static s8 D_808543F4[] = { 13, 1, 2, 3, 4, 9, 10, 11, 8, 7, -6 }; -static s8 D_80854400[] = { 13, 2, 4, 9, 10, 11, 8, -7 }; -static s8 D_80854408[] = { 13, 2, 4, 9, 10, 11, 12, 8, -7 }; -static s8 D_80854414[] = { -7 }; -static s8 D_80854418[] = { 0, 11, 1, 2, 3, 5, 4, 9, 8, 7, -6 }; -static s8 D_80854424[] = { 0, 11, 1, 2, 3, 12, 5, 4, 9, 8, 7, -6 }; -static s8 D_80854430[] = { 13, 1, 2, 3, 12, 5, 4, 9, 10, 11, 8, 7, -6 }; -static s8 D_80854440[] = { 10, 8, -7 }; -static s8 D_80854444[] = { 0, 12, 5, -4 }; +typedef enum { + /* 0 */ PLAYER_ACTION_CHG_0, + /* 1 */ PLAYER_ACTION_CHG_1, + /* 2 */ PLAYER_ACTION_CHG_2, + /* 3 */ PLAYER_ACTION_CHG_3, + /* 4 */ PLAYER_ACTION_CHG_4, + /* 5 */ PLAYER_ACTION_CHG_5, + /* 6 */ PLAYER_ACTION_CHG_6, + /* 7 */ PLAYER_ACTION_CHG_7, + /* 8 */ PLAYER_ACTION_CHG_8, + /* 9 */ PLAYER_ACTION_CHG_9, + /* 10 */ PLAYER_ACTION_CHG_10, + /* 11 */ PLAYER_ACTION_CHG_11, + /* 12 */ PLAYER_ACTION_CHG_12, + /* 13 */ PLAYER_ACTION_CHG_13 +} ActionChangeIndex; -static s32 (*D_80854448[])(Player* this, PlayState* play) = { - func_8083B998, func_80839800, func_8083E5A8, func_8083E0FC, func_8083B644, func_8083F7BC, func_8083C1DC, - func_80850224, func_8083C544, func_8083EB44, func_8083BDBC, func_8083C2B0, func_80838A14, func_8083B040, +static s8 sActionChangeList1[] = { + PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, + PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_7, }; -s32 func_80837348(PlayState* play, Player* this, s8* arg2, s32 arg3) { +static s8 sActionChangeList2[] = { + PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_5, + PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, + PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_7, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_6, +}; + +static s8 sActionChangeList3[] = { + PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_3, + PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, + PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +}; + +static s8 sActionChangeList4[] = { + PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, + PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_7, +}; + +static s8 sActionChangeList5[] = { + PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, + PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_12, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_7, +}; + +static s8 sActionChangeList6[] = { + -PLAYER_ACTION_CHG_7, +}; + +static s8 sActionChangeList7[] = { + PLAYER_ACTION_CHG_0, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, + PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_5, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, + PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +}; + +static s8 sActionChangeList8[] = { + PLAYER_ACTION_CHG_0, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, + PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_12, PLAYER_ACTION_CHG_5, PLAYER_ACTION_CHG_4, + PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +}; + +static s8 sActionChangeList9[] = { + PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_12, + PLAYER_ACTION_CHG_5, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, + PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +}; + +static s8 sActionChangeList10[] = { + PLAYER_ACTION_CHG_10, + PLAYER_ACTION_CHG_8, + -PLAYER_ACTION_CHG_7, +}; + +static s8 sActionChangeList11[] = { + PLAYER_ACTION_CHG_0, + PLAYER_ACTION_CHG_12, + PLAYER_ACTION_CHG_5, + -PLAYER_ACTION_CHG_4, +}; + +s32 Player_ActionChange_0(Player* this, PlayState* play); +s32 Player_ActionChange_1(Player* this, PlayState* play); +s32 Player_ActionChange_2(Player* this, PlayState* play); +s32 Player_ActionChange_3(Player* this, PlayState* play); +s32 Player_ActionChange_4(Player* this, PlayState* play); +s32 Player_ActionChange_5(Player* this, PlayState* play); +s32 Player_ActionChange_6(Player* this, PlayState* play); +s32 Player_ActionChange_7(Player* this, PlayState* play); +s32 Player_ActionChange_8(Player* this, PlayState* play); +s32 Player_ActionChange_9(Player* this, PlayState* play); +s32 Player_ActionChange_10(Player* this, PlayState* play); +s32 Player_ActionChange_11(Player* this, PlayState* play); +s32 Player_ActionChange_12(Player* this, PlayState* play); +s32 Player_ActionChange_13(Player* this, PlayState* play); + +static s32 (*sActionChangeFuncs[])(Player* this, PlayState* play) = { + /* PLAYER_ACTION_CHG_0 */ Player_ActionChange_0, + /* PLAYER_ACTION_CHG_1 */ Player_ActionChange_1, + /* PLAYER_ACTION_CHG_2 */ Player_ActionChange_2, + /* PLAYER_ACTION_CHG_3 */ Player_ActionChange_3, + /* PLAYER_ACTION_CHG_4 */ Player_ActionChange_4, + /* PLAYER_ACTION_CHG_5 */ Player_ActionChange_5, + /* PLAYER_ACTION_CHG_6 */ Player_ActionChange_6, + /* PLAYER_ACTION_CHG_7 */ Player_ActionChange_7, + /* PLAYER_ACTION_CHG_8 */ Player_ActionChange_8, + /* PLAYER_ACTION_CHG_9 */ Player_ActionChange_9, + /* PLAYER_ACTION_CHG_10 */ Player_ActionChange_10, + /* PLAYER_ACTION_CHG_11 */ Player_ActionChange_11, + /* PLAYER_ACTION_CHG_12 */ Player_ActionChange_12, + /* PLAYER_ACTION_CHG_13 */ Player_ActionChange_13, +}; + +/** + * This function processes "Action Change Lists", which run various functions that + * check if it is appropriate to change to a new action. + * + * Action Change Lists are a list of indices for the `sActionChangeFuncs` array. + * The functions are ran in order until one of them returns true, or the end of the list is reached. + * An Action Change index having a negative value indicates that it is the last member in the list. + * + * Because these lists are processed sequentially, the order of the indices in the list determines its priority. + * + * If the `updateUpperBody` argument is true, Player's upper body will update before the Action Change List + * is processed. This allows for Item Action functions to run. + * + * @return true if a new action has been chosen + * + */ +s32 Player_TryActionChangeList(PlayState* play, Player* this, s8* actionChangeList, s32 updateUpperBody) { s32 i; if (!(this->stateFlags1 & (PLAYER_STATE1_0 | PLAYER_STATE1_7 | PLAYER_STATE1_29))) { - if (arg3 != 0) { + if (updateUpperBody) { D_808535E0 = Player_UpdateUpperBody(this, play); + if (Player_Action_8084E604 == this->actionFunc) { - return 1; + return true; } } if (func_8008F128(this)) { this->unk_6AE |= 0x41; - return 1; + return true; } if (!(this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) && (Player_IA_ChangeHeldItem != this->itemActionFunc)) { - while (*arg2 >= 0) { - if (D_80854448[*arg2](this, play)) { - return 1; + // Process all entries in the Action Change List with a positive index + while (*actionChangeList >= 0) { + if (sActionChangeFuncs[*actionChangeList](this, play)) { + return true; } - arg2++; + actionChangeList++; } - if (D_80854448[-(*arg2)](this, play)) { - return 1; + // Try the last entry in the list. Negate the index to make it positive again. + if (sActionChangeFuncs[-(*actionChangeList)](this, play)) { + return true; } } } - return 0; + return false; } s32 func_808374A0(PlayState* play, Player* this, SkelAnime* skelAnime, f32 arg3) { @@ -3727,7 +3826,7 @@ s32 func_808374A0(PlayState* play, Player* this, SkelAnime* skelAnime, f32 arg3) s16 yawTarget; if ((skelAnime->endFrame - arg3) <= skelAnime->curFrame) { - if (func_80837348(play, this, D_80854418, 1)) { + if (Player_TryActionChangeList(play, this, sActionChangeList7, true)) { return 0; } @@ -4335,7 +4434,7 @@ void func_808389E8(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* func_80838940(this, anim, arg2, play, NA_SE_VO_LI_SWORD_N); } -s32 func_80838A14(Player* this, PlayState* play) { +s32 Player_ActionChange_12(Player* this, PlayState* play) { s32 sp3C; LinkAnimationHeader* anim; f32 sp34; @@ -4710,7 +4809,7 @@ s32 Player_PosVsWallLineTest(PlayState* play, Player* this, Vec3f* offset, Colli return BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, posResult, wallPoly, true, false, false, true, bgId); } -s32 func_80839800(Player* this, PlayState* play) { +s32 Player_ActionChange_1(Player* this, PlayState* play) { SlidingDoorActorBase* slidingDoor; DoorActorBase* door; s32 doorDirection; @@ -5353,7 +5452,7 @@ static LinkAnimationHeader* D_80854548[] = { &gPlayerAnim_link_normal_take_out, }; -s32 func_8083B040(Player* this, PlayState* play) { +s32 Player_ActionChange_13(Player* this, PlayState* play) { s32 sp2C; s32 sp28; GetItemEntry* giEntry; @@ -5499,7 +5598,7 @@ s32 func_8083B040(Player* this, PlayState* play) { return 0; } -s32 func_8083B644(Player* this, PlayState* play) { +s32 Player_ActionChange_4(Player* this, PlayState* play) { Actor* sp34 = this->targetActor; Actor* sp30 = this->unk_664; Actor* sp2C = NULL; @@ -5584,9 +5683,9 @@ s32 func_8083B8F4(Player* this, PlayState* play) { return 0; } -s32 func_8083B998(Player* this, PlayState* play) { +s32 Player_ActionChange_0(Player* this, PlayState* play) { if (this->unk_6AD != 0) { - func_8083B040(this, play); + Player_ActionChange_13(this, play); return 1; } @@ -5671,7 +5770,7 @@ void func_8083BCD0(Player* this, PlayState* play, s32 arg2) { Player_PlaySfx(this, ((arg2 << 0xE) == 0x8000) ? NA_SE_PL_ROLL : NA_SE_PL_SKIP); } -s32 func_8083BDBC(Player* this, PlayState* play) { +s32 Player_ActionChange_10(Player* this, PlayState* play) { s32 sp2C; if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && @@ -5762,7 +5861,7 @@ void func_8083C148(Player* this, PlayState* play) { this->stateFlags1 &= ~(PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_20); } -s32 func_8083C1DC(Player* this, PlayState* play) { +s32 Player_ActionChange_6(Player* this, PlayState* play) { if (!func_80833B54(this) && (D_808535E0 == 0) && !(this->stateFlags1 & PLAYER_STATE1_23) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { if (func_8083BC7C(this, play)) { @@ -5778,7 +5877,7 @@ s32 func_8083C1DC(Player* this, PlayState* play) { return 0; } -s32 func_8083C2B0(Player* this, PlayState* play) { +s32 Player_ActionChange_11(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 frame; @@ -5846,7 +5945,7 @@ void func_8083C50C(Player* this) { } } -s32 func_8083C544(Player* this, PlayState* play) { +s32 Player_ActionChange_8(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { if (!(this->stateFlags1 & PLAYER_STATE1_22) && (Player_GetMeleeWeaponHeld(this) != 0) && (this->unk_844 == 1) && (this->heldItemAction != PLAYER_IA_DEKU_STICK)) { @@ -6431,7 +6530,7 @@ static struct_80854578 D_80854578[] = { { &gPlayerAnim_link_uma_right_up, -34.16f, 7.91f }, }; -s32 func_8083E0FC(Player* this, PlayState* play) { +s32 Player_ActionChange_3(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; f32 unk_04; f32 unk_08; @@ -6558,7 +6657,7 @@ void func_8083E4C4(PlayState* play, Player* this, GetItemEntry* giEntry) { Sfx_PlaySfxCentered((this->getItemId < 0) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM); } -s32 func_8083E5A8(Player* this, PlayState* play) { +s32 Player_ActionChange_2(Player* this, PlayState* play) { Actor* interactedActor; if (iREG(67) || @@ -6687,7 +6786,7 @@ s32 func_8083EAF0(Player* this, Actor* actor) { return 1; } -s32 func_8083EB44(Player* this, PlayState* play) { +s32 Player_ActionChange_9(Player* this, PlayState* play) { if ((this->stateFlags1 & PLAYER_STATE1_11) && (this->heldActor != NULL) && CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)) { if (!func_80835644(play, this, this->heldActor)) { @@ -7010,7 +7109,7 @@ void func_8083F72C(Player* this, LinkAnimationHeader* anim, PlayState* play) { this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; } -s32 func_8083F7BC(Player* this, PlayState* play) { +s32 Player_ActionChange_5(Player* this, PlayState* play) { DynaPolyActor* wallPolyActor; if (!(this->stateFlags1 & PLAYER_STATE1_11) && (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && @@ -7302,7 +7401,7 @@ void Player_Action_80840450(Player* this, PlayState* play) { func_8083721C(this); - if (!func_80837348(play, this, D_808543E0, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList1, true)) { if (!func_80833B54(this) && (!func_80833B2C(this) || (func_80834B5C != this->itemActionFunc))) { func_8083CF10(this, play); return; @@ -7368,7 +7467,7 @@ void Player_Action_808407CC(Player* this, PlayState* play) { func_8083721C(this); - if (!func_80837348(play, this, D_808543E8, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList2, true)) { if (func_80833B54(this)) { func_8083CEAC(this, play); return; @@ -7496,7 +7595,7 @@ void Player_Action_80840BC8(Player* this, PlayState* play) { func_8083721C(this); if (this->actionVar2 == 0) { - if (!func_80837348(play, this, D_80854418, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList7, true)) { if (func_80833B54(this)) { func_8083CEAC(this, play); return; @@ -7569,7 +7668,7 @@ void Player_Action_80840DE4(Player* this, PlayState* play) { func_808327F8(this, this->speedXZ); } - if (!func_80837348(play, this, D_808543F4, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList3, true)) { if (func_80833B54(this)) { func_8083CEAC(this, play); return; @@ -7691,7 +7790,7 @@ void Player_Action_808414F8(Player* this, PlayState* play) { func_80841138(this, play); - if (!func_80837348(play, this, D_80854400, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList4, true)) { if (!func_80833C04(this)) { func_8083C8DC(this, play, this->yaw); return; @@ -7736,7 +7835,7 @@ void Player_Action_8084170C(Player* this, PlayState* play) { sp34 = LinkAnimation_Update(play, &this->skelAnime); func_8083721C(this); - if (!func_80837348(play, this, D_80854400, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList4, true)) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (this->speedXZ == 0.0f) { @@ -7756,7 +7855,7 @@ void Player_Action_808417FC(Player* this, PlayState* play) { sp1C = LinkAnimation_Update(play, &this->skelAnime); - if (!func_80837348(play, this, D_80854400, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList4, true)) { if (sp1C != 0) { func_80839F30(this, play); } @@ -7785,7 +7884,7 @@ void Player_Action_8084193C(Player* this, PlayState* play) { func_80841860(play, this); - if (!func_80837348(play, this, D_80854408, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList5, true)) { if (!func_80833C04(this)) { func_8083C858(this, play); return; @@ -7855,7 +7954,7 @@ void Player_Action_80841BA8(Player* this, PlayState* play) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); - if (!func_80837348(play, this, D_80854414, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList6, true)) { if (speedTarget != 0.0f) { this->actor.shape.rot.y = yawTarget; func_8083C858(this, play); @@ -7971,7 +8070,7 @@ void Player_Action_80842180(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; func_80841EE4(this, play); - if (!func_80837348(play, this, D_80854424, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList8, true)) { if (func_80833C04(this)) { func_8083C858(this, play); return; @@ -7997,7 +8096,7 @@ void Player_Action_8084227C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; func_80841EE4(this, play); - if (!func_80837348(play, this, D_80854430, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList9, true)) { if (!func_80833C04(this)) { func_8083C858(this, play); return; @@ -8030,7 +8129,7 @@ void Player_Action_808423EC(Player* this, PlayState* play) { sp34 = LinkAnimation_Update(play, &this->skelAnime); - if (!func_80837348(play, this, D_80854408, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList5, true)) { if (!func_80833C04(this)) { func_8083C858(this, play); return; @@ -8062,7 +8161,7 @@ void Player_Action_8084251C(Player* this, PlayState* play) { func_8083721C(this); - if (!func_80837348(play, this, D_80854440, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList10, true)) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (this->speedXZ == 0.0f) { @@ -8109,7 +8208,7 @@ void Player_Action_8084279C(Player* this, PlayState* play) { func_80832CB0(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check_wait, this->modelAnimType)); if (DECR(this->actionVar2) == 0) { - if (!func_8083B040(this, play)) { + if (!Player_ActionChange_13(this, play)) { func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check_end, this->modelAnimType), play); } @@ -8141,7 +8240,7 @@ s32 func_808428D8(Player* this, PlayState* play) { } s32 func_80842964(Player* this, PlayState* play) { - return func_8083B040(this, play) || func_8083B644(this, play) || func_8083E5A8(this, play); + return Player_ActionChange_13(this, play) || Player_ActionChange_4(this, play) || Player_ActionChange_2(this, play); } void Player_RequestQuake(PlayState* play, s32 speed, s32 y, s32 duration) { @@ -8386,7 +8485,7 @@ void Player_Action_80843188(Player* this, PlayState* play) { this->actionVar1 = 0; } } else if (!func_80842964(this, play)) { - if (func_8083C2B0(this, play)) { + if (Player_ActionChange_11(this, play)) { func_808428D8(this, play); } else { this->stateFlags1 &= ~PLAYER_STATE1_22; @@ -8879,7 +8978,7 @@ void Player_Action_80844708(Player* this, PlayState* play) { } } - if ((this->skelAnime.curFrame < 15.0f) || !func_80850224(this, play)) { + if ((this->skelAnime.curFrame < 15.0f) || !Player_ActionChange_7(this, play)) { if (this->skelAnime.curFrame >= 20.0f) { func_8083A060(this, play); return; @@ -9335,7 +9434,7 @@ void Player_Action_80845CA4(Player* this, PlayState* play) { s32 sp30; s32 pad; - if (!func_8083B040(this, play)) { + if (!Player_ActionChange_13(this, play)) { if (this->actionVar2 == 0) { LinkAnimation_Update(play, &this->skelAnime); @@ -9379,7 +9478,7 @@ void Player_Action_80845CA4(Player* this, PlayState* play) { func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); func_80845C68(play, gSaveContext.respawn[RESPAWN_MODE_DOWN].data); - if (!func_8083B644(this, play)) { + if (!Player_ActionChange_4(this, play)) { func_8083CF5C(this, play); } } @@ -9455,7 +9554,7 @@ static struct_80832924 D_8085461C[] = { void Player_Action_80846120(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime) && (this->actionVar2++ > 20)) { - if (!func_8083B040(this, play)) { + if (!Player_ActionChange_13(this, play)) { func_8083A098(this, &gPlayerAnim_link_normal_heavy_carry_end, play); } return; @@ -11545,7 +11644,7 @@ s32 func_8084B4D4(PlayState* play, Player* this) { this->stateFlags3 &= ~PLAYER_STATE3_5; func_8084B498(this); this->unk_6AD = 4; - func_8083B040(this, play); + Player_ActionChange_13(this, play); return 1; } @@ -11566,7 +11665,7 @@ void Player_Action_8084B530(Player* this, PlayState* play) { func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); if (!func_8084B4D4(play, this) && !func_8084B3CC(play, this) && !func_8083ADD4(play, this)) { - if ((this->targetActor != this->interactRangeActor) || !func_8083E5A8(this, play)) { + if ((this->targetActor != this->interactRangeActor) || !Player_ActionChange_2(this, play)) { if (this->stateFlags1 & PLAYER_STATE1_23) { s32 sp24 = this->actionVar2; func_8083A360(play, this); @@ -12296,8 +12395,8 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { this->yaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; if ((this->csAction != PLAYER_CSACTION_NONE) || - (!func_8083224C(play) && ((rideActor->actor.speed != 0.0f) || !func_8083B644(this, play)) && - !func_8083C1DC(this, play))) { + (!func_8083224C(play) && ((rideActor->actor.speed != 0.0f) || !Player_ActionChange_4(this, play)) && + !Player_ActionChange_6(this, play))) { if (D_808535E0 == 0) { if (this->actionVar1 != 0) { if (LinkAnimation_Update(play, &this->skelAnimeUpper)) { @@ -12353,7 +12452,8 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { return; } - if ((this->csAction != PLAYER_CSACTION_NONE) || (!func_8084C9BC(this, play) && !func_8083B040(this, play))) { + if ((this->csAction != PLAYER_CSACTION_NONE) || + (!func_8084C9BC(this, play) && !Player_ActionChange_13(this, play))) { if (this->unk_664 != NULL) { if (func_8002DD78(this) != 0) { this->unk_6BE = func_8083DB98(this, 1) - this->actor.shape.rot.y; @@ -12438,7 +12538,7 @@ void Player_Action_8084D610(Player* this, PlayState* play) { func_80832CB0(play, this, &gPlayerAnim_link_swimer_swim_wait); func_8084B000(this); - if (!func_8083224C(play) && !func_80837348(play, this, D_80854444, 1) && + if (!func_8083224C(play) && !Player_TryActionChangeList(play, this, sActionChangeList11, true) && !func_8083D12C(play, this, sControlInput)) { if (this->unk_6AD != 1) { this->unk_6AD = 0; @@ -12475,7 +12575,7 @@ void Player_Action_8084D610(Player* this, PlayState* play) { } void Player_Action_8084D7C4(Player* this, PlayState* play) { - if (!func_8083B040(this, play)) { + if (!Player_ActionChange_13(this, play)) { this->stateFlags2 |= PLAYER_STATE2_5; func_8084B158(play, this, NULL, this->speedXZ); @@ -12497,7 +12597,8 @@ void Player_Action_8084D84C(Player* this, PlayState* play) { func_8084B158(play, this, sControlInput, this->speedXZ); func_8084B000(this); - if (!func_80837348(play, this, D_80854444, 1) && !func_8083D12C(play, this, sControlInput)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList11, true) && + !func_8083D12C(play, this, sControlInput)) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); temp = this->actor.shape.rot.y - yawTarget; @@ -12556,7 +12657,8 @@ void Player_Action_8084DAB4(Player* this, PlayState* play) { func_8084B158(play, this, sControlInput, this->speedXZ); func_8084B000(this); - if (!func_80837348(play, this, D_80854444, 1) && !func_8083D12C(play, this, sControlInput)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList11, true) && + !func_8083D12C(play, this, sControlInput)) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (speedTarget == 0.0f) { @@ -12587,7 +12689,7 @@ void Player_Action_8084DC48(Player* this, PlayState* play) { this->actor.gravity = 0.0f; Player_UpdateUpperBody(this, play); - if (!func_8083B040(this, play)) { + if (!Player_ActionChange_13(this, play)) { if (this->currentBoots == PLAYER_BOOTS_IRON) { func_80838F18(play, this); return; @@ -12609,7 +12711,7 @@ void Player_Action_8084DC48(Player* this, PlayState* play) { func_8084B158(play, this, sControlInput, this->actor.velocity.y); this->unk_6C2 = 16000; - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) && !func_8083E5A8(this, play) && + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) && !Player_ActionChange_2(this, play) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.yDistToWater < D_80854784[CUR_UPG_VALUE(UPG_SCALE)])) { func_8084DBC4(play, this, -2.0f); @@ -12785,7 +12887,7 @@ void Player_Action_8084E3C4(Player* this, PlayState* play) { this->targetActor = this->naviActor; this->naviActor->textId = -this->naviTextId; func_80853148(play, this->targetActor); - } else if (!func_8083B040(this, play)) { + } else if (!Player_ActionChange_13(this, play)) { func_8083A098(this, &gPlayerAnim_link_normal_okarina_end, play); } @@ -13211,7 +13313,7 @@ void Player_Action_8084F390(Player* this, PlayState* play) { func_8084269C(play, this); func_800F4138(&this->actor.projectedPos, NA_SE_PL_SLIP_LEVEL - SFX_FLAG, this->actor.speed); - if (func_8083B040(this, play) == 0) { + if (Player_ActionChange_13(this, play) == 0) { floorPoly = this->actor.floorPoly; if (floorPoly == NULL) { @@ -13338,7 +13440,7 @@ void Player_Action_8084F88C(Player* this, PlayState* play) { } void Player_Action_8084F9A0(Player* this, PlayState* play) { - func_80839800(this, play); + Player_ActionChange_1(this, play); } void Player_Action_8084F9C0(Player* this, PlayState* play) { @@ -13540,7 +13642,7 @@ void Player_UpdateBunnyEars(Player* this) { } } -s32 func_80850224(Player* this, PlayState* play) { +s32 Player_ActionChange_7(Player* this, PlayState* play) { if (func_8083C6B8(play, this) == 0) { if (func_8083BB20(this) != 0) { s32 sp24 = func_80837818(this); @@ -13584,7 +13686,7 @@ void Player_Action_808502D0(Player* this, PlayState* play) { func_8083C50C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { - if (!func_80850224(this, play)) { + if (!Player_ActionChange_7(this, play)) { u8 sp43 = this->skelAnime.moveFlags; LinkAnimationHeader* sp3C; @@ -14279,7 +14381,7 @@ void func_808514C0(PlayState* play, Player* this, CsCmdActorCue* cue) { } if ((this->interactRangeActor != NULL) && (this->interactRangeActor->textId == 0xFFFF)) { - func_8083E5A8(this, play); + Player_ActionChange_2(this, play); } } @@ -14835,8 +14937,8 @@ void func_80852944(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80832340(play, this); } else { func_8083C148(this, play); - if (!func_8083B644(this, play)) { - func_8083E5A8(this, play); + if (!Player_ActionChange_4(this, play)) { + Player_ActionChange_2(this, play); } }