1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-23 15:55:47 +00:00

give better names to the attention switching funcs

This commit is contained in:
feacur 2024-11-13 12:59:42 +01:00
parent 7c1d6f54df
commit 17d5b2aaa3
2 changed files with 15 additions and 15 deletions

View file

@ -443,7 +443,7 @@ void EnGo_UpdateBlinking(EnGo* this) {
} }
} }
s32 EnGo_IsAttentionDrawn(EnGo* this, PlayState* play) { s32 EnGo_IsInRange(EnGo* this, PlayState* play) {
f32 xyzDistSq; f32 xyzDistSq;
s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN]; Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN];
@ -798,7 +798,7 @@ void EnGo_GoronFireGeneric(EnGo* this, PlayState* play) {
} }
void EnGo_CurledUp(EnGo* this, PlayState* play) { void EnGo_CurledUp(EnGo* this, PlayState* play) {
if ((DECR(this->curledTimer) == 0) && EnGo_IsAttentionDrawn(this, play)) { if ((DECR(this->curledTimer) == 0) && EnGo_IsInRange(this, play)) {
Audio_PlaySfxGeneral(NA_SE_EN_GOLON_WAKE_UP, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, Audio_PlaySfxGeneral(NA_SE_EN_GOLON_WAKE_UP, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@ -836,7 +836,7 @@ void EnGo_AttentionDrawn(EnGo* this, PlayState* play) {
Audio_PlaySfxGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, Audio_PlaySfxGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
EnGo_SetupAction(this, EnGo_Sitting); EnGo_SetupAction(this, EnGo_Sitting);
} else if (!EnGo_IsAttentionDrawn(this, play)) { } else if (!EnGo_IsInRange(this, play)) {
EnGo_ReverseAnimation(this); EnGo_ReverseAnimation(this);
this->skelAnime.playSpeed = 0.0f; this->skelAnime.playSpeed = 0.0f;
EnGo_SetupAction(this, EnGo_CurlUp); EnGo_SetupAction(this, EnGo_CurlUp);
@ -911,7 +911,7 @@ void EnGo_Standing(EnGo* this, PlayState* play) {
play->msgCtx.stateTimer = 4; play->msgCtx.stateTimer = 4;
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
} else { } else {
if ((DECR(this->attentionCooldown) == 0) && !EnGo_IsAttentionDrawn(this, play)) { if ((DECR(this->attentionCooldown) == 0) && !EnGo_IsInRange(this, play)) {
EnGo_ReverseAnimation(this); EnGo_ReverseAnimation(this);
this->skelAnime.playSpeed = -0.1f; this->skelAnime.playSpeed = -0.1f;
this->skelAnime.playSpeed *= ENGO_GET_SPEED_SCALE(this); this->skelAnime.playSpeed *= ENGO_GET_SPEED_SCALE(this);
@ -941,7 +941,7 @@ void EnGo_AttentionLost(EnGo* this, PlayState* play) {
if (DECR(this->attentionCooldown) == 0) { if (DECR(this->attentionCooldown) == 0) {
EnGo_SetupAction(this, EnGo_CurlUp); EnGo_SetupAction(this, EnGo_CurlUp);
} else if (EnGo_IsAttentionDrawn(this, play)) { } else if (EnGo_IsInRange(this, play)) {
EnGo_ReverseAnimation(this); EnGo_ReverseAnimation(this);
Audio_PlaySfxGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, Audio_PlaySfxGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);

View file

@ -851,7 +851,7 @@ s32 EnGo2_UpdateTalking(EnGo2* this, PlayState* play) {
} }
} }
// `GORON_DMT_BIGGORON`, attention wasn't drawn; see `EnGo2_IsAttentionDrawn` // `GORON_DMT_BIGGORON`, close enough; see `EnGo2_IsInRange`
if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) {
if (!(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { if (!(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) {
return false; return false;
@ -999,7 +999,7 @@ s32 EnGo2_OrientInstant(EnGo2* this) {
return 1; return 1;
} }
s32 EnGo2_IsAttentionDrawn(EnGo2* this) { s32 EnGo2_IsInRange(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;
@ -1205,10 +1205,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_IsAttentionDrawn(this)) { if (EnGo2_IsInRange(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_IsAttentionDrawn(this) && (mainCam->setting == CAM_SET_DIRECTED_YAW)) { } else if (!EnGo2_IsInRange(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);
} }
@ -1228,7 +1228,7 @@ s32 EnGo2_ShouldStay(EnGo2* this, PlayState* play) {
} }
void EnGo2_SetupUncurledFlags_Default(EnGo2* this) { void EnGo2_SetupUncurledFlags_Default(EnGo2* this) {
this->trackingMode = EnGo2_IsAttentionDrawn(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; this->trackingMode = EnGo2_IsInRange(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;
@ -1252,7 +1252,7 @@ void EnGo2_SetupUncurledFlags_NearTracking(EnGo2* this) {
} }
void EnGo2_SetupUncurledFlags_Biggoron(EnGo2* this) { void EnGo2_SetupUncurledFlags_Biggoron(EnGo2* this) {
if (EnGo2_IsAttentionDrawn(this) || this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { if (EnGo2_IsInRange(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 {
@ -1265,7 +1265,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_IsAttentionDrawn(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; this->trackingMode = EnGo2_IsInRange(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);
@ -1472,7 +1472,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_IsAttentionDrawn(this)) { !EnGo2_IsInRange(this)) {
return false; return false;
} }
return true; return true;
@ -1701,7 +1701,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_IsAttentionDrawn(this)) { if ((ENGO2_GET_TYPE(this) != GORON_FIRE_GENERIC) && EnGo2_IsInRange(this)) {
EnGo2_WakeUpAnimated(this, play); EnGo2_WakeUpAnimated(this, play);
} }
} }
@ -1736,7 +1736,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_IsAttentionDrawn(this))) { if ((!EnGo2_ShouldStay(this, play)) && (!EnGo2_IsInRange(this))) {
EnGo2_AnimateRolling(this, play); EnGo2_AnimateRolling(this, play);
} }
} }