summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authormzxrules <mzxrules@gmail.com>2025-02-19 05:54:39 -0500
committerGitHub <noreply@github.com>2025-02-19 05:54:39 -0500
commit981af4b6af34cdd9e4f55f8f9f4fce803600fa62 (patch)
treeb8be209d7db0077a326ecdbdad140b6b9aab2bf8 /src/code
parent3d61fb85efa13203db2e4888c9e892833a164277 (diff)
Reduce overlay dependencies on global.h (8) (#2478)
* move variables into z64environment.h * z_room.h * z64sram.h, z64ss_sram.h, z64font.h, kanread.h * z64lifemeter.h, z64debug.h, debug_arena.h * buffers.h * remove z_bgcheck global * gamealloc.h * suggestions * .bdd
Diffstat (limited to 'src/code')
-rw-r--r--src/code/db_camera.c3
-rw-r--r--src/code/debug_malloc.c4
-rw-r--r--src/code/game.c23
-rw-r--r--src/code/gamealloc.c6
-rw-r--r--src/code/graph.c1
-rw-r--r--src/code/main.c7
-rw-r--r--src/code/sched.c7
-rw-r--r--src/code/sys_math3d_draw.c3
-rw-r--r--src/code/z_bgcheck.c15
-rw-r--r--src/code/z_camera.c3
-rw-r--r--src/code/z_collision_check.c2
-rw-r--r--src/code/z_construct.c4
-rw-r--r--src/code/z_debug.c1
-rw-r--r--src/code/z_kanfont.c8
-rw-r--r--src/code/z_kankyo.c25
-rw-r--r--src/code/z_lifemeter.c3
-rw-r--r--src/code/z_lights.c8
-rw-r--r--src/code/z_map_mark.c1
-rw-r--r--src/code/z_parameter.c1
-rw-r--r--src/code/z_play.c3
-rw-r--r--src/code/z_rcp.c8
-rw-r--r--src/code/z_room.c4
-rw-r--r--src/code/z_scene_table.c2
-rw-r--r--src/code/z_sram.c1
-rw-r--r--src/code/z_ss_sram.c2
25 files changed, 116 insertions, 29 deletions
diff --git a/src/code/db_camera.c b/src/code/db_camera.c
index bc9fa468c..5b997b490 100644
--- a/src/code/db_camera.c
+++ b/src/code/db_camera.c
@@ -1,7 +1,7 @@
-#include "global.h"
#include "libu64/gfxprint.h"
#include "attributes.h"
#include "controller.h"
+#include "debug_arena.h"
#include "letterbox.h"
#include "mempak.h"
#include "regs.h"
@@ -10,6 +10,7 @@
#include "z64camera.h"
#include "z64cutscene.h"
#include "z64cutscene_spline.h"
+#include "z64debug.h"
#include "z64debug_display.h"
#include "z64olib.h"
#include "z64play.h"
diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c
index b6aa81b32..acfca47ca 100644
--- a/src/code/debug_malloc.c
+++ b/src/code/debug_malloc.c
@@ -1,5 +1,7 @@
-#include "global.h"
#include "libc64/os_malloc.h"
+#include "debug_arena.h"
+
+#include "macros.h"
#define LOG_SEVERITY_NOLOG 0
#define LOG_SEVERITY_ERROR 2
diff --git a/src/code/game.c b/src/code/game.c
index 436783952..2e9e9e2d5 100644
--- a/src/code/game.c
+++ b/src/code/game.c
@@ -1,12 +1,29 @@
-#include "global.h"
+#include "libu64/debug.h"
+#include "libu64/gfxprint.h"
+#include "audiomgr.h"
+#include "buffers.h"
+#include "controller.h"
+#include "debug_arena.h"
+#include "gfx.h"
+#include "gfxalloc.h"
#include "fault.h"
#include "libc64/os_malloc.h"
-#include "terminal.h"
-#include "versions.h"
#include "line_numbers.h"
#if PLATFORM_N64
#include "n64dd.h"
#endif
+#include "padmgr.h"
+#include "regs.h"
+#include "rumble.h"
+#include "speed_meter.h"
+#include "terminal.h"
+#include "versions.h"
+#include "z64debug.h"
+#include "z64game.h"
+#include "z64vis.h"
+
+#include "macros.h"
+#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"
diff --git a/src/code/gamealloc.c b/src/code/gamealloc.c
index d625bc65f..47591fd00 100644
--- a/src/code/gamealloc.c
+++ b/src/code/gamealloc.c
@@ -1,4 +1,8 @@
-#include "global.h"
+#include "libc64/malloc.h"
+#include "libu64/debug.h"
+#include "gamealloc.h"
+
+#include "macros.h"
void GameAlloc_Log(GameAlloc* this) {
GameAllocEntry* iter;
diff --git a/src/code/graph.c b/src/code/graph.c
index dfa1dc2f2..650b7dd2e 100644
--- a/src/code/graph.c
+++ b/src/code/graph.c
@@ -1,6 +1,7 @@
#include "libc64/malloc.h"
#include "libc64/sprintf.h"
#include "libu64/debug.h"
+#include "buffers.h"
#include "gfx.h"
#include "fault.h"
#include "line_numbers.h"
diff --git a/src/code/main.c b/src/code/main.c
index 4a55baf43..f93062501 100644
--- a/src/code/main.c
+++ b/src/code/main.c
@@ -12,7 +12,7 @@ extern struct Scheduler gScheduler;
extern struct PadMgr gPadMgr;
extern struct IrqMgr gIrqMgr;
-#include "global.h"
+#include "debug_arena.h"
#include "fault.h"
#include "segmented_address.h"
#include "stack.h"
@@ -22,10 +22,13 @@ extern struct IrqMgr gIrqMgr;
#include "cic6105.h"
#include "n64dd.h"
#endif
+#include "z64debug.h"
#include "z64thread.h"
+#include "global.h"
+
#pragma increment_block_number "gc-eu:96 gc-eu-mq:96 gc-jp:96 gc-jp-ce:96 gc-jp-mq:96 gc-us:96 gc-us-mq:96 ique-cn:96" \
- "ntsc-1.0:78 ntsc-1.1:78 ntsc-1.2:78 pal-1.0:76 pal-1.1:76"
+ "ntsc-1.0:79 ntsc-1.1:79 ntsc-1.2:79 pal-1.0:77 pal-1.1:77"
extern u8 _buffersSegmentEnd[];
diff --git a/src/code/sched.c b/src/code/sched.c
index 3c4199aef..57eae6950 100644
--- a/src/code/sched.c
+++ b/src/code/sched.c
@@ -39,11 +39,16 @@
*
* @see irqmgr.c
*/
-#include "global.h"
+#include "libu64/debug.h"
#include "fault.h"
+#include "irqmgr.h"
+#include "regs.h"
+#include "sched.h"
#include "versions.h"
#include "z64thread.h"
+#include "global.h"
+
#define RSP_DONE_MSG 667
#define RDP_DONE_MSG 668
#define NOTIFY_MSG 670 // original name: ENTRY_MSG
diff --git a/src/code/sys_math3d_draw.c b/src/code/sys_math3d_draw.c
index 76651c825..7781a79e2 100644
--- a/src/code/sys_math3d_draw.c
+++ b/src/code/sys_math3d_draw.c
@@ -1,4 +1,5 @@
-#include "z64.h"
+#include "sys_math3d.h"
+#include "z64play.h"
void Math3D_DrawSphere(PlayState* play, Sphere16* sph) {
}
diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c
index f89840fb6..c5d22fd6a 100644
--- a/src/code/z_bgcheck.c
+++ b/src/code/z_bgcheck.c
@@ -1,8 +1,17 @@
-#include "global.h"
-#include "terminal.h"
+#include "libu64/debug.h"
+#include "attributes.h"
#include "line_numbers.h"
+#include "regs.h"
+#include "segmented_address.h"
+#include "sys_math3d.h"
+#include "terminal.h"
+#include "z_lib.h"
+#include "z64bgcheck.h"
+#include "z64play.h"
+#include "z64player.h"
+#include "z64skin_matrix.h"
-#pragma increment_block_number "ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64"
+#pragma increment_block_number "ntsc-1.0:184 ntsc-1.1:184 ntsc-1.2:184"
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 21ba635c8..a5a18c29c 100644
--- a/src/code/z_camera.c
+++ b/src/code/z_camera.c
@@ -2,6 +2,7 @@
#include "quake.h"
#include "terminal.h"
#include "z64cutscene_spline.h"
+#include "z64debug.h"
#include "z64olib.h"
#include "z64save.h"
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
@@ -3641,7 +3642,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:117 ntsc-1.1:117 ntsc-1.2:117 pal-1.0:115 pal-1.1:115"
+ "ique-cn:128 ntsc-1.0:118 ntsc-1.1:118 ntsc-1.2:118 pal-1.0:116 pal-1.1:116"
s32 Camera_KeepOn4(Camera* camera) {
static Vec3f D_8015BD50;
diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c
index e05bb44d1..5564b7ef3 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:248 ntsc-1.1:248 ntsc-1.2:248 pal-1.0:248 pal-1.1:248"
+#pragma increment_block_number "ique-cn:0 ntsc-1.0:232 ntsc-1.1:232 ntsc-1.2:232 pal-1.0:232 pal-1.1:232"
typedef s32 (*ColChkResetFunc)(PlayState*, Collider*);
typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*);
diff --git a/src/code/z_construct.c b/src/code/z_construct.c
index dacec26d9..4696cb76e 100644
--- a/src/code/z_construct.c
+++ b/src/code/z_construct.c
@@ -1,7 +1,9 @@
-#include "global.h"
#include "map.h"
#include "regs.h"
+#include "segment_symbols.h"
#include "versions.h"
+#include "z64lifemeter.h"
+#include "z64interface.h"
#include "z64ocarina.h"
#include "z64play.h"
#include "z64save.h"
diff --git a/src/code/z_debug.c b/src/code/z_debug.c
index 70d108e16..ed02754fc 100644
--- a/src/code/z_debug.c
+++ b/src/code/z_debug.c
@@ -8,6 +8,7 @@
#include "regs.h"
#include "rumble.h"
#include "ultra64.h"
+#include "z64debug.h"
#include "macros.h"
diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c
index fa038276f..21ba416b3 100644
--- a/src/code/z_kanfont.c
+++ b/src/code/z_kanfont.c
@@ -1,6 +1,12 @@
-#include "global.h"
+#include "kanread.h"
#include "message_data_static.h"
+#include "segment_symbols.h"
#include "versions.h"
+#include "z64dma.h"
+#include "z64font.h"
+#include "z64message.h"
+
+#include "macros.h"
/**
* Loads a texture from kanji for the requested `character` into the character texture buffer
diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c
index 8e835bdd4..3656d7179 100644
--- a/src/code/z_kankyo.c
+++ b/src/code/z_kankyo.c
@@ -1,15 +1,32 @@
#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"
-#include "global.h"
+#include "libc64/qrand.h"
+#include "libu64/gfxprint.h"
+#include "buffers.h"
+#include "gfx.h"
+#include "gfx_setupdl.h"
+#include "gfxalloc.h"
#include "ultra64.h"
+#include "regs.h"
+#include "rumble.h"
+#include "segment_symbols.h"
+#include "segmented_address.h"
#include "seqcmd.h"
#include "sequence.h"
+#include "sfx.h"
+#include "sys_math.h"
+#include "sys_math3d.h"
+#include "sys_matrix.h"
#include "terminal.h"
#include "versions.h"
-
+#include "z_lib.h"
+#include "z64audio.h"
#include "z64cutscene.h"
#include "z64frame_advance.h"
+#include "z64environment.h"
+#include "z64play.h"
+#include "z64player.h"
#include "z64save.h"
#include "assets/objects/gameplay_keep/gameplay_keep.h"
@@ -218,8 +235,8 @@ s16 sLightningFlashAlpha;
s16 sSunDepthTestX;
s16 sSunDepthTestY;
-#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:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
+#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:192 pal-1.1:192"
LightNode* sNGameOverLightNode;
LightInfo sNGameOverLightInfo;
diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c
index 1395580d0..cab9737ff 100644
--- a/src/code/z_lifemeter.c
+++ b/src/code/z_lifemeter.c
@@ -3,12 +3,11 @@
#include "sfx.h"
#include "sys_matrix.h"
#include "z_lib.h"
+#include "z64lifemeter.h"
#include "z64play.h"
#include "z64player.h"
#include "z64save.h"
-#include "global.h"
-
#include "assets/textures/parameter_static/parameter_static.h"
static s16 sHeartsPrimColors[3][3] = {
diff --git a/src/code/z_lights.c b/src/code/z_lights.c
index 5ee208f70..e9f533850 100644
--- a/src/code/z_lights.c
+++ b/src/code/z_lights.c
@@ -1,4 +1,10 @@
-#include "global.h"
+#include "buffers.h"
+#include "gfx.h"
+#include "gfx_setupdl.h"
+#include "sys_matrix.h"
+#include "z64light.h"
+#include "z64play.h"
+
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#define LIGHTS_BUFFER_SIZE 32
diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c
index 72d245ce8..79e4f97ca 100644
--- a/src/code/z_map_mark.c
+++ b/src/code/z_map_mark.c
@@ -1,4 +1,5 @@
#include "libu64/debug.h"
+#include "regs.h"
#include "romfile.h"
#include "segment_symbols.h"
#include "terminal.h"
diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c
index 1a25f6751..2c9b21950 100644
--- a/src/code/z_parameter.c
+++ b/src/code/z_parameter.c
@@ -13,6 +13,7 @@
#include "terminal.h"
#include "versions.h"
#include "z64audio.h"
+#include "z64lifemeter.h"
#include "z64horse.h"
#include "z64ocarina.h"
#include "z64play.h"
diff --git a/src/code/z_play.c b/src/code/z_play.c
index 4e724601f..1e47fab38 100644
--- a/src/code/z_play.c
+++ b/src/code/z_play.c
@@ -1,4 +1,5 @@
#include "libu64/debug.h"
+#include "buffers.h"
#include "controller.h"
#include "fault.h"
#include "gfx.h"
@@ -33,7 +34,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" \
- "ique-cn:192 ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:64 pal-1.1:64"
+ "ique-cn:192 ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:96 pal-1.0:96 pal-1.1:96"
TransitionTile gTransitionTile;
s32 gTransitionTileState;
diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c
index 8f0f61ed3..eb9790a6e 100644
--- a/src/code/z_rcp.c
+++ b/src/code/z_rcp.c
@@ -1,3 +1,11 @@
+#include "buffers.h"
+#include "gfx.h"
+#include "gfx_setupdl.h"
+#include "gfxalloc.h"
+#include "letterbox.h"
+#include "regs.h"
+#include "z64play.h"
+
#include "global.h"
Gfx sSetupDL[SETUPDL_MAX][6] = {
diff --git a/src/code/z_room.c b/src/code/z_room.c
index ce8f452f9..a9daab204 100644
--- a/src/code/z_room.c
+++ b/src/code/z_room.c
@@ -1,5 +1,6 @@
#include "libu64/debug.h"
#include "ultra64/gs2dex.h"
+#include "buffers.h"
#include "fault.h"
#include "gfx.h"
#include "gfx_setupdl.h"
@@ -18,11 +19,10 @@
#include "z64audio.h"
#include "z64play.h"
#include "z64player.h"
+#include "z64room.h"
#include "z64save.h"
#include "z64skin_matrix.h"
-#include "global.h"
-
Vec3f D_801270A0 = { 0.0f, 0.0f, 0.0f };
// unused
diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c
index 8b4a57e89..5e096a262 100644
--- a/src/code/z_scene_table.c
+++ b/src/code/z_scene_table.c
@@ -16,8 +16,6 @@
#include "z64player.h"
#include "z64save.h"
-#include "global.h"
-
#include "assets/scenes/indoors/miharigoya/miharigoya_scene.h"
#include "assets/scenes/indoors/souko/souko_scene.h"
diff --git a/src/code/z_sram.c b/src/code/z_sram.c
index ab25ffeb2..c78c7ae25 100644
--- a/src/code/z_sram.c
+++ b/src/code/z_sram.c
@@ -2,6 +2,7 @@
#include "terminal.h"
#include "versions.h"
#include "z64save.h"
+#include "z64ss_sram.h"
#define SLOT_SIZE (sizeof(SaveContext) + 0x28)
#define CHECKSUM_SIZE (sizeof(Save) / 2)
diff --git a/src/code/z_ss_sram.c b/src/code/z_ss_sram.c
index dd26d695c..c2b7e2d34 100644
--- a/src/code/z_ss_sram.c
+++ b/src/code/z_ss_sram.c
@@ -1,4 +1,6 @@
#include "ultra64.h"
+
+#include "macros.h"
#include "global.h"
typedef struct SsSramContext {