From cf1a39c26fca0f7827fef79d08b114fde1c43cce Mon Sep 17 00:00:00 2001 From: mzxrules Date: Wed, 26 Feb 2025 17:18:30 -0500 Subject: [PATCH] Reduce dependencies on global.h (10) (#2490) * reduce z64.h size * fix z_cheap_proc.inc.c * ,bss * remove temp delcaration --- include/db_camera.h | 88 +++++++++++++++++++ include/functions.h | 16 ---- include/irqmgr.h | 2 + include/line_numbers.h | 2 + include/listalloc.h | 16 ++++ include/map.h | 2 + include/prerender.h | 6 +- include/speed_meter.h | 16 +++- include/sys_debug_controller.h | 13 +++ include/sys_freeze.h | 8 ++ include/ultra64/pi.h | 1 + include/variables.h | 27 +----- include/z64.h | 39 +------- include/z64actor.h | 34 ------- include/z64camera.h | 77 ---------------- include/z64sram.h | 4 +- include/z64vis.h | 3 - include/z_en_a_obj.h | 41 +++++++++ include/z_game_dlftbls.h | 3 +- include/z_locale.h | 12 +++ src/audio/general.c | 7 +- src/audio/lib/effects.c | 2 + src/audio/lib/load.c | 1 + src/audio/lib/seqplayer.c | 2 + src/boot/assert.c | 3 +- src/boot/boot_main.c | 5 +- src/boot/cic6105.c | 4 +- src/boot/idle.c | 1 + src/boot/is_debug.c | 1 + src/boot/z_locale.c | 10 ++- src/boot/z_std_dma.c | 5 +- src/code/PreRender.c | 9 +- src/code/TwoHeadGfxArena.c | 2 +- src/code/audio_thread_manager.c | 7 +- src/code/code_n64dd_800AD4C0.c | 6 +- src/code/db_camera.c | 1 + src/code/fault_gc.c | 4 +- src/code/fault_n64.c | 2 +- src/code/game.c | 4 + src/code/graph.c | 8 +- src/code/irqmgr.c | 6 +- src/code/listalloc.c | 3 +- src/code/main.c | 9 +- src/code/mempak.c | 5 +- src/code/sched.c | 3 + src/code/shrink_window.c | 5 +- src/code/speed_meter.c | 10 ++- src/code/sys_debug_controller.c | 5 +- src/code/sys_freeze.c | 6 +- src/code/sys_rumble.c | 3 +- src/code/z_actor.c | 4 +- src/code/z_bg_item.c | 5 +- src/code/z_bgcheck.c | 2 +- src/code/z_camera.c | 22 ++++- src/code/z_cheap_proc.inc.c | 5 +- src/code/z_collision_check.c | 2 +- src/code/z_common_data.c | 8 +- src/code/z_demo.c | 6 +- src/code/z_eff_blure.c | 11 +++ src/code/z_eff_shield_particle.c | 12 ++- src/code/z_eff_spark.c | 10 +++ src/code/z_eff_ss_dead.c | 4 +- src/code/z_effect.c | 5 +- src/code/z_effect_soft_sprite_old_init.c | 14 ++- src/code/z_en_a_keep.c | 9 +- src/code/z_fbdemo.c | 9 +- src/code/z_fbdemo_circle.c | 2 + src/code/z_fcurve_data_skelanime.c | 8 +- src/code/z_kaleido_scope_call.c | 4 +- src/code/z_kankyo.c | 8 +- src/code/z_map_mark.c | 1 + src/code/z_message.c | 2 +- src/code/z_moji.c | 3 + src/code/z_play.c | 7 +- src/code/z_player_call.c | 6 +- src/code/z_rcp.c | 3 +- src/code/z_rumble.c | 4 +- src/code/z_scene.c | 9 +- src/code/z_skelanime.c | 14 ++- src/code/z_skin_matrix.c | 6 +- src/code/z_view.c | 9 +- src/code/z_vimode.c | 8 +- src/code/z_viscvg.c | 5 +- src/code/z_vismono.c | 9 +- src/code/z_viszbuf.c | 5 +- src/code/z_vr_box_draw.c | 5 +- src/libleo/api/cacreateleomanager.c | 4 +- src/libleo/api/cjcreateleomanager.c | 4 +- src/libleo/leo/leocmdex.c | 4 +- src/libleo/leo/leomecha.c | 4 +- src/libleo/leo/leotimer.c | 4 +- src/libu64/gfxprint.c | 6 +- src/libu64/stackcheck.c | 6 +- src/libu64/system_heap.c | 2 +- src/libultra/os/settimer.c | 3 + src/n64dd/n64dd_801C8000.c | 2 +- src/n64dd/n64dd_801C8940.c | 5 +- src/n64dd/n64dd_801C9B70.c | 2 +- src/n64dd/n64dd_801CA0B0.c | 5 +- src/n64dd/z_n64dd.c | 8 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 4 +- src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c | 1 + src/overlays/actors/ovl_En_Bili/z_en_bili.c | 3 + .../ovl_file_choose/z_file_choose.c | 3 + .../ovl_file_choose/z_file_copy_erase.c | 2 +- .../ovl_file_choose/z_file_nameset.c | 1 + src/overlays/gamestates/ovl_title/z_title.c | 3 + .../ovl_kaleido_scope/z_kaleido_collect.c | 8 ++ .../misc/ovl_kaleido_scope/z_kaleido_debug.c | 6 ++ .../ovl_kaleido_scope/z_kaleido_equipment.c | 7 ++ .../misc/ovl_kaleido_scope/z_kaleido_item.c | 7 ++ .../misc/ovl_kaleido_scope/z_kaleido_map.c | 8 ++ .../misc/ovl_kaleido_scope/z_kaleido_prompt.c | 5 ++ .../misc/ovl_kaleido_scope/z_kaleido_scope.c | 19 +++- .../misc/ovl_kaleido_scope/z_kaleido_scope.h | 33 +++---- .../misc/ovl_kaleido_scope/z_lmap_mark.c | 7 ++ 116 files changed, 663 insertions(+), 308 deletions(-) create mode 100644 include/db_camera.h create mode 100644 include/listalloc.h create mode 100644 include/sys_debug_controller.h create mode 100644 include/sys_freeze.h create mode 100644 include/z_en_a_obj.h create mode 100644 include/z_locale.h diff --git a/include/db_camera.h b/include/db_camera.h new file mode 100644 index 0000000000..81d8515d0b --- /dev/null +++ b/include/db_camera.h @@ -0,0 +1,88 @@ +#ifndef DB_CAMERA_H +#define DB_CAMERA_H + +#include "ultra64.h" +#include "z64cutscene.h" +#include "z64math.h" + +struct Camera; + +typedef struct DebugCamSub { + /* 0x0000 */ s16 mode; + /* 0x0002 */ s16 nFrames; + /* 0x0004 */ s16 nPoints; + /* 0x0006 */ s16 unkIdx; + /* 0x0008 */ s16 unk_08; + /* 0x000A */ s16 unk_0A; + /* 0x000C */ s32 unk_0C; // bool: indicates position vs lookAt? + /* 0x0010 */ char unk_10[0x14]; + /* 0x0024 */ CutsceneCameraPoint position[129]; + /* 0x0834 */ CutsceneCameraPoint lookAt[129]; + /* 0x1044 */ s16 demoCtrlMenu; + /* 0x1046 */ s16 demoCtrlActionIdx; // e (?), s (save), l (load), c (clear) + /* 0x1048 */ s16 demoCtrlToggleSwitch; + /* 0x104A */ Vec3s unk_104A; +} DebugCamSub; // size = 0x1050 + +typedef struct DebugCam { + /* 0x00 */ s32 unk_00; + /* 0x04 */ Vec3f at; + /* 0x10 */ Vec3f eye; + /* 0x1C */ Vec3f unk_1C; + /* 0x28 */ char unk_28[0xC]; + /* 0x34 */ s32 unk_34; + /* 0x38 */ s32 unk_38; + /* 0x3C */ s32 unk_3C; // bool + /* 0x40 */ s32 unk_40; + /* 0x44 */ s32 unk_44; + /* 0x48 */ f32 fov; + /* 0x4C */ s16 roll; + /* 0x4E */ char unk_4E[0x2]; + /* 0x50 */ f32 rollDegrees; + /* 0x54 */ Vec3f unk_54; + /* 0x60 */ Vec3f unk_60; + /* 0x6C */ Vec3f unk_6C; + /* 0x78 */ s16 unk_78; + /* 0x7A */ s16 unk_7A; + /* 0x7C */ DebugCamSub sub; +} DebugCam; // size = 0x10CC + +typedef struct DebugCamCut { + /* 0x00 */ char letter; + /* 0x01 */ u8 unk_01; + /* 0x02 */ s16 mode; + /* 0x04 */ CutsceneCameraPoint* position; + /* 0x08 */ CutsceneCameraPoint* lookAt; + /* 0x0C */ s16 nFrames; + /* 0x0E */ s16 nPoints; +} DebugCamCut; // size = 0x10 + +typedef struct DebugCamAnim { + /* 0x00 */ f32 curFrame; + /* 0x04 */ f32 unk_04; // frame count? + /* 0x08 */ s16 keyframe; + /* 0x0A */ s16 unk_0A; + /* 0x0C */ s16 unk_0C; + /* 0x10 */ Vec3f positionPos; // confusing name + /* 0x1C */ Vec3f lookAtPos; + /* 0x28 */ f32 roll; + /* 0x2C */ f32 fov; +} DebugCamAnim; // size = 0x30 + +typedef enum DebugCamTextColor { + /* 0 */ DEBUG_CAM_TEXT_YELLOW, + /* 1 */ DEBUG_CAM_TEXT_PEACH, + /* 2 */ DEBUG_CAM_TEXT_BROWN, + /* 3 */ DEBUG_CAM_TEXT_ORANGE, + /* 4 */ DEBUG_CAM_TEXT_GOLD, + /* 5 */ DEBUG_CAM_TEXT_WHITE, + /* 6 */ DEBUG_CAM_TEXT_BLUE, + /* 7 */ DEBUG_CAM_TEXT_GREEN +} DebugCamTextColor; + +void DebugCamera_Init(DebugCam* debugCam, struct Camera* cameraPtr); +void DebugCamera_Enable(DebugCam* debugCam, struct Camera* cam); +void DebugCamera_Update(DebugCam* debugCam, struct Camera* cam); +void DebugCamera_Reset(struct Camera* cam, DebugCam* debugCam); + +#endif diff --git a/include/functions.h b/include/functions.h index e5d15c10ec..63255443dc 100644 --- a/include/functions.h +++ b/include/functions.h @@ -14,8 +14,6 @@ void Yaz0_Decompress(uintptr_t romStart, u8* dst, size_t size); #else void gzip_decompress(uintptr_t romStart, u8* dst, size_t size); #endif -void Locale_Init(void); -void Locale_ResetRegion(void); #if DEBUG_FEATURES void isPrintfInit(void); #endif @@ -77,11 +75,6 @@ s32 TransitionFade_IsDone(void* thisx); void TransitionFade_SetColor(void* thisx, u32 color); void TransitionFade_SetType(void* thisx, s32 type); -void DebugCamera_Init(DebugCam* debugCam, Camera* cameraPtr); -void DebugCamera_Enable(DebugCam* debugCam, Camera* cam); -void DebugCamera_Update(DebugCam* debugCam, Camera* cam); -void DebugCamera_Reset(Camera* cam, DebugCam* debugCam); - void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg); void PreRender_Init(PreRender* this); void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf); @@ -98,19 +91,10 @@ void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxP); void PreRender_ApplyFilters(PreRender* this); void Graph_ThreadEntry(void*); -ListAlloc* ListAlloc_Init(ListAlloc* this); -void* ListAlloc_Alloc(ListAlloc* this, u32 size); -void ListAlloc_Free(ListAlloc* this, void* data); -void ListAlloc_FreeAll(ListAlloc* this); - void SysCfb_Init(s32 n64dd); void* SysCfb_GetFbPtr(s32 idx); void* SysCfb_GetFbEnd(void); -NORETURN void func_800D31A0(void); -void func_800D31F0(void); -void func_800D3210(void); - void RcpUtils_PrintRegisterStatus(void); void RcpUtils_Reset(void); diff --git a/include/irqmgr.h b/include/irqmgr.h index b931977ab0..b841fb141f 100644 --- a/include/irqmgr.h +++ b/include/irqmgr.h @@ -46,4 +46,6 @@ void IrqMgr_RemoveClient(IrqMgr* irqMgr, IrqMgrClient* client); extern vu32 gIrqMgrResetStatus; extern volatile OSTime gIrqMgrRetraceTime; +extern IrqMgr gIrqMgr; + #endif diff --git a/include/line_numbers.h b/include/line_numbers.h index bc11d555db..adc2d654d5 100644 --- a/include/line_numbers.h +++ b/include/line_numbers.h @@ -1,6 +1,8 @@ #ifndef LINE_NUMBERS_H #define LINE_NUMBERS_H +#include "versions.h" + // The macros in this file serve to reduce clutter from version differences that are only due to line numbers being different. // The "LN" macros defined here are not meant to be used directly. See the wrapper macros below. diff --git a/include/listalloc.h b/include/listalloc.h new file mode 100644 index 0000000000..76321a3e87 --- /dev/null +++ b/include/listalloc.h @@ -0,0 +1,16 @@ +#ifndef LISTALLOC_H +#define LISTALLOC_H + +#include "ultra64/ultratypes.h" + +typedef struct ListAlloc { + /* 0x00 */ struct ListAlloc* prev; + /* 0x04 */ struct ListAlloc* next; +} ListAlloc; // size = 0x8 + +ListAlloc* ListAlloc_Init(ListAlloc* this); +void* ListAlloc_Alloc(ListAlloc* this, u32 size); +void ListAlloc_Free(ListAlloc* this, void* data); +void ListAlloc_FreeAll(ListAlloc* this); + +#endif diff --git a/include/map.h b/include/map.h index 23d3eb3c88..88c5d9279a 100644 --- a/include/map.h +++ b/include/map.h @@ -67,6 +67,8 @@ typedef struct MapData { #define MAP_48x85_TEX_HEIGHT 85 #define MAP_48x85_TEX_SIZE ((MAP_48x85_TEX_WIDTH * MAP_48x85_TEX_HEIGHT) / 2) // 48x85 CI4 texture +extern MapData gMapDataTable; + void Map_SavePlayerInitialInfo(struct PlayState* play); void Map_SetFloorPalettesData(struct PlayState* play, s16 floor); void Map_InitData(struct PlayState* play, s16 room); diff --git a/include/prerender.h b/include/prerender.h index ca16826341..4231234a8d 100644 --- a/include/prerender.h +++ b/include/prerender.h @@ -2,11 +2,7 @@ #define PRERENDER_H #include "ultra64/ultratypes.h" - -typedef struct ListAlloc { - /* 0x00 */ struct ListAlloc* prev; - /* 0x04 */ struct ListAlloc* next; -} ListAlloc; // size = 0x8 +#include "listalloc.h" typedef struct PreRender { /* 0x00 */ s32 width; diff --git a/include/speed_meter.h b/include/speed_meter.h index 393c89de8d..f8779902f9 100644 --- a/include/speed_meter.h +++ b/include/speed_meter.h @@ -1,7 +1,7 @@ #ifndef SPEEDMETER_H #define SPEEDMETER_H -#include "ultra64/ultratypes.h" +#include "ultra64.h" struct GraphicsContext; struct GameState; @@ -12,6 +12,20 @@ typedef struct SpeedMeter { /* 0x1C */ s32 y; } SpeedMeter; // size = 0x20 +extern volatile OSTime gAudioThreadUpdateTimeTotalPerGfxTask; +extern volatile OSTime gGfxTaskSentToNextReadyMinusAudioThreadUpdateTime; +extern volatile OSTime gRSPAudioTimeTotal; +extern volatile OSTime gRSPGfxTimeTotal; +extern volatile OSTime gRDPTimeTotal; +extern volatile OSTime gGraphUpdatePeriod; +extern volatile OSTime gAudioThreadUpdateTimeStart; +extern volatile OSTime gAudioThreadUpdateTimeAcc; +extern volatile OSTime gRSPAudioTimeAcc; +extern volatile OSTime gRSPGfxTimeAcc; +extern volatile OSTime gRSPOtherTimeAcc; +extern volatile OSTime D_8016A578; +extern volatile OSTime gRDPTimeAcc; + void SpeedMeter_Init(SpeedMeter* this); void SpeedMeter_Destroy(SpeedMeter* this); void SpeedMeter_DrawTimeEntries(SpeedMeter* this, struct GraphicsContext* gfxCtx); diff --git a/include/sys_debug_controller.h b/include/sys_debug_controller.h new file mode 100644 index 0000000000..0345d85aaf --- /dev/null +++ b/include/sys_debug_controller.h @@ -0,0 +1,13 @@ +#ifndef SYS_DEBUG_CONTROLLER_H +#define SYS_DEBUG_CONTROLLER_H + +#include "ultra64/ultratypes.h" + +#if DEBUG_FEATURES +extern u32 gIsCtrlr2Valid; + +void func_800D31F0(void); +void func_800D3210(void); +#endif + +#endif diff --git a/include/sys_freeze.h b/include/sys_freeze.h new file mode 100644 index 0000000000..0e033cacd9 --- /dev/null +++ b/include/sys_freeze.h @@ -0,0 +1,8 @@ +#ifndef SYS_FREEZE_H +#define SYS_FREEZE_H + +#include "attributes.h" + +NORETURN void func_800D31A0(void); + +#endif diff --git a/include/ultra64/pi.h b/include/ultra64/pi.h index af18c407ea..42a90d7609 100644 --- a/include/ultra64/pi.h +++ b/include/ultra64/pi.h @@ -1,6 +1,7 @@ #ifndef ULTRA64_PI_H #define ULTRA64_PI_H +#include "stddef.h" #include "message.h" typedef struct __OSBlockInfo { diff --git a/include/variables.h b/include/variables.h index ea5d188a6e..612b3051b1 100644 --- a/include/variables.h +++ b/include/variables.h @@ -5,6 +5,8 @@ #include "libc64/os_malloc.h" #include "segment_symbols.h" +struct MapData; + extern void* osRomBase; extern s32 osTvType; extern u32 osRomType; @@ -32,7 +34,6 @@ extern u32 gViConfigFeatures; extern f32 gViConfigXScale; extern f32 gViConfigYScale; extern OSPiHandle* gCartHandle; -extern s32 gCurrentRegion; extern u32 __osPiAccessQueueEnabled; extern OSViMode osViModePalLan1; extern s32 osViClock; @@ -65,19 +66,14 @@ extern OSTime __osCurrentTime; extern u32 __osBaseCounter; extern u32 __osViIntrCount; extern u32 __osTimerCounter; -extern MapData gMapDataTable; extern s16 gSpoilingItems[3]; extern s16 gSpoilingItemReverts[3]; -extern u16 gSramSlotOffsets[]; // 4 16-colors palettes extern u64 gMojiFontTLUTs[4][4]; // original name: "moji_tlut" extern u64 gMojiFontTex[]; // original name: "font_ff" extern u8 gBossMarkState; -#if DEBUG_FEATURES -extern u32 gIsCtrlr2Valid; -#endif extern s16* gWaveSamples[9]; extern f32 gBendPitchOneOctaveFrequencies[256]; extern f32 gBendPitchTwoSemitonesFrequencies[256]; @@ -142,28 +138,11 @@ extern u8 gSequenceFontTable[]; extern u8 gSequenceTable[]; extern AudioTable gSampleBankTable; -extern MapData* gMapData; +extern struct MapData* gMapData; extern f32 gBossMarkScale; extern u32 D_8016139C; extern PauseMapMarksData* gLoadedPauseMarkDataTable; -extern Scheduler gScheduler; -extern PadMgr gPadMgr; -extern IrqMgr gIrqMgr; -extern volatile OSTime gAudioThreadUpdateTimeTotalPerGfxTask; -extern volatile OSTime gGfxTaskSentToNextReadyMinusAudioThreadUpdateTime; -extern volatile OSTime gRSPAudioTimeTotal; -extern volatile OSTime gRSPGfxTimeTotal; -extern volatile OSTime gRDPTimeTotal; -extern volatile OSTime gGraphUpdatePeriod; -extern volatile OSTime gAudioThreadUpdateTimeStart; -extern volatile OSTime gAudioThreadUpdateTimeAcc; -extern volatile OSTime gRSPAudioTimeAcc; -extern volatile OSTime gRSPGfxTimeAcc; -extern volatile OSTime gRSPOtherTimeAcc; -extern volatile OSTime D_8016A578; -extern volatile OSTime gRDPTimeAcc; - extern SfxBankEntry D_8016BAD0[9]; extern SfxBankEntry D_8016BC80[12]; extern SfxBankEntry D_8016BEC0[22]; diff --git a/include/z64.h b/include/z64.h index 64bb5984ce..a0ba2873d7 100644 --- a/include/z64.h +++ b/include/z64.h @@ -4,8 +4,6 @@ #include "ultra64.h" #include "ultra64/gs2dex.h" #include "attributes.h" -#include "audiomgr.h" -#include "controller.h" #include "versions.h" #include "z64player.h" #include "z64audio.h" @@ -14,49 +12,14 @@ #include "z64effect.h" #include "z64animation.h" #include "z64animation_legacy.h" -#include "letterbox.h" -#include "z64math.h" -#include "z64map_mark.h" -#include "one_point_cutscene.h" #include "z64play.h" #include "z64skin.h" #include "z64skin_matrix.h" -#include "z64vis.h" -#include "zelda_arena.h" #include "alignment.h" #include "audiothread_cmd.h" #include "sfx.h" #include "color.h" -#include "libu64/gfxprint.h" -#include "z_lib.h" -#include "regs.h" -#include "irqmgr.h" -#include "padmgr.h" -#include "sched.h" -#include "rumble.h" -#include "map.h" -#include "mempak.h" -#include "tha.h" -#include "thga.h" -#include "speed_meter.h" -#include "gfx.h" -#include "gfx_setupdl.h" -#include "gfxalloc.h" -#include "prerender.h" -#include "rand.h" -#include "sys_math.h" -#include "sys_math3d.h" -#include "libc64/math64.h" -#include "sys_matrix.h" -#include "main.h" -#include "segmented_address.h" -#include "stackcheck.h" -#include "kaleido_manager.h" -#include "libc64/aprintf.h" -#include "libc64/malloc.h" -#include "libc64/sleep.h" -#include "libc64/sprintf.h" -#include "libu64/debug.h" +#include "sys_matrix.h" // in room assets, gIdentityMtx // TODO: include all files listed above into the right place, and then delete this file. diff --git a/include/z64actor.h b/include/z64actor.h index 8986c801ce..2709356b99 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -291,40 +291,6 @@ typedef struct BodyBreak { #define BODYBREAK_STATUS_READY -1 #define BODYBREAK_STATUS_FINISHED 0 -// Only A_OBJ_SIGNPOST_OBLONG and A_OBJ_SIGNPOST_ARROW are used in room files. -typedef enum AObjType { - /* 0x00 */ A_OBJ_BLOCK_SMALL, - /* 0x01 */ A_OBJ_BLOCK_LARGE, - /* 0x02 */ A_OBJ_BLOCK_HUGE, - /* 0x03 */ A_OBJ_BLOCK_SMALL_ROT, - /* 0x04 */ A_OBJ_BLOCK_LARGE_ROT, - /* 0x05 */ A_OBJ_CUBE_SMALL, - /* 0x06 */ A_OBJ_UNKNOWN_6, - /* 0x07 */ A_OBJ_GRASS_CLUMP, - /* 0x08 */ A_OBJ_TREE_STUMP, - /* 0x09 */ A_OBJ_SIGNPOST_OBLONG, - /* 0x0A */ A_OBJ_SIGNPOST_ARROW, - /* 0x0B */ A_OBJ_BOULDER_FRAGMENT, - /* 0x0C */ A_OBJ_MAX -} AObjType; - -struct EnAObj; - -typedef void (*EnAObjActionFunc)(struct EnAObj*, struct PlayState*); - -typedef struct EnAObj { - /* 0x000 */ DynaPolyActor dyna; - /* 0x164 */ EnAObjActionFunc actionFunc; - /* 0x168 */ s32 rotateWaitTimer; - /* 0x16C */ s16 textId; - /* 0x16E */ s16 rotateState; - /* 0x170 */ s16 rotateForTimer; - /* 0x172 */ s16 rotSpeedY; - /* 0x174 */ s16 rotSpeedX; - /* 0x178 */ f32 focusYoffset; - /* 0x17C */ ColliderCylinder collider; -} EnAObj; // size = 0x1C8 - typedef enum DoorLockType { DOORLOCK_NORMAL, DOORLOCK_BOSS, diff --git a/include/z64camera.h b/include/z64camera.h index f36cb8e075..2fcbffdf5a 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -1621,83 +1621,6 @@ typedef struct Camera { /* 0x16A */ s16 unk_16A; } Camera; // size = 0x16C -/** - * Debug Camera -*/ - -typedef struct DebugCamSub { - /* 0x0000 */ s16 mode; - /* 0x0002 */ s16 nFrames; - /* 0x0004 */ s16 nPoints; - /* 0x0006 */ s16 unkIdx; - /* 0x0008 */ s16 unk_08; - /* 0x000A */ s16 unk_0A; - /* 0x000C */ s32 unk_0C; // bool: indicates position vs lookAt? - /* 0x0010 */ char unk_10[0x14]; - /* 0x0024 */ CutsceneCameraPoint position[129]; - /* 0x0834 */ CutsceneCameraPoint lookAt[129]; - /* 0x1044 */ s16 demoCtrlMenu; - /* 0x1046 */ s16 demoCtrlActionIdx; // e (?), s (save), l (load), c (clear) - /* 0x1048 */ s16 demoCtrlToggleSwitch; - /* 0x104A */ Vec3s unk_104A; -} DebugCamSub; // size = 0x1050 - -typedef struct DebugCam { - /* 0x00 */ s32 unk_00; - /* 0x04 */ Vec3f at; - /* 0x10 */ Vec3f eye; - /* 0x1C */ Vec3f unk_1C; - /* 0x28 */ char unk_28[0xC]; - /* 0x34 */ s32 unk_34; - /* 0x38 */ s32 unk_38; - /* 0x3C */ s32 unk_3C; // bool - /* 0x40 */ s32 unk_40; - /* 0x44 */ s32 unk_44; - /* 0x48 */ f32 fov; - /* 0x4C */ s16 roll; - /* 0x4E */ char unk_4E[0x2]; - /* 0x50 */ f32 rollDegrees; - /* 0x54 */ Vec3f unk_54; - /* 0x60 */ Vec3f unk_60; - /* 0x6C */ Vec3f unk_6C; - /* 0x78 */ s16 unk_78; - /* 0x7A */ s16 unk_7A; - /* 0x7C */ DebugCamSub sub; -} DebugCam; // size = 0x10CC - -typedef struct DebugCamCut { - /* 0x00 */ char letter; - /* 0x01 */ u8 unk_01; - /* 0x02 */ s16 mode; - /* 0x04 */ CutsceneCameraPoint* position; - /* 0x08 */ CutsceneCameraPoint* lookAt; - /* 0x0C */ s16 nFrames; - /* 0x0E */ s16 nPoints; -} DebugCamCut; // size = 0x10 - -typedef struct DebugCamAnim { - /* 0x00 */ f32 curFrame; - /* 0x04 */ f32 unk_04; // frame count? - /* 0x08 */ s16 keyframe; - /* 0x0A */ s16 unk_0A; - /* 0x0C */ s16 unk_0C; - /* 0x10 */ Vec3f positionPos; // confusing name - /* 0x1C */ Vec3f lookAtPos; - /* 0x28 */ f32 roll; - /* 0x2C */ f32 fov; -} DebugCamAnim; // size = 0x30 - -typedef enum DebugCamTextColor { - /* 0 */ DEBUG_CAM_TEXT_YELLOW, - /* 1 */ DEBUG_CAM_TEXT_PEACH, - /* 2 */ DEBUG_CAM_TEXT_BROWN, - /* 3 */ DEBUG_CAM_TEXT_ORANGE, - /* 4 */ DEBUG_CAM_TEXT_GOLD, - /* 5 */ DEBUG_CAM_TEXT_WHITE, - /* 6 */ DEBUG_CAM_TEXT_BLUE, - /* 7 */ DEBUG_CAM_TEXT_GREEN -} DebugCamTextColor; - extern s32 gDebugCamEnabled; void Camera_Init(Camera* camera, struct View* view, struct CollisionContext* colCtx, struct PlayState* play); diff --git a/include/z64sram.h b/include/z64sram.h index 90617d1e6a..f1d05b7775 100644 --- a/include/z64sram.h +++ b/include/z64sram.h @@ -20,6 +20,8 @@ typedef enum SramHeaderField { /* 0x03 */ SRAM_HEADER_MAGIC // must be the value in `sSramDefaultHeader` for save to be considered valid } SramHeaderField; +extern u16 gSramSlotOffsets[]; + void Sram_InitNewSave(void); void Sram_InitDebugSave(void); void Sram_OpenSave(SramContext* sramCtx); @@ -31,6 +33,6 @@ void Sram_CopySave(struct FileSelectState* fileSelect, SramContext* sramCtx); void Sram_WriteSramHeader(SramContext* sramCtx); void Sram_InitSram(struct GameState* gameState, SramContext* sramCtx); void Sram_Alloc(struct GameState* gameState, SramContext* sramCtx); -void Sram_Init(struct GameState* play, SramContext* sramCtx); +void Sram_Init(struct GameState* gameState, SramContext* sramCtx); #endif diff --git a/include/z64vis.h b/include/z64vis.h index fcd24d1b76..86e286c325 100644 --- a/include/z64vis.h +++ b/include/z64vis.h @@ -28,7 +28,6 @@ typedef struct Vis { } Vis; // size = 0x10 - /* Cvg: Coverage */ #define FB_FILTER_TO_CVG_TYPE(filter) (filter) @@ -50,7 +49,6 @@ void VisCvg_Destroy(VisCvg* this); void VisCvg_Draw(VisCvg* this, Gfx** gfxP); - /* Mono: Desaturation */ // Only one type @@ -66,7 +64,6 @@ void VisMono_Destroy(VisMono* this); void VisMono_Draw(VisMono* this, Gfx** gfxP); - /* ZBuf: Z-Buffer */ #define FB_FILTER_TO_ZBUF_TYPE(filter) ((filter) - FB_FILTER_ZBUF_IA) diff --git a/include/z_en_a_obj.h b/include/z_en_a_obj.h new file mode 100644 index 0000000000..bd65f88f13 --- /dev/null +++ b/include/z_en_a_obj.h @@ -0,0 +1,41 @@ +#ifndef Z_EN_A_OBJ_H +#define Z_EN_A_OBJ_H + +#include "ultra64.h" +#include "z64actor.h" + +// Only A_OBJ_SIGNPOST_OBLONG and A_OBJ_SIGNPOST_ARROW are used in room files. +typedef enum AObjType { + /* 0x00 */ A_OBJ_BLOCK_SMALL, + /* 0x01 */ A_OBJ_BLOCK_LARGE, + /* 0x02 */ A_OBJ_BLOCK_HUGE, + /* 0x03 */ A_OBJ_BLOCK_SMALL_ROT, + /* 0x04 */ A_OBJ_BLOCK_LARGE_ROT, + /* 0x05 */ A_OBJ_CUBE_SMALL, + /* 0x06 */ A_OBJ_UNKNOWN_6, + /* 0x07 */ A_OBJ_GRASS_CLUMP, + /* 0x08 */ A_OBJ_TREE_STUMP, + /* 0x09 */ A_OBJ_SIGNPOST_OBLONG, + /* 0x0A */ A_OBJ_SIGNPOST_ARROW, + /* 0x0B */ A_OBJ_BOULDER_FRAGMENT, + /* 0x0C */ A_OBJ_MAX +} AObjType; + +struct EnAObj; + +typedef void (*EnAObjActionFunc)(struct EnAObj*, struct PlayState*); + +typedef struct EnAObj { + /* 0x000 */ DynaPolyActor dyna; + /* 0x164 */ EnAObjActionFunc actionFunc; + /* 0x168 */ s32 rotateWaitTimer; + /* 0x16C */ s16 textId; + /* 0x16E */ s16 rotateState; + /* 0x170 */ s16 rotateForTimer; + /* 0x172 */ s16 rotSpeedY; + /* 0x174 */ s16 rotSpeedX; + /* 0x178 */ f32 focusYoffset; + /* 0x17C */ ColliderCylinder collider; +} EnAObj; // size = 0x1C8 + +#endif diff --git a/include/z_game_dlftbls.h b/include/z_game_dlftbls.h index 691cda27cb..b5b8c62c87 100644 --- a/include/z_game_dlftbls.h +++ b/include/z_game_dlftbls.h @@ -3,7 +3,6 @@ #include "ultra64.h" #include "romfile.h" -#include "unk.h" typedef struct GameStateOverlay { /* 0x00 */ void* loadedRamAddr; @@ -15,7 +14,7 @@ typedef struct GameStateOverlay { /* 0x1C */ void* destroy; // deconstructs the context, and sets the next context to load /* 0x20 */ void* unk_20; /* 0x24 */ void* unk_24; - /* 0x28 */ UNK_TYPE4 unk_28; + /* 0x28 */ s32 unk_28; /* 0x2C */ u32 instanceSize; } GameStateOverlay; // size = 0x30 diff --git a/include/z_locale.h b/include/z_locale.h new file mode 100644 index 0000000000..7afcb33db4 --- /dev/null +++ b/include/z_locale.h @@ -0,0 +1,12 @@ +#ifndef Z_LOCALE_H +#define Z_LOCALE_H + +#include "ultra64/ultratypes.h" +#include "region.h" + +extern s32 gCurrentRegion; + +void Locale_Init(void); +void Locale_ResetRegion(void); + +#endif diff --git a/src/audio/general.c b/src/audio/general.c index 228fb879f1..ddf13f4cff 100644 --- a/src/audio/general.c +++ b/src/audio/general.c @@ -1,9 +1,14 @@ +#include "libu64/gfxprint.h" #include "ultra64.h" -#include "global.h" +#include "attributes.h" +#include "controller.h" +#include "padmgr.h" #include "seqcmd.h" #include "sequence.h" #include "versions.h" +#include "global.h" + #define ABS_ALT(x) ((x) < 0 ? -(x) : (x)) #if !PLATFORM_N64 diff --git a/src/audio/lib/effects.c b/src/audio/lib/effects.c index bbfcaf61ad..e6d2324886 100644 --- a/src/audio/lib/effects.c +++ b/src/audio/lib/effects.c @@ -1,4 +1,6 @@ #include "ultra64.h" +#include "attributes.h" + #include "global.h" void Audio_SequenceChannelProcessSound(SequenceChannel* channel, s32 recalculateVolume, s32 applyBend) { diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index 8ecf7f8886..d4c1ea8644 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -1,4 +1,5 @@ #include "ultra64.h" +#include "attributes.h" #include "buffers.h" #include "versions.h" diff --git a/src/audio/lib/seqplayer.c b/src/audio/lib/seqplayer.c index 2caaf17e0c..1a1d40c4d2 100644 --- a/src/audio/lib/seqplayer.c +++ b/src/audio/lib/seqplayer.c @@ -15,7 +15,9 @@ */ #include "ultra64.h" #include "assert.h" +#include "attributes.h" #include "audio/aseq.h" + #include "global.h" static_assert(MML_VERSION == MML_VERSION_OOT, "This file implements the OoT version of the MML"); diff --git a/src/boot/assert.c b/src/boot/assert.c index e58f2cc1e7..661f7db873 100644 --- a/src/boot/assert.c +++ b/src/boot/assert.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "libc64/sprintf.h" +#include "assert.h" #include "fault.h" NORETURN void __assert(const char* assertion, const char* file, int line) { diff --git a/src/boot/boot_main.c b/src/boot/boot_main.c index 4bd5b5bd02..75c1b9cf89 100644 --- a/src/boot/boot_main.c +++ b/src/boot/boot_main.c @@ -1,11 +1,14 @@ -#include "global.h" #include "boot.h" #include "stack.h" +#include "stackcheck.h" #if PLATFORM_N64 #include "cic6105.h" #endif +#include "z_locale.h" #include "z64thread.h" +#include "global.h" + #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:128" StackEntry sBootThreadInfo; diff --git a/src/boot/cic6105.c b/src/boot/cic6105.c index 7f76e99c3b..29b04f2a8a 100644 --- a/src/boot/cic6105.c +++ b/src/boot/cic6105.c @@ -1,7 +1,9 @@ #pragma increment_block_number "ntsc-1.2:0" - #include "global.h" +#include "audiomgr.h" #include "cic6105.h" +#include "regs.h" +#include "sched.h" #include "fault.h" s32 func_80001714(void); diff --git a/src/boot/idle.c b/src/boot/idle.c index ffc6de34b4..be4c9f7cbf 100644 --- a/src/boot/idle.c +++ b/src/boot/idle.c @@ -1,4 +1,5 @@ #include "buffers.h" +#include "main.h" #include "segment_symbols.h" #include "stack.h" #include "stackcheck.h" diff --git a/src/boot/is_debug.c b/src/boot/is_debug.c index 1f8938f9de..912b759843 100644 --- a/src/boot/is_debug.c +++ b/src/boot/is_debug.c @@ -1,4 +1,5 @@ #include "global.h" +#include "attributes.h" typedef struct ISVDbg { /* 0x00 */ u32 magic; // "IS64" diff --git a/src/boot/z_locale.c b/src/boot/z_locale.c index b6ce255c6a..f54be014ba 100644 --- a/src/boot/z_locale.c +++ b/src/boot/z_locale.c @@ -1,8 +1,14 @@ -#include "global.h" +#include "libu64/debug.h" +#include "alignment.h" +#include "line_numbers.h" +#include "padmgr.h" #include "region.h" #include "terminal.h" #include "versions.h" -#include "line_numbers.h" +#include "z_locale.h" + +#include "macros.h" +#include "global.h" s32 gCurrentRegion = 0; diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index b8d5276195..7cbf009946 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -19,6 +19,9 @@ * to be uncompressed and the request queue and address translation is skipped. */ #include "libc64/sleep.h" +#include "libc64/sprintf.h" +#include "libu64/debug.h" +#include "attributes.h" #include "fault.h" #include "line_numbers.h" #if PLATFORM_N64 @@ -33,7 +36,7 @@ #include "global.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:86 pal-1.0:84 pal-1.1:84" + "ntsc-1.2:12 pal-1.0:10 pal-1.1:10" StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 8e002a5a18..9dcb28f3a4 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -5,8 +5,15 @@ * buffer copies and coverage drawing. Also contains software implementations of the Video Interface anti-aliasing and * divot filters. */ -#include "global.h" +#include "libu64/debug.h" #include "alloca.h" +#include "color.h" +#include "gfx.h" +#include "prerender.h" +#include "regs.h" + +#include "macros.h" +#include "global.h" void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg) { this->widthSave = width; diff --git a/src/code/TwoHeadGfxArena.c b/src/code/TwoHeadGfxArena.c index ce7b8a45fb..c3f2216fad 100644 --- a/src/code/TwoHeadGfxArena.c +++ b/src/code/TwoHeadGfxArena.c @@ -8,7 +8,7 @@ * * @see TwoHeadArena.c */ -#include "global.h" +#include "thga.h" void THGA_Init(TwoHeadGfxArena* thga, void* start, size_t size) { THA_Init(&thga->tha, start, size); diff --git a/src/code/audio_thread_manager.c b/src/code/audio_thread_manager.c index 1dc72642f3..8837601f8f 100644 --- a/src/code/audio_thread_manager.c +++ b/src/code/audio_thread_manager.c @@ -5,7 +5,12 @@ * and sending the audio rsp tasks generated by the driver to the task scheduler. */ -#include "global.h" +#include "audiomgr.h" +#include "regs.h" +#include "speed_meter.h" +#include "z64dma.h" + +#include "macros.h" void AudioMgr_NotifyTaskDone(AudioMgr* audioMgr) { AudioTask* task = audioMgr->rspTask; diff --git a/src/code/code_n64dd_800AD4C0.c b/src/code/code_n64dd_800AD4C0.c index 34dcdb3bb3..4c4e0db0e3 100644 --- a/src/code/code_n64dd_800AD4C0.c +++ b/src/code/code_n64dd_800AD4C0.c @@ -1,9 +1,11 @@ #include "fault.h" #include "n64dd.h" +#include "regs.h" +#include "segmented_address.h" +#include "z64actor.h" +#include "z64cutscene.h" #include "z64save.h" -#include "global.h" - n64ddStruct_800FEE70_pointers D_800FEE70 = { func_801C7C1C, NULL, diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 5b997b490e..f316505872 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -1,6 +1,7 @@ #include "libu64/gfxprint.h" #include "attributes.h" #include "controller.h" +#include "db_camera.h" #include "debug_arena.h" #include "letterbox.h" #include "mempak.h" diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index c70503cddd..29d04071c6 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -40,8 +40,8 @@ * DPad-Up may be pressed to enable sending fault pages over osSyncPrintf as well as displaying them on-screen. * DPad-Down disables sending fault pages over osSyncPrintf. */ -#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-eu-mq-dbg:160 gc-jp:176 gc-jp-ce:176 gc-jp-mq:176 gc-us:176" \ - "gc-us-mq:176 ique-cn:176" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-eu-mq-dbg:96 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128" \ + "gc-us-mq:128 ique-cn:128" #include "global.h" #include "libc64/sleep.h" diff --git a/src/code/fault_n64.c b/src/code/fault_n64.c index feb884716e..ecfc87f10f 100644 --- a/src/code/fault_n64.c +++ b/src/code/fault_n64.c @@ -13,7 +13,7 @@ #include "macros.h" #include "global.h" -#pragma increment_block_number "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" +#pragma increment_block_number "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" typedef struct FaultMgr { OSThread thread; diff --git a/src/code/game.c b/src/code/game.c index 3f5dfb7ebb..6db35e5630 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -1,3 +1,4 @@ +#include "libc64/malloc.h" #include "libu64/debug.h" #include "libu64/gfxprint.h" #include "audiomgr.h" @@ -16,10 +17,13 @@ #include "regs.h" #include "rumble.h" #include "speed_meter.h" +#include "sys_debug_controller.h" #include "terminal.h" #include "versions.h" #include "vi_mode.h" +#include "zelda_arena.h" #include "z64debug.h" +#include "z64dma.h" #include "z64game.h" #include "z64vis.h" diff --git a/src/code/graph.c b/src/code/graph.c index 288a1cee7d..4fc7a56ac9 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -4,6 +4,7 @@ #include "buffers.h" #include "console_logo_state.h" +#include "controller.h" #include "gfx.h" #include "fault.h" #include "file_select_state.h" @@ -13,12 +14,15 @@ #include "prenmi_state.h" #include "regs.h" #include "setup_state.h" +#include "speed_meter.h" +#include "sys_debug_controller.h" #include "sys_ucode.h" #include "terminal.h" #include "title_setup_state.h" #include "ucode_disas.h" #include "versions.h" #include "z_game_dlftbls.h" +#include "z64audio.h" #include "z64save.h" #include "z64play.h" @@ -28,8 +32,8 @@ #define GFXPOOL_HEAD_MAGIC 0x1234 #define GFXPOOL_TAIL_MAGIC 0x5678 -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.0:224" \ - "ntsc-1.1:224 ntsc-1.2:224 pal-1.0:224 pal-1.1:224" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:128" \ + "ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:96 pal-1.0:96 pal-1.1:96" /** * The time at which the previous `Graph_Update` ended. diff --git a/src/code/irqmgr.c b/src/code/irqmgr.c index b90d5df7b7..d741612e28 100644 --- a/src/code/irqmgr.c +++ b/src/code/irqmgr.c @@ -32,11 +32,15 @@ * * @see sched.c */ -#include "global.h" +#include "libu64/debug.h" +#include "irqmgr.h" +#include "stackcheck.h" #include "terminal.h" #include "versions.h" #include "z64thread.h" +#include "macros.h" + vu32 gIrqMgrResetStatus = IRQ_RESET_STATUS_IDLE; volatile OSTime sIrqMgrResetTime = 0; volatile OSTime gIrqMgrRetraceTime = 0; diff --git a/src/code/listalloc.c b/src/code/listalloc.c index 7560c20c64..9ccaa443d1 100644 --- a/src/code/listalloc.c +++ b/src/code/listalloc.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "libc64/malloc.h" +#include "listalloc.h" ListAlloc* ListAlloc_Init(ListAlloc* this) { this->prev = NULL; diff --git a/src/code/main.c b/src/code/main.c index 32a543a9b4..8a52882d07 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -12,11 +12,16 @@ extern struct Scheduler gScheduler; extern struct PadMgr gPadMgr; extern struct IrqMgr gIrqMgr; +#include "libc64/malloc.h" +#include "audiomgr.h" #include "debug_arena.h" #include "fault.h" +#include "padmgr.h" #include "prenmi_buff.h" +#include "regs.h" #include "segmented_address.h" #include "stack.h" +#include "stackcheck.h" #include "terminal.h" #include "versions.h" #if PLATFORM_N64 @@ -28,8 +33,8 @@ extern struct IrqMgr gIrqMgr; #include "global.h" -#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ - "ique-cn:160 ntsc-1.0:140 ntsc-1.1:140 ntsc-1.2:140 pal-1.0:138 pal-1.1:138" +#pragma increment_block_number "gc-eu:32 gc-eu-mq:32 gc-jp:32 gc-jp-ce:32 gc-jp-mq:32 gc-us:32 gc-us-mq:32 ique-cn:32" \ + "ntsc-1.0:13 ntsc-1.1:13 ntsc-1.2:13 pal-1.0:11 pal-1.1:11" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/mempak.c b/src/code/mempak.c index 8d68be5ca3..f316f0ea31 100644 --- a/src/code/mempak.c +++ b/src/code/mempak.c @@ -7,7 +7,10 @@ * Each file is assigned an uppercase ASCII letter as an identifier, the game name for each is marked as * 'ZELDA DEMO TOOL', encoded according to the N64 Font Code described in section 26.3 of the N64 Programming Manual. */ -#include "global.h" +#include "mempak.h" +#include "padmgr.h" + +#include "macros.h" #define MEMPAK_MAX_FILES 11 diff --git a/src/code/sched.c b/src/code/sched.c index 57eae69500..4fb5a33760 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -42,11 +42,14 @@ #include "libu64/debug.h" #include "fault.h" #include "irqmgr.h" +#include "main.h" #include "regs.h" #include "sched.h" +#include "speed_meter.h" #include "versions.h" #include "z64thread.h" +#include "macros.h" #include "global.h" #define RSP_DONE_MSG 667 diff --git a/src/code/shrink_window.c b/src/code/shrink_window.c index ad8da58d35..e952a0c3fd 100644 --- a/src/code/shrink_window.c +++ b/src/code/shrink_window.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "letterbox.h" +#include "regs.h" + +#include "macros.h" typedef enum LetterboxState { /* 0 */ LETTERBOX_STATE_IDLE, diff --git a/src/code/speed_meter.c b/src/code/speed_meter.c index c8a6fee43c..dabfac7aaa 100644 --- a/src/code/speed_meter.c +++ b/src/code/speed_meter.c @@ -1,8 +1,14 @@ #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" - -#include "global.h" +#include "libc64/malloc.h" +#include "libu64/debug.h" +#include "gfx.h" +#include "regs.h" +#include "speed_meter.h" #include "terminal.h" +#include "zelda_arena.h" +#include "z64game.h" +#include "z64view.h" /** * How much time the audio update on the audio thread (`AudioThread_Update`) took in total, between scheduling the last diff --git a/src/code/sys_debug_controller.c b/src/code/sys_debug_controller.c index eb1398ff24..06ce8bf6cd 100644 --- a/src/code/sys_debug_controller.c +++ b/src/code/sys_debug_controller.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "sys_debug_controller.h" +#include "stdbool.h" +#include "ultra64/ultratypes.h" +#include "padmgr.h" u32 gIsCtrlr2Valid = false; diff --git a/src/code/sys_freeze.c b/src/code/sys_freeze.c index f7cb515cfe..ea50a89491 100644 --- a/src/code/sys_freeze.c +++ b/src/code/sys_freeze.c @@ -1,6 +1,10 @@ -#include "global.h" +#include "libc64/sleep.h" +#include "attributes.h" +#include "sys_freeze.h" #include "terminal.h" +#include "macros.h" + NORETURN void func_800D31A0(void) { PRINTF(VT_FGCOL(RED) "\n**** Freeze!! ****\n" VT_RST); for (;;) { diff --git a/src/code/sys_rumble.c b/src/code/sys_rumble.c index 10844f3674..57f61c9214 100644 --- a/src/code/sys_rumble.c +++ b/src/code/sys_rumble.c @@ -12,7 +12,8 @@ * * @note Original filename is likely sys_vibrate.c or similar as it is ordered after sys_ucode.c */ -#include "global.h" +#include "rumble.h" +#include "padmgr.h" /** * Rumble manager update, runs on Vertical Retrace on the padmgr thread. diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 54807627bf..798d8a036a 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -33,8 +33,8 @@ #include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "assets/objects/object_bdoor/object_bdoor.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:128 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.0:128" \ + "ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" CollisionPoly* sCurCeilingPoly; s32 sCurCeilingBgId; diff --git a/src/code/z_bg_item.c b/src/code/z_bg_item.c index 1a4d9f58d5..43c32eb558 100644 --- a/src/code/z_bg_item.c +++ b/src/code/z_bg_item.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "z_lib.h" +#include "z64actor.h" +#include "z64bgcheck.h" +#include "z64play.h" /** * @param transformFlags How other actors standing on the dynapoly actor's collision move when the dynapoly actor moves. diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index c5d22fd6a2..71733baef5 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -11,7 +11,7 @@ #include "z64player.h" #include "z64skin_matrix.h" -#pragma increment_block_number "ntsc-1.0:184 ntsc-1.1:184 ntsc-1.2:184" +#pragma increment_block_number "ntsc-1.0:208 ntsc-1.1:208 ntsc-1.2:208" u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* nodeList); void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector); diff --git a/src/code/z_camera.c b/src/code/z_camera.c index d36f36b9a5..79516f0171 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -1,14 +1,30 @@ +#include "libc64/math64.h" +#include "libc64/qrand.h" #include "ultra64.h" + +#include "attributes.h" +#include "controller.h" +#include "db_camera.h" +#include "letterbox.h" +#include "one_point_cutscene.h" #include "quake.h" +#include "regs.h" +#include "sfx.h" +#include "sys_math3d.h" #include "terminal.h" +#include "z_lib.h" +#include "zelda_arena.h" +#include "z64audio.h" #include "z64cutscene_spline.h" #include "z64debug.h" #include "z64olib.h" +#include "z64play.h" +#include "z64player.h" #include "z64save.h" #include "overlays/actors/ovl_En_Horse/z_en_horse.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ - "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ + "ique-cn:192 ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" s16 Camera_RequestSettingImpl(Camera* camera, s16 requestedSetting, s16 flags); s32 Camera_RequestModeImpl(Camera* camera, s16 requestedMode, u8 forceModeChange); @@ -3642,7 +3658,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:120 ntsc-1.1:120 ntsc-1.2:120 pal-1.0:118 pal-1.1:118" + "ique-cn:128 ntsc-1.0:95 ntsc-1.1:95 ntsc-1.2:95 pal-1.0:93 pal-1.1:93" s32 Camera_KeepOn4(Camera* camera) { static Vec3f D_8015BD50; diff --git a/src/code/z_cheap_proc.inc.c b/src/code/z_cheap_proc.inc.c index 059f67c02b..e922c0832c 100644 --- a/src/code/z_cheap_proc.inc.c +++ b/src/code/z_cheap_proc.inc.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z64play.h" void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist) { OPEN_DISPS(play->state.gfxCtx, "../z_cheap_proc.c", 214); diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index c342ddf156..e05bb44d17 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -15,7 +15,7 @@ #include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h" #include "z_lib.h" -#pragma increment_block_number "ique-cn:0 ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:224 pal-1.1:224" +#pragma increment_block_number "ique-cn:0 ntsc-1.0:248 ntsc-1.1:248 ntsc-1.2:248 pal-1.0:248 pal-1.1:248" typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index a7f1e7c793..97cb44a4f0 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -1,14 +1,14 @@ +#include "alignment.h" #include "region.h" #include "sequence.h" #include "versions.h" +#include "z_locale.h" #include "z64environment.h" #include "z64save.h" #include "z64transition.h" -#include "global.h" - -#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64" \ - "ntsc-1.0:176 ntsc-1.1:176 ntsc-1.2:176 pal-1.0:192 pal-1.1:192" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" ALIGNED(16) SaveContext gSaveContext; #if PLATFORM_IQUE diff --git a/src/code/z_demo.c b/src/code/z_demo.c index bd1c418574..921613bd80 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,4 +1,4 @@ -#pragma increment_block_number "gc-eu:0 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:128 gc-us:0 gc-us-mq:128 ique-cn:0" \ +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" #include "global.h" #include "libu64/gfxprint.h" @@ -144,8 +144,8 @@ u16 gCamAtSplinePointsAppliedFrame; u16 gCamEyePointAppliedFrame; u16 gCamAtPointAppliedFrame; -#pragma increment_block_number "gc-eu:0 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:128 gc-us:0 gc-us-mq:128 ique-cn:0" \ - "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ + "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:0 pal-1.0:128 pal-1.1:128" // Cam ID to return to when a scripted cutscene is finished s16 sReturnToCamId; diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c index db87e31fd3..d44007bb76 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -1,4 +1,15 @@ +#include "libc64/math64.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64skin_matrix.h" + +#include "macros.h" #include "global.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) { diff --git a/src/code/z_eff_shield_particle.c b/src/code/z_eff_shield_particle.c index 74cd6a435a..e4e331964e 100644 --- a/src/code/z_eff_shield_particle.c +++ b/src/code/z_eff_shield_particle.c @@ -1,5 +1,15 @@ -#include "global.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" #include "terminal.h" +#include "z64effect.h" +#include "z64light.h" +#include "z64play.h" +#include "z64skin_matrix.h" + +#include "macros.h" +#include "global.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" static Vtx sVertices[5] = { diff --git a/src/code/z_eff_spark.c b/src/code/z_eff_spark.c index 8074be9007..f14c8160fe 100644 --- a/src/code/z_eff_spark.c +++ b/src/code/z_eff_spark.c @@ -1,4 +1,14 @@ +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64skin_matrix.h" + +#include "macros.h" #include "global.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" // original name: "spark" diff --git a/src/code/z_eff_ss_dead.c b/src/code/z_eff_ss_dead.c index 2a64a23f4a..c752738725 100644 --- a/src/code/z_eff_ss_dead.c +++ b/src/code/z_eff_ss_dead.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "gfx.h" +#include "z_lib.h" +#include "z64play.h" void func_80026230(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; diff --git a/src/code/z_effect.c b/src/code/z_effect.c index ac2141db0b..02ba00a8dd 100644 --- a/src/code/z_effect.c +++ b/src/code/z_effect.c @@ -1,6 +1,7 @@ -#include "global.h" - +#include "gfx.h" +#include "z64effect.h" #include "z64frame_advance.h" +#include "z64play.h" EffectContext sEffectContext; diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 253996b625..c04e76128e 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -1,4 +1,16 @@ -#include "global.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64skin_matrix.h" + #include "overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h" #include "overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.h" #include "overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.h" diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 23d77075dd..9b2bf7c0b7 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -1,4 +1,11 @@ -#include "global.h" +#include "z_en_a_obj.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_d_hsblock/object_d_hsblock.h" diff --git a/src/code/z_fbdemo.c b/src/code/z_fbdemo.c index a2b0fb8bf1..246e27b1a3 100644 --- a/src/code/z_fbdemo.c +++ b/src/code/z_fbdemo.c @@ -9,7 +9,14 @@ * @note The only coded effect has a visual effect to blend the tiles to a single point, which looks like the screen * gets sucked into. */ -#include "global.h" +#include "libc64/malloc.h" +#include "libc64/sleep.h" +#include "libu64/debug.h" +#include "gfx.h" +#include "z64math.h" +#include "z64transition_instances.h" + +#include "macros.h" // color framebuffer extern u16 D_0F000000[]; diff --git a/src/code/z_fbdemo_circle.c b/src/code/z_fbdemo_circle.c index 59f019e952..c25f174a75 100644 --- a/src/code/z_fbdemo_circle.c +++ b/src/code/z_fbdemo_circle.c @@ -1,3 +1,5 @@ +#include "gfx.h" + #include "global.h" typedef enum TransitionCircleDirection { diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index 1086adb2ec..3797449312 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -25,8 +25,14 @@ * - higher detail draws both. */ -#include "global.h" +#include "gfx.h" +#include "regs.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "zelda_arena.h" +#include "z64actor.h" #include "z64curve.h" +#include "z64play.h" void SkelCurve_Clear(SkelCurve* skelCurve) { skelCurve->limbCount = 0; diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 1d99a6f5c7..cacd46abe3 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -1,5 +1,5 @@ -#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ - "ique-cn:224 ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:224 pal-1.1:224" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:144 ntsc-1.1:144 ntsc-1.2:144 pal-1.0:144 pal-1.1:144" #include "libu64/debug.h" #include "kaleido_manager.h" diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 61285768ac..ff23bbebc2 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1,5 +1,5 @@ -#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ - "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:64 pal-1.1:64" +#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64 ique-cn:64" \ + "ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:64 pal-1.1:64" #include "libc64/qrand.h" #include "libu64/gfxprint.h" @@ -235,8 +235,8 @@ s16 sLightningFlashAlpha; s16 sSunDepthTestX; s16 sSunDepthTestY; -#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:160 pal-1.1:160" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ + "ique-cn:160 ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" LightNode* sNGameOverLightNode; LightInfo sNGameOverLightInfo; diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c index d226d9e0ab..600aa2189c 100644 --- a/src/code/z_map_mark.c +++ b/src/code/z_map_mark.c @@ -1,5 +1,6 @@ #include "libu64/debug.h" #include "libu64/overlay.h" +#include "map.h" #include "regs.h" #include "romfile.h" #include "segment_symbols.h" diff --git a/src/code/z_message.c b/src/code/z_message.c index 1240cfed93..88c219d37d 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -24,7 +24,7 @@ #include "assets/textures/parameter_static/parameter_static.h" #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:208 ntsc-1.1:208 ntsc-1.2:208 pal-1.0:128 pal-1.1:128" + "ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:80 pal-1.0:128 pal-1.1:128" #if !PLATFORM_IQUE #define MSG_BUF_DECODED (msgCtx->msgBufDecoded) diff --git a/src/code/z_moji.c b/src/code/z_moji.c index c9cbbdda88..33abd83f7f 100644 --- a/src/code/z_moji.c +++ b/src/code/z_moji.c @@ -2,6 +2,9 @@ * Unused. A very simple utility for drawing text on screen. */ +#include "gfx.h" + +#include "macros.h" #include "global.h" // how big to draw the characters on screen diff --git a/src/code/z_play.c b/src/code/z_play.c index d49ae40fe7..13ce984512 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1,3 +1,5 @@ +#include "libc64/malloc.h" +#include "libc64/qrand.h" #include "libu64/debug.h" #include "buffers.h" #include "controller.h" @@ -33,11 +35,12 @@ #include "z64play.h" #include "z64player.h" #include "z64save.h" +#include "z64vis.h" #include "global.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:192" \ - "ntsc-1.0:144 ntsc-1.1:144 ntsc-1.2:144 pal-1.0:144 pal-1.1:144" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ + "ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:224 pal-1.1:224" TransitionTile gTransitionTile; s32 gTransitionTileState; diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index 2874522dfb..eb52aff798 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -1,4 +1,8 @@ -#include "global.h" +#include "kaleido_manager.h" +#include "z64actor.h" +#include "z64actor_profile.h" +#include "z64play.h" +#include "z64player.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index eb9790a6e9..6228b51cf1 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -3,11 +3,10 @@ #include "gfx_setupdl.h" #include "gfxalloc.h" #include "letterbox.h" +#include "main.h" #include "regs.h" #include "z64play.h" -#include "global.h" - Gfx sSetupDL[SETUPDL_MAX][6] = { { /* SETUPDL_0 */ diff --git a/src/code/z_rumble.c b/src/code/z_rumble.c index 49a54e7aab..52897d6294 100644 --- a/src/code/z_rumble.c +++ b/src/code/z_rumble.c @@ -11,7 +11,9 @@ * * @note Original filename is likely z_vibrate.c or similar as it is ordered after z_ss_sram.c and before z_view.c */ -#include "global.h" +#include "rumble.h" +#include "padmgr.h" +#include "z64math.h" RumbleMgr sRumbleMgr; diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 805141ade7..77206ce6f8 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -1,9 +1,16 @@ -#include "global.h" +#include "regs.h" +#include "romfile.h" #include "seqcmd.h" +#include "segment_symbols.h" +#include "segmented_address.h" #include "terminal.h" #include "versions.h" #include "z_actor_dlftbls.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" #include "z64save.h" +#include "z64scene.h" SceneCmdHandlerFunc sSceneCmdHandlers[SCENE_CMD_ID_MAX]; RomFile sNaviQuestHintFiles[]; diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 49502f4ec9..be5f275647 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -1,5 +1,17 @@ -#include "global.h" +#include "libu64/debug.h" +#include "gfx.h" +#include "regs.h" +#include "segmented_address.h" +#include "segment_symbols.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "zelda_arena.h" +#include "z64animation.h" +#include "z64animation_legacy.h" +#include "z64play.h" + +#include "macros.h" #define ANIM_INTERP 1 diff --git a/src/code/z_skin_matrix.c b/src/code/z_skin_matrix.c index 689fe67107..f83cb8295d 100644 --- a/src/code/z_skin_matrix.c +++ b/src/code/z_skin_matrix.c @@ -1,5 +1,9 @@ -#include "global.h" +#include "gfx.h" #include "terminal.h" +#include "z_lib.h" +#include "z64skin_matrix.h" + +#include "macros.h" // clang-format off MtxF sMtxFClear = { diff --git a/src/code/z_view.c b/src/code/z_view.c index 5b68f00bf4..dd4608cde3 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -1,5 +1,12 @@ -#include "global.h" +#include "libc64/malloc.h" +#include "libu64/debug.h" +#include "gfx.h" +#include "letterbox.h" +#include "main.h" +#include "regs.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z64view.h" vu32 sLogOnNextViewInit = true; diff --git a/src/code/z_vimode.c b/src/code/z_vimode.c index 668e9648e9..d1f472057e 100644 --- a/src/code/z_vimode.c +++ b/src/code/z_vimode.c @@ -1,9 +1,15 @@ #include "vi_mode.h" -#include "global.h" +#include "libu64/debug.h" #include "ultra64/viint.h" +#include "controller.h" +#include "main.h" +#include "regs.h" #include "versions.h" +#include "global.h" +#include "macros.h" + void ViMode_LogPrint(OSViMode* osViMode) { LOG_ADDRESS("osvimodep", osViMode, "../z_vimode.c", 87); LOG_HEX32("osvimodep->comRegs.ctrl", osViMode->comRegs.ctrl, "../z_vimode.c", 88); diff --git a/src/code/z_viscvg.c b/src/code/z_viscvg.c index 9caf39a3f8..5fff1a460f 100644 --- a/src/code/z_viscvg.c +++ b/src/code/z_viscvg.c @@ -20,7 +20,10 @@ * before the filter is applied. */ -#include "global.h" +#include "gfx.h" +#include "z64vis.h" + +#include "macros.h" /** * Draws only coverage: does not retain any of the original pixel RGB, primColor is used as background color. diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index aac4fa84f9..e3cecda5c1 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -8,7 +8,14 @@ * comments. */ -#include "global.h" +#include "libc64/malloc.h" +#include "libu64/debug.h" +#include "attributes.h" +#include "gfx.h" +#include "gfxalloc.h" +#include "z64vis.h" + +#include "macros.h" // Height of the fragments the color frame buffer (CFB) is split into. // It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into diff --git a/src/code/z_viszbuf.c b/src/code/z_viszbuf.c index 5a542bc124..8f8265bfda 100644 --- a/src/code/z_viszbuf.c +++ b/src/code/z_viszbuf.c @@ -32,7 +32,10 @@ * again ignored by the RenderMode. */ -#include "global.h" +#include "gfx.h" +#include "z64vis.h" + +#include "macros.h" // Height of the fragments the z-buffer is split into. // It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into TMEM. diff --git a/src/code/z_vr_box_draw.c b/src/code/z_vr_box_draw.c index 45e3237deb..aa7fa1dae0 100644 --- a/src/code/z_vr_box_draw.c +++ b/src/code/z_vr_box_draw.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z64skybox.h" Mtx* sSkyboxDrawMatrix; diff --git a/src/libleo/api/cacreateleomanager.c b/src/libleo/api/cacreateleomanager.c index fc3235c08c..aa9c0feda7 100644 --- a/src/libleo/api/cacreateleomanager.c +++ b/src/libleo/api/cacreateleomanager.c @@ -1,9 +1,11 @@ -#include "global.h" #include "ultra64/asm.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" #include "libc/stdint.h" +#include "attributes.h" + +#include "global.h" s32 LeoCACreateLeoManager(s32 comPri, s32 intPri, OSMesg* cmdBuf, s32 cmdMsgCnt) { OSPiHandle* driveRomHandle; diff --git a/src/libleo/api/cjcreateleomanager.c b/src/libleo/api/cjcreateleomanager.c index 26ced4f7db..4cd6ab0018 100644 --- a/src/libleo/api/cjcreateleomanager.c +++ b/src/libleo/api/cjcreateleomanager.c @@ -1,9 +1,11 @@ -#include "global.h" #include "ultra64/asm.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" #include "libc/stdint.h" +#include "attributes.h" + +#include "global.h" s32 LeoCJCreateLeoManager(s32 comPri, s32 intPri, OSMesg* cmdBuf, s32 cmdMsgCnt) { OSPiHandle* driveRomHandle; diff --git a/src/libleo/leo/leocmdex.c b/src/libleo/leo/leocmdex.c index ca3101fb0a..7a678dc675 100644 --- a/src/libleo/leo/leocmdex.c +++ b/src/libleo/leo/leocmdex.c @@ -1,7 +1,9 @@ -#include "global.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" +#include "attributes.h" + +#include "global.h" extern vu16 LEOrw_flags; diff --git a/src/libleo/leo/leomecha.c b/src/libleo/leo/leomecha.c index da141616c8..98de987f71 100644 --- a/src/libleo/leo/leomecha.c +++ b/src/libleo/leo/leomecha.c @@ -1,7 +1,9 @@ -#include "global.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" +#include "attributes.h" + +#include "global.h" extern s32 currentCommand; diff --git a/src/libleo/leo/leotimer.c b/src/libleo/leo/leotimer.c index aadfc3b828..c2c5d98b54 100644 --- a/src/libleo/leo/leotimer.c +++ b/src/libleo/leo/leotimer.c @@ -1,7 +1,9 @@ -#include "global.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" +#include "attributes.h" + +#include "global.h" typedef struct { /* 0x0 */ u8 year; diff --git a/src/libu64/gfxprint.c b/src/libu64/gfxprint.c index b3ebfcd0ef..7a1c37e08c 100644 --- a/src/libu64/gfxprint.c +++ b/src/libu64/gfxprint.c @@ -1,4 +1,8 @@ -#include "global.h" +#include "libc64/aprintf.h" +#include "libu64/gfxprint.h" +#include "attributes.h" + +#include "macros.h" u16 sGfxPrintFontTLUT[64] = { 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, diff --git a/src/libu64/stackcheck.c b/src/libu64/stackcheck.c index 787eb1c3e5..f98e828eae 100644 --- a/src/libu64/stackcheck.c +++ b/src/libu64/stackcheck.c @@ -1,6 +1,10 @@ -#include "global.h" +#include "libu64/debug.h" +#include "attributes.h" +#include "stackcheck.h" #include "terminal.h" +#include "macros.h" + StackEntry* sStackInfoListStart = NULL; StackEntry* sStackInfoListEnd = NULL; diff --git a/src/libu64/system_heap.c b/src/libu64/system_heap.c index 1ae93e868c..3a98ef3cef 100644 --- a/src/libu64/system_heap.c +++ b/src/libu64/system_heap.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "libc64/malloc.h" #include "libc64/os_malloc.h" typedef void (*arg3_800FC868)(void*); diff --git a/src/libultra/os/settimer.c b/src/libultra/os/settimer.c index c5632e82c2..3c4c644078 100644 --- a/src/libultra/os/settimer.c +++ b/src/libultra/os/settimer.c @@ -1,3 +1,6 @@ +#include "ultra64.h" +#include "attributes.h" + #include "global.h" s32 osSetTimer(OSTimer* timer, OSTime countdown, OSTime interval, OSMesgQueue* mq, OSMesg msg) { diff --git a/src/n64dd/n64dd_801C8000.c b/src/n64dd/n64dd_801C8000.c index 9b0a4b3adc..8c6c91a9ce 100644 --- a/src/n64dd/n64dd_801C8000.c +++ b/src/n64dd/n64dd_801C8000.c @@ -1,7 +1,7 @@ // Does some command processing -#include "global.h" #include "n64dd.h" #include "versions.h" +#include "z_locale.h" void func_801C8554(void); void func_801C8578(void* arg0, void* arg1, OSId id, void* sp, OSPri pri); diff --git a/src/n64dd/n64dd_801C8940.c b/src/n64dd/n64dd_801C8940.c index 437a23dcf2..a0d1ff84b3 100644 --- a/src/n64dd/n64dd_801C8940.c +++ b/src/n64dd/n64dd_801C8940.c @@ -1,6 +1,9 @@ // Lower-level command processing in a background thread -#include "global.h" #include "n64dd.h" +#include "libc64/sleep.h" +#include "attributes.h" + +#include "global.h" s32 D_801D2EA0 = 0; u8* D_801D2EA4 = NULL; diff --git a/src/n64dd/n64dd_801C9B70.c b/src/n64dd/n64dd_801C9B70.c index d7d2f63849..2437904c37 100644 --- a/src/n64dd/n64dd_801C9B70.c +++ b/src/n64dd/n64dd_801C9B70.c @@ -1,6 +1,6 @@ // User-facing error handling -#include "global.h" #include "n64dd.h" +#include "z_locale.h" u8 B_801E0F80[0x600]; u8 B_801E1580[0x2800]; diff --git a/src/n64dd/n64dd_801CA0B0.c b/src/n64dd/n64dd_801CA0B0.c index 8758e0fd62..d564d46caa 100644 --- a/src/n64dd/n64dd_801CA0B0.c +++ b/src/n64dd/n64dd_801CA0B0.c @@ -1,5 +1,8 @@ -#include "global.h" #include "n64dd.h" +#include "libc64/aprintf.h" +#include "attributes.h" + +#include "global.h" // Draws text to framebuffer typedef struct struct_801CA704 { diff --git a/src/n64dd/z_n64dd.c b/src/n64dd/z_n64dd.c index 1b6934f502..17aff6416c 100644 --- a/src/n64dd/z_n64dd.c +++ b/src/n64dd/z_n64dd.c @@ -1,11 +1,15 @@ // Main interface for the 64DD from the rest of the game. Starts background // threads and provides functions to submit commands to them. -#include "global.h" +#include "libc64/sleep.h" #include "fault.h" +#include "irqmgr.h" +#include "line_numbers.h" #include "n64dd.h" #include "stack.h" +#include "stackcheck.h" +#include "sys_freeze.h" #include "versions.h" -#include "line_numbers.h" +#include "z64audio.h" #include "z64thread.h" #pragma increment_block_number "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 3cb53006cc..1425b63c8b 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -32,8 +32,8 @@ #include "assets/objects/object_sst/object_sst.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 pal-1.0:128" \ - "pal-1.1:128" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:128" \ + "pal-1.0:128 pal-1.1:128" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ diff --git a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c index 9e9510f2da..5165520c6d 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -11,6 +11,7 @@ #include "gfx_setupdl.h" #include "ichain.h" #include "regs.h" +#include "sys_matrix.h" #include "terminal.h" #include "z64play.h" #include "z64player.h" diff --git a/src/overlays/actors/ovl_En_Bili/z_en_bili.c b/src/overlays/actors/ovl_En_Bili/z_en_bili.c index 57078a73af..82f7b62796 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -7,8 +7,11 @@ #include "z_en_bili.h" #include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" #include "ichain.h" #include "rand.h" +#include "segmented_address.h" #include "sfx.h" #include "sys_matrix.h" #include "versions.h" diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 1ebeaa882f..4517fc7e72 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -7,6 +7,7 @@ #include "gfx_setupdl.h" #include "letterbox.h" #include "macros.h" +#include "main.h" #include "map_select_state.h" #if PLATFORM_N64 #include "n64dd.h" @@ -20,8 +21,10 @@ #include "sys_matrix.h" #include "terminal.h" #include "versions.h" +#include "z_lib.h" #include "z64audio.h" #include "z64environment.h" +#include "z64play.h" #include "z64save.h" #include "z64skybox.h" #include "z64sram.h" diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c index 8fe674c3a2..4cb4fa5c85 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c @@ -3,12 +3,12 @@ #include "controller.h" #include "regs.h" +#include "rumble.h" #include "sfx.h" #include "z64save.h" #include "z64sram.h" #include "macros.h" -#include "global.h" // In iQue versions, this file contains many workarounds for EGCS internal // compiler errors (see docs/compilers.md) diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c index aeee6539a6..2c1e49fb59 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c @@ -4,6 +4,7 @@ #include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "regs.h" #include "rumble.h" #include "sfx.h" #include "sys_matrix.h" diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 0470a4f521..175c43f9ea 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -14,10 +14,13 @@ #include "console_logo_state.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "padmgr.h" #include "regs.h" #include "segment_symbols.h" #include "sequence.h" #include "sys_matrix.h" +#include "sys_debug_controller.h" +#include "sys_freeze.h" #include "title_setup_state.h" #include "versions.h" #include "z64actor.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index c35e3f8cf8..4690ccade8 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -1,7 +1,15 @@ #include "z_kaleido_scope.h" +#include "controller.h" +#include "gfx.h" +#include "regs.h" +#include "sfx.h" +#include "z64ocarina.h" +#include "z64play.h" #include "z64save.h" +#include "global.h" + #include "assets/textures/parameter_static/parameter_static.h" #include "assets/textures/icon_item_static/icon_item_static.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c index 0cecf2ed2b..3339bc3250 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c @@ -1,5 +1,11 @@ #include "z_kaleido_scope.h" +#include "libu64/gfxprint.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "gfxalloc.h" +#include "z64play.h" #include "z64save.h" #include "assets/textures/parameter_static/parameter_static.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index 0ac596023c..8a8b627995 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -1,5 +1,12 @@ #include "z_kaleido_scope.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "regs.h" +#include "sfx.h" +#include "z64play.h" +#include "z64player.h" #include "z64save.h" #include "assets/textures/icon_item_static/icon_item_static.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index 3b9ee9a5de..e76c6a7cea 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -1,5 +1,12 @@ #include "z_kaleido_scope.h" +#include "libu64/pad.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "regs.h" +#include "sfx.h" +#include "z64play.h" #include "z64save.h" #include "assets/textures/parameter_static/parameter_static.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c index ccd2bcee9a..09a85cb039 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c @@ -1,9 +1,17 @@ #include "z_kaleido_scope.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "map.h" +#include "regs.h" +#include "sfx.h" #include "sys_ucode.h" #include "versions.h" #include "z64play.h" #include "z64save.h" +#include "global.h" + #include "assets/textures/icon_item_24_static/icon_item_24_static.h" #if OOT_NTSC #include "assets/textures/icon_item_jpn_static/icon_item_jpn_static.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c index c784ab0b4a..6264c4147c 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c @@ -1,5 +1,10 @@ #include "z_kaleido_scope.h" +#include "libu64/pad.h" +#include "regs.h" +#include "sfx.h" +#include "z64play.h" + static s16 sKaleidoPromptCursorAlphaVals[] = { 100, 255 }; void KaleidoScope_UpdatePrompt(PlayState* play) { diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index 634d7ed38b..5c0bfab0d3 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -1,13 +1,30 @@ #include "z_kaleido_scope.h" +#include "libc64/sleep.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "gfxalloc.h" +#include "map.h" #if PLATFORM_N64 #include "n64dd.h" #endif +#include "regs.h" +#include "segment_symbols.h" +#include "segmented_address.h" #include "seqcmd.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" #include "title_setup_state.h" #include "versions.h" +#include "z64audio.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" #include "z64save.h" +#include "global.h" + #include "assets/textures/icon_item_static/icon_item_static.h" #include "assets/textures/icon_item_24_static/icon_item_24_static.h" #if OOT_NTSC @@ -20,7 +37,7 @@ #endif #include "assets/textures/icon_item_gameover_static/icon_item_gameover_static.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 ntsc-1.0:0 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:0 pal-1.1:0" #if !PLATFORM_GC #define KALEIDO_PROMPT_CURSOR_R 100 diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h index c1e965c650..5a99234432 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h @@ -2,8 +2,11 @@ #define Z_KALEIDO_SCOPE_H #include "ultra64.h" -#include "global.h" +#include "gfx.h" #include "z64inventory.h" +#include "z64pause.h" + +struct PlayState; extern u8 gAmmoItems[]; extern s16 gVtxPageMapWorldQuadsWidth[]; @@ -166,26 +169,26 @@ typedef enum ItemQuad { /* 41 */ ITEM_QUAD_MAX } ItemQuad; -void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx); +void KaleidoScope_DrawQuestStatus(struct PlayState* play, GraphicsContext* gfxCtx); s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point); -void KaleidoScope_DrawDebugEditor(PlayState* play); -void KaleidoScope_DrawPlayerWork(PlayState* play); -void KaleidoScope_DrawEquipment(PlayState* play); +void KaleidoScope_DrawDebugEditor(struct PlayState* play); +void KaleidoScope_DrawPlayerWork(struct PlayState* play); +void KaleidoScope_DrawEquipment(struct PlayState* play); void KaleidoScope_SetCursorPos(PauseContext* pauseCtx, u16 index, Vtx* vtx); -void KaleidoScope_DrawItemSelect(PlayState* play); -void KaleidoScope_UpdateItemEquip(PlayState* play); -void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx); -void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx); -void KaleidoScope_UpdatePrompt(PlayState* play); +void KaleidoScope_DrawItemSelect(struct PlayState* play); +void KaleidoScope_UpdateItemEquip(struct PlayState* play); +void KaleidoScope_DrawDungeonMap(struct PlayState* play, GraphicsContext* gfxCtx); +void KaleidoScope_DrawWorldMap(struct PlayState* play, GraphicsContext* gfxCtx); +void KaleidoScope_UpdatePrompt(struct PlayState* play); Gfx* KaleidoScope_QuadTextureIA4(Gfx* gfx, void* texture, s16 width, s16 height, u16 point); Gfx* KaleidoScope_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, u16 point); -void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, u16 specialPos); +void KaleidoScope_MoveCursorToSpecialPos(struct PlayState* play, u16 specialPos); void KaleidoScope_DrawQuadTextureRGBA32(GraphicsContext* gfxCtx, void* texture, u16 width, u16 height, u16 point); void KaleidoScope_ProcessPlayerPreRender(); -void KaleidoScope_SetupPlayerPreRender(PlayState* play); -void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex); -void KaleidoScope_UpdateDungeonMap(PlayState* play); +void KaleidoScope_SetupPlayerPreRender(struct PlayState* play); +void KaleidoScope_DrawCursor(struct PlayState* play, u16 pageIndex); +void KaleidoScope_UpdateDungeonMap(struct PlayState* play); -void PauseMapMark_Draw(PlayState* play); +void PauseMapMark_Draw(struct PlayState* play); #endif diff --git a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c index 89283bfc16..126ceca4f1 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c @@ -1,7 +1,14 @@ #if PLATFORM_N64 #include "n64dd.h" #endif +#include "regs.h" +#include "sys_matrix.h" #include "z_kaleido_scope.h" +#include "z_lib.h" +#include "z64play.h" + +#include "global.h" + #include "assets/textures/parameter_static/parameter_static.h" typedef struct PauseMapMarkInfo {