1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-13 11:24:40 +00:00

Merge commit '274743738b' into doc_pause_menu

This commit is contained in:
Dragorn421 2022-11-27 12:56:19 +01:00
commit 5bd4d4dd49
No known key found for this signature in database
GPG key ID: 32B53D2D16FC4118
99 changed files with 1786 additions and 1554 deletions

View file

@ -2136,14 +2136,14 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sDbCamAnim.unk_04 = 0;
} else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CLEFT)) {
sDbCamAnim.unk_0A = 0;
Interface_ChangeAlpha(2);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT);
Letterbox_SetSizeTarget(0);
D_8016110C = 0;
return 2;
}
if (func_800B91B0(cam, dbCamera) == 0) {
Interface_ChangeAlpha(2);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT);
Letterbox_SetSizeTarget(0);
Audio_PlaySfxGeneral(NA_SE_SY_GET_RUPY, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@ -2302,7 +2302,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sDbCamAnim.unk_04 = 0.0f;
sDbCamAnim.unk_0A = 1;
sDbCamAnim.unk_0C = 0;
Interface_ChangeAlpha(50);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
Letterbox_SetSizeTarget(32);
D_8016110C = 0;
Audio_PlaySfxGeneral(NA_SE_SY_HP_RECOVER, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,

View file

@ -1991,18 +1991,30 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* play
func_8002FA60(play);
}
u32 D_80116068[ACTORCAT_MAX] = {
u32 sCategoryFreezeMasks[ACTORCAT_MAX] = {
// ACTORCAT_SWITCH
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28,
// ACTORCAT_BG
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28,
// ACTORCAT_PLAYER
0,
// ACTORCAT_EXPLOSIVE
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_10 | PLAYER_STATE1_28,
// ACTORCAT_NPC
PLAYER_STATE1_7,
// ACTORCAT_ENEMY
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29,
// ACTORCAT_PROP
PLAYER_STATE1_7 | PLAYER_STATE1_28,
// ACTORCAT_ITEMACTION
0,
// ACTORCAT_MISC
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29,
// ACTORCAT_BOSS
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_10 | PLAYER_STATE1_28,
// ACTORCAT_DOOR
0,
// ACTORCAT_CHEST
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28,
};
@ -2010,9 +2022,9 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
Actor* refActor;
Actor* actor;
Player* player;
u32* sp80;
u32 unkFlag;
u32 unkCondition;
u32* categoryFreezeMaskP;
u32 requiredActorFlag;
u32 canFreezeCategory;
Actor* sp74;
ActorEntry* actorEntry;
s32 i;
@ -2025,7 +2037,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
}
sp74 = NULL;
unkFlag = 0;
requiredActorFlag = 0;
if (play->numActorEntries != 0) {
actorEntry = &play->actorEntryList[0];
@ -2046,18 +2058,18 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
refActor->world.pos.z, 0, 0, 0, 1);
}
sp80 = &D_80116068[0];
categoryFreezeMaskP = &sCategoryFreezeMasks[0];
if (player->stateFlags2 & PLAYER_STATE2_27) {
unkFlag = ACTOR_FLAG_25;
requiredActorFlag = ACTOR_FLAG_25;
}
if ((player->stateFlags1 & PLAYER_STATE1_6) && ((player->actor.textId & 0xFF00) != 0x600)) {
sp74 = player->targetActor;
}
for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++, sp80++) {
unkCondition = (*sp80 & player->stateFlags1);
for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++, categoryFreezeMaskP++) {
canFreezeCategory = (*categoryFreezeMaskP & player->stateFlags1);
actor = actorCtx->actorLists[i].head;
while (actor != NULL) {
@ -2077,9 +2089,10 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
} else if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
Actor_Kill(actor);
actor = actor->next;
} else if ((unkFlag && !(actor->flags & unkFlag)) ||
(!unkFlag && unkCondition && (sp74 != actor) && (actor != player->naviActor) &&
(actor != player->heldActor) && (&player->actor != actor->parent))) {
} else if ((requiredActorFlag && !(actor->flags & requiredActorFlag)) ||
(!requiredActorFlag && canFreezeCategory &&
!((sp74 == actor) || (actor == player->naviActor) || (actor == player->heldActor) ||
(&player->actor == actor->parent)))) {
CollisionCheck_ResetDamage(&actor->colChkInfo);
actor = actor->next;
} else if (actor->update == NULL) {
@ -3646,24 +3659,40 @@ Hilite* func_8003435C(Vec3f* object, PlayState* play) {
return func_8002EB44(object, &play->view.eye, &lightDir, play->state.gfxCtx);
}
s32 func_800343CC(PlayState* play, Actor* actor, s16* arg2, f32 interactRange, callback1_800343CC unkFunc1,
callback2_800343CC unkFunc2) {
/**
* Updates NPC talking state. Checks for a talk request and updates
* the talkState parameter when a dialog is ongoing. Otherwise checks if
* the actor is onscreen, advertises the interaction in a range and sets
* the current text id if necessary.
*
* The talk state values are defined in the NpcTalkState enum.
*
* @see NpcTalkState
*
* @param[in,out] talkState Talk state
* @param interactRange The interact (talking) range for the actor
* @param getTextId Callback for getting the next text id
* @param updateTalkState Callback for getting the next talkState value
* @return True if a new dialog was started (player talked to the actor). False otherwise.
*/
s32 Npc_UpdateTalking(PlayState* play, Actor* actor, s16* talkState, f32 interactRange, NpcGetTextIdFunc getTextId,
NpcUpdateTalkStateFunc updateTalkState) {
s16 x;
s16 y;
if (Actor_ProcessTalkRequest(actor, play)) {
*arg2 = 1;
*talkState = NPC_TALK_STATE_TALKING;
return true;
}
if (*arg2 != 0) {
*arg2 = unkFunc2(play, actor);
if (*talkState != NPC_TALK_STATE_IDLE) {
*talkState = updateTalkState(play, actor);
return false;
}
Actor_GetScreenPos(play, actor, &x, &y);
if ((x < 0) || (x > SCREEN_WIDTH) || (y < 0) || (y > SCREEN_HEIGHT)) {
// Actor is offscreen
return false;
}
@ -3671,162 +3700,242 @@ s32 func_800343CC(PlayState* play, Actor* actor, s16* arg2, f32 interactRange, c
return false;
}
actor->textId = unkFunc1(play, actor);
actor->textId = getTextId(play, actor);
return false;
}
typedef struct {
/* 0x00 */ s16 unk_00;
/* 0x02 */ s16 unk_02;
/* 0x04 */ s16 unk_04;
/* 0x06 */ s16 unk_06;
/* 0x08 */ s16 unk_08;
/* 0x0A */ s16 unk_0A;
/* 0x0C */ u8 unk_0C;
} struct_80116130_0; // size = 0x10
/* 0x00 */ s16 maxHeadYaw;
/* 0x02 */ s16 minHeadPitch;
/* 0x04 */ s16 maxHeadPitch;
/* 0x06 */ s16 maxTorsoYaw;
/* 0x08 */ s16 minTorsoPitch;
/* 0x0A */ s16 maxTorsoPitch;
/* 0x0C */ u8 rotateYaw;
} NpcTrackingRotLimits; // size = 0x10
typedef struct {
/* 0x00 */ struct_80116130_0 sub_00;
/* 0x10 */ f32 unk_10;
/* 0x14 */ s16 unk_14;
} struct_80116130; // size = 0x18
/* 0x00 */ NpcTrackingRotLimits rotLimits;
// Fields specific to NPC_TRACKING_PLAYER_AUTO_TURN mode
/* 0x10 */ f32 autoTurnDistanceRange; // Max distance to player to enable tracking and auto-turn
/* 0x14 */ s16 maxYawForPlayerTracking; // Player is tracked if within this yaw
} NpcTrackingParams; // size = 0x18
static struct_80116130 D_80116130[] = {
{ { 0x2AA8, 0xF1C8, 0x18E2, 0x1554, 0x0000, 0x0000, 1 }, 170.0f, 0x3FFC },
{ { 0x2AA8, 0xEAAC, 0x1554, 0x1554, 0xF8E4, 0x0E38, 1 }, 170.0f, 0x3FFC },
{ { 0x31C4, 0xE390, 0x0E38, 0x0E38, 0xF1C8, 0x071C, 1 }, 170.0f, 0x3FFC },
{ { 0x1554, 0xF1C8, 0x0000, 0x071C, 0xF8E4, 0x0000, 1 }, 170.0f, 0x3FFC },
{ { 0x2AA8, 0xF8E4, 0x071C, 0x0E38, 0xD558, 0x2AA8, 1 }, 170.0f, 0x3FFC },
{ { 0x0000, 0xE390, 0x2AA8, 0x3FFC, 0xF1C8, 0x0E38, 1 }, 170.0f, 0x3FFC },
{ { 0x2AA8, 0xF1C8, 0x0E38, 0x0E38, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 },
{ { 0x2AA8, 0xF1C8, 0x0000, 0x0E38, 0x0000, 0x1C70, 1 }, 0.0f, 0x0000 },
{ { 0x2AA8, 0xF1C8, 0xF1C8, 0x0000, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 },
{ { 0x071C, 0xF1C8, 0x0E38, 0x1C70, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 },
{ { 0x0E38, 0xF1C8, 0x0000, 0x1C70, 0x0000, 0x0E38, 1 }, 0.0f, 0x0000 },
{ { 0x2AA8, 0xE390, 0x1C70, 0x0E38, 0xF1C8, 0x0E38, 1 }, 0.0f, 0x0000 },
{ { 0x18E2, 0xF1C8, 0x0E38, 0x0E38, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 },
/**
* Npc tracking angle limit presets to use with Npc_TrackPoint.
*
* @see Npc_TrackPoint
*/
static NpcTrackingParams sNpcTrackingPresets[] = {
{ { 0x2AA8, -0x0E38, 0x18E2, 0x1554, 0x0000, 0x0000, true }, 170.0f, 0x3FFC },
{ { 0x2AA8, -0x1554, 0x1554, 0x1554, -0x071C, 0x0E38, true }, 170.0f, 0x3FFC },
{ { 0x31C4, -0x1C70, 0x0E38, 0x0E38, -0x0E38, 0x071C, true }, 170.0f, 0x3FFC },
{ { 0x1554, -0x0E38, 0x0000, 0x071C, -0x071C, 0x0000, true }, 170.0f, 0x3FFC },
{ { 0x2AA8, -0x071C, 0x071C, 0x0E38, -0x2AA8, 0x2AA8, true }, 170.0f, 0x3FFC },
{ { 0x0000, -0x1C70, 0x2AA8, 0x3FFC, -0x0E38, 0x0E38, true }, 170.0f, 0x3FFC },
{ { 0x2AA8, -0x0E38, 0x0E38, 0x0E38, 0x0000, 0x0000, true }, 0.0f, 0x0000 },
{ { 0x2AA8, -0x0E38, 0x0000, 0x0E38, 0x0000, 0x1C70, true }, 0.0f, 0x0000 },
{ { 0x2AA8, -0x0E38, -0x0E38, 0x0000, 0x0000, 0x0000, true }, 0.0f, 0x0000 },
{ { 0x071C, -0x0E38, 0x0E38, 0x1C70, 0x0000, 0x0000, true }, 0.0f, 0x0000 },
{ { 0x0E38, -0x0E38, 0x0000, 0x1C70, 0x0000, 0x0E38, true }, 0.0f, 0x0000 },
{ { 0x2AA8, -0x1C70, 0x1C70, 0x0E38, -0x0E38, 0x0E38, true }, 0.0f, 0x0000 },
{ { 0x18E2, -0x0E38, 0x0E38, 0x0E38, 0x0000, 0x0000, true }, 0.0f, 0x0000 },
};
void func_800344BC(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7,
u8 arg8) {
s16 sp46;
s16 sp44;
s16 temp2;
s16 sp40;
s16 temp1;
Vec3f sp30;
/**
* Smoothly turns the actor's whole body and updates torso and head rotations in
* NpcInteractInfo so that the actor tracks the point specified in NpcInteractInfo.trackPos.
* Rotations are limited to specified angles.
*
* Head and torso rotation angles are determined by calculating the pitch and yaw
* from the actor position to the given target position.
*
* The y position of the actor is offset by NpcInteractInfo.yOffset
* before calculating the angles. It can be used to configure the height difference
* between the actor and the target.
*
* @param maxHeadYaw maximum head yaw difference from neutral position
* @param maxHeadPitch maximum head pitch angle
* @param minHeadPitch minimum head pitch angle
* @param maxTorsoYaw maximum torso yaw difference from neutral position
* @param maxTorsoPitch maximum torso pitch angle
* @param minTorsoPitch minimum torso pitch angle
* @param rotateYaw if true, the actor's yaw (shape.rot.y) is updated to turn the actor's whole body
*/
void Npc_TrackPointWithLimits(Actor* actor, NpcInteractInfo* interactInfo, s16 maxHeadYaw, s16 maxHeadPitch,
s16 minHeadPitch, s16 maxTorsoYaw, s16 maxTorsoPitch, s16 minTorsoPitch, u8 rotateYaw) {
s16 pitchTowardsTarget;
s16 yawTowardsTarget;
s16 torsoPitch;
s16 bodyYawDiff;
s16 temp;
Vec3f offsetActorPos;
sp30.x = actor->world.pos.x;
sp30.y = actor->world.pos.y + arg1->unk_14;
sp30.z = actor->world.pos.z;
offsetActorPos.x = actor->world.pos.x;
offsetActorPos.y = actor->world.pos.y + interactInfo->yOffset;
offsetActorPos.z = actor->world.pos.z;
sp46 = Math_Vec3f_Pitch(&sp30, &arg1->unk_18);
sp44 = Math_Vec3f_Yaw(&sp30, &arg1->unk_18);
sp40 = Math_Vec3f_Yaw(&actor->world.pos, &arg1->unk_18) - actor->shape.rot.y;
pitchTowardsTarget = Math_Vec3f_Pitch(&offsetActorPos, &interactInfo->trackPos);
yawTowardsTarget = Math_Vec3f_Yaw(&offsetActorPos, &interactInfo->trackPos);
bodyYawDiff = Math_Vec3f_Yaw(&actor->world.pos, &interactInfo->trackPos) - actor->shape.rot.y;
temp1 = CLAMP(sp40, -arg2, arg2);
Math_SmoothStepToS(&arg1->unk_08.y, temp1, 6, 2000, 1);
temp = CLAMP(bodyYawDiff, -maxHeadYaw, maxHeadYaw);
Math_SmoothStepToS(&interactInfo->headRot.y, temp, 6, 2000, 1);
temp1 = (ABS(sp40) >= 0x8000) ? 0 : ABS(sp40);
arg1->unk_08.y = CLAMP(arg1->unk_08.y, -temp1, temp1);
temp = (ABS(bodyYawDiff) >= 0x8000) ? 0 : ABS(bodyYawDiff);
interactInfo->headRot.y = CLAMP(interactInfo->headRot.y, -temp, temp);
sp40 -= arg1->unk_08.y;
bodyYawDiff -= interactInfo->headRot.y;
temp1 = CLAMP(sp40, -arg5, arg5);
Math_SmoothStepToS(&arg1->unk_0E.y, temp1, 6, 2000, 1);
temp = CLAMP(bodyYawDiff, -maxTorsoYaw, maxTorsoYaw);
Math_SmoothStepToS(&interactInfo->torsoRot.y, temp, 6, 2000, 1);
temp1 = (ABS(sp40) >= 0x8000) ? 0 : ABS(sp40);
arg1->unk_0E.y = CLAMP(arg1->unk_0E.y, -temp1, temp1);
temp = (ABS(bodyYawDiff) >= 0x8000) ? 0 : ABS(bodyYawDiff);
interactInfo->torsoRot.y = CLAMP(interactInfo->torsoRot.y, -temp, temp);
if (arg8) {
Math_SmoothStepToS(&actor->shape.rot.y, sp44, 6, 2000, 1);
if (rotateYaw) {
Math_SmoothStepToS(&actor->shape.rot.y, yawTowardsTarget, 6, 2000, 1);
}
temp1 = CLAMP(sp46, arg4, (s16)(u16)arg3);
Math_SmoothStepToS(&arg1->unk_08.x, temp1, 6, 2000, 1);
temp = CLAMP(pitchTowardsTarget, minHeadPitch, (s16)(u16)maxHeadPitch);
Math_SmoothStepToS(&interactInfo->headRot.x, temp, 6, 2000, 1);
temp2 = sp46 - arg1->unk_08.x;
torsoPitch = pitchTowardsTarget - interactInfo->headRot.x;
temp1 = CLAMP(temp2, arg7, arg6);
Math_SmoothStepToS(&arg1->unk_0E.x, temp1, 6, 2000, 1);
temp = CLAMP(torsoPitch, minTorsoPitch, maxTorsoPitch);
Math_SmoothStepToS(&interactInfo->torsoRot.x, temp, 6, 2000, 1);
}
s16 func_800347E8(s16 arg0) {
return D_80116130[arg0].unk_14;
s16 Npc_GetTrackingPresetMaxPlayerYaw(s16 presetIndex) {
return sNpcTrackingPresets[presetIndex].maxYawForPlayerTracking;
}
s16 func_80034810(Actor* actor, struct_80034A14_arg1* arg1, f32 arg2, s16 arg3, s16 arg4) {
/**
* Handles NPC tracking modes and auto-turning towards the player when
* NPC_TRACKING_PLAYER_AUTO_TURN tracking mode is used.
*
* Returns a tracking mode that will determine which actor limbs
* will be rotated towards the target.
*
* When the player is behind the actor (i.e. not in the yaw range in front of the actor
* defined by maxYawForPlayerTracking), the actor will start an auto-turn sequence:
* - look forward for 30-60 frames
* - turn head to look at the player for 10-20 frames
* - look forward for 30-60 frames
* - turn the entire body to face the player
*
* @param distanceRange Max distance to player that tracking and auto-turning will be active for
* @param maxYawForPlayerTracking Maximum angle for tracking the player.
* @param trackingMode The tracking mode selected by the actor. If this is not
* NPC_TRACKING_PLAYER_AUTO_TURN this function does nothing
*
* @return The tracking mode (NpcTrackingMode) to use for the current frame.
*/
s16 Npc_UpdateAutoTurn(Actor* actor, NpcInteractInfo* interactInfo, f32 distanceRange, s16 maxYawForPlayerTracking,
s16 trackingMode) {
s32 pad;
s16 var;
s16 abs_var;
s16 yaw;
s16 yawDiff;
if (arg4 != 0) {
return arg4;
if (trackingMode != NPC_TRACKING_PLAYER_AUTO_TURN) {
return trackingMode;
}
if (arg1->unk_00 != 0) {
return 4;
if (interactInfo->talkState != NPC_TALK_STATE_IDLE) {
// When talking, always fully turn to face the player
return NPC_TRACKING_FULL_BODY;
}
if (arg2 < Math_Vec3f_DistXYZ(&actor->world.pos, &arg1->unk_18)) {
arg1->unk_04 = 0;
arg1->unk_06 = 0;
return 1;
if (distanceRange < Math_Vec3f_DistXYZ(&actor->world.pos, &interactInfo->trackPos)) {
// Player is too far away, do not track
interactInfo->autoTurnTimer = 0;
interactInfo->autoTurnState = 0;
return NPC_TRACKING_NONE;
}
var = Math_Vec3f_Yaw(&actor->world.pos, &arg1->unk_18);
abs_var = ABS((s16)((f32)var - actor->shape.rot.y));
if (arg3 >= abs_var) {
arg1->unk_04 = 0;
arg1->unk_06 = 0;
return 2;
yaw = Math_Vec3f_Yaw(&actor->world.pos, &interactInfo->trackPos);
yawDiff = ABS((s16)((f32)yaw - actor->shape.rot.y));
if (maxYawForPlayerTracking >= yawDiff) {
// Player is in front of the actor, track with the head and the torso
interactInfo->autoTurnTimer = 0;
interactInfo->autoTurnState = 0;
return NPC_TRACKING_HEAD_AND_TORSO;
}
if (DECR(arg1->unk_04) != 0) {
return arg1->unk_02;
// Player is behind the actor, run the auto-turn sequence.
if (DECR(interactInfo->autoTurnTimer) != 0) {
// While the timer is still running, return the previous tracking mode
return interactInfo->trackingMode;
}
switch (arg1->unk_06) {
switch (interactInfo->autoTurnState) {
case 0:
case 2:
arg1->unk_04 = Rand_S16Offset(30, 30);
arg1->unk_06++;
return 1;
// Just stand still, not tracking the player
interactInfo->autoTurnTimer = Rand_S16Offset(30, 30);
interactInfo->autoTurnState++;
return NPC_TRACKING_NONE;
case 1:
arg1->unk_04 = Rand_S16Offset(10, 10);
arg1->unk_06++;
return 3;
// Glance at the player by only turning the head
interactInfo->autoTurnTimer = Rand_S16Offset(10, 10);
interactInfo->autoTurnState++;
return NPC_TRACKING_HEAD;
}
return 4;
// Auto-turn sequence complete, turn towards the player
return NPC_TRACKING_FULL_BODY;
}
void func_80034A14(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3) {
struct_80116130_0 sp38;
/**
* Rotates the actor's whole body, torso and head tracking the point specified in NpcInteractInfo.trackPos.
* Uses angle limits from a preset selected from from sNpcTrackingPresets.
*
* The trackingMode parameter controls whether the head and torso are turned towards the target.
* If not, they are smoothly turned towards zero. Setting the parameter to NPC_TRACKING_FULL_BODY
* causes the actor's whole body to be rotated to face the target.
*
* If NPC_TRACKING_PLAYER_AUTO_TURN is used, the actor will track the player with its head and torso as long
* as the player is in front of the actor (within a yaw angle specified in the option preset).
* If the player is outside of this angle, the actor will turn to face the player after a while.
*
* @see Npc_UpdateAutoTurn
* @see sNpcTrackingPresets
* @see NpcTrackingMode
*
* @param presetIndex The index to a preset in sNpcTrackingPresets
* @param trackingMode A value from NpcTrackingMode enum
*/
void Npc_TrackPoint(Actor* actor, NpcInteractInfo* interactInfo, s16 presetIndex, s16 trackingMode) {
NpcTrackingRotLimits rotLimits;
arg1->unk_02 = func_80034810(actor, arg1, D_80116130[arg2].unk_10, D_80116130[arg2].unk_14, arg3);
interactInfo->trackingMode =
Npc_UpdateAutoTurn(actor, interactInfo, sNpcTrackingPresets[presetIndex].autoTurnDistanceRange,
sNpcTrackingPresets[presetIndex].maxYawForPlayerTracking, trackingMode);
sp38 = D_80116130[arg2].sub_00;
rotLimits = sNpcTrackingPresets[presetIndex].rotLimits;
switch (arg1->unk_02) {
case 1:
sp38.unk_00 = 0;
sp38.unk_04 = 0;
sp38.unk_02 = 0;
switch (interactInfo->trackingMode) {
case NPC_TRACKING_NONE:
rotLimits.maxHeadYaw = 0;
rotLimits.maxHeadPitch = 0;
rotLimits.minHeadPitch = 0;
FALLTHROUGH;
case 3:
sp38.unk_06 = 0;
sp38.unk_0A = 0;
sp38.unk_08 = 0;
case NPC_TRACKING_HEAD:
rotLimits.maxTorsoYaw = 0;
rotLimits.maxTorsoPitch = 0;
rotLimits.minTorsoPitch = 0;
FALLTHROUGH;
case 2:
sp38.unk_0C = 0;
case NPC_TRACKING_HEAD_AND_TORSO:
rotLimits.rotateYaw = false;
break;
}
func_800344BC(actor, arg1, sp38.unk_00, sp38.unk_04, sp38.unk_02, sp38.unk_06, sp38.unk_0A, sp38.unk_08,
sp38.unk_0C);
Npc_TrackPointWithLimits(actor, interactInfo, rotLimits.maxHeadYaw, rotLimits.maxHeadPitch, rotLimits.minHeadPitch,
rotLimits.maxTorsoYaw, rotLimits.maxTorsoPitch, rotLimits.minTorsoPitch,
rotLimits.rotateYaw);
}
Gfx* func_80034B28(GraphicsContext* gfxCtx) {

View file

@ -791,11 +791,11 @@ void Camera_UpdateInterface(s16 flags) {
if ((flags & IFACE_ALPHA_MASK) != IFACE_ALPHA_MASK) {
interfaceAlpha = (flags & IFACE_ALPHA_MASK) >> 8;
if (interfaceAlpha == 0) {
interfaceAlpha = 0x32;
interfaceAlpha = HUD_VISIBILITY_ALL;
}
if (interfaceAlpha != sCameraInterfaceAlpha) {
sCameraInterfaceAlpha = interfaceAlpha;
Interface_ChangeAlpha(sCameraInterfaceAlpha);
Interface_ChangeHudVisibilityMode(sCameraInterfaceAlpha);
}
}
}

View file

@ -19,5 +19,5 @@ void SaveContext_Init(void) {
gSaveContext.skyboxTime = 0;
gSaveContext.dogIsLost = true;
gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT;
gSaveContext.unk_13EE = 50;
gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL;
}

View file

@ -11,7 +11,7 @@ void Interface_Init(PlayState* play) {
u8 timerId;
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
gSaveContext.unk_13E8 = gSaveContext.unk_13EA = 0;
gSaveContext.nextHudVisibilityMode = gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
View_Init(&interfaceCtx->view, play->state.gfxCtx);

View file

@ -188,7 +188,7 @@ u32 func_8006472C(PlayState* play, CutsceneContext* csCtx, f32 target) {
}
void func_80064760(PlayState* play, CutsceneContext* csCtx) {
Interface_ChangeAlpha(1);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
Letterbox_SetSizeTarget(32);
if (func_8006472C(play, csCtx, 1.0f)) {
@ -199,7 +199,7 @@ void func_80064760(PlayState* play, CutsceneContext* csCtx) {
void func_800647C0(PlayState* play, CutsceneContext* csCtx) {
func_80068C3C(play, csCtx);
Interface_ChangeAlpha(1);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
Letterbox_SetSizeTarget(32);
if (func_8006472C(play, csCtx, 1.0f)) {
@ -510,7 +510,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB
osSyncPrintf("\n分岐先指定!!=[%d]番", cmd->base); // "Future fork designation=No. [%d]"
if ((gSaveContext.gameMode != GAMEMODE_NORMAL) && (csCtx->frames != cmd->startFrame)) {
gSaveContext.unk_13E7 = 1;
gSaveContext.forceRisingButtonAlphas = true;
}
gSaveContext.cutsceneIndex = 0;
@ -1554,7 +1554,7 @@ void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdText
}
if (csCtx->frames == originalCsFrames) {
Interface_ChangeAlpha(1);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
D_8011E1C0 = 0;
D_8011E1C4 = 0;
}
@ -2018,7 +2018,7 @@ void func_80068ECC(PlayState* play, CutsceneContext* csCtx) {
}
if (gSaveContext.cutsceneTrigger == 0) {
Interface_ChangeAlpha(1);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
Letterbox_SetSizeTarget(32);
Letterbox_SetSize(32);
csCtx->state++;

View file

@ -70,7 +70,8 @@ void GameOver_Update(PlayState* play) {
gSaveContext.eventInf[3] = 0;
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED;
gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = 0;
gSaveContext.forceRisingButtonAlphas = gSaveContext.nextHudVisibilityMode = gSaveContext.hudVisibilityMode =
gSaveContext.hudVisibilityModeTimer = 0; // false, HUD_VISIBILITY_NO_CHANGE
Environment_InitGameOverLights(play);
gGameOverTimer = 20;

View file

@ -56,7 +56,7 @@ void KaleidoSetup_Update(PlayState* play) {
} else if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
// The start button was pressed, pause
gSaveContext.unk_13EE = gSaveContext.unk_13EA;
gSaveContext.prevHudVisibilityMode = gSaveContext.hudVisibilityMode;
R_PAUSE_CURSOR_LEFT_X = -175;
R_PAUSE_CURSOR_RIGHT_X = 155;

View file

@ -1589,10 +1589,10 @@ void Message_OpenText(PlayState* play, u16 textId) {
s16 textBoxType;
if (msgCtx->msgMode == MSGMODE_NONE) {
gSaveContext.unk_13EE = gSaveContext.unk_13EA;
gSaveContext.prevHudVisibilityMode = gSaveContext.hudVisibilityMode;
}
if (R_SCENE_CAM_TYPE == SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT) {
Interface_ChangeAlpha(5);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE);
}
sMessageHasSetSfx = D_8014B2F4 = sTextboxSkipped = sTextIsCredits = 0;
@ -1623,7 +1623,7 @@ void Message_OpenText(PlayState* play, u16 textId) {
textId == 0x2061 || // Learning Epona's Song
textId == 0x5035 || // Guru-Guru in Windmill
textId == 0x40AC) { // Ocarina Frog Minigame
Interface_ChangeAlpha(1);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
}
msgCtx->textId = textId;
@ -1840,9 +1840,9 @@ void Message_StartOcarina(PlayState* play, u16 ocarinaActionId) {
msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget;
if (noStop == false) {
Interface_LoadActionLabelB(play, DO_ACTION_STOP);
noStop = gSaveContext.unk_13EA;
Interface_ChangeAlpha(0xA);
gSaveContext.unk_13EA = noStop;
noStop = gSaveContext.hudVisibilityMode;
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_B_ALT);
gSaveContext.hudVisibilityMode = noStop;
}
// "Music Performance Start"
osSyncPrintf("演奏開始\n");
@ -1853,7 +1853,7 @@ void Message_StartOcarina(PlayState* play, u16 ocarinaActionId) {
msgCtx->msgMode = MSGMODE_FROGS_START;
msgCtx->textBoxType = TEXTBOX_TYPE_BLUE;
} else if (ocarinaActionId == OCARINA_ACTION_MEMORY_GAME) {
Interface_ChangeAlpha(1);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
Message_Decode(play);
msgCtx->msgMode = MSGMODE_MEMORY_GAME_START;
} else if (ocarinaActionId == OCARINA_ACTION_SCARECROW_LONG_PLAYBACK) {
@ -1868,8 +1868,8 @@ void Message_StartOcarina(PlayState* play, u16 ocarinaActionId) {
msgCtx->stateTimer = 3;
msgCtx->msgMode = MSGMODE_SCARECROW_LONG_PLAYBACK;
AudioOcarina_SetPlaybackSong(OCARINA_SONG_SCARECROW_LONG + 1, 1);
gSaveContext.unk_13EA = 0;
Interface_ChangeAlpha(1);
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
}
for (k = 0, j = 0; j < 48; j++, k += 0x80) {
func_8006EE50(&play->msgCtx.font, 0x8140, k);
@ -2139,7 +2139,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
Audio_PlaySfxGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
Interface_ChangeAlpha(1);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
}
} else if (msgCtx->ocarinaAction == OCARINA_ACTION_CHECK_SCARECROW_SPAWN) {
if (msgCtx->ocarinaStaff->state < OCARINA_SONG_SCARECROW_SPAWN) {
@ -2159,7 +2159,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
Audio_PlaySfxGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
Interface_ChangeAlpha(1);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
}
} else if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY) {
// "Ocarina_Free Correct Example Performance"
@ -2176,7 +2176,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
}
Interface_ChangeAlpha(1);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
} else {
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
Audio_PlaySfxGeneral(NA_SE_SY_OCARINA_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
@ -3189,7 +3189,7 @@ void Message_Update(PlayState* play) {
case MSGMODE_TEXT_NEXT_MSG:
Message_Decode(play);
if (sTextFade) {
Interface_ChangeAlpha(1);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
}
if (D_80153D74 != 0) {
msgCtx->textDrawPos = msgCtx->decodedTextLen;
@ -3271,7 +3271,7 @@ void Message_Update(PlayState* play) {
if (msgCtx->textId == 0x301F || msgCtx->textId == 0xA || msgCtx->textId == 0xC || msgCtx->textId == 0xCF ||
msgCtx->textId == 0x21C || msgCtx->textId == 9 || msgCtx->textId == 0x4078 ||
msgCtx->textId == 0x2015 || msgCtx->textId == 0x3040) {
gSaveContext.unk_13EE = 0x32;
gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL;
}
if (play->csCtx.state == 0) {
osSyncPrintf(VT_FGCOL(GREEN));
@ -3282,11 +3282,13 @@ void Message_Update(PlayState* play) {
(msgCtx->textId != 0x3055 && gSaveContext.cutsceneIndex < 0xFFF0)) {
osSyncPrintf("=== day_time=%x ", ((void)0, gSaveContext.cutsceneIndex));
if (play->activeCamId == CAM_ID_MAIN) {
if (gSaveContext.unk_13EE == 0 || gSaveContext.unk_13EE == 1 || gSaveContext.unk_13EE == 2) {
gSaveContext.unk_13EE = 0x32;
if (gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NO_CHANGE ||
gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NOTHING ||
gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NOTHING_ALT) {
gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL;
}
gSaveContext.unk_13EA = 0;
Interface_ChangeAlpha(gSaveContext.unk_13EE);
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
Interface_ChangeHudVisibilityMode(gSaveContext.prevHudVisibilityMode);
}
}
}

View file

@ -1176,7 +1176,7 @@ s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s1
OnePointCutscene_SetAsChild(play, vChildCamId, subCamId);
vSubCamStatus = CAM_STAT_WAIT;
} else {
Interface_ChangeAlpha(2);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT);
}
OnePointCutscene_SetAsChild(play, subCamId, parentCamId);

View file

@ -164,15 +164,20 @@ static Gfx sSetupDL_80125A60[] = {
};
// original name: "alpha_change"
void Interface_ChangeAlpha(u16 alphaType) {
if (alphaType != gSaveContext.unk_13EA) {
osSyncPrintf("ALPHAーTYPE=%d LAST_TIME_TYPE=%d\n", alphaType, gSaveContext.unk_13EE);
gSaveContext.unk_13EA = gSaveContext.unk_13E8 = alphaType;
gSaveContext.unk_13EC = 1;
void Interface_ChangeHudVisibilityMode(u16 hudVisibilityMode) {
if (hudVisibilityMode != gSaveContext.hudVisibilityMode) {
osSyncPrintf("ALPHAーTYPE=%d LAST_TIME_TYPE=%d\n", hudVisibilityMode,
gSaveContext.prevHudVisibilityMode);
gSaveContext.hudVisibilityMode = gSaveContext.nextHudVisibilityMode = hudVisibilityMode;
gSaveContext.hudVisibilityModeTimer = 1;
}
}
void func_80082644(PlayState* play, s16 alpha) {
/**
* Raise button alphas on the HUD to the requested value
* Apply a set value of 70 to disabled buttons
*/
void Interface_RaiseButtonAlphas(PlayState* play, s16 risingAlpha) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
if (gSaveContext.buttonStatus[0] == BTN_DISABLED) {
@ -181,7 +186,7 @@ void func_80082644(PlayState* play, s16 alpha) {
}
} else {
if (interfaceCtx->bAlpha != 255) {
interfaceCtx->bAlpha = alpha;
interfaceCtx->bAlpha = risingAlpha;
}
}
@ -191,7 +196,7 @@ void func_80082644(PlayState* play, s16 alpha) {
}
} else {
if (interfaceCtx->cLeftAlpha != 255) {
interfaceCtx->cLeftAlpha = alpha;
interfaceCtx->cLeftAlpha = risingAlpha;
}
}
@ -201,7 +206,7 @@ void func_80082644(PlayState* play, s16 alpha) {
}
} else {
if (interfaceCtx->cDownAlpha != 255) {
interfaceCtx->cDownAlpha = alpha;
interfaceCtx->cDownAlpha = risingAlpha;
}
}
@ -211,7 +216,7 @@ void func_80082644(PlayState* play, s16 alpha) {
}
} else {
if (interfaceCtx->cRightAlpha != 255) {
interfaceCtx->cRightAlpha = alpha;
interfaceCtx->cRightAlpha = risingAlpha;
}
}
@ -221,182 +226,194 @@ void func_80082644(PlayState* play, s16 alpha) {
}
} else {
if (interfaceCtx->aAlpha != 255) {
interfaceCtx->aAlpha = alpha;
interfaceCtx->aAlpha = risingAlpha;
}
}
}
void func_8008277C(PlayState* play, s16 maxAlpha, s16 alpha) {
/**
* Lower button alphas on the HUD to the requested value
* if forceRisingButtonAlphas is set, then instead raise button alphas
*/
void Interface_DimButtonAlphas(PlayState* play, s16 dimmingAlpha, s16 risingAlpha) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
if (gSaveContext.unk_13E7 != 0) {
func_80082644(play, alpha);
if (gSaveContext.forceRisingButtonAlphas) {
Interface_RaiseButtonAlphas(play, risingAlpha);
return;
}
if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) {
interfaceCtx->bAlpha = maxAlpha;
if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) {
interfaceCtx->bAlpha = dimmingAlpha;
}
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) {
interfaceCtx->aAlpha = maxAlpha;
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) {
interfaceCtx->aAlpha = dimmingAlpha;
}
if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) {
interfaceCtx->cLeftAlpha = maxAlpha;
if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) {
interfaceCtx->cLeftAlpha = dimmingAlpha;
}
if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) {
interfaceCtx->cDownAlpha = maxAlpha;
if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) {
interfaceCtx->cDownAlpha = dimmingAlpha;
}
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) {
interfaceCtx->cRightAlpha = maxAlpha;
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) {
interfaceCtx->cRightAlpha = dimmingAlpha;
}
}
void func_80082850(PlayState* play, s16 maxAlpha) {
void Interface_UpdateHudAlphas(PlayState* play, s16 dimmingAlpha) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
s16 alpha = 255 - maxAlpha;
s16 risingAlpha = 255 - dimmingAlpha;
switch (gSaveContext.unk_13E8) {
case 1:
case 2:
case 8:
switch (gSaveContext.nextHudVisibilityMode) {
case HUD_VISIBILITY_NOTHING:
case HUD_VISIBILITY_NOTHING_ALT:
case HUD_VISIBILITY_B:
osSyncPrintf("a_alpha=%d, c_alpha=%d → ", interfaceCtx->aAlpha, interfaceCtx->cLeftAlpha);
if (gSaveContext.unk_13E8 == 8) {
if (gSaveContext.nextHudVisibilityMode == HUD_VISIBILITY_B) {
if (interfaceCtx->bAlpha != 255) {
interfaceCtx->bAlpha = alpha;
interfaceCtx->bAlpha = risingAlpha;
}
} else {
if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) {
interfaceCtx->bAlpha = maxAlpha;
if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) {
interfaceCtx->bAlpha = dimmingAlpha;
}
}
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) {
interfaceCtx->aAlpha = maxAlpha;
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) {
interfaceCtx->aAlpha = dimmingAlpha;
}
if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) {
interfaceCtx->cLeftAlpha = maxAlpha;
if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) {
interfaceCtx->cLeftAlpha = dimmingAlpha;
}
if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) {
interfaceCtx->cDownAlpha = maxAlpha;
if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) {
interfaceCtx->cDownAlpha = dimmingAlpha;
}
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) {
interfaceCtx->cRightAlpha = maxAlpha;
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) {
interfaceCtx->cRightAlpha = dimmingAlpha;
}
if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) {
interfaceCtx->healthAlpha = maxAlpha;
if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) {
interfaceCtx->healthAlpha = dimmingAlpha;
}
if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) {
interfaceCtx->magicAlpha = maxAlpha;
if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) {
interfaceCtx->magicAlpha = dimmingAlpha;
}
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) {
interfaceCtx->minimapAlpha = maxAlpha;
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) {
interfaceCtx->minimapAlpha = dimmingAlpha;
}
osSyncPrintf("a_alpha=%d, c_alpha=%d\n", interfaceCtx->aAlpha, interfaceCtx->cLeftAlpha);
break;
case 3:
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) {
interfaceCtx->aAlpha = maxAlpha;
case HUD_VISIBILITY_HEARTS_FORCE:
// aAlpha is immediately overwritten in Interface_DimButtonAlphas
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) {
interfaceCtx->aAlpha = dimmingAlpha;
}
func_8008277C(play, maxAlpha, alpha);
Interface_DimButtonAlphas(play, dimmingAlpha, risingAlpha);
if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) {
interfaceCtx->magicAlpha = maxAlpha;
if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) {
interfaceCtx->magicAlpha = dimmingAlpha;
}
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) {
interfaceCtx->minimapAlpha = maxAlpha;
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) {
interfaceCtx->minimapAlpha = dimmingAlpha;
}
if (interfaceCtx->healthAlpha != 255) {
interfaceCtx->healthAlpha = alpha;
interfaceCtx->healthAlpha = risingAlpha;
}
break;
case 4:
if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) {
interfaceCtx->bAlpha = maxAlpha;
case HUD_VISIBILITY_A:
if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) {
interfaceCtx->bAlpha = dimmingAlpha;
}
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) {
interfaceCtx->aAlpha = maxAlpha;
// aAlpha is immediately overwritten below
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) {
interfaceCtx->aAlpha = dimmingAlpha;
}
if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) {
interfaceCtx->cLeftAlpha = maxAlpha;
if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) {
interfaceCtx->cLeftAlpha = dimmingAlpha;
}
if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) {
interfaceCtx->cDownAlpha = maxAlpha;
if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) {
interfaceCtx->cDownAlpha = dimmingAlpha;
}
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) {
interfaceCtx->cRightAlpha = maxAlpha;
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) {
interfaceCtx->cRightAlpha = dimmingAlpha;
}
if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) {
interfaceCtx->healthAlpha = maxAlpha;
if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) {
interfaceCtx->healthAlpha = dimmingAlpha;
}
if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) {
interfaceCtx->magicAlpha = maxAlpha;
if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) {
interfaceCtx->magicAlpha = dimmingAlpha;
}
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) {
interfaceCtx->minimapAlpha = maxAlpha;
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) {
interfaceCtx->minimapAlpha = dimmingAlpha;
}
if (interfaceCtx->aAlpha != 255) {
interfaceCtx->aAlpha = alpha;
interfaceCtx->aAlpha = risingAlpha;
}
break;
case 5:
func_8008277C(play, maxAlpha, alpha);
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) {
interfaceCtx->minimapAlpha = maxAlpha;
case HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE:
Interface_DimButtonAlphas(play, dimmingAlpha, risingAlpha);
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) {
interfaceCtx->minimapAlpha = dimmingAlpha;
}
// aAlpha overwrites the value set in Interface_DimButtonAlphas
if (interfaceCtx->aAlpha != 255) {
interfaceCtx->aAlpha = alpha;
interfaceCtx->aAlpha = risingAlpha;
}
if (interfaceCtx->healthAlpha != 255) {
interfaceCtx->healthAlpha = alpha;
interfaceCtx->healthAlpha = risingAlpha;
}
if (interfaceCtx->magicAlpha != 255) {
interfaceCtx->magicAlpha = alpha;
interfaceCtx->magicAlpha = risingAlpha;
}
break;
case 6:
func_8008277C(play, maxAlpha, alpha);
case HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_FORCE:
Interface_DimButtonAlphas(play, dimmingAlpha, risingAlpha);
// aAlpha overwrites the value set in Interface_DimButtonAlphas
if (interfaceCtx->aAlpha != 255) {
interfaceCtx->aAlpha = alpha;
interfaceCtx->aAlpha = risingAlpha;
}
if (interfaceCtx->healthAlpha != 255) {
interfaceCtx->healthAlpha = alpha;
interfaceCtx->healthAlpha = risingAlpha;
}
if (interfaceCtx->magicAlpha != 255) {
interfaceCtx->magicAlpha = alpha;
interfaceCtx->magicAlpha = risingAlpha;
}
switch (play->sceneId) {
@ -421,187 +438,195 @@ void func_80082850(PlayState* play, s16 maxAlpha) {
case SCENE_SPOT20:
case SCENE_GANON_TOU:
if (interfaceCtx->minimapAlpha < 170) {
interfaceCtx->minimapAlpha = alpha;
interfaceCtx->minimapAlpha = risingAlpha;
} else {
interfaceCtx->minimapAlpha = 170;
}
break;
default:
if (interfaceCtx->minimapAlpha != 255) {
interfaceCtx->minimapAlpha = alpha;
interfaceCtx->minimapAlpha = risingAlpha;
}
break;
}
break;
case 7:
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) {
interfaceCtx->minimapAlpha = maxAlpha;
case HUD_VISIBILITY_ALL_NO_MINIMAP_BY_BTN_STATUS:
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) {
interfaceCtx->minimapAlpha = dimmingAlpha;
}
func_80082644(play, alpha);
Interface_RaiseButtonAlphas(play, risingAlpha);
if (interfaceCtx->healthAlpha != 255) {
interfaceCtx->healthAlpha = alpha;
interfaceCtx->healthAlpha = risingAlpha;
}
if (interfaceCtx->magicAlpha != 255) {
interfaceCtx->magicAlpha = alpha;
interfaceCtx->magicAlpha = risingAlpha;
}
break;
case 9:
if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) {
interfaceCtx->bAlpha = maxAlpha;
case HUD_VISIBILITY_HEARTS_MAGIC:
if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) {
interfaceCtx->bAlpha = dimmingAlpha;
}
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) {
interfaceCtx->aAlpha = maxAlpha;
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) {
interfaceCtx->aAlpha = dimmingAlpha;
}
if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) {
interfaceCtx->cLeftAlpha = maxAlpha;
if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) {
interfaceCtx->cLeftAlpha = dimmingAlpha;
}
if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) {
interfaceCtx->cDownAlpha = maxAlpha;
if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) {
interfaceCtx->cDownAlpha = dimmingAlpha;
}
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) {
interfaceCtx->cRightAlpha = maxAlpha;
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) {
interfaceCtx->cRightAlpha = dimmingAlpha;
}
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) {
interfaceCtx->minimapAlpha = maxAlpha;
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) {
interfaceCtx->minimapAlpha = dimmingAlpha;
}
if (interfaceCtx->healthAlpha != 255) {
interfaceCtx->healthAlpha = alpha;
interfaceCtx->healthAlpha = risingAlpha;
}
if (interfaceCtx->magicAlpha != 255) {
interfaceCtx->magicAlpha = alpha;
interfaceCtx->magicAlpha = risingAlpha;
}
break;
case 10:
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) {
interfaceCtx->aAlpha = maxAlpha;
case HUD_VISIBILITY_B_ALT:
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) {
interfaceCtx->aAlpha = dimmingAlpha;
}
if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) {
interfaceCtx->cLeftAlpha = maxAlpha;
if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) {
interfaceCtx->cLeftAlpha = dimmingAlpha;
}
if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) {
interfaceCtx->cDownAlpha = maxAlpha;
if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) {
interfaceCtx->cDownAlpha = dimmingAlpha;
}
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) {
interfaceCtx->cRightAlpha = maxAlpha;
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) {
interfaceCtx->cRightAlpha = dimmingAlpha;
}
if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) {
interfaceCtx->healthAlpha = maxAlpha;
if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) {
interfaceCtx->healthAlpha = dimmingAlpha;
}
if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) {
interfaceCtx->magicAlpha = maxAlpha;
if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) {
interfaceCtx->magicAlpha = dimmingAlpha;
}
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) {
interfaceCtx->minimapAlpha = maxAlpha;
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) {
interfaceCtx->minimapAlpha = dimmingAlpha;
}
if (interfaceCtx->bAlpha != 255) {
interfaceCtx->bAlpha = alpha;
interfaceCtx->bAlpha = risingAlpha;
}
break;
case 11:
if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) {
interfaceCtx->bAlpha = maxAlpha;
case HUD_VISIBILITY_HEARTS:
if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) {
interfaceCtx->bAlpha = dimmingAlpha;
}
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) {
interfaceCtx->aAlpha = maxAlpha;
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) {
interfaceCtx->aAlpha = dimmingAlpha;
}
if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) {
interfaceCtx->cLeftAlpha = maxAlpha;
if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) {
interfaceCtx->cLeftAlpha = dimmingAlpha;
}
if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) {
interfaceCtx->cDownAlpha = maxAlpha;
if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) {
interfaceCtx->cDownAlpha = dimmingAlpha;
}
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) {
interfaceCtx->cRightAlpha = maxAlpha;
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) {
interfaceCtx->cRightAlpha = dimmingAlpha;
}
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) {
interfaceCtx->minimapAlpha = maxAlpha;
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) {
interfaceCtx->minimapAlpha = dimmingAlpha;
}
if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) {
interfaceCtx->magicAlpha = maxAlpha;
if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) {
interfaceCtx->magicAlpha = dimmingAlpha;
}
if (interfaceCtx->healthAlpha != 255) {
interfaceCtx->healthAlpha = alpha;
interfaceCtx->healthAlpha = risingAlpha;
}
break;
case 12:
case HUD_VISIBILITY_A_B_MINIMAP:
if (interfaceCtx->aAlpha != 255) {
interfaceCtx->aAlpha = alpha;
interfaceCtx->aAlpha = risingAlpha;
}
if (interfaceCtx->bAlpha != 255) {
interfaceCtx->bAlpha = alpha;
interfaceCtx->bAlpha = risingAlpha;
}
if (interfaceCtx->minimapAlpha != 255) {
interfaceCtx->minimapAlpha = alpha;
interfaceCtx->minimapAlpha = risingAlpha;
}
if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) {
interfaceCtx->cLeftAlpha = maxAlpha;
if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) {
interfaceCtx->cLeftAlpha = dimmingAlpha;
}
if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) {
interfaceCtx->cDownAlpha = maxAlpha;
if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) {
interfaceCtx->cDownAlpha = dimmingAlpha;
}
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) {
interfaceCtx->cRightAlpha = maxAlpha;
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) {
interfaceCtx->cRightAlpha = dimmingAlpha;
}
if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) {
interfaceCtx->magicAlpha = maxAlpha;
if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) {
interfaceCtx->magicAlpha = dimmingAlpha;
}
if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) {
interfaceCtx->healthAlpha = maxAlpha;
if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) {
interfaceCtx->healthAlpha = dimmingAlpha;
}
break;
case 13:
func_8008277C(play, maxAlpha, alpha);
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) {
interfaceCtx->minimapAlpha = maxAlpha;
case HUD_VISIBILITY_HEARTS_MAGIC_FORCE:
Interface_DimButtonAlphas(play, dimmingAlpha, risingAlpha);
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) {
interfaceCtx->minimapAlpha = dimmingAlpha;
}
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) {
interfaceCtx->aAlpha = maxAlpha;
// aAlpha overwrites the value set in Interface_DimButtonAlphas
if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) {
interfaceCtx->aAlpha = dimmingAlpha;
}
if (interfaceCtx->healthAlpha != 255) {
interfaceCtx->healthAlpha = alpha;
interfaceCtx->healthAlpha = risingAlpha;
}
if (interfaceCtx->magicAlpha != 255) {
interfaceCtx->magicAlpha = alpha;
interfaceCtx->magicAlpha = risingAlpha;
}
break;
@ -621,12 +646,12 @@ void func_80083108(PlayState* play) {
if ((gSaveContext.cutsceneIndex < 0xFFF0) ||
((play->sceneId == SCENE_SPOT20) && (gSaveContext.cutsceneIndex == 0xFFF0))) {
gSaveContext.unk_13E7 = 0;
gSaveContext.forceRisingButtonAlphas = false;
if ((player->stateFlags1 & PLAYER_STATE1_23) || (play->shootingGalleryStatus > 1) ||
((play->sceneId == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38))) {
if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) {
gSaveContext.unk_13E7 = 1;
gSaveContext.forceRisingButtonAlphas = true;
if (gSaveContext.buttonStatus[0] == BTN_DISABLED) {
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
@ -661,44 +686,45 @@ void func_80083108(PlayState* play) {
gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] =
BTN_DISABLED;
Interface_ChangeAlpha(6);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_FORCE);
}
if (play->transitionMode != TRANS_MODE_OFF) {
Interface_ChangeAlpha(1);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
} else if (gSaveContext.minigameState == 1) {
Interface_ChangeAlpha(8);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_B);
} else if (play->shootingGalleryStatus > 1) {
Interface_ChangeAlpha(8);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_B);
} else if ((play->sceneId == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38)) {
Interface_ChangeAlpha(8);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_B);
} else if (player->stateFlags1 & PLAYER_STATE1_23) {
Interface_ChangeAlpha(12);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_B_MINIMAP);
}
} else {
if (player->stateFlags1 & PLAYER_STATE1_23) {
Interface_ChangeAlpha(12);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_B_MINIMAP);
}
}
} else if (play->sceneId == SCENE_KENJYANOMA) {
Interface_ChangeAlpha(1);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
} else if (play->sceneId == SCENE_TURIBORI) {
gSaveContext.unk_13E7 = 2;
// should likely be set to true
gSaveContext.forceRisingButtonAlphas = 2;
if (play->interfaceCtx.unk_260 != 0) {
if (gSaveContext.equips.buttonItems[0] != ITEM_FISHING_POLE) {
gSaveContext.buttonStatus[0] = gSaveContext.equips.buttonItems[0];
gSaveContext.equips.buttonItems[0] = ITEM_FISHING_POLE;
gSaveContext.unk_13EA = 0;
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
Interface_LoadItemIcon1(play, 0);
Interface_ChangeAlpha(12);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_B_MINIMAP);
}
if (gSaveContext.unk_13EA != 12) {
Interface_ChangeAlpha(12);
if (gSaveContext.hudVisibilityMode != HUD_VISIBILITY_A_B_MINIMAP) {
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_B_MINIMAP);
}
} else if (gSaveContext.equips.buttonItems[0] == ITEM_FISHING_POLE) {
gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0];
gSaveContext.unk_13EA = 0;
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) {
Interface_LoadItemIcon1(play, 0);
@ -706,15 +732,15 @@ void func_80083108(PlayState* play) {
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = BTN_DISABLED;
Interface_ChangeAlpha(50);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
} else {
if (gSaveContext.buttonStatus[0] == BTN_ENABLED) {
gSaveContext.unk_13EA = 0;
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
}
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = BTN_DISABLED;
Interface_ChangeAlpha(50);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
}
} else if (msgCtx->msgMode == MSGMODE_NONE) {
if ((Player_GetEnvironmentalHazard(play) >= PLAYER_ENV_HAZARD_UNDERWATER_FLOOR) &&
@ -751,18 +777,18 @@ void func_80083108(PlayState* play) {
}
if (sp28) {
gSaveContext.unk_13EA = 0;
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
}
Interface_ChangeAlpha(50);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
} else if ((player->stateFlags1 & PLAYER_STATE1_21) || (player->stateFlags2 & PLAYER_STATE2_CRAWLING)) {
if (gSaveContext.buttonStatus[0] != BTN_DISABLED) {
gSaveContext.buttonStatus[0] = BTN_DISABLED;
gSaveContext.buttonStatus[1] = BTN_DISABLED;
gSaveContext.buttonStatus[2] = BTN_DISABLED;
gSaveContext.buttonStatus[3] = BTN_DISABLED;
gSaveContext.unk_13EA = 0;
Interface_ChangeAlpha(50);
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
}
} else if (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_1) {
if (player->stateFlags1 & PLAYER_STATE1_23) {
@ -814,10 +840,10 @@ void func_80083108(PlayState* play) {
}
if (sp28) {
gSaveContext.unk_13EA = 0;
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
}
Interface_ChangeAlpha(50);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
} else {
if (interfaceCtx->restrictions.bButton == 0) {
if ((gSaveContext.equips.buttonItems[0] == ITEM_SLINGSHOT) ||
@ -1059,9 +1085,9 @@ void func_80083108(PlayState* play) {
}
if (sp28) {
gSaveContext.unk_13EA = 0;
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) {
Interface_ChangeAlpha(50);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
osSyncPrintf("???????? alpha_change( 50 ); ?????\n");
} else {
osSyncPrintf("game_play->fade_direction || game_play->fbdemo_wipe_modem");
@ -1312,7 +1338,7 @@ void func_80084BF4(PlayState* play, u16 flag) {
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = BTN_ENABLED;
Interface_ChangeAlpha(7);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL_NO_MINIMAP_BY_BTN_STATUS);
} else {
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = BTN_ENABLED;
@ -2806,7 +2832,9 @@ void Interface_DrawItemButtons(PlayState* play) {
// C-Up Button Texture, Color & Label (Navi Text)
gDPPipeSync(OVERLAY_DISP++);
if ((gSaveContext.unk_13EA == 1) || (gSaveContext.unk_13EA == 2) || (gSaveContext.unk_13EA == 5)) {
if ((gSaveContext.hudVisibilityMode == HUD_VISIBILITY_NOTHING) ||
(gSaveContext.hudVisibilityMode == HUD_VISIBILITY_NOTHING_ALT) ||
(gSaveContext.hudVisibilityMode == HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE)) {
temp = 0;
} else if ((player->stateFlags1 & PLAYER_STATE1_21) ||
(Player_GetEnvironmentalHazard(play) == PLAYER_ENV_HAZARD_UNDERWATER_FREE) ||
@ -3918,8 +3946,8 @@ void Interface_Update(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
Player* player = GET_PLAYER(play);
s16 alpha;
s16 alpha1;
s16 dimmingAlpha;
s16 risingAlpha;
u16 action;
Input* debugInput = &play->state.input[2];
@ -3946,52 +3974,55 @@ void Interface_Update(PlayState* play) {
}
}
switch (gSaveContext.unk_13E8) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
alpha = 255 - (gSaveContext.unk_13EC << 5);
if (alpha < 0) {
alpha = 0;
// Update hud visibility mode
switch (gSaveContext.nextHudVisibilityMode) {
case HUD_VISIBILITY_NOTHING:
case HUD_VISIBILITY_NOTHING_ALT:
case HUD_VISIBILITY_HEARTS_FORCE:
case HUD_VISIBILITY_A:
case HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE:
case HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_FORCE:
case HUD_VISIBILITY_ALL_NO_MINIMAP_BY_BTN_STATUS:
case HUD_VISIBILITY_B:
case HUD_VISIBILITY_HEARTS_MAGIC:
case HUD_VISIBILITY_B_ALT:
case HUD_VISIBILITY_HEARTS:
case HUD_VISIBILITY_A_B_MINIMAP:
case HUD_VISIBILITY_HEARTS_MAGIC_FORCE:
dimmingAlpha = 255 - (32 * gSaveContext.hudVisibilityModeTimer);
if (dimmingAlpha < 0) {
dimmingAlpha = 0;
}
func_80082850(play, alpha);
gSaveContext.unk_13EC++;
Interface_UpdateHudAlphas(play, dimmingAlpha);
gSaveContext.hudVisibilityModeTimer++;
if (alpha == 0) {
gSaveContext.unk_13E8 = 0;
if (dimmingAlpha == 0) {
gSaveContext.nextHudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
}
break;
case 50:
alpha = 255 - (gSaveContext.unk_13EC << 5);
if (alpha < 0) {
alpha = 0;
case HUD_VISIBILITY_ALL:
dimmingAlpha = 255 - (32 * gSaveContext.hudVisibilityModeTimer);
if (dimmingAlpha < 0) {
dimmingAlpha = 0;
}
alpha1 = 255 - alpha;
if (alpha1 >= 255) {
alpha1 = 255;
risingAlpha = 255 - dimmingAlpha;
if (risingAlpha >= 255) {
risingAlpha = 255;
}
osSyncPrintf("case 50 : alpha=%d alpha1=%d\n", alpha, alpha1);
func_80082644(play, alpha1);
osSyncPrintf("case 50 : alpha=%d alpha1=%d\n", dimmingAlpha, risingAlpha);
Interface_RaiseButtonAlphas(play, risingAlpha);
if (interfaceCtx->healthAlpha != 255) {
interfaceCtx->healthAlpha = alpha1;
interfaceCtx->healthAlpha = risingAlpha;
}
if (interfaceCtx->magicAlpha != 255) {
interfaceCtx->magicAlpha = alpha1;
interfaceCtx->magicAlpha = risingAlpha;
}
switch (play->sceneId) {
@ -4016,28 +4047,32 @@ void Interface_Update(PlayState* play) {
case SCENE_SPOT20:
case SCENE_GANON_TOU:
if (interfaceCtx->minimapAlpha < 170) {
interfaceCtx->minimapAlpha = alpha1;
interfaceCtx->minimapAlpha = risingAlpha;
} else {
interfaceCtx->minimapAlpha = 170;
}
break;
default:
if (interfaceCtx->minimapAlpha != 255) {
interfaceCtx->minimapAlpha = alpha1;
interfaceCtx->minimapAlpha = risingAlpha;
}
break;
}
gSaveContext.unk_13EC++;
if (alpha1 == 255) {
gSaveContext.unk_13E8 = 0;
gSaveContext.hudVisibilityModeTimer++;
if (risingAlpha == 255) {
gSaveContext.nextHudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
}
break;
case 52:
gSaveContext.unk_13E8 = 1;
func_80082850(play, 0);
gSaveContext.unk_13E8 = 0;
case HUD_VISIBILITY_NOTHING_INSTANT:
// Hide the HUD immediately
gSaveContext.nextHudVisibilityMode = HUD_VISIBILITY_NOTHING;
Interface_UpdateHudAlphas(play, 0);
gSaveContext.nextHudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
FALLTHROUGH;
default:
break;
}

View file

@ -509,7 +509,7 @@ void Play_Update(PlayState* this) {
if (this->transitionTrigger != TRANS_TRIGGER_END) {
s16 sceneLayer = SCENE_LAYER_CHILD_DAY;
Interface_ChangeAlpha(1);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
if (gSaveContext.cutsceneIndex >= 0xFFF0) {
sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.cutsceneIndex & 0xF);