diff --git a/include/z64.h b/include/z64.h index 53f70c497..6c8d26de7 100644 --- a/include/z64.h +++ b/include/z64.h @@ -35,6 +35,7 @@ #include "z64cutscene.h" #include "z64dma.h" #include "z64effect.h" +#include "z64interface.h" #include "z64item.h" #include "z64light.h" #include "z64map.h" @@ -483,205 +484,6 @@ typedef struct { /* 0x2CA */ s16 unk_2CA; } PauseContext; // size = 0x2D0 -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, - /* 2 */ MINIGAME_STATE_COUNTDOWN_3, - /* 3 */ MINIGAME_STATE_COUNTDOWN_SETUP_2, - /* 4 */ MINIGAME_STATE_COUNTDOWN_2, - /* 5 */ MINIGAME_STATE_COUNTDOWN_SETUP_1, - /* 6 */ MINIGAME_STATE_COUNTDOWN_1, - /* 7 */ MINIGAME_STATE_COUNTDOWN_SETUP_GO, - /* 8 */ MINIGAME_STATE_COUNTDOWN_GO, - /* 20 */ MINIGAME_STATE_NO_COUNTDOWN_SETUP = 20, - /* 21 */ MINIGAME_STATE_NO_COUNTDOWN, - /* 30 */ MINIGAME_STATE_PLAYING = 30 -} MinigameState; - -typedef enum { - /* 0 */ MINIGAME_PERFECT_TYPE_OFF, - /* 1 */ MINIGAME_PERFECT_TYPE_1, - /* 2 */ MINIGAME_PERFECT_TYPE_2, - /* 3 */ MINIGAME_PERFECT_TYPE_3 -} MinigamePerfectType; - -typedef enum { - /* 0 */ MINIGAME_PERFECT_STATE_0, - /* 1 */ MINIGAME_PERFECT_STATE_1, - /* 2 */ MINIGAME_PERFECT_STATE_2, - /* 3 */ MINIGAME_PERFECT_STATE_3, - /* 4 */ MINIGAME_PERFECT_STATE_4, - /* 5 */ MINIGAME_PERFECT_STATE_5, - /* 6 */ MINIGAME_PERFECT_STATE_6 -} MinigamePerfectState; - -typedef enum { - /* 0 */ STORY_LOAD_STATUS_REQUESTED, - /* 1 */ STORY_LOAD_STATUS_WAITING, - /* 2 */ STORY_LOAD_STATUS_FINISHED -} 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* aButtonVtx; - /* 0x16C */ Vtx* beatingHeartVtx; - /* 0x170 */ u8* parameterSegment; - /* 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; - /* 0x1E4 */ OSMesgQueue loadQueue; - /* 0x1FC */ OSMesg loadMsg; - /* 0x200 */ Viewport viewport; - /* 0x210 */ s16 unk_210; - /* 0x212 */ u16 unk_212; - /* 0x214 */ u16 unk_214; - /* 0x218 */ f32 unk_218; - /* 0x21C */ s16 bButtonDoActionActive; - /* 0x21E */ s16 bButtonDoAction; - /* 0x220 */ s16 tatlCalling; - /* 0x222 */ s16 unk_222; - /* 0x224 */ s16 unk_224; - /* 0x226 */ s16 lifeColorChange; - /* 0x228 */ s16 lifeColorChangeDirection; - /* 0x22A */ s16 beatingHeartPrim[3]; - /* 0x230 */ s16 beatingHeartEnv[3]; - /* 0x236 */ s16 heartsPrimR[2]; - /* 0x23A */ s16 heartsPrimG[2]; - /* 0x23E */ s16 heartsPrimB[2]; - /* 0x242 */ s16 heartsEnvR[2]; - /* 0x246 */ s16 heartsEnvG[2]; - /* 0x24A */ s16 heartsEnvB[2]; - /* 0x24E */ s16 health; - /* 0x250 */ s16 unkTimer; - /* 0x252 */ s16 lifeSizeChange; - /* 0x254 */ s16 lifeSizeChangeDirection; // 1 means shrinking, 0 growing - /* 0x256 */ s16 unk_256; - /* 0x258 */ s16 magicConsumptionTimer; // For certain magic states, 1 unit of magic is consumed every time the timer reaches 0 - /* 0x25A */ u8 numHorseBoosts; - /* 0x25C */ u16 minigamePoints; // Points to add to the minigame score. Reset to 0 every frame. - /* 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 screenFillAlpha; - /* 0x266 */ s16 aAlpha; - /* 0x268 */ s16 bAlpha; - /* 0x26A */ s16 cLeftAlpha; - /* 0x26C */ s16 cDownAlpha; - /* 0x26E */ s16 cRightAlpha; - /* 0x270 */ s16 healthAlpha; - /* 0x272 */ s16 magicAlpha; - /* 0x274 */ s16 minimapAlpha; - /* 0x276 */ s16 startAlpha; - /* 0x278 */ s16 unk_278; - /* 0x27A */ s16 dungeonOrBossAreaMapIndex; - /* 0x27C */ s16 mapRoomNum; - /* 0x27E */ u8 unk_27E; - /* 0x27F */ u8 unk_27F; - /* 0x280 */ u8 minigameState; - /* 0x282 */ s16 minigameCountdownAlpha; - /* 0x284 */ s16 minigameCountdownScale; - /* 0x286 */ s16 isMinigamePerfect; - /* 0x288 */ s16 minigamePerfectType; - /* 0x28A */ s16 minigamePerfectState[8]; - /* 0x29A */ u16 minigamePerfectLetterDirection[8]; - /* 0x2AA */ s16 minigamePerfectVtxOffset[8]; - /* 0x2BC */ f32 minigamePerfectLetterPosX[8]; - /* 0x2DC */ f32 minigamePerfectLetterPosY[8]; - /* 0x2FC */ s16 minigamePerfectPrimColor[4]; - /* 0x304 */ s16 minigamePerfectLetterCount; - /* 0x306 */ s16 minigamePerfectUnused; - /* 0x308 */ s16 minigamePerfectColorTargetIndex; - /* 0x30A */ s16 minigamePerfectColorTimer; - /* 0x30C */ s16 minigamePerfectTimer; - struct { - /* 0x30E */ u8 hGauge; - /* 0x30F */ u8 bButton; - /* 0x310 */ u8 aButton; - /* 0x311 */ u8 tradeItems; - /* 0x312 */ u8 unk_312; - /* 0x313 */ u8 unk_313; - /* 0x314 */ u8 unk_314; - /* 0x315 */ u8 songOfSoaring; - /* 0x316 */ u8 songOfStorms; - /* 0x317 */ u8 unk_317; - /* 0x318 */ u8 pictographBox; - /* 0x319 */ u8 all; // "another"; enables all item restrictions - } restrictions; // size = 0xC - /* 0x31A */ u8 storyState; - /* 0x31B */ u8 storyType; - /* 0x31C */ u8 storyLoadStatus; - /* 0x320 */ OSMesgQueue storyMsgQueue; - /* 0x338 */ OSMesg storyMsgBuf; - /* 0x33C */ u8* storySegment; - /* 0x340 */ uintptr_t storyAddr; - /* 0x344 */ size_t storySize; -} InterfaceContext; // size = 0x348 - typedef struct { /* 0x00 */ void* loadedRamAddr; /* 0x04 */ uintptr_t vromStart; diff --git a/include/z64interface.h b/include/z64interface.h new file mode 100644 index 000000000..cffa34a2a --- /dev/null +++ b/include/z64interface.h @@ -0,0 +1,206 @@ +#ifndef Z64INTERFACE_H +#define Z64INTERFACE_H + +#include "ultra64.h" +#include "z64view.h" + +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, + /* 2 */ MINIGAME_STATE_COUNTDOWN_3, + /* 3 */ MINIGAME_STATE_COUNTDOWN_SETUP_2, + /* 4 */ MINIGAME_STATE_COUNTDOWN_2, + /* 5 */ MINIGAME_STATE_COUNTDOWN_SETUP_1, + /* 6 */ MINIGAME_STATE_COUNTDOWN_1, + /* 7 */ MINIGAME_STATE_COUNTDOWN_SETUP_GO, + /* 8 */ MINIGAME_STATE_COUNTDOWN_GO, + /* 20 */ MINIGAME_STATE_NO_COUNTDOWN_SETUP = 20, + /* 21 */ MINIGAME_STATE_NO_COUNTDOWN, + /* 30 */ MINIGAME_STATE_PLAYING = 30 +} MinigameState; + +typedef enum { + /* 0 */ MINIGAME_PERFECT_TYPE_OFF, + /* 1 */ MINIGAME_PERFECT_TYPE_1, + /* 2 */ MINIGAME_PERFECT_TYPE_2, + /* 3 */ MINIGAME_PERFECT_TYPE_3 +} MinigamePerfectType; + +typedef enum { + /* 0 */ MINIGAME_PERFECT_STATE_0, + /* 1 */ MINIGAME_PERFECT_STATE_1, + /* 2 */ MINIGAME_PERFECT_STATE_2, + /* 3 */ MINIGAME_PERFECT_STATE_3, + /* 4 */ MINIGAME_PERFECT_STATE_4, + /* 5 */ MINIGAME_PERFECT_STATE_5, + /* 6 */ MINIGAME_PERFECT_STATE_6 +} MinigamePerfectState; + +typedef enum { + /* 0 */ STORY_LOAD_STATUS_REQUESTED, + /* 1 */ STORY_LOAD_STATUS_WAITING, + /* 2 */ STORY_LOAD_STATUS_FINISHED +} 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* aButtonVtx; + /* 0x16C */ Vtx* beatingHeartVtx; + /* 0x170 */ u8* parameterSegment; + /* 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; + /* 0x1E4 */ OSMesgQueue loadQueue; + /* 0x1FC */ OSMesg loadMsg; + /* 0x200 */ Viewport viewport; + /* 0x210 */ s16 unk_210; + /* 0x212 */ u16 unk_212; + /* 0x214 */ u16 unk_214; + /* 0x218 */ f32 unk_218; + /* 0x21C */ s16 bButtonDoActionActive; + /* 0x21E */ s16 bButtonDoAction; + /* 0x220 */ s16 tatlCalling; + /* 0x222 */ s16 unk_222; + /* 0x224 */ s16 unk_224; + /* 0x226 */ s16 lifeColorChange; + /* 0x228 */ s16 lifeColorChangeDirection; + /* 0x22A */ s16 beatingHeartPrim[3]; + /* 0x230 */ s16 beatingHeartEnv[3]; + /* 0x236 */ s16 heartsPrimR[2]; + /* 0x23A */ s16 heartsPrimG[2]; + /* 0x23E */ s16 heartsPrimB[2]; + /* 0x242 */ s16 heartsEnvR[2]; + /* 0x246 */ s16 heartsEnvG[2]; + /* 0x24A */ s16 heartsEnvB[2]; + /* 0x24E */ s16 health; + /* 0x250 */ s16 unkTimer; + /* 0x252 */ s16 lifeSizeChange; + /* 0x254 */ s16 lifeSizeChangeDirection; // 1 means shrinking, 0 growing + /* 0x256 */ s16 unk_256; + /* 0x258 */ s16 magicConsumptionTimer; // For certain magic states, 1 unit of magic is consumed every time the timer reaches 0 + /* 0x25A */ u8 numHorseBoosts; + /* 0x25C */ u16 minigamePoints; // Points to add to the minigame score. Reset to 0 every frame. + /* 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 screenFillAlpha; + /* 0x266 */ s16 aAlpha; + /* 0x268 */ s16 bAlpha; + /* 0x26A */ s16 cLeftAlpha; + /* 0x26C */ s16 cDownAlpha; + /* 0x26E */ s16 cRightAlpha; + /* 0x270 */ s16 healthAlpha; + /* 0x272 */ s16 magicAlpha; + /* 0x274 */ s16 minimapAlpha; + /* 0x276 */ s16 startAlpha; + /* 0x278 */ s16 unk_278; + /* 0x27A */ s16 dungeonOrBossAreaMapIndex; + /* 0x27C */ s16 mapRoomNum; + /* 0x27E */ u8 unk_27E; + /* 0x27F */ u8 unk_27F; + /* 0x280 */ u8 minigameState; + /* 0x282 */ s16 minigameCountdownAlpha; + /* 0x284 */ s16 minigameCountdownScale; + /* 0x286 */ s16 isMinigamePerfect; + /* 0x288 */ s16 minigamePerfectType; + /* 0x28A */ s16 minigamePerfectState[8]; + /* 0x29A */ u16 minigamePerfectLetterDirection[8]; + /* 0x2AA */ s16 minigamePerfectVtxOffset[8]; + /* 0x2BC */ f32 minigamePerfectLetterPosX[8]; + /* 0x2DC */ f32 minigamePerfectLetterPosY[8]; + /* 0x2FC */ s16 minigamePerfectPrimColor[4]; + /* 0x304 */ s16 minigamePerfectLetterCount; + /* 0x306 */ s16 minigamePerfectUnused; + /* 0x308 */ s16 minigamePerfectColorTargetIndex; + /* 0x30A */ s16 minigamePerfectColorTimer; + /* 0x30C */ s16 minigamePerfectTimer; + struct { + /* 0x30E */ u8 hGauge; + /* 0x30F */ u8 bButton; + /* 0x310 */ u8 aButton; + /* 0x311 */ u8 tradeItems; + /* 0x312 */ u8 unk_312; + /* 0x313 */ u8 unk_313; + /* 0x314 */ u8 unk_314; + /* 0x315 */ u8 songOfSoaring; + /* 0x316 */ u8 songOfStorms; + /* 0x317 */ u8 unk_317; + /* 0x318 */ u8 pictographBox; + /* 0x319 */ u8 all; // "another"; enables all item restrictions + } restrictions; // size = 0xC + /* 0x31A */ u8 storyState; + /* 0x31B */ u8 storyType; + /* 0x31C */ u8 storyLoadStatus; + /* 0x320 */ OSMesgQueue storyMsgQueue; + /* 0x338 */ OSMesg storyMsgBuf; + /* 0x33C */ u8* storySegment; + /* 0x340 */ uintptr_t storyAddr; + /* 0x344 */ size_t storySize; +} InterfaceContext; // size = 0x348 + +#endif diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 70cf0732d..6200e2401 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -6085,6 +6085,7 @@ void Interface_Draw(PlayState* play) { 1 << 10, 1 << 10); } break; + case SCENE_KINSTA1: case SCENE_KINDAN2: // Gold Skulltula Icon @@ -6137,8 +6138,8 @@ void Interface_Draw(PlayState* play) { 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; } @@ -6213,6 +6214,7 @@ void Interface_Draw(PlayState* play) { func_80118BA4(play); func_80119030(play); + // Draw either the minigame countdown or the three-day clock if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { if ((interfaceCtx->minigameState != MINIGAME_STATE_NONE) && (interfaceCtx->minigameState < MINIGAME_STATE_NO_COUNTDOWN_SETUP)) { @@ -6254,6 +6256,7 @@ void Interface_Draw(PlayState* play) { } } + // Draw the letters of minigame perfect if (interfaceCtx->isMinigamePerfect) { Interface_DrawMinigamePerfect(play); } @@ -6387,7 +6390,7 @@ void Interface_AllocStory(PlayState* play) { if (interfaceCtx->storySegment == NULL) { interfaceCtx->storySegment = ZeldaArena_Malloc(interfaceCtx->storySize); } - Interface_LoadStory(play, 0); + Interface_LoadStory(play, OS_MESG_NOBLOCK); } void Interface_Update(PlayState* play) {