summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/color.h2
-rw-r--r--include/functions.h43
-rw-r--r--include/macros.h4
-rw-r--r--include/padmgr.h2
-rw-r--r--include/variables.h7
-rw-r--r--include/z64.h250
-rw-r--r--include/z64actor.h70
-rw-r--r--include/z64collision_check.h12
-rw-r--r--include/z64frame_advance.h19
-rw-r--r--include/z64game_over.h29
-rw-r--r--include/z64play.h161
-rw-r--r--include/z64scene.h49
-rw-r--r--include/z64sfx_source.h21
-rw-r--r--include/z64vis.h2
14 files changed, 374 insertions, 297 deletions
diff --git a/include/color.h b/include/color.h
index 014e7accf..723983f83 100644
--- a/include/color.h
+++ b/include/color.h
@@ -10,7 +10,7 @@ typedef struct {
} Color_RGBA8;
// only use when necessary for alignment purposes
-typedef union {
+typedef union Color_RGBA8_u32 {
struct {
u8 r, g, b, a;
};
diff --git a/include/functions.h b/include/functions.h
index 54b57c8ea..d9c29270a 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -757,9 +757,7 @@ void Cutscene_HandleConditionalTriggers(PlayState* play);
void Cutscene_SetScript(PlayState* play, void* script);
void* MemCpy(void* dest, const void* src, s32 len);
void GetItem_Draw(PlayState* play, s16 drawId);
-void SfxSource_InitAll(PlayState* play);
-void SfxSource_UpdateAll(PlayState* play);
-void SfxSource_PlaySfxAtFixedWorldPos(PlayState* play, Vec3f* worldPos, s32 duration, u16 sfxId);
+
u16 QuestHint_GetSariaTextId(PlayState* play);
u16 QuestHint_GetNaviTextId(PlayState* play);
u16 MaskReaction_GetTextId(PlayState* play, u32 maskReactionSet);
@@ -932,8 +930,7 @@ void Interface_Update(PlayState* play);
Path* Path_GetByIndex(PlayState* play, s16 index, s16 max);
f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw);
void Path_CopyLastPoint(Path* path, Vec3f* dest);
-void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx);
-s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input);
+
void Player_SetBootData(PlayState* play, Player* this);
int Player_InBlockingCsMode(PlayState* play, Player* this);
int Player_InCsMode(PlayState* play);
@@ -1204,37 +1201,7 @@ void KaleidoScopeCall_Init(PlayState* play);
void KaleidoScopeCall_Destroy(PlayState* play);
void KaleidoScopeCall_Update(PlayState* play);
void KaleidoScopeCall_Draw(PlayState* play);
-void Play_SetViewpoint(PlayState* this, s16 viewpoint);
-s32 Play_CheckViewpoint(PlayState* this, s16 viewpoint);
-void Play_SetShopBrowsingViewpoint(PlayState* this);
-Gfx* Play_SetFog(PlayState* this, Gfx* gfx);
-void Play_Destroy(GameState* thisx);
-void Play_Init(GameState* thisx);
-void Play_Main(GameState* thisx);
-int Play_InCsMode(PlayState* this);
-f32 func_800BFCB8(PlayState* this, MtxF* mf, Vec3f* pos);
-void* Play_LoadFile(PlayState* this, RomFile* file);
-void Play_GetScreenPos(PlayState* this, Vec3f* src, Vec3f* dest);
-s16 Play_CreateSubCamera(PlayState* this);
-s16 Play_GetActiveCamId(PlayState* this);
-s16 Play_ChangeCameraStatus(PlayState* this, s16 camId, s16 status);
-void Play_ClearCamera(PlayState* this, s16 camId);
-void Play_ClearAllSubCameras(PlayState* this);
-Camera* Play_GetCamera(PlayState* this, s16 camId);
-s32 Play_SetCameraAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye);
-s32 Play_SetCameraAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up);
-s32 Play_SetCameraFov(PlayState* this, s16 camId, f32 fov);
-s32 Play_SetCameraRoll(PlayState* this, s16 camId, s16 roll);
-void Play_CopyCamera(PlayState* this, s16 destCamId, s16 srcCamId);
-s32 Play_InitCameraDataUsingPlayer(PlayState* this, s16 camId, Player* player, s16 setting);
-s32 Play_RequestCameraSetting(PlayState* this, s16 camId, s16 setting);
-void Play_ReturnToMainCam(PlayState* this, s16 camId, s16 duration);
-void Play_SaveSceneFlags(PlayState* this);
-void Play_SetupRespawnPoint(PlayState* this, s32 respawnMode, s32 playerParams);
-void Play_TriggerVoidOut(PlayState* this);
-void Play_TriggerRespawn(PlayState* this);
-int Play_CamIsNotFixed(PlayState* this);
-int FrameAdvance_IsEnabled(PlayState* this);
+
s32 func_800C0D34(PlayState* this, Actor* actor, s16* yaw);
s32 func_800C0DB4(PlayState* this, Vec3f* pos);
void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg);
@@ -1777,9 +1744,7 @@ u8 Message_GetState(MessageContext* msgCtx);
void Message_Draw(PlayState* play);
void Message_Update(PlayState* play);
void Message_SetTables(void);
-void GameOver_Init(PlayState* play);
-void GameOver_FadeInLights(PlayState* play);
-void GameOver_Update(PlayState* play);
+
void Interface_Destroy(PlayState* play);
void Interface_Init(PlayState* play);
void Message_Init(PlayState* play);
diff --git a/include/macros.h b/include/macros.h
index 6315fbe94..a42693b39 100644
--- a/include/macros.h
+++ b/include/macros.h
@@ -30,10 +30,6 @@
#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0))
-#define GET_PLAYER(play) ((Player*)(play)->actorCtx.actorLists[ACTORCAT_PLAYER].head)
-
-#define GET_ACTIVE_CAM(play) ((play)->cameraPtrs[(play)->activeCamId])
-
#define LINK_IS_ADULT (gSaveContext.save.linkAge == LINK_AGE_ADULT)
#define LINK_IS_CHILD (gSaveContext.save.linkAge == LINK_AGE_CHILD)
diff --git a/include/padmgr.h b/include/padmgr.h
index ba86315c6..fd58765c0 100644
--- a/include/padmgr.h
+++ b/include/padmgr.h
@@ -10,7 +10,7 @@ typedef enum {
CONT_PAK_OTHER
} ControllerPakType;
-typedef struct {
+typedef struct Input {
/* 0x00 */ OSContPad cur;
/* 0x06 */ OSContPad prev;
/* 0x0C */ OSContPad press; // X/Y store delta from last frame
diff --git a/include/variables.h b/include/variables.h
index 0b3b260bf..10f67329f 100644
--- a/include/variables.h
+++ b/include/variables.h
@@ -98,7 +98,7 @@ extern u64 gMojiFontTex[]; // original name: "font_ff"
extern KaleidoMgrOverlay gKaleidoMgrOverlayTable[KALEIDO_OVL_MAX];
extern KaleidoMgrOverlay* gKaleidoMgrCurOvl;
extern u8 gBossMarkState;
-extern void* gDebugCutsceneScript;
+
extern s32 gScreenWidth;
extern s32 gScreenHeight;
extern Mtx gMtxClear;
@@ -197,10 +197,7 @@ extern MapData* gMapData;
extern f32 gBossMarkScale;
extern u32 D_8016139C;
extern PauseMapMarksData* gLoadedPauseMarkDataTable;
-extern TransitionTile gTransitionTile;
-extern s32 gTransitionTileState;
-extern VisMono gPlayVisMono;
-extern Color_RGBA8_u32 gVisMonoColor;
+
extern PreNmiBuff* gAppNmiBufferPtr;
extern uintptr_t gSegments[NUM_SEGMENTS];
extern Scheduler gScheduler;
diff --git a/include/z64.h b/include/z64.h
index 2a556d3f9..03ef633b7 100644
--- a/include/z64.h
+++ b/include/z64.h
@@ -20,6 +20,7 @@
#include "z64curve.h"
#include "z64scene.h"
#include "z64effect.h"
+#include "z64game_over.h"
#include "z64item.h"
#include "z64animation.h"
#include "z64animation_legacy.h"
@@ -28,11 +29,13 @@
#include "z64map_mark.h"
#include "z64message.h"
#include "z64pause.h"
+#include "z64play.h"
#include "z64skin.h"
#include "z64game.h"
#include "z64transition.h"
#include "z64transition_instances.h"
#include "z64interface.h"
+#include "z64sfx_source.h"
#include "z64skybox.h"
#include "z64sram.h"
#include "z64view.h"
@@ -105,90 +108,6 @@
#define REGION_NATIVE REGION_EU
typedef struct {
- /* 0x00 */ u8 seqId;
- /* 0x01 */ u8 natureAmbienceId;
-} SequenceContext; // size = 0x2
-
-typedef struct {
- /* 0x00 */ s32 enabled;
- /* 0x04 */ s32 timer;
-} FrameAdvanceContext; // size = 0x8
-
-typedef struct {
- /* 0x00 */ Vec3f pos;
- /* 0x0C */ f32 unk_0C; // radius?
- /* 0x10 */ Color_RGB8 color;
-} TargetContextEntry; // size = 0x14
-
-typedef struct {
- /* 0x00 */ Vec3f naviRefPos; // possibly wrong
- /* 0x0C */ Vec3f targetCenterPos;
- /* 0x18 */ Color_RGBAf naviInner;
- /* 0x28 */ Color_RGBAf naviOuter;
- /* 0x38 */ Actor* arrowPointedActor;
- /* 0x3C */ Actor* targetedActor;
- /* 0x40 */ f32 unk_40;
- /* 0x44 */ f32 unk_44;
- /* 0x48 */ s16 unk_48;
- /* 0x4A */ u8 activeCategory;
- /* 0x4B */ u8 unk_4B;
- /* 0x4C */ s8 unk_4C;
- /* 0x4D */ char unk_4D[0x03];
- /* 0x50 */ TargetContextEntry arr_50[3];
- /* 0x8C */ Actor* unk_8C;
- /* 0x90 */ Actor* bgmEnemy; // The nearest enemy to player with the right flags that will trigger NA_BGM_ENEMY
- /* 0x94 */ Actor* unk_94;
-} TargetContext; // size = 0x98
-
-typedef struct {
- /* 0x00 */ void* texture;
- /* 0x04 */ s16 x;
- /* 0x06 */ s16 y;
- /* 0x08 */ u8 width;
- /* 0x09 */ u8 height;
- /* 0x0A */ u8 durationTimer; // how long the title card appears for before fading
- /* 0x0B */ u8 delayTimer; // how long the title card waits to appear
- /* 0x0C */ s16 alpha;
- /* 0x0E */ s16 intensity;
-} TitleCardContext; // size = 0x10
-
-typedef struct {
- /* 0x00 */ s32 length; // number of actors loaded of this category
- /* 0x04 */ Actor* head; // pointer to head of the linked list of this category (most recent actor added)
-} ActorListEntry; // size = 0x08
-
-typedef struct {
- /* 0x0000 */ u8 freezeFlashTimer;
- /* 0x0001 */ char unk_01[0x01];
- /* 0x0002 */ u8 unk_02;
- /* 0x0003 */ u8 lensActive;
- /* 0x0004 */ char unk_04[0x04];
- /* 0x0008 */ u8 total; // total number of actors loaded
- /* 0x000C */ ActorListEntry actorLists[ACTORCAT_MAX];
- /* 0x006C */ TargetContext targetCtx;
- struct {
- /* 0x0104 */ u32 swch;
- /* 0x0108 */ u32 tempSwch;
- /* 0x010C */ u32 unk0;
- /* 0x0110 */ u32 unk1;
- /* 0x0114 */ u32 chest;
- /* 0x0118 */ u32 clear;
- /* 0x011C */ u32 tempClear;
- /* 0x0120 */ u32 collect;
- /* 0x0124 */ u32 tempCollect;
- } flags;
- /* 0x0128 */ TitleCardContext titleCtx;
- /* 0x0138 */ char unk_138[0x04];
- /* 0x013C */ void* absoluteSpace; // Space used to allocate actor overlays with alloc type ACTOROVL_ALLOC_ABSOLUTE
-} ActorContext; // size = 0x140
-
-typedef struct {
- /* 0x00 */ u16 countdown;
- /* 0x04 */ Vec3f worldPos;
- /* 0x10 */ Vec3f projectedPos;
-} SfxSource; // size = 0x1C
-
-typedef struct {
/* 0x00 */ void* loadedRamAddr;
/* 0x04 */ RomFile file;
/* 0x0C */ void* vramStart;
@@ -204,85 +123,10 @@ typedef enum {
} KaleidoOverlayType;
typedef enum {
- /* 00 */ GAMEOVER_INACTIVE,
- /* 01 */ GAMEOVER_DEATH_START,
- /* 02 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for link to fall and hit the ground
- /* 03 */ GAMEOVER_DEATH_DELAY_MENU, // wait for 1 second before showing the game over menu
- /* 04 */ GAMEOVER_DEATH_MENU, // do nothing while kaleidoscope handles the game over menu
- /* 20 */ GAMEOVER_REVIVE_START = 20,
- /* 21 */ GAMEOVER_REVIVE_RUMBLE,
- /* 22 */ GAMEOVER_REVIVE_WAIT_GROUND, // wait for link to fall and hit the ground
- /* 23 */ GAMEOVER_REVIVE_WAIT_FAIRY, // wait for the fairy to rise all the way up out of links body
- /* 24 */ GAMEOVER_REVIVE_FADE_OUT // fade out the game over lights as link is revived and gets back up
-} GameOverState;
-
-typedef struct {
- /* 0x00 */ u16 state;
-} GameOverContext; // size = 0x2
-
-typedef enum {
/* 0 */ LENS_MODE_SHOW_ACTORS, // lens actors are invisible by default, and shown by using lens (for example, invisible enemies)
/* 1 */ LENS_MODE_HIDE_ACTORS // lens actors are visible by default, and hidden by using lens (for example, fake walls)
} LensMode;
-typedef enum {
- /* 0 */ ROOM_BEHAVIOR_TYPE1_0,
- /* 1 */ ROOM_BEHAVIOR_TYPE1_1,
- /* 2 */ ROOM_BEHAVIOR_TYPE1_2,
- /* 3 */ ROOM_BEHAVIOR_TYPE1_3, // unused
- /* 4 */ ROOM_BEHAVIOR_TYPE1_4, // unused
- /* 5 */ ROOM_BEHAVIOR_TYPE1_5
-} RoomBehaviorType1;
-
-typedef enum {
- /* 0 */ ROOM_BEHAVIOR_TYPE2_0,
- /* 1 */ ROOM_BEHAVIOR_TYPE2_1,
- /* 2 */ ROOM_BEHAVIOR_TYPE2_2,
- /* 3 */ ROOM_BEHAVIOR_TYPE2_3,
- /* 4 */ ROOM_BEHAVIOR_TYPE2_4,
- /* 5 */ ROOM_BEHAVIOR_TYPE2_5,
- /* 6 */ ROOM_BEHAVIOR_TYPE2_6
-} RoomBehaviorType2;
-
-typedef struct {
- /* 0x00 */ s8 num;
- /* 0x01 */ u8 unk_01;
- /* 0x02 */ u8 behaviorType2;
- /* 0x03 */ u8 behaviorType1;
- /* 0x04 */ s8 echo;
- /* 0x05 */ u8 lensMode;
- /* 0x08 */ RoomShape* roomShape; // original name: "ground_shape"
- /* 0x0C */ void* segment;
- /* 0x10 */ char unk_10[0x4];
-} Room; // size = 0x14
-
-typedef struct {
- /* 0x00 */ Room curRoom;
- /* 0x14 */ Room prevRoom;
- /* 0x28 */ void* bufPtrs[2];
- /* 0x30 */ u8 unk_30;
- /* 0x31 */ s8 status;
- /* 0x34 */ void* unk_34;
- /* 0x38 */ DmaRequest dmaRequest;
- /* 0x58 */ OSMesgQueue loadQueue;
- /* 0x70 */ OSMesg loadMsg;
- /* 0x74 */ s16 unk_74[2]; // context-specific data used by the current scene draw config
-} RoomContext; // size = 0x78
-
-#define SAC_ENABLE (1 << 0)
-
-typedef struct {
- /* 0x000 */ s16 colATCount;
- /* 0x002 */ u16 sacFlags;
- /* 0x004 */ Collider* colAT[COLLISION_CHECK_AT_MAX];
- /* 0x0CC */ s32 colACCount;
- /* 0x0D0 */ Collider* colAC[COLLISION_CHECK_AC_MAX];
- /* 0x1C0 */ s32 colOCCount;
- /* 0x1C4 */ Collider* colOC[COLLISION_CHECK_OC_MAX];
- /* 0x28C */ s32 colLineCount;
- /* 0x290 */ OcLine* colLine[COLLISION_CHECK_OC_LINE_MAX];
-} CollisionCheckContext; // size = 0x29C
-
typedef struct {
/* 0x00 */ GameState state;
} SetupState; // size = 0xA4
@@ -339,18 +183,13 @@ typedef struct {
/* 0x00A8 */ View view;
} SampleState; // size = 0x1D0
-typedef struct {
+typedef struct QuestHintCmd {
/* 0x00 */ u8 byte0;
/* 0x01 */ u8 byte1;
/* 0x02 */ u8 byte2;
/* 0x03 */ u8 byte3;
} QuestHintCmd; // size = 0x4
-typedef struct {
- /* 0x00 */ u8 numActors;
- /* 0x04 */ TransitionActorEntry* list;
-} TransitionActorContext; // size = 0x8
-
typedef enum {
/* 0 */ PAUSE_BG_PRERENDER_OFF, // Inactive, do nothing.
/* 1 */ PAUSE_BG_PRERENDER_SETUP, // The current frame is only drawn for the purpose of serving as the pause background.
@@ -366,87 +205,6 @@ typedef enum {
/* 3 */ TRANS_TILE_READY // The transition is ready, so will update and draw each frame
} TransitionTileState;
-typedef struct PlayState {
- /* 0x00000 */ GameState state;
- /* 0x000A4 */ s16 sceneId;
- /* 0x000A6 */ u8 sceneDrawConfig;
- /* 0x000A7 */ char unk_A7[0x9];
- /* 0x000B0 */ void* sceneSegment;
- /* 0x000B8 */ View view;
- /* 0x001E0 */ Camera mainCamera;
- /* 0x0034C */ Camera subCameras[NUM_CAMS - CAM_ID_SUB_FIRST];
- /* 0x00790 */ Camera* cameraPtrs[NUM_CAMS];
- /* 0x007A0 */ s16 activeCamId;
- /* 0x007A2 */ s16 nextCamId;
- /* 0x007A4 */ SequenceContext sequenceCtx;
- /* 0x007A8 */ LightContext lightCtx;
- /* 0x007B8 */ FrameAdvanceContext frameAdvCtx;
- /* 0x007C0 */ CollisionContext colCtx;
- /* 0x01C24 */ ActorContext actorCtx;
- /* 0x01D64 */ CutsceneContext csCtx; // "demo_play"
- /* 0x01DB4 */ SfxSource sfxSources[16];
- /* 0x01F74 */ SramContext sramCtx;
- /* 0x01F78 */ SkyboxContext skyboxCtx;
- /* 0x020D8 */ MessageContext msgCtx; // "message"
- /* 0x104F0 */ InterfaceContext interfaceCtx; // "parameter"
- /* 0x10760 */ PauseContext pauseCtx;
- /* 0x10A20 */ GameOverContext gameOverCtx;
- /* 0x10A24 */ EnvironmentContext envCtx;
- /* 0x10B20 */ AnimTaskQueue animTaskQueue;
- /* 0x117A4 */ ObjectContext objectCtx;
- /* 0x11CBC */ RoomContext roomCtx;
- /* 0x11D34 */ TransitionActorContext transiActorCtx;
- /* 0x11D3C */ void (*playerInit)(Player* player, struct PlayState* play, FlexSkeletonHeader* skelHeader);
- /* 0x11D40 */ void (*playerUpdate)(Player* player, struct PlayState* play, Input* input);
- /* 0x11D44 */ int (*isPlayerDroppingFish)(struct PlayState* play);
- /* 0x11D48 */ s32 (*startPlayerFishing)(struct PlayState* play);
- /* 0x11D4C */ s32 (*grabPlayer)(struct PlayState* play, Player* player);
- /* 0x11D50 */ s32 (*tryPlayerCsAction)(struct PlayState* play, Actor* actor, s32 csAction);
- /* 0x11D54 */ void (*func_11D54)(Player* player, struct PlayState* play);
- /* 0x11D58 */ s32 (*damagePlayer)(struct PlayState* play, s32 damage);
- /* 0x11D5C */ void (*talkWithPlayer)(struct PlayState* play, Actor* actor);
- /* 0x11D60 */ MtxF viewProjectionMtxF;
- /* 0x11DA0 */ MtxF billboardMtxF;
- /* 0x11DE0 */ Mtx* billboardMtx;
- /* 0x11DE4 */ u32 gameplayFrames;
- /* 0x11DE8 */ u8 linkAgeOnLoad;
- /* 0x11DE9 */ u8 haltAllActors;
- /* 0x11DEA */ u8 spawn;
- /* 0x11DEB */ u8 numActorEntries;
- /* 0x11DEC */ u8 numRooms;
- /* 0x11DF0 */ RomFile* roomList;
- /* 0x11DF4 */ ActorEntry* playerEntry;
- /* 0x11DF8 */ ActorEntry* actorEntryList;
- /* 0x11DFC */ void* unk_11DFC;
- /* 0x11E00 */ Spawn* spawnList;
- /* 0x11E04 */ s16* exitList;
- /* 0x11E08 */ Path* pathList;
- /* 0x11E0C */ QuestHintCmd* naviQuestHints;
- /* 0x11E10 */ void* specialEffects;
- /* 0x11E14 */ u8 skyboxId;
- /* 0x11E15 */ s8 transitionTrigger; // "fade_direction"
- /* 0x11E16 */ s16 unk_11E16;
- /* 0x11E18 */ s16 bgCoverAlpha;
- /* 0x11E1A */ s16 nextEntranceIndex;
- /* 0x11E1C */ char unk_11E1C[0x40];
- /* 0x11E5C */ s8 shootingGalleryStatus;
- /* 0x11E5D */ s8 bombchuBowlingStatus; // "bombchu_game_flag"
- /* 0x11E5E */ u8 transitionType;
- /* 0x11E60 */ CollisionCheckContext colChkCtx;
- /* 0x120FC */ u16 cutsceneFlags[20];
- /* 0x12124 */ PreRender pauseBgPreRender;
- /* 0x12174 */ char unk_12174[0x53];
- /* 0x121C7 */ s8 unk_121C7;
- /* 0x121C8 */ TransitionContext transitionCtx;
- /* 0x12418 */ char unk_12418[0x3];
- /* 0x1241B */ u8 transitionMode; // "fbdemo_wipe_modem"
- /* 0x1241C */ TransitionFade transitionFadeFlash; // Transition fade instance which flashes screen, see R_TRANS_FADE_FLASH_ALPHA_STEP
- /* 0x12428 */ char unk_12428[0x3];
- /* 0x1242B */ u8 viewpoint; // toggleable camera setting by shops or player. Is also equal to the bgCamIndex + 1
- /* 0x1242C */ SceneTableEntry* loadedScene;
- /* 0x12430 */ char unk_12430[0xE8];
-} PlayState; // size = 0x12518
-
typedef struct {
/* 0x0000 */ GameState state;
/* 0x00A8 */ View view;
diff --git a/include/z64actor.h b/include/z64actor.h
index 68991ca7d..ecd6a2911 100644
--- a/include/z64actor.h
+++ b/include/z64actor.h
@@ -574,6 +574,76 @@ typedef enum {
/* 0xFF */ NAVI_ENEMY_NONE = 0xFF
} NaviEnemy;
+typedef struct TargetContextEntry {
+ /* 0x00 */ Vec3f pos;
+ /* 0x0C */ f32 unk_0C; // radius?
+ /* 0x10 */ Color_RGB8 color;
+} TargetContextEntry; // size = 0x14
+
+typedef struct TargetContext {
+ /* 0x00 */ Vec3f naviRefPos; // possibly wrong
+ /* 0x0C */ Vec3f targetCenterPos;
+ /* 0x18 */ Color_RGBAf naviInner;
+ /* 0x28 */ Color_RGBAf naviOuter;
+ /* 0x38 */ Actor* arrowPointedActor;
+ /* 0x3C */ Actor* targetedActor;
+ /* 0x40 */ f32 unk_40;
+ /* 0x44 */ f32 unk_44;
+ /* 0x48 */ s16 unk_48;
+ /* 0x4A */ u8 activeCategory;
+ /* 0x4B */ u8 unk_4B;
+ /* 0x4C */ s8 unk_4C;
+ /* 0x4D */ char unk_4D[0x03];
+ /* 0x50 */ TargetContextEntry arr_50[3];
+ /* 0x8C */ Actor* unk_8C;
+ /* 0x90 */ Actor* bgmEnemy; // The nearest enemy to player with the right flags that will trigger NA_BGM_ENEMY
+ /* 0x94 */ Actor* unk_94;
+} TargetContext; // size = 0x98
+
+typedef struct TitleCardContext {
+ /* 0x00 */ void* texture;
+ /* 0x04 */ s16 x;
+ /* 0x06 */ s16 y;
+ /* 0x08 */ u8 width;
+ /* 0x09 */ u8 height;
+ /* 0x0A */ u8 durationTimer; // how long the title card appears for before fading
+ /* 0x0B */ u8 delayTimer; // how long the title card waits to appear
+ /* 0x0C */ s16 alpha;
+ /* 0x0E */ s16 intensity;
+} TitleCardContext; // size = 0x10
+
+typedef struct ActorListEntry {
+ /* 0x00 */ s32 length; // number of actors loaded of this category
+ /* 0x04 */ Actor* head; // pointer to head of the linked list of this category (most recent actor added)
+} ActorListEntry; // size = 0x08
+
+typedef struct ActorContextSceneFlags {
+ /* 0x00 */ u32 swch;
+ /* 0x04 */ u32 tempSwch;
+ /* 0x08 */ u32 unk0;
+ /* 0x0C */ u32 unk1;
+ /* 0x10 */ u32 chest;
+ /* 0x14 */ u32 clear;
+ /* 0x18 */ u32 tempClear;
+ /* 0x1C */ u32 collect;
+ /* 0x20 */ u32 tempCollect;
+} ActorContextSceneFlags; // size = 0x24
+
+typedef struct ActorContext {
+ /* 0x000 */ u8 freezeFlashTimer;
+ /* 0x001 */ char unk_01[0x01];
+ /* 0x002 */ u8 unk_02;
+ /* 0x003 */ u8 lensActive;
+ /* 0x004 */ char unk_04[0x04];
+ /* 0x008 */ u8 total; // total number of actors loaded
+ /* 0x00C */ ActorListEntry actorLists[ACTORCAT_MAX];
+ /* 0x06C */ TargetContext targetCtx;
+ /* 0x104 */ ActorContextSceneFlags flags;
+ /* 0x128 */ TitleCardContext titleCtx;
+ /* 0x138 */ char unk_138[0x04];
+ /* 0x13C */ void* absoluteSpace; // Space used to allocate actor overlays with alloc type ACTOROVL_ALLOC_ABSOLUTE
+} ActorContext; // size = 0x140
+
#define TRANSITION_ACTOR_PARAMS_INDEX_SHIFT 10
#define GET_TRANSITION_ACTOR_INDEX(actor) ((u16)(actor)->params >> TRANSITION_ACTOR_PARAMS_INDEX_SHIFT)
diff --git a/include/z64collision_check.h b/include/z64collision_check.h
index aa69dedb0..a9cff3a58 100644
--- a/include/z64collision_check.h
+++ b/include/z64collision_check.h
@@ -306,6 +306,18 @@ typedef struct {
/* 0x18 */ u16 ocFlags;
} OcLine; // size = 0x1C
+typedef struct CollisionCheckContext {
+ /* 0x000 */ s16 colATCount;
+ /* 0x002 */ u16 sacFlags;
+ /* 0x004 */ Collider* colAT[COLLISION_CHECK_AT_MAX];
+ /* 0x0CC */ s32 colACCount;
+ /* 0x0D0 */ Collider* colAC[COLLISION_CHECK_AC_MAX];
+ /* 0x1C0 */ s32 colOCCount;
+ /* 0x1C4 */ Collider* colOC[COLLISION_CHECK_OC_MAX];
+ /* 0x28C */ s32 colLineCount;
+ /* 0x290 */ OcLine* colLine[COLLISION_CHECK_OC_LINE_MAX];
+} CollisionCheckContext; // size = 0x29C
+
/*
* Collider properties, for all shapes
*/
diff --git a/include/z64frame_advance.h b/include/z64frame_advance.h
new file mode 100644
index 000000000..b8c77372d
--- /dev/null
+++ b/include/z64frame_advance.h
@@ -0,0 +1,19 @@
+#ifndef Z64FRAME_ADVANCE_H
+#define Z64FRAME_ADVANCE_H
+
+#include "ultra64.h"
+
+struct Input;
+struct PlayState;
+
+typedef struct {
+ /* 0x0 */ s32 enabled;
+ /* 0x4 */ s32 timer;
+} FrameAdvanceContext; // size = 0x8
+
+void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx);
+s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, struct Input* input);
+
+int FrameAdvance_IsEnabled(struct PlayState* this);
+
+#endif
diff --git a/include/z64game_over.h b/include/z64game_over.h
new file mode 100644
index 000000000..03697c1f5
--- /dev/null
+++ b/include/z64game_over.h
@@ -0,0 +1,29 @@
+#ifndef Z64GAME_OVER_H
+#define Z64GAME_OVER_H
+
+#include "ultra64.h"
+
+struct PlayState;
+
+typedef enum GameOverState {
+ /* 00 */ GAMEOVER_INACTIVE,
+ /* 01 */ GAMEOVER_DEATH_START,
+ /* 02 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for link to fall and hit the ground
+ /* 03 */ GAMEOVER_DEATH_DELAY_MENU, // wait for 1 second before showing the game over menu
+ /* 04 */ GAMEOVER_DEATH_MENU, // do nothing while kaleidoscope handles the game over menu
+ /* 20 */ GAMEOVER_REVIVE_START = 20,
+ /* 21 */ GAMEOVER_REVIVE_RUMBLE,
+ /* 22 */ GAMEOVER_REVIVE_WAIT_GROUND, // wait for link to fall and hit the ground
+ /* 23 */ GAMEOVER_REVIVE_WAIT_FAIRY, // wait for the fairy to rise all the way up out of links body
+ /* 24 */ GAMEOVER_REVIVE_FADE_OUT // fade out the game over lights as link is revived and gets back up
+} GameOverState;
+
+typedef struct GameOverContext {
+ /* 0x00 */ u16 state;
+} GameOverContext; // size = 0x2
+
+void GameOver_Init(struct PlayState* play);
+void GameOver_FadeInLights(struct PlayState* play);
+void GameOver_Update(struct PlayState* play);
+
+#endif
diff --git a/include/z64play.h b/include/z64play.h
new file mode 100644
index 000000000..bfea00883
--- /dev/null
+++ b/include/z64play.h
@@ -0,0 +1,161 @@
+#ifndef Z64PLAY_H
+#define Z64PLAY_H
+
+#include "ultra64.h"
+
+#include "prerender.h"
+
+#include "z64actor.h"
+#include "z64bgcheck.h"
+#include "z64camera.h"
+#include "z64cutscene.h"
+#include "z64environment.h"
+#include "z64frame_advance.h"
+#include "z64game.h"
+#include "z64game_over.h"
+#include "z64interface.h"
+#include "z64light.h"
+#include "z64message.h"
+#include "z64object.h"
+#include "z64pause.h"
+#include "z64scene.h"
+#include "z64sfx_source.h"
+#include "z64skybox.h"
+#include "z64sram.h"
+#include "z64transition.h"
+#include "z64view.h"
+
+union Color_RGBA8_u32;
+struct QuestHintCmd;
+struct VisMono;
+
+typedef struct SceneSequences {
+ /* 0x00 */ u8 seqId;
+ /* 0x01 */ u8 natureAmbienceId;
+} SceneSequences; // size = 0x2
+
+typedef struct PlayState {
+ /* 0x00000 */ GameState state;
+ /* 0x000A4 */ s16 sceneId;
+ /* 0x000A6 */ u8 sceneDrawConfig;
+ /* 0x000A7 */ char unk_A7[0x9];
+ /* 0x000B0 */ void* sceneSegment;
+ /* 0x000B8 */ View view;
+ /* 0x001E0 */ Camera mainCamera;
+ /* 0x0034C */ Camera subCameras[NUM_CAMS - CAM_ID_SUB_FIRST];
+ /* 0x00790 */ Camera* cameraPtrs[NUM_CAMS];
+ /* 0x007A0 */ s16 activeCamId;
+ /* 0x007A2 */ s16 nextCamId;
+ /* 0x007A4 */ SceneSequences sceneSequences;
+ /* 0x007A8 */ LightContext lightCtx;
+ /* 0x007B8 */ FrameAdvanceContext frameAdvCtx;
+ /* 0x007C0 */ CollisionContext colCtx;
+ /* 0x01C24 */ ActorContext actorCtx;
+ /* 0x01D64 */ CutsceneContext csCtx; // "demo_play"
+ /* 0x01DB4 */ SfxSource sfxSources[SFX_SOURCE_COUNT];
+ /* 0x01F74 */ SramContext sramCtx;
+ /* 0x01F78 */ SkyboxContext skyboxCtx;
+ /* 0x020D8 */ MessageContext msgCtx; // "message"
+ /* 0x104F0 */ InterfaceContext interfaceCtx; // "parameter"
+ /* 0x10760 */ PauseContext pauseCtx;
+ /* 0x10A20 */ GameOverContext gameOverCtx;
+ /* 0x10A24 */ EnvironmentContext envCtx;
+ /* 0x10B20 */ AnimTaskQueue animTaskQueue;
+ /* 0x117A4 */ ObjectContext objectCtx;
+ /* 0x11CBC */ RoomContext roomCtx;
+ /* 0x11D34 */ TransitionActorContext transiActorCtx;
+ /* 0x11D3C */ void (*playerInit)(Player* player, struct PlayState* play, FlexSkeletonHeader* skelHeader);
+ /* 0x11D40 */ void (*playerUpdate)(Player* player, struct PlayState* play, Input* input);
+ /* 0x11D44 */ int (*isPlayerDroppingFish)(struct PlayState* play);
+ /* 0x11D48 */ s32 (*startPlayerFishing)(struct PlayState* play);
+ /* 0x11D4C */ s32 (*grabPlayer)(struct PlayState* play, Player* player);
+ /* 0x11D50 */ s32 (*tryPlayerCsAction)(struct PlayState* play, Actor* actor, s32 csAction);
+ /* 0x11D54 */ void (*func_11D54)(Player* player, struct PlayState* play);
+ /* 0x11D58 */ s32 (*damagePlayer)(struct PlayState* play, s32 damage);
+ /* 0x11D5C */ void (*talkWithPlayer)(struct PlayState* play, Actor* actor);
+ /* 0x11D60 */ MtxF viewProjectionMtxF;
+ /* 0x11DA0 */ MtxF billboardMtxF;
+ /* 0x11DE0 */ Mtx* billboardMtx;
+ /* 0x11DE4 */ u32 gameplayFrames;
+ /* 0x11DE8 */ u8 linkAgeOnLoad;
+ /* 0x11DE9 */ u8 haltAllActors;
+ /* 0x11DEA */ u8 spawn;
+ /* 0x11DEB */ u8 numActorEntries;
+ /* 0x11DEC */ u8 numRooms;
+ /* 0x11DF0 */ RomFile* roomList;
+ /* 0x11DF4 */ ActorEntry* playerEntry;
+ /* 0x11DF8 */ ActorEntry* actorEntryList;
+ /* 0x11DFC */ void* unk_11DFC;
+ /* 0x11E00 */ Spawn* spawnList;
+ /* 0x11E04 */ s16* exitList;
+ /* 0x11E08 */ Path* pathList;
+ /* 0x11E0C */ struct QuestHintCmd* naviQuestHints;
+ /* 0x11E10 */ void* specialEffects;
+ /* 0x11E14 */ u8 skyboxId;
+ /* 0x11E15 */ s8 transitionTrigger; // "fade_direction"
+ /* 0x11E16 */ s16 unk_11E16;
+ /* 0x11E18 */ s16 bgCoverAlpha;
+ /* 0x11E1A */ s16 nextEntranceIndex;
+ /* 0x11E1C */ char unk_11E1C[0x40];
+ /* 0x11E5C */ s8 shootingGalleryStatus;
+ /* 0x11E5D */ s8 bombchuBowlingStatus; // "bombchu_game_flag"
+ /* 0x11E5E */ u8 transitionType;
+ /* 0x11E60 */ CollisionCheckContext colChkCtx;
+ /* 0x120FC */ u16 cutsceneFlags[20];
+ /* 0x12124 */ PreRender pauseBgPreRender;
+ /* 0x12174 */ char unk_12174[0x53];
+ /* 0x121C7 */ s8 unk_121C7;
+ /* 0x121C8 */ TransitionContext transitionCtx;
+ /* 0x12418 */ char unk_12418[0x3];
+ /* 0x1241B */ u8 transitionMode; // "fbdemo_wipe_modem"
+ /* 0x1241C */ TransitionFade transitionFadeFlash; // Transition fade instance which flashes screen, see R_TRANS_FADE_FLASH_ALPHA_STEP
+ /* 0x12428 */ char unk_12428[0x3];
+ /* 0x1242B */ u8 viewpoint; // toggleable camera setting by shops or player. Is also equal to the bgCamIndex + 1
+ /* 0x1242C */ SceneTableEntry* loadedScene;
+ /* 0x12430 */ char unk_12430[0xE8];
+} PlayState; // size = 0x12518
+
+#define GET_ACTIVE_CAM(play) ((play)->cameraPtrs[(play)->activeCamId])
+#define GET_PLAYER(play) ((Player*)(play)->actorCtx.actorLists[ACTORCAT_PLAYER].head)
+
+void Play_SetViewpoint(PlayState* this, s16 viewpoint);
+s32 Play_CheckViewpoint(PlayState* this, s16 viewpoint);
+void Play_SetShopBrowsingViewpoint(PlayState* this);
+Gfx* Play_SetFog(PlayState* this, Gfx* gfx);
+void Play_Destroy(GameState* thisx);
+void Play_Init(GameState* thisx);
+void Play_Main(GameState* thisx);
+int Play_InCsMode(PlayState* this);
+f32 func_800BFCB8(PlayState* this, MtxF* mf, Vec3f* pos);
+void* Play_LoadFile(PlayState* this, RomFile* file);
+void Play_GetScreenPos(PlayState* this, Vec3f* src, Vec3f* dest);
+s16 Play_CreateSubCamera(PlayState* this);
+s16 Play_GetActiveCamId(PlayState* this);
+s16 Play_ChangeCameraStatus(PlayState* this, s16 camId, s16 status);
+void Play_ClearCamera(PlayState* this, s16 camId);
+void Play_ClearAllSubCameras(PlayState* this);
+Camera* Play_GetCamera(PlayState* this, s16 camId);
+s32 Play_SetCameraAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye);
+s32 Play_SetCameraAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up);
+s32 Play_SetCameraFov(PlayState* this, s16 camId, f32 fov);
+s32 Play_SetCameraRoll(PlayState* this, s16 camId, s16 roll);
+void Play_CopyCamera(PlayState* this, s16 destCamId, s16 srcCamId);
+s32 Play_InitCameraDataUsingPlayer(PlayState* this, s16 camId, Player* player, s16 setting);
+s32 Play_RequestCameraSetting(PlayState* this, s16 camId, s16 setting);
+void Play_ReturnToMainCam(PlayState* this, s16 camId, s16 duration);
+void Play_SaveSceneFlags(PlayState* this);
+void Play_SetupRespawnPoint(PlayState* this, s32 respawnMode, s32 playerParams);
+void Play_TriggerVoidOut(PlayState* this);
+void Play_TriggerRespawn(PlayState* this);
+int Play_CamIsNotFixed(PlayState* this);
+
+#if OOT_DEBUG
+extern void* gDebugCutsceneScript;
+#endif
+
+extern TransitionTile gTransitionTile;
+extern s32 gTransitionTileState;
+extern struct VisMono gPlayVisMono;
+extern union Color_RGBA8_u32 gVisMonoColor;
+
+#endif
diff --git a/include/z64scene.h b/include/z64scene.h
index c966913f1..f1a45af70 100644
--- a/include/z64scene.h
+++ b/include/z64scene.h
@@ -33,6 +33,11 @@ typedef struct {
/* 0x0E */ s16 params;
} TransitionActorEntry; // size = 0x10
+typedef struct TransitionActorContext {
+ /* 0x00 */ u8 numActors;
+ /* 0x04 */ TransitionActorEntry* list;
+} TransitionActorContext; // size = 0x8
+
typedef struct {
/* 0x00 */ u8 playerEntryIndex;
/* 0x01 */ u8 room;
@@ -139,6 +144,50 @@ typedef union {
RoomShapeCullable cullable;
} RoomShape; // "Ground Shape"
+typedef enum RoomBehaviorType1 {
+ /* 0 */ ROOM_BEHAVIOR_TYPE1_0,
+ /* 1 */ ROOM_BEHAVIOR_TYPE1_1,
+ /* 2 */ ROOM_BEHAVIOR_TYPE1_2,
+ /* 3 */ ROOM_BEHAVIOR_TYPE1_3, // unused
+ /* 4 */ ROOM_BEHAVIOR_TYPE1_4, // unused
+ /* 5 */ ROOM_BEHAVIOR_TYPE1_5
+} RoomBehaviorType1;
+
+typedef enum RoomBehaviorType2 {
+ /* 0 */ ROOM_BEHAVIOR_TYPE2_0,
+ /* 1 */ ROOM_BEHAVIOR_TYPE2_1,
+ /* 2 */ ROOM_BEHAVIOR_TYPE2_2,
+ /* 3 */ ROOM_BEHAVIOR_TYPE2_3,
+ /* 4 */ ROOM_BEHAVIOR_TYPE2_4,
+ /* 5 */ ROOM_BEHAVIOR_TYPE2_5,
+ /* 6 */ ROOM_BEHAVIOR_TYPE2_6
+} RoomBehaviorType2;
+
+typedef struct Room {
+ /* 0x00 */ s8 num;
+ /* 0x01 */ u8 unk_01;
+ /* 0x02 */ u8 behaviorType2;
+ /* 0x03 */ u8 behaviorType1;
+ /* 0x04 */ s8 echo;
+ /* 0x05 */ u8 lensMode;
+ /* 0x08 */ RoomShape* roomShape; // original name: "ground_shape"
+ /* 0x0C */ void* segment;
+ /* 0x10 */ char unk_10[0x4];
+} Room; // size = 0x14
+
+typedef struct RoomContext {
+ /* 0x00 */ Room curRoom;
+ /* 0x14 */ Room prevRoom;
+ /* 0x28 */ void* bufPtrs[2];
+ /* 0x30 */ u8 unk_30;
+ /* 0x31 */ s8 status;
+ /* 0x34 */ void* unk_34;
+ /* 0x38 */ DmaRequest dmaRequest;
+ /* 0x58 */ OSMesgQueue loadQueue;
+ /* 0x70 */ OSMesg loadMsg;
+ /* 0x74 */ s16 unk_74[2]; // context-specific data used by the current scene draw config
+} RoomContext; // size = 0x78
+
#define ROOM_DRAW_OPA (1 << 0)
#define ROOM_DRAW_XLU (1 << 1)
diff --git a/include/z64sfx_source.h b/include/z64sfx_source.h
new file mode 100644
index 000000000..0034bc90a
--- /dev/null
+++ b/include/z64sfx_source.h
@@ -0,0 +1,21 @@
+#ifndef Z64SFX_SOURCE_H
+#define Z64SFX_SOURCE_H
+
+#include "ultra64.h"
+#include "z64math.h"
+
+struct PlayState;
+
+typedef struct SfxSource {
+ /* 0x00 */ u16 countdown;
+ /* 0x04 */ Vec3f worldPos;
+ /* 0x10 */ Vec3f projectedPos;
+} SfxSource; // size = 0x1C
+
+#define SFX_SOURCE_COUNT 16
+
+void SfxSource_InitAll(struct PlayState* play);
+void SfxSource_UpdateAll(struct PlayState* play);
+void SfxSource_PlaySfxAtFixedWorldPos(struct PlayState* play, Vec3f* worldPos, s32 duration, u16 sfxId);
+
+#endif
diff --git a/include/z64vis.h b/include/z64vis.h
index c88d6de48..371b2346b 100644
--- a/include/z64vis.h
+++ b/include/z64vis.h
@@ -55,7 +55,7 @@ void VisCvg_Draw(VisCvg* this, Gfx** gfxP);
// Only one type
-typedef struct {
+typedef struct VisMono {
/* 0x00 */ Vis vis;
/* 0x10 */ u16* tlut;
/* 0x14 */ Gfx* dList;