summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
Diffstat (limited to 'src/code')
-rw-r--r--src/code/code_80069420.c2
-rw-r--r--src/code/fault.c4
-rw-r--r--src/code/fmodf.c2
-rw-r--r--src/code/fp_math.c (renamed from src/code/code_800FCE80.c)3
-rw-r--r--src/code/rand.c2
-rw-r--r--src/code/sys_math.c2
-rw-r--r--src/code/sys_math3d.c16
-rw-r--r--src/code/sys_math3d_draw.c7
-rw-r--r--src/code/sys_math_atan.c3
-rw-r--r--src/code/z_collision_check.c13
-rw-r--r--src/code/z_kankyo.c2
-rw-r--r--src/code/z_lib.c11
-rw-r--r--src/code/z_olib.c4
13 files changed, 40 insertions, 31 deletions
diff --git a/src/code/code_80069420.c b/src/code/code_80069420.c
index 6dd0a94f4..9a190edcf 100644
--- a/src/code/code_80069420.c
+++ b/src/code/code_80069420.c
@@ -1,4 +1,4 @@
-#include "global.h"
+#include "ultra64.h"
/**
* memcpy: copies `len` bytes from memory starting at `src` to memory starting at `dest`. Expects the memory
diff --git a/src/code/fault.c b/src/code/fault.c
index 662c1a9f1..7d8e62fef 100644
--- a/src/code/fault.c
+++ b/src/code/fault.c
@@ -48,9 +48,9 @@
// just above (the exact upper bound depends on the block numbers assigned to
// extern variables declared in headers).
#if OOT_DEBUG
-#pragma increment_block_number 20
+#pragma increment_block_number 0
#else
-#pragma increment_block_number 25
+#pragma increment_block_number 20
#endif
void FaultDrawer_Init(void);
diff --git a/src/code/fmodf.c b/src/code/fmodf.c
index e1e386223..4ebec43bd 100644
--- a/src/code/fmodf.c
+++ b/src/code/fmodf.c
@@ -1,4 +1,4 @@
-#include "global.h"
+#include "ultra64.h"
/**
* Computes one `x` modulo `y` for floats.
diff --git a/src/code/code_800FCE80.c b/src/code/fp_math.c
index 8ac46833d..c429b83e2 100644
--- a/src/code/code_800FCE80.c
+++ b/src/code/fp_math.c
@@ -1,4 +1,5 @@
-#include "global.h"
+#include "z64math.h"
+#include "macros.h"
s32 gUseAtanContFrac;
diff --git a/src/code/rand.c b/src/code/rand.c
index 4a0c5dc4a..baf396542 100644
--- a/src/code/rand.c
+++ b/src/code/rand.c
@@ -41,7 +41,7 @@
*
* @note Original name: qrand.c
*/
-#include "ultra64.h"
+#include "rand.h"
#define RAND_MULTIPLIER 1664525
#define RAND_INCREMENT 1013904223
diff --git a/src/code/sys_math.c b/src/code/sys_math.c
index f19719bb9..6a7344baa 100644
--- a/src/code/sys_math.c
+++ b/src/code/sys_math.c
@@ -1,4 +1,4 @@
-#include "global.h"
+#include "sys_math.h"
f32 sFactorialTbl[] = { 1.0f, 1.0f, 2.0f, 6.0f, 24.0f, 120.0f, 720.0f,
5040.0f, 40320.0f, 362880.0f, 3628800.0f, 39916800.0f, 479001600.0f };
diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c
index 6525f825d..f0bfb60bc 100644
--- a/src/code/sys_math3d.c
+++ b/src/code/sys_math3d.c
@@ -1,9 +1,13 @@
-#include "global.h"
+#include "ultra64.h"
+#include "z_lib.h"
+#include "z64math.h"
#include "terminal.h"
+#include "macros.h"
+#include "sys_math3d.h"
// For retail BSS ordering, the block number of cbf in Math3D_CylVsCylOverlapCenterDist
// must be 0.
-#pragma increment_block_number 187
+#pragma increment_block_number 114
s32 Math3D_LineVsLineClosestTwoPoints(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB,
Vec3f* lineAClosestToB, Vec3f* lineBClosestToA);
@@ -2147,11 +2151,3 @@ s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z) {
}
return false;
}
-
-#if OOT_DEBUG
-void Math3D_DrawSphere(PlayState* play, Sphere16* sph) {
-}
-
-void Math3D_DrawCylinder(PlayState* play, Cylinder16* cyl) {
-}
-#endif
diff --git a/src/code/sys_math3d_draw.c b/src/code/sys_math3d_draw.c
new file mode 100644
index 000000000..76651c825
--- /dev/null
+++ b/src/code/sys_math3d_draw.c
@@ -0,0 +1,7 @@
+#include "z64.h"
+
+void Math3D_DrawSphere(PlayState* play, Sphere16* sph) {
+}
+
+void Math3D_DrawCylinder(PlayState* play, Cylinder16* cyl) {
+}
diff --git a/src/code/sys_math_atan.c b/src/code/sys_math_atan.c
index efbe8a205..0647745b0 100644
--- a/src/code/sys_math_atan.c
+++ b/src/code/sys_math_atan.c
@@ -1,4 +1,5 @@
-#include "global.h"
+#include "z64math.h"
+#include "macros.h"
static u16 sAtan2Tbl[] = {
0x0000, 0x000A, 0x0014, 0x001F, 0x0029, 0x0033, 0x003D, 0x0047, 0x0051, 0x005C, 0x0066, 0x0070, 0x007A, 0x0084,
diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c
index 118a445d7..bebcac08d 100644
--- a/src/code/z_collision_check.c
+++ b/src/code/z_collision_check.c
@@ -2360,9 +2360,6 @@ void CollisionCheck_ATTrisVsACTris(PlayState* play, CollisionCheckContext* colCh
#if OOT_DEBUG
static s8 sBssDummy7;
-static s8 sBssDummy8;
-static s8 sBssDummy9;
-static s8 sBssDummy10;
#endif
void CollisionCheck_ATTrisVsACQuad(PlayState* play, CollisionCheckContext* colChkCtx, Collider* atCol,
@@ -3329,12 +3326,10 @@ void Collider_SetTrisDim(PlayState* play, ColliderTris* tris, s32 elemIndex, Col
}
#if OOT_DEBUG
-// Due to an unknown reason, bss ordering changed between the 2 static Vec3f variables in the function below.
-// In order to reproduce this behavior, we need a specific number of bss variables in the file before that point.
-// For this, we introduce a certain amount of dummy variables throughout the file, which we fit inside padding added
-// by the compiler between structs like TriNorm and/or Vec3f, so they don't take space in bss.
-static s8 sBssDummy11;
-static s8 sBssDummy12;
+// The two static Vec3f variables in the function below cross a block index rollover, causing a bss order swap.
+//! In order to replicate this behavior, we declare a certain amount of sBssDummy variables throughout the file, which
+//! we fit inside padding added by the compiler between structs like TriNorm and/or Vec3f, so they don't take space in
+//! bss.
#endif
/**
diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c
index ce79a7df9..aab406904 100644
--- a/src/code/z_kankyo.c
+++ b/src/code/z_kankyo.c
@@ -215,7 +215,7 @@ s16 sSunDepthTestY;
// These variables could be moved farther down in the file to reduce the amount
// of block number padding here, but currently this causes BSS ordering issues
// for debug.
-#pragma increment_block_number 230
+#pragma increment_block_number 227
LightNode* sNGameOverLightNode;
LightInfo sNGameOverLightInfo;
diff --git a/src/code/z_lib.c b/src/code/z_lib.c
index 58a291162..5eba9346f 100644
--- a/src/code/z_lib.c
+++ b/src/code/z_lib.c
@@ -1,4 +1,11 @@
-#include "global.h"
+#include "ultra64.h"
+#include "z_lib.h"
+#include "ichain.h"
+#include "regs.h"
+#include "macros.h"
+#include "sys_math.h"
+#include "rand.h"
+#include "sfx.h"
/**
* memset: sets `len` bytes to `val` starting at address `dest`.
@@ -334,7 +341,7 @@ void (*sInitChainHandlers[])(u8* ptr, InitChainEntry* ichain) = {
IChain_Apply_Vec3f, IChain_Apply_Vec3fdiv1000, IChain_Apply_Vec3s,
};
-void Actor_ProcessInitChain(Actor* actor, InitChainEntry* ichain) {
+void Actor_ProcessInitChain(struct Actor* actor, InitChainEntry* ichain) {
do {
sInitChainHandlers[ichain->type]((u8*)actor, ichain);
} while ((ichain++)->cont);
diff --git a/src/code/z_olib.c b/src/code/z_olib.c
index d5056e8f7..c1f93a052 100644
--- a/src/code/z_olib.c
+++ b/src/code/z_olib.c
@@ -1,4 +1,6 @@
-#include "global.h"
+#include "z64math.h"
+#include "fp_math.h"
+#include "z_lib.h"
/**
* Calculates the distances between `a` and `b`