1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-10 11:03:46 +00:00

apply review suggestions

This commit is contained in:
feacur 2025-01-14 13:34:28 +01:00
parent 3504b7db05
commit dee9afcb07
3 changed files with 88 additions and 89 deletions

View file

@ -10,7 +10,7 @@
<Animation Name="gGoronWalkingAnim" Offset="0x29A8"/> <Animation Name="gGoronWalkingAnim" Offset="0x29A8"/>
<Animation Name="gGoronEyedropsTakenAnim" Offset="0x2D80"/> <Animation Name="gGoronEyedropsTakenAnim" Offset="0x2D80"/>
<Animation Name="gGoronCryingAnim" Offset="0x3768"/> <Animation Name="gGoronCryingAnim" Offset="0x3768"/>
<Animation Name="gGoronEyeropsAnim" Offset="0x38E4"/> <Animation Name="gGoronEyedropsAnim" Offset="0x38E4"/>
<Animation Name="gGoronUncurlSitStandAnim" Offset="0x4930"/> <Animation Name="gGoronUncurlSitStandAnim" Offset="0x4930"/>
<Animation Name="gGoronSidestepAnim" Offset="0x10590"/> <Animation Name="gGoronSidestepAnim" Offset="0x10590"/>

View file

@ -142,7 +142,7 @@ static AnimationInfo sAnimationInfo[] = {
{ &gGoronWalkingAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronWalkingAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f },
{ &gGoronSidestepAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronSidestepAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f },
{ &gGoronCryingAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronCryingAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f },
{ &gGoronEyeropsAnim, 1.0f, 0.0f, -1.0f, 0x02, -8.0f }, { &gGoronEyedropsAnim, 1.0f, 0.0f, -1.0f, 0x02, -8.0f },
{ &gGoronEyedropsTakenAnim, 1.0f, 0.0f, -1.0f, 0x02, -8.0f }, { &gGoronEyedropsTakenAnim, 1.0f, 0.0f, -1.0f, 0x02, -8.0f },
{ &gGoronUncurlToProneAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronUncurlToProneAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f },
{ &gGoronProneAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronProneAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f },
@ -254,7 +254,7 @@ void EnGo2_DrawEffects(EnGo2* this, PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2_eff.c", 151); CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2_eff.c", 151);
} }
s32 EnGo2_SpawnDustExplicitly(EnGo2* this, u8 initialTimer, f32 scale, f32 scaleStep, s32 numDustEffects, f32 radius, s32 EnGo2_SpawnDustImpl(EnGo2* this, u8 initialTimer, f32 scale, f32 scaleStep, s32 numDustEffects, f32 radius,
f32 yAccel) { f32 yAccel) {
Vec3f pos = sPos; Vec3f pos = sPos;
Vec3f velocity = sVelocity; Vec3f velocity = sVelocity;
@ -828,7 +828,7 @@ s32 EnGo2_UpdateTalking(EnGo2* this, PlayState* play) {
EnGo2_GetTextId, EnGo2_UpdateTalkState); EnGo2_GetTextId, EnGo2_UpdateTalkState);
} }
// Biggoron is close enough; see `EnGo2_IsWithinInteactionRange` // Biggoron is close enough; see `EnGo2_IsWithinInteractionRange`
if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON && !(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON && !(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) {
return false; return false;
} }
@ -974,7 +974,7 @@ s32 EnGo2_OrientInstant(EnGo2* this) {
return 1; return 1;
} }
s32 EnGo2_IsWithinInteactionRange(EnGo2* this) { s32 EnGo2_IsWithinInteractionRange(EnGo2* this) {
s16 yawDiff; s16 yawDiff;
f32 xyzDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 800.0f : 200.0f; f32 xyzDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 800.0f : 200.0f;
f32 yDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 400.0f : 60.0f; f32 yDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 400.0f : 60.0f;
@ -1001,12 +1001,12 @@ s32 EnGo2_IsWithinInteactionRange(EnGo2* this) {
} }
} }
s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 bounceCount, f32 boundSpeed, s16 rumble) { s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 bounceCount, f32 bounceSpeed, s16 rumble) {
if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || this->actor.velocity.y > 0.0f) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || this->actor.velocity.y > 0.0f) {
return false; return false;
} }
// rumble on odds and evens // animate grounded shaking
if (DECR(this->bounceTimer)) { if (DECR(this->bounceTimer)) {
if (!rumble) { if (!rumble) {
return true; return true;
@ -1019,10 +1019,9 @@ s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 bounceCount, f32 boundSpeed, s16 ru
} }
// bounce! // bounce!
{
if (this->bounceCounter >= 2) { if (this->bounceCounter >= 2) {
Actor_PlaySfx(&this->actor, (ENGO2_GET_TYPE(this) == GORON_CITY_HOT_RODDER) ? NA_SE_EN_GOLON_LAND_BIG Actor_PlaySfx(&this->actor,
: NA_SE_EN_DODO_M_GND); (ENGO2_GET_TYPE(this) == GORON_CITY_HOT_RODDER) ? NA_SE_EN_GOLON_LAND_BIG : NA_SE_EN_DODO_M_GND);
} }
this->bounceCounter--; this->bounceCounter--;
@ -1037,10 +1036,9 @@ s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 bounceCount, f32 boundSpeed, s16 ru
} }
} }
this->actor.velocity.y = ((f32)this->bounceCounter / (f32)bounceCount) * boundSpeed; this->actor.velocity.y = ((f32)this->bounceCounter / (f32)bounceCount) * bounceSpeed;
return true; return true;
} }
}
void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) {
u16 textId; u16 textId;
@ -1179,10 +1177,10 @@ s32 EnGo2_ShouldStay(EnGo2* this, PlayState* play) {
Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN]; Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN];
if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) {
if (EnGo2_IsWithinInteactionRange(this)) { if (EnGo2_IsWithinInteractionRange(this)) {
Camera_RequestSetting(mainCam, CAM_SET_DIRECTED_YAW); Camera_RequestSetting(mainCam, CAM_SET_DIRECTED_YAW);
Camera_UnsetStateFlag(mainCam, CAM_STATE_CHECK_BG); Camera_UnsetStateFlag(mainCam, CAM_STATE_CHECK_BG);
} else if (!EnGo2_IsWithinInteactionRange(this) && (mainCam->setting == CAM_SET_DIRECTED_YAW)) { } else if (!EnGo2_IsWithinInteractionRange(this) && (mainCam->setting == CAM_SET_DIRECTED_YAW)) {
Camera_RequestSetting(mainCam, CAM_SET_DUNGEON1); Camera_RequestSetting(mainCam, CAM_SET_DUNGEON1);
Camera_SetStateFlag(mainCam, CAM_STATE_CHECK_BG); Camera_SetStateFlag(mainCam, CAM_STATE_CHECK_BG);
} }
@ -1202,7 +1200,7 @@ s32 EnGo2_ShouldStay(EnGo2* this, PlayState* play) {
} }
void EnGo2_SetupUncurledFlags_Default(EnGo2* this) { void EnGo2_SetupUncurledFlags_Default(EnGo2* this) {
this->trackingMode = EnGo2_IsWithinInteactionRange(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; this->trackingMode = EnGo2_IsWithinInteractionRange(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE;
if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
this->trackingMode = NPC_TRACKING_FULL_BODY; this->trackingMode = NPC_TRACKING_FULL_BODY;
@ -1212,7 +1210,8 @@ void EnGo2_SetupUncurledFlags_Default(EnGo2* this) {
} }
void EnGo2_SetupUncurledFlags_NearTracking(EnGo2* this) { void EnGo2_SetupUncurledFlags_NearTracking(EnGo2* this) {
// always false, he wakes up with `EnGo2_SetupUncurledFlags_Biggoron` // always false: this functions if for `GORON_FIRE_GENERIC` and `GORON_CITY_LINK`
// see `EnGo2_SetupUncurledFlags_Biggoron` for `GORON_DMT_BIGGORON`'s variant
f32 xyzDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 800.0f : 200.0f; f32 xyzDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 800.0f : 200.0f;
s32 isTrue = true; s32 isTrue = true;
@ -1226,7 +1225,7 @@ void EnGo2_SetupUncurledFlags_NearTracking(EnGo2* this) {
} }
void EnGo2_SetupUncurledFlags_Biggoron(EnGo2* this) { void EnGo2_SetupUncurledFlags_Biggoron(EnGo2* this) {
if (EnGo2_IsWithinInteactionRange(this) || this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { if (EnGo2_IsWithinInteractionRange(this) || this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO; this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO;
this->isTalkative = true; this->isTalkative = true;
} else { } else {
@ -1239,7 +1238,7 @@ void EnGo2_SetupUncurledFlags(EnGo2* this) {
switch (ENGO2_GET_TYPE(this)) { switch (ENGO2_GET_TYPE(this)) {
case GORON_DMT_BOMB_FLOWER: case GORON_DMT_BOMB_FLOWER:
this->isTalkative = true; this->isTalkative = true;
this->trackingMode = EnGo2_IsWithinInteactionRange(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; this->trackingMode = EnGo2_IsWithinInteractionRange(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE;
break; break;
case GORON_FIRE_GENERIC: case GORON_FIRE_GENERIC:
EnGo2_SetupUncurledFlags_NearTracking(this); EnGo2_SetupUncurledFlags_NearTracking(this);
@ -1312,7 +1311,7 @@ void EnGo2_SpawnDust(EnGo2* this, s32 index2) {
s32 index1 = ENGO2_GET_TYPE(this) == GORON_CITY_HOT_RODDER ? 1 : 0; s32 index1 = ENGO2_GET_TYPE(this) == GORON_CITY_HOT_RODDER ? 1 : 0;
EnGo2DustEffectData* dustEffectData = &sDustEffectData[index1][index2]; EnGo2DustEffectData* dustEffectData = &sDustEffectData[index1][index2];
EnGo2_SpawnDustExplicitly(this, dustEffectData->initialTimer, dustEffectData->scale, dustEffectData->scaleStep, EnGo2_SpawnDustImpl(this, dustEffectData->initialTimer, dustEffectData->scale, dustEffectData->scaleStep,
dustEffectData->numDustEffects, dustEffectData->radius, dustEffectData->yAccel); dustEffectData->numDustEffects, dustEffectData->radius, dustEffectData->yAccel);
} }
@ -1446,7 +1445,7 @@ s32 EnGo2_IsGoronFireGeneric(EnGo2* this) {
s32 EnGo2_IsGoronLinkReversing(EnGo2* this) { s32 EnGo2_IsGoronLinkReversing(EnGo2* this) {
if (ENGO2_GET_TYPE(this) != GORON_CITY_LINK || (this->waypoint >= this->reverseWaypoint) || if (ENGO2_GET_TYPE(this) != GORON_CITY_LINK || (this->waypoint >= this->reverseWaypoint) ||
!EnGo2_IsWithinInteactionRange(this)) { !EnGo2_IsWithinInteractionRange(this)) {
return false; return false;
} }
return true; return true;
@ -1560,7 +1559,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) {
EnGo2_SetShape(this); EnGo2_SetShape(this);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_DEFAULT); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_DEFAULT);
this->actor.gravity = -1.0f; this->actor.gravity = -1.0f;
this->shadownAlpha = this->actor.shape.shadowAlpha = 0; this->shadowAlpha = this->actor.shape.shadowAlpha = 0;
this->reverse = 0; this->reverse = 0;
this->isTalkative = false; this->isTalkative = false;
this->isUncurled = false; this->isUncurled = false;
@ -1675,7 +1674,7 @@ void EnGo2_CurledUp(EnGo2* this, PlayState* play) {
this->isTalkative = false; this->isTalkative = false;
EnGo2_WakeUpAnimated(this, play); EnGo2_WakeUpAnimated(this, play);
} }
if ((ENGO2_GET_TYPE(this) != GORON_FIRE_GENERIC) && EnGo2_IsWithinInteactionRange(this)) { if ((ENGO2_GET_TYPE(this) != GORON_FIRE_GENERIC) && EnGo2_IsWithinInteractionRange(this)) {
EnGo2_WakeUpAnimated(this, play); EnGo2_WakeUpAnimated(this, play);
} }
} }
@ -1710,7 +1709,7 @@ void EnGo2_Standing(EnGo2* this, PlayState* play) {
(s16)((height * 0.4f * (this->skelAnime.curFrame / this->skelAnime.endFrame)) + (height * 0.6f)); (s16)((height * 0.4f * (this->skelAnime.curFrame / this->skelAnime.endFrame)) + (height * 0.6f));
} }
} }
if ((!EnGo2_ShouldStay(this, play)) && (!EnGo2_IsWithinInteactionRange(this))) { if ((!EnGo2_ShouldStay(this, play)) && (!EnGo2_IsWithinInteractionRange(this))) {
EnGo2_SetupCurledUp(this, play); EnGo2_SetupCurledUp(this, play);
} }
} }
@ -1765,7 +1764,7 @@ void EnGo2_RollingSlow(EnGo2* this, PlayState* play) {
break; break;
case GORON_CITY_LINK: case GORON_CITY_LINK:
if ((updatedWaypoint == 2) && (this->waypoint == 1)) { if ((updatedWaypoint == 2) && (this->waypoint == 1)) {
// @unreachable: `EnGo2_FollowPath` returns `0` or `1` // Unreachable: `EnGo2_FollowPath` returns `0` or `1`
EnGo2_StopRolling(this, play); EnGo2_StopRolling(this, play);
return; return;
} }
@ -2000,7 +1999,7 @@ void EnGo2_GoronFireGeneric(EnGo2* this, PlayState* play) {
void EnGo2_Update(Actor* thisx, PlayState* play) { void EnGo2_Update(Actor* thisx, PlayState* play) {
EnGo2* this = (EnGo2*)thisx; EnGo2* this = (EnGo2*)thisx;
EnGo2_UpdateShadowAlpha(this, &this->shadownAlpha); EnGo2_UpdateShadowAlpha(this, &this->shadowAlpha);
EnGo2_PlayStandingChangeSfx(this); EnGo2_PlayStandingChangeSfx(this);
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
EnGo2_RollForward(this); EnGo2_RollForward(this);

View file

@ -93,7 +93,7 @@ typedef struct EnGo2 {
/* 0x0216 */ u8 reverseWaypoint; // Set to z rotation, checked by waypoint /* 0x0216 */ u8 reverseWaypoint; // Set to z rotation, checked by waypoint
/* 0x0218 */ f32 interactRange; /* 0x0218 */ f32 interactRange;
/* 0x021C */ char unk_21C[0x04]; /* 0x021C */ char unk_21C[0x04];
/* 0x0220 */ f32 shadownAlpha; /* 0x0220 */ f32 shadowAlpha;
/* 0x0224 */ s16 blinkTimer; /* 0x0224 */ s16 blinkTimer;
/* 0x0226 */ s16 fidgetTableY[GORON_LIMB_MAX]; /* 0x0226 */ s16 fidgetTableY[GORON_LIMB_MAX];
/* 0x024A */ s16 fidgetTableZ[GORON_LIMB_MAX]; /* 0x024A */ s16 fidgetTableZ[GORON_LIMB_MAX];