diff --git a/include/functions.h b/include/functions.h index 77c3fa3712..27c11bbe71 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1621,9 +1621,9 @@ s32 func_8010A0A4(PlayState* play); void Minimap_SavePlayerRoomInitInfo(PlayState* play); void Map_InitRoomData(PlayState* play, s16 room); void Map_Destroy(PlayState* play); -// void Map_Init(PlayState* play); -// void Minimap_Draw(PlayState* play); -// void Map_Update(PlayState* play); +void Map_Init(PlayState* play); +void Minimap_Draw(PlayState* play); +void Map_Update(PlayState* play); // void func_8010A760(void); // void func_8010A7CC(void); // void func_8010A814(void); @@ -1710,8 +1710,7 @@ void Interface_StartPostmanTimer(s16 seconds, s16 bunnyHoodState); void Interface_NewDay(PlayState* play, s32 day); void Interface_SetHudVisibility(u16 hudVisibility); void func_80110038(PlayState* play); -// void func_80111CB4(void); -// void func_801129E4(void); +void Interface_SetSceneRestrictions(PlayState* play); void Interface_InitMinigame(PlayState* play); void Interface_LoadItemIconImpl(PlayState* play, u8 btn); void Interface_LoadItemIcon(PlayState* play, u8 btn); @@ -1727,12 +1726,10 @@ s32 Inventory_HasItemInBottle(u8 item); void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 btn); s32 Inventory_ConsumeFairy(PlayState* play); void Inventory_UpdateItem(PlayState* play, s16 slot, s16 item); -// void func_801153C8(void); -// void func_80115428(void); void func_8011552C(PlayState* play, u16 arg1); void func_801155B4(PlayState* play, s16 arg1); void func_80115764(PlayState* play, UNK_TYPE arg1); -void func_80115844(PlayState* play, s16 param_2); +void func_80115844(PlayState* play, s16 doAction); s32 Health_ChangeBy(PlayState* play, s16 healthChange); void Health_GiveHearts(s16 hearts); void Rupees_ChangeBy(s16 rupeeChange); @@ -1812,7 +1809,7 @@ s32 Player_ActionToExplosive(Player* player, PlayerItemAction itemAction); s32 Player_GetExplosiveHeld(Player* player); s32 Player_ActionToSword(Actor* actor, PlayerItemAction itemAction); s32 func_801242B4(Player* player); -s32 Player_GetEnvTimerType(PlayState* play); +s32 Player_GetEnvironmentalHazard(PlayState* play); void func_80124420(Player* player); void func_80124618(struct_80124618 arg0[], f32 curFrame, Vec3f* arg2); void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, PlayerTransformation playerForm, s32 boots, s32 face, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor); @@ -2327,8 +2324,8 @@ void func_80165DF0(void); // void func_80166060(void); Gfx* func_801660B8(PlayState* play, Gfx* gfx); void Play_Destroy(GameState* thisx); -// void func_801663C4(void); -// void func_80166644(void); +void Play_CompressI8ToI5(void* srcI8, void* destI5, size_t size); +void Play_DecompressI5ToI8(void* srcI5, void* destI8, size_t size); // void func_801668B4(void); void func_80166968(PlayState* play, Camera* camera); void func_80166B30(PlayState* play); diff --git a/include/regs.h b/include/regs.h index 41ba0c2917..b19131748c 100644 --- a/include/regs.h +++ b/include/regs.h @@ -60,14 +60,24 @@ #define R_PLAY_FILL_SCREEN_B MREG(67) #define R_PLAY_FILL_SCREEN_ALPHA MREG(68) -#define R_PAUSE_WORLD_MAP_YAW YREG(24) -#define R_PAUSE_WORLD_MAP_Y_OFFSET YREG(25) -#define R_PAUSE_WORLD_MAP_DEPTH YREG(26) -#define R_PAUSE_DBG_QUEST_CURSOR_ON YREG(69) -#define R_PAUSE_DBG_QUEST_CURSOR_X YREG(70) -#define R_PAUSE_DBG_QUEST_CURSOR_Y YREG(71) -#define R_C_UP_ICON_X YREG(88) -#define R_C_UP_ICON_Y YREG(89) +#define R_PAUSE_WORLD_MAP_YAW YREG(24) +#define R_PAUSE_WORLD_MAP_Y_OFFSET YREG(25) +#define R_PAUSE_WORLD_MAP_DEPTH YREG(26) +#define R_PICTO_FOCUS_BORDER_TOPLEFT_X YREG(32) +#define R_PICTO_FOCUS_BORDER_TOPLEFT_Y YREG(33) +#define R_PICTO_FOCUS_BORDER_TOPRIGHT_X YREG(34) +#define R_PICTO_FOCUS_BORDER_TOPRIGHT_Y YREG(35) +#define R_PICTO_FOCUS_BORDER_BOTTOMLEFT_X YREG(36) +#define R_PICTO_FOCUS_BORDER_BOTTOMLEFT_Y YREG(37) +#define R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_X YREG(38) +#define R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_Y YREG(39) +#define R_PICTO_FOCUS_ICON_X YREG(40) +#define R_PICTO_FOCUS_ICON_Y YREG(41) +#define R_PICTO_FOCUS_TEXT_X YREG(42) +#define R_PICTO_FOCUS_TEXT_Y YREG(43) +#define R_PAUSE_DBG_QUEST_CURSOR_ON YREG(69) +#define R_PAUSE_DBG_QUEST_CURSOR_X YREG(70) +#define R_PAUSE_DBG_QUEST_CURSOR_Y YREG(71) #define R_MAGIC_FILL_COLOR(i) ZREG(0 + i) #define R_C_BTN_COLOR(i) ZREG(39 + i) @@ -86,11 +96,13 @@ #define R_ITEM_ICON_Y(i) ZREG(86 + i) #define R_ITEM_ICON_DD(i) ZREG(90 + i) +#define R_MAGIC_DBG_SET_UPGRADE XREG(4) #define R_A_BTN_Y XREG(16) #define R_A_BTN_X XREG(17) #define R_A_ICON_Y XREG(19) #define R_A_ICON_X XREG(20) #define R_A_BTN_COLOR(i) XREG(22 + i) +#define R_A_BTN_Y_OFFSET XREG(31) #define R_MAGIC_CONSUME_TIMER_GIANTS_MASK XREG(41) #define R_THREE_DAY_CLOCK_Y_POS XREG(43) #define R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF XREG(44) diff --git a/include/variables.h b/include/variables.h index fc156ff31d..70874a1ecb 100644 --- a/include/variables.h +++ b/include/variables.h @@ -631,127 +631,6 @@ extern UNK_PTR D_801BEC14; // extern UNK_TYPE2 D_801BF5B0; extern UNK_PTR D_801BF5C0; // extern UNK_TYPE1 D_801BF68C; -// extern UNK_TYPE1 D_801BF6C0; -// extern UNK_TYPE1 D_801BF79E; -// extern UNK_TYPE2 D_801BF884; -// extern UNK_TYPE2 D_801BF888; -// extern UNK_TYPE2 D_801BF88C; -// extern UNK_TYPE2 D_801BF890; -// extern UNK_TYPE2 D_801BF898; -// extern UNK_TYPE2 D_801BF89C; -// extern UNK_TYPE2 sMagicMeterOutlinePrimRed; -// extern UNK_TYPE2 sMagicMeterOutlinePrimGreen; -// extern UNK_TYPE2 sMagicMeterOutlinePrimBlue; -// extern UNK_TYPE2 sMagicBorderRatio; -// extern UNK_TYPE2 sMagicBorderStep; -// extern UNK_TYPE2 sEnvTimerType; -// extern UNK_TYPE2 sEnvTimerActive; -// extern UNK_TYPE2 sPostmanBunnyHoodState; -// extern UNK_TYPE4 sTimerPausedOsTime; -// extern UNK_TYPE4 sBottleTimerPausedOsTime; -// extern UNK_TYPE4 D_801BF8F4; -// extern UNK_TYPE4 D_801BF8F8; -// extern UNK_TYPE4 D_801BF8FC; -// extern UNK_TYPE4 D_801BF930; -// extern UNK_TYPE4 D_801BF934; -// extern UNK_TYPE1 sIsTimerPaused; -// extern UNK_TYPE1 D_801BF96A; -// extern UNK_TYPE1 sIsBottleTimerPaused; -// extern UNK_TYPE1 D_801BF96E; -// extern UNK_TYPE2 sTimerId; -// extern UNK_TYPE1 D_801BF972; -// extern UNK_TYPE2 D_801BF974; -// extern UNK_TYPE2 D_801BF978; -// extern UNK_TYPE2 D_801BF97C; -// extern UNK_TYPE4 D_801BF980; -// extern UNK_TYPE1 D_801BF988; -// extern UNK_TYPE1 D_801BF998; -// extern UNK_TYPE2 D_801BF9B0; -// extern UNK_TYPE1 D_801BF9B4; -// extern UNK_TYPE1 D_801BF9BC; -// extern UNK_TYPE1 D_801BF9C4; -// extern UNK_TYPE1 D_801BF9C8; -// extern UNK_TYPE1 D_801BF9CC; -// extern UNK_TYPE2 D_801BF9D4; -// extern UNK_TYPE2 D_801BF9D6; -// extern UNK_TYPE2 D_801BF9D8; -// extern UNK_TYPE2 D_801BF9DA; -// extern UNK_TYPE2 D_801BF9DC; -// extern UNK_TYPE2 D_801BF9DE; -// extern UNK_TYPE2 D_801BF9E0; -// extern UNK_TYPE2 D_801BF9E2; -// extern UNK_TYPE2 D_801BF9E4; -// extern UNK_TYPE2 D_801BF9E6; -// extern UNK_TYPE2 D_801BF9E8; -// extern UNK_TYPE2 D_801BF9EA; -// extern UNK_TYPE2 D_801BF9EC; -// extern UNK_TYPE2 D_801BF9F0; -// extern UNK_TYPE2 D_801BF9F4; -// extern UNK_TYPE2 D_801BF9F8; -// extern UNK_TYPE2 D_801BF9FC; -// extern UNK_TYPE2 D_801BFA00; -// extern UNK_TYPE1 D_801BFAB0; -// extern UNK_TYPE1 D_801BFAB8; -// extern UNK_TYPE1 D_801BFAC4; -// extern UNK_TYPE1 D_801BFACC; -// extern UNK_TYPE1 D_801BFAD4; -// extern UNK_TYPE2 D_801BFAF4; -// extern UNK_TYPE2 D_801BFAF6; -// extern UNK_TYPE2 D_801BFAF8; -// extern UNK_TYPE2 D_801BFAFA; -// extern UNK_TYPE1 D_801BFAFC; -// extern UNK_TYPE1 D_801BFB04; -// extern UNK_TYPE1 D_801BFB0C; -// extern UNK_TYPE1 D_801BFB14; -// extern UNK_TYPE1 D_801BFB1C; -// extern UNK_TYPE1 D_801BFB24; -// extern UNK_TYPE2 sThreeDayClockAlpha; -// extern UNK_TYPE2 D_801BFB30; -// extern UNK_TYPE2 D_801BFB34; -// extern UNK_TYPE1 sThreeDayClockHours; -// extern UNK_TYPE1 sThreeDayClockHourTextures; -// extern UNK_TYPE2 D_801BFBCC; -// extern UNK_TYPE2 D_801BFBD0; -// extern UNK_TYPE2 D_801BFBD4; -// extern UNK_TYPE2 D_801BFBD8; -// extern UNK_TYPE2 D_801BFBDC; -// extern UNK_TYPE2 D_801BFBE0; -// extern UNK_TYPE2 D_801BFBE4; -// extern UNK_TYPE2 D_801BFBE8; -// extern UNK_TYPE1 D_801BFBEC; -// extern UNK_TYPE1 D_801BFBF0; -// extern UNK_TYPE1 D_801BFBF4; -// extern UNK_TYPE1 D_801BFBF8; -// extern UNK_TYPE1 D_801BFBFC; -// extern UNK_TYPE1 D_801BFC00; -// extern UNK_TYPE1 D_801BFC04; -// extern UNK_TYPE1 D_801BFC08; -// extern UNK_TYPE1 D_801BFC0C; -// extern UNK_TYPE1 D_801BFC10; -// extern UNK_TYPE1 sFinalHoursDigitTextures; -// extern UNK_TYPE1 D_801BFC40; -// extern UNK_TYPE2 sTimerStateTimer; -// extern UNK_TYPE2 sTimerDigits; -// extern UNK_TYPE2 D_801BFCEA; -// extern UNK_TYPE2 D_801BFCEC; -// extern UNK_TYPE2 D_801BFCEE; -// extern UNK_TYPE2 D_801BFCF0; -// extern UNK_TYPE2 D_801BFCF2; -// extern UNK_TYPE2 D_801BFCF4; -// extern UNK_TYPE2 sTimerBeepSfxSeconds; -// extern UNK_TYPE2 D_801BFCFC; -// extern UNK_TYPE2 D_801BFD0C; -// extern UNK_TYPE1 D_801BFD1C; -// extern UNK_TYPE1 D_801BFD24; -// extern UNK_TYPE1 D_801BFD2C; -// extern UNK_TYPE1 D_801BFD40; -// extern UNK_TYPE1 D_801BFD54; -// extern UNK_TYPE1 D_801BFD64; -// extern UNK_TYPE2 D_801BFD6C; -// extern UNK_TYPE1 D_801BFD84; -// extern UNK_TYPE1 D_801BFD8C; -// extern UNK_TYPE1 D_801BFD94; -// extern UNK_TYPE2 D_801BFD98; extern FlexSkeletonHeader* gPlayerSkeletons[PLAYER_FORM_MAX]; extern PlayerModelIndices gPlayerModelTypes[]; @@ -2926,7 +2805,7 @@ extern GfxPool gGfxPools[2]; extern u8 gAudioHeap[0x138000]; extern u8 gSystemHeap[UNK_SIZE]; -extern u8 D_80780000[0x4600]; +extern u8 gPictoPhotoI8[PICTO_PHOTO_SIZE]; extern u8 D_80784600[0x56200]; extern u16 gFramebuffer0[SCREEN_HEIGHT][SCREEN_WIDTH]; diff --git a/include/z64.h b/include/z64.h index edc8e5bbf0..b8a3ac01ef 100644 --- a/include/z64.h +++ b/include/z64.h @@ -987,7 +987,9 @@ struct PlayState { /* 0x18B4C */ PreRender pauseBgPreRender; /* 0x18B9C */ char unk_18B9C[0x2B8]; /* 0x18E54 */ SceneTableEntry* loadedScene; - /* 0x18E58 */ char unk_18E58[0x10]; + /* 0x18E58 */ char unk_18E58[0x4]; + /* 0x18E5C */ TexturePtr pictoPhotoI8; + /* 0x18E60 */ char unk_18E60[0x8]; /* 0x18E68 */ void* unk_18E68; /* 0x18E6C */ char unk_18E6C[0x3EC]; }; // size = 0x19258 diff --git a/include/z64actor.h b/include/z64actor.h index 3af22c4e9d..ce6cfe321b 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -310,7 +310,7 @@ typedef enum { #define ACTORCTX_FLAG_0 (1 << 0) #define ACTORCTX_FLAG_1 (1 << 1) -#define ACTORCTX_FLAG_2 (1 << 2) +#define ACTORCTX_FLAG_PICTO_BOX_ON (1 << 2) #define ACTORCTX_FLAG_3 (1 << 3) #define ACTORCTX_FLAG_4 (1 << 4) #define ACTORCTX_FLAG_5 (1 << 5) diff --git a/include/z64interface.h b/include/z64interface.h index cd17b12672..385f808357 100644 --- a/include/z64interface.h +++ b/include/z64interface.h @@ -4,6 +4,60 @@ #include "ultra64.h" #include "z64view.h" +typedef enum { + /* 0 */ A_BTN_STATE_0, + /* 1 */ A_BTN_STATE_1, + /* 2 */ A_BTN_STATE_2, + /* 3 */ A_BTN_STATE_3, + /* 4 */ A_BTN_STATE_4 +} AButtonState; + +typedef enum { + /* 0x00 */ DO_ACTION_ATTACK, + /* 0x01 */ DO_ACTION_CHECK, + /* 0x02 */ DO_ACTION_ENTER, + /* 0x03 */ DO_ACTION_RETURN, + /* 0x04 */ DO_ACTION_OPEN, + /* 0x05 */ DO_ACTION_JUMP, + /* 0x06 */ DO_ACTION_DECIDE, + /* 0x07 */ DO_ACTION_DIVE, + /* 0x08 */ DO_ACTION_FASTER, + /* 0x09 */ DO_ACTION_THROW, + /* 0x0A */ DO_ACTION_NONE, // in do_action_static, the texture at this position is NAVI, however this value is in practice the "No Action" value + /* 0x0B */ DO_ACTION_CLIMB, + /* 0x0C */ DO_ACTION_DROP, + /* 0x0D */ DO_ACTION_DOWN, + /* 0x0E */ DO_ACTION_QUIT, + /* 0x0F */ DO_ACTION_SPEAK, + /* 0x10 */ DO_ACTION_NEXT, + /* 0x11 */ DO_ACTION_GRAB, + /* 0x12 */ DO_ACTION_STOP, + /* 0x13 */ DO_ACTION_PUTAWAY, + /* 0x14 */ DO_ACTION_REEL, + /* 0x15 */ DO_ACTION_INFO, + /* 0x16 */ DO_ACTION_WARP, + /* 0x17 */ DO_ACTION_SNAP, + /* 0x18 */ DO_ACTION_EXPLODE, + /* 0x19 */ DO_ACTION_DANCE, + /* 0x1A */ DO_ACTION_MARCH, + /* 0x1B */ DO_ACTION_1, + /* 0x1C */ DO_ACTION_2, + /* 0x1D */ DO_ACTION_3, + /* 0x1E */ DO_ACTION_4, + /* 0x1F */ DO_ACTION_5, + /* 0x20 */ DO_ACTION_6, + /* 0x21 */ DO_ACTION_7, + /* 0x22 */ DO_ACTION_8, + /* 0x23 */ DO_ACTION_CURL, + /* 0x24 */ DO_ACTION_SURFACE, + /* 0x25 */ DO_ACTION_SWIM, + /* 0x26 */ DO_ACTION_PUNCH, + /* 0x27 */ DO_ACTION_POUND, + /* 0x28 */ DO_ACTION_HOOK, + /* 0x29 */ DO_ACTION_SHOOT, + /* 0x2A */ DO_ACTION_MAX +} DoAction; + typedef enum { /* 0 */ MINIGAME_STATE_NONE, /* 1 */ MINIGAME_STATE_COUNTDOWN_SETUP_3, @@ -39,6 +93,27 @@ typedef enum { #define PERFECT_LETTERS_NUM_LETTERS 8 #define PERFECT_LETTERS_ANGLE_PER_LETTER (0x10000 / PERFECT_LETTERS_NUM_LETTERS) +typedef enum { + /* 0 */ STORY_DMA_IDLE, + /* 1 */ STORY_DMA_LOADING, + /* 2 */ STORY_DMA_DONE +} StoryLoadStatus; + +typedef enum { + /* 0 */ STORY_STATE_OFF, + /* 1 */ STORY_STATE_INIT, + /* 2 */ STORY_STATE_IDLE, + /* 3 */ STORY_STATE_DESTROY, + /* 4 */ STORY_STATE_SETUP_IDLE, + /* 5 */ STORY_STATE_FADE_OUT, + /* 6 */ STORY_STATE_FADE_IN +} StoryState; + +typedef enum { + /* 0 */ STORY_TYPE_MASK_FESTIVAL, + /* 1 */ STORY_TYPE_GIANTS_LEAVING +} StoryType; + typedef struct { /* 0x000 */ View view; /* 0x168 */ Vtx* actionVtx; @@ -47,17 +122,16 @@ typedef struct { /* 0x174 */ u8* doActionSegment; /* 0x178 */ u8* iconItemSegment; /* 0x17C */ u8* mapSegment; - /* 0x180 */ u8* unk_180; - /* 0x184 */ DmaRequest dmaRequest_184; - /* 0x1A4 */ DmaRequest dmaRequest_1A4; - /* 0x1C4 */ DmaRequest dmaRequest_1C4; + /* 0x180 */ u8* unk_180; // unused segment? + /* 0x184 */ DmaRequest dmaRequest; + /* 0x1A4 */ UNK_TYPE1 unk_1A4[0x40]; // likely 2 DmaRequest /* 0x1E4 */ OSMesgQueue loadQueue; /* 0x1FC */ OSMesg loadMsg; /* 0x200 */ Viewport viewport; - /* 0x210 */ s16 unk_210; + /* 0x210 */ s16 aButtonState; /* 0x212 */ u16 unk_212; - /* 0x214 */ u16 unk_214; - /* 0x218 */ f32 unk_218; + /* 0x214 */ u16 aButtonDoAction; + /* 0x218 */ f32 aButtonRoll; /* 0x21C */ s16 unk_21C; /* 0x21E */ s16 bButtonDoAction; /* 0x220 */ s16 unk_220; @@ -74,7 +148,7 @@ typedef struct { /* 0x246 */ s16 heartsEnvG[2]; /* 0x24A */ s16 heartsEnvB[2]; /* 0x24E */ s16 health; - /* 0x250 */ s16 unkTimer; + /* 0x250 */ s16 healthTimer; /* 0x252 */ s16 lifeSizeChange; /* 0x254 */ s16 lifeSizeChangeDirection; // 1 means shrinking, 0 growing /* 0x256 */ s16 unk_256; @@ -84,7 +158,7 @@ typedef struct { /* 0x25E */ u16 minigameHiddenPoints; // Points to add to the secondary set of minigame points not displayed. Reset to 0 every frame. /* 0x260 */ u16 minigameAmmo; /* 0x262 */ u16 minigameUnusedPoints; // Associated with other minigame points, unused - /* 0x264 */ s16 unk_264; + /* 0x264 */ s16 screenFillAlpha; /* 0x266 */ s16 aAlpha; /* 0x268 */ s16 bAlpha; /* 0x26A */ s16 cLeftAlpha; @@ -116,27 +190,27 @@ typedef struct { /* 0x30A */ s16 perfectLettersColorTimer; /* 0x30C */ s16 perfectLettersTimer; struct { - /* 0x30E */ u8 unk_30E; // "h_gauge" + /* 0x30E */ u8 hGauge; /* 0x30F */ u8 bButton; /* 0x310 */ u8 aButton; - /* 0x311 */ u8 tradeItems; - /* 0x312 */ u8 unk_312; - /* 0x313 */ u8 unk_313; - /* 0x314 */ u8 unk_314; + /* 0x311 */ u8 tradeItems; // Includes deed trade quest, anju/kafei trade quest, bottles, and ocarina + /* 0x312 */ u8 songOfTime; + /* 0x313 */ u8 songOfDoubleTime; + /* 0x314 */ u8 invSongOfTime; /* 0x315 */ u8 songOfSoaring; /* 0x316 */ u8 songOfStorms; - /* 0x317 */ u8 unk_317; - /* 0x318 */ u8 pictographBox; + /* 0x317 */ u8 masks; + /* 0x318 */ u8 pictoBox; /* 0x319 */ u8 all; // "another"; enables all item restrictions } restrictions; // size = 0xC /* 0x31A */ u8 storyState; /* 0x31B */ u8 storyType; - /* 0x31C */ u8 unk_31C; - /* 0x320 */ OSMesgQueue unk_320; - /* 0x338 */ OSMesg unk_338; - /* 0x33C */ void* unk_33C; - /* 0x340 */ u32 unk_340; - /* 0x344 */ u32 unk_344; + /* 0x31C */ u8 storyDmaStatus; + /* 0x320 */ OSMesgQueue storyMsgQueue; + /* 0x338 */ OSMesg storyMsgBuf; + /* 0x33C */ u8* storySegment; + /* 0x340 */ uintptr_t storyAddr; + /* 0x344 */ size_t storySize; } InterfaceContext; // size = 0x348 #endif diff --git a/include/z64item.h b/include/z64item.h index 8110a3dd46..d1d36ebbad 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -9,7 +9,8 @@ typedef enum { /* 0 */ EQUIP_TYPE_SWORD, /* 1 */ EQUIP_TYPE_SHIELD, - /* 2 */ EQUIP_TYPE_MAX + /* 2 */ EQUIP_TYPE_TUNIC, // Remnant of OoT + /* 3 */ EQUIP_TYPE_MAX } EquipmentType; typedef enum { @@ -28,6 +29,14 @@ typedef enum { /* 3 */ EQUIP_VALUE_SHIELD_MAX } EquipValueShield; +typedef enum { + /* 0 */ EQUIP_VALUE_TUNIC_NONE, + /* 1 */ EQUIP_VALUE_TUNIC_KOKIRI, + /* 2 */ EQUIP_VALUE_TUNIC_GORON, + /* 3 */ EQUIP_VALUE_TUNIC_ZORA, + /* 4 */ EQUIP_VALUE_TUNIC_MAX +} EquipValueTunic; // Remnant of OoT + typedef enum { /* 0 */ UPG_QUIVER, /* 1 */ UPG_BOMB_BAG, diff --git a/include/z64player.h b/include/z64player.h index 21a1c0ca47..e99b261ce1 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -72,12 +72,12 @@ typedef enum PlayerMask { } PlayerMask; typedef enum { - /* 0 */ PLAYER_ENV_TIMER_NONE, - /* 1 */ PLAYER_ENV_TIMER_HOTROOM, - /* 2 */ PLAYER_ENV_TIMER_UNDERWATER_FLOOR, - /* 3 */ PLAYER_ENV_TIMER_SWIMMING, - /* 4 */ PLAYER_ENV_TIMER_UNDERWATER_FREE -} PlayerEnvTimerType; + /* 0 */ PLAYER_ENV_HAZARD_NONE, + /* 1 */ PLAYER_ENV_HAZARD_HOTROOM, + /* 2 */ PLAYER_ENV_HAZARD_UNDERWATER_FLOOR, + /* 3 */ PLAYER_ENV_HAZARD_SWIMMING, + /* 4 */ PLAYER_ENV_HAZARD_UNDERWATER_FREE +} PlayerEnvHazard; typedef enum PlayerItemAction { /* -1 */ PLAYER_IA_MINUS1 = -1, diff --git a/include/z64save.h b/include/z64save.h index d694327ff3..f9083144d6 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -55,6 +55,14 @@ typedef enum { #define MAGIC_NORMAL_METER 0x30 #define MAGIC_DOUBLE_METER (2 * MAGIC_NORMAL_METER) +// See `R_MAGIC_DBG_SET_UPGRADE` +#define MAGIC_DBG_SET_UPGRADE_NO_ACTION 0 +#define MAGIC_DBG_SET_UPGRADE_NORMAL_METER -1 +#define MAGIC_DBG_SET_UPGRADE_DOUBLE_METER 1 + +#define ENV_HAZARD_TEXT_TRIGGER_HOTROOM (1 << 0) +#define ENV_HAZARD_TEXT_TRIGGER_UNDERWATER (1 << 1) + #define SECONDS_TO_TIMER(seconds) ((seconds) * 100) #define OSTIME_TO_TIMER(osTime) ((osTime) * 64 / 3000 / 10000) @@ -69,7 +77,7 @@ typedef enum { /* 2 */ TIMER_ID_2, /* 3 */ TIMER_ID_MOON_CRASH, // timer used for mooncrash on the clocktower roof /* 4 */ TIMER_ID_MINIGAME_2, // minigame timer - /* 5 */ TIMER_ID_ENV, // environmental timer (underwater or hot room) + /* 5 */ TIMER_ID_ENV_HAZARD, // environmental hazard timer (underwater or hot room) /* 6 */ TIMER_ID_GORON_RACE_UNUSED, /* 7 */ TIMER_ID_MAX, /* 99 */ TIMER_ID_NONE = 99, @@ -89,7 +97,7 @@ typedef enum { /* 5 */ TIMER_STATE_STOP, /* 6 */ TIMER_STATE_6, // like `TIMER_STATE_STOP` but with extra minigame checks /* 7 */ TIMER_STATE_7, // stopped but still update `timerCurTimes` - /* 8 */ TIMER_STATE_ENV_START, + /* 8 */ TIMER_STATE_ENV_HAZARD_START, /* 9 */ TIMER_STATE_ALT_START, /* 10 */ TIMER_STATE_10, // precursor to `TIMER_STATE_ALT_COUNTING` /* 11 */ TIMER_STATE_ALT_COUNTING, @@ -139,6 +147,15 @@ typedef enum { /* 52 */ HUD_VISIBILITY_NONE_INSTANT = 52 } HudVisibility; +#define PICTO_PHOTO_WIDTH 160 +#define PICTO_PHOTO_HEIGHT 112 + +#define PICTO_PHOTO_TOPLEFT_X ((SCREEN_WIDTH - PICTO_PHOTO_WIDTH) / 2) +#define PICTO_PHOTO_TOPLEFT_Y ((SCREEN_HEIGHT - PICTO_PHOTO_HEIGHT) / 2) + +#define PICTO_PHOTO_SIZE (PICTO_PHOTO_WIDTH * PICTO_PHOTO_HEIGHT) +#define PICTO_PHOTO_COMPRESSED_SIZE (PICTO_PHOTO_SIZE * 5 / 8) + typedef struct SramContext { /* 0x00 */ u8* readBuff; /* 0x04 */ u8 *saveBuf; @@ -304,7 +321,7 @@ typedef struct SaveContext { /* 0x1050 */ u64 bottleTimerTimeLimits[BOTTLE_MAX]; // The original total time given before the timer expires, in centiseconds (1/100th sec). "bottle_sub" /* 0x1080 */ u64 bottleTimerCurTimes[BOTTLE_MAX]; // The remaining time left before the timer expires, in centiseconds (1/100th sec). "bottle_time" /* 0x10B0 */ OSTime bottleTimerPausedOsTimes[BOTTLE_MAX]; // The cumulative osTime spent with the timer paused. "bottle_stop_time" - /* 0x10E0 */ u64 pictoPhoto[1400]; // buffer containing the pictograph photo + /* 0x10E0 */ u8 pictoPhotoI5[PICTO_PHOTO_COMPRESSED_SIZE]; // buffer containing the pictograph photo, compressed to I5 from I8 /* 0x3CA0 */ s32 fileNum; // "file_no" /* 0x3CA4 */ s16 powderKegTimer; // "big_bom_timer" /* 0x3CA6 */ u8 unk_3CA6; @@ -318,7 +335,7 @@ typedef struct SaveContext { /* 0x3DBA */ u8 unk_3DBA; // "player_wipe_item" /* 0x3DBB */ u8 unk_3DBB; // "next_walk" /* 0x3DBC */ s16 dogParams; // "dog_flag" - /* 0x3DBE */ u8 textTriggerFlags; // "guide_status" + /* 0x3DBE */ u8 envHazardTextTriggerFlags; // "guide_status" /* 0x3DBF */ u8 showTitleCard; // "name_display" /* 0x3DC0 */ s16 unk_3DC0; // "shield_magic_timer" /* 0x3DC2 */ u8 unk_3DC2; // "pad1" @@ -607,7 +624,7 @@ typedef enum SunsSongState { #define WEEKEVENTREG_14_02 PACK_WEEKEVENTREG_FLAG(14, 0x02) #define WEEKEVENTREG_14_04 PACK_WEEKEVENTREG_FLAG(14, 0x04) -#define WEEKEVENTREG_14_08 PACK_WEEKEVENTREG_FLAG(14, 0x08) +#define WEEKEVENTREG_DRANK_CHATEAU_ROMANI PACK_WEEKEVENTREG_FLAG(14, 0x08) #define WEEKEVENTREG_14_10 PACK_WEEKEVENTREG_FLAG(14, 0x10) #define WEEKEVENTREG_14_20 PACK_WEEKEVENTREG_FLAG(14, 0x20) #define WEEKEVENTREG_14_40 PACK_WEEKEVENTREG_FLAG(14, 0x40) diff --git a/src/code/title_setup.c b/src/code/title_setup.c index 8ba6f9b563..4e9293ce79 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 7120964468..dac0d83001 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 d4927ae975..669aa338ab 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 44fff9f9f3..e3eb9839dc 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 29155be2a8..cd4ffa67fd 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]; -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 }, -}; +#define RESTRICTIONS_TABLE_END 0xFF -s16 D_801BF884 = 0; // pictoBox related -s16 D_801BF888 = false; // pictoBox related +#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, 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 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; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80112AF4.s") + 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); +} + +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; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80120F90.s") + OPEN_DISPS(play->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80121064.s") + gSPSegment(OVERLAY_DISP++, 0x02, interfaceCtx->parameterSegment); + gSPSegment(OVERLAY_DISP++, 0x09, interfaceCtx->doActionSegment); + gSPSegment(OVERLAY_DISP++, 0x08, interfaceCtx->iconItemSegment); + gSPSegment(OVERLAY_DISP++, 0x0B, interfaceCtx->mapSegment); -u8 D_801BFD94 = 0; -s16 D_801BFD98 = 0; -s16 D_801BFD9C = 0; + if (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) { + Interface_SetVertices(play); + func_801170B8(interfaceCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_Update.s") + // 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; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + 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; + } + + break; + + 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 71fbc897f7..7b3a875c2b 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 ac6ac560cc..d003252245 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 80ca0a4a6f..94d0e69c31 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)) { diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 2a96a0c8a0..4ed78d4588 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -215,7 +215,7 @@ void func_80953F9C(BgIngate* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() != -1) { Camera_ChangeSetting(mainCam, CAM_SET_NORMAL0); player->stateFlags1 |= PLAYER_STATE1_20; - play->actorCtx.flags &= ~ACTORCTX_FLAG_2; + play->actorCtx.flags &= ~ACTORCTX_FLAG_PICTO_BOX_ON; } else { Camera_ChangeSetting(mainCam, CAM_SET_BOAT_CRUISE); player->stateFlags1 &= ~PLAYER_STATE1_20; diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index 8d65c8a76f..f28c3cd341 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -4,6 +4,7 @@ * Description: Twinmold */ +#include "prevent_bss_reordering.h" #include "z_boss_02.h" #include "z64rumble.h" #include "z64shrink_window.h" diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index 3487d95c6a..bc168d5348 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -164,7 +164,7 @@ void DoorWarp1_Init(Actor* thisx, PlayState* play) { if ((play->sceneId == SCENE_MITURIN_BS) || (play->sceneId == SCENE_HAKUGIN_BS) || (play->sceneId == SCENE_INISIE_BS) || (play->sceneId == SCENE_SEA_BS)) { Environment_StopTime(); - play->interfaceCtx.restrictions.unk_312 = 1; + play->interfaceCtx.restrictions.songOfTime = 1; play->interfaceCtx.restrictions.songOfSoaring = 1; } } diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c index 23dc0f3505..0fa23e71a7 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -801,7 +801,7 @@ void EnFsn_BeginInteraction(EnFsn* this, PlayState* play) { ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); this->cutsceneState = ENFSN_CUTSCENESTATE_PLAYING; if (Player_GetMask(play) == PLAYER_MASK_NONE) { - func_8011552C(play, 16); + func_8011552C(play, DO_ACTION_NEXT); if (EnFsn_HasItemsToSell()) { this->actionFunc = EnFsn_AskBuyOrSell; } else { @@ -880,7 +880,7 @@ void EnFsn_AskBuyOrSell(EnFsn* this, PlayState* play) { } } } else if (talkState == TEXT_STATE_CHOICE) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (!EnFsn_TestEndInteraction(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: @@ -1052,7 +1052,7 @@ void EnFsn_ResumeShoppingInteraction(EnFsn* this, PlayState* play) { } else if (this->actor.textId != 0x29D6) { this->actionFunc = EnFsn_AskCanBuyAterRunningOutOfItems; } else { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; this->actionFunc = EnFsn_FaceShopkeeperSelling; @@ -1103,7 +1103,7 @@ void EnFsn_BrowseShelf(EnFsn* this, PlayState* play) { this->stickLeftPrompt.isEnabled = true; EnFsn_UpdateCursorPos(this, play); if (talkstate == TEXT_STATE_5) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (!EnFsn_HasPlayerSelectedItem(this, play, CONTROLLER1(&play->state))) { EnFsn_CursorLeftRight(this); if (this->cursorIndex != prevCursorIdx) { @@ -1205,7 +1205,7 @@ void EnFsn_SelectItem(EnFsn* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); if (EnFsn_TakeItemOffShelf(this) && (talkState == TEXT_STATE_CHOICE)) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (!EnFsn_TestCancelOption(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: @@ -1325,7 +1325,7 @@ void EnFsn_FaceShopkeeperSelling(EnFsn* this, PlayState* play) { u8 cursorIndex; if (talkState == TEXT_STATE_CHOICE) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (!EnFsn_TestEndInteraction(this, play, CONTROLLER1(&play->state)) && (!Message_ShouldAdvance(play) || !EnFsn_FacingShopkeeperDialogResult(this, play)) && this->stickAccumX > 0) { @@ -1333,7 +1333,7 @@ void EnFsn_FaceShopkeeperSelling(EnFsn* this, PlayState* play) { if (cursorIndex != CURSOR_INVALID) { this->cursorIndex = cursorIndex; this->actionFunc = EnFsn_LookToShelf; - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); this->stickRightPrompt.isEnabled = false; play_sound(NA_SE_SY_CURSOR); } diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 4cd82df43f..0346749a90 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -346,7 +346,7 @@ void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) { EnKakasi_SetupDialogue(this); return; } - if (play->actorCtx.flags & ACTORCTX_FLAG_2) { + if (play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON) { Actor_GetScreenPos(play, &this->picto.actor, &x, &y); if (this->picto.actor.projectedPos.z > -20.0f && x > 0 && x < SCREEN_WIDTH && y > 0 && y < SCREEN_HEIGHT && this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 789c96cf07..d1f7dbec9e 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -339,7 +339,7 @@ s32 EnOssan_TestCancelOption(EnOssan* this, PlayState* play, Input* input) { } void EnOssan_SetupStartShopping(PlayState* play, EnOssan* this, u8 skipHello) { - func_8011552C(play, 0x10); + func_8011552C(play, DO_ACTION_NEXT); if (!skipHello) { EnOssan_SetupAction(this, EnOssan_Hello); } else { @@ -350,7 +350,7 @@ void EnOssan_SetupStartShopping(PlayState* play, EnOssan* this, u8 skipHello) { void EnOssan_StartShopping(PlayState* play, EnOssan* this) { EnOssan_SetupAction(this, EnOssan_FaceShopkeeper); func_80151938(play, 0x640); - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); this->stickRightPrompt.isEnabled = true; this->stickLeftPrompt.isEnabled = true; } @@ -603,7 +603,7 @@ s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, PlayState* play) { } EnOssan_SetupAction(this, EnOssan_TalkToShopkeeper); func_80151938(play, sTalkOptionTextIds[this->actor.params]); - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; return true; @@ -630,7 +630,7 @@ void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play) { this->cutsceneState = ENOSSAN_CUTSCENESTATE_WAITING; } else { if (talkState == TEXT_STATE_CHOICE) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (!EnOssan_TestEndInteraction(this, play, CONTROLLER1(&play->state)) && (!Message_ShouldAdvance(play) || !EnOssan_FacingShopkeeperDialogResult(this, play))) { if (this->stickAccumX < 0) { @@ -638,7 +638,7 @@ void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play) { if (cursorIndex != CURSOR_INVALID) { this->cursorIndex = cursorIndex; EnOssan_SetupAction(this, EnOssan_LookToLeftShelf); - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; play_sound(NA_SE_SY_CURSOR); } @@ -647,7 +647,7 @@ void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play) { if (cursorIndex != CURSOR_INVALID) { this->cursorIndex = cursorIndex; EnOssan_SetupAction(this, EnOssan_LookToRightShelf); - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); this->stickRightPrompt.isEnabled = false; play_sound(NA_SE_SY_CURSOR); } @@ -853,7 +853,7 @@ void EnOssan_BrowseLeftShelf(EnOssan* this, PlayState* play) { this->stickRightPrompt.isEnabled = true; EnOssan_UpdateCursorPos(play, this); if (talkState == TEXT_STATE_5) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (!EnOssan_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) { if (this->moveHorizontal) { if (this->stickAccumX > 0) { @@ -911,7 +911,7 @@ void EnOssan_BrowseRightShelf(EnOssan* this, PlayState* play) { this->stickLeftPrompt.isEnabled = true; EnOssan_UpdateCursorPos(play, this); if (talkState == TEXT_STATE_5) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (!EnOssan_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) { if (this->moveHorizontal != 0) { if (this->stickAccumX < 0) { @@ -1052,7 +1052,7 @@ void EnOssan_SelectItem(EnOssan* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); if (EnOssan_TakeItemOffShelf(this) && (talkState == TEXT_STATE_CHOICE)) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (!EnOssan_TestCancelOption(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: @@ -1119,7 +1119,7 @@ void EnOssan_ContinueShopping(EnOssan* this, PlayState* play) { EnGirlA* item; if (talkState == TEXT_STATE_CHOICE) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (Message_ShouldAdvance(play)) { EnOssan_ResetItemPosition(this); item = this->items[this->cursorIndex]; diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index 1fa9b2059c..035bc2bfab 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -494,7 +494,7 @@ s32 EnSob1_TestCancelOption(EnSob1* this, PlayState* play, Input* input) { } void EnSob1_SetupStartShopping(PlayState* play, EnSob1* this, u8 skipHello) { - func_8011552C(play, 16); + func_8011552C(play, DO_ACTION_NEXT); if (!skipHello) { EnSob1_SetupAction(this, EnSob1_Hello); } else { @@ -505,7 +505,7 @@ void EnSob1_SetupStartShopping(PlayState* play, EnSob1* this, u8 skipHello) { void EnSob1_StartShopping(PlayState* play, EnSob1* this) { EnSob1_SetupAction(this, EnSob1_FaceShopkeeper); func_80151938(play, sFacingShopkeeperTextIds[this->shopType]); - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; } @@ -514,7 +514,7 @@ void EnSob1_TalkToShopkeeper(PlayState* play, EnSob1* this) { EnSob1_SetupAction(this, EnSob1_TalkingToShopkeeper); this->talkOptionTextId = EnSob1_GetTalkOption(this, play); func_80151938(play, this->talkOptionTextId); - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; } @@ -680,7 +680,7 @@ void EnSob1_FaceShopkeeper(EnSob1* this, PlayState* play) { this->cutsceneState = ENSOB1_CUTSCENESTATE_WAITING; } else { if (talkState == TEXT_STATE_CHOICE) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (!EnSob1_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { if (!Message_ShouldAdvance(play) || !EnSob1_FacingShopkeeperDialogResult(this, play)) { if (this->stickAccumX > 0) { @@ -688,7 +688,7 @@ void EnSob1_FaceShopkeeper(EnSob1* this, PlayState* play) { if (cursorIndex != CURSOR_INVALID) { this->cursorIndex = cursorIndex; EnSob1_SetupAction(this, EnSob1_LookToShelf); - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); this->stickRightPrompt.isEnabled = false; play_sound(NA_SE_SY_CURSOR); } @@ -933,7 +933,7 @@ void EnSob1_BrowseShelf(EnSob1* this, PlayState* play) { this->stickLeftPrompt.isEnabled = true; EnSob1_UpdateCursorPos(play, this); if (talkState == TEXT_STATE_5) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (!EnSob1_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) { EnSob1_CursorLeftRight(play, this); cursorIndex = this->cursorIndex; @@ -1041,7 +1041,7 @@ void EnSob1_SelectItem(EnSob1* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); if (EnSob1_TakeItemOffShelf(this) && (talkState == TEXT_STATE_CHOICE)) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (!EnSob1_TestCancelOption(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index 689af15ee8..dade95ee3f 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -4,6 +4,7 @@ * Description: Kafei */ +#include "prevent_bss_reordering.h" #include "z_en_test3.h" #include "objects/object_test3/object_test3.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index 9fbce37c7f..1dcb6ccb4d 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -381,8 +381,8 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { if ((temp_a3 * temp_a2) <= 0) { gSaveContext.unk_3CA7 = 1; - if (play->actorCtx.flags & ACTORCTX_FLAG_2) { - play->actorCtx.flags &= ~ACTORCTX_FLAG_2; + if (play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON) { + play->actorCtx.flags &= ~ACTORCTX_FLAG_PICTO_BOX_ON; } if (temp_a0 != CLOCK_TIME(6, 0)) { diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c index a8ffe6ea1a..caceb62bd9 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -253,7 +253,7 @@ s32 EnTrt_TestCancelOption(EnTrt* this, PlayState* play, Input* input) { } void EnTrt_SetupStartShopping(PlayState* play, EnTrt* this, u8 skipHello) { - func_8011552C(play, 0x10); + func_8011552C(play, DO_ACTION_NEXT); if (!skipHello) { this->actionFunc = EnTrt_Hello; } else { @@ -263,7 +263,7 @@ void EnTrt_SetupStartShopping(PlayState* play, EnTrt* this, u8 skipHello) { void EnTrt_StartShopping(PlayState* play, EnTrt* this) { func_80151938(play, 0x83E); - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; this->actionFunc = EnTrt_FaceShopkeeper; @@ -532,7 +532,7 @@ void EnTrt_FaceShopkeeper(EnTrt* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_WAITING; } else if (talkState == TEXT_STATE_CHOICE) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (!EnTrt_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { if ((!Message_ShouldAdvance(play) || !EnTrt_FacingShopkeeperDialogResult(this, play)) && (this->stickAccumX > 0)) { @@ -540,7 +540,7 @@ void EnTrt_FaceShopkeeper(EnTrt* this, PlayState* play) { if (cursorIndex != CURSOR_INVALID) { this->cursorIndex = cursorIndex; this->actionFunc = EnTrt_LookToShelf; - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); this->stickRightPrompt.isEnabled = false; play_sound(NA_SE_SY_CURSOR); } @@ -634,7 +634,7 @@ void EnTrt_BrowseShelf(EnTrt* this, PlayState* play) { this->stickLeftPrompt.isEnabled = true; EnTrt_UpdateCursorPos(play, this); if (talkState == TEXT_STATE_5) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (!EnTrt_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) { EnTrt_CursorLeftRight(play, this); if (this->cursorIndex != prevCursorIdx) { @@ -727,7 +727,7 @@ void EnTrt_SelectItem(EnTrt* this, PlayState* play) { if (EnTrt_TakeItemOffShelf(this)) { if (talkState == TEXT_STATE_CHOICE) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (!EnTrt_TestCancelOption(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: @@ -896,7 +896,7 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) { case 0x834: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_17_01)) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; this->actionFunc = EnTrt_Hello; @@ -905,7 +905,7 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) { } break; case 0x83E: - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; this->actionFunc = EnTrt_FaceShopkeeper; @@ -1114,7 +1114,7 @@ void EnTrt_ContinueShopping(EnTrt* this, PlayState* play) { EnGirlA* item; if (talkState == TEXT_STATE_CHOICE) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); if (Message_ShouldAdvance(play)) { EnTrt_ResetItemPosition(this); item = this->items[this->cursorIndex]; @@ -1427,7 +1427,7 @@ void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) { void EnTrt_SetupTalkToShopkeeper(PlayState* play, EnTrt* this) { this->actionFunc = EnTrt_TalkToShopkeeper; func_80151938(play, this->talkOptionTextId); - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c index 3d819423c0..fe72ee8405 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c @@ -650,7 +650,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; if (interfaceCtx->unk_212 == 6) { - func_8011552C(play, 0x15); + func_8011552C(play, DO_ACTION_INFO); } return; } else { @@ -834,7 +834,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG; if (interfaceCtx->unk_212 != 6) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); } // Stop receiving input to play a song as mentioned above @@ -847,7 +847,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { } } else { if (interfaceCtx->unk_212 != 6) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); } if (gSaveContext.buttonStatus[EQUIP_SLOT_A] != BTN_DISABLED) { gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_DISABLED; @@ -858,11 +858,11 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { } else { if ((cursor == QUEST_BOMBERS_NOTEBOOK) && (pauseCtx->cursorItem[PAUSE_QUEST] != PAUSE_ITEM_NONE)) { if (interfaceCtx->unk_212 != 6) { - func_8011552C(play, 6); + func_8011552C(play, DO_ACTION_DECIDE); } pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_BLUE; } else if (interfaceCtx->unk_212 == 6) { - func_8011552C(play, 0x15); + func_8011552C(play, DO_ACTION_INFO); } if ((pauseCtx->cursorItem[PAUSE_QUEST] != PAUSE_ITEM_NONE) && (msgCtx->msgLength == 0)) { diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c index 1152db2029..b8858b7ca4 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c @@ -894,10 +894,10 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, value); if (value != 0) { - BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = value + (ITEM_SWORD_KOKIRI - 1); + CUR_FORM_EQUIP(EQUIP_SLOT_B) = value + (ITEM_SWORD_KOKIRI - 1); gSaveContext.save.playerData.swordHealth = 100; } else { - BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NONE; + CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || @@ -909,7 +909,7 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, value); - BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = value + (ITEM_SWORD_KOKIRI - 1); + CUR_FORM_EQUIP(EQUIP_SLOT_B) = value + (ITEM_SWORD_KOKIRI - 1); gSaveContext.save.playerData.swordHealth = 100; } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c index 02cb7ce462..219ecd7a9e 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c @@ -566,8 +566,8 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { } } - if ((Player_GetEnvTimerType(play) >= PLAYER_ENV_TIMER_UNDERWATER_FLOOR) && - (Player_GetEnvTimerType(play) <= PLAYER_ENV_TIMER_UNDERWATER_FREE) && + if ((Player_GetEnvironmentalHazard(play) >= PLAYER_ENV_HAZARD_UNDERWATER_FLOOR) && + (Player_GetEnvironmentalHazard(play) <= PLAYER_ENV_HAZARD_UNDERWATER_FREE) && ((cursorSlot == (SLOT_MASK_DEKU - NUM_ITEM_SLOTS)) || (cursorSlot == (SLOT_MASK_GORON - NUM_ITEM_SLOTS)))) { play_sound(NA_SE_SY_ERROR); diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index 77f0a37c4f..a56afd71b3 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -548,7 +548,7 @@ void KaleidoScope_UpdateOpening(PlayState* play) { pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->state++; // PAUSE_STATE_MAIN pauseCtx->alpha = 255; - func_80115844(play, 3); + func_80115844(play, DO_ACTION_RETURN); } else if (pauseCtx->switchPageTimer == 64) { pauseCtx->pageIndex = sPageSwitchNextPageIndex[pauseCtx->nextPageMode]; pauseCtx->nextPageMode = (pauseCtx->pageIndex * 2) + 1; @@ -647,7 +647,7 @@ void KaleidoScope_Update(PlayState* play) { DmaMgr_SendRequest0(pauseCtx->iconItemLangSegment, SEGMENT_ROM_START(icon_item_jpn_static), size2); pauseCtx->nameSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemLangSegment + size2); - func_8011552C(play, 0x15); + func_8011552C(play, DO_ACTION_INFO); if (((void)0, gSaveContext.worldMapArea) < 0x16) { func_8082192C(pauseCtx->nameSegment + 0x400, ((void)0, gSaveContext.worldMapArea)); } @@ -693,7 +693,7 @@ void KaleidoScope_Update(PlayState* play) { case PAUSE_MAIN_STATE_IDLE: if (!pauseCtx->itemDescriptionOn && (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_B))) { - func_8011552C(play, 0xA); + func_8011552C(play, DO_ACTION_NONE); pauseCtx->state = PAUSE_STATE_UNPAUSE_SETUP; sPauseMenuVerticalOffset = -6240.0f; func_801A3AEC(0); @@ -727,7 +727,7 @@ void KaleidoScope_Update(PlayState* play) { if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_B)) { // Abort having the player play the song and close the pause menu AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); - func_8011552C(play, 0xA); + func_8011552C(play, DO_ACTION_NONE); pauseCtx->state = PAUSE_STATE_UNPAUSE_SETUP; sPauseMenuVerticalOffset = -6240.0f; func_801A3AEC(0); @@ -763,7 +763,7 @@ void KaleidoScope_Update(PlayState* play) { case PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG: if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_B)) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); - func_8011552C(play, 0xA); + func_8011552C(play, DO_ACTION_NONE); pauseCtx->state = PAUSE_STATE_UNPAUSE_SETUP; sPauseMenuVerticalOffset = -6240.0f; func_801A3AEC(0); @@ -805,7 +805,7 @@ void KaleidoScope_Update(PlayState* play) { case PAUSE_SAVEPROMPT_STATE_1: if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_CUP)) { if (pauseCtx->promptChoice != PAUSE_PROMPT_YES) { - func_8011552C(play, 0xA); + func_8011552C(play, DO_ACTION_NONE); pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_2; } else { play_sound(NA_SE_SY_PIECE_OF_HEART); @@ -823,13 +823,13 @@ void KaleidoScope_Update(PlayState* play) { sDelayTimer = 90; } } else if (CHECK_BTN_ALL(input->press.button, BTN_START)) { - func_8011552C(play, 0xA); + func_8011552C(play, DO_ACTION_NONE); pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_3; sPauseMenuVerticalOffset = -6240.0f; D_8082B90C = pauseCtx->roll; func_801A3AEC(0); } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { - func_8011552C(play, 0xA); + func_8011552C(play, DO_ACTION_NONE); pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_2; D_8082B90C = pauseCtx->roll; } @@ -844,7 +844,7 @@ void KaleidoScope_Update(PlayState* play) { case PAUSE_SAVEPROMPT_STATE_5: if (CHECK_BTN_ALL(input->press.button, BTN_B) || CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START) || (--sDelayTimer == 0)) { - func_8011552C(play, 0xA); + func_8011552C(play, DO_ACTION_NONE); pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_3; sPauseMenuVerticalOffset = -6240.0f; D_8082B90C = pauseCtx->roll; @@ -886,7 +886,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->roll = -314.0f; pauseCtx->itemPageRoll = pauseCtx->mapPageRoll = pauseCtx->questPageRoll = pauseCtx->maskPageRoll = 0.0f; - func_8011552C(play, 0x15); + func_8011552C(play, DO_ACTION_INFO); gSaveContext.buttonStatus[EQUIP_SLOT_B] = D_801C6A98[pauseCtx->pageIndex + 1][0]; gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = D_801C6A98[pauseCtx->pageIndex + 1][1]; gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = D_801C6A98[pauseCtx->pageIndex + 1][1]; @@ -901,10 +901,10 @@ void KaleidoScope_Update(PlayState* play) { break; case PAUSE_SAVEPROMPT_STATE_6: - if (interfaceCtx->unk_264 != 255) { - interfaceCtx->unk_264 += 10; - if (interfaceCtx->unk_264 >= 255) { - interfaceCtx->unk_264 = 255; + if (interfaceCtx->screenFillAlpha != 255) { + interfaceCtx->screenFillAlpha += 10; + if (interfaceCtx->screenFillAlpha >= 255) { + interfaceCtx->screenFillAlpha = 255; pauseCtx->state = PAUSE_STATE_OFF; Game_SetFramerateDivisor(&play->state, 3); R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_UNK4; @@ -1129,10 +1129,10 @@ void KaleidoScope_Update(PlayState* play) { break; case PAUSE_STATE_GAMEOVER_10: - if (interfaceCtx->unk_264 != 255) { - interfaceCtx->unk_264 += 10; - if (interfaceCtx->unk_264 >= 255) { - interfaceCtx->unk_264 = 255; + if (interfaceCtx->screenFillAlpha != 255) { + interfaceCtx->screenFillAlpha += 10; + if (interfaceCtx->screenFillAlpha >= 255) { + interfaceCtx->screenFillAlpha = 255; pauseCtx->state = PAUSE_STATE_OFF; Game_SetFramerateDivisor(&play->state, 3); @@ -1191,7 +1191,7 @@ void KaleidoScope_Update(PlayState* play) { DmaMgr_SendRequest0(pauseCtx->iconItemLangSegment, SEGMENT_ROM_START(icon_item_jpn_static), size2); pauseCtx->nameSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemLangSegment + size2); - func_8011552C(play, 0x16); + func_8011552C(play, DO_ACTION_WARP); worldMapCursorPoint = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; func_80821900(pauseCtx->nameSegment, worldMapCursorPoint); @@ -1227,7 +1227,7 @@ void KaleidoScope_Update(PlayState* play) { case PAUSE_STATE_OWLWARP_SELECT: if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_B)) { - func_8011552C(play, 0xA); + func_8011552C(play, DO_ACTION_NONE); pauseCtx->state = PAUSE_STATE_OWLWARP_6; sPauseMenuVerticalOffset = -6240.0f; func_801A3AEC(0); @@ -1247,7 +1247,7 @@ void KaleidoScope_Update(PlayState* play) { msgCtx->msgLength = 0; msgCtx->msgMode = 0; if (msgCtx->choiceIndex == 0) { - func_8011552C(play, 0xA); + func_8011552C(play, DO_ACTION_NONE); pauseCtx->state = PAUSE_STATE_OWLWARP_6; sPauseMenuVerticalOffset = -6240.0f; func_801A3AEC(0); @@ -1255,7 +1255,7 @@ void KaleidoScope_Update(PlayState* play) { play_sound(NA_SE_SY_DECIDE); } else { pauseCtx->state = PAUSE_STATE_OWLWARP_SELECT; - func_8011552C(play, 0x16); + func_8011552C(play, DO_ACTION_WARP); play_sound(NA_SE_SY_MESSAGE_PASS); } } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { @@ -1266,7 +1266,7 @@ void KaleidoScope_Update(PlayState* play) { } else if (CHECK_BTN_ALL(input->press.button, BTN_START)) { msgCtx->msgLength = 0; msgCtx->msgMode = 0; - func_8011552C(play, 0xA); + func_8011552C(play, DO_ACTION_NONE); pauseCtx->state = PAUSE_STATE_OWLWARP_6; sPauseMenuVerticalOffset = -6240.0f; func_801A3AEC(0); @@ -1346,8 +1346,8 @@ void KaleidoScope_Update(PlayState* play) { func_80143324(play, &play->skyboxCtx, play->skyboxId); if ((msgCtx->msgMode != 0) && (msgCtx->currentTextId == 0xFF)) { - func_80115844(play, 0x12); - func_8011552C(play, 0x12); + func_80115844(play, DO_ACTION_STOP); + func_8011552C(play, DO_ACTION_STOP); Interface_SetHudVisibility(HUD_VISIBILITY_A_B_C); } else { interfaceCtx->unk_222 = interfaceCtx->unk_224 = 0; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 46be74fb0e..ac39602196 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2106,8 +2106,8 @@ 0x8010F1A8:("Interface_UpdateHudAlphas",), 0x80110038:("func_80110038",), 0x80111CB4:("func_80111CB4",), - 0x801129E4:("func_801129E4",), - 0x80112AF4:("func_80112AF4",), + 0x801129E4:("Interface_SetSceneRestrictions",), + 0x80112AF4:("Interface_Noop",), 0x80112AFC:("Interface_InitMinigame",), 0x80112B40:("Interface_LoadItemIconImpl",), 0x80112BE4:("Interface_LoadItemIcon",), @@ -2162,8 +2162,8 @@ 0x8011E3B4:("Interface_UpdateBottleTimers",), 0x8011E730:("Interface_DrawMinigameIcons",), 0x8011F0E0:("Interface_Draw",), - 0x80120F90:("func_80120F90",), - 0x80121064:("func_80121064",), + 0x80120F90:("Interface_LoadStory",), + 0x80121064:("Interface_AllocStory",), 0x801210E0:("Interface_Update",), 0x80121F94:("Interface_Destroy",), 0x80121FC4:("Interface_Init",), @@ -2232,7 +2232,7 @@ 0x80124258:("Player_GetExplosiveHeld",), 0x80124278:("Player_ActionToSword",), 0x801242B4:("func_801242B4",), - 0x801242DC:("Player_GetEnvTimerType",), + 0x801242DC:("Player_GetEnvironmentalHazard",), 0x80124420:("func_80124420",), 0x80124618:("func_80124618",), 0x801246F4:("Player_DrawImpl",), @@ -2987,8 +2987,8 @@ 0x80166060:("func_80166060",), 0x801660B8:("func_801660B8",), 0x8016613C:("Play_Destroy",), - 0x801663C4:("func_801663C4",), - 0x80166644:("func_80166644",), + 0x801663C4:("Play_CompressI8ToI5",), + 0x80166644:("Play_DecompressI5ToI8",), 0x801668B4:("func_801668B4",), 0x80166968:("func_80166968",), 0x80166B30:("func_80166B30",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 7581da391d..cb31ce3602 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -1075,8 +1075,8 @@ 0x801BF5C0:("D_801BF5C0","UNK_PTR","",0x4), 0x801BF68C:("D_801BF68C","UNK_TYPE1","",0x1), 0x801BF6C0:("sRestrictionFlags","RestrictionFlags","[113]",0x1c4), - 0x801BF884:("D_801BF884","UNK_TYPE2","",0x2), - 0x801BF888:("D_801BF888","UNK_TYPE2","",0x2), + 0x801BF884:("sPictoState","UNK_TYPE2","",0x2), + 0x801BF888:("sPictoPhotoBeingTaken","UNK_TYPE2","",0x2), 0x801BF88C:("sHBAScoreTier","UNK_TYPE2","",0x2), 0x801BF890:("sMinigameScoreDigits","UNK_TYPE2","",0x2), 0x801BF898:("sCUpInvisible","UNK_TYPE2","",0x2), @@ -1086,7 +1086,7 @@ 0x801BF8A8:("sMagicMeterOutlinePrimBlue","UNK_TYPE2","",0x2), 0x801BF8AC:("sMagicBorderRatio","UNK_TYPE2","",0x2), 0x801BF8B0:("sMagicBorderStep","UNK_TYPE2","",0x2), - 0x801BF8DC:("sEnvTimerType","UNK_TYPE2","",0x2), + 0x801BF8DC:("sEnvHazard","UNK_TYPE2","",0x2), 0x801BF8E0:("sEnvTimerActive","UNK_TYPE2","",0x2), 0x801BF8E4:("sPostmanBunnyHoodState","UNK_TYPE2","",0x2), 0x801BF8E8:("sTimerPausedOsTime","UNK_TYPE4","",0x4), @@ -1100,7 +1100,7 @@ 0x801BF978:("D_801BF978","UNK_TYPE4","",0x4), 0x801BF97C:("D_801BF97C","UNK_TYPE4","",0x4), 0x801BF980:("D_801BF980","UNK_TYPE4","",0x4), - 0x801BF988:("D_801BF988","Gfx","[5]",0x28), + 0x801BF988:("sScreenFillSetupDL","Gfx","[5]",0x28), 0x801BF9B0:("D_801BF9B0","UNK_TYPE2","",0x2), 0x801BF9B4:("D_801BF9B4","UNK_TYPE1","",0x1), 0x801BF9BC:("D_801BF9BC","UNK_TYPE1","",0x1), @@ -1178,17 +1178,17 @@ 0x801BFCF8:("sTimerBeepSfxSeconds","UNK_TYPE4","",0x4), 0x801BFCFC:("D_801BFCFC","UNK_TYPE4","",0x4), 0x801BFD0C:("D_801BFD0C","UNK_TYPE4","",0x4), - 0x801BFD1C:("D_801BFD1C","UNK_TYPE1","",0x1), - 0x801BFD24:("D_801BFD24","UNK_TYPE1","",0x1), - 0x801BFD2C:("D_801BFD2C","UNK_TYPE1","",0x1), - 0x801BFD40:("D_801BFD40","UNK_TYPE1","",0x1), - 0x801BFD54:("D_801BFD54","UNK_TYPE1","",0x1), - 0x801BFD64:("D_801BFD64","UNK_TYPE1","",0x1), - 0x801BFD6C:("D_801BFD6C","UNK_TYPE2","",0x2), - 0x801BFD84:("D_801BFD84","UNK_TYPE1","",0x1), - 0x801BFD8C:("D_801BFD8C","UNK_TYPE1","",0x1), - 0x801BFD94:("D_801BFD94","UNK_TYPE4","",0x4), - 0x801BFD98:("D_801BFD98","UNK_TYPE4","[2]",0x8), + 0x801BFD1C:("sRupeeDigitsFirst","UNK_TYPE1","",0x1), + 0x801BFD24:("sRupeeDigitsCount","UNK_TYPE1","",0x1), + 0x801BFD2C:("sRupeeCounterIconPrimColors","UNK_TYPE1","",0x1), + 0x801BFD40:("sRupeeCounterIconEnvColors","UNK_TYPE1","",0x1), + 0x801BFD54:("sMinigameCountdownTextures","UNK_TYPE1","",0x1), + 0x801BFD64:("sMinigameCountdownTexWidths","UNK_TYPE1","",0x1), + 0x801BFD6C:("sMinigameCountdownPrimColors","UNK_TYPE2","",0x2), + 0x801BFD84:("sStoryTextures","UNK_TYPE1","",0x1), + 0x801BFD8C:("sStoryTLUTs","UNK_TYPE1","",0x1), + 0x801BFD94:("sIsSunsPlayedAtDay","UNK_TYPE4","",0x4), + 0x801BFD98:("sPrevTimeSpeed","UNK_TYPE4","[2]",0x8), 0x801BFDA0:("sMaskObjectIds","s16","[24]",0x30), 0x801BFDD0:("D_801BFDD0","UNK_TYPE1","",0x1), 0x801BFDE8:("sMaskItemIds","UNK_TYPE1","",0x1), @@ -1198,7 +1198,7 @@ 0x801BFF3C:("sActionModelGroups","UNK_TYPE1","",0x1), 0x801BFF90:("D_801BFF90","UNK_TYPE1","",0x1), 0x801BFF98:("sPlayerStrengths","UNK_TYPE1","",0x1), - 0x801BFFA0:("sEnvironmentTextTriggers","UNK_TYPE1","",0x1), + 0x801BFFA0:("sEnvHazardTextTriggers","UNK_TYPE1","",0x1), 0x801BFFB0:("gPlayerModelTypes","UNK_TYPE1","",0x1), 0x801BFFFC:("gPlayerWaistDLs","UNK_TYPE1","",0x1), 0x801C0024:("gPlayerHandHoldingShields","UNK_TYPE1","",0x1), @@ -4366,7 +4366,7 @@ 0x80209EA0:("gGfxPools","GfxPool","[2]",0x40620), 0x8024A4C0:("gAudioHeap","u8","[0x138000]",0x138000), 0x803824C0:("gSystemHeap","u8","[UNK_SIZE]",0x3fdb40), - 0x80780000:("D_80780000","u8","[0x4600]",0x4600), + 0x80780000:("gPictoPhotoI8","u8","[0x4600]",0x4600), 0x80784600:("D_80784600","u8","[0x56200]",0x56200), 0x807DA800:("gFramebuffer0","u16","[SCREEN_HEIGHT][SCREEN_WIDTH]",0x25800), 0x80800860:("titleRotation","s16","",0x2), diff --git a/tools/namefixer.py b/tools/namefixer.py index 9feaa0ef79..1981163159 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -499,6 +499,7 @@ wordReplace = { "func_80169E6C": "Play_SetupRespawnPoint", "func_8016A0AC": "Play_IsUnderwater", "func_801690CC": "Play_InCsMode", + "func_801129E4": "Interface_SetSceneRestrictions", "func_8011B4E0": "Interface_SetPerfectLetters", "func_80112AFC": "Interface_InitMinigame", "func_8010E9F0": "Interface_StartTimer", @@ -811,6 +812,8 @@ wordReplace = { "ICHAIN_F32_DIV1000(minVelocityY,": "ICHAIN_F32_DIV1000(terminalVelocity,", "ICHAIN_F32(minVelocityY,": "ICHAIN_F32(terminalVelocity,", + "ACTORCTX_FLAG_2": "ACTORCTX_FLAG_PICTO_BOX_ON", + "EXCH_ITEM_MINUS1": "PLAYER_IA_MINUS1", "EXCH_ITEM_NONE": "PLAYER_IA_NONE", "EXCH_ITEM_PICTO_BOX": "PLAYER_IA_PICTO_BOX", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 64ba2a468c..b6c9bb9148 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1620,8 +1620,8 @@ asm/non_matchings/code/z_parameter/Interface_UpdateButtonAlphas.s,Interface_Upda asm/non_matchings/code/z_parameter/Interface_UpdateHudAlphas.s,Interface_UpdateHudAlphas,0x8010F1A8,0x3A4 asm/non_matchings/code/z_parameter/func_80110038.s,func_80110038,0x80110038,0x71F asm/non_matchings/code/z_parameter/func_80111CB4.s,func_80111CB4,0x80111CB4,0x34C -asm/non_matchings/code/z_parameter/func_801129E4.s,func_801129E4,0x801129E4,0x44 -asm/non_matchings/code/z_parameter/func_80112AF4.s,func_80112AF4,0x80112AF4,0x2 +asm/non_matchings/code/z_parameter/Interface_SetSceneRestrictions.s,Interface_SetSceneRestrictions,0x801129E4,0x44 +asm/non_matchings/code/z_parameter/Interface_Noop.s,Interface_Noop,0x80112AF4,0x2 asm/non_matchings/code/z_parameter/Interface_InitMinigame.s,Interface_InitMinigame,0x80112AFC,0x11 asm/non_matchings/code/z_parameter/Interface_LoadItemIconImpl.s,Interface_LoadItemIconImpl,0x80112B40,0x29 asm/non_matchings/code/z_parameter/Interface_LoadItemIcon.s,Interface_LoadItemIcon,0x80112BE4,0xA @@ -1676,8 +1676,8 @@ asm/non_matchings/code/z_parameter/Interface_DrawTimers.s,Interface_DrawTimers,0 asm/non_matchings/code/z_parameter/Interface_UpdateBottleTimers.s,Interface_UpdateBottleTimers,0x8011E3B4,0xDF asm/non_matchings/code/z_parameter/Interface_DrawMinigameIcons.s,Interface_DrawMinigameIcons,0x8011E730,0x26C asm/non_matchings/code/z_parameter/Interface_Draw.s,Interface_Draw,0x8011F0E0,0x7AC -asm/non_matchings/code/z_parameter/func_80120F90.s,func_80120F90,0x80120F90,0x35 -asm/non_matchings/code/z_parameter/func_80121064.s,func_80121064,0x80121064,0x1F +asm/non_matchings/code/z_parameter/Interface_LoadStory.s,Interface_LoadStory,0x80120F90,0x35 +asm/non_matchings/code/z_parameter/Interface_AllocStory.s,Interface_AllocStory,0x80121064,0x1F asm/non_matchings/code/z_parameter/Interface_Update.s,Interface_Update,0x801210E0,0x3AD asm/non_matchings/code/z_parameter/Interface_Destroy.s,Interface_Destroy,0x80121F94,0xC asm/non_matchings/code/z_parameter/Interface_Init.s,Interface_Init,0x80121FC4,0x147 @@ -1746,7 +1746,7 @@ asm/non_matchings/code/z_player_lib/Player_ActionToExplosive.s,Player_ActionToEx asm/non_matchings/code/z_player_lib/Player_GetExplosiveHeld.s,Player_GetExplosiveHeld,0x80124258,0x8 asm/non_matchings/code/z_player_lib/Player_ActionToSword.s,Player_ActionToSword,0x80124278,0xF asm/non_matchings/code/z_player_lib/func_801242B4.s,func_801242B4,0x801242B4,0xA -asm/non_matchings/code/z_player_lib/Player_GetEnvTimerType.s,Player_GetEnvTimerType,0x801242DC,0x51 +asm/non_matchings/code/z_player_lib/Player_GetEnvironmentalHazard.s,Player_GetEnvironmentalHazard,0x801242DC,0x51 asm/non_matchings/code/z_player_lib/func_80124420.s,func_80124420,0x80124420,0x7E asm/non_matchings/code/z_player_lib/func_80124618.s,func_80124618,0x80124618,0x37 asm/non_matchings/code/z_player_lib/Player_DrawImpl.s,Player_DrawImpl,0x801246F4,0x5F @@ -2501,8 +2501,8 @@ asm/non_matchings/code/z_play/func_80165EC0.s,func_80165EC0,0x80165EC0,0x68 asm/non_matchings/code/z_play/func_80166060.s,func_80166060,0x80166060,0x16 asm/non_matchings/code/z_play/func_801660B8.s,func_801660B8,0x801660B8,0x21 asm/non_matchings/code/z_play/Play_Destroy.s,Play_Destroy,0x8016613C,0xA2 -asm/non_matchings/code/z_play/func_801663C4.s,func_801663C4,0x801663C4,0xA0 -asm/non_matchings/code/z_play/func_80166644.s,func_80166644,0x80166644,0x9C +asm/non_matchings/code/z_play/Play_CompressI8ToI5.s,Play_CompressI8ToI5,0x801663C4,0xA0 +asm/non_matchings/code/z_play/Play_DecompressI5ToI8.s,Play_DecompressI5ToI8,0x80166644,0x9C asm/non_matchings/code/z_play/func_801668B4.s,func_801668B4,0x801668B4,0x2D asm/non_matchings/code/z_play/func_80166968.s,func_80166968,0x80166968,0x72 asm/non_matchings/code/z_play/func_80166B30.s,func_80166B30,0x80166B30,0x339 diff --git a/tools/weekeventregconvert.py b/tools/weekeventregconvert.py index 4e8ca13113..e2092e5959 100755 --- a/tools/weekeventregconvert.py +++ b/tools/weekeventregconvert.py @@ -119,7 +119,7 @@ weekEventReg = { (14 << 8) | 0x01: "WEEKEVENTREG_14_01", (14 << 8) | 0x02: "WEEKEVENTREG_14_02", (14 << 8) | 0x04: "WEEKEVENTREG_14_04", - (14 << 8) | 0x08: "WEEKEVENTREG_14_08", + (14 << 8) | 0x08: "WEEKEVENTREG_DRANK_CHATEAU_ROMANI", (14 << 8) | 0x10: "WEEKEVENTREG_14_10", (14 << 8) | 0x20: "WEEKEVENTREG_14_20", (14 << 8) | 0x40: "WEEKEVENTREG_14_40",