summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorRandom <28494085+Random06457@users.noreply.github.com>2020-10-03 17:22:44 +0200
committerGitHub <noreply@github.com>2020-10-03 11:22:44 -0400
commit174af7384d1cfcbf15da02d9069bf02bdc433c20 (patch)
treee4fb18346f71047c123ec4d34a80ae7e4d8ab9ea /src/code
parent6136ee6debd570a63fc695a6f4664553303f2324 (diff)
libultra cleanup (#215)
* cleanup libultra * fixes - use quotes instead of <> for includes - add macros for zelda specific thread priorities - fix Makefile - properly format the remaining pfs structs * fix button macros + add CHECK_BTN_ANY/CHECK_BTN_ALL * remove ULTRA_ABS * fix includes * update z_player.c/z_lib.c + run format.sh * merge upstream/master * fix include in En_Goroiwa * fix includes
Diffstat (limited to 'src/code')
-rw-r--r--src/code/PreRender.c2
-rw-r--r--src/code/TwoHeadArena.c2
-rw-r--r--src/code/__osMalloc.c4
-rw-r--r--src/code/audioMgr.c5
-rw-r--r--src/code/audio_effects.c4
-rw-r--r--src/code/audio_heap.c4
-rw-r--r--src/code/audio_playback.c3
-rw-r--r--src/code/audio_seqplayer.c4
-rw-r--r--src/code/code_800430A0.c3
-rw-r--r--src/code/code_80043480.c3
-rw-r--r--src/code/code_80069420.c3
-rw-r--r--src/code/code_8006BA00.c3
-rw-r--r--src/code/code_8006C3A0.c3
-rw-r--r--src/code/code_8006C510.c3
-rw-r--r--src/code/code_8008E6A0.c10
-rw-r--r--src/code/code_80097A00.c3
-rw-r--r--src/code/code_800A9D40.c3
-rw-r--r--src/code/code_800A9F30.c3
-rw-r--r--src/code/code_800ACE70.c2
-rw-r--r--src/code/code_800AD920.c2
-rw-r--r--src/code/code_800BB0A0.c2
-rw-r--r--src/code/code_800C3C20.c2
-rw-r--r--src/code/code_800D2E30.c3
-rw-r--r--src/code/code_800D31A0.c4
-rw-r--r--src/code/code_800DACC0.c4
-rw-r--r--src/code/code_800E11F0.c4
-rw-r--r--src/code/code_800EC960.c4
-rw-r--r--src/code/code_800F7260.c4
-rw-r--r--src/code/code_800F9280.c4
-rw-r--r--src/code/code_800FBCE0.c2
-rw-r--r--src/code/code_800FC620.c2
-rw-r--r--src/code/code_800FCE80.c5
-rw-r--r--src/code/code_800FD970.c3
-rw-r--r--src/code/code_801067F0.c3
-rw-r--r--src/code/code_80106860.c3
-rw-r--r--src/code/code_801068B0.c3
-rw-r--r--src/code/code_80110450.c3
-rw-r--r--src/code/db_camera.c3
-rw-r--r--src/code/debug_malloc.c2
-rw-r--r--src/code/fault.c87
-rw-r--r--src/code/fault_drawer.c5
-rw-r--r--src/code/flg_set.c23
-rw-r--r--src/code/game.c26
-rw-r--r--src/code/gamealloc.c2
-rw-r--r--src/code/gfxprint.c3
-rw-r--r--src/code/graph.c10
-rw-r--r--src/code/irqmgr.c8
-rw-r--r--src/code/jpegdecoder.c2
-rw-r--r--src/code/jpegutils.c2
-rw-r--r--src/code/listalloc.c2
-rw-r--r--src/code/loadfragment2.c2
-rw-r--r--src/code/logseverity.c2
-rw-r--r--src/code/main.c18
-rw-r--r--src/code/mempak.c2
-rw-r--r--src/code/mtxuty-cvt.c2
-rw-r--r--src/code/padmgr.c42
-rw-r--r--src/code/padsetup.c2
-rw-r--r--src/code/padutils.c30
-rw-r--r--src/code/printutils.c2
-rw-r--r--src/code/relocation.c2
-rw-r--r--src/code/sched.c5
-rw-r--r--src/code/shrink_window.c2
-rw-r--r--src/code/sleep.c2
-rw-r--r--src/code/speed_meter.c5
-rw-r--r--src/code/sys_cfb.c2
-rw-r--r--src/code/sys_math.c4
-rw-r--r--src/code/sys_math3d.c5
-rw-r--r--src/code/sys_math_atan.c3
-rw-r--r--src/code/sys_matrix.c3
-rw-r--r--src/code/sys_ucode.c2
-rw-r--r--src/code/system_malloc.c2
-rw-r--r--src/code/title_setup.c2
-rw-r--r--src/code/ucode_disas.c2
-rw-r--r--src/code/z_DLF.c5
-rw-r--r--src/code/z_actor.c7
-rw-r--r--src/code/z_actor_dlftbls.c5
-rw-r--r--src/code/z_bgcheck.c19
-rw-r--r--src/code/z_camera.c13
-rw-r--r--src/code/z_cheap_proc.c3
-rw-r--r--src/code/z_collision_btltbls.c3
-rw-r--r--src/code/z_collision_check.c16
-rw-r--r--src/code/z_common_data.c3
-rw-r--r--src/code/z_construct.c3
-rw-r--r--src/code/z_debug.c55
-rw-r--r--src/code/z_debug_display.c3
-rw-r--r--src/code/z_demo.c20
-rw-r--r--src/code/z_draw.c3
-rw-r--r--src/code/z_eff_blure.c3
-rw-r--r--src/code/z_eff_shield_particle.c5
-rw-r--r--src/code/z_eff_spark.c3
-rw-r--r--src/code/z_eff_ss_dead.c3
-rw-r--r--src/code/z_effect.c3
-rw-r--r--src/code/z_effect_soft_sprite.c5
-rw-r--r--src/code/z_effect_soft_sprite_dlftbls.c5
-rw-r--r--src/code/z_effect_soft_sprite_old_init.c3
-rw-r--r--src/code/z_elf_message.c3
-rw-r--r--src/code/z_en_a_keep.c4
-rw-r--r--src/code/z_en_item00.c3
-rw-r--r--src/code/z_face_reaction.c3
-rw-r--r--src/code/z_fbdemo.c3
-rw-r--r--src/code/z_fbdemo_circle.c2
-rw-r--r--src/code/z_fbdemo_fade.c4
-rw-r--r--src/code/z_fbdemo_triforce.c2
-rw-r--r--src/code/z_fbdemo_wipe1.c2
-rw-r--r--src/code/z_fcurve_data_skelanime.c3
-rw-r--r--src/code/z_game_dlftbls.c2
-rw-r--r--src/code/z_horse.c5
-rw-r--r--src/code/z_jpeg.c5
-rw-r--r--src/code/z_kaleido_manager.c4
-rw-r--r--src/code/z_kaleido_scope_call.c6
-rw-r--r--src/code/z_kaleido_setup.c6
-rw-r--r--src/code/z_kanfont.c3
-rw-r--r--src/code/z_kankyo.c3
-rw-r--r--src/code/z_lib.c7
-rw-r--r--src/code/z_lifemeter.c3
-rw-r--r--src/code/z_lights.c3
-rw-r--r--src/code/z_malloc.c2
-rw-r--r--src/code/z_map_data.c2
-rw-r--r--src/code/z_map_exp.c9
-rw-r--r--src/code/z_map_mark.c5
-rw-r--r--src/code/z_message_PAL.c3
-rw-r--r--src/code/z_moji.c3
-rw-r--r--src/code/z_msgevent.c3
-rw-r--r--src/code/z_olib.c3
-rw-r--r--src/code/z_onepointdemo.c3
-rw-r--r--src/code/z_parameter.c12
-rw-r--r--src/code/z_path.c3
-rw-r--r--src/code/z_play.c7
-rw-r--r--src/code/z_player_call.c2
-rw-r--r--src/code/z_player_lib.c3
-rw-r--r--src/code/z_prenmi.c5
-rw-r--r--src/code/z_prenmi_buff.c3
-rw-r--r--src/code/z_quake.c4
-rw-r--r--src/code/z_rcp.c3
-rw-r--r--src/code/z_room.c5
-rw-r--r--src/code/z_sample.c6
-rw-r--r--src/code/z_scene.c5
-rw-r--r--src/code/z_scene_table.c3
-rw-r--r--src/code/z_skelanime.c5
-rw-r--r--src/code/z_skin.c3
-rw-r--r--src/code/z_skin_awb.c3
-rw-r--r--src/code/z_skin_matrix.c5
-rw-r--r--src/code/z_sram.c3
-rw-r--r--src/code/z_view.c7
-rw-r--r--src/code/z_vimode.c3
-rw-r--r--src/code/z_vismono.c3
-rw-r--r--src/code/z_vr_box.c3
-rw-r--r--src/code/z_vr_box_draw.c2
148 files changed, 372 insertions, 465 deletions
diff --git a/src/code/PreRender.c b/src/code/PreRender.c
index c0d0eb923..94afbafb7 100644
--- a/src/code/PreRender.c
+++ b/src/code/PreRender.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
void PreRender_SetValuesSave(PreRenderContext* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg) {
this->widthSave = width;
diff --git a/src/code/TwoHeadArena.c b/src/code/TwoHeadArena.c
index 23cfa00f8..fa2a6aafd 100644
--- a/src/code/TwoHeadArena.c
+++ b/src/code/TwoHeadArena.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, u32 size) {
THA_Ct((TwoHeadArena*)thga, start, size);
diff --git a/src/code/__osMalloc.c b/src/code/__osMalloc.c
index 6b4d84eaf..5a304171b 100644
--- a/src/code/__osMalloc.c
+++ b/src/code/__osMalloc.c
@@ -1,5 +1,5 @@
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
#define FILL_ALLOCBLOCK (1 << 0)
#define FILL_FREEBLOCK (1 << 1)
diff --git a/src/code/audioMgr.c b/src/code/audioMgr.c
index cdec774cb..2d3a12248 100644
--- a/src/code/audioMgr.c
+++ b/src/code/audioMgr.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void func_800C3C80(AudioMgr* audioMgr) {
Sub_AudioMgr_18* sub;
@@ -91,7 +90,7 @@ void AudioMgr_Unlock(AudioMgr* audioMgr) {
osRecvMesg(&audioMgr->unk_C8, NULL, OS_MESG_BLOCK);
}
-void AudioMgr_Start(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedContext* sched, IrqMgr* irqMgr) {
+void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedContext* sched, IrqMgr* irqMgr) {
bzero(audioMgr, sizeof(AudioMgr));
audioMgr->sched = sched;
diff --git a/src/code/audio_effects.c b/src/code/audio_effects.c
index 41f727771..45d267fb0 100644
--- a/src/code/audio_effects.c
+++ b/src/code/audio_effects.c
@@ -1,5 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
+#include "ultra64.h"
+#include "global.h"
void Audio_SequenceChannelProcessSound(SequenceChannel* seqChannel, s32 recalculateVolume, s32 b) {
f32 channelVolume;
diff --git a/src/code/audio_heap.c b/src/code/audio_heap.c
index 974f5eb56..9ecc9d29c 100644
--- a/src/code/audio_heap.c
+++ b/src/code/audio_heap.c
@@ -1,5 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
+#include "ultra64.h"
+#include "global.h"
f32 func_800DDE20(f32 arg0) {
return 256.0f * gAudioContext.gAudioBufferParameters.unkUpdatesPerFrameScaled / arg0;
diff --git a/src/code/audio_playback.c b/src/code/audio_playback.c
index d5e71ff9c..e79e9e06b 100644
--- a/src/code/audio_playback.c
+++ b/src/code/audio_playback.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void Audio_NoteSetVelPanReverb(Note* note, NoteSubEu* sub, Reverb* reverb) {
f32 volRight, volLeft;
diff --git a/src/code/audio_seqplayer.c b/src/code/audio_seqplayer.c
index 0092249b2..dc13c246d 100644
--- a/src/code/audio_seqplayer.c
+++ b/src/code/audio_seqplayer.c
@@ -1,5 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
+#include "ultra64.h"
+#include "global.h"
#define PORTAMENTO_IS_SPECIAL(x) ((x).mode & 0x80)
#define PORTAMENTO_MODE(x) ((x).mode & ~0x80)
diff --git a/src/code/code_800430A0.c b/src/code/code_800430A0.c
index 0c15155b8..29eaae1e1 100644
--- a/src/code/code_800430A0.c
+++ b/src/code/code_800430A0.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800430A0/func_800430A0.s")
diff --git a/src/code/code_80043480.c b/src/code/code_80043480.c
index ddd8d0e99..54f422a6f 100644
--- a/src/code/code_80043480.c
+++ b/src/code/code_80043480.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void DynaPolyInfo_SetActorMove(DynaPolyActor* dynaActor, DynaPolyMoveFlag flags) {
dynaActor->dynaPolyId = -1;
diff --git a/src/code/code_80069420.c b/src/code/code_80069420.c
index ee9a179d7..3d656cfb0 100644
--- a/src/code/code_80069420.c
+++ b/src/code/code_80069420.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void* MemCopy(void* dest, void* src, s32 size) {
u8* destu = (u8*)dest;
diff --git a/src/code/code_8006BA00.c b/src/code/code_8006BA00.c
index ee5677ad3..768ece14f 100644
--- a/src/code/code_8006BA00.c
+++ b/src/code/code_8006BA00.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void func_8006BA00(GlobalContext* globalCtx) {
SoundSource* sources = &globalCtx->soundSources[0];
diff --git a/src/code/code_8006C3A0.c b/src/code/code_8006C3A0.c
index 789869598..341a44595 100644
--- a/src/code/code_8006C3A0.c
+++ b/src/code/code_8006C3A0.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void Flags_UnsetAllEnv(GlobalContext* globalCtx) {
u8 i;
diff --git a/src/code/code_8006C510.c b/src/code/code_8006C510.c
index 8e9f28322..833009e81 100644
--- a/src/code/code_8006C510.c
+++ b/src/code/code_8006C510.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
f32 func_8006C510(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5) {
char pad[0x1C];
diff --git a/src/code/code_8008E6A0.c b/src/code/code_8008E6A0.c
index 6a1fe8c31..47d437e98 100644
--- a/src/code/code_8008E6A0.c
+++ b/src/code/code_8008E6A0.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
void func_8008E6A0(SubGlobalContext7B8* this) {
this->counter = 0;
@@ -6,20 +6,20 @@ void func_8008E6A0(SubGlobalContext7B8* this) {
}
u32 func_8008E6AC(SubGlobalContext7B8* this, Input* input) {
- if (CHECK_PAD(input->cur, R_TRIG) && CHECK_PAD(input->press, D_JPAD)) {
+ if (CHECK_BTN_ALL(input->cur.button, BTN_R) && CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
this->toggle = !this->toggle;
}
if (!this->toggle) {
goto ret_true;
}
- if (CHECK_PAD(input->cur, Z_TRIG)) {
+ if (CHECK_BTN_ALL(input->cur.button, BTN_Z)) {
- if (CHECK_PAD(input->press, R_TRIG)) {
+ if (CHECK_BTN_ALL(input->press.button, BTN_R)) {
goto ret_true;
}
- if (CHECK_PAD(input->cur, R_TRIG)) {
+ if (CHECK_BTN_ALL(input->cur.button, BTN_R)) {
this->counter++;
if (this->counter >= 9) {
goto ret_true;
diff --git a/src/code/code_80097A00.c b/src/code/code_80097A00.c
index 882d422d1..b61559de6 100644
--- a/src/code/code_80097A00.c
+++ b/src/code/code_80097A00.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
// Bit Flag array in which gBitFlags[n] is literally (1 << n)
u32 gBitFlags[] = {
diff --git a/src/code/code_800A9D40.c b/src/code/code_800A9D40.c
index c32d31d4e..17660b74e 100644
--- a/src/code/code_800A9D40.c
+++ b/src/code/code_800A9D40.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
typedef struct {
/* 0x00 */ OSPiHandle piHandle;
diff --git a/src/code/code_800A9F30.c b/src/code/code_800A9F30.c
index f7d16a56a..fd8d220e2 100644
--- a/src/code/code_800A9F30.c
+++ b/src/code/code_800A9F30.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
UnkRumbleStruct D_80160FD0;
diff --git a/src/code/code_800ACE70.c b/src/code/code_800ACE70.c
index ebb93da34..88e86014a 100644
--- a/src/code/code_800ACE70.c
+++ b/src/code/code_800ACE70.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
// Note : This file is related to z_vismono, the original name was probably z_vis<something before "mono"
// alphabetically>
diff --git a/src/code/code_800AD920.c b/src/code/code_800AD920.c
index 512396006..2fbd7c452 100644
--- a/src/code/code_800AD920.c
+++ b/src/code/code_800AD920.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
// Note : This file is related to z_vismono, the original name was probably z_vis<something after "mono" alphabetically>
diff --git a/src/code/code_800BB0A0.c b/src/code/code_800BB0A0.c
index f5e8a2170..8d9f37b4a 100644
--- a/src/code/code_800BB0A0.c
+++ b/src/code/code_800BB0A0.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800BB0A0/func_800BB0A0.s")
diff --git a/src/code/code_800C3C20.c b/src/code/code_800C3C20.c
index 714de7254..bfe37bdfb 100644
--- a/src/code/code_800C3C20.c
+++ b/src/code/code_800C3C20.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
u8 D_8012D200[] = {
0, 1, 2, 3, 4, 5, 6,
diff --git a/src/code/code_800D2E30.c b/src/code/code_800D2E30.c
index e7e67f0a0..ebf03760e 100644
--- a/src/code/code_800D2E30.c
+++ b/src/code/code_800D2E30.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void func_800D2E30(UnkRumbleStruct* arg0) {
s32 i;
diff --git a/src/code/code_800D31A0.c b/src/code/code_800D31A0.c
index ec5b7a9b0..4f6b9f8c0 100644
--- a/src/code/code_800D31A0.c
+++ b/src/code/code_800D31A0.c
@@ -1,5 +1,5 @@
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
extern PadMgr gPadMgr;
diff --git a/src/code/code_800DACC0.c b/src/code/code_800DACC0.c
index 05fe08763..10ebbce75 100644
--- a/src/code/code_800DACC0.c
+++ b/src/code/code_800DACC0.c
@@ -1,5 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
+#include "ultra64.h"
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800DACC0/pad_800DACB0.s")
diff --git a/src/code/code_800E11F0.c b/src/code/code_800E11F0.c
index 0cf0be4fa..3cf45a3ed 100644
--- a/src/code/code_800E11F0.c
+++ b/src/code/code_800E11F0.c
@@ -1,5 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
+#include "ultra64.h"
+#include "global.h"
// like audio_load in sm64, but completely rewritten
diff --git a/src/code/code_800EC960.c b/src/code/code_800EC960.c
index d509867af..962e73557 100644
--- a/src/code/code_800EC960.c
+++ b/src/code/code_800EC960.c
@@ -1,5 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
+#include "ultra64.h"
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800EC960/func_800EC960.s")
diff --git a/src/code/code_800F7260.c b/src/code/code_800F7260.c
index c556781d8..e2f087821 100644
--- a/src/code/code_800F7260.c
+++ b/src/code/code_800F7260.c
@@ -1,5 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
+#include "ultra64.h"
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F7260/func_800F7260.s")
diff --git a/src/code/code_800F9280.c b/src/code/code_800F9280.c
index a00535ea1..347d8270d 100644
--- a/src/code/code_800F9280.c
+++ b/src/code/code_800F9280.c
@@ -1,5 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
+#include "ultra64.h"
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F9280/func_800F9280.s")
diff --git a/src/code/code_800FBCE0.c b/src/code/code_800FBCE0.c
index 2c17e6fa2..65156eda0 100644
--- a/src/code/code_800FBCE0.c
+++ b/src/code/code_800FBCE0.c
@@ -1,4 +1,4 @@
-#include <z64.h>
+#include "global.h"
#define printSpStatus(x, name) \
if (x & SP_STATUS_##name) \
diff --git a/src/code/code_800FC620.c b/src/code/code_800FC620.c
index 48fcf48a5..d1bb1f36d 100644
--- a/src/code/code_800FC620.c
+++ b/src/code/code_800FC620.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
typedef void (*arg3_800FC868)(void*);
typedef void (*arg3_800FC8D8)(void*, u32);
diff --git a/src/code/code_800FCE80.c b/src/code/code_800FCE80.c
index 5180c2444..2acf1ed02 100644
--- a/src/code/code_800FCE80.c
+++ b/src/code/code_800FCE80.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <fp.h>
+#include "global.h"
+#include "fp.h"
s32 use_cfrac;
diff --git a/src/code/code_800FD970.c b/src/code/code_800FD970.c
index ae2d5916d..04d5f8118 100644
--- a/src/code/code_800FD970.c
+++ b/src/code/code_800FD970.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
// The latest generated random number, used to generate the next number in the sequence.
static u32 sRandInt = 1;
diff --git a/src/code/code_801067F0.c b/src/code/code_801067F0.c
index b895ee360..ae65e522b 100644
--- a/src/code/code_801067F0.c
+++ b/src/code/code_801067F0.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
// fmodf?
f32 func_801067F0(f32 arg0, f32 arg1) {
diff --git a/src/code/code_80106860.c b/src/code/code_80106860.c
index 9d862014f..4c1b8480b 100644
--- a/src/code/code_80106860.c
+++ b/src/code/code_80106860.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
// memset used in __osMalloc, z_quake, z_view, and z_camera
void* func_80106860(void* ptr, s32 val, size_t size) {
diff --git a/src/code/code_801068B0.c b/src/code/code_801068B0.c
index bf3ae5744..da6f94883 100644
--- a/src/code/code_801068B0.c
+++ b/src/code/code_801068B0.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
// memcpy used in __osMalloc.c
void* func_801068B0(void* dst, void* src, size_t size) {
diff --git a/src/code/code_80110450.c b/src/code/code_80110450.c
index d312881ba..828d757a2 100644
--- a/src/code/code_80110450.c
+++ b/src/code/code_80110450.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80110450/func_80110450.s")
diff --git a/src/code/db_camera.c b/src/code/db_camera.c
index b693051d9..fc97d1ebd 100644
--- a/src/code/db_camera.c
+++ b/src/code/db_camera.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3B50.s")
diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c
index 69a4d9362..827f10a40 100644
--- a/src/code/debug_malloc.c
+++ b/src/code/debug_malloc.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
#define LOG_SEVERITY_NOLOG 0
#define LOG_SEVERITY_ERROR 2
diff --git a/src/code/fault.c b/src/code/fault.c
index 7520165f4..2dcea2667 100644
--- a/src/code/fault.c
+++ b/src/code/fault.c
@@ -1,9 +1,6 @@
-#include <ultra64.h>
-#include <ultra64/controller.h>
-#include <ultra64/hardware.h>
-#include <global.h>
-#include <alloca.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
+#include "alloca.h"
// data
const char* sExceptionNames[] = {
@@ -72,7 +69,8 @@ void Fault_ProcessClientContext(FaultClientContext* ctx) {
if (sFaultStructPtr->currClientThreadSp != 0) {
thread = alloca(sizeof(OSThread));
- osCreateThread(thread, 2, Fault_ClientProcessThread, ctx, sFaultStructPtr->currClientThreadSp, 0x7E);
+ osCreateThread(thread, 2, Fault_ClientProcessThread, ctx, sFaultStructPtr->currClientThreadSp,
+ OS_PRIORITY_APPMAX - 1);
osStartThread(thread);
} else {
Fault_ClientProcessThread(ctx);
@@ -287,9 +285,9 @@ u32 Fault_WaitForInputImpl() {
Fault_Sleep(0x10);
Fault_UpdatePadImpl();
- kDown = curInput->press.in.button;
+ kDown = curInput->press.button;
- if (kDown == L_TRIG) {
+ if (kDown == BTN_L) {
sFaultStructPtr->faultActive = !sFaultStructPtr->faultActive;
}
@@ -298,19 +296,19 @@ u32 Fault_WaitForInputImpl() {
return false;
}
} else {
- if (kDown == A_BUTTON || kDown == R_JPAD) {
+ if (kDown == BTN_A || kDown == BTN_DRIGHT) {
return false;
}
- if (kDown == L_JPAD) {
+ if (kDown == BTN_DLEFT) {
return true;
}
- if (kDown == U_JPAD) {
+ if (kDown == BTN_DUP) {
FaultDrawer_SetOsSyncPrintfEnabled(true);
}
- if (kDown == D_JPAD) {
+ if (kDown == BTN_DDOWN) {
FaultDrawer_SetOsSyncPrintfEnabled(false);
}
}
@@ -557,8 +555,8 @@ void Fault_WaitForButtonCombo() {
Fault_Sleep(0x10);
Fault_UpdatePadImpl();
- kDown = curInput->press.in.button;
- kCur = curInput->cur.in.button;
+ kDown = curInput->press.button;
+ kCur = curInput->cur.button;
if ((kCur == 0) && (s1 == s2)) {
s1 = 0;
@@ -569,20 +567,20 @@ void Fault_WaitForButtonCombo() {
switch (state) {
case 0:
- if (kCur == (Z_TRIG | L_TRIG | R_TRIG) && kDown == Z_TRIG) {
+ if (kCur == (BTN_Z | BTN_L | BTN_R) && kDown == BTN_Z) {
state = s2;
s1 = s2;
}
break;
case 1:
- if (kDown == U_JPAD) {
+ if (kDown == BTN_DUP) {
state = 2;
} else {
state = 0;
}
break;
case 2:
- if (kDown == D_CBUTTONS) {
+ if (kDown == BTN_CDOWN) {
state = 3;
s1 = s2;
} else {
@@ -590,14 +588,14 @@ void Fault_WaitForButtonCombo() {
}
break;
case 3:
- if (kDown == U_CBUTTONS) {
+ if (kDown == BTN_CUP) {
state = 4;
} else {
state = 0;
}
break;
case 4:
- if (kDown == D_JPAD) {
+ if (kDown == BTN_DDOWN) {
state = 5;
s1 = s2;
} else {
@@ -605,14 +603,14 @@ void Fault_WaitForButtonCombo() {
}
break;
case 5:
- if (kDown == L_JPAD) {
+ if (kDown == BTN_DLEFT) {
state = 6;
} else {
state = 0;
}
break;
case 6:
- if (kDown == L_CBUTTONS) {
+ if (kDown == BTN_CLEFT) {
state = 7;
s1 = s2;
} else {
@@ -620,14 +618,14 @@ void Fault_WaitForButtonCombo() {
}
break;
case 7:
- if (kDown == R_CBUTTONS) {
+ if (kDown == BTN_CRIGHT) {
state = 8;
} else {
state = 0;
}
break;
case 8:
- if (kDown == R_JPAD) {
+ if (kDown == BTN_DRIGHT) {
state = 9;
s1 = s2;
} else {
@@ -635,32 +633,32 @@ void Fault_WaitForButtonCombo() {
}
break;
case 9:
- if (kDown == (A_BUTTON | B_BUTTON)) {
+ if (kDown == (BTN_A | BTN_B)) {
state = 10;
- } else if (kDown == A_BUTTON) {
+ } else if (kDown == BTN_A) {
state = 0x5B;
- } else if (kDown == B_BUTTON) {
+ } else if (kDown == BTN_B) {
state = 0x5C;
} else {
state = 0;
}
break;
case 0x5B:
- if (kDown == B_BUTTON) {
+ if (kDown == BTN_B) {
state = 10;
} else {
state = 0;
}
break;
case 0x5C:
- if (kDown == A_BUTTON) {
+ if (kDown == BTN_A) {
state = 10;
} else {
state = 0;
}
break;
case 10:
- if (kDown == START_BUTTON) {
+ if (kDown == BTN_START) {
state = 11;
} else {
state = 0;
@@ -733,7 +731,7 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) {
count--;
Fault_Sleep(0x10);
Fault_UpdatePadImpl();
- if (CHECK_PAD(curInput->press, L_TRIG)) {
+ if (CHECK_BTN_ALL(curInput->press.button, BTN_L)) {
sFaultStructPtr->faultActive = false;
}
}
@@ -741,40 +739,40 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) {
do {
Fault_Sleep(0x10);
Fault_UpdatePadImpl();
- } while (curInput->press.in.button == 0);
+ } while (curInput->press.button == 0);
- if (CHECK_PAD(curInput->press, START_BUTTON) || CHECK_PAD(curInput->cur, A_BUTTON)) {
+ if (CHECK_BTN_ALL(curInput->press.button, BTN_START) || CHECK_BTN_ALL(curInput->cur.button, BTN_A)) {
return;
}
off = 0x10;
- if (CHECK_PAD(curInput->cur, Z_TRIG)) {
+ if (CHECK_BTN_ALL(curInput->cur.button, BTN_Z)) {
off = 0x100;
}
- if (CHECK_PAD(curInput->cur, B_BUTTON)) {
+ if (CHECK_BTN_ALL(curInput->cur.button, BTN_B)) {
off <<= 8;
}
- if (CHECK_PAD(curInput->press, U_JPAD)) {
+ if (CHECK_BTN_ALL(curInput->press.button, BTN_DUP)) {
addr -= off;
}
- if (CHECK_PAD(curInput->press, D_JPAD)) {
+ if (CHECK_BTN_ALL(curInput->press.button, BTN_DDOWN)) {
addr += off;
}
- if (CHECK_PAD(curInput->press, U_CBUTTONS)) {
+ if (CHECK_BTN_ALL(curInput->press.button, BTN_CUP)) {
addr = pc;
}
- if (CHECK_PAD(curInput->press, D_CBUTTONS)) {
+ if (CHECK_BTN_ALL(curInput->press.button, BTN_CDOWN)) {
addr = sp;
}
- if (CHECK_PAD(curInput->press, L_CBUTTONS)) {
+ if (CHECK_BTN_ALL(curInput->press.button, BTN_CLEFT)) {
addr = unk0;
}
- if (CHECK_PAD(curInput->press, R_CBUTTONS)) {
+ if (CHECK_BTN_ALL(curInput->press.button, BTN_CRIGHT)) {
addr = unk1;
}
- } while (!CHECK_PAD(curInput->press, L_TRIG));
+ } while (!CHECK_BTN_ALL(curInput->press.button, BTN_L));
sFaultStructPtr->faultActive = true;
}
@@ -1023,7 +1021,7 @@ void Fault_SetFB(void* fb, u16 w, u16 h) {
FaultDrawer_SetDrawerFB(fb, w, h);
}
-void Fault_Start(void) {
+void Fault_Init(void) {
sFaultStructPtr = &gFaultStruct;
bzero(sFaultStructPtr, sizeof(FaultThreadStruct));
FaultDrawer_SetDefault();
@@ -1038,7 +1036,8 @@ void Fault_Start(void) {
gFaultStruct.faultHandlerEnabled = true;
osCreateMesgQueue(&sFaultStructPtr->queue, &sFaultStructPtr->msg, 1);
StackCheck_Init(&sFaultThreadInfo, &sFaultStack, sFaultStack + sizeof(sFaultStack), 0, 0x100, "fault");
- osCreateThread(&sFaultStructPtr->thread, 2, &Fault_ThreadEntry, 0, sFaultStack + sizeof(sFaultStack), 0x7f);
+ osCreateThread(&sFaultStructPtr->thread, 2, &Fault_ThreadEntry, 0, sFaultStack + sizeof(sFaultStack),
+ OS_PRIORITY_APPMAX);
osStartThread(&sFaultStructPtr->thread);
}
diff --git a/src/code/fault_drawer.c b/src/code/fault_drawer.c
index 9a4a81be1..32c10cb88 100644
--- a/src/code/fault_drawer.c
+++ b/src/code/fault_drawer.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
// rodata
const u32 sFaultDrawerFont[] = {
diff --git a/src/code/flg_set.c b/src/code/flg_set.c
index 966c39ba2..44707957a 100644
--- a/src/code/flg_set.c
+++ b/src/code/flg_set.c
@@ -1,5 +1,4 @@
-#include <global.h>
-#include <ultra64/controller.h>
+#include "global.h"
void FlagSet_Update(GlobalContext* globalCtx) {
static s32 entryIdx = 0;
@@ -76,35 +75,35 @@ void FlagSet_Update(GlobalContext* globalCtx) {
}
}
- if (CHECK_PAD(input->press, L_JPAD)) {
+ if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) {
timer = 10;
curBit++;
}
- if (CHECK_PAD(input->press, R_JPAD)) {
+ if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)) {
curBit--;
timer = 10;
}
if (timer == 0) {
- if (CHECK_PAD(input->cur, L_JPAD)) {
+ if (CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) {
curBit++;
timer = 2;
}
- if (CHECK_PAD(input->cur, R_JPAD)) {
+ if (CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT)) {
curBit--;
timer = 2;
}
}
curBit %= 16;
- if (CHECK_PAD(input->press, U_JPAD)) {
+ if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) {
entryIdx--;
if (entryIdx < 0) {
entryIdx = 0;
}
timer = 10;
}
- if (CHECK_PAD(input->press, D_JPAD)) {
+ if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
timer = 10;
entryIdx++;
if (!entries[entryIdx].value) {
@@ -113,14 +112,14 @@ void FlagSet_Update(GlobalContext* globalCtx) {
}
if (timer == 0) {
- if (CHECK_PAD(input->cur, U_JPAD)) {
+ if (CHECK_BTN_ALL(input->cur.button, BTN_DUP)) {
entryIdx--;
timer = 2;
if (entryIdx < 0) {
entryIdx = 0;
}
}
- if (CHECK_PAD(input->cur, D_JPAD)) {
+ if (CHECK_BTN_ALL(input->cur.button, BTN_DDOWN)) {
timer = 2;
entryIdx++;
if (!entries[entryIdx].value) {
@@ -129,7 +128,7 @@ void FlagSet_Update(GlobalContext* globalCtx) {
}
}
- if (CHECK_PAD(input->press, A_BUTTON)) {
+ if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
*entries[entryIdx].value ^= (1 << curBit);
}
@@ -145,7 +144,7 @@ void FlagSet_Update(GlobalContext* globalCtx) {
oGfxCtx->polyOpa.p = gfx;
}
- if (CHECK_PAD(input->press, L_TRIG)) {
+ if (CHECK_BTN_ALL(input->press.button, BTN_L)) {
globalCtx->pauseCtx.flag = 0;
}
diff --git a/src/code/game.c b/src/code/game.c
index 8b53efabf..bafc50469 100644
--- a/src/code/game.c
+++ b/src/code/game.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
#include "vt.h"
typedef struct {
@@ -77,17 +77,17 @@ void func_800C4344(GameState* gameState) {
if (HREG(80) == 0xC) {
selectedInput = &gameState->input[HREG(81) < 4U ? HREG(81) : 0];
hReg82 = HREG(82);
- HREG(83) = selectedInput->cur.in.button;
- HREG(84) = selectedInput->press.in.button;
- HREG(85) = selectedInput->rel.in.x;
- HREG(86) = selectedInput->rel.in.y;
- HREG(87) = selectedInput->rel.in.x;
- HREG(88) = selectedInput->rel.in.y;
- HREG(89) = selectedInput->cur.in.x;
- HREG(90) = selectedInput->cur.in.y;
- HREG(93) = (selectedInput->cur.in.button == hReg82);
- HREG(94) = CHECK_PAD(selectedInput->cur, hReg82);
- HREG(95) = CHECK_PAD(selectedInput->press, hReg82);
+ HREG(83) = selectedInput->cur.button;
+ HREG(84) = selectedInput->press.button;
+ HREG(85) = selectedInput->rel.stick_x;
+ HREG(86) = selectedInput->rel.stick_y;
+ HREG(87) = selectedInput->rel.stick_x;
+ HREG(88) = selectedInput->rel.stick_y;
+ HREG(89) = selectedInput->cur.stick_x;
+ HREG(90) = selectedInput->cur.stick_y;
+ HREG(93) = (selectedInput->cur.button == hReg82);
+ HREG(94) = CHECK_BTN_ALL(selectedInput->cur.button, hReg82);
+ HREG(95) = CHECK_BTN_ALL(selectedInput->press.button, hReg82);
}
if (D_8012DBC0 != 0) {
@@ -158,7 +158,7 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
GameState_SetFBFilter(&newDList);
}
- sLastButtonPressed = gameState->input[0].press.in.button | gameState->input[0].cur.in.button;
+ sLastButtonPressed = gameState->input[0].press.button | gameState->input[0].cur.button;
if (R_DISABLE_INPUT_DISPLAY == 0) {
GameState_DrawInputDisplay(sLastButtonPressed, &newDList);
}
diff --git a/src/code/gamealloc.c b/src/code/gamealloc.c
index 9ec6886b2..960aeea98 100644
--- a/src/code/gamealloc.c
+++ b/src/code/gamealloc.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
void GameAlloc_Log(GameAlloc* this) {
GameAllocEntry* iter;
diff --git a/src/code/gfxprint.c b/src/code/gfxprint.c
index 9b859c212..91854f8fd 100644
--- a/src/code/gfxprint.c
+++ b/src/code/gfxprint.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
// .bss
u8 D_801755F0;
diff --git a/src/code/graph.c b/src/code/graph.c
index dc958ff00..3ba23f9ff 100644
--- a/src/code/graph.c
+++ b/src/code/graph.c
@@ -1,7 +1,5 @@
-#include <global.h>
-#include <ultra64/hardware.h>
-#include <ultra64/controller.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
#define GFXPOOL_HEAD_MAGIC 0x1234
#define GFXPOOL_TAIL_MAGIC 0x5678
@@ -392,8 +390,8 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
sGraphUpdateTime = time;
}
- if (D_8012DBC0 && CHECK_PAD(gameState->input[0].press, Z_TRIG) &&
- CHECK_PAD(gameState->input[0].cur, L_TRIG | R_TRIG)) {
+ if (D_8012DBC0 && CHECK_BTN_ALL(gameState->input[0].press.button, BTN_Z) &&
+ CHECK_BTN_ALL(gameState->input[0].cur.button, BTN_L | BTN_R)) {
gSaveContext.gameMode = 0;
SET_NEXT_GAMESTATE(gameState, Select_Init, SelectContext);
gameState->running = false;
diff --git a/src/code/irqmgr.c b/src/code/irqmgr.c
index ba47ef40e..1a8eeffec 100644
--- a/src/code/irqmgr.c
+++ b/src/code/irqmgr.c
@@ -1,7 +1,7 @@
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
-volatile u32 gIrqMgrResetStatus = 0;
+vu32 gIrqMgrResetStatus = 0;
volatile OSTime sIrqMgrResetTime = 0;
volatile OSTime gIrqMgrRetraceTime = 0;
u32 sIrqMgrRetraceCount = 0;
@@ -212,7 +212,7 @@ void IrqMgr_ThreadEntry(void* arg0) {
osSyncPrintf("IRQマネージャスレッド実行終了\n"); // End of IRQ manager thread execution
}
-void IrqMgr_Create(IrqMgr* this, void* stack, OSPri pri, u8 retraceCount) {
+void IrqMgr_Init(IrqMgr* this, void* stack, OSPri pri, u8 retraceCount) {
LogUtils_CheckNullPointer("this", this, "../irqmgr.c", 346);
LogUtils_CheckNullPointer("stack", stack, "../irqmgr.c", 347);
this->clients = NULL;
diff --git a/src/code/jpegdecoder.c b/src/code/jpegdecoder.c
index 1f73a4626..cde91207c 100644
--- a/src/code/jpegdecoder.c
+++ b/src/code/jpegdecoder.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
u8* sJpegBitStreamPtr;
u32 sJpegBitStreamByteIdx;
diff --git a/src/code/jpegutils.c b/src/code/jpegutils.c
index 52b8612dd..c532681b9 100644
--- a/src/code/jpegutils.c
+++ b/src/code/jpegutils.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
void JpegUtils_ProcessQuantizationTable(u8* dqt, JpegQuantizationTable* qt, u8 count) {
u8 i;
diff --git a/src/code/listalloc.c b/src/code/listalloc.c
index b7d97281c..b6aefeee2 100644
--- a/src/code/listalloc.c
+++ b/src/code/listalloc.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
ListAlloc* ListAlloc_Init(ListAlloc* this) {
this->prev = NULL;
diff --git a/src/code/loadfragment2.c b/src/code/loadfragment2.c
index 2a304bbeb..d651ff4e6 100644
--- a/src/code/loadfragment2.c
+++ b/src/code/loadfragment2.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
void* Overlay_AllocateAndLoad(u32 vRomStart, u32 vRomEnd, void* vRamStart, void* vRamEnd) {
void* allocatedVRamAddr;
diff --git a/src/code/logseverity.c b/src/code/logseverity.c
index 25bc68c46..940aa87cc 100644
--- a/src/code/logseverity.c
+++ b/src/code/logseverity.c
@@ -1,3 +1,3 @@
-#include <global.h>
+#include "global.h"
s32 gOverlayLogSeverity = 2;
diff --git a/src/code/main.c b/src/code/main.c
index 6e0862287..cf74a8b57 100644
--- a/src/code/main.c
+++ b/src/code/main.c
@@ -1,5 +1,5 @@
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
s32 gScreenWidth = SCREEN_WIDTH;
s32 gScreenHeight = SCREEN_HEIGHT;
@@ -48,7 +48,7 @@ void Main(void* arg0) {
gScreenHeight = SCREEN_HEIGHT;
gAppNmiBufferPtr = (PreNmiBuff*)osAppNmiBuffer;
PreNmiBuff_Init(gAppNmiBufferPtr);
- Fault_Start();
+ Fault_Init();
SysCfb_Init(0);
sysHeap = (u32)gSystemHeap;
fb = SysCfb_GetFbPtr(0);
@@ -75,26 +75,26 @@ void Main(void* arg0) {
osCreateMesgQueue(&irqMgrMsgQ, irqMgrMsgBuf, 0x3c);
StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, sIrqMgrStack + sizeof(sIrqMgrStack), 0, 0x100, "irqmgr");
- IrqMgr_Create(&gIrqMgr, &sGraphStackInfo, 0x11, 1);
+ IrqMgr_Init(&gIrqMgr, &sGraphStackInfo, Z_PRIORITY_IRQMGR, 1);
osSyncPrintf("タスクスケジューラの初期化\n"); // Initialize the task scheduler
StackCheck_Init(&sSchedStackInfo, sSchedStack, sSchedStack + sizeof(sSchedStack), 0, 0x100, "sched");
- Sched_Init(&gSchedContext, &sAudioStack, 0xf, D_80013960, 1, &gIrqMgr);
+ Sched_Init(&gSchedContext, &sAudioStack, Z_PRIORITY_SCHED, D_80013960, 1, &gIrqMgr);
IrqMgr_AddClient(&gIrqMgr, &irqClient, &irqMgrMsgQ);
StackCheck_Init(&sAudioStackInfo, sAudioStack, sAudioStack + sizeof(sAudioStack), 0, 0x100, "audio");
- AudioMgr_Start(&gAudioMgr, sAudioStack + sizeof(sAudioStack), 0xc, 0xa, &gSchedContext, &gIrqMgr);
+ AudioMgr_Init(&gAudioMgr, sAudioStack + sizeof(sAudioStack), Z_PRIORITY_AUDIOMGR, 0xa, &gSchedContext, &gIrqMgr);
StackCheck_Init(&sPadMgrStackInfo, sPadMgrStack, sPadMgrStack + sizeof(sPadMgrStack), 0, 0x100, "padmgr");
- PadMgr_Init(&gPadMgr, &sSiIntMsgQ, &gIrqMgr, 7, 0xe, &sIrqMgrStack);
+ PadMgr_Init(&gPadMgr, &sSiIntMsgQ, &gIrqMgr, 7, Z_PRIORITY_PADMGR, &sIrqMgrStack);
AudioMgr_Unlock(&gAudioMgr);
StackCheck_Init(&sGraphStackInfo, sGraphStack, sGraphStack + sizeof(sGraphStack), 0, 0x100, "graph");
- osCreateThread(&sGraphThread, 4, Graph_ThreadEntry, arg0, sGraphStack + sizeof(sGraphStack), 0xb);
+ osCreateThread(&sGraphThread, 4, Graph_ThreadEntry, arg0, sGraphStack + sizeof(sGraphStack), Z_PRIORITY_GRAPH);
osStartThread(&sGraphThread);
- osSetThreadPri(0, 0xf);
+ osSetThreadPri(0, Z_PRIORITY_SCHED);
while (true) {
msg = NULL;
diff --git a/src/code/mempak.c b/src/code/mempak.c
index 6478bb725..9da4804eb 100644
--- a/src/code/mempak.c
+++ b/src/code/mempak.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
OSPfs sMempakPfsHandle;
s32 sMempakFreeBytes;
diff --git a/src/code/mtxuty-cvt.c b/src/code/mtxuty-cvt.c
index 289e8649d..345059dba 100644
--- a/src/code/mtxuty-cvt.c
+++ b/src/code/mtxuty-cvt.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
void MtxConv_F2L(MatrixInternal* m1, MtxF* m2) {
s32 i;
diff --git a/src/code/padmgr.c b/src/code/padmgr.c
index 13266ab50..a3e32d584 100644
--- a/src/code/padmgr.c
+++ b/src/code/padmgr.c
@@ -1,7 +1,5 @@
-#include <ultra64.h>
-#include <ultra64/controller.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
s32 D_8012D280 = 1;
@@ -206,7 +204,7 @@ void PadMgr_RumbleSet(PadMgr* padmgr, u8* ctrlrRumbles) {
void PadMgr_ProcessInputs(PadMgr* padmgr) {
s32 i;
Input* input;
- PadState* padnow1; // original name
+ OSContPad* padnow1; // original name
s32 buttonDiff;
PadMgr_LockPadData(padmgr);
@@ -237,9 +235,9 @@ void PadMgr_ProcessInputs(PadMgr* padmgr) {
osSyncPrintf(VT_RST);
break;
case 8:
- input->cur.in.button = 0;
- input->cur.in.x = 0;
- input->cur.in.y = 0;
+ input->cur.button = 0;
+ input->cur.stick_x = 0;
+ input->cur.stick_y = 0;
input->cur.errno = padnow1->errno;
if (padmgr->ctrlrIsConnected[i]) {
padmgr->ctrlrIsConnected[i] = false;
@@ -255,12 +253,12 @@ void PadMgr_ProcessInputs(PadMgr* padmgr) {
Fault_AddHungupAndCrash("../padmgr.c", 397);
}
- buttonDiff = input->prev.in.button ^ input->cur.in.button;
- input->press.in.button |= (u16)(buttonDiff & input->cur.in.button);
- input->rel.in.button |= (u16)(buttonDiff & input->prev.in.button);
+ buttonDiff = input->prev.button ^ input->cur.button;
+ input->press.button |= (u16)(buttonDiff & input->cur.button);
+ input->rel.button |= (u16)(buttonDiff & input->prev.button);
PadUtils_UpdateRelXY(input);
- input->press.in.x += (s8)(input->cur.in.x - input->prev.in.x);
- input->press.in.y += (s8)(input->cur.in.y - input->prev.in.y);
+ input->press.stick_x += (s8)(input->cur.stick_x - input->prev.stick_x);
+ input->press.stick_y += (s8)(input->cur.stick_y - input->prev.stick_y);
}
PadMgr_UnlockPadData(padmgr);
@@ -333,19 +331,19 @@ void PadMgr_RequestPadData(PadMgr* padmgr, Input* inputs, s32 mode) {
for (i = 0; i < 4; i++) {
if (mode != 0) {
*newInput = *ogInput;
- ogInput->press.in.button = 0;
- ogInput->press.in.x = 0;
- ogInput->press.in.y = 0;
- ogInput->rel.in.button = 0;
+ ogInput->press.button = 0;
+ ogInput->press.stick_x = 0;
+ ogInput->press.stick_y = 0;
+ ogInput->rel.button = 0;
} else {
newInput->prev = newInput->cur;
newInput->cur = ogInput->cur;
- buttonDiff = newInput->prev.in.button ^ newInput->cur.in.button;
- newInput->press.in.button = newInput->cur.in.button & buttonDiff;
- newInput->rel.in.button = newInput->prev.in.button & buttonDiff;
+ buttonDiff = newInput->prev.button ^ newInput->cur.button;
+ newInput->press.button = newInput->cur.button & buttonDiff;
+ newInput->rel.button = newInput->prev.button & buttonDiff;
PadUtils_UpdateRelXY(newInput);
- newInput->press.in.x += (s8)(newInput->cur.in.x - newInput->prev.in.x);
- newInput->press.in.y += (s8)(newInput->cur.in.y - newInput->prev.in.y);
+ newInput->press.stick_x += (s8)(newInput->cur.stick_x - newInput->prev.stick_x);
+ newInput->press.stick_y += (s8)(newInput->cur.stick_y - newInput->prev.stick_y);
}
ogInput++;
newInput++;
diff --git a/src/code/padsetup.c b/src/code/padsetup.c
index 045724a51..745a32493 100644
--- a/src/code/padsetup.c
+++ b/src/code/padsetup.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status) {
s32 ret;
diff --git a/src/code/padutils.c b/src/code/padutils.c
index b19fdbf12..564cfbf6f 100644
--- a/src/code/padutils.c
+++ b/src/code/padutils.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
void PadUtils_Init(Input* input) {
bzero(input, sizeof(Input));
@@ -8,53 +8,53 @@ void func_800FCB70() {
}
void PadUtils_ResetPressRel(Input* input) {
- input->press.in.button = 0;
- input->rel.in.button = 0;
+ input->press.button = 0;
+ input->rel.button = 0;
}
u32 PadUtils_CheckCurExact(Input* input, u16 value) {
- return value == input->cur.in.button;
+ return value == input->cur.button;
}
u32 PadUtils_CheckCur(Input* input, u16 key) {
- return key == (input->cur.in.button & key);
+ return key == (input->cur.button & key);
}
u32 PadUtils_CheckPressed(Input* input, u16 key) {
- return key == (input->press.in.button & key);
+ return key == (input->press.button & key);
}
u32 PadUtils_CheckReleased(Input* input, u16 key) {
- return key == (input->rel.in.button & key);
+ return key == (input->rel.button & key);
}
u16 PadUtils_GetCurButton(Input* input) {
- return input->cur.in.button;
+ return input->cur.button;
}
u16 PadUtils_GetPressButton(Input* input) {
- return input->press.in.button;
+ return input->press.button;
}
s8 PadUtils_GetCurX(Input* input) {
- return input->cur.in.x;
+ return input->cur.stick_x;
}
s8 PadUtils_GetCurY(Input* input) {
- return input->cur.in.y;
+ return input->cur.stick_y;
}
void PadUtils_SetRelXY(Input* input, s32 x, s32 y) {
- input->rel.in.x = x;
- input->rel.in.y = y;
+ input->rel.stick_x = x;
+ input->rel.stick_y = y;
}
s8 PadUtils_GetRelXImpl(Input* input) {
- return input->rel.in.x;
+ return input->rel.stick_x;
}
s8 PadUtils_GetRelYImpl(Input* input) {
- return input->rel.in.y;
+ return input->rel.stick_y;
}
s8 PadUtils_GetRelX(Input* input) {
diff --git a/src/code/printutils.c b/src/code/printutils.c
index 7cd00f71c..043ed8782 100644
--- a/src/code/printutils.c
+++ b/src/code/printutils.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
void PrintUtils_VPrintf(char** arg0, const char* fmt, va_list args) {
_Printf(*arg0, arg0, fmt, args);
diff --git a/src/code/relocation.c b/src/code/relocation.c
index dccd6e176..68f7ac7d0 100644
--- a/src/code/relocation.c
+++ b/src/code/relocation.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* overlayInfo, void* vRamAddress) {
u32 sections[4];
diff --git a/src/code/sched.c b/src/code/sched.c
index 7bd13383a..5b928cb1d 100644
--- a/src/code/sched.c
+++ b/src/code/sched.c
@@ -1,12 +1,11 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#define RSP_DONE_MSG 667
#define RDP_DONE_MSG 668
#define ENTRY_MSG 670
// data
-volatile s32 sLogScheduler = false;
+vs32 sLogScheduler = false;
// bss
OSTime sRSPGFXStartTime;
diff --git a/src/code/shrink_window.c b/src/code/shrink_window.c
index 212195ce6..c995b7c03 100644
--- a/src/code/shrink_window.c
+++ b/src/code/shrink_window.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
s32 D_8012CED0 = 0;
diff --git a/src/code/sleep.c b/src/code/sleep.c
index 31720a0df..f08129701 100644
--- a/src/code/sleep.c
+++ b/src/code/sleep.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
void Sleep_Cycles(OSTime cycles) {
OSMesgQueue mq;
diff --git a/src/code/speed_meter.c b/src/code/speed_meter.c
index 24b4e8d65..b1ee055a3 100644
--- a/src/code/speed_meter.c
+++ b/src/code/speed_meter.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
volatile OSTime D_8016A520;
volatile OSTime D_8016A528;
diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c
index 5ee8e857f..aab304465 100644
--- a/src/code/sys_cfb.c
+++ b/src/code/sys_cfb.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
u32 sSysCfbFbPtr[2];
u32 sSysCfbEnd;
diff --git a/src/code/sys_math.c b/src/code/sys_math.c
index 994f66475..87a1eacd8 100644
--- a/src/code/sys_math.c
+++ b/src/code/sys_math.c
@@ -1,5 +1,5 @@
-#include <global.h>
-#include <math.h>
+#include "global.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 141b27fd4..4a0006c32 100644
--- a/src/code/sys_math3d.c
+++ b/src/code/sys_math3d.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
s32 Math3D_LineSegMakePerpLineSeg(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB,
Vec3f* lineAIntersect, Vec3f* lineBIntersect);
diff --git a/src/code/sys_math_atan.c b/src/code/sys_math_atan.c
index ab62977d2..b468818c8 100644
--- a/src/code/sys_math_atan.c
+++ b/src/code/sys_math_atan.c
@@ -1,5 +1,4 @@
-#include <global.h>
-#include <math.h>
+#include "global.h"
u16 sATan2Tbl[] = {
0x0000, 0x000A, 0x0014, 0x001F, 0x0029, 0x0033, 0x003D, 0x0047, 0x0051, 0x005C, 0x0066, 0x0070, 0x007A, 0x0084,
diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c
index 87a1708f4..ec7b6f8ab 100644
--- a/src/code/sys_matrix.c
+++ b/src/code/sys_matrix.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
// clang-format off
Mtx gMtxClear = {
diff --git a/src/code/sys_ucode.c b/src/code/sys_ucode.c
index 6496217eb..34e782387 100644
--- a/src/code/sys_ucode.c
+++ b/src/code/sys_ucode.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
u32 D_8012DBA0 = (u32)&D_80155F50;
u32 D_8012DBA4 = (u32)&D_80157580;
diff --git a/src/code/system_malloc.c b/src/code/system_malloc.c
index a9141043d..be55cb76c 100644
--- a/src/code/system_malloc.c
+++ b/src/code/system_malloc.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
#define LOG_SEVERITY_NOLOG 0
#define LOG_SEVERITY_ERROR 2
diff --git a/src/code/title_setup.c b/src/code/title_setup.c
index 827987d33..94c536625 100644
--- a/src/code/title_setup.c
+++ b/src/code/title_setup.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
void TitleSetup_InitImpl(GameState* gameState) {
// Zelda common data initalization
diff --git a/src/code/ucode_disas.c b/src/code/ucode_disas.c
index 1f4975799..81301f2cc 100644
--- a/src/code/ucode_disas.c
+++ b/src/code/ucode_disas.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
#define F3DZEX_CONST(name) \
{ name, #name }
diff --git a/src/code/z_DLF.c b/src/code/z_DLF.c
index ab09cbac5..a8e8a13fc 100644
--- a/src/code/z_DLF.c
+++ b/src/code/z_DLF.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
void Overlay_LoadGameState(GameStateOverlay* overlayEntry) {
if (overlayEntry->loadedRamAddr != NULL) {
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index e17084fd1..b9638879b 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -1,8 +1,7 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
-#include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h"
+#include "global.h"
+#include "vt.h"
+#include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h"
#include "overlays/actors/ovl_En_Part/z_en_part.h"
void ActorShape_Init(ActorShape* shape, f32 arg1, void* shadowDrawFunc, f32 arg3) {
diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c
index 42a153113..a03019b72 100644
--- a/src/code/z_actor_dlftbls.c
+++ b/src/code/z_actor_dlftbls.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <initvars.h>
+#include "global.h"
+#include "initvars.h"
#define ACTOR_OVERLAY(name, allocType) \
{ \
diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c
index 318dd4838..75d078ab3 100644
--- a/src/code/z_bgcheck.c
+++ b/src/code/z_bgcheck.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038600.s")
@@ -23,7 +22,7 @@ void func_800387FC(u32 uParm1, u32* puParm2) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003880C.s")
-void func_80038870(int iParm1) {
+void func_80038870(s32 iParm1) {
*(u32*)(iParm1 + 4) = 0;
}
@@ -31,9 +30,9 @@ u32 func_80038878(s32 iParm1) {
u32 uVar1;
uVar1 = *(u32*)(iParm1 + 4) & 0xffff;
- *(int*)(iParm1 + 4) = *(u32*)(iParm1 + 4) + 1;
+ *(s32*)(iParm1 + 4) = *(u32*)(iParm1 + 4) + 1;
- if (*(int*)(iParm1 + 8) <= (int)uVar1) {
+ if (*(s32*)(iParm1 + 8) <= (s32)uVar1) {
return 0xffff;
}
@@ -200,7 +199,7 @@ void func_8003E6E4(u16* a0) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E750.s")
-void func_8003E804(int iParm1) {
+void func_8003E804(s32 iParm1) {
func_8003E5B4(iParm1 + 0x14, iParm1 + 0x34);
}
@@ -231,7 +230,7 @@ void func_8003E8EC(u32 uParm1, u32* iParm2) {
iParm2[0x0C] = iParm2[0x14];
- //int i;
+ //s32 i;
//for (i = 0; i < 4; i++) {
//iParm2[0x06 + (i * 2)] = iParm2[0x0E + (i * 2)];
//iParm2[0x07 + (i * 2)] = iParm2[0x0D + (i * 2)];
@@ -239,7 +238,7 @@ void func_8003E8EC(u32 uParm1, u32* iParm2) {
}
*/
-u32 func_8003E934(int iParm1) {
+u32 func_8003E934(s32 iParm1) {
if (!((-1 < iParm1) && (iParm1 < 0x32))) {
return 0;
}
@@ -338,13 +337,13 @@ void func_800418D0(CollisionContext* colCtx, GlobalContext* globalCtx) {
}
#ifdef NON_MATCHING
-void func_80041978(int iParm1, int iParm2) {
+void func_80041978(s32 iParm1, s32 iParm2) {
u8* puVar1;
puVar1 = *(u8**)(iParm1 + 8);
if (puVar1 < puVar1 + iParm2) {
*puVar1 = 0;
- while (puVar1++ < (u8*)(*(int*)(iParm1 + 8) + iParm2)) {
+ while (puVar1++ < (u8*)(*(s32*)(iParm1 + 8) + iParm2)) {
*puVar1 = 0;
}
}
diff --git a/src/code/z_camera.c b/src/code/z_camera.c
index 75c536b9f..c0822b1ab 100644
--- a/src/code/z_camera.c
+++ b/src/code/z_camera.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
typedef struct {
s16 val;
@@ -3328,19 +3327,19 @@ s32 func_80058D34(Camera* camera) {
if (D_8011D394 == 0) {
if (camera->globalCtx->activeCamera == 0) {
- if (CHECK_PAD(D_8015BD7C->state.input[2].press, U_CBUTTONS)) {
+ if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_CUP)) {
osSyncPrintf("attention sound URGENCY\n");
func_80078884(NA_SE_SY_ATTENTION_URGENCY);
}
- if (CHECK_PAD(D_8015BD7C->state.input[2].press, D_CBUTTONS)) {
+ if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_CDOWN)) {
osSyncPrintf("attention sound NORMAL\n");
func_80078884(NA_SE_SY_ATTENTION_ON);
}
- if (CHECK_PAD(D_8015BD7C->state.input[2].press, R_CBUTTONS)) {
+ if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_CRIGHT)) {
phi_a2 = 1;
}
- if (CHECK_PAD(D_8015BD7C->state.input[2].press, L_CBUTTONS)) {
+ if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_CLEFT)) {
phi_a2 = -1;
}
if (phi_a2 != 0) {
diff --git a/src/code/z_cheap_proc.c b/src/code/z_cheap_proc.c
index 518b2d359..eb9ecfa53 100644
--- a/src/code/z_cheap_proc.c
+++ b/src/code/z_cheap_proc.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void Gfx_DrawDListOpa(GlobalContext* globalCtx, Gfx* dlist) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 214);
diff --git a/src/code/z_collision_btltbls.c b/src/code/z_collision_btltbls.c
index c56347e9a..1b323dacf 100644
--- a/src/code/z_collision_btltbls.c
+++ b/src/code/z_collision_btltbls.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
DamageTable D_8011DB20[] = {
{ {
diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c
index 36aeadf5f..0554c3d24 100644
--- a/src/code/z_collision_check.c
+++ b/src/code/z_collision_check.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
// draw red poly
void func_8005B280(GraphicsContext* gfx, Vec3f* vA, Vec3f* vB, Vec3f* vC) {
@@ -497,7 +496,7 @@ s32 Collider_DestroyTrisItemDim(GlobalContext* globalCtx, TriNorm* dim) {
s32 Collider_SetTrisItemDim(GlobalContext* globalCtx, TriNorm* dest, ColliderTrisItemDimInit* src) {
Vec3f* d;
Vec3f* s;
- float nx, ny, nz, nd;
+ f32 nx, ny, nz, nd;
d = dest->vtx;
s = src->vtx;
@@ -1981,6 +1980,7 @@ void CollisionCheck_AC_CylVsQuad(GlobalContext* globalCtx, CollisionCheckContext
}
static s8 sBssDummy1;
+static s8 sBssDummy2;
static TriNorm D_8015E3A0;
static TriNorm D_8015E3D8;
@@ -2032,10 +2032,10 @@ void CollisionCheck_AC_QuadVsCyl(GlobalContext* globalCtx, CollisionCheckContext
}
}
-static s8 sBssDummy2;
static s8 sBssDummy3;
static s8 sBssDummy4;
static s8 sBssDummy5;
+static s8 sBssDummy6;
static Vec3f D_8015E420;
@@ -2077,10 +2077,10 @@ void CollisionCheck_AC_TrisVsTris(GlobalContext* globalCtx, CollisionCheckContex
}
}
-static s8 sBssDummy6;
static s8 sBssDummy7;
static s8 sBssDummy8;
static s8 sBssDummy9;
+static s8 sBssDummy10;
static Vec3f D_8015E430;
static TriNorm D_8015E440;
@@ -2676,7 +2676,7 @@ void func_80061F64(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, C
u32 flags;
s32 i;
f32 damage;
- int tblLookup;
+ s32 tblLookup;
if (collider->actor == NULL || !(collider->acFlags & 2)) {
return;
@@ -2910,10 +2910,10 @@ void func_8006285C(GlobalContext* globalCtx, ColliderTris* collider, s32 index,
// 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 sBssDummy10;
static s8 sBssDummy11;
static s8 sBssDummy12;
static s8 sBssDummy13;
+static s8 sBssDummy14;
void func_800628A4(s32 arg0, ColliderJntSph* collider) {
static Vec3f D_8015E648;
diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c
index 53a2fa82d..4923e56f1 100644
--- a/src/code/z_common_data.c
+++ b/src/code/z_common_data.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
SaveContext gSaveContext;
u32 D_8015FA88;
diff --git a/src/code/z_construct.c b/src/code/z_construct.c
index f7970ac19..15a8054e7 100644
--- a/src/code/z_construct.c
+++ b/src/code/z_construct.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void func_80110990(GlobalContext* globalCtx) {
Map_Destroy(globalCtx);
diff --git a/src/code/z_debug.c b/src/code/z_debug.c
index 21e0eae03..0ee403868 100644
--- a/src/code/z_debug.c
+++ b/src/code/z_debug.c
@@ -1,6 +1,4 @@
-#include <ultra64.h>
-#include <ultra64/controller.h>
-#include <global.h>
+#include "global.h"
typedef struct {
u8 x;
@@ -15,7 +13,7 @@ typedef struct {
} InputCombo;
GameInfo* gGameInfo;
-int D_8015FA94; // no known symbols
+s32 D_8015FA94; // no known symbols
PrintTextBuffer D_8015FA98[0x16];
s16 D_8011E0B0 = 0; // PrintTextBuffer index
@@ -25,14 +23,12 @@ Color_RGBA8 printTextColors[] = {
};
InputCombo inputCombos[REG_GROUPS] = {
- { L_TRIG, U_CBUTTONS }, { L_TRIG, L_CBUTTONS }, { L_TRIG, D_CBUTTONS }, { L_TRIG, A_BUTTON },
- { R_TRIG, D_CBUTTONS }, { L_TRIG, R_CBUTTONS }, { L_TRIG, R_TRIG }, { L_TRIG, L_JPAD },
- { L_TRIG, R_JPAD }, { L_TRIG, U_JPAD }, { L_TRIG, B_BUTTON }, { L_TRIG, Z_TRIG },
- { L_TRIG, D_JPAD }, { R_TRIG, A_BUTTON }, { R_TRIG, B_BUTTON }, { R_TRIG, Z_TRIG },
- { R_TRIG, L_TRIG }, { R_TRIG, U_CBUTTONS }, { R_TRIG, R_CBUTTONS }, { R_TRIG, L_JPAD },
- { R_TRIG, L_CBUTTONS }, { R_TRIG, START_BUTTON }, { L_TRIG, START_BUTTON }, { R_TRIG, R_JPAD },
- { R_TRIG, U_JPAD }, { START_BUTTON, R_TRIG }, { START_BUTTON, A_BUTTON }, { START_BUTTON, B_BUTTON },
- { START_BUTTON, R_CBUTTONS },
+ { BTN_L, BTN_CUP }, { BTN_L, BTN_CLEFT }, { BTN_L, BTN_CDOWN }, { BTN_L, BTN_A }, { BTN_R, BTN_CDOWN },
+ { BTN_L, BTN_CRIGHT }, { BTN_L, BTN_R }, { BTN_L, BTN_DLEFT }, { BTN_L, BTN_DRIGHT }, { BTN_L, BTN_DUP },
+ { BTN_L, BTN_B }, { BTN_L, BTN_Z }, { BTN_L, BTN_DDOWN }, { BTN_R, BTN_A }, { BTN_R, BTN_B },
+ { BTN_R, BTN_Z }, { BTN_R, BTN_L }, { BTN_R, BTN_CUP }, { BTN_R, BTN_CRIGHT }, { BTN_R, BTN_DLEFT },
+ { BTN_R, BTN_CLEFT }, { BTN_R, BTN_START }, { BTN_L, BTN_START }, { BTN_R, BTN_DRIGHT }, { BTN_R, BTN_DUP },
+ { BTN_START, BTN_R }, { BTN_START, BTN_A }, { BTN_START, BTN_B }, { BTN_START, BTN_CRIGHT },
};
char regChar[] = " SOPQMYDUIZCNKXcsiWAVHGmnBdkb";
@@ -114,11 +110,12 @@ void func_8006390C(Input* input) {
s32 i;
regGroup = (gGameInfo->regGroup * REG_PAGES + gGameInfo->regPage) * REG_PER_PAGE - REG_PER_PAGE;
- dpad = input->cur.in.button & (U_JPAD | L_JPAD | R_JPAD | D_JPAD);
- if (CHECK_PAD(input->cur, L_TRIG) || CHECK_PAD(input->cur, R_TRIG) || CHECK_PAD(input->cur, START_BUTTON)) {
+ dpad = input->cur.button & (BTN_DUP | BTN_DLEFT | BTN_DRIGHT | BTN_DDOWN);
+ if (CHECK_BTN_ALL(input->cur.button, BTN_L) || CHECK_BTN_ALL(input->cur.button, BTN_R) ||
+ CHECK_BTN_ALL(input->cur.button, BTN_START)) {
input_combo = inputCombos;
for (i = 0; i < REG_GROUPS; i++) {
- if (~(~input_combo->push | input->cur.in.button) || ~(~input_combo->held | input->press.in.button)) {
+ if (~(~input_combo->push | input->cur.button) || ~(~input_combo->held | input->press.button)) {
input_combo++;
} else {
break;
@@ -154,25 +151,27 @@ void func_8006390C(Input* input) {
gGameInfo->dpadLast = dpad;
}
- increment =
- (dpad & R_JPAD)
- ? (CHECK_PAD(input->cur, A_BUTTON | B_BUTTON)
- ? 1000
- : CHECK_PAD(input->cur, A_BUTTON) ? 100 : CHECK_PAD(input->cur, B_BUTTON) ? 10 : 1)
- : (dpad & L_JPAD)
- ? (CHECK_PAD(input->cur, A_BUTTON | B_BUTTON)
- ? -1000
- : CHECK_PAD(input->cur, A_BUTTON) ? -100
- : CHECK_PAD(input->cur, B_BUTTON) ? -10 : -1)
- : 0;
+ increment = (CHECK_BTN_ANY(dpad, BTN_DRIGHT))
+ ? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B)
+ ? 1000
+ : CHECK_BTN_ALL(input->cur.button, BTN_A)
+ ? 100
+ : CHECK_BTN_ALL(input->cur.button, BTN_B) ? 10 : 1)
+ : (CHECK_BTN_ANY(dpad, BTN_DLEFT))
+ ? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B)
+ ? -1000
+ : CHECK_BTN_ALL(input->cur.button, BTN_A)
+ ? -100
+ : CHECK_BTN_ALL(input->cur.button, BTN_B) ? -10 : -1)
+ : 0;
gGameInfo->data[gGameInfo->regCur + regGroup] += increment;
- if (dpad & U_JPAD) {
+ if (CHECK_BTN_ANY(dpad, BTN_DUP)) {
gGameInfo->regCur--;
if (gGameInfo->regCur < 0) {
gGameInfo->regCur = REG_PER_PAGE - 1;
}
- } else if (dpad & D_JPAD) {
+ } else if (CHECK_BTN_ANY(dpad, BTN_DDOWN)) {
gGameInfo->regCur++;
if (gGameInfo->regCur >= REG_PER_PAGE) {
gGameInfo->regCur = 0;
diff --git a/src/code/z_debug_display.c b/src/code/z_debug_display.c
index d029d2556..571bb8240 100644
--- a/src/code/z_debug_display.c
+++ b/src/code/z_debug_display.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
typedef struct {
/* 0x00 */ s16 drawType; // indicates which draw function to use when displaying the object
diff --git a/src/code/z_demo.c b/src/code/z_demo.c
index 35dc743ff..9210fe1d1 100644
--- a/src/code/z_demo.c
+++ b/src/code/z_demo.c
@@ -1,6 +1,4 @@
-#include <ultra64.h>
-#include <ultra64/controller.h>
-#include <global.h>
+#include "global.h"
u16 D_8011E1C0 = 0;
u16 D_8011E1C4 = 0;
@@ -98,14 +96,15 @@ void func_80064558(GlobalContext* globalCtx, CutsceneContext* csCtx) {
void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx) {
Input* pad1 = &globalCtx->state.input[0];
- if (CHECK_PAD(pad1->press, L_JPAD) && (csCtx->state == CS_STATE_IDLE) && (gSaveContext.sceneSetupIndex >= 4)) {
+ if (CHECK_BTN_ALL(pad1->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) &&
+ (gSaveContext.sceneSetupIndex >= 4)) {
D_8015FCC8 = 0;
gSaveContext.cutsceneIndex = 0xFFFD;
gSaveContext.cutsceneTrigger = 1;
}
- if (CHECK_PAD(pad1->press, U_JPAD) && (csCtx->state == CS_STATE_IDLE) && (gSaveContext.sceneSetupIndex >= 4) &&
- (D_8011D394 == 0)) {
+ if (CHECK_BTN_ALL(pad1->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) &&
+ (gSaveContext.sceneSetupIndex >= 4) && (D_8011D394 == 0)) {
D_8015FCC8 = 1;
gSaveContext.cutsceneIndex = 0xFFFD;
gSaveContext.cutsceneTrigger = 1;
@@ -442,15 +441,16 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
if ((gSaveContext.gameMode != 0) && (gSaveContext.gameMode != 3) && (globalCtx->sceneNum != SCENE_SPOT00) &&
(csCtx->frames > 20) &&
- (CHECK_PAD(globalCtx->state.input[0].press, A_BUTTON) || CHECK_PAD(globalCtx->state.input[0].press, B_BUTTON) ||
- CHECK_PAD(globalCtx->state.input[0].press, START_BUTTON)) &&
+ (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) ||
+ CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B) ||
+ CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START)) &&
(gSaveContext.fileNum != 0xFEDC) && (globalCtx->sceneLoadFlag == 0)) {
Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
temp = 1;
}
if ((csCtx->frames == cmd->startFrame) || (temp != 0) ||
- ((csCtx->frames > 20) && CHECK_PAD(globalCtx->state.input[0].press, START_BUTTON) &&
+ ((csCtx->frames > 20) && CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) &&
(gSaveContext.fileNum != 0xFEDC))) {
csCtx->state = CS_STATE_UNSKIPPABLE_EXEC;
func_800F68BC(0);
@@ -1522,7 +1522,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx,
return;
}
- if (CHECK_PAD(globalCtx->state.input[0].press, R_JPAD)) {
+ if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_DRIGHT)) {
csCtx->state = CS_STATE_UNSKIPPABLE_INIT;
return;
}
diff --git a/src/code/z_draw.c b/src/code/z_draw.c
index 83f13ce07..885a4674f 100644
--- a/src/code/z_draw.c
+++ b/src/code/z_draw.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
// "Get Item" Model Draw Functions
void func_800694E4(GlobalContext* globalCtx, s16 drawId);
diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c
index 8f256bcc5..3624a2c9f 100644
--- a/src/code/z_eff_blure.c
+++ b/src/code/z_eff_blure.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) {
EffectBlureElement* elem;
diff --git a/src/code/z_eff_shield_particle.c b/src/code/z_eff_shield_particle.c
index 2d6763da1..a68c76561 100644
--- a/src/code/z_eff_shield_particle.c
+++ b/src/code/z_eff_shield_particle.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
static Vtx sVertices[5] = {
VTX(-32, -32, 0, 0, 1024, 0xFF, 0xFF, 0xFF, 0xFF),
diff --git a/src/code/z_eff_spark.c b/src/code/z_eff_spark.c
index 77b7e3f2b..6d4ef51cc 100644
--- a/src/code/z_eff_spark.c
+++ b/src/code/z_eff_spark.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
// original name: "spark"
void EffectSpark_Init(void* thisx, void* initParamsx) {
diff --git a/src/code/z_eff_ss_dead.c b/src/code/z_eff_ss_dead.c
index 5ac7774bc..a6eeabeb8 100644
--- a/src/code/z_eff_ss_dead.c
+++ b/src/code/z_eff_ss_dead.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void func_80026230(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) {
f32 cos;
diff --git a/src/code/z_effect.c b/src/code/z_effect.c
index a1077c13a..f035469e0 100644
--- a/src/code/z_effect.c
+++ b/src/code/z_effect.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
EffectContext sEffectContext;
diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c
index 4fa2abb88..381a24f98 100644
--- a/src/code/z_effect_soft_sprite.c
+++ b/src/code/z_effect_soft_sprite.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
EffectSsInfo sEffectSsInfo = { 0 }; // "EffectSS2Info"
diff --git a/src/code/z_effect_soft_sprite_dlftbls.c b/src/code/z_effect_soft_sprite_dlftbls.c
index 8ecba2e1b..bc7ec83b9 100644
--- a/src/code/z_effect_soft_sprite_dlftbls.c
+++ b/src/code/z_effect_soft_sprite_dlftbls.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <initvars.h>
+#include "global.h"
+#include "initvars.h"
#define EFFECT_SS_OVERLAY(name) \
{ \
diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c
index 4fd31db0f..806ee878a 100644
--- a/src/code/z_effect_soft_sprite_old_init.c
+++ b/src/code/z_effect_soft_sprite_old_init.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.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_elf_message.c b/src/code/z_elf_message.c
index e188e1947..d3552c419 100644
--- a/src/code/z_elf_message.c
+++ b/src/code/z_elf_message.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
// TODO: use macros to define elf messages once the format is fully documented
ElfMessage sChildSariaMsgs[] = {
diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c
index 0847ad682..34ca02864 100644
--- a/src/code/z_en_a_keep.c
+++ b/src/code/z_en_a_keep.c
@@ -1,5 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
+#include "vt.h"
#define FLAGS 0x00000010
diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c
index 64a8dc4dc..df18eb7f7 100644
--- a/src/code/z_en_item00.c
+++ b/src/code/z_en_item00.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h"
#define FLAGS 0x00000000
diff --git a/src/code/z_face_reaction.c b/src/code/z_face_reaction.c
index 8bc9c6685..56e40fd82 100644
--- a/src/code/z_face_reaction.c
+++ b/src/code/z_face_reaction.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
u16 sReactionTextIds[][PLAYER_MASK_MAX] = {
{ 0x0000, 0x7124, 0x7127, 0x7126, 0x7125, 0x7127, 0x7124, 0x7125, 0x7127 },
diff --git a/src/code/z_fbdemo.c b/src/code/z_fbdemo.c
index f8409a7ed..426231bcb 100644
--- a/src/code/z_fbdemo.c
+++ b/src/code/z_fbdemo.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
Gfx D_8012AFB0[] = {
gsDPPipeSync(),
diff --git a/src/code/z_fbdemo_circle.c b/src/code/z_fbdemo_circle.c
index dfcf7e54a..8ef912278 100644
--- a/src/code/z_fbdemo_circle.c
+++ b/src/code/z_fbdemo_circle.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
// unused
Gfx sCircleNullDList[] = {
diff --git a/src/code/z_fbdemo_fade.c b/src/code/z_fbdemo_fade.c
index 74d218caa..d0f99bed6 100644
--- a/src/code/z_fbdemo_fade.c
+++ b/src/code/z_fbdemo_fade.c
@@ -1,5 +1,5 @@
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
static Gfx sRCPSetupFade[] = {
gsDPPipeSync(),
diff --git a/src/code/z_fbdemo_triforce.c b/src/code/z_fbdemo_triforce.c
index 4c2d0a475..d4c3d6655 100644
--- a/src/code/z_fbdemo_triforce.c
+++ b/src/code/z_fbdemo_triforce.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
Gfx sTriforceDList[] = {
gsDPPipeSync(),
diff --git a/src/code/z_fbdemo_wipe1.c b/src/code/z_fbdemo_wipe1.c
index 93b3a9511..3c0456cce 100644
--- a/src/code/z_fbdemo_wipe1.c
+++ b/src/code/z_fbdemo_wipe1.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
Vtx sWipeVtx[] = {
VTX(-1299, 750, 0, 13653, 2048, 0xAD, 0x30, 0xB8, 0xFF), VTX(-750, 1299, 0, 15019, 2048, 0xD0, 0x53, 0xB8, 0xFF),
diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c
index 7e3500fc1..e5aa09dd9 100644
--- a/src/code/z_fcurve_data_skelanime.c
+++ b/src/code/z_fcurve_data_skelanime.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void SkelCurve_Clear(SkelAnimeCurve* skelCurve) {
skelCurve->limbCount = 0;
diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c
index c7bfa9dd6..d54364068 100644
--- a/src/code/z_game_dlftbls.c
+++ b/src/code/z_game_dlftbls.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
#define GAMESTATE_OVERLAY(name, init, destroy, size) \
{ \
diff --git a/src/code/z_horse.c b/src/code/z_horse.c
index 3764530dd..3d02e175e 100644
--- a/src/code/z_horse.c
+++ b/src/code/z_horse.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
s32 func_8006CFC0(s32 scene) {
s32 validScenes[] = { SCENE_SPOT00, SCENE_SPOT06, SCENE_SPOT09, SCENE_SPOT12, SCENE_SPOT20 };
diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c
index ee92e02cf..019f68216 100644
--- a/src/code/z_jpeg.c
+++ b/src/code/z_jpeg.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
#define MARKER_SOI 0xD8
#define MARKER_SOF 0xC0
diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c
index 861b81861..6f80b3ae1 100644
--- a/src/code/z_kaleido_manager.c
+++ b/src/code/z_kaleido_manager.c
@@ -1,5 +1,5 @@
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
#define KALEIDO_OVERLAY(name) \
{ \
diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c
index d7f42b724..09eee556b 100644
--- a/src/code/z_kaleido_scope_call.c
+++ b/src/code/z_kaleido_scope_call.c
@@ -1,9 +1,9 @@
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
void (*sKaleidoScopeUpdateFunc)(GlobalContext*);
void (*sKaleidoScopeDrawFunc)(GlobalContext*);
-float D_80161398;
+f32 D_80161398;
u32 D_8016139C;
void* D_801613A0;
diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c
index ce5513bb4..10140553e 100644
--- a/src/code/z_kaleido_setup.c
+++ b/src/code/z_kaleido_setup.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
s16 sKaleidoSetupKscpPos0[] = {
2,
@@ -48,11 +48,11 @@ void KaleidoSetup_Update(GlobalContext* globalCtx) {
gSaveContext.unk_13F0 != 8 && gSaveContext.unk_13F0 != 9 &&
(globalCtx->sceneNum != SCENE_BOWLING || !Flags_GetSwitch(globalCtx, 0x38))) {
- if (CHECK_PAD(input->cur, L_TRIG) && CHECK_PAD(input->press, U_CBUTTONS)) {
+ if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
if (BREG(0)) {
pauseCtx->flag = 3;
}
- } else if (CHECK_PAD(input->press, START_BUTTON)) {
+ } else if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
gSaveContext.unk_13EE = gSaveContext.unk_13EA;
WREG(16) = -0xAF;
WREG(17) = 0x9B;
diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c
index fc2c0b1e8..272c235f3 100644
--- a/src/code/z_kanfont.c
+++ b/src/code/z_kanfont.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kanfont/func_8006EE60.s")
diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c
index 7caa221e5..70b8e2c31 100644
--- a/src/code/z_kankyo.c
+++ b/src/code/z_kankyo.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_8006F0A0.s")
diff --git a/src/code/z_lib.c b/src/code/z_lib.c
index 01ea0ef86..a69770ca2 100644
--- a/src/code/z_lib.c
+++ b/src/code/z_lib.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void Lib_MemSet(u8* dest, size_t size, u8 val) {
u32 i;
@@ -168,8 +167,8 @@ s32 func_80077C6C(f32* pValue, f32 target, f32 incrStep, f32 decrStep) {
}
void func_80077D10(f32* arg0, s16* arg1, Input* input) {
- f32 relX = input->rel.in.x;
- f32 relY = input->rel.in.y;
+ f32 relX = input->rel.stick_x;
+ f32 relY = input->rel.stick_y;
*arg0 = sqrtf(SQ(relX) + SQ(relY));
*arg0 = (60.0f < *arg0) ? 60.0f : *arg0;
diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c
index 9faf69026..64fe2e53e 100644
--- a/src/code/z_lifemeter.c
+++ b/src/code/z_lifemeter.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
extern s16 D_8011FF10[3];
extern s16 D_8011FF24[3];
diff --git a/src/code/z_lights.c b/src/code/z_lights.c
index 5fc5b1b0d..2f6c06a62 100644
--- a/src/code/z_lights.c
+++ b/src/code/z_lights.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#define LIGHTS_BUFFER_SIZE 32
diff --git a/src/code/z_malloc.c b/src/code/z_malloc.c
index ce9b1a599..f992755a1 100644
--- a/src/code/z_malloc.c
+++ b/src/code/z_malloc.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
#define LOG_SEVERITY_NOLOG 0
#define LOG_SEVERITY_ERROR 2
diff --git a/src/code/z_map_data.c b/src/code/z_map_data.c
index b0dbd6cac..f518a124c 100644
--- a/src/code/z_map_data.c
+++ b/src/code/z_map_data.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
static s16 sFloorTexIndexOffset[10][8] = {
{ 0, 0, 0, 0, 2, 4, 6, 8 }, { 0, 0, 0, 0, 0, 0, 0, 2 },
diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c
index 9336c8a85..c409d0cf8 100644
--- a/src/code/z_map_exp.c
+++ b/src/code/z_map_exp.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
MapData* gMapData;
@@ -403,7 +402,7 @@ void Minimap_Draw(GlobalContext* globalCtx) {
}
}
- if (CHECK_PAD(globalCtx->state.input[0].press, L_TRIG) && !Gameplay_InCsMode(globalCtx)) {
+ if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Gameplay_InCsMode(globalCtx)) {
osSyncPrintf("Game_play_demo_mode_check=%d\n", Gameplay_InCsMode(globalCtx));
// clang-format off
if (!R_MINIMAP_TOGGLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &D_801333D4, 4,
@@ -484,7 +483,7 @@ void Minimap_Draw(GlobalContext* globalCtx) {
Minimap_DrawCompassIcons(globalCtx); // Draw icons for the player spawn and current position
}
- if (CHECK_PAD(globalCtx->state.input[0].press, L_TRIG) && !Gameplay_InCsMode(globalCtx)) {
+ if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Gameplay_InCsMode(globalCtx)) {
// clang-format off
if (!R_MINIMAP_TOGGLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &D_801333D4, 4,
&D_801333E0, &D_801333E0, &D_801333E8); }
diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c
index 5597c7711..c8e447f64 100644
--- a/src/code/z_map_mark.c
+++ b/src/code/z_map_mark.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
typedef struct {
/* 0x00 */ void* texture;
diff --git a/src/code/z_message_PAL.c b/src/code/z_message_PAL.c
index b8e443435..1dd79776c 100644
--- a/src/code/z_message_PAL.c
+++ b/src/code/z_message_PAL.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_801069B0.s")
diff --git a/src/code/z_moji.c b/src/code/z_moji.c
index 17886ba8b..42f5704bc 100644
--- a/src/code/z_moji.c
+++ b/src/code/z_moji.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
u32 sFontColorRed = 255;
u32 sFontColorGreen = 255;
diff --git a/src/code/z_msgevent.c b/src/code/z_msgevent.c
index 652d49899..d09ab08d3 100644
--- a/src/code/z_msgevent.c
+++ b/src/code/z_msgevent.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void MsgEvent_SendNullTask() {
s32 pad[4];
diff --git a/src/code/z_olib.c b/src/code/z_olib.c
index c9f278b0b..b4b989929 100644
--- a/src/code/z_olib.c
+++ b/src/code/z_olib.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
/**
* Calculates the distances between `a` and `b`
diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c
index faf7ca6b7..176a11f7a 100644
--- a/src/code/z_onepointdemo.c
+++ b/src/code/z_onepointdemo.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
typedef struct {
/* 0x00 */ u32 unk_00;
diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c
index ca8fc1d22..97ef34dc4 100644
--- a/src/code/z_parameter.c
+++ b/src/code/z_parameter.c
@@ -1,7 +1,5 @@
-#include <ultra64.h>
-#include <ultra64/controller.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
typedef struct {
/* 0x00 */ u8 scene;
@@ -3920,13 +3918,13 @@ void Interface_Update(GlobalContext* globalCtx) {
u16 action;
Input* input = &globalCtx->state.input[2];
- if (CHECK_PAD(input->press, L_JPAD)) {
+ if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) {
gSaveContext.language = 0;
osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
- } else if (CHECK_PAD(input->press, U_JPAD)) {
+ } else if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) {
gSaveContext.language = 1;
osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
- } else if (CHECK_PAD(input->press, R_JPAD)) {
+ } else if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)) {
gSaveContext.language = 2;
osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
}
diff --git a/src/code/z_path.c b/src/code/z_path.c
index 03dc6d6f6..f9bcac084 100644
--- a/src/code/z_path.c
+++ b/src/code/z_path.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
Path* Path_GetByIndex(GlobalContext* globalCtx, s16 index, s16 max) {
Path* path;
diff --git a/src/code/z_play.c b/src/code/z_play.c
index 20c2567bd..29cad2538 100644
--- a/src/code/z_play.c
+++ b/src/code/z_play.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
void* D_8012D1F0 = NULL;
UNK_TYPE D_8012D1F4 = 0; // unused
@@ -921,7 +920,7 @@ void Gameplay_Update(GlobalContext* globalCtx) {
}
if (globalCtx->unk_1242B != 0) {
- if (CHECK_PAD(input[0].press, U_CBUTTONS)) {
+ if (CHECK_BTN_ALL(input[0].press.button, BTN_CUP)) {
if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.flag != 0)) {
// Translates to: "Changing viewpoint is prohibited due to the kaleidoscope"
osSyncPrintf(VT_FGCOL(CYAN) "カレイドスコープ中につき視点変更を禁止しております\n" VT_RST);
diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c
index e408cc989..616f1e4b3 100644
--- a/src/code/z_player_call.c
+++ b/src/code/z_player_call.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
#define FLAGS 0x06000035
diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c
index 7bdacf68b..e5a87bb78 100644
--- a/src/code/z_player_lib.c
+++ b/src/code/z_player_lib.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
typedef struct {
/* 0x00 */ u8 flag;
diff --git a/src/code/z_prenmi.c b/src/code/z_prenmi.c
index eeae441ce..678e393b0 100644
--- a/src/code/z_prenmi.c
+++ b/src/code/z_prenmi.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
void func_80092320(PreNMIContext* prenmiCtx) {
prenmiCtx->state.running = false;
diff --git a/src/code/z_prenmi_buff.c b/src/code/z_prenmi_buff.c
index 9c5924bc9..340309e69 100644
--- a/src/code/z_prenmi_buff.c
+++ b/src/code/z_prenmi_buff.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#define COLD_RESET 0
#define NMI 1
diff --git a/src/code/z_quake.c b/src/code/z_quake.c
index e8f31aa57..9869fa6fb 100644
--- a/src/code/z_quake.c
+++ b/src/code/z_quake.c
@@ -1,5 +1,5 @@
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
QuakeRequest sQuakeRequest[4];
s16 D_80126250 = 1;
diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c
index 93fb38469..7af688f2e 100644
--- a/src/code/z_rcp.c
+++ b/src/code/z_rcp.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
Gfx sSetupDL[] = {
/* 0x00 */
diff --git a/src/code/z_room.c b/src/code/z_room.c
index 388c41b74..9dbb12203 100644
--- a/src/code/z_room.c
+++ b/src/code/z_room.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags);
void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags);
diff --git a/src/code/z_sample.c b/src/code/z_sample.c
index 59ad5a59b..d5383b373 100644
--- a/src/code/z_sample.c
+++ b/src/code/z_sample.c
@@ -1,9 +1,7 @@
-#include <ultra64.h>
-#include <ultra64/controller.h>
-#include <global.h>
+#include "global.h"
void Sample_HandleStateChange(SampleContext* this) {
- if (CHECK_PAD(this->state.input[0].press, START_BUTTON)) {
+ if (CHECK_BTN_ALL(this->state.input[0].press.button, BTN_START)) {
SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext);
this->state.running = false;
}
diff --git a/src/code/z_scene.c b/src/code/z_scene.c
index 733d08fa4..04bcb358c 100644
--- a/src/code/z_scene.c
+++ b/src/code/z_scene.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
RomFile sNaviMsgFiles[];
diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c
index 4473697d3..0ddb3ca5b 100644
--- a/src/code/z_scene_table.c
+++ b/src/code/z_scene_table.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#define ENTRANCE(scene, spawn, continueBgm, displayTitleCard, fadeIn, fadeOut) \
{ \
diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c
index 2bccd4db1..a890c9a7f 100644
--- a/src/code/z_skelanime.c
+++ b/src/code/z_skelanime.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
s32 func_800A3D70(GlobalContext*, SkelAnime*);
s32 func_800A3E0C(GlobalContext*, SkelAnime*);
diff --git a/src/code/z_skin.c b/src/code/z_skin.c
index ca907bb17..9d8f9004f 100644
--- a/src/code/z_skin.c
+++ b/src/code/z_skin.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_800A57C0.s")
diff --git a/src/code/z_skin_awb.c b/src/code/z_skin_awb.c
index 4e4530025..b506d002f 100644
--- a/src/code/z_skin_awb.c
+++ b/src/code/z_skin_awb.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_awb/func_800A6460.s")
diff --git a/src/code/z_skin_matrix.c b/src/code/z_skin_matrix.c
index 9920fe76e..62513bc0e 100644
--- a/src/code/z_skin_matrix.c
+++ b/src/code/z_skin_matrix.c
@@ -1,6 +1,5 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
// clang-format off
MtxF sMtxFClear = {
diff --git a/src/code/z_sram.c b/src/code/z_sram.c
index 0f2bcaa64..06517245f 100644
--- a/src/code/z_sram.c
+++ b/src/code/z_sram.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A81A0.s")
diff --git a/src/code/z_view.c b/src/code/z_view.c
index 5ef8808de..5807cc0fb 100644
--- a/src/code/z_view.c
+++ b/src/code/z_view.c
@@ -1,8 +1,7 @@
-#include <ultra64.h>
-#include <global.h>
-#include <vt.h>
+#include "global.h"
+#include "vt.h"
-volatile u32 D_8012ABF0 = true;
+vu32 D_8012ABF0 = true;
void View_ViewportToVp(Vp* dest, Viewport* src) {
s32 width = src->rightX - src->leftX;
diff --git a/src/code/z_vimode.c b/src/code/z_vimode.c
index 1fa3ba452..0dedd0792 100644
--- a/src/code/z_vimode.c
+++ b/src/code/z_vimode.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vimode/func_800AC030.s")
diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c
index 112f64c00..be0600ba1 100644
--- a/src/code/z_vismono.c
+++ b/src/code/z_vismono.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
// (Note: 80 = SCREEN_HEIGHT/3, see VisMono_DrawTexture)
// Did the devs forget to update this? 1+1+1+80*(7+2+2+3)+1+1 makes more sense
diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c
index 8008c6aca..09c872365 100644
--- a/src/code/z_vr_box.c
+++ b/src/code/z_vr_box.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box/func_800ADBB0.s")
diff --git a/src/code/z_vr_box_draw.c b/src/code/z_vr_box_draw.c
index b8cd7f336..f08feaf92 100644
--- a/src/code/z_vr_box_draw.c
+++ b/src/code/z_vr_box_draw.c
@@ -1,4 +1,4 @@
-#include <global.h>
+#include "global.h"
Mtx* sSkyboxDrawMatrix;