summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
Diffstat (limited to 'src/code')
-rw-r--r--src/code/title_setup.c34
-rw-r--r--src/code/z_kaleido_setup.c2
-rw-r--r--src/code/z_lifemeter.c25
-rw-r--r--src/code/z_message.c4
-rw-r--r--src/code/z_parameter.c1463
-rw-r--r--src/code/z_play.c4
-rw-r--r--src/code/z_player_lib.c50
-rw-r--r--src/code/z_sram_NES.c4
8 files changed, 1344 insertions, 242 deletions
diff --git a/src/code/title_setup.c b/src/code/title_setup.c
index 8ba6f9b56..4e9293ce7 100644
--- a/src/code/title_setup.c
+++ b/src/code/title_setup.c
@@ -7,12 +7,13 @@ void Setup_SetRegs(void) {
XREG(11) = 0x14;
XREG(12) = 0xE;
XREG(13) = 0;
- XREG(31) = 0;
+ R_A_BTN_Y_OFFSET = 0;
R_MAGIC_CONSUME_TIMER_GIANTS_MASK = 80;
- XREG(43) = 0xFC54;
- XREG(44) = 0xD7;
- XREG(45) = 0xDA;
+ R_THREE_DAY_CLOCK_Y_POS = 64596;
+ R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF = 215;
+ R_THREE_DAY_CLOCK_HOUR_DIGIT_CUTOFF = 218;
+
XREG(68) = 0x61;
XREG(69) = 0x93;
XREG(70) = 0x28;
@@ -27,22 +28,23 @@ void Setup_SetRegs(void) {
XREG(88) = 0x56;
XREG(89) = 0x258;
XREG(90) = 0x1C2;
+
R_STORY_FILL_SCREEN_ALPHA = 0;
R_REVERSE_FLOOR_INDEX = 0;
R_MINIMAP_DISABLED = false;
- YREG(32) = 0x50;
- YREG(33) = 0x3C;
- YREG(34) = 0xDC;
- YREG(35) = 0x3C;
- YREG(36) = 0x50;
- YREG(37) = 0xA0;
- YREG(38) = 0xDC;
- YREG(39) = 0xA0;
- YREG(40) = 0x8E;
- YREG(41) = 0x6C;
- YREG(42) = 0xCC;
- YREG(43) = 0xB1;
+ R_PICTO_FOCUS_BORDER_TOPLEFT_X = 80;
+ R_PICTO_FOCUS_BORDER_TOPLEFT_Y = 60;
+ R_PICTO_FOCUS_BORDER_TOPRIGHT_X = 220;
+ R_PICTO_FOCUS_BORDER_TOPRIGHT_Y = 60;
+ R_PICTO_FOCUS_BORDER_BOTTOMLEFT_X = 80;
+ R_PICTO_FOCUS_BORDER_BOTTOMLEFT_Y = 160;
+ R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_X = 220;
+ R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_Y = 160;
+ R_PICTO_FOCUS_ICON_X = 142;
+ R_PICTO_FOCUS_ICON_Y = 108;
+ R_PICTO_FOCUS_TEXT_X = 204;
+ R_PICTO_FOCUS_TEXT_Y = 177;
}
void Setup_InitImpl(SetupState* this) {
diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c
index 712096446..dac0d8300 100644
--- a/src/code/z_kaleido_setup.c
+++ b/src/code/z_kaleido_setup.c
@@ -98,7 +98,7 @@ void KaleidoSetup_Update(PlayState* play) {
(gSaveContext.magicState != MAGIC_STATE_FILL)) {
if (!CHECK_EVENTINF(EVENTINF_17) && !(player->stateFlags1 & PLAYER_STATE1_20)) {
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) &&
- !(play->actorCtx.flags & ACTORCTX_FLAG_2)) {
+ !(play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON)) {
if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) {
gSaveContext.prevHudVisibility = gSaveContext.hudVisibility;
pauseCtx->itemDescriptionOn = false;
diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c
index d4927ae97..669aa338a 100644
--- a/src/code/z_lifemeter.c
+++ b/src/code/z_lifemeter.c
@@ -36,7 +36,7 @@ TexturePtr HeartDDTextures[] = {
void LifeMeter_Init(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
- interfaceCtx->unkTimer = 320;
+ interfaceCtx->healthTimer = 320;
interfaceCtx->health = gSaveContext.save.playerData.health;
@@ -167,39 +167,44 @@ void LifeMeter_UpdateColors(PlayState* play) {
sBeatingHeartsDDEnv[2] = (u8)(bFactor + 0) & 0xFF;
}
+// Unused
s32 LifeMeter_SaveInterfaceHealth(PlayState* play) {
- gSaveContext.save.playerData.health = play->interfaceCtx.health;
+ InterfaceContext* interfaceCtx = &play->interfaceCtx;
+
+ gSaveContext.save.playerData.health = interfaceCtx->health;
return 1;
}
+// Unused
s32 LifeMeter_IncreaseInterfaceHealth(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
- interfaceCtx->unkTimer = 320;
+ interfaceCtx->healthTimer = 320;
interfaceCtx->health += 0x10;
if (play->interfaceCtx.health >= gSaveContext.save.playerData.health) {
play->interfaceCtx.health = gSaveContext.save.playerData.health;
- return 1;
+ return true;
}
- return 0;
+ return false;
}
+// Unused
s32 LifeMeter_DecreaseInterfaceHealth(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
- if (interfaceCtx->unkTimer != 0) {
- interfaceCtx->unkTimer--;
+ if (interfaceCtx->healthTimer != 0) {
+ interfaceCtx->healthTimer--;
} else {
- interfaceCtx->unkTimer = 320;
+ interfaceCtx->healthTimer = 320;
interfaceCtx->health -= 0x10;
if (interfaceCtx->health <= 0) {
interfaceCtx->health = 0;
play->damagePlayer(play, -(((void)0, gSaveContext.save.playerData.health) + 1));
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
void LifeMeter_Draw(PlayState* play) {
diff --git a/src/code/z_message.c b/src/code/z_message.c
index 44fff9f9f..e3eb9839d 100644
--- a/src/code/z_message.c
+++ b/src/code/z_message.c
@@ -322,9 +322,9 @@ void func_80151938(PlayState* play, u16 textId) {
if (interfaceCtx->unk_222 == 0) {
if (textId != 0x1B93) {
- func_8011552C(play, 0x10);
+ func_8011552C(play, DO_ACTION_NEXT);
} else if (textId != 0xF8) {
- func_8011552C(play, 6);
+ func_8011552C(play, DO_ACTION_DECIDE);
}
}
msgCtx->unk1203C = msgCtx->unk1203A;
diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c
index 29155be2a..cd4ffa67f 100644
--- a/src/code/z_parameter.c
+++ b/src/code/z_parameter.c
@@ -7,6 +7,13 @@
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
#include "overlays/actors/ovl_En_Mm3/z_en_mm3.h"
+typedef enum {
+ /* 0 */ PICTO_BOX_STATE_OFF, // Not using the pictograph
+ /* 1 */ PICTO_BOX_STATE_LENS, // Looking through the lens of the pictograph
+ /* 2 */ PICTO_BOX_STATE_SETUP_PHOTO, // Looking at the photo currently taken
+ /* 3 */ PICTO_BOX_STATE_PHOTO
+} PictoBoxState;
+
typedef struct {
/* 0x00 */ u8 scene;
/* 0x01 */ u8 flags1;
@@ -16,124 +23,169 @@ typedef struct {
Input sPostmanTimerInput[4];
+#define RESTRICTIONS_TABLE_END 0xFF
+
+#define RESTRICTIONS_GET_BITS(flags, s) (((flags) & (3 << (s))) >> (s))
+
+// does nothing
+#define RESTRICTIONS_GET_HGAUGE(flags) RESTRICTIONS_GET_BITS((flags)->flags1, 6)
+// 0 = usable, !0 = unusable
+#define RESTRICTIONS_GET_B_BUTTON(flags) RESTRICTIONS_GET_BITS((flags)->flags1, 4)
+// does nothing
+#define RESTRICTIONS_GET_A_BUTTON(flags) RESTRICTIONS_GET_BITS((flags)->flags1, 2)
+// 0 = usable, !0 = unusable
+#define RESTRICTIONS_GET_TRADE_ITEMS(flags) RESTRICTIONS_GET_BITS((flags)->flags1, 0)
+// 0 = usable, !0 = unusable
+#define RESTRICTIONS_GET_SONG_OF_TIME(flags) RESTRICTIONS_GET_BITS((flags)->flags2, 6)
+// 0 = usable, !0 = unusable
+#define RESTRICTIONS_GET_SONG_OF_DOUBLE_TIME(flags) RESTRICTIONS_GET_BITS((flags)->flags2, 4)
+// 0 = usable, !0 = unusable
+#define RESTRICTIONS_GET_INV_SONG_OF_TIME(flags) RESTRICTIONS_GET_BITS((flags)->flags2, 2)
+// 0 = usable, !0 = unusable
+#define RESTRICTIONS_GET_SONG_OF_SOARING(flags) RESTRICTIONS_GET_BITS((flags)->flags2, 0)
+// 0 = usable, !0 = unusable
+#define RESTRICTIONS_GET_SONG_OF_STORMS(flags) RESTRICTIONS_GET_BITS((flags)->flags3, 6)
+// 0 = usable, !0 = unusable
+#define RESTRICTIONS_GET_MASKS(flags) RESTRICTIONS_GET_BITS((flags)->flags3, 4)
+// 0 = usable, !0 = unusable
+#define RESTRICTIONS_GET_PICTO_BOX(flags) RESTRICTIONS_GET_BITS((flags)->flags3, 2)
+// 0 = usable, !0 = unusable
+#define RESTRICTIONS_GET_ALL(flags) RESTRICTIONS_GET_BITS((flags)->flags3, 0)
+
+#define RESTRICTIONS_SET(hGauge, bButton, aButton, tradeItems, songOfTime, songOfDoubleTime, invSongOfTime, \
+ songOfSoaring, songOfStorms, masks, pictoBox, all) \
+ ((((hGauge)&3) << 6) | (((bButton)&3) << 4) | (((aButton)&3) << 2) | (((tradeItems)&3) << 0)), \
+ ((((songOfTime)&3) << 6) | (((songOfDoubleTime)&3) << 4) | (((invSongOfTime)&3) << 2) | \
+ (((songOfSoaring)&3) << 0)), \
+ ((((songOfStorms)&3) << 6) | (((masks)&3) << 4) | (((pictoBox)&3) << 2) | (((all)&3) << 0))
+
+// Common patterns
+#define RESTRICTIONS_NONE RESTRICTIONS_SET(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+#define RESTRICTIONS_INDOORS RESTRICTIONS_SET(0, 1, 0, 0, 0, 3, 0, 0, 3, 0, 0, 1)
+#define RESTRICTIONS_MOON RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0)
+#define RESTRICTIONS_NO_DOUBLE_TIME RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0)
+
RestrictionFlags sRestrictionFlags[] = {
- { SCENE_20SICHITAI2, 0x00, 0x00, 0x00 },
- { SCENE_UNSET_1, 0x00, 0x00, 0x00 },
- { SCENE_UNSET_2, 0x00, 0x00, 0x00 },
- { SCENE_UNSET_3, 0x00, 0x00, 0x00 },
- { SCENE_UNSET_4, 0x00, 0x00, 0x00 },
- { SCENE_UNSET_5, 0x00, 0x00, 0x00 },
- { SCENE_UNSET_6, 0x00, 0x00, 0x00 },
- { SCENE_KAKUSIANA, 0x00, 0x00, 0x00 },
- { SCENE_SPOT00, 0x00, 0x00, 0x00 },
- { SCENE_UNSET_9, 0x00, 0x00, 0x00 },
- { SCENE_WITCH_SHOP, 0x10, 0x30, 0xC1 },
- { SCENE_LAST_BS, 0x00, 0x3F, 0x00 },
- { SCENE_HAKASHITA, 0x00, 0x00, 0x00 },
- { SCENE_AYASHIISHOP, 0x10, 0x30, 0xC1 },
- { SCENE_UNSET_E, 0x00, 0x00, 0x00 },
- { SCENE_UNSET_F, 0x00, 0x00, 0x00 },
- { SCENE_OMOYA, 0x00, 0x33, 0x00 },
- { SCENE_BOWLING, 0x10, 0x30, 0xC1 },
- { SCENE_SONCHONOIE, 0x10, 0x30, 0xC1 },
- { SCENE_IKANA, 0x00, 0x00, 0x00 },
- { SCENE_KAIZOKU, 0x00, 0x00, 0x00 },
- { SCENE_MILK_BAR, 0x10, 0x30, 0xC1 },
- { SCENE_INISIE_N, 0x00, 0x00, 0x00 },
- { SCENE_TAKARAYA, 0x10, 0x30, 0xC1 },
- { SCENE_INISIE_R, 0x00, 0x00, 0x00 },
- { SCENE_OKUJOU, 0x00, 0x3F, 0xF0 },
- { SCENE_OPENINGDAN, 0x00, 0x00, 0x00 },
- { SCENE_MITURIN, 0x00, 0x00, 0x00 },
- { SCENE_13HUBUKINOMITI, 0x00, 0x00, 0x00 },
- { SCENE_CASTLE, 0x00, 0x00, 0x00 },
- { SCENE_DEKUTES, 0x10, 0x30, 0x01 },
- { SCENE_MITURIN_BS, 0x00, 0x00, 0x00 },
- { SCENE_SYATEKI_MIZU, 0x10, 0x30, 0xC1 },
- { SCENE_HAKUGIN, 0x00, 0x00, 0x00 },
- { SCENE_ROMANYMAE, 0x00, 0x00, 0x00 },
- { SCENE_PIRATE, 0x00, 0x00, 0x00 },
- { SCENE_SYATEKI_MORI, 0x10, 0x30, 0xC1 },
- { SCENE_SINKAI, 0x00, 0x00, 0x00 },
- { SCENE_YOUSEI_IZUMI, 0x00, 0x00, 0x00 },
- { SCENE_KINSTA1, 0x00, 0x30, 0x00 },
- { SCENE_KINDAN2, 0x00, 0x30, 0x00 },
- { SCENE_TENMON_DAI, 0x00, 0x03, 0xC0 },
- { SCENE_LAST_DEKU, 0x00, 0x3F, 0x00 },
- { SCENE_22DEKUCITY, 0x00, 0x00, 0x00 },
- { SCENE_KAJIYA, 0x00, 0x30, 0xC0 },
- { SCENE_00KEIKOKU, 0x00, 0x00, 0x00 },
- { SCENE_POSTHOUSE, 0x00, 0x30, 0xC1 },
- { SCENE_LABO, 0x00, 0x30, 0xC1 },
- { SCENE_DANPEI2TEST, 0x00, 0x30, 0x00 },
- { SCENE_UNSET_31, 0x00, 0x00, 0x00 },
- { SCENE_16GORON_HOUSE, 0x00, 0x00, 0x00 },
- { SCENE_33ZORACITY, 0x00, 0x00, 0xC0 },
- { SCENE_8ITEMSHOP, 0x00, 0x30, 0xC1 },
- { SCENE_F01, 0x00, 0x00, 0x00 },
- { SCENE_INISIE_BS, 0x00, 0x00, 0x00 },
- { SCENE_30GYOSON, 0x00, 0x00, 0x00 },
- { SCENE_31MISAKI, 0x00, 0x00, 0x00 },
- { SCENE_TAKARAKUJI, 0x00, 0x30, 0xC1 },
- { SCENE_UNSET_3A, 0x00, 0x00, 0x00 },
- { SCENE_TORIDE, 0x00, 0x00, 0x00 },
- { SCENE_FISHERMAN, 0x00, 0x30, 0xC1 },
- { SCENE_GORONSHOP, 0x10, 0x30, 0xC1 },
- { SCENE_DEKU_KING, 0x00, 0x30, 0xC0 },
- { SCENE_LAST_GORON, 0x00, 0x3F, 0x00 },
- { SCENE_24KEMONOMITI, 0x00, 0x00, 0x00 },
- { SCENE_F01_B, 0x00, 0x30, 0x00 },
- { SCENE_F01C, 0x00, 0x30, 0x00 },
- { SCENE_BOTI, 0x00, 0x00, 0x00 },
- { SCENE_HAKUGIN_BS, 0x00, 0x00, 0x00 },
- { SCENE_20SICHITAI, 0x00, 0x00, 0x00 },
- { SCENE_21MITURINMAE, 0x00, 0x00, 0x00 },
- { SCENE_LAST_ZORA, 0x00, 0x3F, 0x00 },
- { SCENE_11GORONNOSATO2, 0x00, 0x00, 0x00 },
- { SCENE_SEA, 0x00, 0x00, 0x00 },
- { SCENE_35TAKI, 0x00, 0x00, 0x00 },
- { SCENE_REDEAD, 0x00, 0x00, 0x00 },
- { SCENE_BANDROOM, 0x00, 0x30, 0xC0 },
- { SCENE_11GORONNOSATO, 0x00, 0x00, 0x00 },
- { SCENE_GORON_HAKA, 0x00, 0x00, 0x00 },
- { SCENE_SECOM, 0x00, 0x3C, 0xC0 },
- { SCENE_10YUKIYAMANOMURA, 0x00, 0x00, 0x00 },
- { SCENE_TOUGITES, 0x00, 0x3F, 0xF0 },
- { SCENE_DANPEI, 0x00, 0x30, 0x00 },
- { SCENE_IKANAMAE, 0x00, 0x00, 0x00 },
- { SCENE_DOUJOU, 0x00, 0x30, 0xC1 },
- { SCENE_MUSICHOUSE, 0x00, 0x30, 0xC0 },
- { SCENE_IKNINSIDE, 0x00, 0x3F, 0xC0 },
- { SCENE_MAP_SHOP, 0x10, 0x30, 0xC1 },
- { SCENE_F40, 0x00, 0x00, 0x00 },
- { SCENE_F41, 0x00, 0x00, 0x00 },
- { SCENE_10YUKIYAMANOMURA2, 0x00, 0x00, 0x00 },
- { SCENE_14YUKIDAMANOMITI, 0x00, 0x00, 0x00 },
- { SCENE_12HAKUGINMAE, 0x00, 0x00, 0x00 },
- { SCENE_17SETUGEN, 0x00, 0x00, 0x00 },
- { SCENE_17SETUGEN2, 0x00, 0x00, 0x00 },
- { SCENE_SEA_BS, 0x00, 0x00, 0x00 },
- { SCENE_RANDOM, 0x00, 0x00, 0x00 },
- { SCENE_YADOYA, 0x10, 0x30, 0xC1 },
- { SCENE_KONPEKI_ENT, 0x00, 0x00, 0x00 },
- { SCENE_INSIDETOWER, 0x00, 0xFF, 0xC0 },
- { SCENE_26SARUNOMORI, 0x00, 0x30, 0x00 },
- { SCENE_LOST_WOODS, 0x00, 0x00, 0x00 },
- { SCENE_LAST_LINK, 0x00, 0x3F, 0x00 },
- { SCENE_SOUGEN, 0x00, 0x3F, 0x00 },
- { SCENE_BOMYA, 0x10, 0x30, 0xC1 },
- { SCENE_KYOJINNOMA, 0x00, 0x00, 0x00 },
- { SCENE_KOEPONARACE, 0x00, 0x30, 0x00 },
- { SCENE_GORONRACE, 0x00, 0x00, 0x00 },
- { SCENE_TOWN, 0x00, 0x00, 0x00 },
- { SCENE_ICHIBA, 0x00, 0x00, 0x00 },
- { SCENE_BACKTOWN, 0x00, 0x00, 0x00 },
- { SCENE_CLOCKTOWER, 0x00, 0x00, 0x00 },
- { SCENE_ALLEY, 0x00, 0x00, 0x00 },
+ { SCENE_20SICHITAI2, RESTRICTIONS_NONE },
+ { SCENE_UNSET_1, RESTRICTIONS_NONE },
+ { SCENE_UNSET_2, RESTRICTIONS_NONE },
+ { SCENE_UNSET_3, RESTRICTIONS_NONE },
+ { SCENE_UNSET_4, RESTRICTIONS_NONE },
+ { SCENE_UNSET_5, RESTRICTIONS_NONE },
+ { SCENE_UNSET_6, RESTRICTIONS_NONE },
+ { SCENE_KAKUSIANA, RESTRICTIONS_NONE },
+ { SCENE_SPOT00, RESTRICTIONS_NONE },
+ { SCENE_UNSET_9, RESTRICTIONS_NONE },
+ { SCENE_WITCH_SHOP, RESTRICTIONS_INDOORS },
+ { SCENE_LAST_BS, RESTRICTIONS_MOON },
+ { SCENE_HAKASHITA, RESTRICTIONS_NONE },
+ { SCENE_AYASHIISHOP, RESTRICTIONS_INDOORS },
+ { SCENE_UNSET_E, RESTRICTIONS_NONE },
+ { SCENE_UNSET_F, RESTRICTIONS_NONE },
+ { SCENE_OMOYA, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 0, 3, 0, 0, 0, 0) },
+ { SCENE_BOWLING, RESTRICTIONS_INDOORS },
+ { SCENE_SONCHONOIE, RESTRICTIONS_INDOORS },
+ { SCENE_IKANA, RESTRICTIONS_NONE },
+ { SCENE_KAIZOKU, RESTRICTIONS_NONE },
+ { SCENE_MILK_BAR, RESTRICTIONS_INDOORS },
+ { SCENE_INISIE_N, RESTRICTIONS_NONE },
+ { SCENE_TAKARAYA, RESTRICTIONS_INDOORS },
+ { SCENE_INISIE_R, RESTRICTIONS_NONE },
+ { SCENE_OKUJOU, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 0, 0) },
+ { SCENE_OPENINGDAN, RESTRICTIONS_NONE },
+ { SCENE_MITURIN, RESTRICTIONS_NONE },
+ { SCENE_13HUBUKINOMITI, RESTRICTIONS_NONE },
+ { SCENE_CASTLE, RESTRICTIONS_NONE },
+ { SCENE_DEKUTES, RESTRICTIONS_SET(0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1) },
+ { SCENE_MITURIN_BS, RESTRICTIONS_NONE },
+ { SCENE_SYATEKI_MIZU, RESTRICTIONS_INDOORS },
+ { SCENE_HAKUGIN, RESTRICTIONS_NONE },
+ { SCENE_ROMANYMAE, RESTRICTIONS_NONE },
+ { SCENE_PIRATE, RESTRICTIONS_NONE },
+ { SCENE_SYATEKI_MORI, RESTRICTIONS_INDOORS },
+ { SCENE_SINKAI, RESTRICTIONS_NONE },
+ { SCENE_YOUSEI_IZUMI, RESTRICTIONS_NONE },
+ { SCENE_KINSTA1, RESTRICTIONS_NO_DOUBLE_TIME },
+ { SCENE_KINDAN2, RESTRICTIONS_NO_DOUBLE_TIME },
+ { SCENE_TENMON_DAI, RESTRICTIONS_SET(0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0) },
+ { SCENE_LAST_DEKU, RESTRICTIONS_MOON },
+ { SCENE_22DEKUCITY, RESTRICTIONS_NONE },
+ { SCENE_KAJIYA, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 0) },
+ { SCENE_00KEIKOKU, RESTRICTIONS_NONE },
+ { SCENE_POSTHOUSE, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 1) },
+ { SCENE_LABO, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 1) },
+ { SCENE_DANPEI2TEST, RESTRICTIONS_NO_DOUBLE_TIME },
+ { SCENE_UNSET_31, RESTRICTIONS_NONE },
+ { SCENE_16GORON_HOUSE, RESTRICTIONS_NONE },
+ { SCENE_33ZORACITY, RESTRICTIONS_SET(0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0) },
+ { SCENE_8ITEMSHOP, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 1) },
+ { SCENE_F01, RESTRICTIONS_NONE },
+ { SCENE_INISIE_BS, RESTRICTIONS_NONE },
+ { SCENE_30GYOSON, RESTRICTIONS_NONE },
+ { SCENE_31MISAKI, RESTRICTIONS_NONE },
+ { SCENE_TAKARAKUJI, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 1) },
+ { SCENE_UNSET_3A, RESTRICTIONS_NONE },
+ { SCENE_TORIDE, RESTRICTIONS_NONE },
+ { SCENE_FISHERMAN, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 1) },
+ { SCENE_GORONSHOP, RESTRICTIONS_INDOORS },
+ { SCENE_DEKU_KING, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 0) },
+ { SCENE_LAST_GORON, RESTRICTIONS_MOON },
+ { SCENE_24KEMONOMITI, RESTRICTIONS_NONE },
+ { SCENE_F01_B, RESTRICTIONS_NO_DOUBLE_TIME },
+ { SCENE_F01C, RESTRICTIONS_NO_DOUBLE_TIME },
+ { SCENE_BOTI, RESTRICTIONS_NONE },
+ { SCENE_HAKUGIN_BS, RESTRICTIONS_NONE },
+ { SCENE_20SICHITAI, RESTRICTIONS_NONE },
+ { SCENE_21MITURINMAE, RESTRICTIONS_NONE },
+ { SCENE_LAST_ZORA, RESTRICTIONS_MOON },
+ { SCENE_11GORONNOSATO2, RESTRICTIONS_NONE },
+ { SCENE_SEA, RESTRICTIONS_NONE },
+ { SCENE_35TAKI, RESTRICTIONS_NONE },
+ { SCENE_REDEAD, RESTRICTIONS_NONE },
+ { SCENE_BANDROOM, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 0) },
+ { SCENE_11GORONNOSATO, RESTRICTIONS_NONE },
+ { SCENE_GORON_HAKA, RESTRICTIONS_NONE },
+ { SCENE_SECOM, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 3, 0, 3, 0, 0, 0) },
+ { SCENE_10YUKIYAMANOMURA, RESTRICTIONS_NONE },
+ { SCENE_TOUGITES, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 0, 0) },
+ { SCENE_DANPEI, RESTRICTIONS_NO_DOUBLE_TIME },
+ { SCENE_IKANAMAE, RESTRICTIONS_NONE },
+ { SCENE_DOUJOU, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 1) },
+ { SCENE_MUSICHOUSE, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 0) },
+ { SCENE_IKNINSIDE, RESTRICTIONS_SET(0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0) },
+ { SCENE_MAP_SHOP, RESTRICTIONS_INDOORS },
+ { SCENE_F40, RESTRICTIONS_NONE },
+ { SCENE_F41, RESTRICTIONS_NONE },
+ { SCENE_10YUKIYAMANOMURA2, RESTRICTIONS_NONE },
+ { SCENE_14YUKIDAMANOMITI, RESTRICTIONS_NONE },
+ { SCENE_12HAKUGINMAE, RESTRICTIONS_NONE },
+ { SCENE_17SETUGEN, RESTRICTIONS_NONE },
+ { SCENE_17SETUGEN2, RESTRICTIONS_NONE },
+ { SCENE_SEA_BS, RESTRICTIONS_NONE },
+ { SCENE_RANDOM, RESTRICTIONS_NONE },
+ { SCENE_YADOYA, RESTRICTIONS_INDOORS },
+ { SCENE_KONPEKI_ENT, RESTRICTIONS_NONE },
+ { SCENE_INSIDETOWER, RESTRICTIONS_SET(0, 0, 0, 0, 3, 3, 3, 3, 3, 0, 0, 0) },
+ { SCENE_26SARUNOMORI, RESTRICTIONS_NO_DOUBLE_TIME },
+ { SCENE_LOST_WOODS, RESTRICTIONS_NONE },
+ { SCENE_LAST_LINK, RESTRICTIONS_MOON },
+ { SCENE_SOUGEN, RESTRICTIONS_MOON },
+ { SCENE_BOMYA, RESTRICTIONS_INDOORS },
+ { SCENE_KYOJINNOMA, RESTRICTIONS_NONE },
+ { SCENE_KOEPONARACE, RESTRICTIONS_NO_DOUBLE_TIME },
+ { SCENE_GORONRACE, RESTRICTIONS_NONE },
+ { SCENE_TOWN, RESTRICTIONS_NONE },
+ { SCENE_ICHIBA, RESTRICTIONS_NONE },
+ { SCENE_BACKTOWN, RESTRICTIONS_NONE },
+ { SCENE_CLOCKTOWER, RESTRICTIONS_NONE },
+ { SCENE_ALLEY, RESTRICTIONS_NONE },
+ // { RESTRICTIONS_TABLE_END, RESTRICTIONS_NONE }, // See note below
};
+//! @note: in `Interface_SetSceneRestrictions`, `RESTRICTIONS_TABLE_END` act as a terminating value to
+// stop looping through the array. If a scene is missing, then this will cause issues.
-s16 D_801BF884 = 0; // pictoBox related
-s16 D_801BF888 = false; // pictoBox related
+s16 sPictoState = PICTO_BOX_STATE_OFF;
+s16 sPictoPhotoBeingTaken = false;
s16 sHBAScoreTier = 0; // Remnant of OoT, non-functional
@@ -170,7 +222,7 @@ s16 sExtraItemBases[] = {
ITEM_NUT, // ITEM_NUT_UPGRADE_30
};
-s16 sEnvTimerType = PLAYER_ENV_TIMER_NONE;
+s16 sEnvHazard = PLAYER_ENV_HAZARD_NONE;
s16 sEnvTimerActive = false;
s16 sPostmanBunnyHoodState = POSTMAN_MINIGAME_BUNNY_HOOD_OFF;
OSTime sTimerPausedOsTime = 0;
@@ -191,7 +243,7 @@ s16 D_801BF97C = 255;
f32 D_801BF980 = 1.0f;
s32 D_801BF984 = 0;
-Gfx D_801BF988[] = {
+Gfx sScreenFillSetupDL[] = {
gsDPPipeSync(),
gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN |
G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH),
@@ -1722,11 +1774,37 @@ void Interface_UpdateHudAlphas(PlayState* play, s16 dimmingAlpha) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80110038.s")
+void func_80111CB4(PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80111CB4.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_801129E4.s")
+void Interface_SetSceneRestrictions(PlayState* play) {
+ InterfaceContext* interfaceCtx = &play->interfaceCtx;
+ s16 i = 0;
+ u8 currentScene;
+
+ do {
+ currentScene = (u8)play->sceneId;
+ if (currentScene == sRestrictionFlags[i].scene) {
+ interfaceCtx->restrictions.hGauge = RESTRICTIONS_GET_HGAUGE(&sRestrictionFlags[i]);
+ interfaceCtx->restrictions.bButton = RESTRICTIONS_GET_B_BUTTON(&sRestrictionFlags[i]);
+ interfaceCtx->restrictions.aButton = RESTRICTIONS_GET_A_BUTTON(&sRestrictionFlags[i]);
+ interfaceCtx->restrictions.tradeItems = RESTRICTIONS_GET_TRADE_ITEMS(&sRestrictionFlags[i]);
+ interfaceCtx->restrictions.songOfTime = RESTRICTIONS_GET_SONG_OF_TIME(&sRestrictionFlags[i]);
+ interfaceCtx->restrictions.songOfDoubleTime = RESTRICTIONS_GET_SONG_OF_DOUBLE_TIME(&sRestrictionFlags[i]);
+ interfaceCtx->restrictions.invSongOfTime = RESTRICTIONS_GET_INV_SONG_OF_TIME(&sRestrictionFlags[i]);
+ interfaceCtx->restrictions.songOfSoaring = RESTRICTIONS_GET_SONG_OF_SOARING(&sRestrictionFlags[i]);
+ interfaceCtx->restrictions.songOfStorms = RESTRICTIONS_GET_SONG_OF_STORMS(&sRestrictionFlags[i]);
+ interfaceCtx->restrictions.masks = RESTRICTIONS_GET_MASKS(&sRestrictionFlags[i]);
+ interfaceCtx->restrictions.pictoBox = RESTRICTIONS_GET_PICTO_BOX(&sRestrictionFlags[i]);
+ interfaceCtx->restrictions.all = RESTRICTIONS_GET_ALL(&sRestrictionFlags[i]);
+ break;
+ }
+ i++;
+ } while (sRestrictionFlags[i].scene != RESTRICTIONS_TABLE_END);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80112AF4.s")
+void Interface_Noop(void) {
+}
void Interface_InitMinigame(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
@@ -1797,7 +1875,7 @@ u8 Item_Give(PlayState* play, u8 item) {
} else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_GILDED)) {
SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, item - ITEM_SWORD_KOKIRI + EQUIP_VALUE_SWORD_KOKIRI);
- BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = item;
+ CUR_FORM_EQUIP(EQUIP_SLOT_B) = item;
Interface_LoadItemIconImpl(play, EQUIP_SLOT_B);
if (item == ITEM_SWORD_RAZOR) {
gSaveContext.save.playerData.swordHealth = 100;
@@ -2391,12 +2469,12 @@ void Inventory_UpdateDeitySwordEquip(PlayState* play) {
if ((((gSaveContext.save.playerForm > 0) && (gSaveContext.save.playerForm < 4))
? 1
: gSaveContext.save.playerForm >> 1) == 0) {
- BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_SWORD_DEITY;
- } else if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_SWORD_DEITY) {
+ CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_SWORD_DEITY;
+ } else if (CUR_FORM_EQUIP(EQUIP_SLOT_B) == ITEM_SWORD_DEITY) {
if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_NONE) {
- BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NONE;
+ CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE;
} else {
- BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) =
+ CUR_FORM_EQUIP(EQUIP_SLOT_B) =
GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) - EQUIP_VALUE_SWORD_KOKIRI + ITEM_SWORD_KOKIRI;
}
}
@@ -2492,6 +2570,7 @@ TexturePtr sDoActionTextures[] = {
gDoActionCheckENGTex,
};
+void func_80115428(InterfaceContext* interfaceCtx, u16 doAction, s16 loadOffset);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80115428.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011552C.s")
@@ -2639,8 +2718,7 @@ s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) {
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
play->actorCtx.lensActive = false;
}
- if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
- // Drank Chateau Romani
+ if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
magicToConsume = 0;
}
gSaveContext.magicToConsume = magicToConsume;
@@ -2659,8 +2737,7 @@ s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) {
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
play->actorCtx.lensActive = false;
}
- if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
- // Drank Chateau Romani
+ if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
magicToConsume = 0;
}
gSaveContext.magicToConsume = magicToConsume;
@@ -2736,8 +2813,7 @@ s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) {
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
play->actorCtx.lensActive = false;
}
- if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
- // Drank Chateau Romani
+ if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
magicToConsume = 0;
}
gSaveContext.save.playerData.magic -= magicToConsume;
@@ -2825,8 +2901,7 @@ void Magic_Update(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
s16 magicCapacityTarget;
- if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
- // Drank Chateau Romani
+ if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
Magic_FlashMeterBorder();
}
@@ -2876,7 +2951,7 @@ void Magic_Update(PlayState* play) {
case MAGIC_STATE_CONSUME:
// Consume magic until target is reached or no more magic is available
- if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
+ if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
gSaveContext.save.playerData.magic =
((void)0, gSaveContext.save.playerData.magic) - ((void)0, gSaveContext.magicToConsume);
if (gSaveContext.save.playerData.magic <= 0) {
@@ -2889,7 +2964,7 @@ void Magic_Update(PlayState* play) {
case MAGIC_STATE_METER_FLASH_1:
case MAGIC_STATE_METER_FLASH_2:
case MAGIC_STATE_METER_FLASH_3:
- if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
+ if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
Magic_FlashMeterBorder();
}
break;
@@ -2907,8 +2982,8 @@ void Magic_Update(PlayState* play) {
!Play_InCsMode(play)) {
if ((gSaveContext.save.playerData.magic == 0) ||
- ((Player_GetEnvTimerType(play) >= PLAYER_ENV_TIMER_UNDERWATER_FLOOR) &&
- (Player_GetEnvTimerType(play) <= PLAYER_ENV_TIMER_UNDERWATER_FREE)) ||
+ ((Player_GetEnvironmentalHazard(play) >= PLAYER_ENV_HAZARD_UNDERWATER_FLOOR) &&
+ (Player_GetEnvironmentalHazard(play) <= PLAYER_ENV_HAZARD_UNDERWATER_FREE)) ||
((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) != ITEM_LENS) &&
(BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) != ITEM_LENS) &&
(BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) != ITEM_LENS)) ||
@@ -2923,19 +2998,19 @@ void Magic_Update(PlayState* play) {
interfaceCtx->magicConsumptionTimer--;
if (interfaceCtx->magicConsumptionTimer == 0) {
- if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
+ if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
gSaveContext.save.playerData.magic--;
}
interfaceCtx->magicConsumptionTimer = 80;
}
}
- if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
+ if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
Magic_FlashMeterBorder();
}
break;
case MAGIC_STATE_CONSUME_GORON_ZORA_SETUP:
- if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
+ if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
gSaveContext.save.playerData.magic -= 2;
}
if (gSaveContext.save.playerData.magic <= 0) {
@@ -2950,7 +3025,7 @@ void Magic_Update(PlayState* play) {
if (!Play_InCsMode(play)) {
interfaceCtx->magicConsumptionTimer--;
if (interfaceCtx->magicConsumptionTimer == 0) {
- if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
+ if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
gSaveContext.save.playerData.magic--;
}
if (gSaveContext.save.playerData.magic <= 0) {
@@ -2960,7 +3035,7 @@ void Magic_Update(PlayState* play) {
}
}
}
- if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
+ if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
Magic_FlashMeterBorder();
}
break;
@@ -2972,7 +3047,7 @@ void Magic_Update(PlayState* play) {
if (!Play_InCsMode(play)) {
interfaceCtx->magicConsumptionTimer--;
if (interfaceCtx->magicConsumptionTimer == 0) {
- if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
+ if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
gSaveContext.save.playerData.magic--;
}
if (gSaveContext.save.playerData.magic <= 0) {
@@ -2982,7 +3057,7 @@ void Magic_Update(PlayState* play) {
}
}
}
- if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
+ if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
Magic_FlashMeterBorder();
}
break;
@@ -3038,8 +3113,8 @@ void Magic_DrawMeter(PlayState* play) {
// Fill the rest of the meter with the normal magic color
gDPPipeSync(OVERLAY_DISP++);
- if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
- // Blue magic (drank Chateau Romani)
+ if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
+ // Blue magic
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 200, interfaceCtx->magicAlpha);
} else {
// Green magic (default)
@@ -3052,8 +3127,8 @@ void Magic_DrawMeter(PlayState* play) {
(magicBarY + 10) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
} else {
// Fill the whole meter with the normal magic color
- if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) {
- // Blue magic (drank Chateau Romani)
+ if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
+ // Blue magic
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 200, interfaceCtx->magicAlpha);
} else {
// Green magic (default)
@@ -3073,6 +3148,7 @@ void Magic_DrawMeter(PlayState* play) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80116FD8.s")
+void func_801170B8(InterfaceContext* interfaceCtx);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_801170B8.s")
TexturePtr cUpLabelTextures[] = {
@@ -3085,6 +3161,7 @@ s16 startButtonLeftPos[] = {
s16 D_801BFAF4[] = { 0x1D, 0x1B };
s16 D_801BFAF8[] = { 0x1B, 0x1B };
+void func_80117100(PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80117100.s")
s16 D_801BFAFC[] = { 30, 24, 24, 24 };
@@ -3096,10 +3173,13 @@ s16 D_801BFB0C[] = { 0x23, 0x23, 0x33, 0x23 };
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80117BD0.s")
+void func_80118084(PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80118084.s")
+void func_80118890(PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80118890.s")
+void func_80118BA4(PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80118BA4.s")
extern TexturePtr D_08095AC0; // gMagicArrowEquipEffectTex
@@ -3107,6 +3187,7 @@ s16 D_801BFB14[] = { 255, 100, 255, 0 }; // magicArrowEffectsR
s16 D_801BFB1C[] = { 0, 100, 255, 0 }; // magicArrowEffectsG
s16 D_801BFB24[] = { 0, 255, 100, 0 }; // magicArrowEffectsB
+void func_80119030(PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80119030.s")
/**
@@ -4183,7 +4264,7 @@ void Interface_UpdatePerfectLettersType3(PlayState* play) {
}
}
-TexturePtr sPerfectLettersTextures[] = {
+TexturePtr sPerfectLettersTextures[PERFECT_LETTERS_NUM_LETTERS] = {
gPerfectLetterPTex, gPerfectLetterETex, gPerfectLetterRTex, gPerfectLetterFTex,
gPerfectLetterETex, gPerfectLetterCTex, gPerfectLetterTTex, gPerfectLetterExclamationTex,
};
@@ -4306,7 +4387,7 @@ void Interface_DrawTimers(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
Player* player = GET_PLAYER(play);
OSTime osTime;
- OSTime timerOsTime;
+ OSTime postmanTimerStopOsTime;
s16 j;
s16 i;
@@ -4356,10 +4437,10 @@ void Interface_DrawTimers(PlayState* play) {
break;
case TIMER_STATE_POSTMAN_STOP:
- timerOsTime = gSaveContext.postmanTimerStopOsTime;
- gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] =
- OSTIME_TO_TIMER(timerOsTime - ((void)0, gSaveContext.timerStartOsTimes[TIMER_ID_POSTMAN]) -
- ((void)0, gSaveContext.timerPausedOsTimes[TIMER_ID_POSTMAN]));
+ postmanTimerStopOsTime = gSaveContext.postmanTimerStopOsTime;
+ gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] = OSTIME_TO_TIMER(
+ postmanTimerStopOsTime - ((void)0, gSaveContext.timerStartOsTimes[TIMER_ID_POSTMAN]) -
+ ((void)0, gSaveContext.timerPausedOsTimes[TIMER_ID_POSTMAN]));
gSaveContext.timerStates[TIMER_ID_POSTMAN] = TIMER_STATE_POSTMAN_END;
func_80174F9C(Interface_PostmanTimerCallback, NULL);
break;
@@ -4480,7 +4561,7 @@ void Interface_DrawTimers(PlayState* play) {
gSaveContext.timerStates[sTimerId] = TIMER_STATE_COUNTING;
break;
- case TIMER_STATE_ENV_START:
+ case TIMER_STATE_ENV_HAZARD_START:
gSaveContext.timerCurTimes[sTimerId] = SECONDS_TO_TIMER(gSaveContext.save.playerData.health >> 1);
gSaveContext.timerDirections[sTimerId] = TIMER_COUNT_DOWN;
gSaveContext.timerTimeLimits[sTimerId] = gSaveContext.timerCurTimes[sTimerId];
@@ -4687,7 +4768,7 @@ void Interface_DrawTimers(PlayState* play) {
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255);
}
- } else if ((gSaveContext.minigameStatus == 1) &&
+ } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) &&
(gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0))) {
if (gSaveContext.timerCurTimes[sTimerId] >= SECONDS_TO_TIMER(110)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 50, 0, 255);
@@ -4834,9 +4915,9 @@ void Interface_DrawMinigameIcons(PlayState* play) {
func_8012C654(play->state.gfxCtx);
- if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) {
+ if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) {
// Carrots rendering if the action corresponds to riding a horse
- if (interfaceCtx->unk_212 == 8) {
+ if (interfaceCtx->unk_212 == DO_ACTION_FASTER) {
// Load Carrot Icon
gDPLoadTextureBlock(OVERLAY_DISP++, gCarrotIconTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 16, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
@@ -4937,64 +5018,1080 @@ void Interface_DrawMinigameIcons(PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx);
}
-// rupeeDigitsFirst
-s16 D_801BFD1C[] = { 1, 0, 0, 0 };
-// rupeeDigitsCount
-s16 D_801BFD24[] = { 2, 3, 3, 0 };
-// rupeeIconPrimColor
-Color_RGB16 D_801BFD2C[] = {
+s16 sRupeeDigitsFirst[] = { 1, 0, 0, 0 };
+
+s16 sRupeeDigitsCount[] = { 2, 3, 3, 0 };
+
+Color_RGB16 sRupeeCounterIconPrimColors[] = {
{ 200, 255, 100 },
{ 170, 170, 255 },
{ 255, 105, 105 },
};
-// rupeeIconEnvColor
-Color_RGB16 D_801BFD40[] = {
+
+Color_RGB16 sRupeeCounterIconEnvColors[] = {
{ 0, 80, 0 },
{ 10, 10, 80 },
{ 40, 10, 0 },
};
-// minigameCountdownTexs
-TexturePtr D_801BFD54[] = {
+
+TexturePtr sMinigameCountdownTextures[] = {
gMinigameCountdown3Tex,
gMinigameCountdown2Tex,
gMinigameCountdown1Tex,
gMinigameCountdownGoTex,
};
-// minigameCountdownTexHeights
-s16 D_801BFD64[] = { 24, 24, 24, 40 };
-// minigameCountdownPrimColor
-Color_RGB16 D_801BFD6C[] = {
+
+s16 sMinigameCountdownTexWidths[] = { 24, 24, 24, 40 };
+
+Color_RGB16 sMinigameCountdownPrimColors[] = {
{ 100, 255, 100 },
{ 255, 255, 60 },
{ 255, 100, 0 },
{ 120, 170, 255 },
};
-// grandma's story pictures
-TexturePtr D_801BFD84[] = {
+
+TexturePtr sStoryTextures[] = {
gStoryMaskFestivalTex,
gStoryGiantsLeavingTex,
};
-// grandma's story TLUT
-TexturePtr D_801BFD8C[] = {
+
+TexturePtr sStoryTLUTs[] = {
gStoryMaskFestivalTLUT,
gStoryGiantsLeavingTLUT,
};
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_Draw.s")
+void Interface_Draw(PlayState* play) {
+ s32 pad;
+ InterfaceContext* interfaceCtx = &play->interfaceCtx;
+ Player* player = GET_PLAYER(play);
+ Gfx* gfx;
+ s16 sp2CE;
+ s16 sp2CC;
+ s16 sp2CA;
+ s16 sp2C8;
+ PauseContext* pauseCtx = &play->pauseCtx;
+ f32 minigameCountdownScale;
+ s16 counterDigits[4];
+ s16 magicAlpha;
+
+ OPEN_DISPS(play->state.gfxCtx);
+
+ gSPSegment(OVERLAY_DISP++, 0x02, interfaceCtx->parameterSegment);
+ gSPSegment(OVERLAY_DISP++, 0x09, interfaceCtx->doActionSegment);
+ gSPSegment(OVERLAY_DISP++, 0x08, interfaceCtx->iconItemSegment);
+ gSPSegment(OVERLAY_DISP++, 0x0B, interfaceCtx->mapSegment);
+
+ if (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) {
+ Interface_SetVertices(play);
+ func_801170B8(interfaceCtx);
+
+ // Draw Grandma's Story
+ if (interfaceCtx->storyDmaStatus == STORY_DMA_DONE) {
+ gSPSegment(OVERLAY_DISP++, 0x07, interfaceCtx->storySegment);
+ func_8012C628(play->state.gfxCtx);
+
+ gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
+
+ // Load in Grandma's Story
+ gSPLoadUcodeL(OVERLAY_DISP++, gspS2DEX2_fifo);
+ gfx = OVERLAY_DISP;
+ func_80172758(&gfx, sStoryTextures[interfaceCtx->storyType], sStoryTLUTs[interfaceCtx->storyType],
+ SCREEN_WIDTH, SCREEN_HEIGHT, 2, 1, 0x8000, 0x100, 0.0f, 0.0f, 1.0f, 1.0f, 0);
+ OVERLAY_DISP = gfx;
+ gSPLoadUcode(OVERLAY_DISP++, SysUcode_GetUCode(), SysUcode_GetUCodeData());
+
+ gDPPipeSync(OVERLAY_DISP++);
+
+ // Fill the screen with a black rectangle
+ gDPSetRenderMode(OVERLAY_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
+ gDPSetCombineMode(OVERLAY_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, R_STORY_FILL_SCREEN_ALPHA);
+ gDPFillRectangle(OVERLAY_DISP++, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ }
+
+ LifeMeter_Draw(play);
+
+ func_8012C654(play->state.gfxCtx);
+
+ // Draw Rupee Icon
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sRupeeCounterIconPrimColors[CUR_UPG_VALUE(UPG_WALLET)].r,
+ sRupeeCounterIconPrimColors[CUR_UPG_VALUE(UPG_WALLET)].g,
+ sRupeeCounterIconPrimColors[CUR_UPG_VALUE(UPG_WALLET)].b, interfaceCtx->magicAlpha);
+ gDPSetEnvColor(OVERLAY_DISP++, sRupeeCounterIconEnvColors[CUR_UPG_VALUE(UPG_WALLET)].r,
+ sRupeeCounterIconEnvColors[CUR_UPG_VALUE(UPG_WALLET)].g,
+ sRupeeCounterIconEnvColors[CUR_UPG_VALUE(UPG_WALLET)].b, 255);
+ OVERLAY_DISP =
+ Gfx_DrawTexRectIA8(OVERLAY_DISP, gRupeeCounterIconTex, 16, 16, 26, 206, 16, 16, 1 << 10, 1 << 10);
+
+ switch (play->sceneId) {
+ case SCENE_INISIE_N:
+ case SCENE_INISIE_R:
+ case SCENE_MITURIN:
+ case SCENE_HAKUGIN:
+ case SCENE_SEA:
+ if (DUNGEON_KEY_COUNT(gSaveContext.mapIndex) >= 0) {
+ // Small Key Icon
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 230, 255, interfaceCtx->magicAlpha);
+ gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 20, 255);
+ OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, gSmallKeyCounterIconTex, 16, 16, 26, 190, 16, 16,
+ 1 << 10, 1 << 10);
+
+ // Small Key Counter
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE,
+ TEXEL0, 0, PRIMITIVE, 0);
+
+ counterDigits[2] = 0;
+ counterDigits[3] = DUNGEON_KEY_COUNT(gSaveContext.mapIndex);
+
+ while (counterDigits[3] >= 10) {
+ counterDigits[2]++;
+ counterDigits[3] -= 10;
+ }
+
+ sp2CA = 42;
+
+ if (counterDigits[2] != 0) {
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->magicAlpha);
+
+ OVERLAY_DISP =
+ Gfx_DrawTexRectI8(OVERLAY_DISP, (u8*)gCounterDigit0Tex + (8 * 16 * counterDigits[2]), 8, 16,
+ 43, 191, 8, 16, 1 << 10, 1 << 10);
+
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
+ gSPTextureRectangle(OVERLAY_DISP++, 168, 760, 200, 824, G_TX_RENDERTILE, 0, 0, 1 << 10,
+ 1 << 10);
+
+ sp2CA += 8;
+ }
+
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->magicAlpha);
+
+ OVERLAY_DISP = Gfx_DrawTexRectI8(OVERLAY_DISP, (u8*)gCounterDigit0Tex + (8 * 16 * counterDigits[3]),
+ 8, 16, sp2CA + 1, 191, 8, 16, 1 << 10, 1 << 10);
+
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
+ gSPTextureRectangle(OVERLAY_DISP++, sp2CA * 4, 760, (sp2CA * 4) + 0x20, 824, G_TX_RENDERTILE, 0, 0,
+ 1 << 10, 1 << 10);
+ }
+ break;
+
+ case SCENE_KINSTA1:
+ case SCENE_KINDAN2:
+ // Gold Skulltula Icon
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
+ gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255);
+ gDPLoadTextureBlock(OVERLAY_DISP++, gGoldSkulltulaCounterIconTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 24, 24,
+ 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);
+ gSPTextureRectangle(OVERLAY_DISP++, 80, 748, 176, 820, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
+
+ // Gold Skulluta Counter
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE,
+ TEXEL0, 0, PRIMITIVE, 0);
+
+ counterDigits[2] = 0;
+ counterDigits[3] = Inventory_GetSkullTokenCount(play->sceneId);
+
+ while (counterDigits[3] >= 10) {
+ counterDigits[2]++;
+ counterDigits[3] -= 10;
+ }
+
+ sp2CA = 42;
+
+ if (counterDigits[2] != 0) {
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->magicAlpha);
+
+ OVERLAY_DISP = Gfx_DrawTexRectI8(OVERLAY_DISP, (u8*)gCounterDigit0Tex + (8 * 16 * counterDigits[2]),
+ 8, 16, 43, 191, 8, 16, 1 << 10, 1 << 10);
+
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
+ gSPTextureRectangle(OVERLAY_DISP++, 168, 760, 200, 824, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
+
+ sp2CA += 8;
+ }
+
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->magicAlpha);
+
+ OVERLAY_DISP = Gfx_DrawTexRectI8(OVERLAY_DISP, (u8*)gCounterDigit0Tex + (8 * 16 * counterDigits[3]), 8,
+ 16, sp2CA + 1, 191, 8, 16, 1 << 10, 1 << 10);
+
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
+ gSPTextureRectangle(OVERLAY_DISP++, sp2CA * 4, 760, (sp2CA * 4) + 0x20, 824, G_TX_RENDERTILE, 0, 0,
+ 1 << 10, 1 << 10);
+ break;
+
+ default:
+ break;
+ }
+
+ // Rupee Counter
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0,
+ PRIMITIVE, 0);
+
+ counterDigits[0] = counterDigits[1] = 0;
+ counterDigits[2] = gSaveContext.save.playerData.rupees;
+
+ if ((counterDigits[2] > 9999) || (counterDigits[2] < 0)) {
+ counterDigits[2] &= 0xDDD;
+ }
+
+ while (counterDigits[2] >= 100) {
+ counterDigits[0]++;
+ counterDigits[2] -= 100;
+ }
+
+ while (counterDigits[2] >= 10) {
+ counterDigits[1]++;
+ counterDigits[2] -= 10;
+ }
+
+ sp2CC = sRupeeDigitsFirst[CUR_UPG_VALUE(UPG_WALLET)];
+ sp2C8 = sRupeeDigitsCount[CUR_UPG_VALUE(UPG_WALLET)];
+
+ magicAlpha = interfaceCtx->magicAlpha;
+ if (magicAlpha > 180) {
+ magicAlpha = 180;
+ }
+
+ for (sp2CE = 0, sp2CA = 42; sp2CE < sp2C8; sp2CE++, sp2CC++, sp2CA += 8) {
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, magicAlpha);
+
+ OVERLAY_DISP = Gfx_DrawTexRectI8(OVERLAY_DISP, (u8*)gCounterDigit0Tex + (8 * 16 * counterDigits[sp2CC]), 8,
+ 16, sp2CA + 1, 207, 8, 16, 1 << 10, 1 << 10);
+
+ gDPPipeSync(OVERLAY_DISP++);
+
+ if (gSaveContext.save.playerData.rupees == CUR_CAPACITY(UPG_WALLET)) {
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 255, 0, interfaceCtx->magicAlpha);
+ } else if (gSaveContext.save.playerData.rupees != 0) {
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
+ } else {
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 100, 100, interfaceCtx->magicAlpha);
+ }
+
+ gSPTextureRectangle(OVERLAY_DISP++, sp2CA * 4, 824, (sp2CA * 4) + 0x20, 888, G_TX_RENDERTILE, 0, 0, 1 << 10,
+ 1 << 10);
+ }
+
+ Magic_DrawMeter(play);
+ Minimap_Draw(play);
+
+ if ((R_PAUSE_BG_PRERENDER_STATE != 2) && (R_PAUSE_BG_PRERENDER_STATE != 3)) {
+ Actor_DrawZTarget(&play->actorCtx.targetContext, play);
+ }
+
+ func_8012C654(play->state.gfxCtx);
+
+ func_80117100(play);
+
+ if (player->transformation == ((void)0, gSaveContext.save.playerForm)) {
+ func_80118084(play);
+ }
+ func_80118890(play);
+
+ func_80118BA4(play);
+
+ func_80119030(play);
+
+ // Draw either the minigame countdown or the three-day clock
+ if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) {
+ if ((interfaceCtx->minigameState != MINIGAME_STATE_NONE) &&
+ (interfaceCtx->minigameState < MINIGAME_STATE_NO_COUNTDOWN_SETUP)) {
+ // Minigame Countdown
+ if (((u32)interfaceCtx->minigameState % 2) == 0) {
+
+ sp2CE = (interfaceCtx->minigameState >> 1) - 1;
+ minigameCountdownScale = interfaceCtx->minigameCountdownScale / 100.0f;
+
+ if (sp2CE == 3) {
+ interfaceCtx->actionVtx[40 + 0].v.ob[0] = interfaceCtx->actionVtx[40 + 2].v.ob[0] = -20;
+ interfaceCtx->actionVtx[40 + 1].v.ob[0] = interfaceCtx->actionVtx[40 + 3].v.ob[0] =
+ interfaceCtx->actionVtx[40 + 0].v.ob[0] + 40;
+ interfaceCtx->actionVtx[40 + 1].v.tc[0] = interfaceCtx->actionVtx[40 + 3].v.tc[0] = 40 << 5;
+ }
+
+ interfaceCtx->actionVtx[40 + 2].v.tc[1] = interfaceCtx->actionVtx[40 + 3].v.tc[1] = 32 << 5;
+
+ func_8012C8D4(play->state.gfxCtx);
+
+ gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
+ gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sMinigameCountdownPrimColors[sp2CE].r,
+ sMinigameCountdownPrimColors[sp2CE].g, sMinigameCountdownPrimColors[sp2CE].b,
+ interfaceCtx->minigameCountdownAlpha);
+
+ Matrix_Translate(0.0f, -40.0f, 0.0f, MTXMODE_NEW);
+ Matrix_Scale(minigameCountdownScale, minigameCountdownScale, 0.0f, MTXMODE_APPLY);
+
+ gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[40], 4, 0);
+
+ OVERLAY_DISP = Gfx_DrawTexQuadIA8(OVERLAY_DISP, sMinigameCountdownTextures[sp2CE],
+ sMinigameCountdownTexWidths[sp2CE], 32, 0);
+ }
+ } else {
+ Interface_DrawClock(play);
+ }
+ }
+
+ // Draw the letters of minigame perfect
+ if (interfaceCtx->perfectLettersOn) {
+ Interface_DrawPerfectLetters(play);
+ }
+
+ Interface_DrawMinigameIcons(play);
+ Interface_DrawTimers(play);
+ }
+
+ // Draw pictograph focus icons
+ if (sPictoState == PICTO_BOX_STATE_LENS) {
+
+ func_8012C654(play->state.gfxCtx);
+
+ gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD);
+ gDPSetRenderMode(OVERLAY_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
+ gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 155, 255);
+ gDPLoadTextureBlock_4b(OVERLAY_DISP++, gPictoBoxFocusBorderTex, G_IM_FMT_IA, 16, 16, 0, G_TX_MIRROR | G_TX_WRAP,
+ G_TX_MIRROR | G_TX_WRAP, 4, 4, G_TX_NOLOD, G_TX_NOLOD);
+
+ gSPTextureRectangle(OVERLAY_DISP++, R_PICTO_FOCUS_BORDER_TOPLEFT_X << 2, R_PICTO_FOCUS_BORDER_TOPLEFT_Y << 2,
+ (R_PICTO_FOCUS_BORDER_TOPLEFT_X << 2) + (16 << 2),
+ (R_PICTO_FOCUS_BORDER_TOPLEFT_Y << 2) + (16 << 2), G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
+ gSPTextureRectangle(OVERLAY_DISP++, R_PICTO_FOCUS_BORDER_TOPRIGHT_X << 2, R_PICTO_FOCUS_BORDER_TOPRIGHT_Y << 2,
+ (R_PICTO_FOCUS_BORDER_TOPRIGHT_X << 2) + (16 << 2),
+ (R_PICTO_FOCUS_BORDER_TOPRIGHT_Y << 2) + (16 << 2), G_TX_RENDERTILE, 512, 0, 1 << 10,
+ 1 << 10);
+ gSPTextureRectangle(
+ OVERLAY_DISP++, R_PICTO_FOCUS_BORDER_BOTTOMLEFT_X << 2, R_PICTO_FOCUS_BORDER_BOTTOMLEFT_Y << 2,
+ (R_PICTO_FOCUS_BORDER_BOTTOMLEFT_X << 2) + (16 << 2), (R_PICTO_FOCUS_BORDER_BOTTOMLEFT_Y << 2) + (16 << 2),
+ G_TX_RENDERTILE, 0, 512, 1 << 10, 1 << 10);
+ gSPTextureRectangle(
+ OVERLAY_DISP++, R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_X << 2, R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_Y << 2,
+ (R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_X << 2) + (16 << 2),
+ (R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_Y << 2) + (16 << 2), G_TX_RENDERTILE, 512, 512, 1 << 10, 1 << 10);
+
+ gDPLoadTextureBlock_4b(OVERLAY_DISP++, gPictoBoxFocusIconTex, G_IM_FMT_I, 32, 16, 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);
+
+ gSPTextureRectangle(OVERLAY_DISP++, R_PICTO_FOCUS_ICON_X << 2, R_PICTO_FOCUS_ICON_Y << 2,
+ (R_PICTO_FOCUS_ICON_X << 2) + 0x80, (R_PICTO_FOCUS_ICON_Y << 2) + (16 << 2),
+ G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
+
+ gDPLoadTextureBlock_4b(OVERLAY_DISP++, gPictoBoxFocusTextTex, G_IM_FMT_I, 32, 8, 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);
+
+ gSPTextureRectangle(OVERLAY_DISP++, R_PICTO_FOCUS_TEXT_X << 2, R_PICTO_FOCUS_TEXT_Y << 2,
+ (R_PICTO_FOCUS_TEXT_X << 2) + 0x80, (R_PICTO_FOCUS_TEXT_Y << 2) + 0x20, G_TX_RENDERTILE, 0,
+ 0, 1 << 10, 1 << 10);
+ }
+
+ // Draw pictograph photo
+ if (sPictoState >= PICTO_BOX_STATE_SETUP_PHOTO) {
+ if (!(play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON)) {
+ Play_CompressI8ToI5((play->pictoPhotoI8 != NULL) ? play->pictoPhotoI8 : D_801FBB90,
+ (u8*)gSaveContext.pictoPhotoI5, PICTO_PHOTO_WIDTH * PICTO_PHOTO_HEIGHT);
+
+ interfaceCtx->unk_222 = interfaceCtx->unk_224 = 0;
+
+ sPictoState = PICTO_BOX_STATE_OFF;
+ gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE;
+ Interface_SetHudVisibility(HUD_VISIBILITY_ALL);
+ } else {
+ s16 pictoRectTop;
+ s16 pictoRectLeft;
+
+ if (sPictoState == PICTO_BOX_STATE_SETUP_PHOTO) {
+ sPictoState = PICTO_BOX_STATE_PHOTO;
+ Message_StartTextbox(play, 0xF8, NULL);
+ Interface_SetHudVisibility(HUD_VISIBILITY_NONE);
+ player->stateFlags1 |= PLAYER_STATE1_200;
+ }
+
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetRenderMode(OVERLAY_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
+ gDPSetCombineMode(OVERLAY_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 200, 200, 250);
+ gDPFillRectangle(OVERLAY_DISP++, 70, 22, 251, 151);
+
+ func_8012C654(play->state.gfxCtx);
+
+ gDPSetRenderMode(OVERLAY_DISP++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
+ gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEI_PRIM, G_CC_MODULATEI_PRIM);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 250, 160, 160, 255);
+
+ // Picture is offset up by 33 pixels to give room for the message box at the bottom
+ pictoRectTop = PICTO_PHOTO_TOPLEFT_Y - 33;
+ for (sp2CC = 0; sp2CC < (PICTO_PHOTO_HEIGHT / 8); sp2CC++, pictoRectTop += 8) {
+ pictoRectLeft = PICTO_PHOTO_TOPLEFT_X;
+ gDPLoadTextureBlock(OVERLAY_DISP++,
+ (u8*)((play->pictoPhotoI8 != NULL) ? play->pictoPhotoI8 : D_801FBB90) +
+ (0x500 * sp2CC),
+ G_IM_FMT_I, G_IM_SIZ_8b, PICTO_PHOTO_WIDTH, 8, 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);
+
+ gSPTextureRectangle(OVERLAY_DISP++, pictoRectLeft << 2, pictoRectTop << 2,
+ (pictoRectLeft + PICTO_PHOTO_WIDTH) << 2, (pictoRectTop << 2) + (8 << 2),
+ G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
+ }
+ }
+ }
+
+ // Draw over the entire screen (used in gameover)
+ if (interfaceCtx->screenFillAlpha != 0) {
+ gDPPipeSync(OVERLAY_DISP++);
+ gSPDisplayList(OVERLAY_DISP++, sScreenFillSetupDL);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->screenFillAlpha);
+ gSPDisplayList(OVERLAY_DISP++, D_0E000000.fillRect);
+ }
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
+
+void Interface_LoadStory(PlayState* play, s32 osMesgFlag) {
+ InterfaceContext* interfaceCtx = &play->interfaceCtx;
+
+ switch (interfaceCtx->storyDmaStatus) {
+ case STORY_DMA_IDLE:
+ if (interfaceCtx->storySegment == NULL) {
+ break;
+ }
+ osCreateMesgQueue(&interfaceCtx->storyMsgQueue, &interfaceCtx->storyMsgBuf, 1);
+ DmaMgr_SendRequestImpl(&interfaceCtx->dmaRequest, interfaceCtx->storySegment, interfaceCtx->storyAddr,
+ interfaceCtx->storySize, 0, &interfaceCtx->storyMsgQueue, NULL);
+ interfaceCtx->storyDmaStatus = STORY_DMA_LOADING;
+ // fallthrough
+ case STORY_DMA_LOADING:
+ if (osRecvMesg(&interfaceCtx->storyMsgQueue, NULL, osMesgFlag) == 0) {
+ interfaceCtx->storyDmaStatus = STORY_DMA_DONE;
+ }
+ break;
+
+ default: // STORY_DMA_DONE
+ break;
+ }
+}
+
+void Interface_AllocStory(PlayState* play) {
+ InterfaceContext* interfaceCtx = &play->interfaceCtx;
+
+ interfaceCtx->storyAddr = SEGMENT_ROM_START(story_static);
+ interfaceCtx->storySize = SEGMENT_ROM_SIZE(story_static);
+
+ if (interfaceCtx->storySegment == NULL) {
+ interfaceCtx->storySegment = ZeldaArena_Malloc(interfaceCtx->storySize);
+ }
+ Interface_LoadStory(play, OS_MESG_NOBLOCK);
+}
+
+void Interface_Update(PlayState* play) {
+ static u8 sIsSunsPlayedAtDay = false;
+ static s16 sPrevTimeSpeed = 0;
+ InterfaceContext* interfaceCtx = &play->interfaceCtx;
+ MessageContext* msgCtx = &play->msgCtx;
+ Player* player = GET_PLAYER(play);
+ s16 dimmingAlpha;
+ s16 risingAlpha;
+ u16 aButtonDoAction;
+
+ // Update buttons
+ if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) {
+ if (play->gameOverCtx.state == GAMEOVER_INACTIVE) {
+ func_80111CB4(play);
+ }
+ }
+
+ // Update hud visibility
+ switch (gSaveContext.nextHudVisibility) {
+ case HUD_VISIBILITY_NONE:
+ case HUD_VISIBILITY_NONE_ALT:
+ case HUD_VISIBILITY_B:
+ dimmingAlpha = 255 - (gSaveContext.hudVisibilityTimer << 5);
+ if (dimmingAlpha < 0) {
+ dimmingAlpha = 0;
+ }
+
+ Interface_UpdateHudAlphas(play, dimmingAlpha);
+ gSaveContext.hudVisibilityTimer += 2;
+ if (dimmingAlpha == 0) {
+ gSaveContext.nextHudVisibility = HUD_VISIBILITY_IDLE;
+ }
+ break;
+
+ case HUD_VISIBILITY_HEARTS_WITH_OVERWRITE:
+ case HUD_VISIBILITY_A:
+ case HUD_VISIBILITY_A_HEARTS_MAGIC_WITH_OVERWRITE:
+ case HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_WITH_OVERWRITE:
+ case HUD_VISIBILITY_ALL_NO_MINIMAP_W_DISABLED:
+ 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_WITH_OVERWRITE:
+ case HUD_VISIBILITY_HEARTS_MAGIC_C:
+ case HUD_VISIBILITY_ALL_NO_MINIMAP:
+ case HUD_VISIBILITY_A_B_C:
+ case HUD_VISIBILITY_B_MINIMAP:
+ case HUD_VISIBILITY_HEARTS_MAGIC_MINIMAP:
+ case HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP:
+ case HUD_VISIBILITY_B_MAGIC:
+ case HUD_VISIBILITY_A_B:
+ case HUD_VISIBILITY_A_B_HEARTS_MAGIC_MINIMAP:
+ dimmingAlpha = 255 - (gSaveContext.hudVisibilityTimer << 5);
+ if (dimmingAlpha < 0) {
+ dimmingAlpha = 0;
+ }
+
+ Interface_UpdateHudAlphas(play, dimmingAlpha);
+ gSaveContext.hudVisibilityTimer++;
+ if (dimmingAlpha == 0) {
+ gSaveContext.nextHudVisibility = HUD_VISIBILITY_IDLE;
+ }
+ break;
+
+ case HUD_VISIBILITY_ALL:
+ dimmingAlpha = 255 - (gSaveContext.hudVisibilityTimer << 5);
+ if (dimmingAlpha < 0) {
+ dimmingAlpha = 0;
+ }
+
+ risingAlpha = 255 - dimmingAlpha;
+ if (risingAlpha >= 255) {
+ risingAlpha = 255;
+ }
+
+ Interface_UpdateButtonAlphasByStatus(play, risingAlpha);
+
+ if (gSaveContext.buttonStatus[5] == BTN_DISABLED) {
+ if (interfaceCtx->startAlpha != 70) {
+ interfaceCtx->startAlpha = 70;
+ }
+ } else {
+ if (interfaceCtx->startAlpha != 255) {
+ interfaceCtx->startAlpha = risingAlpha;
+ }
+ }
+
+ if (interfaceCtx->healthAlpha != 255) {
+ interfaceCtx->healthAlpha = risingAlpha;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80120F90.s")
+ if (interfaceCtx->magicAlpha != 255) {
+ interfaceCtx->magicAlpha = risingAlpha;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80121064.s")
+ if (play->sceneId == SCENE_SPOT00) {
+ if (interfaceCtx->minimapAlpha < 170) {
+ interfaceCtx->minimapAlpha = risingAlpha;
+ } else {
+ interfaceCtx->minimapAlpha = 170;
+ }
+ } else if (interfaceCtx->minimapAlpha != 255) {
+ interfaceCtx->minimapAlpha = risingAlpha;
+ }
+
+ gSaveContext.hudVisibilityTimer++;
+
+ if (risingAlpha == 255) {
+ gSaveContext.nextHudVisibility = HUD_VISIBILITY_IDLE;
+ }
-u8 D_801BFD94 = 0;
-s16 D_801BFD98 = 0;
-s16 D_801BFD9C = 0;
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_Update.s")
+ case HUD_VISIBILITY_NONE_INSTANT:
+ // Turn off all Hud immediately
+ gSaveContext.nextHudVisibility = HUD_VISIBILITY_NONE;
+ Interface_UpdateHudAlphas(play, 0);
+ gSaveContext.nextHudVisibility = HUD_VISIBILITY_IDLE;
+ // fallthrough
+ default:
+ break;
+ }
+
+ Map_Update(play);
+
+ // Update health
+ if (gSaveContext.healthAccumulator != 0) {
+ gSaveContext.healthAccumulator -= 4;
+ gSaveContext.save.playerData.health += 4;
+
+ if ((gSaveContext.save.playerData.health & 0xF) < 4) {
+ play_sound(NA_SE_SY_HP_RECOVER);
+ }
+
+ if (((void)0, gSaveContext.save.playerData.health) >= ((void)0, gSaveContext.save.playerData.healthCapacity)) {
+ gSaveContext.save.playerData.health = gSaveContext.save.playerData.healthCapacity;
+ gSaveContext.healthAccumulator = 0;
+ }
+ }
+
+ LifeMeter_UpdateSizeAndBeep(play);
+
+ // Update environmental hazard (remnant of OoT)
+ sEnvHazard = Player_GetEnvironmentalHazard(play);
+ if (sEnvHazard == PLAYER_ENV_HAZARD_HOTROOM) {
+ if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC) == EQUIP_VALUE_TUNIC_GORON) {
+ sEnvHazard = PLAYER_ENV_HAZARD_NONE;
+ }
+ } else if ((Player_GetEnvironmentalHazard(play) >= PLAYER_ENV_HAZARD_UNDERWATER_FLOOR) &&
+ (Player_GetEnvironmentalHazard(play) <= PLAYER_ENV_HAZARD_UNDERWATER_FREE)) {
+ if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC) == EQUIP_VALUE_TUNIC_ZORA) {
+ sEnvHazard = PLAYER_ENV_HAZARD_NONE;
+ }
+ }
+
+ LifeMeter_UpdateColors(play);
+
+ // Update rupees
+ if (gSaveContext.rupeeAccumulator != 0) {
+ if (gSaveContext.rupeeAccumulator > 0) {
+ if (gSaveContext.save.playerData.rupees < CUR_CAPACITY(UPG_WALLET)) {
+ gSaveContext.rupeeAccumulator--;
+ gSaveContext.save.playerData.rupees++;
+ play_sound(NA_SE_SY_RUPY_COUNT);
+ } else {
+ // Max rupees
+ gSaveContext.save.playerData.rupees = CUR_CAPACITY(UPG_WALLET);
+ gSaveContext.rupeeAccumulator = 0;
+ }
+ } else if (gSaveContext.save.playerData.rupees != 0) {
+ if (gSaveContext.rupeeAccumulator <= -50) {
+ gSaveContext.rupeeAccumulator += 10;
+ gSaveContext.save.playerData.rupees -= 10;
+ if (gSaveContext.save.playerData.rupees < 0) {
+ gSaveContext.save.playerData.rupees = 0;
+ }
+ play_sound(NA_SE_SY_RUPY_COUNT);
+ } else {
+ gSaveContext.rupeeAccumulator++;
+ gSaveContext.save.playerData.rupees--;
+ play_sound(NA_SE_SY_RUPY_COUNT);
+ }
+ } else {
+ gSaveContext.rupeeAccumulator = 0;
+ }
+ }
+
+ // Update perfect letters
+ if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) {
+ if (interfaceCtx->perfectLettersOn) {
+ if (interfaceCtx->perfectLettersType == PERFECT_LETTERS_TYPE_1) {
+ Interface_UpdatePerfectLettersType1(play);
+ } else if (interfaceCtx->perfectLettersType == PERFECT_LETTERS_TYPE_2) {
+ Interface_UpdatePerfectLettersType2(play);
+ } else if (interfaceCtx->perfectLettersType == PERFECT_LETTERS_TYPE_3) {
+ Interface_UpdatePerfectLettersType3(play);
+ }
+ }
+ }
+
+ // Update minigame State
+ if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) {
+ if ((u32)interfaceCtx->minigameState != MINIGAME_STATE_NONE) {
+ switch (interfaceCtx->minigameState) {
+ case MINIGAME_STATE_COUNTDOWN_SETUP_3:
+ case MINIGAME_STATE_COUNTDOWN_SETUP_2:
+ case MINIGAME_STATE_COUNTDOWN_SETUP_1:
+ case MINIGAME_STATE_COUNTDOWN_SETUP_GO:
+ interfaceCtx->minigameCountdownAlpha = 255;
+ interfaceCtx->minigameCountdownScale = 100;
+ interfaceCtx->minigameState++;
+ if (interfaceCtx->minigameState == MINIGAME_STATE_COUNTDOWN_GO) {
+ interfaceCtx->minigameCountdownScale = 160;
+ play_sound(NA_SE_SY_START_SHOT);
+ } else {
+ play_sound(NA_SE_SY_WARNING_COUNT_E);
+ }
+ break;
+
+ case MINIGAME_STATE_COUNTDOWN_3:
+ case MINIGAME_STATE_COUNTDOWN_2:
+ case MINIGAME_STATE_COUNTDOWN_1:
+ interfaceCtx->minigameCountdownAlpha -= 10;
+ interfaceCtx->minigameCountdownScale += 3;
+ if (interfaceCtx->minigameCountdownAlpha < 22) {
+ interfaceCtx->minigameState++;
+ }
+ break;
+
+ case MINIGAME_STATE_COUNTDOWN_GO:
+ interfaceCtx->minigameCountdownAlpha -= 10;
+ if (interfaceCtx->minigameCountdownAlpha <= 150) {
+ interfaceCtx->minigameState = MINIGAME_STATE_PLAYING;
+ }
+ break;
+
+ case MINIGAME_STATE_NO_COUNTDOWN_SETUP:
+ interfaceCtx->minigameCountdownAlpha = 0;
+ interfaceCtx->minigameState++;
+ break;
+
+ case MINIGAME_STATE_NO_COUNTDOWN:
+ interfaceCtx->minigameCountdownAlpha++;
+ if (interfaceCtx->minigameCountdownAlpha >= 18) {
+ interfaceCtx->minigameState = MINIGAME_STATE_PLAYING;
+ }
+ break;
+ }
+ }
+ }
+
+ // Update A Button
+ switch (interfaceCtx->aButtonState) {
+ case A_BTN_STATE_1:
+ interfaceCtx->aButtonRoll += 10466.667f;
+ if (interfaceCtx->aButtonRoll >= 15700.0f) {
+ interfaceCtx->aButtonRoll = -15700.0f;
+ interfaceCtx->aButtonState = A_BTN_STATE_2;
+
+ if ((msgCtx->msgMode != 0) && (msgCtx->unk12006 == 0x26)) {
+ R_A_BTN_Y_OFFSET = -14;
+ } else {
+ R_A_BTN_Y_OFFSET = 0;
+ }
+ }
+ break;
+
+ case A_BTN_STATE_2:
+ interfaceCtx->aButtonRoll += 10466.667f;
+ if (interfaceCtx->aButtonRoll >= 0.0f) {
+ interfaceCtx->aButtonRoll = 0.0f;
+ interfaceCtx->aButtonState = A_BTN_STATE_0;
+ interfaceCtx->unk_212 = interfaceCtx->aButtonDoAction;
+ aButtonDoAction = interfaceCtx->unk_212;
+ if ((aButtonDoAction == DO_ACTION_MAX) || (aButtonDoAction == DO_ACTION_MAX + 1)) {
+ aButtonDoAction = DO_ACTION_NONE;
+ }
+ func_80115428(&play->interfaceCtx, aButtonDoAction, 0);
+ }
+ break;
+
+ case A_BTN_STATE_3:
+ interfaceCtx->aButtonRoll += 10466.667f;
+ if (interfaceCtx->aButtonRoll >= 15700.0f) {
+ interfaceCtx->aButtonRoll = -15700.0f;
+ interfaceCtx->aButtonState = A_BTN_STATE_2;
+ }
+ break;
+
+ case A_BTN_STATE_4:
+ interfaceCtx->aButtonRoll += 10466.667f;
+ if (interfaceCtx->aButtonRoll >= 0.0f) {
+ interfaceCtx->aButtonRoll = 0.0f;
+ interfaceCtx->aButtonState = A_BTN_STATE_0;
+ interfaceCtx->unk_212 = interfaceCtx->aButtonDoAction;
+ aButtonDoAction = interfaceCtx->unk_212;
+ if ((aButtonDoAction == DO_ACTION_MAX) || (aButtonDoAction == DO_ACTION_MAX + 1)) {
+ aButtonDoAction = DO_ACTION_NONE;
+ }
+
+ func_80115428(&play->interfaceCtx, aButtonDoAction, 0);
+ }
+ break;
+
+ default: // A_BTN_STATE_0
+ break;
+ }
+
+ // Update magic
+ if (!(player->stateFlags1 & PLAYER_STATE1_200)) {
+ if (R_MAGIC_DBG_SET_UPGRADE == MAGIC_DBG_SET_UPGRADE_DOUBLE_METER) {
+ // Upgrade to double magic
+ if (!gSaveContext.save.playerData.isMagicAcquired) {
+ gSaveContext.save.playerData.isMagicAcquired = true;
+ }
+ gSaveContext.save.playerData.isDoubleMagicAcquired = true;
+ gSaveContext.save.playerData.magic = MAGIC_DOUBLE_METER;
+ gSaveContext.save.playerData.magicLevel = 0;
+ R_MAGIC_DBG_SET_UPGRADE = MAGIC_DBG_SET_UPGRADE_NO_ACTION;
+ } else if (R_MAGIC_DBG_SET_UPGRADE == MAGIC_DBG_SET_UPGRADE_NORMAL_METER) {
+ // Upgrade to normal magic
+ if (!gSaveContext.save.playerData.isMagicAcquired) {
+ gSaveContext.save.playerData.isMagicAcquired = true;
+ }
+ gSaveContext.save.playerData.isDoubleMagicAcquired = false;
+ gSaveContext.save.playerData.magic = MAGIC_NORMAL_METER;
+ gSaveContext.save.playerData.magicLevel = 0;
+ R_MAGIC_DBG_SET_UPGRADE = MAGIC_DBG_SET_UPGRADE_NO_ACTION;
+ }
+
+ if ((gSaveContext.save.playerData.isMagicAcquired) && (gSaveContext.save.playerData.magicLevel == 0)) {
+ // Prepare to step `magicCapacity` to full capacity
+ gSaveContext.save.playerData.magicLevel = gSaveContext.save.playerData.isDoubleMagicAcquired + 1;
+ gSaveContext.magicFillTarget = gSaveContext.save.playerData.magic;
+ gSaveContext.save.playerData.magic = 0;
+ gSaveContext.magicState = MAGIC_STATE_STEP_CAPACITY;
+ BUTTON_ITEM_EQUIP(PLAYER_FORM_DEKU, EQUIP_SLOT_B) = ITEM_NUT;
+ }
+
+ Magic_Update(play);
+ Magic_UpdateAddRequest();
+ }
+
+ // Update environmental hazard timer
+ if (gSaveContext.timerStates[TIMER_ID_ENV_HAZARD] == TIMER_STATE_OFF) {
+ if ((sEnvHazard == PLAYER_ENV_HAZARD_HOTROOM) || (sEnvHazard == PLAYER_ENV_HAZARD_UNDERWATER_FREE)) {
+ if (CUR_FORM != PLAYER_FORM_ZORA) {
+ if (play->gameOverCtx.state == GAMEOVER_INACTIVE) {
+ if ((gSaveContext.save.playerData.health >> 1) != 0) {
+ gSaveContext.timerStates[TIMER_ID_ENV_HAZARD] = TIMER_STATE_ENV_HAZARD_START;
+ gSaveContext.timerX[TIMER_ID_ENV_HAZARD] = 115;
+ gSaveContext.timerY[TIMER_ID_ENV_HAZARD] = 80;
+ sEnvTimerActive = true;
+ gSaveContext.timerDirections[TIMER_ID_ENV_HAZARD] = TIMER_COUNT_DOWN;
+ }
+ }
+ }
+ }
+ } else if (((sEnvHazard == PLAYER_ENV_HAZARD_NONE) || (sEnvHazard == PLAYER_ENV_HAZARD_SWIMMING)) &&
+ (gSaveContext.timerStates[TIMER_ID_ENV_HAZARD] <= TIMER_STATE_COUNTING)) {
+ gSaveContext.timerStates[TIMER_ID_ENV_HAZARD] = TIMER_STATE_OFF;
+ }
+
+ // Update minigame
+ if (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) {
+ gSaveContext.minigameScore += interfaceCtx->minigamePoints;
+ gSaveContext.minigameHiddenScore += interfaceCtx->minigameHiddenPoints;
+ interfaceCtx->minigamePoints = 0;
+ interfaceCtx->minigameHiddenPoints = 0;
+
+ // Update horseback archery tier, unused remnant of OoT.
+ if (sHBAScoreTier == 0) {
+ if (gSaveContext.minigameScore >= 1000) {
+ sHBAScoreTier++;
+ }
+ } else if (sHBAScoreTier == 1) {
+ if (gSaveContext.minigameScore >= 1500) {
+ sHBAScoreTier++;
+ }
+ }
+
+ // Get minigame digits
+ sMinigameScoreDigits[0] = sMinigameScoreDigits[1] = 0;
+ sMinigameScoreDigits[2] = 0;
+ sMinigameScoreDigits[3] = gSaveContext.minigameScore;
+
+ while (sMinigameScoreDigits[3] >= 1000) {
+ sMinigameScoreDigits[0]++;
+ sMinigameScoreDigits[3] -= 1000;
+ }
+
+ while (sMinigameScoreDigits[3] >= 100) {
+ sMinigameScoreDigits[1]++;
+ sMinigameScoreDigits[3] -= 100;
+ }
+
+ while (sMinigameScoreDigits[3] >= 10) {
+ sMinigameScoreDigits[2]++;
+ sMinigameScoreDigits[3] -= 10;
+ }
+ }
+
+ // Update Sun Song
+ if (gSaveContext.sunsSongState != SUNSSONG_INACTIVE) {
+ // exit out of ocarina mode after suns song finishes playing
+ if ((msgCtx->ocarinaAction != 0x39) && (gSaveContext.sunsSongState == SUNSSONG_START)) {
+ play->msgCtx.ocarinaMode = 4;
+ }
+
+ // handle suns song in areas where time moves
+ if (play->envCtx.sceneTimeSpeed != 0) {
+ if (gSaveContext.sunsSongState != SUNSSONG_SPEED_TIME) {
+ sIsSunsPlayedAtDay = false;
+ if ((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time <= CLOCK_TIME(18, 0))) {
+ sIsSunsPlayedAtDay = true;
+ }
+
+ gSaveContext.sunsSongState = SUNSSONG_SPEED_TIME;
+ sPrevTimeSpeed = R_TIME_SPEED;
+ R_TIME_SPEED = 400;
+ } else if (!sIsSunsPlayedAtDay) {
+ // Nighttime
+ if ((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time <= CLOCK_TIME(18, 0))) {
+ // Daytime has been reached. End suns song effect
+ gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
+ R_TIME_SPEED = sPrevTimeSpeed;
+ play->msgCtx.ocarinaMode = 4;
+ }
+ } else {
+ // Daytime
+ if (gSaveContext.save.time > CLOCK_TIME(18, 0)) {
+ // Nighttime has been reached. End suns song effect
+ gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
+ R_TIME_SPEED = sPrevTimeSpeed;
+ play->msgCtx.ocarinaMode = 4;
+ }
+ }
+ } else {
+ gSaveContext.sunsSongState = SUNSSONG_SPECIAL;
+ }
+ }
+
+ Interface_UpdateBottleTimers(play);
+
+ // Update Grandma's Story
+ if (interfaceCtx->storyState != STORY_STATE_OFF) {
+ if (interfaceCtx->storyState == STORY_STATE_INIT) {
+ interfaceCtx->storyDmaStatus = STORY_DMA_IDLE;
+ interfaceCtx->storyState = STORY_STATE_IDLE;
+ R_STORY_FILL_SCREEN_ALPHA = 0;
+ }
+
+ Interface_AllocStory(play);
+
+ if (interfaceCtx->storyState == STORY_STATE_DESTROY) {
+ interfaceCtx->storyState = STORY_STATE_OFF;
+ interfaceCtx->storyDmaStatus = STORY_DMA_IDLE;
+ if (interfaceCtx->storySegment != NULL) {
+ ZeldaArena_Free(interfaceCtx->storySegment);
+ interfaceCtx->storySegment = NULL;
+ }
+ } else if (interfaceCtx->storyState == STORY_STATE_SETUP_IDLE) {
+ interfaceCtx->storyState = STORY_STATE_IDLE;
+ } else if (interfaceCtx->storyState == STORY_STATE_FADE_OUT) {
+ R_STORY_FILL_SCREEN_ALPHA += 10;
+ if (R_STORY_FILL_SCREEN_ALPHA >= 250) {
+ R_STORY_FILL_SCREEN_ALPHA = 255;
+ interfaceCtx->storyState = STORY_STATE_IDLE;
+ }
+ } else if (interfaceCtx->storyState == STORY_STATE_FADE_IN) {
+ R_STORY_FILL_SCREEN_ALPHA -= 10;
+ if (R_STORY_FILL_SCREEN_ALPHA < 0) {
+ R_STORY_FILL_SCREEN_ALPHA = 0;
+ interfaceCtx->storyState = STORY_STATE_IDLE;
+ }
+ }
+ }
+}
void Interface_Destroy(PlayState* play) {
Map_Destroy(play);
func_80174F9C(Interface_PostmanTimerCallback, NULL);
}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_Init.s")
+void Interface_Init(PlayState* play) {
+ s32 pad;
+ InterfaceContext* interfaceCtx = &play->interfaceCtx;
+ size_t parameterStaticSize;
+ s32 i;
+
+ bzero(interfaceCtx, sizeof(InterfaceContext));
+
+ gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
+ gSaveContext.nextHudVisibility = HUD_VISIBILITY_IDLE;
+ gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE;
+
+ View_Init(&interfaceCtx->view, play->state.gfxCtx);
+
+ interfaceCtx->magicConsumptionTimer = 16;
+ interfaceCtx->healthTimer = 200;
+
+ parameterStaticSize = SEGMENT_ROM_SIZE(parameter_static);
+ interfaceCtx->parameterSegment = THA_AllocEndAlign16(&play->state.heap, parameterStaticSize);
+ DmaMgr_SendRequest0(interfaceCtx->parameterSegment, SEGMENT_ROM_START(parameter_static), parameterStaticSize);
+
+ interfaceCtx->doActionSegment = THA_AllocEndAlign16(&play->state.heap, 0xC90);
+ DmaMgr_SendRequest0(interfaceCtx->doActionSegment, SEGMENT_ROM_START(do_action_static), 0x300);
+ DmaMgr_SendRequest0(interfaceCtx->doActionSegment + 0x300, SEGMENT_ROM_START(do_action_static) + 0x480, 0x180);
+
+ Interface_NewDay(play, CURRENT_DAY);
+
+ interfaceCtx->iconItemSegment = THA_AllocEndAlign16(&play->state.heap, 0x4000);
+
+ if (CUR_FORM_EQUIP(EQUIP_SLOT_B) < ITEM_F0) {
+ Interface_LoadItemIconImpl(play, EQUIP_SLOT_B);
+ } else if ((CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_NONE) && (CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_FD)) {
+ Interface_LoadItemIconImpl(play, EQUIP_SLOT_B);
+ }
+
+ if (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) < ITEM_F0) {
+ Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_LEFT);
+ }
+
+ if (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) < ITEM_F0) {
+ Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_DOWN);
+ }
+
+ if (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) < ITEM_F0) {
+ Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_RIGHT);
+ }
+
+ if (((gSaveContext.timerStates[TIMER_ID_MINIGAME_2] == TIMER_STATE_COUNTING) ||
+ (gSaveContext.timerStates[TIMER_ID_GORON_RACE_UNUSED] == TIMER_STATE_COUNTING)) &&
+ ((gSaveContext.respawnFlag == -1) || (gSaveContext.respawnFlag == 1)) &&
+ (gSaveContext.timerStates[TIMER_ID_MINIGAME_2] == TIMER_STATE_COUNTING)) {
+ gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_START;
+ gSaveContext.timerX[TIMER_ID_MINIGAME_2] = 115;
+ gSaveContext.timerY[TIMER_ID_MINIGAME_2] = 80;
+ }
+
+ LifeMeter_Init(play);
+ Map_Init(play);
+
+ gSaveContext.minigameStatus = MINIGAME_STATUS_END;
+ interfaceCtx->perfectLettersPrimColor[0] = 255;
+ interfaceCtx->perfectLettersPrimColor[1] = 165;
+ interfaceCtx->perfectLettersPrimColor[2] = 55;
+
+ if (CHECK_EVENTINF(EVENTINF_34)) {
+ CLEAR_EVENTINF(EVENTINF_34);
+ gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF;
+ }
+
+ gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_OFF;
+ gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0);
+ gSaveContext.timerTimeLimits[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0);
+ gSaveContext.timerStartOsTimes[TIMER_ID_MINIGAME_1] = 0;
+ gSaveContext.timerStopTimes[TIMER_ID_MINIGAME_1] = 0;
+ gSaveContext.timerPausedOsTimes[TIMER_ID_MINIGAME_1] = 0;
+
+ for (i = 0; i < TIMER_ID_MAX; i++) {
+ if (gSaveContext.timerStates[i] == TIMER_STATE_7) {
+ gSaveContext.timerStates[i] = TIMER_STATE_OFF;
+ }
+ }
+
+ sPictoState = PICTO_BOX_STATE_OFF;
+ sPictoPhotoBeingTaken = false;
+
+ if ((play->sceneId != SCENE_MITURIN_BS) && (play->sceneId != SCENE_HAKUGIN_BS) && (play->sceneId != SCENE_SEA_BS) &&
+ (play->sceneId != SCENE_INISIE_BS) && (play->sceneId != SCENE_LAST_BS) && (play->sceneId != SCENE_MITURIN) &&
+ (play->sceneId != SCENE_HAKUGIN) && (play->sceneId != SCENE_SEA) && (play->sceneId != SCENE_INISIE_N) &&
+ (play->sceneId != SCENE_INISIE_R) && (play->sceneId != SCENE_LAST_DEKU) &&
+ (play->sceneId != SCENE_LAST_GORON) && (play->sceneId != SCENE_LAST_ZORA) &&
+ (play->sceneId != SCENE_LAST_LINK)) {
+
+ CLEAR_EVENTINF(EVENTINF_53); // Goht intro cutscene watched
+ CLEAR_EVENTINF(EVENTINF_54); // Odolwa intro cutscene watched
+ CLEAR_EVENTINF(EVENTINF_55); // Twinmold intro cutscene watched
+ CLEAR_EVENTINF(EVENTINF_56); // Gyorg intro cutscene watched
+ CLEAR_EVENTINF(EVENTINF_57); // Igos du Ikana intro cutscene watched
+ CLEAR_EVENTINF(EVENTINF_60); // Wart intro cutscene watched
+ CLEAR_EVENTINF(EVENTINF_61); // Majoras intro cutscene watched
+ CLEAR_EVENTINF(EVENTINF_62); //
+ CLEAR_EVENTINF(EVENTINF_63); // Gomess intro cutscene watched
+ }
+
+ sFinalHoursClockDigitsRed = sFinalHoursClockFrameEnvRed = sFinalHoursClockFrameEnvGreen =
+ sFinalHoursClockFrameEnvBlue = 0;
+ sFinalHoursClockColorTimer = 15;
+ sFinalHoursClockColorTargetIndex = 0;
+}
diff --git a/src/code/z_play.c b/src/code/z_play.c
index 71fbc897f..7b3a875c2 100644
--- a/src/code/z_play.c
+++ b/src/code/z_play.c
@@ -39,9 +39,9 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Destroy.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801663C4.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CompressI8ToI5.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80166644.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_DecompressI5ToI8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801668B4.s")
diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c
index ac6ac560c..d00325224 100644
--- a/src/code/z_player_lib.c
+++ b/src/code/z_player_lib.c
@@ -1,4 +1,3 @@
-#include "prevent_bss_reordering.h"
#include "global.h"
#include "objects/gameplay_keep/gameplay_keep.h"
@@ -543,15 +542,15 @@ ItemId func_8012364C(PlayState* play, Player* player, s32 arg2) {
return item;
}
- if ((player->currentMask == PLAYER_MASK_BLAST) && (play->interfaceCtx.bButtonDoAction == 0x18)) {
+ if ((player->currentMask == PLAYER_MASK_BLAST) && (play->interfaceCtx.bButtonDoAction == DO_ACTION_EXPLODE)) {
return ITEM_F0;
}
- if ((player->currentMask == PLAYER_MASK_BREMEN) && (play->interfaceCtx.bButtonDoAction == 0x1A)) {
+ if ((player->currentMask == PLAYER_MASK_BREMEN) && (play->interfaceCtx.bButtonDoAction == DO_ACTION_MARCH)) {
return ITEM_F1;
}
- if ((player->currentMask == PLAYER_MASK_KAMARO) && (play->interfaceCtx.bButtonDoAction == 0x19)) {
+ if ((player->currentMask == PLAYER_MASK_KAMARO) && (play->interfaceCtx.bButtonDoAction == DO_ACTION_DANCE)) {
return ITEM_F2;
}
@@ -725,17 +724,17 @@ u8 sPlayerStrengths[PLAYER_FORM_MAX] = {
};
typedef struct {
- /* 0x00 */ u8 flag;
- /* 0x02 */ u16 textId;
-} TextTriggerEntry; // size = 0x04
+ /* 0x0 */ u8 flag;
+ /* 0x2 */ u16 textId;
+} EnvHazardTextTriggerEntry; // size = 0x4
// These textIds are OoT remnants. The corresponding text entries are not present in this game, and so these don't point
// to anything relevant.
-TextTriggerEntry sEnvironmentTextTriggers[] = {
- { 1, 0x26FC },
- { 2, 0x26FD },
- { 0, 0 },
- { 2, 0x26FD },
+EnvHazardTextTriggerEntry sEnvHazardTextTriggers[] = {
+ { ENV_HAZARD_TEXT_TRIGGER_HOTROOM, 0x26FC }, // PLAYER_ENV_HAZARD_HOTROOM - 1
+ { ENV_HAZARD_TEXT_TRIGGER_UNDERWATER, 0x26FD }, // PLAYER_ENV_HAZARD_UNDERWATER_FLOOR - 1
+ { 0, 0 }, // PLAYER_ENV_HAZARD_SWIMMING - 1
+ { ENV_HAZARD_TEXT_TRIGGER_UNDERWATER, 0x26FD }, // PLAYER_ENV_HAZARD_UNDERWATER_FREE - 1
};
PlayerModelIndices gPlayerModelTypes[PLAYER_MODELGROUP_MAX] = {
@@ -1451,37 +1450,36 @@ s32 func_801242B4(Player* player) {
return (player->stateFlags1 & PLAYER_STATE1_8000000) && (player->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER);
}
-s32 Player_GetEnvTimerType(PlayState* play) {
+s32 Player_GetEnvironmentalHazard(PlayState* play) {
Player* player = GET_PLAYER(play);
- TextTriggerEntry* triggerEntry;
- s32 envTimerType;
+ EnvHazardTextTriggerEntry* triggerEntry;
+ s32 envHazard;
if (play->roomCtx.curRoom.unk2 == 3) { // Room is hot
- envTimerType = PLAYER_ENV_TIMER_HOTROOM - 1;
+ envHazard = PLAYER_ENV_HAZARD_HOTROOM - 1;
} else if ((player->transformation != PLAYER_FORM_ZORA) && (player->underwaterTimer > 80)) {
- envTimerType = PLAYER_ENV_TIMER_UNDERWATER_FREE - 1;
+ envHazard = PLAYER_ENV_HAZARD_UNDERWATER_FREE - 1;
} else if (player->stateFlags1 & PLAYER_STATE1_8000000) {
if ((player->transformation == PLAYER_FORM_ZORA) && (player->currentBoots >= PLAYER_BOOTS_ZORA_UNDERWATER) &&
(player->actor.bgCheckFlags & 1)) {
- envTimerType = PLAYER_ENV_TIMER_UNDERWATER_FLOOR - 1;
+ envHazard = PLAYER_ENV_HAZARD_UNDERWATER_FLOOR - 1;
} else {
- envTimerType = PLAYER_ENV_TIMER_SWIMMING - 1;
+ envHazard = PLAYER_ENV_HAZARD_SWIMMING - 1;
}
} else {
- return PLAYER_ENV_TIMER_NONE;
+ return PLAYER_ENV_HAZARD_NONE;
}
- // Trigger general textboxes under certain conditions, like "It's so hot in here!". Unused in MM
- triggerEntry = &sEnvironmentTextTriggers[envTimerType];
+ triggerEntry = &sEnvHazardTextTriggers[envHazard];
if (!Player_InCsMode(play)) {
- if ((triggerEntry->flag) && !(gSaveContext.textTriggerFlags & triggerEntry->flag) &&
- (envTimerType == (PLAYER_ENV_TIMER_HOTROOM - 1))) {
+ if ((triggerEntry->flag) && !(gSaveContext.envHazardTextTriggerFlags & triggerEntry->flag) &&
+ (envHazard == (PLAYER_ENV_HAZARD_HOTROOM - 1))) {
Message_StartTextbox(play, triggerEntry->textId, NULL);
- gSaveContext.textTriggerFlags |= triggerEntry->flag;
+ gSaveContext.envHazardTextTriggerFlags |= triggerEntry->flag;
}
}
- return envTimerType + 1;
+ return envHazard + 1;
}
void func_80124420(Player* player);
diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c
index 80ca0a4a6..94d0e69c3 100644
--- a/src/code/z_sram_NES.c
+++ b/src/code/z_sram_NES.c
@@ -468,10 +468,10 @@ void Sram_SaveEndOfCycle(PlayState* play) {
if (CUR_FORM == 0) {
if ((STOLEN_ITEM_1 >= ITEM_SWORD_GILDED) || (STOLEN_ITEM_2 >= ITEM_SWORD_GILDED)) {
- BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_SWORD_GILDED;
+ CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_SWORD_GILDED;
SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_GILDED);
} else {
- BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI;
+ CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI;
}
} else {
if ((STOLEN_ITEM_1 >= ITEM_SWORD_GILDED) || (STOLEN_ITEM_2 >= ITEM_SWORD_GILDED)) {