From dd48d34270d8938bfceb87e2649284ae52cb7a32 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 12 Aug 2024 01:34:05 +0200 Subject: [PATCH 01/33] Update c_cpp_properties.json for VSCode (#2033) --- docs/c_cpp_properties.json | 173 ++++++++++++++++++++++++++++++++++--- docs/vscode.md | 5 +- 2 files changed, 164 insertions(+), 14 deletions(-) diff --git a/docs/c_cpp_properties.json b/docs/c_cpp_properties.json index ed8c0feaae..64e468330b 100644 --- a/docs/c_cpp_properties.json +++ b/docs/c_cpp_properties.json @@ -1,5 +1,90 @@ { "configurations": [ + { + "name": "oot-ntsc-1.2", + "compilerArgs": [ + "-m32" + ], + "includePath": [ + "include", + "include/libc", + "src", + "build/ntsc-1.2", + ".", + "extracted/ntsc-1.2" + ], + "defines": [ + "_LANGUAGE_C", + "OOT_VERSION=OOT_NTSC_1_2", + "OOT_REGION=REGION_JP", + "PLATFORM_N64=1", + "PLATFORM_GC=0", + "OOT_NTSC=1", + "OOT_MQ=0", + "OOT_DEBUG=0", + "NDEBUG", + "F3DEX_GBI_2" + ], + "cStandard": "gnu89" + }, + { + "name": "oot-gc-jp", + "compilerArgs": [ + "-m32" + ], + "includePath": [ + "include", + "include/libc", + "src", + "build/gc-jp", + ".", + "extracted/gc-jp" + ], + "defines": [ + "_LANGUAGE_C", + "OOT_VERSION=OOT_GC_JP", + "OOT_REGION=REGION_JP", + "PLATFORM_N64=0", + "PLATFORM_GC=1", + "OOT_NTSC=1", + "OOT_MQ=0", + "OOT_DEBUG=0", + "NDEBUG", + "F3DEX_GBI_2", + "F3DEX_GBI_PL", + "GBI_DOWHILE" + ], + "cStandard": "gnu89" + }, + { + "name": "oot-gc-jp-mq", + "compilerArgs": [ + "-m32" + ], + "includePath": [ + "include", + "include/libc", + "src", + "build/gc-jp-mq", + ".", + "extracted/gc-jp-mq" + ], + "defines": [ + "_LANGUAGE_C", + "OOT_VERSION=OOT_GC_JP_MQ", + "OOT_REGION=REGION_JP", + "PLATFORM_N64=0", + "PLATFORM_GC=1", + "OOT_NTSC=1", + "OOT_MQ=1", + "OOT_DEBUG=0", + "NDEBUG", + "F3DEX_GBI_2", + "F3DEX_GBI_PL", + "GBI_DOWHILE" + ], + "cStandard": "gnu89" + }, { "name": "oot-gc-us", "compilerArgs": [ @@ -17,6 +102,8 @@ "_LANGUAGE_C", "OOT_VERSION=OOT_GC_US", "OOT_REGION=REGION_US", + "PLATFORM_N64=0", + "PLATFORM_GC=1", "OOT_NTSC=1", "OOT_MQ=0", "OOT_DEBUG=0", @@ -27,6 +114,64 @@ ], "cStandard": "gnu89" }, + { + "name": "oot-gc-us-mq", + "compilerArgs": [ + "-m32" + ], + "includePath": [ + "include", + "include/libc", + "src", + "build/gc-us-mq", + ".", + "extracted/gc-us-mq" + ], + "defines": [ + "_LANGUAGE_C", + "OOT_VERSION=OOT_GC_US_MQ", + "OOT_REGION=REGION_US", + "PLATFORM_N64=0", + "PLATFORM_GC=1", + "OOT_NTSC=1", + "OOT_MQ=1", + "OOT_DEBUG=0", + "NDEBUG", + "F3DEX_GBI_2", + "F3DEX_GBI_PL", + "GBI_DOWHILE" + ], + "cStandard": "gnu89" + }, + { + "name": "oot-gc-eu-mq-dbg", + "compilerArgs": [ + "-m32" + ], + "includePath": [ + "include", + "include/libc", + "src", + "build/gc-eu-mq-dbg", + ".", + "extracted/gc-eu-mq-dbg" + ], + "defines": [ + "_LANGUAGE_C", + "OOT_VERSION=OOT_GC_EU_MQ_DBG", + "OOT_REGION=REGION_EU", + "PLATFORM_N64=0", + "PLATFORM_GC=1", + "OOT_PAL=1", + "OOT_MQ=1", + "OOT_DEBUG=1", + "F3DEX_GBI_2", + "F3DEX_GBI_PL", + "GBI_DOWHILE", + "GBI_DEBUG" + ], + "cStandard": "gnu89" + }, { "name": "oot-gc-eu", "compilerArgs": [ @@ -44,6 +189,8 @@ "_LANGUAGE_C", "OOT_VERSION=OOT_GC_EU", "OOT_REGION=REGION_EU", + "PLATFORM_N64=0", + "PLATFORM_GC=1", "OOT_PAL=1", "OOT_MQ=0", "OOT_DEBUG=0", @@ -71,6 +218,8 @@ "_LANGUAGE_C", "OOT_VERSION=OOT_GC_EU_MQ", "OOT_REGION=REGION_EU", + "PLATFORM_N64=0", + "PLATFORM_GC=1", "OOT_PAL=1", "OOT_MQ=1", "OOT_DEBUG=0", @@ -82,7 +231,7 @@ "cStandard": "gnu89" }, { - "name": "oot-gc-eu-mq-dbg", + "name": "oot-gc-jp-ce", "compilerArgs": [ "-m32" ], @@ -90,24 +239,26 @@ "include", "include/libc", "src", - "build/gc-eu-mq-dbg", + "build/gc-jp-ce", ".", - "extracted/gc-eu-mq-dbg" + "extracted/gc-jp-ce" ], "defines": [ "_LANGUAGE_C", - "OOT_VERSION=OOT_GC_EU_MQ_DBG", - "OOT_REGION=REGION_EU", - "OOT_PAL=1", - "OOT_MQ=1", - "OOT_DEBUG=1", + "OOT_VERSION=OOT_GC_JP_CE", + "OOT_REGION=REGION_JP", + "PLATFORM_N64=0", + "PLATFORM_GC=1", + "OOT_NTSC=1", + "OOT_MQ=0", + "OOT_DEBUG=0", + "NDEBUG", "F3DEX_GBI_2", "F3DEX_GBI_PL", - "GBI_DOWHILE", - "GBI_DEBUG" + "GBI_DOWHILE" ], "cStandard": "gnu89" - } + }, ], "version": 4 } diff --git a/docs/vscode.md b/docs/vscode.md index c5cd0fc2ea..a50f3c53a8 100644 --- a/docs/vscode.md +++ b/docs/vscode.md @@ -46,11 +46,9 @@ A more complete `c_cpp_properties.json` with configurations for all supported ve "configurations": [ { "name": "oot-gc-eu-mq-dbg", - "compilerPath": "${default}", // Needs to not be "" for -m32 to work "compilerArgs": [ "-m32" // Removes integer truncation warnings with gbi macros ], - "intelliSenseMode": "${default}", // Shouldn't matter "includePath": [ // Matches makefile's includes "include", "include/libc", @@ -64,6 +62,8 @@ A more complete `c_cpp_properties.json` with configurations for all supported ve // Version-specific "OOT_VERSION=OOT_GC_EU_MQ_DBG", "OOT_REGION=REGION_EU", + "PLATFORM_N64=0", + "PLATFORM_GC=1", "OOT_PAL=1", "OOT_MQ=1", "OOT_DEBUG=1", @@ -73,7 +73,6 @@ A more complete `c_cpp_properties.json` with configurations for all supported ve "GBI_DEBUG" ], "cStandard": "gnu89", // C89 + some GNU extensions from C99 like C++ comments - "cppStandard": "${default}" // Only ZAPD uses C++, so doesn't really matter } ], "version": 4 From 672728455d2ab5f46953660189523336acf5075d Mon Sep 17 00:00:00 2001 From: Yanis <35189056+Yanis42@users.noreply.github.com> Date: Mon, 12 Aug 2024 03:12:27 +0200 Subject: [PATCH 02/33] Match ``z_fbdemo.c`` and ``z_fbdemo_fade.c`` for NTSC-1.2 (#2031) * matched ntsc-1.2 fbdemo/fbdemo_fade * remove ifdef for fbdemo * remove macro for 's match --- src/code/z_fbdemo.c | 2 +- src/code/z_fbdemo_fade.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/code/z_fbdemo.c b/src/code/z_fbdemo.c index 1a3916ffa0..a2b0fb8bf1 100644 --- a/src/code/z_fbdemo.c +++ b/src/code/z_fbdemo.c @@ -90,8 +90,8 @@ void TransitionTile_InitGraphics(TransitionTile* this) { for (row = 0; row < this->rows; row++) { gSPVertex(gfx++, SEGMENT_ADDR(0xA, (u32)row * (this->cols + 1) * sizeof(Vtx)), 2 * (this->cols + 1), 0); - colTex = 0; col2 = 0; + colTex = 0; col = 0; while (col < this->cols) { gDPPipeSync(gfx++); diff --git a/src/code/z_fbdemo_fade.c b/src/code/z_fbdemo_fade.c index 1f0843176d..171df77883 100644 --- a/src/code/z_fbdemo_fade.c +++ b/src/code/z_fbdemo_fade.c @@ -101,7 +101,12 @@ void TransitionFade_Draw(void* thisx, Gfx** gfxP) { Gfx* gfx; Color_RGBA8_u32* color = &this->color; - if (color->a > 0) { +#if PLATFORM_N64 + if (color->a != 0) +#else + if (color->a > 0) +#endif + { gfx = *gfxP; gSPDisplayList(gfx++, sTransFadeSetupDL); gDPSetPrimColor(gfx++, 0, 0, color->r, color->g, color->b, color->a); From e6bc4bd8cb66b2e7b946829b3892fd0d2967fde3 Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 12 Aug 2024 00:07:48 -0700 Subject: [PATCH 03/33] Add names to all typedef'd structs, unions, and enums (#2028) * Add names to all typedef'd structs, unions, and enums * wtf vs code * Use a better regex --- include/audiomgr.h | 4 +- include/audiothread_cmd.h | 2 +- include/color.h | 8 +- include/face_change.h | 2 +- include/gfx.h | 8 +- include/gfxprint.h | 2 +- include/ichain.h | 4 +- include/irqmgr.h | 6 +- include/jpeg.h | 16 +- include/message_data_fmt.h | 10 +- include/message_data_static.h | 8 +- include/padmgr.h | 2 +- include/prerender.h | 2 +- include/quake.h | 4 +- include/regs.h | 4 +- include/romfile.h | 2 +- include/rumble.h | 4 +- include/sched.h | 4 +- include/seqcmd.h | 8 +- include/sequence.h | 24 +- include/sfx.h | 12 +- include/speedmeter.h | 2 +- include/tha.h | 2 +- include/thga.h | 2 +- include/ultra64/abi.h | 40 +-- include/ultra64/controller.h | 16 +- include/ultra64/gbi.h | 110 ++++---- include/ultra64/gs2dex.h | 16 +- include/ultra64/gu.h | 4 +- include/ultra64/internal.h | 2 +- include/ultra64/pfs.h | 14 +- include/ultra64/pi.h | 10 +- include/ultra64/rdb.h | 2 +- include/ultra64/sptask.h | 4 +- include/ultra64/thread.h | 8 +- include/ultra64/ultratypes.h | 2 +- include/ultra64/vi.h | 10 +- include/ultra64/xstdio.h | 2 +- include/z64.h | 50 ++-- include/z64actor.h | 38 +-- include/z64animation.h | 46 ++-- include/z64animation_legacy.h | 4 +- include/z64audio.h | 112 ++++---- include/z64bgcheck.h | 46 ++-- include/z64camera.h | 248 +++++++++--------- include/z64collision_check.h | 70 ++--- include/z64curve.h | 10 +- include/z64cutscene.h | 46 ++-- include/z64dma.h | 4 +- include/z64effect.h | 36 +-- include/z64environment.h | 32 +-- include/z64frame_advance.h | 2 +- include/z64game.h | 4 +- include/z64interface.h | 4 +- include/z64item.h | 34 +-- include/z64light.h | 12 +- include/z64map_mark.h | 4 +- include/z64math.h | 30 +-- include/z64message.h | 10 +- include/z64object.h | 6 +- include/z64ocarina.h | 18 +- include/z64pause.h | 12 +- include/z64player.h | 54 ++-- include/z64save.h | 52 ++-- include/z64scene.h | 100 +++---- include/z64skin.h | 14 +- include/z64skybox.h | 6 +- include/z64sram.h | 4 +- include/z64transition.h | 6 +- include/z64transition_instances.h | 20 +- include/z64view.h | 4 +- include/z64vis.h | 14 +- src/audio/general.c | 12 +- src/audio/lib/heap.c | 2 +- src/audio/lib/load.c | 4 +- src/audio/lib/seqplayer.c | 2 +- src/audio/lib/synthesis.c | 2 +- src/audio/sequence.c | 2 +- src/audio/sfx.c | 4 +- src/code/fault.c | 2 +- src/code/fault_drawer.c | 2 +- src/code/flg_set.c | 2 +- src/code/shrink_window.c | 2 +- src/code/speed_meter.c | 4 +- src/code/ucode_disas.c | 12 +- src/code/z_actor.c | 10 +- src/code/z_bgcheck.c | 4 +- src/code/z_camera.c | 2 +- src/code/z_camera_data.inc.c | 6 +- src/code/z_collision_check.c | 8 +- src/code/z_debug.c | 4 +- src/code/z_debug_display.c | 2 +- src/code/z_demo.c | 4 +- src/code/z_draw.c | 2 +- src/code/z_fbdemo_circle.c | 2 +- src/code/z_fbdemo_fade.c | 4 +- src/code/z_fbdemo_wipe1.c | 2 +- src/code/z_fcurve_data_skelanime.c | 2 +- src/code/z_horse.c | 4 +- src/code/z_kankyo.c | 10 +- src/code/z_lights.c | 2 +- src/code/z_map_mark.c | 4 +- src/code/z_parameter.c | 2 +- src/code/z_player_lib.c | 4 +- src/code/z_quake.c | 2 +- src/code/z_room.c | 2 +- src/code/z_ss_sram.c | 2 +- src/code/z_vr_box.c | 2 +- src/libultra/os/initialize.c | 2 +- .../ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c | 4 +- .../ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h | 2 +- .../ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h | 2 +- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.c | 2 +- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.h | 2 +- .../actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c | 2 +- .../actors/ovl_Bg_Dodoago/z_bg_dodoago.h | 2 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 4 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h | 2 +- .../ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c | 2 +- .../ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h | 2 +- .../ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c | 2 +- .../actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h | 2 +- .../ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c | 2 +- .../actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h | 2 +- .../actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c | 2 +- .../ovl_Bg_Heavy_Block/z_bg_heavy_block.h | 2 +- .../ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c | 2 +- .../ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c | 2 +- .../z_bg_hidan_kowarerukabe.c | 2 +- .../ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h | 2 +- .../ovl_Bg_Ice_Turara/z_bg_ice_turara.h | 2 +- .../ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c | 2 +- .../ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h | 2 +- .../ovl_Bg_Jya_Megami/z_bg_jya_megami.c | 2 +- .../ovl_Bg_Jya_Megami/z_bg_jya_megami.h | 2 +- .../ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h | 2 +- .../ovl_Bg_Mizu_Water/z_bg_mizu_water.c | 2 +- .../ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h | 2 +- .../ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c | 2 +- .../ovl_Bg_Relay_Objects/z_bg_relay_objects.c | 2 +- .../z_bg_spot00_hanebasi.c | 2 +- .../ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h | 2 +- .../z_bg_spot06_objects.c | 4 +- .../actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h | 2 +- .../actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.h | 2 +- .../actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h | 2 +- .../actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c | 2 +- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.h | 2 +- src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c | 6 +- src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h | 14 +- src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c | 4 +- src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h | 8 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 4 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.h | 12 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.h | 2 +- .../ovl_Boss_Ganon2/z_boss_ganon2_data.inc.c | 2 +- .../ovl_Boss_Ganondrof/z_boss_ganondrof.c | 10 +- .../ovl_Boss_Ganondrof/z_boss_ganondrof.h | 8 +- .../actors/ovl_Boss_Goma/z_boss_goma.c | 4 +- .../actors/ovl_Boss_Goma/z_boss_goma.h | 2 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 10 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h | 8 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 4 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h | 6 +- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 10 +- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h | 8 +- src/overlays/actors/ovl_Boss_Va/z_boss_va.c | 12 +- src/overlays/actors/ovl_Boss_Va/z_boss_va.h | 2 +- src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c | 4 +- .../actors/ovl_Demo_Effect/z_demo_effect.h | 28 +- src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c | 4 +- src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h | 2 +- src/overlays/actors/ovl_Demo_Im/z_demo_im.h | 2 +- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.h | 4 +- .../actors/ovl_Demo_Kekkai/z_demo_kekkai.h | 2 +- src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c | 4 +- .../actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c | 2 +- .../actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h | 2 +- .../actors/ovl_Door_Killer/z_door_killer.c | 2 +- .../actors/ovl_Door_Killer/z_door_killer.h | 2 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 14 +- .../actors/ovl_Door_Shutter/z_door_shutter.h | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.h | 4 +- .../actors/ovl_Efc_Erupc/z_efc_erupc.h | 2 +- src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h | 2 +- src/overlays/actors/ovl_En_Am/z_en_am.c | 4 +- src/overlays/actors/ovl_En_Am/z_en_am.h | 2 +- .../actors/ovl_En_Anubice/z_en_anubice.c | 2 +- .../actors/ovl_En_Anubice/z_en_anubice.h | 2 +- src/overlays/actors/ovl_En_Arrow/z_en_arrow.h | 2 +- src/overlays/actors/ovl_En_Ba/z_en_ba.h | 2 +- src/overlays/actors/ovl_En_Bb/z_en_bb.c | 10 +- src/overlays/actors/ovl_En_Bb/z_en_bb.h | 2 +- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 2 +- src/overlays/actors/ovl_En_Bili/z_en_bili.h | 4 +- src/overlays/actors/ovl_En_Bom/z_en_bom.h | 2 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 2 +- src/overlays/actors/ovl_En_Bombf/z_en_bombf.h | 2 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 2 +- src/overlays/actors/ovl_En_Box/z_en_box.h | 2 +- src/overlays/actors/ovl_En_Butte/z_en_butte.c | 2 +- src/overlays/actors/ovl_En_Bw/z_en_bw.h | 2 +- .../actors/ovl_En_Changer/z_en_changer.c | 2 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.h | 12 +- src/overlays/actors/ovl_En_Cow/z_en_cow.h | 4 +- src/overlays/actors/ovl_En_Cs/z_en_cs.c | 2 +- src/overlays/actors/ovl_En_Daiku/z_en_daiku.c | 6 +- .../z_en_daiku_kakariko.c | 4 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 2 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.h | 2 +- src/overlays/actors/ovl_En_Dh/z_en_dh.c | 2 +- src/overlays/actors/ovl_En_Dh/z_en_dh.h | 2 +- .../ovl_En_Diving_Game/z_en_diving_game.h | 4 +- src/overlays/actors/ovl_En_Dns/z_en_dns.h | 8 +- .../actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c | 2 +- .../actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h | 10 +- .../actors/ovl_En_Dodongo/z_en_dodongo.c | 2 +- .../actors/ovl_En_Dodongo/z_en_dodongo.h | 2 +- src/overlays/actors/ovl_En_Dog/z_en_dog.c | 4 +- src/overlays/actors/ovl_En_Door/z_en_door.c | 4 +- src/overlays/actors/ovl_En_Door/z_en_door.h | 2 +- src/overlays/actors/ovl_En_Du/z_en_du.c | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.h | 2 +- .../actors/ovl_En_Encount1/z_en_encount1.h | 2 +- .../actors/ovl_En_Encount2/z_en_encount2.c | 2 +- .../actors/ovl_En_Encount2/z_en_encount2.h | 2 +- .../actors/ovl_En_Ex_Item/z_en_ex_item.h | 2 +- .../actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c | 2 +- src/overlays/actors/ovl_En_Fd/z_en_fd.c | 2 +- src/overlays/actors/ovl_En_Fd/z_en_fd.h | 4 +- .../actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c | 6 +- .../actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h | 8 +- .../actors/ovl_En_Fire_Rock/z_en_fire_rock.h | 2 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 2 +- .../actors/ovl_En_Firefly/z_en_firefly.h | 2 +- src/overlays/actors/ovl_En_Fish/z_en_fish.h | 2 +- src/overlays/actors/ovl_En_Fr/z_en_fr.c | 4 +- src/overlays/actors/ovl_En_Fr/z_en_fr.h | 4 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 2 +- src/overlays/actors/ovl_En_Fu/z_en_fu.h | 2 +- src/overlays/actors/ovl_En_Fw/z_en_fw.c | 2 +- src/overlays/actors/ovl_En_Fw/z_en_fw.h | 2 +- src/overlays/actors/ovl_En_Fz/z_en_fz.h | 2 +- .../actors/ovl_En_G_Switch/z_en_g_switch.c | 2 +- .../actors/ovl_En_G_Switch/z_en_g_switch.h | 6 +- .../ovl_En_Ganon_Mant/z_en_ganon_mant.c | 2 +- .../ovl_En_Ganon_Mant/z_en_ganon_mant.h | 2 +- src/overlays/actors/ovl_En_Gb/z_en_gb.h | 4 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 2 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.h | 4 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 4 +- src/overlays/actors/ovl_En_GeldB/z_en_geldb.c | 4 +- src/overlays/actors/ovl_En_GeldB/z_en_geldb.h | 2 +- src/overlays/actors/ovl_En_GirlA/z_en_girla.c | 2 +- src/overlays/actors/ovl_En_GirlA/z_en_girla.h | 4 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.h | 2 +- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 2 +- src/overlays/actors/ovl_En_Go2/z_en_go2.h | 8 +- src/overlays/actors/ovl_En_Goma/z_en_goma.h | 4 +- src/overlays/actors/ovl_En_Hata/z_en_hata.h | 4 +- .../actors/ovl_En_Heishi4/z_en_heishi4.h | 2 +- src/overlays/actors/ovl_En_Holl/z_en_holl.h | 2 +- .../actors/ovl_En_Honotrap/z_en_honotrap.c | 2 +- .../actors/ovl_En_Honotrap/z_en_honotrap.h | 4 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 10 +- src/overlays/actors/ovl_En_Horse/z_en_horse.h | 8 +- .../z_en_horse_game_check.c | 4 +- .../z_en_horse_game_check.h | 2 +- .../ovl_En_Horse_Ganon/z_en_horse_ganon.c | 2 +- .../ovl_En_Horse_Normal/z_en_horse_normal.c | 6 +- .../ovl_En_Horse_Zelda/z_en_horse_zelda.c | 2 +- src/overlays/actors/ovl_En_Hy/z_en_hy.c | 18 +- src/overlays/actors/ovl_En_Hy/z_en_hy.h | 2 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 6 +- src/overlays/actors/ovl_En_Ik/z_en_ik.h | 6 +- src/overlays/actors/ovl_En_In/z_en_in.c | 2 +- src/overlays/actors/ovl_En_In/z_en_in.h | 2 +- .../actors/ovl_En_Insect/z_en_insect.h | 2 +- src/overlays/actors/ovl_En_Ishi/z_en_ishi.h | 2 +- src/overlays/actors/ovl_En_Jj/z_en_jj.c | 2 +- src/overlays/actors/ovl_En_Jj/z_en_jj.h | 2 +- .../actors/ovl_En_Jsjutan/z_en_jsjutan.h | 2 +- .../actors/ovl_En_Kanban/z_en_kanban.c | 6 +- src/overlays/actors/ovl_En_Ko/z_en_ko.c | 12 +- src/overlays/actors/ovl_En_Ko/z_en_ko.h | 4 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.h | 2 +- src/overlays/actors/ovl_En_Kz/z_en_kz.c | 2 +- src/overlays/actors/ovl_En_Light/z_en_light.c | 2 +- src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 2 +- src/overlays/actors/ovl_En_Ma2/z_en_ma2.c | 2 +- src/overlays/actors/ovl_En_Ma2/z_en_ma2.h | 2 +- src/overlays/actors/ovl_En_Ma3/z_en_ma3.c | 2 +- src/overlays/actors/ovl_En_Ma3/z_en_ma3.h | 2 +- src/overlays/actors/ovl_En_Mag/z_en_mag.h | 2 +- src/overlays/actors/ovl_En_Mb/z_en_mb.c | 6 +- src/overlays/actors/ovl_En_Mb/z_en_mb.h | 2 +- src/overlays/actors/ovl_En_Md/z_en_md.c | 2 +- src/overlays/actors/ovl_En_Md/z_en_md.h | 2 +- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 6 +- src/overlays/actors/ovl_En_Mm2/z_en_mm2.c | 4 +- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 4 +- src/overlays/actors/ovl_En_Nb/z_en_nb.h | 4 +- src/overlays/actors/ovl_En_Niw/z_en_niw.h | 2 +- .../actors/ovl_En_Nutsball/z_en_nutsball.h | 2 +- src/overlays/actors/ovl_En_Nwc/z_en_nwc.c | 2 +- src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 4 +- src/overlays/actors/ovl_En_Ossan/z_en_ossan.h | 8 +- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 4 +- .../actors/ovl_En_Peehat/z_en_peehat.c | 4 +- .../actors/ovl_En_Peehat/z_en_peehat.h | 2 +- .../actors/ovl_En_Po_Field/z_en_po_field.h | 4 +- src/overlays/actors/ovl_En_Poh/z_en_poh.h | 6 +- src/overlays/actors/ovl_En_Rd/z_en_rd.c | 6 +- src/overlays/actors/ovl_En_Rd/z_en_rd.h | 4 +- src/overlays/actors/ovl_En_Reeba/z_en_reeba.c | 2 +- src/overlays/actors/ovl_En_Reeba/z_en_reeba.h | 2 +- .../ovl_En_River_Sound/z_en_river_sound.h | 2 +- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 6 +- src/overlays/actors/ovl_En_Rr/z_en_rr.h | 2 +- src/overlays/actors/ovl_En_Ru1/z_en_ru1.h | 2 +- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 8 +- src/overlays/actors/ovl_En_Sb/z_en_sb.c | 2 +- .../actors/ovl_En_Siofuki/z_en_siofuki.h | 2 +- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 2 +- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 10 +- src/overlays/actors/ovl_En_Ssh/z_en_ssh.c | 2 +- src/overlays/actors/ovl_En_St/z_en_st.c | 2 +- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 2 +- .../ovl_En_Syateki_Itm/z_en_syateki_itm.c | 2 +- .../ovl_En_Syateki_Itm/z_en_syateki_itm.h | 4 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 4 +- .../ovl_En_Syateki_Niw/z_en_syateki_niw.h | 4 +- src/overlays/actors/ovl_En_Ta/z_en_ta.c | 4 +- src/overlays/actors/ovl_En_Ta/z_en_ta.h | 4 +- src/overlays/actors/ovl_En_Test/z_en_test.c | 2 +- src/overlays/actors/ovl_En_Test/z_en_test.h | 4 +- src/overlays/actors/ovl_En_Tite/z_en_tite.c | 6 +- src/overlays/actors/ovl_En_Tite/z_en_tite.h | 2 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 2 +- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 4 +- src/overlays/actors/ovl_En_Tp/z_en_tp.h | 2 +- src/overlays/actors/ovl_En_Tr/z_en_tr.h | 4 +- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 2 +- src/overlays/actors/ovl_En_Vali/z_en_vali.h | 4 +- .../actors/ovl_En_Viewer/z_en_viewer.h | 12 +- src/overlays/actors/ovl_En_Vm/z_en_vm.h | 2 +- .../actors/ovl_En_Wallmas/z_en_wallmas.h | 2 +- .../ovl_En_Weather_Tag/z_en_weather_tag.h | 2 +- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 2 +- src/overlays/actors/ovl_En_Wf/z_en_wf.h | 6 +- .../ovl_En_Wonder_Item/z_en_wonder_item.h | 4 +- .../actors/ovl_En_Wood02/z_en_wood02.c | 4 +- .../actors/ovl_En_Wood02/z_en_wood02.h | 2 +- src/overlays/actors/ovl_En_Xc/z_en_xc.h | 6 +- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 2 +- src/overlays/actors/ovl_En_Zf/z_en_zf.h | 6 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 10 +- src/overlays/actors/ovl_En_Zo/z_en_zo.c | 4 +- src/overlays/actors/ovl_En_Zo/z_en_zo.h | 2 +- src/overlays/actors/ovl_En_fHG/z_en_fhg.c | 4 +- src/overlays/actors/ovl_En_fHG/z_en_fhg.h | 2 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 20 +- .../ovl_Item_Etcetera/z_item_etcetera.h | 2 +- .../actors/ovl_Magic_Fire/z_magic_fire.c | 4 +- src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c | 2 +- src/overlays/actors/ovl_Mir_Ray/z_mir_ray.h | 4 +- src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c | 2 +- src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c | 2 +- src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c | 2 +- .../ovl_Obj_Lightswitch/z_obj_lightswitch.c | 2 +- .../ovl_Obj_Lightswitch/z_obj_lightswitch.h | 2 +- .../ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c | 2 +- src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c | 4 +- .../actors/ovl_Obj_Mure2/z_obj_mure2.c | 2 +- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h | 2 +- .../actors/ovl_Obj_Switch/z_obj_switch.h | 8 +- .../ovl_Obj_Timeblock/z_obj_timeblock.c | 2 +- .../ovl_Obj_Warp2block/z_obj_warp2block.c | 2 +- .../actors/ovl_Oceff_Wipe/z_oceff_wipe.h | 2 +- .../actors/ovl_Oceff_Wipe4/z_oceff_wipe4.h | 2 +- src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 2 +- .../actors/ovl_player_actor/z_player.c | 36 +-- .../ovl_Effect_Ss_Blast/z_eff_ss_blast.h | 2 +- .../ovl_Effect_Ss_Bomb/z_eff_ss_bomb.h | 2 +- .../ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h | 2 +- .../ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h | 2 +- .../ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h | 2 +- .../ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h | 2 +- .../ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h | 2 +- .../ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h | 2 +- .../z_eff_ss_dead_sound.h | 2 +- .../z_eff_ss_dt_bubble.h | 2 +- .../ovl_Effect_Ss_Dust/z_eff_ss_dust.h | 2 +- .../ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c | 4 +- .../ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h | 2 +- .../ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h | 2 +- .../ovl_Effect_Ss_Extra/z_eff_ss_extra.h | 4 +- .../ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.h | 2 +- .../z_eff_ss_fhg_flash.h | 8 +- .../z_eff_ss_fire_tail.h | 2 +- .../ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h | 2 +- .../ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.h | 2 +- .../z_eff_ss_g_magma2.h | 2 +- .../z_eff_ss_g_ripple.h | 2 +- .../ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h | 2 +- .../z_eff_ss_g_splash.h | 2 +- .../ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h | 2 +- .../ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h | 4 +- .../z_eff_ss_ice_piece.h | 2 +- .../z_eff_ss_ice_smoke.h | 2 +- .../ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h | 2 +- .../ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h | 4 +- .../z_eff_ss_kirakira.h | 2 +- .../z_eff_ss_lightning.h | 2 +- .../ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h | 2 +- .../ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.h | 2 +- .../z_eff_ss_solder_srch_ball.h | 2 +- .../ovl_Effect_Ss_Stick/z_eff_ss_stick.c | 2 +- .../ovl_Effect_Ss_Stick/z_eff_ss_stick.h | 2 +- .../ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c | 2 +- .../ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h | 2 +- .../gamestates/ovl_file_choose/file_select.h | 30 +-- .../ovl_file_choose/z_file_nameset.c | 4 +- .../misc/ovl_kaleido_scope/z_lmap_mark.c | 2 +- 426 files changed, 1417 insertions(+), 1417 deletions(-) diff --git a/include/audiomgr.h b/include/audiomgr.h index 036192ce7c..b518c976a5 100644 --- a/include/audiomgr.h +++ b/include/audiomgr.h @@ -4,13 +4,13 @@ #include "sched.h" #include "z64audio.h" -typedef enum { +typedef enum AudioMgrDebugLevel { /* 0 */ AUDIOMGR_DEBUG_LEVEL_NONE, /* 1 */ AUDIOMGR_DEBUG_LEVEL_NO_RSP, /* 2 */ AUDIOMGR_DEBUG_LEVEL_NO_UPDATE } AudioMgrDebugLevel; -typedef struct { +typedef struct AudioMgr { /* 0x0000 */ IrqMgr* irqMgr; /* 0x0004 */ Scheduler* sched; /* 0x0008 */ OSScTask audioTask; diff --git a/include/audiothread_cmd.h b/include/audiothread_cmd.h index ab0ea1c176..c0576b82b3 100644 --- a/include/audiothread_cmd.h +++ b/include/audiothread_cmd.h @@ -6,7 +6,7 @@ * from the external graph thread to the internal audio thread */ -typedef enum { +typedef enum AudioThreadCmdOp { // Channel Commands /* 0x00 */ AUDIOCMD_OP_NOOP, /* 0x01 */ AUDIOCMD_OP_CHANNEL_SET_VOL_SCALE, diff --git a/include/color.h b/include/color.h index 723983f83a..0d6eff3233 100644 --- a/include/color.h +++ b/include/color.h @@ -1,11 +1,11 @@ #ifndef COLOR_H #define COLOR_H -typedef struct { +typedef struct Color_RGB8 { u8 r, g, b; } Color_RGB8; -typedef struct { +typedef struct Color_RGBA8 { u8 r, g, b, a; } Color_RGBA8; @@ -17,11 +17,11 @@ typedef union Color_RGBA8_u32 { u32 rgba; } Color_RGBA8_u32; -typedef struct { +typedef struct Color_RGBAf { f32 r, g, b, a; } Color_RGBAf; -typedef union { +typedef union Color_RGBA16 { struct { u16 r : 5; u16 g : 5; diff --git a/include/face_change.h b/include/face_change.h index 6a5573765a..5a0c8d8566 100644 --- a/include/face_change.h +++ b/include/face_change.h @@ -1,7 +1,7 @@ #ifndef FACE_CHANGE_H #define FACE_CHANGE_H -typedef struct { +typedef struct FaceChange { /* 0x00 */ s16 face; /* 0x02 */ s16 timer; } FaceChange; // size = 0x4 diff --git a/include/gfx.h b/include/gfx.h index a50dd3a196..c68e6a3618 100644 --- a/include/gfx.h +++ b/include/gfx.h @@ -9,7 +9,7 @@ // Texture memory size, 4 KiB #define TMEM_SIZE 0x1000 -typedef struct { +typedef struct GfxPool { /* 0x00000 */ u16 headMagic; // GFXPOOL_HEAD_MAGIC /* 0x00008 */ Gfx polyOpaBuffer[0x17E0]; /* 0x0BF08 */ Gfx polyXluBuffer[0x800]; @@ -51,7 +51,7 @@ typedef struct GraphicsContext { /* 0x02FC */ char unk_2FC[0x04]; } GraphicsContext; // size = 0x300 -typedef enum { +typedef enum SetupDL { /* 0 */ SETUPDL_0, /* 1 */ SETUPDL_1, /* 2 */ SETUPDL_2, @@ -131,12 +131,12 @@ typedef enum { #define UCODE_UNK 2 #define UCODE_S2DEX 3 -typedef struct { +typedef struct UCodeInfo { /* 0x00 */ u32 type; /* 0x04 */ void* ptr; } UCodeInfo; // size = 0x8 -typedef struct { +typedef struct UCodeDisas { /* 0x00 */ uintptr_t segments[NUM_SEGMENTS]; /* 0x40 */ Gfx* dlStack[18]; /* 0x88 */ s32 dlDepth; diff --git a/include/gfxprint.h b/include/gfxprint.h index a5a89af458..647ebf8561 100644 --- a/include/gfxprint.h +++ b/include/gfxprint.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "color.h" -typedef struct { +typedef struct GfxPrint { /* 0x00 */ PrintCallback callback; /* 0x04 */ Gfx* dList; /* 0x08 */ u16 posX; diff --git a/include/ichain.h b/include/ichain.h index 8334237801..a77ed379ad 100644 --- a/include/ichain.h +++ b/include/ichain.h @@ -5,14 +5,14 @@ struct Actor; -typedef struct { +typedef struct InitChainEntry { u32 cont: 1; u32 type: 4; u32 offset: 11; s32 value: 16; } InitChainEntry; -typedef enum { +typedef enum InitChainType { /* 0x0 */ ICHAINTYPE_U8, // sets byte /* 0x1 */ ICHAINTYPE_S8, /* 0x2 */ ICHAINTYPE_U16, // sets short diff --git a/include/irqmgr.h b/include/irqmgr.h index 69a749a494..b931977ab0 100644 --- a/include/irqmgr.h +++ b/include/irqmgr.h @@ -8,13 +8,13 @@ #define OS_SC_NMI_MSG 3 // name is made up, 3 is OS_SC_RDP_DONE_MSG in the original sched.c #define OS_SC_PRE_NMI_MSG 4 -typedef enum { +typedef enum IrqResetStatus { IRQ_RESET_STATUS_IDLE, IRQ_RESET_STATUS_PRENMI, IRQ_RESET_STATUS_NMI } IrqResetStatus; -typedef struct { +typedef struct OSScMsg { /* 0x00 */ s16 type; /* 0x02 */ char misc[0x1E]; } OSScMsg; // size = 0x20 @@ -24,7 +24,7 @@ typedef struct IrqMgrClient { /* 0x04 */ OSMesgQueue* queue; } IrqMgrClient; -typedef struct { +typedef struct IrqMgr { /* 0x000 */ OSScMsg retraceMsg; /* 0x020 */ OSScMsg prenmiMsg; /* 0x040 */ OSScMsg nmiMsg; diff --git a/include/jpeg.h b/include/jpeg.h index 253d797bd4..85b048baf3 100644 --- a/include/jpeg.h +++ b/include/jpeg.h @@ -4,11 +4,11 @@ #include "ultra64.h" #include "sched.h" -typedef struct { +typedef struct JpegQuantizationTable { /* 0x00 */ u16 table[8*8]; } JpegQuantizationTable; // size = 0x80 -typedef struct { +typedef struct JpegHuffmanTable { /* 0x00 */ u8 codeOffs[16]; /* 0x10 */ u16 codesA[16]; /* 0x30 */ u16 codesB[16]; @@ -16,13 +16,13 @@ typedef struct { } JpegHuffmanTable; // size = 0x54 // this struct might be inaccurate but it's not used outside jpegutils.c anyways -typedef struct { +typedef struct JpegHuffmanTableOld { /* 0x000 */ u8 codeOffs[16]; /* 0x010 */ u16 dcCodes[120]; /* 0x100 */ u16 acCodes[256]; } JpegHuffmanTableOld; // size = 0x300 -typedef union { +typedef union JpegTaskData { struct { /* 0x00 */ u32 address; /* 0x04 */ u32 mbCount; @@ -35,7 +35,7 @@ typedef union { long long int force_structure_alignment; } JpegTaskData; // size = 0x20 -typedef struct { +typedef struct JpegWork { /* 0x000 */ JpegTaskData taskData; /* 0x020 */ u64 yieldData[0x200 / sizeof(u64)]; /* 0x220 */ JpegQuantizationTable qTableY; @@ -46,7 +46,7 @@ typedef struct { /* 0x6C0 */ u16 data[4][0x180]; } JpegWork; // size = 0x12C0 -typedef struct { +typedef struct JpegDecoder { /* 0x00 */ void* imageData; /* 0x04 */ u8 mode; /* 0x05 */ u8 unk_05; @@ -54,7 +54,7 @@ typedef struct { /* 0x18 */ u8 unk_18; } JpegDecoder; // size = 0x1C -typedef struct { +typedef struct JpegContext { /* 0x00 */ u8 dqtCount; /* 0x04 */ u8* dqtPtr[3]; /* 0x10 */ u8 dhtCount; @@ -67,7 +67,7 @@ typedef struct { /* 0xB4 */ JpegWork* workBuf; } JpegContext; // size = 0xB8 -typedef struct { +typedef struct JpegDecoderState { /* 0x00 */ u32 byteIdx; /* 0x04 */ u8 bitIdx; /* 0x05 */ u8 dontSkip; diff --git a/include/message_data_fmt.h b/include/message_data_fmt.h index 08e3a49990..ac798d9346 100644 --- a/include/message_data_fmt.h +++ b/include/message_data_fmt.h @@ -111,7 +111,7 @@ * Colors */ -typedef enum { +typedef enum TextColor { TEXT_COLOR_DEFAULT, TEXT_COLOR_RED, TEXT_COLOR_ADJUSTABLE, @@ -126,12 +126,12 @@ typedef enum { * Background */ -typedef enum { +typedef enum TextboxBackgroundIndex { TEXTBOX_BG_X_LEFT, TEXTBOX_BG_X_RIGHT } TextboxBackgroundIndex; -typedef enum { +typedef enum TextboxBackgroundForegroundColor { TEXTBOX_BG_FGCOL_WHITE, TEXTBOX_BG_FGCOL_DARK_RED, TEXTBOX_BG_FGCOL_ORANGE, @@ -142,14 +142,14 @@ typedef enum { TEXTBOX_BG_FGCOL_WHITE_7 } TextboxBackgroundForegroundColor; -typedef enum { +typedef enum TextboxBackgroundBackgroundColor { TEXTBOX_BG_BGCOL_BLACK, TEXTBOX_BG_BGCOL_GOLD, TEXTBOX_BG_BGCOL_BLACK_2, TEXTBOX_BG_BGCOL_BLACK_3 } TextboxBackgroundBackgroundColor; -typedef enum { +typedef enum TextboxBackgroundYOffsetIndex { TEXTBOX_BG_Y_OFFSET_1, TEXTBOX_BG_Y_OFFSET_2 } TextboxBackgroundYOffsetIndex; diff --git a/include/message_data_static.h b/include/message_data_static.h index 4b38aec6b2..6b6824966a 100644 --- a/include/message_data_static.h +++ b/include/message_data_static.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "message_data_fmt.h" -typedef enum { +typedef enum TextBoxType { /* 0 */ TEXTBOX_TYPE_BLACK, /* 1 */ TEXTBOX_TYPE_WOODEN, /* 2 */ TEXTBOX_TYPE_BLUE, @@ -14,18 +14,18 @@ typedef enum { /* 11 */ TEXTBOX_TYPE_CREDITS = 11 } TextBoxType; -typedef enum { +typedef enum TextBoxBackground { /* 0 */ TEXTBOX_BG_CROSS } TextBoxBackground; -typedef enum { +typedef enum TextBoxPosition { /* 0 */ TEXTBOX_POS_VARIABLE, /* 1 */ TEXTBOX_POS_TOP, /* 2 */ TEXTBOX_POS_MIDDLE, /* 3 */ TEXTBOX_POS_BOTTOM } TextBoxPosition; -typedef struct { +typedef struct MessageTableEntry { u16 textId; u8 typePos; const char* segment; diff --git a/include/padmgr.h b/include/padmgr.h index fd58765c06..0e7be4cdad 100644 --- a/include/padmgr.h +++ b/include/padmgr.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "irqmgr.h" -typedef enum { +typedef enum ControllerPakType { CONT_PAK_NONE, CONT_PAK_RUMBLE, CONT_PAK_OTHER diff --git a/include/prerender.h b/include/prerender.h index 12f17f7ed9..ca16826341 100644 --- a/include/prerender.h +++ b/include/prerender.h @@ -8,7 +8,7 @@ typedef struct ListAlloc { /* 0x04 */ struct ListAlloc* next; } ListAlloc; // size = 0x8 -typedef struct { +typedef struct PreRender { /* 0x00 */ s32 width; /* 0x04 */ s32 height; /* 0x08 */ s32 widthSave; diff --git a/include/quake.h b/include/quake.h index a9a33b5288..0d97a5bf45 100644 --- a/include/quake.h +++ b/include/quake.h @@ -4,7 +4,7 @@ #include "z64camera.h" #include "z64math.h" -typedef struct { +typedef struct ShakeInfo { /* 0x00 */ Vec3f atOffset; /* 0x0C */ Vec3f eyeOffset; /* 0x18 */ s16 upPitchOffset; // gives a "roll" effect by offsetting the Up vector @@ -13,7 +13,7 @@ typedef struct { /* 0x20 */ f32 maxOffset; } ShakeInfo; // size = 0x24 -typedef enum { +typedef enum QuakeType { /* 0 */ QUAKE_TYPE_NONE, /* 1 */ QUAKE_TYPE_1, // Periodic, sustaining, random X perturbations /* 2 */ QUAKE_TYPE_2, // Aperiodic, sustaining, random X perturbations diff --git a/include/regs.h b/include/regs.h index 53e8053a71..4f8968a0c4 100644 --- a/include/regs.h +++ b/include/regs.h @@ -243,7 +243,7 @@ #define R_HREG_MODE HREG(80) // see `HRegMode` for mode options -typedef enum { +typedef enum HRegMode { /* 6 */ HREG_MODE_PRINT_HILITE_INFO = 6, // print hilite information /* 7 */ HREG_MODE_UCODE_DISAS, // various controls for the ucode disas system /* 8 */ HREG_MODE_PRINT_MEMORY, // print memory at a specified address @@ -386,7 +386,7 @@ typedef enum { #define R_VI_CUR_ADDI_SCAN_LINES HREG(83) #define R_VI_CUR_Y_SCALE_MODE HREG(84) -typedef struct { +typedef struct RegEditor { /* 0x00 */ s32 regPage; // 0: no page selected (reg editor is not active); 1: first page; `REG_PAGES`: last page /* 0x04 */ s32 regGroup; // Indexed from 0 to `REG_GROUPS`-1. Each group has its own character to identify it. /* 0x08 */ s32 regCur; // Selected reg, indexed from 0 as the page start diff --git a/include/romfile.h b/include/romfile.h index a7022f45f4..49b5f202dc 100644 --- a/include/romfile.h +++ b/include/romfile.h @@ -3,7 +3,7 @@ #include "ultra64.h" -typedef struct { +typedef struct RomFile { /* 0x00 */ uintptr_t vromStart; /* 0x04 */ uintptr_t vromEnd; } RomFile; // size = 0x8 diff --git a/include/rumble.h b/include/rumble.h index 2ce8f4e71a..f8e0b82cb7 100644 --- a/include/rumble.h +++ b/include/rumble.h @@ -5,13 +5,13 @@ #define RUMBLE_MAX_REQUESTS 64 -typedef enum { +typedef enum RumbleState { RUMBLE_STATE_CLEAR, RUMBLE_STATE_RUNNING, RUMBLE_STATE_RESET } RumbleState; -typedef struct { +typedef struct RumbleMgr { /* 0x000 */ u8 rumbleEnable[MAXCONTROLLERS]; /* 0x004 */ u8 reqStrengths[RUMBLE_MAX_REQUESTS]; // Source strength modulated by distance to the source /* 0x044 */ u8 reqDurations[RUMBLE_MAX_REQUESTS]; // Duration until decreaseRate kicks in diff --git a/include/sched.h b/include/sched.h index da946bdce3..86db3e66f7 100644 --- a/include/sched.h +++ b/include/sched.h @@ -19,7 +19,7 @@ #define OS_SC_RCP_MASK (OS_SC_NEEDS_RDP | OS_SC_NEEDS_RSP) #define OS_SC_TYPE_MASK (OS_SC_NEEDS_RDP | OS_SC_NEEDS_RSP | OS_SC_DRAM_DLIST) -typedef struct { +typedef struct CfbInfo { /* 0x00 */ u16* framebuffer; // current framebuffer /* 0x04 */ u16* swapBuffer; // framebuffer to swap to /* 0x08 */ OSViMode* viMode; @@ -43,7 +43,7 @@ typedef struct OSScTask { /* 0x60 */ OSTime totalTime; } OSScTask; // size = 0x68 -typedef struct { +typedef struct Scheduler { /* 0x0000 */ OSMesgQueue interruptQueue; /* 0x0018 */ OSMesg interruptMsgBuf[8]; /* 0x0038 */ OSMesgQueue cmdQueue; // queue for receiving OSScTask pointers diff --git a/include/seqcmd.h b/include/seqcmd.h index f6c42b7014..b351346fee 100644 --- a/include/seqcmd.h +++ b/include/seqcmd.h @@ -5,7 +5,7 @@ #define SEQCMD_OP_MASK 0xF0000000 -typedef enum { +typedef enum SeqCmdOp { /* 0x0 */ SEQCMD_OP_PLAY_SEQUENCE, /* 0x1 */ SEQCMD_OP_STOP_SEQUENCE, /* 0x2 */ SEQCMD_OP_QUEUE_SEQUENCE, @@ -27,7 +27,7 @@ typedef enum { // ==== Secondary commands ==== // Subset of `SEQCMD_OP_TEMPO_CMD` -typedef enum { +typedef enum SeqCmdTempoCmdOp { /* 0x0 */ SEQCMD_SUB_OP_TEMPO_SET, /* 0x1 */ SEQCMD_SUB_OP_TEMPO_SPEED_UP, /* 0x2 */ SEQCMD_SUB_OP_TEMPO_SLOW_DOWN, @@ -36,7 +36,7 @@ typedef enum { } SeqCmdTempoCmdOp; // Subset of `SEQCMD_OP_SETUP_CMD` -typedef enum { +typedef enum SeqCmdSetupCmdOp { /* 0x0 */ SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME, /* 0x1 */ SEQCMD_SUB_OP_SETUP_SEQ_UNQUEUE, /* 0x2 */ SEQCMD_SUB_OP_SETUP_RESTART_SEQ, @@ -53,7 +53,7 @@ typedef enum { } SeqCmdSetupCmdOp; // Subset of `SEQCMD_OP_GLOBAL_CMD` -typedef enum { +typedef enum SeqCmdSubCmdOp { /* 0x0 */ SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE, /* 0x1 */ SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES } SeqCmdSubCmdOp; diff --git a/include/sequence.h b/include/sequence.h index 5f040d1ce9..673242a800 100644 --- a/include/sequence.h +++ b/include/sequence.h @@ -1,7 +1,7 @@ #ifndef SEQUENCE_H #define SEQUENCE_H -typedef enum { +typedef enum SeqId { /* 0x00 */ NA_BGM_GENERAL_SFX, // General Sound Effects /* 0x01 */ NA_BGM_NATURE_AMBIENCE, // Environmental nature background sounds /* 0x02 */ NA_BGM_FIELD_LOGIC, // Hyrule Field @@ -117,21 +117,21 @@ typedef enum { /* 0xFFFF */ NA_BGM_DISABLED = 0xFFFF } SeqId; -typedef enum { +typedef enum SequencePlayerId { /* 0 */ SEQ_PLAYER_BGM_MAIN, /* 1 */ SEQ_PLAYER_FANFARE, /* 2 */ SEQ_PLAYER_SFX, /* 3 */ SEQ_PLAYER_BGM_SUB } SequencePlayerId; -typedef enum { +typedef enum SequenceMode { /* 0 */ SEQ_MODE_DEFAULT, /* 1 */ SEQ_MODE_ENEMY, /* 2 */ SEQ_MODE_STILL, // Not moving or first-person view /* 3 */ SEQ_MODE_IGNORE } SequenceMode; -typedef enum { +typedef enum SequenceCutsceneEffects { /* 0x0 */ SEQ_CS_EFFECTS_SWORD_GLOW, // Master sword glow /* 0x1 */ SEQ_CS_EFFECTS_SHEIK_TRANSFORM, // Sheik's transformation to Zelda /* 0x2 */ SEQ_CS_EFFECTS_SAGE_SEAL, // Sages accumulating their power @@ -150,7 +150,7 @@ typedef enum { /* 0xF */ SEQ_CS_EFFECTS_RAINFALL // Rain with thunder effects } SequenceCutsceneEffects; -typedef enum { +typedef enum ChannelIOPort { /* 0x0 */ CHANNEL_IO_PORT_0, /* 0x1 */ CHANNEL_IO_PORT_1, /* 0x2 */ CHANNEL_IO_PORT_2, @@ -161,7 +161,7 @@ typedef enum { /* 0x7 */ CHANNEL_IO_PORT_7 } ChannelIOPort; -typedef enum { +typedef enum VolumeScaleIndex { /* 0 */ VOL_SCALE_INDEX_BGM_MAIN, /* 1 */ VOL_SCALE_INDEX_FANFARE, /* 2 */ VOL_SCALE_INDEX_SFX, @@ -169,7 +169,7 @@ typedef enum { /* 4 */ VOL_SCALE_INDEX_MAX } VolumeScaleIndex; // May be worth using SequencePlayerId instead -typedef struct { +typedef struct ActiveSequenceChannelData { /* 0x00 */ f32 volCur; /* 0x04 */ f32 volTarget; /* 0x08 */ f32 volStep; @@ -180,7 +180,7 @@ typedef struct { /* 0x1C */ u16 freqScaleTimer; } ActiveSequenceChannelData; // size = 0x20 -typedef struct { +typedef struct ActiveSequence { /* 0x000 */ f32 volCur; /* 0x004 */ f32 volTarget; /* 0x008 */ f32 volStep; @@ -208,7 +208,7 @@ typedef struct { /* 0x260 */ u8 isWaitingForFonts; // This name comes from MM } ActiveSequence; // size = 0x264 -typedef enum { +typedef enum NatureChannelIndex { /* 0x0 */ NATURE_CHANNEL_STREAM_0, /* 0x1 */ NATURE_CHANNEL_CRITTER_0, /* 0x2 */ NATURE_CHANNEL_CRITTER_1, @@ -224,7 +224,7 @@ typedef enum { /* 0xF */ NATURE_CHANNEL_LIGHTNING } NatureChannelIndex; // seqPlayerIndex = 0 (Overlaps with main bgm) -typedef enum { +typedef enum NatureAmbienceId { /* 0x00 */ NATURE_ID_GENERAL_NIGHT, /* 0x01 */ NATURE_ID_MARKET_ENTRANCE, /* 0x02 */ NATURE_ID_KAKARIKO_REGION, @@ -248,14 +248,14 @@ typedef enum { /* 0xFF */ NATURE_ID_DISABLED = 0xFF } NatureAmbienceId; -typedef enum { +typedef enum NatureStreamId { /* 0x00 */ NATURE_STREAM_RUSHING_WATER, /* 0x01 */ NATURE_STREAM_HOWLING_WIND, /* 0x02 */ NATURE_STREAM_SCREECHING_WIND, /* 0x03 */ NATURE_STREAM_SCREECHING_WIND_ALT1 } NatureStreamId; -typedef enum { +typedef enum NatureAmimalId { /* 0x00 */ NATURE_CRITTER_BIRD_CHIRP_1, /* 0x01 */ NATURE_CRITTER_TAP, /* 0x02 */ NATURE_CRITTER_BIRD_CHIRP_2, diff --git a/include/sfx.h b/include/sfx.h index a8ea68dee5..7fc597867a 100644 --- a/include/sfx.h +++ b/include/sfx.h @@ -1,7 +1,7 @@ #ifndef SFX_H #define SFX_H -typedef enum { +typedef enum SfxBankType { /* 0 */ BANK_PLAYER, /* 1 */ BANK_ITEM, /* 2 */ BANK_ENV, @@ -11,7 +11,7 @@ typedef enum { /* 6 */ BANK_VOICE } SfxBankType; -typedef enum { +typedef enum SfxState { /* 0 */ SFX_STATE_EMPTY, /* 1 */ SFX_STATE_QUEUED, /* 2 */ SFX_STATE_READY, @@ -20,7 +20,7 @@ typedef enum { /* 5 */ SFX_STATE_PLAYING_2 } SfxState; -typedef struct { +typedef struct SfxBankEntry { /* 0x00 */ f32* posX; /* 0x04 */ f32* posY; /* 0x08 */ f32* posZ; @@ -57,7 +57,7 @@ typedef struct { #define DEFINE_SFX(enum, _1, _2, _3, _4) enum, -typedef enum { +typedef enum SfxId { NA_SE_NONE, // Requesting a sfx with this id will play no sound NA_SE_PL_BASE = 0x7FF, #include "tables/sfx/playerbank_table.h" @@ -87,7 +87,7 @@ typedef enum { #define SFX_FLAG 0x800 -typedef struct { +typedef struct ActiveSfx { u32 priority; // lower is more prioritized u8 entryIndex; } ActiveSfx; @@ -114,7 +114,7 @@ typedef struct { #define SFX_FLAG_14 (1 << 14) #define SFX_FLAG_15 (1 << 15) -typedef struct { +typedef struct SfxParams { u8 importance; u16 params; } SfxParams; diff --git a/include/speedmeter.h b/include/speedmeter.h index ec4c3f799e..393c89de8d 100644 --- a/include/speedmeter.h +++ b/include/speedmeter.h @@ -6,7 +6,7 @@ struct GraphicsContext; struct GameState; -typedef struct { +typedef struct SpeedMeter { /* 0x00 */ char unk_00[0x18]; /* 0x18 */ s32 x; // Unused /* 0x1C */ s32 y; diff --git a/include/tha.h b/include/tha.h index 1f086b0016..941321b820 100644 --- a/include/tha.h +++ b/include/tha.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "alignment.h" -typedef struct { +typedef struct TwoHeadArena { /* 0x00 */ size_t size; /* 0x04 */ void* start; /* 0x08 */ void* head; diff --git a/include/thga.h b/include/thga.h index 9d9e96950a..fb84506813 100644 --- a/include/thga.h +++ b/include/thga.h @@ -3,7 +3,7 @@ #include "tha.h" -typedef union { +typedef union TwoHeadGfxArena { /* 0x00 */ TwoHeadArena tha; struct { // Same as TwoHeadArena, with different types and field names for the head and tail pointers /* 0x00 */ size_t size; diff --git a/include/ultra64/abi.h b/include/ultra64/abi.h index a71beb9e79..1dda80dbca 100644 --- a/include/ultra64/abi.h +++ b/include/ultra64/abi.h @@ -49,28 +49,28 @@ * Data Structures. */ -typedef struct { +typedef struct Aadpcm { u32 cmd : 8; u32 flags : 8; u32 gain : 16; u32 addr; } Aadpcm; -typedef struct { +typedef struct Apolef { u32 cmd : 8; u32 flags : 8; u32 gain : 16; u32 addr; } Apolef; -typedef struct { +typedef struct Aenvelope { u32 cmd : 8; u32 flags : 8; u32 pad1 : 16; u32 addr; } Aenvelope; -typedef struct { +typedef struct Aclearbuff { u32 cmd : 8; u32 pad1 : 8; u32 dmem : 16; @@ -78,7 +78,7 @@ typedef struct { u32 count : 16; } Aclearbuff; -typedef struct { +typedef struct Ainterleave { u32 cmd : 8; u32 pad1 : 8; u32 pad2 : 16; @@ -86,20 +86,20 @@ typedef struct { u32 inR : 16; } Ainterleave; -typedef struct { +typedef struct Aloadbuff { u32 cmd : 8; u32 pad1 : 24; u32 addr; } Aloadbuff; -typedef struct { +typedef struct Aenvmixer { u32 cmd : 8; u32 flags : 8; u32 pad1 : 16; u32 addr; } Aenvmixer; -typedef struct { +typedef struct Amixer { u32 cmd : 8; u32 flags : 8; u32 gain : 16; @@ -107,34 +107,34 @@ typedef struct { u32 dmemo : 16; } Amixer; -typedef struct { +typedef struct Apan { u32 cmd : 8; u32 flags : 8; u32 dmem2 : 16; u32 addr; } Apan; -typedef struct { +typedef struct Aresample { u32 cmd : 8; u32 flags : 8; u32 pitch : 16; u32 addr; } Aresample; -typedef struct { +typedef struct Areverb { u32 cmd : 8; u32 flags : 8; u32 pad1 : 16; u32 addr; } Areverb; -typedef struct { +typedef struct Asavebuff { u32 cmd : 8; u32 pad1 : 24; u32 addr; } Asavebuff; -typedef struct { +typedef struct Asegment { u32 cmd : 8; u32 pad1 : 24; u32 pad2 : 2; @@ -142,7 +142,7 @@ typedef struct { u32 base : 24; } Asegment; -typedef struct { +typedef struct Asetbuff { u32 cmd : 8; u32 flags : 8; u32 dmemin : 16; @@ -150,7 +150,7 @@ typedef struct { u32 count : 16; } Asetbuff; -typedef struct { +typedef struct Asetvol { u32 cmd : 8; u32 flags : 8; u32 vol : 16; @@ -158,7 +158,7 @@ typedef struct { u32 volrate : 16; } Asetvol; -typedef struct { +typedef struct Admemmove { u32 cmd : 8; u32 pad1 : 8; u32 dmemin : 16; @@ -166,14 +166,14 @@ typedef struct { u32 count : 16; } Admemmove; -typedef struct { +typedef struct Aloadadpcm { u32 cmd : 8; u32 pad1 : 8; u32 count : 16; u32 addr; } Aloadadpcm; -typedef struct { +typedef struct Asetloop { u32 cmd : 8; u32 pad1 : 8; u32 pad2 : 16; @@ -184,12 +184,12 @@ typedef struct { * Generic Acmd Packet */ -typedef struct { +typedef struct Awords { u32 w0; u32 w1; } Awords; -typedef union { +typedef union Acmd { Awords words; Aadpcm adpcm; Apolef polef; diff --git a/include/ultra64/controller.h b/include/ultra64/controller.h index 9178991d94..79dcf1c47d 100644 --- a/include/ultra64/controller.h +++ b/include/ultra64/controller.h @@ -125,7 +125,7 @@ // however file alignment should not be relied on in general. __attribute__((aligned(0x10))) #endif -typedef union { +typedef union OSPifRam { struct { /* 0x00 */ u32 ram[15]; /* 0x3C */ u32 status; @@ -133,20 +133,20 @@ typedef union { u64 force_structure_alignment; } OSPifRam; // size = 0x40 -typedef struct { +typedef struct OSContStatus { /* 0x00 */ u16 type; /* 0x02 */ u8 status; /* 0x03 */ u8 errno; } OSContStatus; // size = 0x04 -typedef struct { +typedef struct OSContPad { /* 0x00 */ u16 button; /* 0x02 */ s8 stick_x; /* 0x03 */ s8 stick_y; /* 0x04 */ u8 errno; } OSContPad; // size = 0x06 -typedef struct { +typedef struct OSContRamIo { /* 0x00 */ void* address; /* 0x04 */ u8 databuffer[32]; /* 0x24 */ u8 addressCrc; @@ -154,7 +154,7 @@ typedef struct { /* 0x26 */ u8 errno; } OSContRamIo; // size = 0x28 -typedef struct { +typedef struct __OSContRequesFormat { /* 0x00 */ u8 align; /* 0x01 */ u8 txsize; /* 0x02 */ u8 rxsize; @@ -165,7 +165,7 @@ typedef struct { /* 0x07 */ u8 align1; } __OSContRequesFormat; // size = 0x8 -typedef struct { +typedef struct __OSContRequesFormatShort { /* 0x00 */ u8 txsize; /* 0x01 */ u8 rxsize; /* 0x02 */ u8 cmd; @@ -174,7 +174,7 @@ typedef struct { /* 0x05 */ u8 status; } __OSContRequesFormatShort; // size = 0x6 -typedef struct { +typedef struct __OSContRamReadFormat { /* 0x00 */ u8 unk_00; /* 0x01 */ u8 txsize; /* 0x02 */ u8 rxsize; @@ -187,7 +187,7 @@ typedef struct { #define READFORMAT(ptr) ((__OSContRamReadFormat*)(ptr)) -typedef struct { +typedef struct __OSContReadFormat { /* 0x00 */ u8 align; /* 0x01 */ u8 txsize; /* 0x02 */ u8 rxsize; diff --git a/include/ultra64/gbi.h b/include/ultra64/gbi.h index 058fcb3cd2..55171076d6 100644 --- a/include/ultra64/gbi.h +++ b/include/ultra64/gbi.h @@ -1005,7 +1005,7 @@ /* * Vertex (set up for use with colors) */ -typedef struct { +typedef struct Vtx_t { short ob[3]; /* x, y, z */ unsigned short flag; short tc[2]; /* texture coord */ @@ -1015,7 +1015,7 @@ typedef struct { /* * Vertex (set up for use with normals) */ -typedef struct { +typedef struct Vtx_tn { short ob[3]; /* x, y, z */ unsigned short flag; short tc[2]; /* texture coord */ @@ -1023,7 +1023,7 @@ typedef struct { unsigned char a; /* alpha */ } Vtx_tn; -typedef union { +typedef union Vtx { Vtx_t v; /* Use this one for colors */ Vtx_tn n; /* Use this one for normals */ long long int force_structure_alignment; @@ -1033,7 +1033,7 @@ typedef union { * Sprite structure */ -typedef struct { +typedef struct uSprite_t { void* SourceImagePointer; void* TlutPointer; short Stride; @@ -1049,7 +1049,7 @@ typedef struct { char dummy[4]; } uSprite_t; -typedef union { +typedef union uSprite { uSprite_t s; /* Need to make sure this is 64 bit aligned */ @@ -1059,7 +1059,7 @@ typedef union { /* * Triangle face */ -typedef struct { +typedef struct Tri { unsigned char flag; unsigned char v[3]; } Tri; @@ -1070,7 +1070,7 @@ typedef struct { * Last 8 words are the fraction portion of the 4x4 matrix */ typedef long int Mtx_t[4][4]; -typedef union { +typedef union Mtx { Mtx_t m; struct { u16 intPart[4][4]; @@ -1140,13 +1140,13 @@ typedef union { * (SCREEN_WD/2)*4, (SCREEN_HT/2)*4, G_MAXZ, 0, * (SCREEN_WD/2)*4, (SCREEN_HT/2)*4, 0, 0, */ -typedef struct { +typedef struct Vp_t { short vscale[4]; /* scale, 2 bits fraction */ short vtrans[4]; /* translate, 2 bits fraction */ /* both the above arrays are padded to 64-bit boundary */ } Vp_t; -typedef union { +typedef union Vp { Vp_t vp; long long int force_structure_alignment; } Vp; @@ -1306,7 +1306,7 @@ typedef union { * */ -typedef struct { +typedef struct Light_t { unsigned char col[3]; /* diffuse light value (rgba) */ char pad1; unsigned char colc[3]; /* copy of diffuse light value (rgba) */ @@ -1316,7 +1316,7 @@ typedef struct { } Light_t; #ifdef F3DEX_GBI_PL -typedef struct { +typedef struct PointLight_t { unsigned char col[3]; /* point light value (rgba) */ unsigned char kc; /* constant attenuation (> 0 indicates point light) */ unsigned char colc[3]; /* copy of point light value (rgba) */ @@ -1326,14 +1326,14 @@ typedef struct { } PointLight_t; #endif -typedef struct { +typedef struct Ambient_t { unsigned char col[3]; /* ambient light value (rgba) */ char pad1; unsigned char colc[3]; /* copy of ambient light value (rgba) */ char pad2; } Ambient_t; -typedef struct { +typedef struct Hilite_t { /* texture offsets for highlight 1/2 */ int x1; int y1; @@ -1341,7 +1341,7 @@ typedef struct { int y2; } Hilite_t; -typedef union { +typedef union Light { Light_t l; #ifdef F3DEX_GBI_PL PointLight_t p; @@ -1349,61 +1349,61 @@ typedef union { long long int force_structure_alignment[2]; } Light; -typedef union { +typedef union Ambient { Ambient_t l; long long int force_structure_alignment[1]; } Ambient; -typedef struct { +typedef struct Lightsn { Ambient a; Light l[7]; } Lightsn; -typedef struct { +typedef struct Lights0 { Ambient a; Light l[1]; } Lights0; -typedef struct { +typedef struct Lights1 { Ambient a; Light l[1]; } Lights1; -typedef struct { +typedef struct Lights2 { Ambient a; Light l[2]; } Lights2; -typedef struct { +typedef struct Lights3 { Ambient a; Light l[3]; } Lights3; -typedef struct { +typedef struct Lights4 { Ambient a; Light l[4]; } Lights4; -typedef struct { +typedef struct Lights5 { Ambient a; Light l[5]; } Lights5; -typedef struct { +typedef struct Lights6 { Ambient a; Light l[6]; } Lights6; -typedef struct { +typedef struct Lights7 { Ambient a; Light l[7]; } Lights7; -typedef struct { +typedef struct LookAt { Light l[2]; } LookAt; -typedef union { +typedef union Hilite { Hilite_t h; long int force_structure_alignment; } Hilite; @@ -1672,7 +1672,7 @@ typedef union { }}, \ }} -typedef struct { +typedef struct Gnoop { int cmd : 8; unsigned int type : 8; unsigned int len : 16; @@ -1690,7 +1690,7 @@ typedef struct { /* * Graphics DMA Packet */ -typedef struct { +typedef struct Gdma { int cmd : 8; unsigned int par : 8; unsigned int len : 16; @@ -1698,7 +1698,7 @@ typedef struct { } Gdma; #ifdef F3DEX_GBI_2 -typedef struct { +typedef struct Gdma2 { int cmd : 8; unsigned int len : 8; unsigned int ofs : 8; @@ -1711,7 +1711,7 @@ typedef struct { * Graphics Moveword Packet */ // Inaccurate for F3DEX2, offset and index are swapped -typedef struct { +typedef struct Gmovewd { int cmd : 8; unsigned int offset : 16; unsigned int index : 8; @@ -1721,7 +1721,7 @@ typedef struct { /* * Graphics Movemem Packet */ -typedef struct { +typedef struct Gmovemem { int cmd : 8; unsigned int size : 8; unsigned int offset : 8; @@ -1732,24 +1732,24 @@ typedef struct { /* * Graphics Immediate Mode Packet types */ -typedef struct { +typedef struct Gtri { int cmd : 8; int pad : 24; Tri tri; } Gtri; #if (defined(F3DLP_GBI) || defined(F3DEX_GBI)) -typedef struct { +typedef struct Gtri2 { Tri tri1; /* flag is the command byte */ Tri tri2; } Gtri2; -typedef struct { +typedef struct Gquad { Tri tri1; /* flag is the command byte */ Tri tri2; } Gquad; -typedef struct { +typedef struct Gcull { int cmd : 8; unsigned int pad : 8; unsigned short vstart_x2; @@ -1758,14 +1758,14 @@ typedef struct { } Gcull; #endif -typedef struct { +typedef struct Gsetprimdepth { int cmd : 8; unsigned int pad : 24; unsigned short z; unsigned short dz; } Gsetprimdepth; -typedef struct { +typedef struct Gpopmtx { int cmd : 8; int pad1 : 24; #ifdef F3DEX_GBI_2 @@ -1777,7 +1777,7 @@ typedef struct { } Gpopmtx; /* - * typedef struct { + * typedef struct Gsegment { * int cmd:8; * int pad0:24; * int pad1:4; @@ -1785,7 +1785,7 @@ typedef struct { * int base:24; * } Gsegment; */ -typedef struct { +typedef struct Gsegment { int cmd : 8; int pad0 : 8; int mw_index : 8; @@ -1794,7 +1794,7 @@ typedef struct { int base : 24; } Gsegment; -typedef struct { +typedef struct GsetothermodeL { int cmd : 8; int pad0 : 8; unsigned int sft : 8; @@ -1802,7 +1802,7 @@ typedef struct { unsigned int data : 32; } GsetothermodeL; -typedef struct { +typedef struct GsetothermodeH { int cmd : 8; int pad0 : 8; unsigned int sft : 8; @@ -1810,7 +1810,7 @@ typedef struct { unsigned int data : 32; } GsetothermodeH; -typedef struct { +typedef struct Gtexture { unsigned char cmd; unsigned char lodscale; #ifdef F3DEX_GBI_2 @@ -1825,7 +1825,7 @@ typedef struct { unsigned short t; } Gtexture; -typedef struct { +typedef struct Gline3D { int cmd : 8; #ifdef F3DEX_GBI_2 unsigned char v0; @@ -1838,7 +1838,7 @@ typedef struct { #endif } Gline3D; -typedef struct { +typedef struct Gperspnorm { int cmd : 8; int pad1 : 24; short int pad2; @@ -1849,7 +1849,7 @@ typedef struct { /* * RDP Packet types */ -typedef struct { +typedef struct Gsetimg { int cmd : 8; unsigned int fmt : 3; unsigned int siz : 2; @@ -1858,7 +1858,7 @@ typedef struct { unsigned int dram; /* to account for 1024 */ } Gsetimg; -typedef struct { +typedef struct Gsetcombine { int cmd : 8; // muxs0 unsigned int a0 : 4; @@ -1880,7 +1880,7 @@ typedef struct { unsigned int Ad1 : 3; } Gsetcombine; -typedef struct { +typedef struct Gsetcolor { int cmd : 8; unsigned char pad; unsigned char prim_min_level; @@ -1896,7 +1896,7 @@ typedef struct { }; } Gsetcolor; -typedef struct { +typedef struct Gfillrect { int cmd : 8; int x0 : 10; int x0frac : 2; @@ -1909,7 +1909,7 @@ typedef struct { int y1frac : 2; } Gfillrect; -typedef struct { +typedef struct Gsettile { int cmd : 8; unsigned int fmt : 3; unsigned int siz : 2; @@ -1929,7 +1929,7 @@ typedef struct { unsigned int shifts : 4; } Gsettile; -typedef struct { +typedef struct Gloadtile { int cmd : 8; unsigned int sl : 12; unsigned int tl : 12; @@ -1945,7 +1945,7 @@ typedef Gloadtile Gsettilesize; typedef Gloadtile Gloadtlut; -typedef struct { +typedef struct Gtexrect { unsigned int cmd : 8; /* command */ unsigned int xl : 12; /* X coordinate of upper left */ unsigned int yl : 12; /* Y coordinate of upper left */ @@ -1965,7 +1965,7 @@ typedef struct { /* * Textured rectangles are 128 bits not 64 bits */ -typedef struct { +typedef struct TexRect { unsigned long w0; unsigned long w1; unsigned long w2; @@ -1973,7 +1973,7 @@ typedef struct { } TexRect; #ifdef F3DEX_GBI_2 -typedef struct { +typedef struct Gvtx { int cmd : 8; unsigned int pad : 4; unsigned int len : 8; // n @@ -1988,7 +1988,7 @@ typedef Gdma Gvtx; /* * Generic Gfx Packet */ -typedef struct { +typedef struct Gwords { unsigned int w0; unsigned int w1; } Gwords; @@ -1997,7 +1997,7 @@ typedef struct { * This union is the fundamental type of the display list. * It is, by law, exactly 64 bits in size. */ -typedef union { +typedef union Gfx { Gwords words; Gnoop noop; Gdma dma; diff --git a/include/ultra64/gs2dex.h b/include/ultra64/gs2dex.h index 6371ae04c2..031dcb9f7d 100644 --- a/include/ultra64/gs2dex.h +++ b/include/ultra64/gs2dex.h @@ -91,7 +91,7 @@ typedef struct { } uObjScaleBg_t; /* 40 bytes */ -typedef union { +typedef union uObjBg { uObjBg_t b; uObjScaleBg_t s; long long int force_structure_alignment; @@ -103,7 +103,7 @@ typedef union { #define G_OBJ_FLAG_FLIPS 1<<0 /* inversion to S-direction */ #define G_OBJ_FLAG_FLIPT 1<<4 /* nversion to T-direction */ -typedef struct { +typedef struct uObjSprite_t { s16 objX; /* s10.2 OBJ x-coordinate of upper-left end */ u16 scaleW; /* u5.10 Scaling of u5.10 width direction */ u16 imageW; /* u10.5 width of u10.5 texture (length of S-direction) */ @@ -120,7 +120,7 @@ typedef struct { u8 imageFlags; /* The display flag - G_OBJ_FLAG_FLIP* */ } uObjSprite_t; /* 24 bytes */ -typedef union { +typedef union uObjSprite { uObjSprite_t s; long long int force_structure_alignment; } uObjSprite; @@ -128,25 +128,25 @@ typedef union { /*---------------------------------------------------------------------------* * 2D Matrix *---------------------------------------------------------------------------*/ -typedef struct { +typedef struct uObjMtx_t { s32 A, B, C, D; /* s15.16 */ s16 X, Y; /* s10.2 */ u16 BaseScaleX; /* u5.10 */ u16 BaseScaleY; /* u5.10 */ } uObjMtx_t; /* 24 bytes */ -typedef union { +typedef union uObjMtx { uObjMtx_t m; long long int force_structure_alignment; } uObjMtx; -typedef struct { +typedef struct uObjSubMtx_t { s16 X, Y; /* s10.2 */ u16 BaseScaleX; /* u5.10 */ u16 BaseScaleY; /* u5.10 */ } uObjSubMtx_t; /* 8 bytes */ -typedef union { +typedef union uObjSubMtx { uObjSubMtx_t m; long long int force_structure_alignment; } uObjSubMtx; @@ -200,7 +200,7 @@ typedef struct { u32 mask; /* STATE mask */ } uObjTxtrTLUT_t; /* 24 bytes */ -typedef union { +typedef union uObjTxtr { uObjTxtrBlock_t block; uObjTxtrTile_t tile; uObjTxtrTLUT_t tlut; diff --git a/include/ultra64/gu.h b/include/ultra64/gu.h index 7e2a50d725..36ff2dd1c0 100644 --- a/include/ultra64/gu.h +++ b/include/ultra64/gu.h @@ -7,7 +7,7 @@ #define ROUND(x) (s32)(((x) >= 0.0) ? ((x) + 0.5) : ((x) - 0.5)) -typedef union { +typedef union du { struct { u32 hi; u32 lo; @@ -16,7 +16,7 @@ typedef union { f64 d; } du; -typedef union { +typedef union fu { u32 i; f32 f; } fu; diff --git a/include/ultra64/internal.h b/include/ultra64/internal.h index 0851314a8b..e094d39622 100644 --- a/include/ultra64/internal.h +++ b/include/ultra64/internal.h @@ -3,7 +3,7 @@ #include "pi.h" -typedef struct { +typedef struct OSDevMgr { /* 0x00 */ u32 active; /* 0x04 */ OSThread* thread; /* 0x08 */ OSMesgQueue* cmdQueue; diff --git a/include/ultra64/pfs.h b/include/ultra64/pfs.h index 019f29350c..c86f36d628 100644 --- a/include/ultra64/pfs.h +++ b/include/ultra64/pfs.h @@ -69,7 +69,7 @@ #define PFS_INODE_DIST_MAP (PFS_BANK_LAPPED_BY * PFS_SECTOR_PER_BANK) #define PFS_SECTOR_SIZE (PFS_INODE_SIZE_PER_PAGE/PFS_SECTOR_PER_BANK) -typedef struct { +typedef struct OSPfs { /* 0x00 */ s32 status; /* 0x04 */ OSMesgQueue* queue; /* 0x08 */ s32 channel; @@ -85,7 +85,7 @@ typedef struct { /* 0x65 */ u8 activebank; } OSPfs; // size = 0x68 -typedef struct { +typedef struct OSPfsState { /* 0x00 */ u32 file_size; /* bytes */ /* 0x04 */ u32 game_code; /* 0x08 */ u16 company_code; @@ -93,7 +93,7 @@ typedef struct { /* 0x10 */ char game_name[16]; } OSPfsState; // size = 0x20 -typedef union { +typedef union __OSInodeUnit { struct { /* 0x00 */ u8 bank; /* 0x01 */ u8 page; @@ -101,11 +101,11 @@ typedef union { /* 0x00 */ u16 ipage; } __OSInodeUnit; // size = 0x02 -typedef struct { +typedef struct __OSInode { /* 0x00 */ __OSInodeUnit inodePage[128]; } __OSInode; // size = 0x100 -typedef struct { +typedef struct __OSDir { /* 0x00 */ u32 game_code; /* 0x04 */ u16 company_code; /* 0x06 */ __OSInodeUnit start_page; @@ -116,7 +116,7 @@ typedef struct { /* 0x10 */ u8 game_name[PFS_FILE_NAME_LEN]; } __OSDir; // size = 0x20 -typedef struct { +typedef struct __OSPackId { /* 0x00 */ u32 repaired; /* 0x04 */ u32 random; /* 0x08 */ u64 serialMid; @@ -128,7 +128,7 @@ typedef struct { /* 0x1E */ u16 invertedChecksum; } __OSPackId; // size = 0x20 -typedef struct { +typedef struct __OSInodeCache { /* 0x000 */ __OSInode inode; /* 0x100 */ u8 bank; /* 0x101 */ u8 map[PFS_INODE_DIST_MAP]; diff --git a/include/ultra64/pi.h b/include/ultra64/pi.h index 6fb52cea70..af18c407ea 100644 --- a/include/ultra64/pi.h +++ b/include/ultra64/pi.h @@ -3,7 +3,7 @@ #include "message.h" -typedef struct { +typedef struct __OSBlockInfo { /* 0x00 */ u32 errStatus; /* 0x04 */ void* dramAddr; /* 0x08 */ void* C2Addr; @@ -12,7 +12,7 @@ typedef struct { /* 0x14 */ u32 C1ErrSector[4]; } __OSBlockInfo; // size = 0x24 -typedef struct { +typedef struct __OSTranxInfo { /* 0x00 */ u32 cmdType; /* 0x04 */ u16 transferMode; /* 0x06 */ u16 blockNum; @@ -36,19 +36,19 @@ typedef struct OSPiHandle { /* 0x14 */ __OSTranxInfo transferInfo; } OSPiHandle; // size = 0x74 -typedef struct { +typedef struct OSPiInfo { /* 0x00 */ u8 type; /* 0x04 */ u32 address; } OSPiInfo; // size = 0x08 -typedef struct { +typedef struct OSIoMesgHdr { /* 0x00 */ u16 type; /* 0x02 */ u8 pri; /* 0x03 */ u8 status; /* 0x04 */ OSMesgQueue* retQueue; } OSIoMesgHdr; // size = 0x08 -typedef struct { +typedef struct OSIoMesg { /* 0x00 */ OSIoMesgHdr hdr; /* 0x08 */ void* dramAddr; /* 0x0C */ u32 devAddr; diff --git a/include/ultra64/rdb.h b/include/ultra64/rdb.h index 0493b82b99..b58e3c8cf9 100644 --- a/include/ultra64/rdb.h +++ b/include/ultra64/rdb.h @@ -71,7 +71,7 @@ #include "ultratypes.h" /* Structure for debug port */ -typedef struct { +typedef struct rdbPacket { u32 type : 6; /* 0: invalid, 1: print, 2: debug */ u32 length : 2; /* 1, 2, or 3 */ char buf[3]; /* character buffer */ diff --git a/include/ultra64/sptask.h b/include/ultra64/sptask.h index ea00dbfdf5..5218c64cac 100644 --- a/include/ultra64/sptask.h +++ b/include/ultra64/sptask.h @@ -28,7 +28,7 @@ #define OS_YIELD_DATA_SIZE 0xC00 -typedef struct { +typedef struct OSTask_t { /* 0x00 */ u32 type; /* 0x04 */ u32 flags; @@ -54,7 +54,7 @@ typedef struct { /* 0x3C */ u32 yield_data_size; } OSTask_t; // size = 0x40 -typedef union { +typedef union OSTask { OSTask_t t; long long int force_structure_alignment; } OSTask; diff --git a/include/ultra64/thread.h b/include/ultra64/thread.h index 474a63641a..813fefaa97 100644 --- a/include/ultra64/thread.h +++ b/include/ultra64/thread.h @@ -27,7 +27,7 @@ typedef s32 OSPri; typedef s32 OSId; -typedef union { +typedef union __OSfp { struct { /* 0x00 */ f32 f_odd; /* 0x04 */ f32 f_even; @@ -35,7 +35,7 @@ typedef union { f64 d; } __OSfp; // size = 0x08 -typedef struct { +typedef struct __OSThreadContext { /* 0x000 */ u64 at, v0, v1, a0, a1, a2, a3; /* 0x038 */ u64 t0, t1, t2, t3, t4, t5, t6, t7; /* 0x078 */ u64 s0, s1, s2, s3, s4, s5, s6, s7; @@ -47,7 +47,7 @@ typedef struct { /* 0x150 */ __OSfp fp16, fp18, fp20, fp22, fp24, fp26, fp28, fp30; } __OSThreadContext; // size = 0x190 -typedef struct { +typedef struct __OSThreadprofile { /* 0x00 */ u32 flag; /* 0x04 */ u32 count; /* 0x08 */ u64 time; @@ -66,7 +66,7 @@ typedef struct OSThread { /* 0x20 */ __OSThreadContext context; } OSThread; // size = 0x1B0 -typedef struct { +typedef struct __OSThreadTail { OSThread* next; OSPri priority; } __OSThreadTail; // size = 0x8 diff --git a/include/ultra64/ultratypes.h b/include/ultra64/ultratypes.h index 7f45a7ef84..743e755ae9 100644 --- a/include/ultra64/ultratypes.h +++ b/include/ultra64/ultratypes.h @@ -26,7 +26,7 @@ typedef double f64; typedef float MtxF_t[4][4]; -typedef union { +typedef union MtxF { MtxF_t mf; struct { // Note: The order displayed here is the transpose of the order in which matrices are typically written. diff --git a/include/ultra64/vi.h b/include/ultra64/vi.h index 5125461123..70665d8f55 100644 --- a/include/ultra64/vi.h +++ b/include/ultra64/vi.h @@ -13,7 +13,7 @@ #define OS_VI_DITHER_FILTER_ON 0x0040 #define OS_VI_DITHER_FILTER_OFF 0x0080 -typedef struct { +typedef struct OSViCommonRegs { /* 0x00 */ u32 ctrl; /* 0x04 */ u32 width; /* 0x08 */ u32 burst; @@ -25,7 +25,7 @@ typedef struct { /* 0x20 */ u32 vCurrent; } OSViCommonRegs; // size = 0x20 -typedef struct { +typedef struct OSViFieldRegs { /* 0x00 */ u32 origin; /* 0x04 */ u32 yScale; /* 0x08 */ u32 vStart; @@ -33,19 +33,19 @@ typedef struct { /* 0x10 */ u32 vIntr; } OSViFieldRegs; // size = 0x14 -typedef struct { +typedef struct OSViMode { /* 0x00 */ u8 type; /* 0x04 */ OSViCommonRegs comRegs; /* 0x24 */ OSViFieldRegs fldRegs[2]; } OSViMode; // size = 0x4C -typedef struct { +typedef struct __OSViScale { /* 0x0 */ f32 factor; /* 0x4 */ u16 offset; /* 0x8 */ u32 scale; } __OSViScale; // size = 0x0C -typedef struct { +typedef struct OSViContext { /* 0x00 */ u16 state; /* 0x02 */ u16 retraceCount; /* 0x04 */ void* framep; diff --git a/include/ultra64/xstdio.h b/include/ultra64/xstdio.h index 27c44a56be..184ee49079 100644 --- a/include/ultra64/xstdio.h +++ b/include/ultra64/xstdio.h @@ -10,7 +10,7 @@ #define LONG_DOUBLE_TYPE long double #endif -typedef struct { +typedef struct _Pft { /* 0x00 */ union { long long ll; LONG_DOUBLE_TYPE ld; diff --git a/include/z64.h b/include/z64.h index 1c24f026c7..fc6e89aded 100644 --- a/include/z64.h +++ b/include/z64.h @@ -99,7 +99,7 @@ #define STACK_TOP(stack) \ ((u8*)(stack) + sizeof(stack)) -typedef struct { +typedef struct KaleidoMgrOverlay { /* 0x00 */ void* loadedRamAddr; /* 0x04 */ RomFile file; /* 0x0C */ void* vramStart; @@ -108,22 +108,22 @@ typedef struct { /* 0x18 */ const char* name; } KaleidoMgrOverlay; // size = 0x1C -typedef enum { +typedef enum KaleidoOverlayType { /* 0 */ KALEIDO_OVL_KALEIDO_SCOPE, /* 1 */ KALEIDO_OVL_PLAYER_ACTOR, /* 2 */ KALEIDO_OVL_MAX } KaleidoOverlayType; -typedef enum { +typedef enum LensMode { /* 0 */ LENS_MODE_SHOW_ACTORS, // lens actors are invisible by default, and shown by using lens (for example, invisible enemies) /* 1 */ LENS_MODE_HIDE_ACTORS // lens actors are visible by default, and hidden by using lens (for example, fake walls) } LensMode; -typedef struct { +typedef struct SetupState { /* 0x00 */ GameState state; } SetupState; // size = 0xA4 -typedef struct { +typedef struct ConsoleLogoState { /* 0x0000 */ GameState state; /* 0x00A4 */ u8* staticSegment; /* 0x00A8 */ View view; @@ -141,7 +141,7 @@ typedef struct { struct MapSelectState; -typedef struct { +typedef struct SceneSelectEntry { /* 0x00 */ char* name; /* 0x04 */ void (*loadFunc)(struct MapSelectState*, s32); /* 0x08 */ s32 entranceIndex; @@ -169,7 +169,7 @@ typedef struct MapSelectState { /* 0x0238 */ u8* staticSegment; } MapSelectState; // size = 0x240 -typedef struct { +typedef struct SampleState { /* 0x0000 */ GameState state; /* 0x00A4 */ u8* staticSegment; /* 0x00A8 */ View view; @@ -182,7 +182,7 @@ typedef struct QuestHintCmd { /* 0x03 */ u8 byte3; } QuestHintCmd; // size = 0x4 -typedef enum { +typedef enum PauseBgPreRenderState { /* 0 */ PAUSE_BG_PRERENDER_OFF, // Inactive, do nothing. /* 1 */ PAUSE_BG_PRERENDER_SETUP, // The current frame is only drawn for the purpose of serving as the pause background. /* 2 */ PAUSE_BG_PRERENDER_PROCESS, // The previous frame was PAUSE_BG_PRERENDER_SETUP, now apply prerender filters. @@ -190,19 +190,19 @@ typedef enum { /* 4 */ PAUSE_BG_PRERENDER_MAX } PauseBgPreRenderState; -typedef enum { +typedef enum TransitionTileState { /* 0 */ TRANS_TILE_OFF, // Inactive, do nothing /* 1 */ TRANS_TILE_SETUP, // Save the necessary buffers /* 2 */ TRANS_TILE_PROCESS, // Initialize the transition /* 3 */ TRANS_TILE_READY // The transition is ready, so will update and draw each frame } TransitionTileState; -typedef struct { +typedef struct TitleSetupState { /* 0x0000 */ GameState state; /* 0x00A8 */ View view; } TitleSetupState; // size = 0x1D0 -typedef struct { +typedef struct FileSelectState { /* 0x00000 */ GameState state; /* 0x000A4 */ Vtx* windowVtx; /* 0x000A8 */ u8* staticSegment; @@ -299,13 +299,13 @@ typedef struct { (((field) >> ENTRANCE_INFO_START_TRANS_TYPE_SHIFT) \ & (ENTRANCE_INFO_START_TRANS_TYPE_MASK >> ENTRANCE_INFO_START_TRANS_TYPE_SHIFT)) -typedef struct { +typedef struct EntranceInfo { /* 0x00 */ s8 sceneId; /* 0x01 */ s8 spawn; /* 0x02 */ u16 field; } EntranceInfo; // size = 0x4 -typedef struct { +typedef struct GameStateOverlay { /* 0x00 */ void* loadedRamAddr; /* 0x04 */ RomFile file; // if applicable /* 0x0C */ void* vramStart; // if applicable @@ -319,13 +319,13 @@ typedef struct { /* 0x2C */ u32 instanceSize; } GameStateOverlay; // size = 0x30 -typedef struct { +typedef struct PreNMIState { /* 0x00 */ GameState state; /* 0xA4 */ u32 timer; /* 0xA8 */ UNK_TYPE4 unk_A8; } PreNMIState; // size = 0xAC -typedef enum { +typedef enum FloorID { /* 1 */ F_8F = 1, /* 2 */ F_7F, /* 3 */ F_6F, @@ -347,7 +347,7 @@ typedef enum { // All arrays pointed in this struct are indexed by "map indices" // In dungeons, the map index corresponds to the dungeon index (which also indexes keys, items, etc) // In overworld areas, the map index corresponds to the overworld area index (spot 00, 01, etc) -typedef struct { +typedef struct MapData { /* 0x00 */ s16 (*floorTexIndexOffset)[8]; // dungeon texture index offset by floor /* 0x04 */ s16* bossFloor; // floor the boss is on /* 0x08 */ s16 (*roomPalette)[32]; // map palette by room @@ -396,7 +396,7 @@ typedef struct DebugDispObject { /* 0x28 */ struct DebugDispObject* next; } DebugDispObject; // size = 0x2C -typedef enum { +typedef enum MatrixMode { /* 0 */ MTXMODE_NEW, // generates a new matrix /* 1 */ MTXMODE_APPLY // applies transformation to the current matrix } MatrixMode; @@ -411,13 +411,13 @@ typedef struct StackEntry { /* 0x18 */ const char* name; } StackEntry; -typedef enum { +typedef enum StackStatus { /* 0 */ STACK_STATUS_OK, /* 1 */ STACK_STATUS_WARNING, /* 2 */ STACK_STATUS_OVERFLOW } StackStatus; -typedef struct { +typedef struct ISVDbg { /* 0x00 */ u32 magic; // IS64 /* 0x04 */ u32 get; /* 0x08 */ u8 unk_08[0x14-0x08]; @@ -426,7 +426,7 @@ typedef struct { /* 0x20 */ u8 data[0x10000-0x20]; } ISVDbg; -typedef struct { +typedef struct LocaleCartInfo { /* 0x00 */ char name[0x18]; /* 0x18 */ u32 mediaFormat; /* 0x1C */ union { @@ -439,7 +439,7 @@ typedef struct { }; } LocaleCartInfo; // size = 0x20 -typedef struct { +typedef struct Yaz0Header { /* 0x00 */ char magic[4]; // Yaz0 /* 0x04 */ u32 decSize; /* 0x08 */ u32 compInfoOffset; // only used in mio0 @@ -486,7 +486,7 @@ typedef struct ArenaNode { #define R_MIPS_LO16 6 /* Reloc section id, must fit in 2 bits otherwise the relocation format must be modified */ -typedef enum { +typedef enum RelocSectionId { /* 0 */ RELOC_SECTION_NULL, /* 1 */ RELOC_SECTION_TEXT, /* 2 */ RELOC_SECTION_DATA, @@ -508,21 +508,21 @@ typedef struct OverlayRelocationSection { // where 64-bit load/store instructions are emulated with 2x 32-bit load/store instructions. The alignment attribute // conveys that this structure will not always be 8-bytes aligned, allowing a modern compiler to generate non-crashing // code for accessing these. This is not an issue in the original compiler as it only output O32 ABI code. -ALIGNED(4) typedef struct { +ALIGNED(4) typedef struct PreNmiBuff { /* 0x00 */ u32 resetting; /* 0x04 */ u32 resetCount; /* 0x08 */ OSTime duration; /* 0x10 */ OSTime resetTime; } PreNmiBuff; // size = 0x18 (actually osAppNMIBuffer is 0x40 bytes large but the rest is unused) -typedef enum { +typedef enum ViModeEditState { /* 0 */ VI_MODE_EDIT_STATE_INACTIVE, /* 1 */ VI_MODE_EDIT_STATE_ACTIVE, /* 2 */ VI_MODE_EDIT_STATE_2, // active, more adjustments /* 3 */ VI_MODE_EDIT_STATE_3 // active, more adjustments, print comparison with NTSC LAN1 mode } ViModeEditState; -typedef struct { +typedef struct ViMode { /* 0x00 */ OSViMode customViMode; /* 0x50 */ s32 viHeight; /* 0x54 */ s32 viWidth; diff --git a/include/z64actor.h b/include/z64actor.h index f5c2a3ef08..a886160793 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -24,7 +24,7 @@ typedef void (*ActorShadowFunc)(struct Actor*, struct Lights*, struct PlayState* typedef u16 (*NpcGetTextIdFunc)(struct PlayState*, struct Actor*); typedef s16 (*NpcUpdateTalkStateFunc)(struct PlayState*, struct Actor*); -typedef struct { +typedef struct ActorProfile { /* 0x00 */ s16 id; /* 0x02 */ u8 category; // Classifies actor and determines when it will update or draw /* 0x04 */ u32 flags; @@ -85,7 +85,7 @@ typedef struct { */ #define ACTOROVL_ALLOC_PERSISTENT (1 << 1) -typedef struct { +typedef struct ActorOverlay { /* 0x00 */ RomFile file; /* 0x08 */ void* vramStart; /* 0x0C */ void* vramEnd; @@ -96,18 +96,18 @@ typedef struct { /* 0x1E */ s8 numLoaded; // original name: "clients" } ActorOverlay; // size = 0x20 -typedef struct { +typedef struct DamageTable { u8 table[32]; } DamageTable; -typedef struct { +typedef struct CollisionCheckInfoInit { /* 0x00 */ u8 health; /* 0x02 */ s16 cylRadius; /* 0x04 */ s16 cylHeight; /* 0x06 */ u8 mass; } CollisionCheckInfoInit; -typedef struct { +typedef struct CollisionCheckInfoInit2 { /* 0x00 */ u8 health; /* 0x02 */ s16 cylRadius; /* 0x04 */ s16 cylHeight; @@ -115,7 +115,7 @@ typedef struct { /* 0x08 */ u8 mass; } CollisionCheckInfoInit2; -typedef struct { +typedef struct CollisionCheckInfo { /* 0x00 */ DamageTable* damageTable; /* 0x04 */ Vec3f displacement; // Amount to correct actor velocity by when colliding into a body /* 0x10 */ s16 cylRadius; // Used for various purposes @@ -129,7 +129,7 @@ typedef struct { /* 0x1B */ u8 acHitEffect; // Stores what effect should occur when AC is touched by an AT } CollisionCheckInfo; // size = 0x1C -typedef struct { +typedef struct ActorShape { /* 0x00 */ Vec3s rot; // Current actor shape rotation /* 0x06 */ s16 face; // Used to index eyes and mouth textures. Only used by player /* 0x08 */ f32 yOffset; // Model y axis offset. Represents model space units @@ -310,7 +310,7 @@ typedef struct Actor { #endif } Actor; // size = 0x14C -typedef enum { +typedef enum ActorFootIndex { /* 0 */ FOOT_LEFT, /* 1 */ FOOT_RIGHT } ActorFootIndex; @@ -344,7 +344,7 @@ typedef struct DynaPolyActor { /* 0x162 */ s16 unk_162; } DynaPolyActor; // size = 0x164 -typedef struct { +typedef struct BodyBreak { /* 0x00 */ MtxF* matrices; /* 0x04 */ s16* objectSlots; /* 0x08 */ s16 count; @@ -357,7 +357,7 @@ typedef struct { #define BODYBREAK_STATUS_READY -1 #define BODYBREAK_STATUS_FINISHED 0 -typedef enum { +typedef enum Item00Type { /* 0x00 */ ITEM00_RUPEE_GREEN, /* 0x01 */ ITEM00_RUPEE_BLUE, /* 0x02 */ ITEM00_RUPEE_RED, @@ -406,7 +406,7 @@ typedef struct EnItem00 { } EnItem00; // size = 0x1AC // Only A_OBJ_SIGNPOST_OBLONG and A_OBJ_SIGNPOST_ARROW are used in room files. -typedef enum { +typedef enum AObjType { /* 0x00 */ A_OBJ_BLOCK_SMALL, /* 0x01 */ A_OBJ_BLOCK_LARGE, /* 0x02 */ A_OBJ_BLOCK_HUGE, @@ -439,7 +439,7 @@ typedef struct EnAObj { /* 0x17C */ ColliderCylinder collider; } EnAObj; // size = 0x1C8 -typedef enum { +typedef enum ActorCategory { /* 0x00 */ ACTORCAT_SWITCH, /* 0x01 */ ACTORCAT_BG, /* 0x02 */ ACTORCAT_PLAYER, @@ -459,7 +459,7 @@ typedef enum { #define DEFINE_ACTOR_INTERNAL(_0, enum, _2, _3) enum, #define DEFINE_ACTOR_UNSET(enum) enum, -typedef enum { +typedef enum ActorID { #include "tables/actor_table.h" /* 0x0192 */ ACTOR_ID_MAX // originally "ACTOR_DLF_MAX" } ActorID; @@ -468,13 +468,13 @@ typedef enum { #undef DEFINE_ACTOR_INTERNAL #undef DEFINE_ACTOR_UNSET -typedef enum { +typedef enum DoorLockType { DOORLOCK_NORMAL, DOORLOCK_BOSS, DOORLOCK_NORMAL_SPIRIT } DoorLockType; -typedef enum { +typedef enum NaviEnemy { /* 0x00 */ NAVI_ENEMY_DEFAULT, /* 0x01 */ NAVI_ENEMY_GOHMA, /* 0x02 */ NAVI_ENEMY_GOHMA_EGG, @@ -666,7 +666,7 @@ typedef struct SlidingDoorActorBase { /* 0x0000 */ SLIDING_DOOR_ACTOR_BASE; } SlidingDoorActorBase; -typedef enum { +typedef enum DoorOpenAnim { /* 0x00 */ DOOR_OPEN_ANIM_ADULT_L, /* 0x01 */ DOOR_OPEN_ANIM_CHILD_L, /* 0x02 */ DOOR_OPEN_ANIM_ADULT_R, @@ -683,14 +683,14 @@ typedef enum { #define UPDBGCHECKINFO_FLAG_6 (1 << 6) // disable water ripples #define UPDBGCHECKINFO_FLAG_7 (1 << 7) // alternate wall check? -typedef enum { +typedef enum NpcTalkState { /* 0x0 */ NPC_TALK_STATE_IDLE, // NPC not currently talking to player /* 0x1 */ NPC_TALK_STATE_TALKING, // NPC is currently talking to player /* 0x2 */ NPC_TALK_STATE_ACTION, // An NPC-defined action triggered in the conversation /* 0x3 */ NPC_TALK_STATE_ITEM_GIVEN // NPC finished giving an item and text box is done } NpcTalkState; -typedef enum { +typedef enum NpcTrackingMode { /* 0x0 */ NPC_TRACKING_PLAYER_AUTO_TURN, // Determine tracking mode based on player position, see Npc_UpdateAutoTurn /* 0x1 */ NPC_TRACKING_NONE, // Don't track the target (usually the player) /* 0x2 */ NPC_TRACKING_HEAD_AND_TORSO, // Track target by turning the head and the torso @@ -698,7 +698,7 @@ typedef enum { /* 0x4 */ NPC_TRACKING_FULL_BODY // Track target by turning the body, torso and head } NpcTrackingMode; -typedef struct { +typedef struct NpcInteractInfo { /* 0x00 */ s16 talkState; /* 0x02 */ s16 trackingMode; /* 0x04 */ s16 autoTurnTimer; diff --git a/include/z64animation.h b/include/z64animation.h index ff4df48a22..5a561cad97 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -16,14 +16,14 @@ struct SkelAnime; #define LIMB_DONE 0xFF -typedef struct { +typedef struct StandardLimb { /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent /* 0x06 */ u8 child; /* 0x07 */ u8 sibling; /* 0x08 */ Gfx* dList; } StandardLimb; // size = 0xC -typedef struct { +typedef struct LodLimb { /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent /* 0x06 */ u8 child; /* 0x07 */ u8 sibling; @@ -31,13 +31,13 @@ typedef struct { } LodLimb; // size = 0x10 // Model has limbs with only rigid meshes -typedef struct { +typedef struct SkeletonHeader { /* 0x00 */ void** segment; /* 0x04 */ u8 limbCount; } SkeletonHeader; // size = 0x8 // Model has limbs with flexible meshes -typedef struct { +typedef struct FlexSkeletonHeader { /* 0x00 */ SkeletonHeader sh; /* 0x08 */ u8 dListCount; } FlexSkeletonHeader; // size = 0xC @@ -47,22 +47,22 @@ typedef struct { */ // Index into the frame data table. -typedef struct { +typedef struct JointIndex { /* 0x00 */ u16 x; /* 0x02 */ u16 y; /* 0x04 */ u16 z; } JointIndex; // size = 0x06 -typedef struct { +typedef struct AnimationHeaderCommon { /* 0x00 */ s16 frameCount; } AnimationHeaderCommon; -typedef struct { +typedef struct LinkAnimationHeader { /* 0x00 */ AnimationHeaderCommon common; /* 0x04 */ void* segment; } LinkAnimationHeader; // size = 0x8 -typedef struct { +typedef struct AnimationHeader { /* 0x00 */ AnimationHeaderCommon common; /* 0x04 */ s16* frameData; // "tbl" /* 0x08 */ JointIndex* jointIndices; // "ref_tbl" @@ -73,7 +73,7 @@ typedef struct { * SkelAnime */ -typedef enum { +typedef enum AnimationMode { /* 0 */ ANIMMODE_LOOP, /* 1 */ ANIMMODE_LOOP_INTERP, /* 2 */ ANIMMODE_ONCE, @@ -82,7 +82,7 @@ typedef enum { /* 5 */ ANIMMODE_LOOP_PARTIAL_INTERP } AnimationMode; -typedef enum { +typedef enum AnimationTapers { /* -1 */ ANIMTAPER_DECEL = -1, /* 0 */ ANIMTAPER_NONE, /* 1 */ ANIMTAPER_ACCEL @@ -253,7 +253,7 @@ void Animation_EndLoop(SkelAnime* skelAnime); void Animation_Reverse(SkelAnime* skelAnime); void Animation_SetMorph(struct PlayState* play, SkelAnime* skelAnime, f32 morphFrames); -typedef struct { +typedef struct AnimationInfo { /* 0x00 */ AnimationHeader* animation; /* 0x04 */ f32 playSpeed; /* 0x08 */ f32 startFrame; @@ -264,21 +264,21 @@ typedef struct { void Animation_ChangeByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo, s32 index); -typedef struct { +typedef struct AnimationFrameCountInfo { /* 0x00 */ AnimationHeader* animation; /* 0x04 */ f32 frameCount; /* 0x08 */ u8 mode; /* 0x0C */ f32 morphFrames; } AnimationFrameCountInfo; // size = 0x10 -typedef struct { +typedef struct AnimationSpeedInfo { /* 0x00 */ AnimationHeader* animation; /* 0x04 */ f32 playSpeed; /* 0x08 */ u8 mode; /* 0x0C */ f32 morphFrames; } AnimationSpeedInfo; // size = 0x10 -typedef struct { +typedef struct AnimationMinimalInfo { /* 0x00 */ AnimationHeader* animation; /* 0x04 */ u8 mode; /* 0x08 */ f32 morphFrames; @@ -296,7 +296,7 @@ s16 Animation_GetLastFrame(void* animation); * Animation Task Queue */ -typedef enum { +typedef enum AnimTaskType { /* 0 */ ANIMTASK_LOAD_PLAYER_FRAME, /* 1 */ ANIMTASK_COPY, /* 2 */ ANIMTASK_INTERP, @@ -305,20 +305,20 @@ typedef enum { /* 5 */ ANIMTASK_ACTOR_MOVE } AnimTaskType; -typedef struct { +typedef struct AnimTaskLoadPlayerFrame { /* 0x00 */ DmaRequest req; /* 0x20 */ OSMesgQueue msgQueue; /* 0x38 */ OSMesg msg; } AnimTaskLoadPlayerFrame; // size = 0x3C -typedef struct { +typedef struct AnimTaskCopy { /* 0x00 */ u8 group; /* 0x01 */ u8 vecCount; /* 0x04 */ Vec3s* dest; /* 0x08 */ Vec3s* src; } AnimTaskCopy; // size = 0xC -typedef struct { +typedef struct AnimTaskInterp { /* 0x00 */ u8 group; /* 0x01 */ u8 vecCount; /* 0x04 */ Vec3s* base; @@ -326,7 +326,7 @@ typedef struct { /* 0x0C */ f32 weight; } AnimTaskInterp; // size = 0x10 -typedef struct { +typedef struct AnimTaskCopyUsingMap { /* 0x00 */ u8 group; /* 0x01 */ u8 vecCount; /* 0x04 */ Vec3s* dest; @@ -334,7 +334,7 @@ typedef struct { /* 0x0C */ u8* limbCopyMap; } AnimTaskCopyUsingMap; // size = 0x10 -typedef struct { +typedef struct AnimTaskCopyUsingMapInverted { /* 0x00 */ u8 group; /* 0x01 */ u8 vecCount; /* 0x04 */ Vec3s* dest; @@ -342,13 +342,13 @@ typedef struct { /* 0x0C */ u8* limbCopyMap; } AnimTaskCopyUsingMapInverted; // size = 0x10 -typedef struct { +typedef struct AnimTaskActorMove { /* 0x00 */ struct Actor* actor; /* 0x04 */ struct SkelAnime* skelAnime; /* 0x08 */ f32 diffScaleY; } AnimTaskActorMove; // size = 0xC -typedef union { +typedef union AnimTaskData { AnimTaskLoadPlayerFrame loadPlayerFrame; AnimTaskCopy copy; AnimTaskInterp interp; @@ -357,7 +357,7 @@ typedef union { AnimTaskActorMove actorMove; } AnimTaskData; // size = 0x3C -typedef struct { +typedef struct AnimTask { /* 0x00 */ u8 type; /* 0x04 */ AnimTaskData data; } AnimTask; // size = 0x40 diff --git a/include/z64animation_legacy.h b/include/z64animation_legacy.h index f4c222a5cc..066a8faa33 100644 --- a/include/z64animation_legacy.h +++ b/include/z64animation_legacy.h @@ -12,7 +12,7 @@ typedef struct LegacyLimb { /* 0x01C */ struct LegacyLimb* child; } LegacyLimb; // size = 0x20 -typedef struct { +typedef struct LegacyJointKey { /* 0x00 */ s16 xMax; /* 0x02 */ s16 x; /* 0x04 */ s16 yMax; @@ -21,7 +21,7 @@ typedef struct { /* 0x0A */ s16 z; } LegacyJointKey; // size = 0x0C -typedef struct { +typedef struct LegacyAnimationHeader { /* 0x00 */ s16 frameCount; /* 0x02 */ s16 limbCount; /* 0x04 */ s16* frameData; diff --git a/include/z64audio.h b/include/z64audio.h index 1ec0f4a4d3..006e6d3186 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -62,14 +62,14 @@ typedef void (*AudioCustomUpdateFunction)(void); #define AUDIO_RELOCATED_ADDRESS_START K0BASE -typedef enum { +typedef enum SoundMode { /* 0 */ SOUNDMODE_STEREO, /* 1 */ SOUNDMODE_HEADSET, /* 2 */ SOUNDMODE_SURROUND, /* 3 */ SOUNDMODE_MONO } SoundMode; -typedef enum { +typedef enum AdsrStatus { /* 0 */ ADSR_STATE_DISABLED, /* 1 */ ADSR_STATE_INITIAL, /* 2 */ ADSR_STATE_START_LOOP, @@ -81,14 +81,14 @@ typedef enum { /* 8 */ ADSR_STATE_SUSTAIN } AdsrStatus; -typedef enum { +typedef enum SampleMedium { /* 0 */ MEDIUM_RAM, /* 1 */ MEDIUM_UNK, /* 2 */ MEDIUM_CART, /* 3 */ MEDIUM_DISK_DRIVE } SampleMedium; -typedef enum { +typedef enum SampleCodec { /* 0 */ CODEC_ADPCM, // 16 2-byte samples (32 bytes) compressed into 4-bit samples (8 bytes) + 1 header byte /* 1 */ CODEC_S8, // 16 2-byte samples (32 bytes) compressed into 8-bit samples (16 bytes) /* 2 */ CODEC_S16_INMEMORY, @@ -97,20 +97,20 @@ typedef enum { /* 5 */ CODEC_S16 } SampleCodec; -typedef enum { +typedef enum SampleBankTableType { /* 0 */ SEQUENCE_TABLE, /* 1 */ FONT_TABLE, /* 2 */ SAMPLE_TABLE } SampleBankTableType; -typedef enum { +typedef enum AudioCacheType { /* 0 */ CACHE_TEMPORARY, /* 1 */ CACHE_PERSISTENT, /* 2 */ CACHE_EITHER, /* 3 */ CACHE_PERMANENT } AudioCacheType; -typedef enum { +typedef enum AudioLoadStatus { /* 0 */ LOAD_STATUS_NOT_LOADED, // the entry data is not loaded /* 1 */ LOAD_STATUS_IN_PROGRESS, // the entry data is being loaded asynchronously /* 2 */ LOAD_STATUS_COMPLETE, // the entry data is loaded, it may be discarded if not stored persistently, and either no longer in use, or the memory is needed for something else @@ -154,19 +154,19 @@ typedef struct NotePool { // direction is "supported" by setting extent to be negative. The code // exterpolates exponentially in the wrong direction in that case, but that // doesn't prevent seqplayer from doing it, AFAICT. -typedef struct { +typedef struct Portamento { /* 0x00 */ u8 mode; // bit 0x80 denotes something; the rest are an index 0-5 /* 0x02 */ u16 cur; /* 0x04 */ u16 speed; /* 0x08 */ f32 extent; } Portamento; // size = 0xC -typedef struct { +typedef struct EnvelopePoint { /* 0x0 */ s16 delay; /* 0x2 */ s16 arg; } EnvelopePoint; // size = 0x4 -typedef struct { +typedef struct AdpcmLoop { /* 0x00 */ u32 start; /* 0x04 */ u32 end; /* 0x08 */ u32 count; @@ -174,13 +174,13 @@ typedef struct { /* 0x10 */ s16 predictorState[16]; // only exists if count != 0. 8-byte aligned } AdpcmLoop; // size = 0x30 (or 0x10) -typedef struct { +typedef struct AdpcmBook { /* 0x00 */ s32 order; /* 0x04 */ s32 numPredictors; /* 0x08 */ s16 book[1]; // size 8 * order * numPredictors. 8-byte aligned } AdpcmBook; // size >= 0x8 -typedef struct { +typedef struct Sample { /* 0x00 */ u32 codec : 4; // The state of compression or decompression /* 0x00 */ u32 medium : 2; // Medium where sample is currently stored /* 0x00 */ u32 unk_bit26 : 1; @@ -191,12 +191,12 @@ typedef struct { /* 0x0C */ AdpcmBook* book; // Adpcm book parameters used by the sample. Offset from the start of the sound font / pointer to ram } Sample; // size = 0x10 -typedef struct { +typedef struct TunedSample { /* 0x00 */ Sample* sample; /* 0x04 */ f32 tuning; // frequency scale factor } TunedSample; // size = 0x8 -typedef struct { +typedef struct Instrument { /* 0x00 */ u8 isRelocated; // have the envelope and all samples been relocated (offsets to pointers) /* 0x01 */ u8 normalRangeLo; /* 0x02 */ u8 normalRangeHi; @@ -207,7 +207,7 @@ typedef struct { /* 0x18 */ TunedSample highPitchTunedSample; } Instrument; // size = 0x20 -typedef struct { +typedef struct Drum { /* 0x00 */ u8 adsrDecayIndex; // index used to obtain adsr decay rate from adsrDecayTable /* 0x01 */ u8 pan; /* 0x02 */ u8 isRelocated; // have tunedSample.sample and envelope been relocated (offsets to pointers) @@ -215,14 +215,14 @@ typedef struct { /* 0x0C */ EnvelopePoint* envelope; } Drum; // size = 0x10 -typedef struct { +typedef struct SoundEffect { /* 0x00 */ TunedSample tunedSample; } SoundEffect; // size = 0x08 /** * Stores parsed information from soundfont data */ -typedef struct { +typedef struct SoundFont { /* 0x00 */ u8 numInstruments; /* 0x01 */ u8 numDrums; /* 0x02 */ u8 sampleBankId1; @@ -233,7 +233,7 @@ typedef struct { /* 0x10 */ SoundEffect* soundEffects; } SoundFont; // size = 0x14 -typedef struct { +typedef struct ReverbRingBufferItem { /* 0x00 */ s16 numSamplesAfterDownsampling; // never read /* 0x02 */ s16 chunkLen; // never read /* 0x04 */ s16* toDownsampleLeft; @@ -246,7 +246,7 @@ typedef struct { /* 0x18 */ u16 unk_18; } ReverbRingBufferItem; // size = 0x1C -typedef struct { +typedef struct SynthesisReverb { /* 0x000 */ u8 resampleFlags; /* 0x001 */ u8 useReverb; /* 0x002 */ u8 framesToIgnore; @@ -286,7 +286,7 @@ typedef struct { /* 0x298 */ AdpcmLoop loop; } SynthesisReverb; // size = 0x2C8 -typedef struct { +typedef struct SeqScriptState { /* 0x00 */ u8* pc; // program counter /* 0x04 */ u8* stack[4]; /* 0x14 */ u8 remLoopIters[4]; // remaining loop iterations @@ -295,7 +295,7 @@ typedef struct { } SeqScriptState; // size = 0x1C // Also known as a Group, according to debug strings. -typedef struct { +typedef struct SequencePlayer { /* 0x000 */ u8 enabled : 1; /* 0x000 */ u8 finished : 1; /* 0x000 */ u8 muted : 1; @@ -337,13 +337,13 @@ typedef struct { /* 0x158 */ s8 seqScriptIO[8]; } SequencePlayer; // size = 0x160 -typedef struct { +typedef struct AdsrSettings { /* 0x0 */ u8 decayIndex; // index used to obtain adsr decay rate from adsrDecayTable /* 0x1 */ u8 sustain; /* 0x4 */ EnvelopePoint* envelope; } AdsrSettings; // size = 0x8 -typedef struct { +typedef struct AdsrState { /* 0x00 */ union { struct A { /* 0x00 */ u8 unused : 1; @@ -365,7 +365,7 @@ typedef struct { /* 0x1C */ EnvelopePoint* envelope; } AdsrState; // size = 0x20 -typedef struct { +typedef struct StereoData { /* 0x00 */ u8 unused : 2; /* 0x00 */ u8 bit2 : 2; /* 0x00 */ u8 strongRight : 1; @@ -374,12 +374,12 @@ typedef struct { /* 0x00 */ u8 usesHeadsetPanEffects : 1; } StereoData; // size = 0x1 -typedef union { +typedef union Stereo { /* 0x00 */ StereoData s; /* 0x00 */ u8 asByte; } Stereo; // size = 0x1 -typedef struct { +typedef struct NoteAttributes { /* 0x00 */ u8 reverb; /* 0x01 */ u8 gain; // Increases volume by a multiplicative scaling factor. Represented as a UQ4.4 number /* 0x02 */ u8 pan; @@ -498,7 +498,7 @@ typedef struct SequenceLayer { /* 0x70 */ AudioListItem listItem; } SequenceLayer; // size = 0x80 -typedef struct { +typedef struct NoteSynthesisBuffers { /* 0x000 */ s16 adpcmdecState[16]; /* 0x020 */ s16 finalResampleState[16]; /* 0x040 */ s16 mixEnvelopeState[32]; @@ -507,7 +507,7 @@ typedef struct { /* 0x0E0 */ s16 combFilterState[128]; } NoteSynthesisBuffers; // size = 0x1E0 -typedef struct { +typedef struct NoteSynthesisState { /* 0x00 */ u8 restart; /* 0x01 */ u8 sampleDmaIndex; /* 0x02 */ u8 prevHaasEffectLeftDelaySize; @@ -524,7 +524,7 @@ typedef struct { /* 0x1C */ char unk_1C[0x4]; } NoteSynthesisState; // size = 0x20 -typedef struct { +typedef struct VibratoState { /* 0x00 */ struct SequenceChannel* channel; /* 0x04 */ u32 time; /* 0x08 */ s16* curve; // sineWave @@ -536,7 +536,7 @@ typedef struct { /* 0x1A */ u16 delay; } VibratoState; // size = 0x1C -typedef struct { +typedef struct NotePlaybackState { /* 0x00 */ u8 priority; /* 0x01 */ u8 waveId; /* 0x02 */ u8 harmonicIndex; // the harmonic index for the synthetic wave contained in gWaveSamples (also matches the base 2 logarithm of the harmonic order) @@ -555,7 +555,7 @@ typedef struct { /* 0x6C */ VibratoState vibratoState; } NotePlaybackState; // size = 0x88 -typedef struct { +typedef struct NoteSubEu { struct { /* 0x00 */ volatile u8 enabled : 1; /* 0x00 */ u8 needsInit : 1; @@ -600,7 +600,7 @@ typedef struct Note { /* 0xC0 */ NoteSubEu noteSubEu; } Note; // size = 0xE0 -typedef struct { +typedef struct ReverbSettings { /* 0x00 */ u8 downsampleRate; /* 0x02 */ u16 windowSize; /* 0x04 */ u16 decayRatio; // determines how much reverb persists @@ -619,7 +619,7 @@ typedef struct { * The high-level audio specifications requested when initializing or resetting the audio heap. * The audio heap can be reset on various occasions, including on most scene transitions. */ -typedef struct { +typedef struct AudioSpec { /* 0x00 */ u32 samplingFrequency; // Target sampling rate in Hz /* 0x04 */ u8 unk_04; /* 0x05 */ u8 numNotes; @@ -646,7 +646,7 @@ typedef struct { * digital-analog converter (DAC), then to play on the speakers. The audio buffer is written to by the rsp after * processing audio commands. This struct parameterizes that buffer. */ -typedef struct { +typedef struct AudioBufferParameters { /* 0x00 */ s16 specUnk4; /* 0x02 */ u16 samplingFrequency; // Target sampling rate in Hz /* 0x04 */ u16 aiSamplingFrequency; // True sampling rate of the audio interface (AI), see `osAiSetFrequency` @@ -667,7 +667,7 @@ typedef struct { /** * Meta-data associated with a pool (contained within the Audio Heap) */ -typedef struct { +typedef struct AudioAllocPool { /* 0x0 */ u8* startRamAddr; // start addr of the pool /* 0x4 */ u8* curRamAddr; // address of the next available memory for allocation /* 0x8 */ s32 size; // size of the pool @@ -677,7 +677,7 @@ typedef struct { /** * Audio cache entry data to store a single entry containing either a sequence, soundfont, or entire sample banks */ -typedef struct { +typedef struct AudioCacheEntry { /* 0x0 */ u8* ramAddr; /* 0x4 */ u32 size; /* 0x8 */ s16 tableType; @@ -687,7 +687,7 @@ typedef struct { /** * Audio cache entry data to store a single entry containing an individual sample */ -typedef struct { +typedef struct SampleCacheEntry { /* 0x00 */ s8 inUse; /* 0x01 */ s8 origMedium; /* 0x02 */ s8 sampleBankId; @@ -700,48 +700,48 @@ typedef struct { /** * Audio cache entry data to store individual samples */ -typedef struct { +typedef struct AudioSampleCache { /* 0x000 */ AudioAllocPool pool; /* 0x010 */ SampleCacheEntry entries[32]; /* 0x290 */ s32 numEntries; } AudioSampleCache; // size = 0x294 -typedef struct { +typedef struct AudioPersistentCache { /* 0x00*/ u32 numEntries; /* 0x04*/ AudioAllocPool pool; /* 0x14*/ AudioCacheEntry entries[16]; } AudioPersistentCache; // size = 0xD4 -typedef struct { +typedef struct AudioTemporaryCache { /* 0x00*/ u32 nextSide; /* 0x04*/ AudioAllocPool pool; /* 0x14*/ AudioCacheEntry entries[2]; } AudioTemporaryCache; // size = 0x3C -typedef struct { +typedef struct AudioCache { /* 0x000*/ AudioPersistentCache persistent; /* 0x0D4*/ AudioTemporaryCache temporary; /* 0x100*/ u8 unk_100[0x10]; } AudioCache; // size = 0x110 -typedef struct { +typedef struct AudioCachePoolSplit { /* 0x0 */ u32 persistentCommonPoolSize; /* 0x4 */ u32 temporaryCommonPoolSize; } AudioCachePoolSplit; // size = 0x8 -typedef struct { +typedef struct AudioCommonPoolSplit { /* 0x0 */ u32 seqCacheSize; /* 0x4 */ u32 fontCacheSize; /* 0x8 */ u32 sampleBankCacheSize; } AudioCommonPoolSplit; // size = 0xC -typedef struct { +typedef struct AudioSessionPoolSplit { /* 0x0 */ u32 miscPoolSize; /* 0x4 */ u32 unkSizes[2]; /* 0xC */ u32 cachePoolSize; } AudioSessionPoolSplit; // size = 0x10 -typedef struct { +typedef struct AudioPreloadReq { /* 0x00 */ u32 endAndMediumKey; /* 0x04 */ Sample* sample; /* 0x08 */ u8* ramAddr; @@ -752,7 +752,7 @@ typedef struct { /** * Audio commands used to transfer audio requests from the graph thread to the audio thread */ -typedef struct { +typedef struct AudioCmd { /* 0x0 */ union{ u32 opArgs; struct { @@ -773,7 +773,7 @@ typedef struct { }; } AudioCmd; // size = 0x8 -typedef struct { +typedef struct AudioAsyncLoad { /* 0x00 */ s8 status; /* 0x01 */ s8 delay; /* 0x02 */ s8 medium; @@ -790,7 +790,7 @@ typedef struct { /* 0x40 */ OSIoMesg ioMesg; } AudioAsyncLoad; // size = 0x58 -typedef struct { +typedef struct AudioSlowLoad { /* 0x00 */ u8 medium; /* 0x01 */ u8 seqOrFontId; /* 0x02 */ u16 instId; @@ -807,7 +807,7 @@ typedef struct { /* 0x4C */ OSIoMesg ioMesg; } AudioSlowLoad; // size = 0x64 -typedef struct { +typedef struct AudioTableEntry { /* 0x00 */ u32 romAddr; /* 0x04 */ u32 size; /* 0x08 */ s8 medium; @@ -817,7 +817,7 @@ typedef struct { /* 0x0E */ s16 shortData3; } AudioTableEntry; // size = 0x10 -typedef struct { +typedef struct AudioTable { /* 0x00 */ s16 numEntries; /* 0x02 */ s16 unkMediumParam; /* 0x04 */ u32 romAddr; @@ -825,7 +825,7 @@ typedef struct { /* 0x10 */ AudioTableEntry entries[1]; // (dynamic size) } AudioTable; // size >= 0x20 -typedef struct { +typedef struct SampleDma { /* 0x00 */ u8* ramAddr; /* 0x04 */ u32 devAddr; /* 0x08 */ u16 sizeUnused; @@ -835,14 +835,14 @@ typedef struct { /* 0x0E */ u8 ttl; // duration after which the DMA can be discarded } SampleDma; // size = 0x10 -typedef struct { +typedef struct AudioTask { /* 0x00 */ OSTask task; /* 0x40 */ OSMesgQueue* msgQueue; /* 0x44 */ void* unk_44; // probably a message that gets unused. /* 0x48 */ char unk_48[0x8]; } AudioTask; // size = 0x50 -typedef struct { +typedef struct AudioContext { /* 0x0000 */ char unk_0000; /* 0x0001 */ s8 numSynthesisReverbs; /* 0x0002 */ u16 unk_2; // reads from audio spec unk_14, never used, always set to 0x7FFF @@ -968,7 +968,7 @@ typedef struct { /* 0x5C50 */ AudioCmd threadCmdBuf[0x100]; // Audio thread commands used to transfer audio requests from the graph thread to the audio thread } AudioContext; // size = 0x6450 -typedef struct { +typedef struct NoteSubAttributes { /* 0x00 */ u8 reverbVol; /* 0x01 */ u8 gain; // Increases volume by a multiplicative scaling factor. Represented as a UQ4.4 number /* 0x02 */ u8 pan; @@ -981,12 +981,12 @@ typedef struct { /* 0x16 */ u16 combFilterGain; } NoteSubAttributes; // size = 0x18 -typedef struct { +typedef struct TempoData { /* 0x0 */ s16 unk_00; // set to 0x1C00, unused /* 0x2 */ s16 seqTicksPerBeat; } TempoData; // size = 0x4 -typedef struct { +typedef struct AudioHeapInitSizes { /* 0x00 */ u32 heapSize; // total number of bytes allocated to the audio heap. Must be <= the size of `gAudioHeap` (ideally about the same size) /* 0x04 */ u32 initPoolSize; // The entire audio heap is split into two pools. /* 0x08 */ u32 permanentPoolSize; diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index 6a66cc829c..d5364a24b3 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -23,7 +23,7 @@ struct DynaPolyActor; #define FUNC_80041EA4_STOP 8 #define FUNC_80041EA4_VOID_OUT 12 -typedef struct { +typedef struct ScaleRotPos { /* 0x00 */ Vec3f scale; /* 0x0C */ Vec3s rot; /* 0x14 */ Vec3f pos; @@ -66,7 +66,7 @@ typedef struct CollisionPoly { /* 0x0E */ s16 dist; // Plane distance from origin along the normal } CollisionPoly; // size = 0x10 -typedef struct { +typedef struct BgCamInfo { /* 0x0 */ u16 setting; // camera setting described by CameraSettingType enum /* 0x2 */ s16 count; // only used when `bgCamFuncData` is a list of points used for crawlspaces /* 0x4 */ Vec3s* bgCamFuncData; // s16 data grouped in threes (ex. Vec3s), is usually of type `BgCamFuncData`, but can be a list of points of type `Vec3s` for crawlspaces @@ -74,7 +74,7 @@ typedef struct { // The structure used for all instances of s16 data from `BgCamInfo` with the exception of crawlspaces. // See `Camera_Subj4` for Vec3s data usage in crawlspaces -typedef struct { +typedef struct BgCamFuncData { /* 0x00 */ Vec3s pos; /* 0x06 */ Vec3s rot; /* 0x0C */ s16 fov; @@ -101,7 +101,7 @@ typedef struct { (((room) & 0x3F) << 13) | \ (((setFlag19) & 1) << 19)) -typedef struct { +typedef struct WaterBox { /* 0x00 */ s16 xMin; /* 0x02 */ s16 ySurface; /* 0x04 */ s16 zMin; @@ -110,7 +110,7 @@ typedef struct { /* 0x0C */ u32 properties; } WaterBox; // size = 0x10 -typedef enum { +typedef enum FloorType { /* 0 */ FLOOR_TYPE_0, /* 1 */ FLOOR_TYPE_1, /* 2 */ FLOOR_TYPE_2, @@ -126,7 +126,7 @@ typedef enum { /* 12 */ FLOOR_TYPE_12 } FloorType; -typedef enum { +typedef enum WallType { /* 0 */ WALL_TYPE_0, /* 1 */ WALL_TYPE_1, /* 2 */ WALL_TYPE_2, @@ -152,7 +152,7 @@ typedef enum { #define WALL_FLAG_6 (1 << 6) #define WALL_FLAG_CRAWLSPACE (WALL_FLAG_CRAWLSPACE_1 | WALL_FLAG_CRAWLSPACE_2) -typedef enum { +typedef enum FloorProperty { /* 0 */ FLOOR_PROPERTY_0, /* 5 */ FLOOR_PROPERTY_5 = 5, /* 6 */ FLOOR_PROPERTY_6, @@ -163,7 +163,7 @@ typedef enum { /* 12 */ FLOOR_PROPERTY_12 } FloorProperty; -typedef enum { +typedef enum SurfaceSfxOffset { /* 0 */ SURFACE_SFX_OFFSET_DIRT, /* 1 */ SURFACE_SFX_OFFSET_SAND, /* 2 */ SURFACE_SFX_OFFSET_STONE, @@ -182,7 +182,7 @@ typedef enum { /* 15 */ SURFACE_SFX_OFFSET_ICE } SurfaceSfxOffset; -typedef enum { +typedef enum SurfaceMaterial { /* 0 */ SURFACE_MATERIAL_DIRT, /* 1 */ SURFACE_MATERIAL_SAND, /* 2 */ SURFACE_MATERIAL_STONE, @@ -200,13 +200,13 @@ typedef enum { /* 14 */ SURFACE_MATERIAL_MAX } SurfaceMaterial; -typedef enum { +typedef enum FloorEffect { /* 0 */ FLOOR_EFFECT_0, /* 1 */ FLOOR_EFFECT_1, /* 2 */ FLOOR_EFFECT_2 } FloorEffect; -typedef enum { +typedef enum ConveyorSpeed { /* 0 */ CONVEYOR_SPEED_DISABLED, /* 1 */ CONVEYOR_SPEED_SLOW, /* 2 */ CONVEYOR_SPEED_MEDIUM, @@ -237,11 +237,11 @@ typedef enum { (((conveyorDirection) & 0x3F) << 21) | \ (((unk27) & 1) << 27)) -typedef struct { +typedef struct SurfaceType { u32 data[2]; } SurfaceType; -typedef struct { +typedef struct CollisionHeader { /* 0x00 */ Vec3s minBounds; // minimum coordinates of poly bounding box /* 0x06 */ Vec3s maxBounds; // maximum coordinates of poly bounding box /* 0x0C */ u16 numVertices; @@ -254,16 +254,16 @@ typedef struct { /* 0x28 */ WaterBox* waterBoxes; } CollisionHeader; // original name: BGDataInfo -typedef struct { +typedef struct SSNode { s16 polyId; u16 next; // next SSNode index } SSNode; -typedef struct { +typedef struct SSList { u16 head; // first SSNode index } SSList; -typedef struct { +typedef struct SSNodeList { /* 0x00 */ u16 max; // original name: short_slist_node_size /* 0x02 */ u16 count; // original name: short_slist_node_last_index /* 0x04 */ SSNode* tbl; // original name: short_slist_node_tbl @@ -271,26 +271,26 @@ typedef struct { // bg check, and set to 1 if that poly has already been tested. } SSNodeList; -typedef struct { +typedef struct DynaSSNodeList { SSNode* tbl; s32 count; s32 max; } DynaSSNodeList; -typedef struct { +typedef struct StaticLookup { SSList floor; SSList wall; SSList ceiling; } StaticLookup; -typedef struct { +typedef struct DynaLookup { u16 polyStartIndex; SSList ceiling; SSList wall; SSList floor; } DynaLookup; -typedef struct { +typedef struct BgActor { /* 0x00 */ struct Actor* actor; /* 0x04 */ CollisionHeader* colHeader; /* 0x08 */ DynaLookup dynaLookup; @@ -307,7 +307,7 @@ typedef struct { #define BGACTOR_COLLISION_DISABLED (1 << 2) // The collision of the bgActor is disabled #define BGACTOR_CEILING_COLLISION_DISABLED (1 << 3) // The ceilings in the collision of the bgActor are ignored -typedef struct { +typedef struct DynaCollisionContext { /* 0x0000 */ u8 bitFlag; /* 0x0004 */ BgActor bgActors[BG_ACTOR_MAX]; /* 0x138C */ u16 bgActorFlags[BG_ACTOR_MAX]; @@ -332,7 +332,7 @@ typedef struct CollisionContext { /* 0x1460 */ u32 memSize; // Size of all allocated memory plus CollisionContext } CollisionContext; // size = 0x1464 -typedef struct { +typedef struct DynaRaycastDown { /* 0x00 */ struct PlayState* play; /* 0x04 */ struct CollisionContext* colCtx; /* 0x08 */ u16 xpFlags; @@ -347,7 +347,7 @@ typedef struct { /* 0x2C */ SSList* ssList; } DynaRaycastDown; -typedef struct { +typedef struct DynaLineTest { /* 0x00 */ struct CollisionContext* colCtx; /* 0x04 */ u16 xpFlags; /* 0x08 */ DynaCollisionContext* dyna; diff --git a/include/z64camera.h b/include/z64camera.h index 3214bdab12..ee28d87f1c 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -133,7 +133,7 @@ struct Actor; struct CollisionPoly; -typedef enum { +typedef enum CameraSettingType { /* 0x00 */ CAM_SET_NONE, /* 0x01 */ CAM_SET_NORMAL0, /* 0x02 */ CAM_SET_NORMAL1, @@ -203,7 +203,7 @@ typedef enum { /* 0x42 */ CAM_SET_MAX } CameraSettingType; -typedef enum { +typedef enum CameraModeType { /* 0x00 */ CAM_MODE_NORMAL, /* 0x01 */ CAM_MODE_Z_PARALLEL, // Holding Z but with no target, keeps the camera aligned /* 0x02 */ CAM_MODE_Z_TARGET_FRIENDLY, @@ -228,7 +228,7 @@ typedef enum { /* 0x15 */ CAM_MODE_MAX } CameraModeType; -typedef enum { +typedef enum CameraFuncType { /* 0x00 */ CAM_FUNC_NONE, /* 0x01 */ CAM_FUNC_NORM0, /* 0x02 */ CAM_FUNC_NORM1, @@ -303,7 +303,7 @@ typedef enum { /* 0x47 */ CAM_FUNC_MAX } CameraFuncType; -typedef enum { +typedef enum CameraDataType { /* 0x00 */ CAM_DATA_Y_OFFSET, /* 0x01 */ CAM_DATA_EYE_DIST, /* 0x02 */ CAM_DATA_EYE_DIST_NEXT, @@ -337,7 +337,7 @@ typedef enum { #define CAM_FUNCDATA_INTERFACE_FIELD(interfaceField) \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct SwingAnimation { /* 0x00 */ Vec3f collisionClosePoint; /* 0x0C */ struct CollisionPoly* atEyePoly; /* 0x10 */ f32 swingUpdateRate; @@ -347,7 +347,7 @@ typedef struct { /* 0x1A */ s16 swingUpdateRateTimer; } SwingAnimation; // size = 0x1C -typedef struct { +typedef struct Normal1ReadOnlyData { /* 0x00 */ f32 yOffset; /* 0x04 */ f32 distMin; /* 0x08 */ f32 distMax; @@ -360,7 +360,7 @@ typedef struct { /* 0x22 */ s16 interfaceField; } Normal1ReadOnlyData; // size = 0x24 -typedef struct { +typedef struct Normal1ReadWriteData { /* 0x00 */ SwingAnimation swing; /* 0x1C */ f32 yOffset; /* 0x20 */ f32 unk_20; @@ -370,7 +370,7 @@ typedef struct { /* 0x2A */ s16 startSwingTimer; } Normal1ReadWriteData; // size = 0x2C -typedef struct { +typedef struct Normal1 { /* 0x00 */ Normal1ReadOnlyData roData; /* 0x24 */ Normal1ReadWriteData rwData; } Normal1; // size = 0x50 @@ -406,7 +406,7 @@ typedef struct { { atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Normal2ReadOnlyData { /* 0x00 */ f32 unk_00; /* 0x04 */ f32 unk_04; /* 0x08 */ f32 unk_08; @@ -418,7 +418,7 @@ typedef struct { /* 0x1E */ s16 interfaceField; } Normal2ReadOnlyData; // size = 0x20 -typedef struct { +typedef struct Normal2ReadWriteData { /* 0x00 */ Vec3f unk_00; /* 0x0C */ Vec3f unk_0C; /* 0x18 */ f32 unk_18; @@ -429,7 +429,7 @@ typedef struct { /* 0x28 */ s16 unk_28; } Normal2ReadWriteData; // size = 0x2C -typedef struct { +typedef struct Normal2 { /* 0x00 */ Normal2ReadOnlyData roData; /* 0x20 */ Normal2ReadWriteData rwData; } Normal2; // size = 0x4C @@ -450,7 +450,7 @@ typedef struct { { atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Normal3ReadOnlyData { /* 0x00 */ f32 yOffset; /* 0x04 */ f32 distMin; /* 0x08 */ f32 distMax; @@ -462,7 +462,7 @@ typedef struct { /* 0x1E */ s16 interfaceField; } Normal3ReadOnlyData; // size = 0x20 -typedef struct { +typedef struct Normal3ReadWriteData { /* 0x00 */ SwingAnimation swing; /* 0x1C */ f32 unk_1C; /* 0x20 */ f32 unk_20; @@ -472,7 +472,7 @@ typedef struct { /* 0x2A */ s16 distTimer; } Normal3ReadWriteData; // size = 0x2C -typedef struct { +typedef struct Normal3 { /* 0x00 */ Normal3ReadOnlyData roData; /* 0x20 */ Normal3ReadWriteData rwData; } Normal3; // size = 0x4C @@ -488,7 +488,7 @@ typedef struct { { atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Parallel1ReadOnlyData { /* 0x00 */ f32 yOffset; /* 0x04 */ f32 distTarget; /* 0x08 */ f32 unk_08; @@ -502,7 +502,7 @@ typedef struct { /* 0x24 */ s16 interfaceField; } Parallel1ReadOnlyData; // size = 0x28 -typedef struct { +typedef struct Parallel1ReadWriteData { /* 0x00 */ Vec3f unk_00; /* 0x0C */ f32 yTarget; /* 0x10 */ s16 unk_10; @@ -512,7 +512,7 @@ typedef struct { /* 0x18 */ s16 animTimer; } Parallel1ReadWriteData; // size = 0x1C -typedef struct { +typedef struct Parallel1 { /* 0x00 */ Parallel1ReadOnlyData roData; /* 0x28 */ Parallel1ReadWriteData rwData; } Parallel1; // size = 0x44 @@ -542,7 +542,7 @@ typedef struct { #define PARALLEL3_FLAG_0 (1 << 0) #define PARALLEL3_FLAG_1 (1 << 1) -typedef struct { +typedef struct Jump1ReadOnlyData { /* 0x00 */ f32 atYOffset; /* 0x04 */ f32 distMin; /* 0x08 */ f32 distMax; @@ -553,7 +553,7 @@ typedef struct { /* 0x1C */ s16 interfaceField; } Jump1ReadOnlyData; // size = 0x20 -typedef struct { +typedef struct Jump1ReadWriteData { /* 0x00 */ SwingAnimation swing; /* 0x1C */ f32 unk_1C; /* 0x20 */ f32 unk_20; @@ -561,7 +561,7 @@ typedef struct { /* 0x26 */ s16 unk_26; } Jump1ReadWriteData; // size = 0x28 -typedef struct { +typedef struct Jump1 { /* 0x00 */ Jump1ReadOnlyData roData; /* 0x20 */ Jump1ReadWriteData rwData; } Jump1; // size = 0x48 @@ -579,7 +579,7 @@ typedef struct { { atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Jump2ReadOnlyData { /* 0x00 */ f32 atYOffset; /* 0x04 */ f32 minDist; /* 0x08 */ f32 maxDist; @@ -591,7 +591,7 @@ typedef struct { /* 0x20 */ s16 interfaceField; } Jump2ReadOnlyData; // size = 0x24 -typedef struct { +typedef struct Jump2ReadWriteData { /* 0x0 */ f32 floorY; /* 0x4 */ s16 yawTarget; /* 0x6 */ s16 initYawDiff; // unused, set but not read. @@ -600,7 +600,7 @@ typedef struct { /* 0xC */ s16 animTimer; } Jump2ReadWriteData; // size = 0x10 -typedef struct { +typedef struct Jump2 { /* 0x00 */ Jump2ReadOnlyData roData; /* 0x24 */ Jump2ReadWriteData rwData; } Jump2; // size = 0x34 @@ -619,7 +619,7 @@ typedef struct { { atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Jump3ReadOnlyData { /* 0x00 */ f32 yOffset; /* 0x04 */ f32 distMin; /* 0x08 */ f32 distMax; @@ -632,14 +632,14 @@ typedef struct { /* 0x22 */ s16 interfaceField; } Jump3ReadOnlyData; // size = 0x24 -typedef struct { +typedef struct Jump3ReadWriteData { /* 0x00 */ SwingAnimation swing; /* 0x1C */ f32 unk_1C; /* 0x20 */ s16 animTimer; /* 0x22 */ s16 mode; } Jump3ReadWriteData; // size = 0x24 -typedef struct { +typedef struct Jump3 { /* 0x00 */ Jump3ReadOnlyData roData; /* 0x24 */ Jump3ReadWriteData rwData; } Jump3; // size = 0x48 @@ -660,7 +660,7 @@ typedef struct { { atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Battle1ReadOnlyData { /* 0x00 */ f32 yOffset; /* 0x04 */ f32 distance; /* 0x08 */ f32 swingYawInitial; @@ -675,7 +675,7 @@ typedef struct { /* 0x2C */ s16 interfaceField; } Battle1ReadOnlyData; // size = 0x30 -typedef struct { +typedef struct Battle1ReadWriteData { /* 0x00 */ f32 initialEyeToAtDist; /* 0x04 */ f32 roll; /* 0x08 */ f32 yPosOffset; @@ -688,7 +688,7 @@ typedef struct { /* 0x1C */ s16 chargeTimer; } Battle1ReadWriteData; // size = 0x20 -typedef struct { +typedef struct Battle1 { /* 0x00 */ Battle1ReadOnlyData roData; /* 0x30 */ Battle1ReadWriteData rwData; } Battle1; // size = 0x50 @@ -711,7 +711,7 @@ typedef struct { { groundYOffset, CAM_DATA_GROUND_Y_OFFSET }, \ { groundAtLerpStepScale, CAM_DATA_GROUND_AT_LERP_STEP_SCALE } -typedef struct { +typedef struct Battle4ReadOnlyData { /* 0x00 */ f32 yOffset; /* 0x04 */ f32 rTarget; /* 0x08 */ s16 pitchTarget; @@ -722,11 +722,11 @@ typedef struct { /* 0x1A */ s16 unk_1A; } Battle4ReadOnlyData; // size = 0x1C -typedef struct { +typedef struct Battle4ReadWriteData { /* 0x0 */ s16 animTimer; } Battle4ReadWriteData; // size = 0x4 -typedef struct { +typedef struct Battle4 { /* 0x00 */ Battle4ReadOnlyData roData; /* 0x1C */ Battle4ReadWriteData rwData; } Battle4; // size = 0x20 @@ -740,7 +740,7 @@ typedef struct { { atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct KeepOn1ReadOnlyData { /* 0x00 */ f32 unk_00; /* 0x04 */ f32 unk_04; /* 0x08 */ f32 unk_08; @@ -756,7 +756,7 @@ typedef struct { /* 0x30 */ s16 interfaceField; } KeepOn1ReadOnlyData; // size = 0x34 -typedef struct { +typedef struct KeepOn1ReadWriteData { /* 0x00 */ f32 unk_00; /* 0x04 */ f32 unk_04; /* 0x08 */ f32 unk_08; @@ -767,7 +767,7 @@ typedef struct { /* 0x16 */ s16 unk_16; } KeepOn1ReadWriteData; // size = 0x18 -typedef struct { +typedef struct KeepOn1 { /* 0x00 */ KeepOn1ReadOnlyData roData; /* 0x34 */ KeepOn1ReadWriteData rwData; } KeepOn1; // size = 0x4C @@ -790,7 +790,7 @@ typedef struct { { groundYOffset, CAM_DATA_GROUND_Y_OFFSET }, \ { groundAtLerpStepScale, CAM_DATA_GROUND_AT_LERP_STEP_SCALE } -typedef struct { +typedef struct KeepOn3ReadOnlyData { /* 0x00 */ f32 yOffset; /* 0x04 */ f32 minDist; /* 0x08 */ f32 maxDist; @@ -805,7 +805,7 @@ typedef struct { /* 0x2A */ s16 interfaceField; } KeepOn3ReadOnlyData; // size = 0x2C -typedef struct { +typedef struct KeepOn3ReadWriteData { /* 0x00 */ f32 eyeToAtTargetR; /* 0x08 */ f32 eyeToAtTargetYaw; /* 0x04 */ f32 eyeToAtTargetPitch; @@ -814,7 +814,7 @@ typedef struct { /* 0x1C */ s16 animTimer; } KeepOn3ReadWriteData; // size = 0x20 -typedef struct { +typedef struct KeepOn3 { /* 0x00 */ KeepOn3ReadOnlyData roData; /* 0x2C */ KeepOn3ReadWriteData rwData; } KeepOn3; // size = 0x4C @@ -837,7 +837,7 @@ typedef struct { { yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct KeepOn4ReadOnlyData { /* 0x00 */ f32 unk_00; /* 0x04 */ f32 unk_04; /* 0x08 */ f32 unk_08; @@ -849,7 +849,7 @@ typedef struct { /* 0x1E */ s16 unk_1E; } KeepOn4ReadOnlyData; // size = 0x20 -typedef struct { +typedef struct KeepOn4ReadWriteData { /* 0x00 */ f32 unk_00; /* 0x04 */ f32 unk_04; /* 0x08 */ f32 unk_08; @@ -860,7 +860,7 @@ typedef struct { /* 0x14 */ s16 unk_14; } KeepOn4ReadWriteData; // size = 0x18 -typedef struct { +typedef struct KeepOn4 { /* 0x00 */ KeepOn4ReadOnlyData roData; /* 0x20 */ KeepOn4ReadWriteData rwData; } KeepOn4; // size = 0x38 @@ -885,19 +885,19 @@ typedef struct { { yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \ { unk_22, CAM_DATA_UNK_22 } -typedef struct { +typedef struct KeepOn0ReadOnlyData { /* 0x00 */ f32 fovScale; /* 0x04 */ f32 yawScale; /* 0x08 */ s16 timerInit; /* 0x0A */ s16 interfaceField; } KeepOn0ReadOnlyData; // size = 0x0C -typedef struct { +typedef struct KeepOn0ReadWriteData { /* 0x0 */ f32 fovTarget; /* 0x4 */ s16 animTimer; } KeepOn0ReadWriteData; // size = 0x8 -typedef struct { +typedef struct KeepOn0 { /* 0x00 */ KeepOn0ReadOnlyData roData; /* 0x0C */ KeepOn0ReadWriteData rwData; } KeepOn0; // size = 0x14 @@ -908,19 +908,19 @@ typedef struct { { yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Fixed1ReadOnlyData { /* 0x00 */ f32 unk_00; // seems to be unused? /* 0x04 */ f32 lerpStep; /* 0x08 */ f32 fov; /* 0x0C */ s16 interfaceField; } Fixed1ReadOnlyData; // size = 0x10 -typedef struct { +typedef struct Fixed1ReadWriteData { /* 0x00 */ PosRot eyePosRotTarget; /* 0x14 */ s16 fov; } Fixed1ReadWriteData; // size = 0x18 -typedef struct { +typedef struct Fixed1 { /* 0x00 */ Fixed1ReadOnlyData roData; /* 0x10 */ Fixed1ReadWriteData rwData; } Fixed1; // size = 0x28 @@ -931,7 +931,7 @@ typedef struct { { fov, CAM_DATA_FOV }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Fixed2ReadOnlyData { /* 0x00 */ f32 yOffset; /* 0x04 */ f32 eyeStepScale; /* 0x08 */ f32 posStepScale; @@ -939,12 +939,12 @@ typedef struct { /* 0x10 */ s16 interfaceField; } Fixed2ReadOnlyData; // size = 0x14 -typedef struct { +typedef struct Fixed2ReadWriteData { /* 0x0 */ Vec3f eye; /* 0xC */ s16 fov; } Fixed2ReadWriteData; // size = 0x10 -typedef struct { +typedef struct Fixed2 { /* 0x00 */ Fixed2ReadOnlyData roData; /* 0x14 */ Fixed2ReadWriteData rwData; } Fixed2; // size = 0x24 @@ -959,23 +959,23 @@ typedef struct { { fov, CAM_DATA_FOV }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Fixed3ReadOnlyData { /* 0x0 */ s16 interfaceField; } Fixed3ReadOnlyData; // size = 0x4 -typedef struct { +typedef struct Fixed3ReadWriteData { /* 0x0 */ Vec3s rot; /* 0x6 */ s16 fov; /* 0x8 */ s16 updDirTimer; /* 0xA */ s16 roomImageOverrideBgCamIndex; } Fixed3ReadWriteData; // size = 0xC -typedef struct { +typedef struct Fixed3 { /* 0x0 */ Fixed3ReadOnlyData roData; /* 0x4 */ Fixed3ReadWriteData rwData; } Fixed3; // size = 0x10 -typedef struct { +typedef struct Fixed4ReadOnlyData { /* 0x00 */ f32 yOffset; /* 0x04 */ f32 speedToEyePos; /* 0x08 */ f32 followSpeed; @@ -983,12 +983,12 @@ typedef struct { /* 0x10 */ s16 interfaceField; } Fixed4ReadOnlyData; // size = 0x14 -typedef struct { +typedef struct Fixed4ReadWriteData { /* 0x0 */ Vec3f eyeTarget; /* 0xC */ f32 followSpeed; } Fixed4ReadWriteData; // size = 0x10 -typedef struct { +typedef struct Fixed4 { /* 0x00 */ Fixed4ReadOnlyData roData; /* 0x14 */ Fixed4ReadWriteData rwData; } Fixed4; // size = 0x24 @@ -1002,7 +1002,7 @@ typedef struct { { fov, CAM_DATA_FOV }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Subj3ReadOnlyData { /* 0x00 */ f32 eyeNextYOffset; /* 0x04 */ f32 eyeDist; /* 0x08 */ f32 eyeNextDist; @@ -1012,14 +1012,14 @@ typedef struct { /* 0x20 */ s16 interfaceField; } Subj3ReadOnlyData; // size = 0x24 -typedef struct { +typedef struct Subj3ReadWriteData { /* 0x0 */ f32 r; /* 0x4 */ s16 yaw; /* 0x6 */ s16 pitch; /* 0x8 */ s16 animTimer; } Subj3ReadWriteData; // size = 0xC -typedef struct { +typedef struct Subj3 { /* 0x00 */ Subj3ReadOnlyData roData; /* 0x24 */ Subj3ReadWriteData rwData; } Subj3; // size = 0x30 @@ -1035,11 +1035,11 @@ typedef struct { { fov, CAM_DATA_FOV }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Subj4ReadOnlyData { /* 0x0 */ s16 interfaceField; } Subj4ReadOnlyData; // size = 0x4 -typedef struct { +typedef struct Subj4ReadWriteData { /* 0x00 */ InfiniteLine crawlspaceLine; /* 0x18 */ Vec3f unk_18; // unused /* 0x24 */ f32 xzSpeed; @@ -1050,7 +1050,7 @@ typedef struct { /* 0x32 */ s16 zoomTimer; } Subj4ReadWriteData; // size = 0x34 -typedef struct { +typedef struct Subj4 { /* 0x00 */ Subj4ReadOnlyData roData; /* 0x04 */ Subj4ReadWriteData rwData; } Subj4; // size = 0x38 @@ -1063,20 +1063,20 @@ typedef struct { { fov, CAM_DATA_FOV }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Data4ReadOnlyData { /* 0x0 */ f32 yOffset; /* 0x4 */ f32 fov; /* 0x8 */ s16 interfaceField; } Data4ReadOnlyData; // size = 0xC -typedef struct { +typedef struct Data4ReadWriteData { /* 0x00 */ PosRot eyePosRot; /* 0x14 */ char unk_14[0x8]; /* 0x1C */ s16 fov; /* 0x1E */ s16 flags; } Data4ReadWriteData; // size = 0x20 -typedef struct { +typedef struct Data4 { /* 0x00 */ Data4ReadOnlyData roData; /* 0x0C */ Data4ReadWriteData rwData; } Data4; // size = 0x2C @@ -1086,7 +1086,7 @@ typedef struct { { fov, CAM_DATA_FOV }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Unique1ReadOnlyData { /* 0x00 */ f32 yOffset; /* 0x04 */ f32 distMin; /* 0x08 */ f32 distMax; @@ -1097,14 +1097,14 @@ typedef struct { /* 0x1A */ s16 interfaceField; } Unique1ReadOnlyData; // size = 0x1C -typedef struct { +typedef struct Unique1ReadWriteData { /* 0x0 */ f32 unk_00; // unused /* 0x4 */ s16 yawTarget; /* 0x6 */ s16 yawTargetAdj; /* 0x8 */ s16 timer; } Unique1ReadWriteData; // size = 0xC -typedef struct { +typedef struct Unique1 { /* 0x00 */ Unique1ReadOnlyData roData; /* 0x1C */ Unique1ReadWriteData rwData; } Unique1; // size = 0x28 @@ -1118,19 +1118,19 @@ typedef struct { { atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Unique2ReadOnlyData { /* 0x00 */ f32 yOffset; /* 0x04 */ f32 distTarget; /* 0x08 */ f32 fovTarget; /* 0x0C */ s16 interfaceField; } Unique2ReadOnlyData; // size = 0x10 -typedef struct { +typedef struct Unique2ReadWriteData { /* 0x0 */ f32 unk_00; /* 0x4 */ s16 unk_04; } Unique2ReadWriteData; // size = 0x8 -typedef struct { +typedef struct Unique2 { /* 0x00 */ Unique2ReadOnlyData roData; /* 0x10 */ Unique2ReadWriteData rwData; } Unique2; // size = 0x18 @@ -1145,7 +1145,7 @@ typedef struct { { fov, CAM_DATA_FOV }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct DoorParams { /* 0x0 */ struct Actor* doorActor; /* 0x4 */ s16 bgCamIndex; /* 0x6 */ s16 timer1; @@ -1153,18 +1153,18 @@ typedef struct { /* 0xA */ s16 timer3; } DoorParams; // size = 0xC -typedef struct { +typedef struct Unique3ReadOnlyData { /* 0x0 */ f32 yOffset; /* 0x4 */ f32 fov; /* 0x8 */ s16 interfaceField; } Unique3ReadOnlyData; // size = 0xC -typedef struct { +typedef struct Unique3ReadWriteData { /* 0x0 */ f32 initialFov; /* 0x4 */ f32 initialDist; } Unique3ReadWriteData; // size = 0x8 -typedef struct { +typedef struct Unique3 { /* 0x00 */ Unique3ReadOnlyData roData; /* 0x0C */ Unique3ReadWriteData rwData; } Unique3; // size = 0x14 @@ -1177,44 +1177,44 @@ typedef struct { { fov, CAM_DATA_FOV }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Unique0ReadOnlyData { /* 0x0 */ s16 interfaceField; } Unique0ReadOnlyData; // size = 0x4 -typedef struct { +typedef struct Unique0ReadWriteData { /* 0x00 */ Vec3f initalPos; /* 0x0C */ s16 animTimer; /* 0x10 */ InfiniteLine eyeAndDirection; } Unique0ReadWriteData; // size = 0x28 -typedef struct { +typedef struct Unique0 { /* 0x00 */ Unique0ReadOnlyData roData; /* 0x04 */ Unique0ReadWriteData rwData; } Unique0; // size = 0x2C #define UNIQUE0_FLAG_0 (1 << 0) -typedef struct { +typedef struct Unique6ReadOnlyData { /* 0x0 */ s16 interfaceField; } Unique6ReadOnlyData; // size = 0x4 -typedef struct { +typedef struct Unique6 { /* 0x0 */ Unique6ReadOnlyData roData; } Unique6; // size = 0x4 #define UNIQUE6_FLAG_0 (1 << 0) -typedef struct { +typedef struct Unique7ReadOnlyData { /* 0x0 */ f32 fov; /* 0x4 */ s16 interfaceField; /* 0x6 */ s16 align; } Unique7ReadOnlyData; // size = 0x8 -typedef struct { +typedef struct Unique7ReadWriteData { /* 0x0 */ Vec3s unk_00; } Unique7ReadWriteData; // size = 0x8 -typedef struct { +typedef struct Unique7 { /* 0x00 */ Unique7ReadOnlyData roData; /* 0x08 */ Unique7ReadWriteData rwData; } Unique7; // size = 0x10 @@ -1223,7 +1223,7 @@ typedef struct { { fov, CAM_DATA_FOV }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef enum { +typedef enum OnePointCsAction { /* 0x1 */ ONEPOINT_CS_ACTION_ID_1 = 1, /* 0x2 */ ONEPOINT_CS_ACTION_ID_2, /* 0x3 */ ONEPOINT_CS_ACTION_ID_3, @@ -1272,7 +1272,7 @@ typedef enum { * 0x10: ? unused * 0x20: focus on player */ -typedef struct { +typedef struct OnePointCsFull { /* 0x00 */ u8 actionFlags; /* 0x01 */ u8 initField; /* 0x02 */ s16 viewFlags; @@ -1284,16 +1284,16 @@ typedef struct { /* 0x1C */ Vec3f eyeTargetInit; } OnePointCsFull; // size = 0x28 -typedef struct { +typedef struct OnePointCsInfo { /* 0x0 */ s32 keyFrameCount; /* 0x4 */ OnePointCsFull* keyFrames; } OnePointCsInfo; // size = 0x8 -typedef struct { +typedef struct Unique9ReadOnlyData { /* 0x0 */ s16 interfaceField; } Unique9ReadOnlyData; // size = 0x40 -typedef struct { +typedef struct Unique9ReadWriteData { /* 0x00 */ OnePointCsFull* curKeyFrame; /* 0x04 */ Vec3f atTarget; /* 0x10 */ Vec3f eyeTarget; @@ -1307,40 +1307,40 @@ typedef struct { /* 0x3C */ s16 keyFrameTimer; } Unique9ReadWriteData; // size = 0x40 -typedef struct { +typedef struct Unique9 { /* 0x00 */ OnePointCsInfo csInfo; /* 0x08 */ Unique9ReadOnlyData roData; /* 0x0C */ Unique9ReadWriteData rwData; } Unique9; // size = 0x4C -typedef struct { +typedef struct Demo1ReadOnlyData { /* 0x0 */ s16 interfaceField; } Demo1ReadOnlyData; // size = 0x4 -typedef struct { +typedef struct Demo1ReadWriteData { /* 0x0 */ f32 curFrame; /* 0x4 */ s16 keyframe; } Demo1ReadWriteData; // size = 0x14 -typedef struct { +typedef struct Demo1 { /* 0x00 */ Demo1ReadOnlyData roData; /* 0x04 */ Demo1ReadWriteData rwData; } Demo1; // size = 0x18 -typedef struct { +typedef struct Demo3ReadOnlyData { /* 0x0 */ f32 fov; /* 0x4 */ f32 unk_04; // unused /* 0x8 */ s16 interfaceField; } Demo3ReadOnlyData; // size = 0xC -typedef struct { +typedef struct Demo3ReadWriteData { /* 0x00 */ Vec3f initialAt; /* 0x0C */ f32 unk_0C; /* 0x10 */ s16 animFrame; /* 0x12 */ s16 yawDir; } Demo3ReadWriteData; // size = 0x14 -typedef struct { +typedef struct Demo3 { /* 0x00 */ Demo3ReadOnlyData roData; /* 0x0C */ Demo3ReadWriteData rwData; } Demo3; // size = 0x20 @@ -1350,33 +1350,33 @@ typedef struct { { atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Demo6ReadOnlyData { /* 0x0 */ s16 interfaceField; /* 0x2 */ s16 unk_02; } Demo6ReadOnlyData; // size = 0x4 -typedef struct { +typedef struct Demo6ReadWriteData { /* 0x0 */ s16 animTimer; /* 0x4 */ Vec3f atTarget; } Demo6ReadWriteData; // size = 0x10 -typedef struct { +typedef struct Demo6 { /* 0x00 */ Demo6ReadOnlyData roData; /* 0x04 */ Demo6ReadWriteData rwData; } Demo6; // size = 0x14 -typedef struct { +typedef struct OnePointCamData { /* 0x0 */ CutsceneCameraPoint* atPoints; /* 0x4 */ CutsceneCameraPoint* eyePoints; /* 0x8 */ s16 actionParameters; /* 0xA */ s16 initTimer; } OnePointCamData; // size = 0xC -typedef struct { +typedef struct Demo9ReadOnlyData { /* 0x0 */ s16 interfaceField; } Demo9ReadOnlyData; // size = 0x4 -typedef struct { +typedef struct Demo9ReadWriteData { /* 0x0 */ f32 curFrame; /* 0x4 */ s16 keyframe; /* 0x6 */ s16 doLERPAt; @@ -1384,7 +1384,7 @@ typedef struct { /* 0xA */ s16 animTimer; } Demo9ReadWriteData; // size = 0xC -typedef struct { +typedef struct Demo9 { /* 0x00 */ OnePointCamData onePointCamData; /* 0x0C */ Demo9ReadOnlyData roData; /* 0x10 */ Demo9ReadWriteData rwData; @@ -1393,12 +1393,12 @@ typedef struct { #define DEMO9_FLAG_1 (1 << 1) #define DEMO9_FLAG_4 (1 << 4) -typedef struct { +typedef struct Special0ReadOnlyData { /* 0x0 */ f32 lerpAtScale; /* 0x4 */ s16 interfaceField; } Special0ReadOnlyData; // size = 0x8 -typedef struct { +typedef struct Special0 { /* 0x0 */ Special0ReadOnlyData roData; } Special0; // size = 0x8 @@ -1406,15 +1406,15 @@ typedef struct { { yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Special4ReadWriteData { /* 0x0 */ s16 initalTimer; } Special4ReadWriteData; // size = 0x4 -typedef struct { +typedef struct Special4 { /* 0x0 */ Special4ReadWriteData rwData; } Special4; // size = 0x4 -typedef struct { +typedef struct Special5ReadOnlyData { /* 0x00 */ f32 yOffset; /* 0x04 */ f32 eyeDist; /* 0x08 */ f32 minDistForRot; @@ -1426,11 +1426,11 @@ typedef struct { /* 0x1A */ s16 unk_1A; } Special5ReadOnlyData; // size = 0x1C -typedef struct { +typedef struct Special5ReadWriteData { /* 0x0 */ s16 animTimer; } Special5ReadWriteData; // size = 0x4 -typedef struct { +typedef struct Special5 { /* 0x00 */ Special5ReadOnlyData roData; /* 0x1C */ Special5ReadWriteData rwData; } Special5; // size = 0x20 @@ -1456,40 +1456,40 @@ typedef struct { { unk_22, CAM_DATA_UNK_22 }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef struct { +typedef struct Special7ReadWriteData { /* 0x0 */ s16 index; // See `CamElevatorPlatform` } Special7ReadWriteData; // size = 0x4 -typedef struct { +typedef struct Special7 { /* 0x0 */ Special7ReadWriteData rwData; } Special7; // size = 0x4 -typedef struct { +typedef struct Special6ReadOnlyData { /* 0x0 */ s16 interfaceField; } Special6ReadOnlyData; // size = 0x4 -typedef struct { +typedef struct Special6ReadWriteData { /* 0x0 */ f32 initalPlayerY; /* 0x4 */ s16 animTimer; } Special6ReadWriteData; // size = 0x8 -typedef struct { +typedef struct Special6 { /* 0x0 */ Special6ReadOnlyData roData; /* 0x4 */ Special6ReadWriteData rwData; } Special6; // size = 0xC -typedef struct { +typedef struct Special9ReadOnlyData { /* 0x0 */ f32 yOffset; /* 0x4 */ f32 unk_04; /* 0x8 */ s16 interfaceField; /* 0xA */ s16 unk_0A; } Special9ReadOnlyData; // size = 0xC -typedef struct { +typedef struct Special9ReadWriteData { /* 0x0 */ s16 targetYaw; } Special9ReadWriteData; // size = 0x4 -typedef struct { +typedef struct Special9 { /* 0x00 */ Special9ReadOnlyData roData; /* 0x0C */ Special9ReadWriteData rwData; } Special9; // size = 0x10 @@ -1503,7 +1503,7 @@ typedef struct { { fov, CAM_DATA_FOV }, \ { interfaceField, CAM_DATA_INTERFACE_FIELD } -typedef union { +typedef union CamParamData { Normal1 norm1; Normal2 norm2; Normal3 norm3; @@ -1548,7 +1548,7 @@ typedef union { }; } CamParamData; // size = 0x50 -typedef struct { +typedef struct CamColChk { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f norm; /* 0x18 */ struct CollisionPoly* poly; @@ -1623,7 +1623,7 @@ typedef struct Camera { * Debug Camera */ -typedef struct { +typedef struct DebugCamSub { /* 0x0000 */ s16 mode; /* 0x0002 */ s16 nFrames; /* 0x0004 */ s16 nPoints; @@ -1640,7 +1640,7 @@ typedef struct { /* 0x104A */ Vec3s unk_104A; } DebugCamSub; // size = 0x1050 -typedef struct { +typedef struct DebugCam { /* 0x00 */ s32 unk_00; /* 0x04 */ Vec3f at; /* 0x10 */ Vec3f eye; @@ -1663,7 +1663,7 @@ typedef struct { /* 0x7C */ DebugCamSub sub; } DebugCam; // size = 0x10CC -typedef struct { +typedef struct DebugCamCut { /* 0x00 */ char letter; /* 0x01 */ u8 unk_01; /* 0x02 */ s16 mode; @@ -1673,7 +1673,7 @@ typedef struct { /* 0x0E */ s16 nPoints; } DebugCamCut; // size = 0x10 -typedef struct { +typedef struct DebugCamAnim { /* 0x00 */ f32 curFrame; /* 0x04 */ f32 unk_04; // frame count? /* 0x08 */ s16 keyframe; @@ -1685,7 +1685,7 @@ typedef struct { /* 0x2C */ f32 fov; } DebugCamAnim; // size = 0x30 -typedef enum { +typedef enum DebugCamTextColor { /* 0 */ DEBUG_CAM_TEXT_YELLOW, /* 1 */ DEBUG_CAM_TEXT_PEACH, /* 2 */ DEBUG_CAM_TEXT_BROWN, diff --git a/include/z64collision_check.h b/include/z64collision_check.h index a9cff3a58e..5921eda064 100644 --- a/include/z64collision_check.h +++ b/include/z64collision_check.h @@ -12,7 +12,7 @@ struct Actor; * Bases for all shapes of colliders */ -typedef enum { +typedef enum ColliderType { /* 0 */ COLTYPE_HIT0, // Blue blood, white hitmark /* 1 */ COLTYPE_HIT1, // No blood, dust hitmark /* 2 */ COLTYPE_HIT2, // Green blood, dust hitmark @@ -29,7 +29,7 @@ typedef enum { /* 13 */ COLTYPE_TREE } ColliderType; -typedef enum { +typedef enum ColliderShape { /* 0 */ COLSHAPE_JNTSPH, /* 1 */ COLSHAPE_CYLINDER, /* 2 */ COLSHAPE_TRIS, @@ -37,7 +37,7 @@ typedef enum { /* 4 */ COLSHAPE_MAX } ColliderShape; -typedef struct { +typedef struct Collider { /* 0x00 */ struct Actor* actor; // Attached actor /* 0x04 */ struct Actor* at; // Actor attached to what it collided with as an AT collider. /* 0x08 */ struct Actor* ac; // Actor attached to what it collided with as an AC collider. @@ -50,7 +50,7 @@ typedef struct { /* 0x15 */ u8 shape; // See `ColliderShape` enum } Collider; // size = 0x18 -typedef struct { +typedef struct ColliderInit { /* 0x00 */ u8 colType; /* 0x01 */ u8 atFlags; /* 0x02 */ u8 acFlags; @@ -59,7 +59,7 @@ typedef struct { /* 0x05 */ u8 shape; } ColliderInit; // size = 0x06 -typedef struct { +typedef struct ColliderInitType1 { /* 0x00 */ u8 colType; /* 0x01 */ u8 atFlags; /* 0x02 */ u8 acFlags; @@ -67,7 +67,7 @@ typedef struct { /* 0x04 */ u8 shape; } ColliderInitType1; // size = 0x05 -typedef struct { +typedef struct ColliderInitToActor { /* 0x00 */ struct Actor* actor; /* 0x04 */ u8 atFlags; /* 0x05 */ u8 acFlags; @@ -75,20 +75,20 @@ typedef struct { /* 0x07 */ u8 shape; } ColliderInitToActor; // size = 0x08 -typedef struct { +typedef struct ColliderElementDamageInfoAT { /* 0x00 */ u32 dmgFlags; // Damage types dealt by this collider element as AT. /* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) /* 0x05 */ u8 damage; // Damage } ColliderElementDamageInfoAT; // size = 0x08 -typedef struct { +typedef struct ColliderElementDamageInfoAC { /* 0x00 */ u32 dmgFlags; // Damage types that may affect this collider element as AC. /* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) /* 0x05 */ u8 defense; // Damage Resistance /* 0x06 */ Vec3s hitPos; // Point of contact } ColliderElementDamageInfoAC; // size = 0x0C -typedef struct { +typedef struct ColliderElementDamageInfoACInit { /* 0x00 */ u32 dmgFlags; // Damage types that may affect this collider element as AC. /* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) /* 0x05 */ u8 defense; // Damage Resistance @@ -100,7 +100,7 @@ typedef struct { * are == or !=. Will probably need more actors decomped to truly * understand what this is. */ -typedef enum { +typedef enum ElementType { /* 0 */ ELEMTYPE_UNK0, /* 1 */ ELEMTYPE_UNK1, /* 2 */ ELEMTYPE_UNK2, @@ -124,7 +124,7 @@ typedef struct ColliderElement { /* 0x24 */ struct ColliderElement* acHitElem; // element that hit the AC collider } ColliderElement; // size = 0x28 -typedef struct { +typedef struct ColliderElementInit { /* 0x00 */ u8 elemType; // Affects sfx reaction when attacked by Link and hookability. Full purpose unknown. /* 0x04 */ ColliderElementDamageInfoAT atDmgInfo; // Damage properties when acting as an AT collider /* 0x0C */ ColliderElementDamageInfoACInit acDmgInfo; // Damage properties when acting as an AC collider @@ -139,19 +139,19 @@ typedef struct { // collider structs -typedef struct { +typedef struct ColliderJntSphElementDim { /* 0x00 */ Sphere16 modelSphere; // model space sphere /* 0x08 */ Sphere16 worldSphere; // world space sphere /* 0x10 */ f32 scale; // world space sphere = model * scale * 0.01 /* 0x14 */ u8 limb; // attached limb } ColliderJntSphElementDim; // size = 0x18 -typedef struct { +typedef struct ColliderJntSphElement { /* 0x00 */ ColliderElement base; /* 0x28 */ ColliderJntSphElementDim dim; } ColliderJntSphElement; // size = 0x40 -typedef struct { +typedef struct ColliderJntSph { /* 0x00 */ Collider base; /* 0x18 */ s32 count; /* 0x1C */ ColliderJntSphElement* elements; @@ -159,30 +159,30 @@ typedef struct { // init data structs -typedef struct { +typedef struct ColliderJntSphElementDimInit { /* 0x00 */ u8 limb; // attached limb /* 0x02 */ Sphere16 modelSphere; // model space sphere /* 0x0A */ s16 scale; // world space sphere = model * scale * 0.01 } ColliderJntSphElementDimInit; // size = 0x0C -typedef struct { +typedef struct ColliderJntSphElementInit { /* 0x00 */ ColliderElementInit base; /* 0x18 */ ColliderJntSphElementDimInit dim; } ColliderJntSphElementInit; // size = 0x24 -typedef struct { +typedef struct ColliderJntSphInit { /* 0x00 */ ColliderInit base; /* 0x08 */ s32 count; /* 0x0C */ ColliderJntSphElementInit* elements; } ColliderJntSphInit; // size = 0x10 -typedef struct { +typedef struct ColliderJntSphInitType1 { /* 0x00 */ ColliderInitType1 base; /* 0x08 */ s32 count; /* 0x0C */ ColliderJntSphElementInit* elements; } ColliderJntSphInitType1; // size = 0x10 -typedef struct { +typedef struct ColliderJntSphInitToActor { /* 0x00 */ ColliderInitToActor base; /* 0x08 */ s32 count; /* 0x0C */ ColliderJntSphElementInit* elements; @@ -194,7 +194,7 @@ typedef struct { // collider structs -typedef struct { +typedef struct ColliderCylinder { /* 0x00 */ Collider base; /* 0x18 */ ColliderElement elem; /* 0x40 */ Cylinder16 dim; @@ -202,19 +202,19 @@ typedef struct { // init data structs -typedef struct { +typedef struct ColliderCylinderInit { /* 0x00 */ ColliderInit base; /* 0x08 */ ColliderElementInit elem; /* 0x20 */ Cylinder16 dim; } ColliderCylinderInit; // size = 0x2C -typedef struct { +typedef struct ColliderCylinderInitType1 { /* 0x00 */ ColliderInitType1 base; /* 0x08 */ ColliderElementInit elem; /* 0x20 */ Cylinder16 dim; } ColliderCylinderInitType1; // size = 0x2C -typedef struct { +typedef struct ColliderCylinderInitToActor { /* 0x00 */ ColliderInitToActor base; /* 0x08 */ ColliderElementInit elem; /* 0x20 */ Cylinder16 dim; @@ -226,12 +226,12 @@ typedef struct { // collider structs -typedef struct { +typedef struct ColliderTrisElement { /* 0x00 */ ColliderElement base; /* 0x28 */ TriNorm dim; } ColliderTrisElement; // size = 0x5C -typedef struct { +typedef struct ColliderTris { /* 0x00 */ Collider base; /* 0x18 */ s32 count; /* 0x1C */ ColliderTrisElement* elements; @@ -239,22 +239,22 @@ typedef struct { // init data structs -typedef struct { +typedef struct ColliderTrisElementDimInit { /* 0x00 */ Vec3f vtx[3]; } ColliderTrisElementDimInit; // size = 0x24 -typedef struct { +typedef struct ColliderTrisElementInit { /* 0x00 */ ColliderElementInit base; /* 0x18 */ ColliderTrisElementDimInit dim; } ColliderTrisElementInit; // size = 0x3C -typedef struct { +typedef struct ColliderTrisInit { /* 0x00 */ ColliderInit base; /* 0x08 */ s32 count; /* 0x0C */ ColliderTrisElementInit* elements; } ColliderTrisInit; // size = 0x10 -typedef struct { +typedef struct ColliderTrisInitType1 { /* 0x00 */ ColliderInitType1 base; /* 0x08 */ s32 count; /* 0x0C */ ColliderTrisElementInit* elements; @@ -266,14 +266,14 @@ typedef struct { // collider structs -typedef struct { +typedef struct ColliderQuadDim { /* 0x00 */ Vec3f quad[4]; /* 0x30 */ Vec3s dcMid; // midpoint of vectors d, c /* 0x36 */ Vec3s baMid; // midpoint of vectors b, a /* 0x3C */ f32 acDistSq; // distance to nearest AC collision this frame, squared. } ColliderQuadDim; // size = 0x40 -typedef struct { +typedef struct ColliderQuad { /* 0x00 */ Collider base; /* 0x18 */ ColliderElement elem; /* 0x40 */ ColliderQuadDim dim; @@ -281,17 +281,17 @@ typedef struct { // init data structs -typedef struct { +typedef struct ColliderQuadDimInit { /* 0x00 */ Vec3f quad[4]; } ColliderQuadDimInit; // size = 0x30 -typedef struct { +typedef struct ColliderQuadInit { /* 0x00 */ ColliderInit base; /* 0x08 */ ColliderElementInit elem; /* 0x20 */ ColliderQuadDimInit dim; } ColliderQuadInit; // size = 0x50 -typedef struct { +typedef struct ColliderQuadInitType1 { /* 0x00 */ ColliderInitType1 base; /* 0x08 */ ColliderElementInit elem; /* 0x20 */ ColliderQuadDimInit dim; @@ -301,7 +301,7 @@ typedef struct { * Line collider */ -typedef struct { +typedef struct OcLine { /* 0x00 */ Linef line; /* 0x18 */ u16 ocFlags; } OcLine; // size = 0x1C diff --git a/include/z64curve.h b/include/z64curve.h index b150302e9c..2f35aec967 100644 --- a/include/z64curve.h +++ b/include/z64curve.h @@ -6,7 +6,7 @@ struct PlayState; -typedef struct { +typedef struct CurveInterpKnot { /* 0x0 */ u16 flags; // Only the bottom two bits are used, although others are set in objects /* 0x2 */ s16 abscissa; // knot input value /* 0x4 */ s16 leftGradient; // left derivative at the point @@ -14,7 +14,7 @@ typedef struct { /* 0x8 */ f32 ordinate; // output value } CurveInterpKnot; // size = 0xC -typedef struct { +typedef struct CurveAnimationHeader { /* 0x0 */ u8* knotCounts; /* 0x4 */ CurveInterpKnot* interpolationData; /* 0x8 */ s16* constantData; @@ -22,18 +22,18 @@ typedef struct { /* 0xE */ s16 frameCount; // Not used, inferred from use in objects } CurveAnimationHeader; // size = 0x10 -typedef struct { +typedef struct SkelCurveLimb { /* 0x0 */ u8 child; /* 0x1 */ u8 sibling; /* 0x4 */ Gfx* dList[2]; } SkelCurveLimb; // size = 0xC -typedef struct { +typedef struct CurveSkeletonHeader { /* 0x0 */ SkelCurveLimb** limbs; /* 0x4 */ u8 limbCount; } CurveSkeletonHeader; // size = 0x8 -typedef struct { +typedef struct SkelCurve { /* 0x00 */ u8 limbCount; /* 0x04 */ SkelCurveLimb** skeleton; /* 0x08 */ CurveAnimationHeader* animation; diff --git a/include/z64cutscene.h b/include/z64cutscene.h index 5cfe81dd86..627da47e51 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -11,7 +11,7 @@ typedef union CutsceneData { s8 b[4]; } CutsceneData; -typedef enum { +typedef enum CutsceneState { /* 0 */ CS_STATE_IDLE, /* 1 */ CS_STATE_START, /* 2 */ CS_STATE_RUN, @@ -19,7 +19,7 @@ typedef enum { /* 4 */ CS_STATE_RUN_UNSTOPPABLE } CutsceneState; -typedef enum { +typedef enum CutsceneCmd { /* 0x0001 */ CS_CMD_CAM_EYE_SPLINE = 0x01, /* 0x0002 */ CS_CMD_CAM_AT_SPLINE, /* 0x0003 */ CS_CMD_MISC, @@ -151,7 +151,7 @@ typedef enum { /* 0xFFFF */ CS_CMD_END = 0xFFFF } CutsceneCmd; -typedef enum { +typedef enum CutsceneMiscType { /* 0x00 */ CS_MISC_UNIMPLEMENTED_0, /* 0x01 */ CS_MISC_RAIN, /* 0x02 */ CS_MISC_LIGHTNING, @@ -190,7 +190,7 @@ typedef enum { /* 0x23 */ CS_MISC_LONG_SCARECROW_SONG } CutsceneMiscType; -typedef enum { +typedef enum CutsceneTextType { /* 0x00 */ CS_TEXT_NORMAL, /* 0x01 */ CS_TEXT_CHOICE, /* 0x02 */ CS_TEXT_OCARINA_ACTION, @@ -198,12 +198,12 @@ typedef enum { /* 0x04 */ CS_TEXT_ZORA_SAPPHIRE // use `altTextId1` in the sapphire cutscene if ruby is already obtained } CutsceneTextType; -typedef enum { +typedef enum CutsceneFadeOutSeqPlayer { /* 0x03 */ CS_FADE_OUT_FANFARE = 3, /* 0x04 */ CS_FADE_OUT_BGM_MAIN } CutsceneFadeOutSeqPlayer; -typedef enum { +typedef enum CutsceneTransitionType { /* 0x01 */ CS_TRANS_GRAY_FILL_IN = 1, // has hardcoded sounds for some scenes /* 0x02 */ CS_TRANS_BLUE_FILL_IN, /* 0x03 */ CS_TRANS_RED_FILL_OUT, @@ -219,7 +219,7 @@ typedef enum { /* 0x0D */ CS_TRANS_BLACK_FILL_IN_FROM_HALF } CutsceneTransitionType; -typedef enum { +typedef enum CutsceneDestination { /* 0x00 */ CS_DEST_UNIMPLEMENTED_0, /* 0x01 */ CS_DEST_CUTSCENE_MAP_GANON_HORSE, /* 0x02 */ CS_DEST_CUTSCENE_MAP_THREE_GODDESSES, @@ -342,7 +342,7 @@ typedef enum { /* 0x77 */ CS_DEST_ZELDAS_COURTYARD_RECEIVE_LETTER } CutsceneDestination; -typedef union { +typedef union CsCmdCam { struct { /* 0x00 */ u16 unused0; /* 0x02 */ u16 startFrame; @@ -352,7 +352,7 @@ typedef union { } CsCmdCam; // size = 0x8 -typedef union { +typedef union CsCmdMisc { struct { /* 0x00 */ u16 type; /* 0x02 */ u16 startFrame; @@ -361,7 +361,7 @@ typedef union { s32 _words[12]; } CsCmdMisc; // size = 0x30 -typedef union { +typedef union CsCmdLightSetting { struct { /* 0x00 */ u8 unused0; /* 0x01 */ u8 settingPlusOne; @@ -371,7 +371,7 @@ typedef union { s32 _words[12]; } CsCmdLightSetting; // size = 0x30 -typedef union { +typedef union CsCmdStartSeq { struct { /* 0x00 */ u8 unused0; /* 0x01 */ u8 seqIdPlusOne; @@ -381,7 +381,7 @@ typedef union { s32 _words[12]; } CsCmdStartSeq; // size = 0x30 -typedef union { +typedef union CsCmdStopSeq { struct { /* 0x00 */ u8 unused0; /* 0x01 */ u8 seqIdPlusOne; @@ -391,7 +391,7 @@ typedef union { s32 _words[12]; } CsCmdStopSeq; // size = 0x30 -typedef union { +typedef union CsCmdFadeOutSeq { struct { /* 0x00 */ u16 seqPlayer; /* 0x02 */ u16 startFrame; @@ -400,7 +400,7 @@ typedef union { s32 _words[12]; } CsCmdFadeOutSeq; // size = 0x30 -typedef union { +typedef union CsCmdRumble { struct { /* 0x00 */ u16 unused0; /* 0x02 */ u16 startFrame; @@ -412,7 +412,7 @@ typedef union { s32 _words[3]; } CsCmdRumble; // size = 0xC -typedef union { +typedef union CsCmdTime { struct { /* 0x00 */ u16 unused0; /* 0x02 */ u16 startFrame; @@ -423,7 +423,7 @@ typedef union { s32 _words[3]; } CsCmdTime; // size = 0xC -typedef union { +typedef union CsCmdDestination { struct { /* 0x00 */ u16 destination; /* 0x02 */ u16 startFrame; @@ -432,7 +432,7 @@ typedef union { s32 _words[2]; } CsCmdDestination; // size = 0x8 -typedef union { +typedef union CsCmdText { struct { /* 0x00 */ u16 textId; // can also be an ocarina action for `CS_TEXT_OCARINA_ACTION` /* 0x02 */ u16 startFrame; @@ -446,7 +446,7 @@ typedef union { #define CS_TEXT_ID_NONE 0xFFFF -typedef union { +typedef union CsCmdTransition { struct { /* 0x00 */ u16 type; /* 0x02 */ u16 startFrame; @@ -455,7 +455,7 @@ typedef union { s32 _words[2]; } CsCmdTransition; // size = 0x8 -typedef union { +typedef union CsCmdActorCue { struct { /* 0x00 */ u16 id; // "dousa" /* 0x02 */ u16 startFrame; @@ -467,7 +467,7 @@ typedef union { s32 _words[12]; } CsCmdActorCue; // size = 0x30 -typedef union { +typedef union CutsceneCameraPoint { struct { /* 0x00 */ s8 continueFlag; /* 0x01 */ s8 cameraRoll; @@ -483,20 +483,20 @@ typedef union { #define CS_CAM_DATA_NOT_APPLIED 0xFFFF -typedef struct { +typedef struct CutsceneCameraDirection { /* 0x00 */ Vec3f at; /* 0x0C */ Vec3f eye; /* 0x18 */ s16 roll; /* 0x1A */ s16 fov; } CutsceneCameraDirection; // size = 0x1C -typedef struct { +typedef struct CutsceneCameraMove { /* 0x0 */ CutsceneCameraPoint* atPoints; /* 0x4 */ CutsceneCameraPoint* eyePoints; /* 0x8 */ s16 relativeToPlayer; } CutsceneCameraMove; // size = 0xC -typedef struct { +typedef struct CutsceneContext { /* 0x00 */ char unk_00[0x4]; /* 0x04 */ void* script; /* 0x08 */ u8 state; diff --git a/include/z64dma.h b/include/z64dma.h index 0567ed542b..aab5556d7c 100755 --- a/include/z64dma.h +++ b/include/z64dma.h @@ -5,7 +5,7 @@ #include "alignment.h" #include "romfile.h" -typedef struct { +typedef struct DmaRequest { /* 0x00 */ uintptr_t vromAddr; // VROM address (source) /* 0x04 */ void* dramAddr; // DRAM address (destination) /* 0x08 */ size_t size; // File Transfer size @@ -16,7 +16,7 @@ typedef struct { /* 0x1C */ OSMesg notifyMsg; // Completion notification message } DmaRequest; // size = 0x20 -typedef struct { +typedef struct DmaEntry { /* 0x00 */ RomFile file; /* 0x08 */ uintptr_t romStart; /* 0x0C */ uintptr_t romEnd; diff --git a/include/z64effect.h b/include/z64effect.h index 4e34ec0f7f..d21f2cb53d 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -14,20 +14,20 @@ struct PlayState; #define TOTAL_EFFECT_COUNT SPARK_COUNT + BLURE_COUNT + SHIELD_PARTICLE_COUNT -typedef struct { +typedef struct EffectStatus { /* 0x00 */ u8 active; /* 0x01 */ u8 unk_01; /* 0x02 */ u8 unk_02; } EffectStatus; // size = 0x03 -typedef struct { +typedef struct EffectSparkElement { /* 0x00 */ Vec3f velocity; /* 0x0C */ Vec3f position; /* 0x18 */ Vec3s unkVelocity; /* 0x1E */ Vec3s unkPosition; } EffectSparkElement; // size = 0x24 -typedef struct { +typedef struct EffectSparkInit { /* 0x000 */ Vec3s position; /* 0x008 */ s32 numElements; // "table_size"; calculated as uDiv * vDiv + 2 /* 0x00C */ EffectSparkElement elements[32]; @@ -41,7 +41,7 @@ typedef struct { /* 0x4C0 */ s32 duration; } EffectSparkInit; // size = 0x4C4 -typedef struct { +typedef struct EffectSpark { /* 0x000 */ Vec3s position; /* 0x008 */ s32 numElements; // "table_size"; calculated as uDiv * vDiv + 2 /* 0x00C */ EffectSparkElement elements[32]; @@ -55,7 +55,7 @@ typedef struct { /* 0x4C0 */ s32 duration; } EffectSpark; // size = 0x4C4 -typedef struct { +typedef struct EffectBlureElement { /* 0x00 */ s32 state; /* 0x04 */ s32 timer; /* 0x08 */ Vec3s p1; @@ -63,7 +63,7 @@ typedef struct { /* 0x14 */ u16 flags; } EffectBlureElement; // size = 0x18 -typedef struct { +typedef struct EffectBlureInit1 { /* 0x000 */ char unk_00[0x184]; /* 0x184 */ u8 p1StartColor[4]; /* 0x188 */ u8 p2StartColor[4]; @@ -74,7 +74,7 @@ typedef struct { /* 0x19C */ s32 calcMode; } EffectBlureInit1; // size = 0x1A0 -typedef struct { +typedef struct EffectBlureInit2 { /* 0x00 */ s32 calcMode; /* 0x04 */ u16 flags; /* 0x06 */ s16 addAngleChange; @@ -90,7 +90,7 @@ typedef struct { /* 0x20 */ Color_RGBA8 altEnvColor; // used with drawMode 1 } EffectBlureInit2; // size = 0x24 -typedef struct { +typedef struct EffectBlure { /* 0x000 */ EffectBlureElement elements[16]; /* 0x180 */ s32 calcMode; /* 0x184 */ f32 mode4Param; @@ -109,7 +109,7 @@ typedef struct { /* 0x1A6 */ Color_RGBA8 altEnvColor; // used with drawMode 1 } EffectBlure; // size = 0x1AC -typedef struct { +typedef struct EffectShieldParticleElement { /* 0x00 */ f32 initialSpeed; /* 0x04 */ f32 endXChange; /* 0x08 */ f32 endX; @@ -119,7 +119,7 @@ typedef struct { /* 0x16 */ s16 pitch; } EffectShieldParticleElement; // size = 0x18 -typedef struct { +typedef struct EffectShieldParticleInit { /* 0x00 */ u8 numElements; /* 0x02 */ Vec3s position; /* 0x08 */ Color_RGBA8 primColorStart; @@ -136,7 +136,7 @@ typedef struct { /* 0x3C */ s32 lightDecay; // halves light radius every frame when set to 1 } EffectShieldParticleInit; // size = 0x40 -typedef struct { +typedef struct EffectShieldParticle { /* 0x000 */ EffectShieldParticleElement elements[16]; /* 0x180 */ u8 numElements; /* 0x182 */ Vec3s position; @@ -157,7 +157,7 @@ typedef struct { /* 0x1C4 */ s32 lightDecay; // halves light radius every frame when set to 1 } EffectShieldParticle; // size = 0x1C8 -typedef struct { +typedef struct EffectContext { /* 0x0000 */ struct PlayState* play; struct { EffectStatus status; @@ -173,7 +173,7 @@ typedef struct { } /* 0x388C */ shieldParticles[SHIELD_PARTICLE_COUNT]; } EffectContext; // size = 0x3DF0 -typedef struct { +typedef struct EffectInfo { /* 0x00 */ u32 size; /* 0x04 */ void (*init)(void* effect, void* initParams); /* 0x08 */ void (*destroy)(void* effect); @@ -181,7 +181,7 @@ typedef struct { /* 0x10 */ void (*draw)(void* effect, struct GraphicsContext* gfxCtx); } EffectInfo; // size = 0x14 -typedef enum { +typedef enum EffectType { /* 0x00 */ EFFECT_SPARK, /* 0x01 */ EFFECT_BLURE1, /* 0x02 */ EFFECT_BLURE2, @@ -196,12 +196,12 @@ typedef u32 (*EffectSsInitFunc)(struct PlayState* play, u32 index, struct Effect typedef void (*EffectSsUpdateFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs); typedef void (*EffectSsDrawFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs); -typedef struct { +typedef struct EffectSsProfile { /* 0x00 */ u32 type; /* 0x04 */ EffectSsInitFunc init; } EffectSsProfile; // size = 0x08 -typedef struct { +typedef struct EffectSsOverlay { /* 0x00 */ RomFile file; /* 0x08 */ void* vramStart; /* 0x0C */ void* vramEnd; @@ -226,7 +226,7 @@ typedef struct EffectSs { /* 0x5F */ u8 type; } EffectSs; // size = 0x60 -typedef struct { +typedef struct EffectSsInfo { /* 0x00 */ EffectSs* table; // "data_table" /* 0x04 */ s32 searchStartIndex; /* 0x08 */ s32 tableSize; @@ -250,7 +250,7 @@ typedef struct { #define DEFINE_EFFECT_SS(_0, enum) enum, #define DEFINE_EFFECT_SS_UNSET(enum) enum, -typedef enum { +typedef enum EffectSsType { #include "tables/effect_ss_table.h" /* 0x25 */ EFFECT_SS_TYPE_MAX // originally "EFFECT_SS2_TYPE_LAST_LABEL" } EffectSsType; diff --git a/include/z64environment.h b/include/z64environment.h index 922c544258..ad08ff5d0e 100644 --- a/include/z64environment.h +++ b/include/z64environment.h @@ -34,12 +34,12 @@ struct SkyboxContext; // This is a bit of a hack used only by bosses in the original game. #define LIGHT_BLEND_OVERRIDE_FULL_CONTROL 2 -typedef enum { +typedef enum LightMode { /* 0 */ LIGHT_MODE_TIME, // environment lights use `lightConfig` and change based on time of day /* 1 */ LIGHT_MODE_SETTINGS // environment lights use `lightSetting` } LightMode; -typedef enum { +typedef enum SkyboxDmaState { /* 0 */ SKYBOX_DMA_INACTIVE, /* 1 */ SKYBOX_DMA_TEXTURE1_START, /* 2 */ SKYBOX_DMA_TEXTURE1_DONE, @@ -49,19 +49,19 @@ typedef enum { /* 13 */ SKYBOX_DMA_TLUT2_START } SkyboxDmaState; -typedef enum { +typedef enum LightningState { /* 0 */ LIGHTNING_OFF, // no lightning /* 1 */ LIGHTNING_ON, // request lightning strikes at random intervals /* 2 */ LIGHTNING_LAST // request one lightning strike before turning off } LightningState; -typedef enum { +typedef enum LightningStrikeState { /* 0 */ LIGHTNING_STRIKE_WAIT, // wait between lightning strikes. request bolts when timer hits 0 /* 1 */ LIGHTNING_STRIKE_START, // fade in the flash. note: bolts are requested in the previous state /* 2 */ LIGHTNING_STRIKE_END // fade out the flash and go back to wait } LightningStrikeState; -typedef enum { +typedef enum WeatherMode { /* 0 */ WEATHER_MODE_CLEAR, /* 1 */ WEATHER_MODE_CLOUDY_CONFIG3, // scene must define settings for light config 3 /* 2 */ WEATHER_MODE_CLOUDY_CONFIG2, // scene must define settings for light config 2 @@ -70,14 +70,14 @@ typedef enum { /* 5 */ WEATHER_MODE_HEAVY_RAIN // scene must define settings for light config 4 } WeatherMode; -typedef enum { +typedef enum ChangeSkyboxState { /* 0 */ CHANGE_SKYBOX_INACTIVE, /* 1 */ CHANGE_SKYBOX_REQUESTED, /* 2 */ CHANGE_SKYBOX_WAIT, /* 3 */ CHANGE_SKYBOX_ACTIVE } ChangeSkyboxState; -typedef enum { +typedef enum PrecipitationData { /* 0 */ PRECIP_RAIN_MAX, // max number of raindrops that can draw; uses this or SOS_MAX, whichever is larger /* 1 */ PRECIP_RAIN_CUR, // current number of rain drops being drawn on screen /* 2 */ PRECIP_SNOW_CUR, // current number of snowflakes being drawn on screen @@ -86,18 +86,18 @@ typedef enum { /* 5 */ PRECIP_MAX } PrecipitationData; -typedef enum { +typedef enum StormRequest { /* 0 */ STORM_REQUEST_NONE, /* 1 */ STORM_REQUEST_START, /* 2 */ STORM_REQUEST_STOP } StormRequest; -typedef enum { +typedef enum StormState { /* 0 */ STORM_STATE_OFF, /* 1 */ STORM_STATE_ON } StormState; -typedef enum { +typedef enum TimeBasedSeqState { /* 0x00 */ TIMESEQ_DAY_BGM, /* 0x01 */ TIMESEQ_FADE_DAY_BGM, /* 0x02 */ TIMESEQ_NIGHT_BEGIN_SFX, @@ -110,7 +110,7 @@ typedef enum { /* 0xFF */ TIMESEQ_DISABLED = 0xFF } TimeBasedSeqState; -typedef enum { +typedef enum SandstormState { /* 0 */ SANDSTORM_OFF, /* 1 */ SANDSTORM_FILL, /* 2 */ SANDSTORM_UNFILL, @@ -118,7 +118,7 @@ typedef enum { /* 4 */ SANDSTORM_DISSIPATE } SandstormState; -typedef struct { +typedef struct LightningStrike { /* 0x00 */ u8 state; /* 0x01 */ u8 flashRed; /* 0x02 */ u8 flashGreen; @@ -127,7 +127,7 @@ typedef struct { /* 0x08 */ f32 delayTimer; } LightningStrike; // size = 0xC -typedef struct { +typedef struct TimeBasedSkyboxEntry { /* 0x00 */ u16 startTime; /* 0x02 */ u16 endTime; /* 0x04 */ u8 changeSkybox; @@ -135,7 +135,7 @@ typedef struct { /* 0x06 */ u8 skybox2Index; } TimeBasedSkyboxEntry; // size = 0x8 -typedef struct { +typedef struct CurrentEnvLightSettings { /* 0x00 */ u8 ambientColor[3]; /* 0x03 */ s8 light1Dir[3]; /* 0x06 */ u8 light1Color[3]; @@ -155,7 +155,7 @@ typedef struct { #define ENV_LIGHT_SETTINGS_BLEND_RATE_U8(blendRateAndFogNear) (((blendRateAndFogNear) >> 10) * 4) #define ENV_LIGHT_SETTINGS_FOG_NEAR(blendRateAndFogNear) ((blendRateAndFogNear) & 0x3FF) -typedef struct { +typedef struct EnvLightSettings { /* 0x00 */ u8 ambientColor[3]; /* 0x03 */ s8 light1Dir[3]; /* 0x06 */ u8 light1Color[3]; @@ -166,7 +166,7 @@ typedef struct { /* 0x14 */ s16 zFar; } EnvLightSettings; // size = 0x16 -typedef struct { +typedef struct EnvironmentContext { /* 0x00 */ char unk_00[0x02]; /* 0x02 */ u16 sceneTimeSpeed; // time speed value from the scene file /* 0x04 */ Vec3f sunPos; // moon position can be found by negating the sun position diff --git a/include/z64frame_advance.h b/include/z64frame_advance.h index b8c77372d6..edefb0b47d 100644 --- a/include/z64frame_advance.h +++ b/include/z64frame_advance.h @@ -6,7 +6,7 @@ struct Input; struct PlayState; -typedef struct { +typedef struct FrameAdvanceContext { /* 0x0 */ s32 enabled; /* 0x4 */ s32 timer; } FrameAdvanceContext; // size = 0x8 diff --git a/include/z64game.h b/include/z64game.h index 8cd6478963..3b50cfd362 100644 --- a/include/z64game.h +++ b/include/z64game.h @@ -15,7 +15,7 @@ typedef struct GameAllocEntry { /* 0x0C */ u32 unk_0C; } GameAllocEntry; // size = 0x10 -typedef struct { +typedef struct GameAlloc { /* 0x00 */ GameAllocEntry base; /* 0x10 */ GameAllocEntry* head; } GameAlloc; // size = 0x14 @@ -23,7 +23,7 @@ typedef struct { // Used in Graph_GetNextGameState in graph.c #define DEFINE_GAMESTATE_INTERNAL(typeName, enumName) enumName, #define DEFINE_GAMESTATE(typeName, enumName, name) DEFINE_GAMESTATE_INTERNAL(typeName, enumName) -typedef enum { +typedef enum GameStateId { #include "tables/gamestate_table.h" GAMESTATE_ID_MAX } GameStateId; diff --git a/include/z64interface.h b/include/z64interface.h index 4412cfdeda..e3b533970f 100644 --- a/include/z64interface.h +++ b/include/z64interface.h @@ -29,7 +29,7 @@ extern u8 _icon_item_24_staticSegmentRomStart[]; #define GET_QUEST_ICON_VROM(itemId) \ ((uintptr_t)_icon_item_24_staticSegmentRomStart + (((itemId)-ITEM_MEDALLION_FOREST) * QUEST_ICON_SIZE)) -typedef enum { +typedef enum DoAction { /* 0x00 */ DO_ACTION_ATTACK, /* 0x01 */ DO_ACTION_CHECK, /* 0x02 */ DO_ACTION_ENTER, @@ -67,7 +67,7 @@ typedef enum { #define DO_ACTION_TEX_HEIGHT 16 #define DO_ACTION_TEX_SIZE ((DO_ACTION_TEX_WIDTH * DO_ACTION_TEX_HEIGHT) / 2) // (sizeof(gCheckDoActionENGTex)) -typedef struct { +typedef struct InterfaceContext { /* 0x0000 */ View view; /* 0x0128 */ Vtx* actionVtx; /* 0x012C */ Vtx* beatingHeartVtx; diff --git a/include/z64item.h b/include/z64item.h index 5ddd8b7e36..28c2aa1903 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -7,7 +7,7 @@ #define ITEM_NAME_TEX_HEIGHT 16 #define ITEM_NAME_TEX_SIZE ((ITEM_NAME_TEX_WIDTH * ITEM_NAME_TEX_HEIGHT) / 2) // 128x16 IA4 texture -typedef enum { +typedef enum EquipmentType { /* 0 */ EQUIP_TYPE_SWORD, /* 1 */ EQUIP_TYPE_SHIELD, /* 2 */ EQUIP_TYPE_TUNIC, @@ -17,26 +17,26 @@ typedef enum { // `EquipInv*` enums are for Inventory.equipment (for example used in the `CHECK_OWNED_EQUIP` macro) -typedef enum { +typedef enum EquipInvSword { /* 0 */ EQUIP_INV_SWORD_KOKIRI, /* 1 */ EQUIP_INV_SWORD_MASTER, /* 2 */ EQUIP_INV_SWORD_BIGGORON, /* 3 */ EQUIP_INV_SWORD_BROKENGIANTKNIFE } EquipInvSword; -typedef enum { +typedef enum EquipInvShield { /* 0 */ EQUIP_INV_SHIELD_DEKU, /* 1 */ EQUIP_INV_SHIELD_HYLIAN, /* 2 */ EQUIP_INV_SHIELD_MIRROR } EquipInvShield; -typedef enum { +typedef enum EquipInvTunic { /* 0 */ EQUIP_INV_TUNIC_KOKIRI, /* 1 */ EQUIP_INV_TUNIC_GORON, /* 2 */ EQUIP_INV_TUNIC_ZORA } EquipInvTunic; -typedef enum { +typedef enum EquipInvBoots { /* 0 */ EQUIP_INV_BOOTS_KOKIRI, /* 1 */ EQUIP_INV_BOOTS_IRON, /* 2 */ EQUIP_INV_BOOTS_HOVER @@ -44,7 +44,7 @@ typedef enum { // `EquipValue*` enums are for ItemEquips.equipment (for example used in the `CUR_EQUIP_VALUE` macro) -typedef enum { +typedef enum EquipValueSword { /* 0 */ EQUIP_VALUE_SWORD_NONE, /* 1 */ EQUIP_VALUE_SWORD_KOKIRI, /* 2 */ EQUIP_VALUE_SWORD_MASTER, @@ -52,7 +52,7 @@ typedef enum { /* 4 */ EQUIP_VALUE_SWORD_MAX } EquipValueSword; -typedef enum { +typedef enum EquipValueShield { /* 0 */ EQUIP_VALUE_SHIELD_NONE, /* 1 */ EQUIP_VALUE_SHIELD_DEKU, /* 2 */ EQUIP_VALUE_SHIELD_HYLIAN, @@ -60,7 +60,7 @@ typedef enum { /* 4 */ EQUIP_VALUE_SHIELD_MAX } EquipValueShield; -typedef enum { +typedef enum EquipValueTunic { /* 0 */ EQUIP_VALUE_TUNIC_NONE, /* 1 */ EQUIP_VALUE_TUNIC_KOKIRI, /* 2 */ EQUIP_VALUE_TUNIC_GORON, @@ -68,7 +68,7 @@ typedef enum { /* 4 */ EQUIP_VALUE_TUNIC_MAX } EquipValueTunic; -typedef enum { +typedef enum EquipValueBoots { /* 0 */ EQUIP_VALUE_BOOTS_NONE, /* 1 */ EQUIP_VALUE_BOOTS_KOKIRI, /* 2 */ EQUIP_VALUE_BOOTS_IRON, @@ -76,7 +76,7 @@ typedef enum { /* 4 */ EQUIP_VALUE_BOOTS_MAX } EquipValueBoots; -typedef enum { +typedef enum UpgradeType { /* 0x00 */ UPG_QUIVER, /* 0x01 */ UPG_BOMB_BAG, /* 0x02 */ UPG_STRENGTH, @@ -88,7 +88,7 @@ typedef enum { /* 0x08 */ UPG_MAX } UpgradeType; -typedef enum { +typedef enum QuestItem { /* 0x00 */ QUEST_MEDALLION_FOREST, /* 0x01 */ QUEST_MEDALLION_FIRE, /* 0x02 */ QUEST_MEDALLION_WATER, @@ -116,13 +116,13 @@ typedef enum { /* 0x1C */ QUEST_HEART_PIECE_COUNT = 0x1C } QuestItem; -typedef enum { +typedef enum DungeonItem { /* 0x00 */ DUNGEON_BOSS_KEY, /* 0x01 */ DUNGEON_COMPASS, /* 0x02 */ DUNGEON_MAP } DungeonItem; -typedef enum { +typedef enum InventorySlot { /* 0x00 */ SLOT_DEKU_STICK, /* 0x01 */ SLOT_DEKU_NUT, /* 0x02 */ SLOT_BOMB, @@ -150,7 +150,7 @@ typedef enum { /* 0xFF */ SLOT_NONE = 0xFF } InventorySlot; -typedef enum { +typedef enum ItemID { /* 0x00 */ ITEM_DEKU_STICK, /* 0x01 */ ITEM_DEKU_NUT, /* 0x02 */ ITEM_BOMB, @@ -316,7 +316,7 @@ typedef enum { #define ITEM_TRADE_ADULT ITEM_POCKET_EGG // Get Item result may vary depending on context (chest/shop/scrub/drop) -typedef enum { +typedef enum GetItemID { /* 0x00 */ GI_NONE, /* 0x01 */ GI_BOMBS_5, /* 0x02 */ GI_DEKU_NUTS_5, @@ -446,7 +446,7 @@ typedef enum { /* 0x7E */ GI_MAX } GetItemID; -typedef enum { +typedef enum GetItemDrawID { /* 0x00 */ GID_BOTTLE_EMPTY, /* 0x01 */ GID_SMALL_KEY, /* 0x02 */ GID_SONG_MINUET, @@ -567,7 +567,7 @@ typedef enum { /* 0x75 */ GID_MAX } GetItemDrawID; -typedef enum { +typedef enum ExchangeItemID { /* 0x00 */ EXCH_ITEM_NONE, /* 0x01 */ EXCH_ITEM_ZELDAS_LETTER, /* 0x02 */ EXCH_ITEM_WEIRD_EGG, diff --git a/include/z64light.h b/include/z64light.h index 7e11dd32c8..5b20af3142 100644 --- a/include/z64light.h +++ b/include/z64light.h @@ -6,7 +6,7 @@ #include "z64math.h" #include "color.h" -typedef struct { +typedef struct LightPoint { /* 0x0 */ s16 x; /* 0x2 */ s16 y; /* 0x4 */ s16 z; @@ -15,19 +15,19 @@ typedef struct { /* 0xA */ s16 radius; } LightPoint; // size = 0xC -typedef struct { +typedef struct LightDirectional { /* 0x0 */ s8 x; /* 0x1 */ s8 y; /* 0x2 */ s8 z; /* 0x3 */ u8 color[3]; } LightDirectional; // size = 0x6 -typedef union { +typedef union LightParams { LightPoint point; LightDirectional dir; } LightParams; // size = 0xC -typedef struct { +typedef struct LightInfo { /* 0x0 */ u8 type; /* 0x2 */ LightParams params; } LightInfo; // size = 0xE @@ -46,7 +46,7 @@ typedef struct LightNode { #define ENV_FOGNEAR_MAX 996 #define ENV_ZFAR_MAX 12800 -typedef struct { +typedef struct LightContext { /* 0x0 */ LightNode* listHead; /* 0x4 */ u8 ambientColor[3]; /* 0x7 */ u8 fogColor[3]; @@ -54,7 +54,7 @@ typedef struct { /* 0xC */ s16 zFar; // draw distance. range 0 - ENV_ZFAR_MAX } LightContext; // size = 0x10 -typedef enum { +typedef enum LightType { /* 0x00 */ LIGHT_POINT_NOGLOW, /* 0x01 */ LIGHT_DIRECTIONAL, /* 0x02 */ LIGHT_POINT_GLOW diff --git a/include/z64map_mark.h b/include/z64map_mark.h index d862197840..0c55efa3ae 100644 --- a/include/z64map_mark.h +++ b/include/z64map_mark.h @@ -7,12 +7,12 @@ #define MAP_MARK_CHEST 0 #define MAP_MARK_BOSS 1 -typedef struct { +typedef struct MapMarkPoint { /* 0x00 */ s8 chestFlag; // chest icon is only displayed if this flag is not set for the current room /* 0x01 */ u8 x, y; // coordinates to place the icon (top-left corner), relative to the minimap texture } MapMarkPoint; // size = 0x3 -typedef struct { +typedef struct MapMarkIconData { /* 0x00 */ s8 markType; // 0 for the chest icon, 1 for the boss skull icon, -1 for none /* 0x01 */ u8 count; // number of icons to display /* 0x02 */ MapMarkPoint points[12]; diff --git a/include/z64math.h b/include/z64math.h index 247cafdaff..8e665a7830 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -7,76 +7,76 @@ #define SQ(x) ((x)*(x)) #define VEC_SET(V,X,Y,Z) (V).x=(X);(V).y=(Y);(V).z=(Z) -typedef struct { +typedef struct Vec2f { f32 x, y; } Vec2f; // size = 0x08 -typedef struct { +typedef struct Vec3f { f32 x, y, z; } Vec3f; // size = 0x0C -typedef struct { +typedef struct Vec3us { u16 x, y, z; } Vec3us; // size = 0x06 -typedef struct { +typedef struct Vec3s { s16 x, y, z; } Vec3s; // size = 0x06 -typedef struct { +typedef struct Vec3i { s32 x, y, z; } Vec3i; // size = 0x0C -typedef struct { +typedef struct Sphere16 { Vec3s center; s16 radius; } Sphere16; // size = 0x08 -typedef struct { +typedef struct Spheref { Vec3f center; f32 radius; } Spheref; // size = 0x10 -typedef struct { +typedef struct PosRot { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3s rot; } PosRot; // size = 0x14 -typedef struct { +typedef struct Plane { Vec3f normal; f32 originDist; } Plane; // size = 0x10 -typedef struct { +typedef struct TriNorm { Vec3f vtx[3]; Plane plane; } TriNorm; // size = 0x34 -typedef struct { +typedef struct Cylinder16 { /* 0x0000 */ s16 radius; /* 0x0002 */ s16 height; /* 0x0004 */ s16 yShift; /* 0x0006 */ Vec3s pos; } Cylinder16; // size = 0x0C -typedef struct { +typedef struct Cylinderf { /* 0x00 */ f32 radius; /* 0x04 */ f32 height; /* 0x08 */ f32 yShift; /* 0x0C */ Vec3f pos; } Cylinderf; // size = 0x18 -typedef struct { +typedef struct InfiniteLine { /* 0x0000 */ Vec3f point; /* 0x000C */ Vec3f dir; } InfiniteLine; // size = 0x18 -typedef struct { +typedef struct Linef { /* 0x0000 */ Vec3f a; /* 0x000C */ Vec3f b; } Linef; // size = 0x18 -typedef struct { +typedef struct VecSphGeo { /* 0x0 */ f32 r; // radius /* 0x4 */ s16 pitch; // depends on coordinate system. See below. /* 0x6 */ s16 yaw; // azimuthal angle diff --git a/include/z64message.h b/include/z64message.h index 014c379b82..d0df11a16a 100644 --- a/include/z64message.h +++ b/include/z64message.h @@ -6,7 +6,7 @@ struct OcarinaStaff; struct Actor; -typedef enum { +typedef enum TextBoxIcon { /* 0 */ TEXTBOX_ICON_TRIANGLE, /* 1 */ TEXTBOX_ICON_SQUARE, /* 2 */ TEXTBOX_ICON_ARROW @@ -54,7 +54,7 @@ typedef enum { #define FILENAME_PERIOD 0x40 #endif -typedef enum { +typedef enum MessageMode { /* 0x00 */ MSGMODE_NONE, /* 0x01 */ MSGMODE_TEXT_START, /* 0x02 */ MSGMODE_TEXT_BOX_GROWING, @@ -177,7 +177,7 @@ typedef enum MaskReactionSet { /* 0x3C */ MASK_REACTION_SET_MAX } MaskReactionSet; -typedef enum { +typedef enum TextState { /* 0 */ TEXT_STATE_NONE, /* 1 */ TEXT_STATE_DONE_HAS_NEXT, /* 2 */ TEXT_STATE_CLOSING, @@ -191,7 +191,7 @@ typedef enum { /* 10 */ TEXT_STATE_AWAITING_NEXT } TextState; -typedef struct { +typedef struct Font { /* 0x0000 */ u32 msgOffset; /* 0x0004 */ u32 msgLength; union { @@ -221,7 +221,7 @@ typedef struct { #define TEXTBOX_ENDTYPE_EVENT 0x50 #define TEXTBOX_ENDTYPE_FADING 0x60 -typedef struct { +typedef struct MessageContext { /* 0x0000 */ View view; /* 0x0128 */ Font font; /* 0xE2B0 */ u8* textboxSegment; // original name: "fukidashiSegment" diff --git a/include/z64object.h b/include/z64object.h index 057b445b69..e74b1793d1 100644 --- a/include/z64object.h +++ b/include/z64object.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "z64dma.h" -typedef struct { +typedef struct ObjectEntry { /* 0x00 */ s16 id; /* 0x04 */ void* segment; /* 0x08 */ DmaRequest dmaRequest; @@ -12,7 +12,7 @@ typedef struct { /* 0x40 */ OSMesg loadMsg; } ObjectEntry; // size = 0x44 -typedef struct { +typedef struct ObjectContext { /* 0x0000 */ void* spaceStart; /* 0x0004 */ void* spaceEnd; // original name: "endSegment" /* 0x0008 */ u8 numEntries; // total amount of used entries @@ -26,7 +26,7 @@ typedef struct { #define DEFINE_OBJECT_EMPTY(_0, enum) enum, #define DEFINE_OBJECT_UNSET(enum) enum, -typedef enum { +typedef enum ObjectId { #include "tables/object_table.h" /* 0x0192 */ OBJECT_ID_MAX } ObjectId; diff --git a/include/z64ocarina.h b/include/z64ocarina.h index 0ff3d01487..917b1b83f4 100644 --- a/include/z64ocarina.h +++ b/include/z64ocarina.h @@ -3,7 +3,7 @@ #include "ultra64.h" -typedef enum { +typedef enum OcarinaSongId { /* 0 */ OCARINA_SONG_MINUET, /* 1 */ OCARINA_SONG_BOLERO, /* 2 */ OCARINA_SONG_SERENADE, @@ -22,7 +22,7 @@ typedef enum { /* 14 */ OCARINA_SONG_SCARECROW_LONG = OCARINA_SONG_MAX // anything larger than 13 is considered the long scarecrow's song } OcarinaSongId; -typedef enum { +typedef enum OcarinaSongActionId { /* 0x00 */ OCARINA_ACTION_UNK_0, // acts like free play but never set /* 0x01 */ OCARINA_ACTION_FREE_PLAY, /* 0x02 */ OCARINA_ACTION_TEACH_MINUET, // Song demonstrations by teachers @@ -75,7 +75,7 @@ typedef enum { /* 0x31 */ OCARINA_ACTION_CHECK_NOWARP_DONE } OcarinaSongActionId; -typedef enum { +typedef enum OcarinaMode { /* 0x00 */ OCARINA_MODE_00, /* 0x01 */ OCARINA_MODE_01, /* 0x02 */ OCARINA_MODE_02, @@ -94,7 +94,7 @@ typedef enum { /* 0x0F */ OCARINA_MODE_0F } OcarinaMode; -typedef enum { +typedef enum OcarinaButtonIndex { /* 0 */ OCARINA_BTN_A, /* 1 */ OCARINA_BTN_C_DOWN, /* 2 */ OCARINA_BTN_C_RIGHT, @@ -106,7 +106,7 @@ typedef enum { // Uses scientific pitch notation relative to middle C // https://en.wikipedia.org/wiki/Scientific_pitch_notation -typedef enum { +typedef enum OcarinaPitch { /* 0x0 */ OCARINA_PITCH_C4, /* 0x1 */ OCARINA_PITCH_DFLAT4, /* 0x2 */ OCARINA_PITCH_D4, @@ -126,7 +126,7 @@ typedef enum { /* 0xFF */ OCARINA_PITCH_NONE = 0xFF } OcarinaPitch; -typedef enum { +typedef enum OcarinaInstrumentId { /* 0 */ OCARINA_INSTRUMENT_OFF, /* 1 */ OCARINA_INSTRUMENT_DEFAULT, /* 2 */ OCARINA_INSTRUMENT_MALON, @@ -139,7 +139,7 @@ typedef enum { /* 8 */ OCARINA_INSTRUMENT_DEFAULT_COPY2 = OCARINA_INSTRUMENT_MAX + 1 // Unused but present in Sequence 0 table } OcarinaInstrumentId; -typedef enum { +typedef enum OcarinaRecordingState { /* 0 */ OCARINA_RECORD_OFF, /* 1 */ OCARINA_RECORD_SCARECROW_LONG, /* 2 */ OCARINA_RECORD_SCARECROW_SPAWN, @@ -157,7 +157,7 @@ typedef enum { * 0x80 - BTN_R is pressed to raise note by a semitone */ -typedef struct { +typedef struct OcarinaNote { /* 0x0 */ u8 pitch; // number of semitones above middle C /* 0x2 */ u16 length; // number of frames the note is sustained /* 0x4 */ u8 volume; @@ -166,7 +166,7 @@ typedef struct { /* 0x7 */ u8 bFlat4Flag; // See note above } OcarinaNote; // size = 0x8 -typedef struct { +typedef struct OcarinaSongButtons { /* 0x0 */ u8 numButtons; /* 0x1 */ u8 buttonsIndex[8]; } OcarinaSongButtons; // size = 0x9 diff --git a/include/z64pause.h b/include/z64pause.h index 85a6d1af85..eda4e2f82a 100644 --- a/include/z64pause.h +++ b/include/z64pause.h @@ -12,7 +12,7 @@ struct OcarinaStaff; #define PAUSE_CURSOR_PAGE_LEFT 10 #define PAUSE_CURSOR_PAGE_RIGHT 11 -typedef enum { +typedef enum PauseMenuPage { /* 0x00 */ PAUSE_ITEM, /* 0x01 */ PAUSE_MAP, /* 0x02 */ PAUSE_QUEST, @@ -53,7 +53,7 @@ typedef enum { #define PAUSE_EQUIP_BUFFER_SIZE sizeof(u16[PAUSE_EQUIP_PLAYER_HEIGHT][PAUSE_EQUIP_PLAYER_WIDTH]) #define PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE 0x5000 -typedef enum { +typedef enum PauseState { /* 0 */ PAUSE_STATE_OFF, /* 1 */ PAUSE_STATE_WAIT_LETTERBOX, // Request no letterboxing and wait for it. /* 2 */ PAUSE_STATE_WAIT_BG_PRERENDER, // Wait for the pause background prerender to be done. @@ -83,7 +83,7 @@ typedef enum { (((pauseCtx)->state != PAUSE_STATE_OFF) || ((pauseCtx)->debugState != 0)) // Sub-states of PAUSE_STATE_MAIN -typedef enum { +typedef enum PauseMainState { /* 0 */ PAUSE_MAIN_STATE_IDLE, /* 1 */ PAUSE_MAIN_STATE_SWITCHING_PAGE, /* 2 */ PAUSE_MAIN_STATE_2, @@ -96,7 +96,7 @@ typedef enum { /* 9 */ PAUSE_MAIN_STATE_9 } PauseMainState; -typedef struct { +typedef struct PauseContext { /* 0x0000 */ View view; /* 0x0128 */ u8* iconItemSegment; /* 0x012C */ u8* iconItem24Segment; @@ -180,12 +180,12 @@ typedef struct { #define PAUSE_MAP_MARK_CHEST 0 #define PAUSE_MAP_MARK_BOSS 1 -typedef struct { +typedef struct PauseMapMarkPoint { /* 0x00 */ s16 chestFlag; // chest icon is only displayed if this flag is not set for the current room, -1 for no flag /* 0x04 */ f32 x, y; // coordinates to place the icon (top-left corner) } PauseMapMarkPoint; // size = 0x0C -typedef struct { +typedef struct PauseMapMarkData { /* 0x00 */ s16 markType; // 0 for the chest icon, 1 for the boss skull icon, -1 for none /* 0x04 */ s32 unk_04; /* 0x08 */ const Vtx* vtx; diff --git a/include/z64player.h b/include/z64player.h index 979afd744a..6acf673364 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -7,7 +7,7 @@ struct Player; -typedef enum { +typedef enum PlayerSword { /* 0 */ PLAYER_SWORD_NONE, /* 1 */ PLAYER_SWORD_KOKIRI, /* 2 */ PLAYER_SWORD_MASTER, @@ -15,7 +15,7 @@ typedef enum { /* 4 */ PLAYER_SWORD_MAX } PlayerSword; -typedef enum { +typedef enum PlayerShield { /* 0x00 */ PLAYER_SHIELD_NONE, /* 0x01 */ PLAYER_SHIELD_DEKU, /* 0x02 */ PLAYER_SHIELD_HYLIAN, @@ -23,14 +23,14 @@ typedef enum { /* 0x04 */ PLAYER_SHIELD_MAX } PlayerShield; -typedef enum { +typedef enum PlayerTunic { /* 0x00 */ PLAYER_TUNIC_KOKIRI, /* 0x01 */ PLAYER_TUNIC_GORON, /* 0x02 */ PLAYER_TUNIC_ZORA, /* 0x03 */ PLAYER_TUNIC_MAX } PlayerTunic; -typedef enum { +typedef enum PlayerBoots { /* 0x00 */ PLAYER_BOOTS_KOKIRI, /* 0x01 */ PLAYER_BOOTS_IRON, /* 0x02 */ PLAYER_BOOTS_HOVER, @@ -41,7 +41,7 @@ typedef enum { /* 0x06 */ PLAYER_BOOTS_MAX } PlayerBoots; -typedef enum { +typedef enum PlayerStrength { /* 0x00 */ PLAYER_STR_NONE, /* 0x01 */ PLAYER_STR_BRACELET, /* 0x02 */ PLAYER_STR_SILVER_G, @@ -49,7 +49,7 @@ typedef enum { /* 0x04 */ PLAYER_STR_MAX } PlayerStrength; -typedef enum { +typedef enum PlayerMask { /* 0x00 */ PLAYER_MASK_NONE, /* 0x01 */ PLAYER_MASK_KEATON, /* 0x02 */ PLAYER_MASK_SKULL, @@ -62,7 +62,7 @@ typedef enum { /* 0x09 */ PLAYER_MASK_MAX } PlayerMask; -typedef enum { +typedef enum PlayerEnvHazard { /* 0x0 */ PLAYER_ENV_HAZARD_NONE, /* 0x1 */ PLAYER_ENV_HAZARD_HOTROOM, /* 0x2 */ PLAYER_ENV_HAZARD_UNDERWATER_FLOOR, @@ -70,7 +70,7 @@ typedef enum { /* 0x4 */ PLAYER_ENV_HAZARD_UNDERWATER_FREE } PlayerEnvHazard; -typedef enum { +typedef enum PlayerItemAction { /* 0x00 */ PLAYER_IA_NONE, /* 0x01 */ PLAYER_IA_SWORD_CS, // Hold sword without shield in hand. The sword is not useable. /* 0x02 */ PLAYER_IA_FISHING_POLE, @@ -141,7 +141,7 @@ typedef enum { /* 0x43 */ PLAYER_IA_MAX } PlayerItemAction; -typedef enum { +typedef enum PlayerLimb { /* 0x00 */ PLAYER_LIMB_NONE, /* 0x01 */ PLAYER_LIMB_ROOT, /* 0x02 */ PLAYER_LIMB_WAIST, @@ -167,7 +167,7 @@ typedef enum { /* 0x16 */ PLAYER_LIMB_MAX } PlayerLimb; -typedef enum { +typedef enum PlayerBodyPart { /* 0x00 */ PLAYER_BODYPART_WAIST, // PLAYER_LIMB_WAIST /* 0x01 */ PLAYER_BODYPART_R_THIGH, // PLAYER_LIMB_R_THIGH /* 0x02 */ PLAYER_BODYPART_R_SHIN, // PLAYER_LIMB_R_SHIN @@ -189,7 +189,7 @@ typedef enum { /* 0x12 */ PLAYER_BODYPART_MAX } PlayerBodyPart; -typedef enum { +typedef enum PlayerMeleeWeaponAnimation { /* 0 */ PLAYER_MWA_FORWARD_SLASH_1H, /* 1 */ PLAYER_MWA_FORWARD_SLASH_2H, /* 2 */ PLAYER_MWA_FORWARD_COMBO_1H, @@ -221,7 +221,7 @@ typedef enum { /* 28 */ PLAYER_MWA_MAX } PlayerMeleeWeaponAnimation; -typedef enum { +typedef enum PlayerDoorType { /* -1 */ PLAYER_DOORTYPE_AJAR = -1, /* 0 */ PLAYER_DOORTYPE_NONE, /* 1 */ PLAYER_DOORTYPE_HANDLE, @@ -229,13 +229,13 @@ typedef enum { /* 3 */ PLAYER_DOORTYPE_FAKE } PlayerDoorType; -typedef enum { +typedef enum PlayerFacePart { /* 0 */ PLAYER_FACEPART_EYES, /* 1 */ PLAYER_FACEPART_MOUTH, /* 2 */ PLAYER_FACEPART_MAX } PlayerFacePart; -typedef enum { +typedef enum PlayerEyes { /* 0 */ PLAYER_EYES_OPEN, /* 1 */ PLAYER_EYES_HALF, /* 2 */ PLAYER_EYES_CLOSED, @@ -247,7 +247,7 @@ typedef enum { /* 8 */ PLAYER_EYES_MAX } PlayerEyes; -typedef enum { +typedef enum PlayerMouth { /* 0 */ PLAYER_MOUTH_CLOSED, /* 1 */ PLAYER_MOUTH_HALF, /* 2 */ PLAYER_MOUTH_OPEN, @@ -255,7 +255,7 @@ typedef enum { /* 4 */ PLAYER_MOUTH_MAX } PlayerMouth; -typedef enum { +typedef enum PlayerFace { /* 0 */ PLAYER_FACE_NEUTRAL, // eyes open and mouth closed /* 1 */ PLAYER_FACE_NEUTRAL_BLINKING_HALF, // eyes half open and mouth closed /* 2 */ PLAYER_FACE_NEUTRAL_BLINKING_CLOSED, // eyes and mouth closed @@ -275,7 +275,7 @@ typedef enum { /* 16 */ PLAYER_FACE_MAX } PlayerFace; -typedef enum { +typedef enum PlayerModelGroup { /* 0x00 */ PLAYER_MODELGROUP_0, // unused (except for a bug in `Player_OverrideLimbDrawPause`) /* 0x01 */ PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD, //hold sword only. used for holding sword only as child link with hylian shield equipped /* 0x02 */ PLAYER_MODELGROUP_SWORD_AND_SHIELD, // hold sword and shield or just sword if no shield is equipped @@ -295,7 +295,7 @@ typedef enum { /* 0x10 */ PLAYER_MODELGROUP_MAX } PlayerModelGroup; -typedef enum { +typedef enum PlayerModelGroupEntry { /* 0x00 */ PLAYER_MODELGROUPENTRY_ANIM, /* 0x01 */ PLAYER_MODELGROUPENTRY_LEFT_HAND, /* 0x02 */ PLAYER_MODELGROUPENTRY_RIGHT_HAND, @@ -304,7 +304,7 @@ typedef enum { /* 0x05 */ PLAYER_MODELGROUPENTRY_MAX } PlayerModelGroupEntry; -typedef enum { +typedef enum PlayerModelType { // left hand /* 0x00 */ PLAYER_MODELTYPE_LH_OPEN, // empty open hand /* 0x01 */ PLAYER_MODELTYPE_LH_CLOSED, // empty closed hand @@ -334,7 +334,7 @@ typedef enum { /* 0xFF */ PLAYER_MODELTYPE_RH_FF = 0xFF // disable shield collider, cutscene-specific } PlayerModelType; -typedef enum { +typedef enum PlayerAnimType { /* 0x00 */ PLAYER_ANIMTYPE_0, /* 0x01 */ PLAYER_ANIMTYPE_1, /* 0x02 */ PLAYER_ANIMTYPE_2, @@ -347,7 +347,7 @@ typedef enum { /** * Temporary names, derived from original animation names in `D_80853914` */ -typedef enum { +typedef enum PlayerAnimGroup { /* 0x00 */ PLAYER_ANIMGROUP_wait, /* 0x01 */ PLAYER_ANIMGROUP_walk, /* 0x02 */ PLAYER_ANIMGROUP_run, @@ -399,7 +399,7 @@ typedef enum { #define LIMB_BUF_COUNT(limbCount) ((ALIGN16((limbCount) * sizeof(Vec3s)) + sizeof(Vec3s) - 1) / sizeof(Vec3s)) #define PLAYER_LIMB_BUF_COUNT LIMB_BUF_COUNT(PLAYER_LIMB_MAX) -typedef enum { +typedef enum PlayerCsAction { /* 0x00 */ PLAYER_CSACTION_NONE, /* 0x01 */ PLAYER_CSACTION_1, /* 0x02 */ PLAYER_CSACTION_2, @@ -506,7 +506,7 @@ typedef enum { /* 0x67 */ PLAYER_CSACTION_MAX } PlayerCsAction; -typedef enum { +typedef enum PlayerCueId { /* 0x00 */ PLAYER_CUEID_NONE, /* 0x01 */ PLAYER_CUEID_1, /* 0x02 */ PLAYER_CUEID_2, @@ -588,7 +588,7 @@ typedef enum { /* 0x4E */ PLAYER_CUEID_MAX } PlayerCueId; -typedef enum { +typedef enum PlayerLedgeClimbType { /* 0 */ PLAYER_LEDGE_CLIMB_NONE, /* 1 */ PLAYER_LEDGE_CLIMB_1, /* 2 */ PLAYER_LEDGE_CLIMB_2, @@ -596,7 +596,7 @@ typedef enum { /* 4 */ PLAYER_LEDGE_CLIMB_4 } PlayerLedgeClimbType; -typedef enum { +typedef enum PlayerStickDirection { /* -1 */ PLAYER_STICK_DIR_NONE = -1, /* 0 */ PLAYER_STICK_DIR_FORWARD, /* 1 */ PLAYER_STICK_DIR_LEFT, @@ -604,7 +604,7 @@ typedef enum { /* 3 */ PLAYER_STICK_DIR_RIGHT } PlayerStickDirection; -typedef struct { +typedef struct PlayerAgeProperties { /* 0x00 */ f32 ceilingCheckHeight; /* 0x04 */ f32 unk_04; /* 0x08 */ f32 unk_08; @@ -640,7 +640,7 @@ typedef struct { /* 0xCC */ LinkAnimationHeader* unk_CC[2]; } PlayerAgeProperties; // size = 0xD4 -typedef struct { +typedef struct WeaponInfo { /* 0x00 */ s32 active; /* 0x04 */ Vec3f tip; /* 0x10 */ Vec3f base; diff --git a/include/z64save.h b/include/z64save.h index 94177d8c79..f270600254 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "z64math.h" -typedef enum { +typedef enum Language { #if OOT_NTSC /* 0 */ LANGUAGE_JPN, /* 1 */ LANGUAGE_ENG, @@ -19,7 +19,7 @@ typedef enum { // `_FORCE` means that this request will respond to `forceRisingButtonAlphas`. // If set, the buttons will also raise alphas but will also account for disabled buttons -typedef enum { +typedef enum HudVisibilityMode { /* 0 */ HUD_VISIBILITY_NO_CHANGE, /* 1 */ HUD_VISIBILITY_NOTHING, /* 2 */ HUD_VISIBILITY_NOTHING_ALT, // Identical to HUD_VISIBILITY_NOTHING @@ -38,7 +38,7 @@ typedef enum { /* 52 */ HUD_VISIBILITY_NOTHING_INSTANT = 52 } HudVisibilityMode; -typedef enum { +typedef enum MagicState { /* 0x0 */ MAGIC_STATE_IDLE, // Regular gameplay /* 0x1 */ MAGIC_STATE_CONSUME_SETUP, // Sets the speed at which magic border flashes /* 0x2 */ MAGIC_STATE_CONSUME, // Consume magic until target is reached or no more magic is available @@ -52,7 +52,7 @@ typedef enum { /* 0xA */ MAGIC_STATE_ADD // Add requested magic } MagicState; -typedef enum { +typedef enum MagicChangeType { /* 0 */ MAGIC_CONSUME_NOW, // Consume Magic immediately without preview /* 1 */ MAGIC_CONSUME_WAIT_NO_PREVIEW, // Sets consume target but waits to consume. No yellow magic preview to target consumption. Unused /* 2 */ MAGIC_CONSUME_NOW_ALT, // Identical behaviour to MAGIC_CONSUME_NOW. Unused @@ -64,13 +64,13 @@ typedef enum { #define MAGIC_NORMAL_METER 0x30 #define MAGIC_DOUBLE_METER (2 * MAGIC_NORMAL_METER) -typedef struct { +typedef struct ItemEquips { /* 0x00 */ u8 buttonItems[4]; /* 0x04 */ u8 cButtonSlots[3]; /* 0x08 */ u16 equipment; // a mask where each nibble corresponds to a type of equipment `EquipmentType`, and each nibble is a piece `EquipValue*` } ItemEquips; // size = 0x0A -typedef struct { +typedef struct Inventory { /* 0x00 */ u8 items[24]; /* 0x18 */ s8 ammo[16]; /* 0x28 */ u16 equipment; // a mask where each nibble corresponds to a type of equipment `EquipmentType`, and each bit to an owned piece `EquipInv*` @@ -82,7 +82,7 @@ typedef struct { /* 0x5C */ s16 gsTokens; } Inventory; // size = 0x5E -typedef struct { +typedef struct SavedSceneFlags { /* 0x00 */ u32 chest; /* 0x04 */ u32 swch; /* 0x08 */ u32 clear; @@ -92,7 +92,7 @@ typedef struct { /* 0x18 */ u32 floors; } SavedSceneFlags; // size = 0x1C -typedef struct { +typedef struct HorseData { /* 0x00 */ s16 sceneId; /* 0x02 */ Vec3s pos; /* 0x08 */ s16 angle; @@ -104,14 +104,14 @@ typedef struct { * "return": coming from the ground * "top": coming from the air */ -typedef enum { +typedef enum RespawnMode { /* 0x00 */ RESPAWN_MODE_DOWN, /* Normal Void Outs */ /* 0x01 */ RESPAWN_MODE_RETURN, /* Grotto Returnpoints */ /* 0x02 */ RESPAWN_MODE_TOP, /* Farore's Wind */ /* 0x03 */ RESPAWN_MODE_MAX } RespawnMode; -typedef struct { +typedef struct RespawnData { /* 0x00 */ Vec3f pos; /* 0x0C */ s16 yaw; /* 0x0E */ s16 playerParams; @@ -122,7 +122,7 @@ typedef struct { /* 0x18 */ u32 tempCollectFlags; } RespawnData; // size = 0x1C -typedef struct { +typedef struct FaroresWindData { /* 0x00 */ Vec3i pos; /* 0x0C */ s32 yaw; /* 0x10 */ s32 playerParams; @@ -133,7 +133,7 @@ typedef struct { /* 0x24 */ s32 tempCollectFlags; } FaroresWindData; // size = 0x28 -typedef enum { +typedef enum TimerState { /* 0x0 */ TIMER_STATE_OFF, /* 0x1 */ TIMER_STATE_ENV_HAZARD_INIT, // Init env timer that counts down, total time based on health, resets on void-out, kills at 0 /* 0x2 */ TIMER_STATE_ENV_HAZARD_PREVIEW, // Display initial time, keep it fixed at the screen center @@ -151,7 +151,7 @@ typedef enum { /* 0xF */ TIMER_STATE_UP_FREEZE // Stop counting the timer } TimerState; -typedef enum { +typedef enum SubTimerState { /* 0x0 */ SUBTIMER_STATE_OFF, /* 0x1 */ SUBTIMER_STATE_DOWN_INIT, // Init timer that counts down /* 0x2 */ SUBTIMER_STATE_DOWN_PREVIEW, // Display initial time, keep it fixed at the screen center @@ -165,7 +165,7 @@ typedef enum { /* 0xA */ SUBTIMER_STATE_UP_TICK // Counting up } SubTimerState; -typedef enum { +typedef enum TimerId { /* 0 */ TIMER_ID_MAIN, // Takes priority in both counting and drawing. See `timerState` and `timerSeconds` /* 1 */ TIMER_ID_SUB, // See `subTimerState` and `subTimerSeconds` /* 2 */ TIMER_ID_MAX @@ -177,7 +177,7 @@ typedef enum { #define ENV_HAZARD_TEXT_TRIGGER_UNDERWATER (1 << 1) // offsets in SavePlayerData and SaveContext/Save -typedef struct { +typedef struct SavePlayerData { /* 0x00 0x001C */ char newf[6]; // string "ZELDAZ" /* 0x06 0x0022 */ u16 deaths; /* 0x08 0x0024 */ char playerName[8]; @@ -203,7 +203,7 @@ typedef struct { } SavePlayerData; // offsets in SaveInfo and SaveContext/Save -typedef struct { +typedef struct SaveInfo { /* 0x0000 0x001C */ SavePlayerData playerData; // "S_Private" /* 0x004C 0x0068 */ ItemEquips equips; /* 0x0058 0x0074 */ Inventory inventory; @@ -229,7 +229,7 @@ typedef struct { /* 0x1336 0x1352 */ u16 checksum; // "check_sum" } SaveInfo; -typedef struct { +typedef struct Save { /* 0x00 */ s32 entranceIndex; /* 0x04 */ s32 linkAge; // 0: Adult; 1: Child (see enum `LinkAge`) /* 0x08 */ s32 cutsceneIndex; @@ -240,7 +240,7 @@ typedef struct { /* 0x1C */ SaveInfo info; // "information" } Save; -typedef struct { +typedef struct SaveContext { /* 0x0000 */ Save save; // "memory" /* 0x1354 */ s32 fileNum; // "file_no" /* 0x1358 */ char unk_1358[0x0004]; @@ -305,12 +305,12 @@ typedef struct { /* 0x1424 */ s16 healthAccumulator; } SaveContext; // size = 0x1428 -typedef enum { +typedef enum ButtonStatus { /* 0x00 */ BTN_ENABLED, /* 0xFF */ BTN_DISABLED = 0xFF } ButtonStatus; -typedef enum { +typedef enum ChamberCutsceneNum { /* 0 */ CHAMBER_CS_FOREST, /* 1 */ CHAMBER_CS_FIRE, /* 2 */ CHAMBER_CS_WATER, @@ -319,7 +319,7 @@ typedef enum { /* 5 */ CHAMBER_CS_LIGHT } ChamberCutsceneNum; -typedef enum { +typedef enum HighScores { /* 0x00 */ HS_HBA, // horseback archery /* 0x01 */ HS_POE_POINTS, /* 0x02 */ HS_FISHING, @@ -341,21 +341,21 @@ typedef enum { #define HS_FISH_CHEAT_ADULT 0x80000000 // used Sinking Lure as adult to catch record fish #define HS_FISH_PLAYED 0x10000 // incremented for every play. controls weather. -typedef enum { +typedef enum SunsSongState { /* 0 */ SUNSSONG_INACTIVE, /* 1 */ SUNSSONG_START, // the suns ocarina effect signals that the song has finished playing /* 2 */ SUNSSONG_SPEED_TIME, // suns was played where time passes, speed up the advancement of time /* 3 */ SUNSSONG_SPECIAL // time does not advance, but signals the song was played. used for freezing redeads } SunsSongState; -typedef enum { +typedef enum GameMode { /* 0 */ GAMEMODE_NORMAL, /* 1 */ GAMEMODE_TITLE_SCREEN, /* 2 */ GAMEMODE_FILE_SELECT, // Note: only instance type transitions swap to file select /* 3 */ GAMEMODE_END_CREDITS } GameMode; -typedef enum { +typedef enum SceneLayer { /* 0 */ SCENE_LAYER_CHILD_DAY, /* 1 */ SCENE_LAYER_CHILD_NIGHT, /* 2 */ SCENE_LAYER_ADULT_DAY, @@ -365,7 +365,7 @@ typedef enum { #define IS_CUTSCENE_LAYER (gSaveContext.sceneLayer >= SCENE_LAYER_CUTSCENE_FIRST) -typedef enum { +typedef enum LinkAge { /* 0 */ LINK_AGE_ADULT, /* 1 */ LINK_AGE_CHILD } LinkAge; @@ -820,7 +820,7 @@ typedef enum { #define EVENTINF_HORSES_0A ((EVENTINF_HORSES_INDEX << 4) | EVENTINF_HORSES_0A_SHIFT) #define EVENTINF_CUCCO_GAME_FINISHED EVENTINF_HORSES_0A -typedef enum { +typedef enum EventInfHorsesState { /* 0 */ EVENTINF_HORSES_STATE_0, /* 1 */ EVENTINF_HORSES_STATE_1, /* 2 */ EVENTINF_HORSES_STATE_2, diff --git a/include/z64scene.h b/include/z64scene.h index f1a45af70b..ec3d33f855 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -6,7 +6,7 @@ #include "command_macros_base.h" -typedef struct { +typedef struct SceneTableEntry { /* 0x00 */ RomFile sceneFile; /* 0x08 */ RomFile titleFile; /* 0x10 */ u8 unk_10; @@ -15,14 +15,14 @@ typedef struct { /* 0x13 */ u8 unk_13; } SceneTableEntry; // size = 0x14 -typedef struct { +typedef struct ActorEntry { /* 0x00 */ s16 id; /* 0x02 */ Vec3s pos; /* 0x08 */ Vec3s rot; /* 0x0E */ s16 params; } ActorEntry; // size = 0x10 -typedef struct { +typedef struct TransitionActorEntry { struct { s8 room; // Room to switch to s8 bgCamIndex; // How the camera reacts during the transition. See `Camera_ChangeDoorCam` @@ -38,53 +38,53 @@ typedef struct TransitionActorContext { /* 0x04 */ TransitionActorEntry* list; } TransitionActorContext; // size = 0x8 -typedef struct { +typedef struct Spawn { /* 0x00 */ u8 playerEntryIndex; /* 0x01 */ u8 room; } Spawn; -typedef struct { +typedef struct Path { /* 0x00 */ u8 count; // number of points in the path /* 0x04 */ Vec3s* points; // Segment Address to the array of points } Path; // size = 0x8 // Room shapes -typedef enum { +typedef enum RoomShapeType { /* 0 */ ROOM_SHAPE_TYPE_NORMAL, /* 1 */ ROOM_SHAPE_TYPE_IMAGE, /* 2 */ ROOM_SHAPE_TYPE_CULLABLE, /* 3 */ ROOM_SHAPE_TYPE_MAX } RoomShapeType; -typedef struct { +typedef struct RoomShapeBase { /* 0x00 */ u8 type; } RoomShapeBase; // size = 0x01 -typedef struct { +typedef struct RoomShapeDListsEntry { /* 0x00 */ Gfx* opa; /* 0x04 */ Gfx* xlu; } RoomShapeDListsEntry; // size = 0x08 -typedef struct { +typedef struct RoomShapeNormal { /* 0x00 */ RoomShapeBase base; /* 0x01 */ u8 numEntries; /* 0x04 */ RoomShapeDListsEntry* entries; /* 0x08 */ RoomShapeDListsEntry* entriesEnd; } RoomShapeNormal; // size = 0x0C -typedef enum { +typedef enum RoomShapeImageAmountType { /* 1 */ ROOM_SHAPE_IMAGE_AMOUNT_SINGLE = 1, /* 2 */ ROOM_SHAPE_IMAGE_AMOUNT_MULTI } RoomShapeImageAmountType; -typedef struct { +typedef struct RoomShapeImageBase { /* 0x00 */ RoomShapeBase base; /* 0x01 */ u8 amountType; // RoomShapeImageAmountType /* 0x04 */ RoomShapeDListsEntry* entry; } RoomShapeImageBase; // size = 0x08 -typedef struct { +typedef struct RoomShapeImageSingle { /* 0x00 */ RoomShapeImageBase base; /* 0x08 */ void* source; /* 0x0C */ u32 unk_0C; @@ -97,7 +97,7 @@ typedef struct { /* 0x1C */ u16 tlutCount; } RoomShapeImageSingle; // size = 0x20 -typedef struct { +typedef struct RoomShapeImageMultiBgEntry { /* 0x00 */ u16 unk_00; /* 0x02 */ u8 bgCamIndex; // for which bg cam index is this entry for /* 0x04 */ void* source; @@ -111,13 +111,13 @@ typedef struct { /* 0x18 */ u16 tlutCount; } RoomShapeImageMultiBgEntry; // size = 0x1C -typedef struct { +typedef struct RoomShapeImageMulti { /* 0x00 */ RoomShapeImageBase base; /* 0x08 */ u8 numBackgrounds; /* 0x0C */ RoomShapeImageMultiBgEntry* backgrounds; } RoomShapeImageMulti; // size = 0x10 -typedef struct { +typedef struct RoomShapeCullableEntry { /* 0x00 */ Vec3s boundsSphereCenter; /* 0x06 */ s16 boundsSphereRadius; /* 0x08 */ Gfx* opa; @@ -126,14 +126,14 @@ typedef struct { #define ROOM_SHAPE_CULLABLE_MAX_ENTRIES 64 -typedef struct { +typedef struct RoomShapeCullable { /* 0x00 */ RoomShapeBase base; /* 0x01 */ u8 numEntries; /* 0x04 */ RoomShapeCullableEntry* entries; /* 0x08 */ RoomShapeCullableEntry* entriesEnd; } RoomShapeCullable; // size = 0x0C -typedef union { +typedef union RoomShape { RoomShapeBase base; RoomShapeNormal normal; union { @@ -193,43 +193,43 @@ typedef struct RoomContext { // Scene commands -typedef struct { +typedef struct SCmdBase { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ u32 data2; } SCmdBase; -typedef struct { +typedef struct SCmdPlayerEntryList { /* 0x00 */ u8 code; /* 0x01 */ u8 length; /* 0x04 */ ActorEntry* data; } SCmdPlayerEntryList; -typedef struct { +typedef struct SCmdActorEntryList { /* 0x00 */ u8 code; /* 0x01 */ u8 length; /* 0x04 */ ActorEntry* data; } SCmdActorEntryList; -typedef struct { +typedef struct SCmdUnused02 { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ void* segment; } SCmdUnused02; -typedef struct { +typedef struct SCmdColHeader { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ CollisionHeader* data; } SCmdColHeader; -typedef struct { +typedef struct SCmdRoomList { /* 0x00 */ u8 code; /* 0x01 */ u8 length; /* 0x04 */ RomFile* data; } SCmdRoomList; -typedef struct { +typedef struct SCmdWindSettings { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x02 */ char pad[2]; @@ -239,61 +239,61 @@ typedef struct { /* 0x07 */ u8 unk_07; } SCmdWindSettings; -typedef struct { +typedef struct SCmdSpawnList { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ Spawn* data; } SCmdSpawnList; -typedef struct { +typedef struct SCmdSpecialFiles { /* 0x00 */ u8 code; /* 0x01 */ u8 naviQuestHintFileId; /* 0x04 */ u32 keepObjectId; } SCmdSpecialFiles; -typedef struct { +typedef struct SCmdRoomBehavior { /* 0x00 */ u8 code; /* 0x01 */ u8 gpFlag1; /* 0x04 */ u32 gpFlag2; } SCmdRoomBehavior; -typedef struct { +typedef struct SCmdMesh { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ RoomShapeBase* data; } SCmdMesh; -typedef struct { +typedef struct SCmdObjectList { /* 0x00 */ u8 code; /* 0x01 */ u8 length; /* 0x04 */ s16* data; } SCmdObjectList; -typedef struct { +typedef struct SCmdLightList { /* 0x00 */ u8 code; /* 0x01 */ u8 length; /* 0x04 */ LightInfo* data; } SCmdLightList; -typedef struct { +typedef struct SCmdPathList { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ Path* data; } SCmdPathList; -typedef struct { +typedef struct SCmdTransiActorList { /* 0x00 */ u8 code; /* 0x01 */ u8 length; /* 0x04 */ TransitionActorEntry* data; } SCmdTransiActorList; -typedef struct { +typedef struct SCmdLightSettingList { /* 0x00 */ u8 code; /* 0x01 */ u8 length; /* 0x04 */ EnvLightSettings* data; } SCmdLightSettingList; -typedef struct { +typedef struct SCmdTimeSettings { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x02 */ char pad[2]; @@ -302,7 +302,7 @@ typedef struct { /* 0x06 */ u8 timeSpeed; } SCmdTimeSettings; -typedef struct { +typedef struct SCmdSkyboxSettings { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x02 */ char pad[2]; @@ -311,7 +311,7 @@ typedef struct { /* 0x06 */ u8 envLightMode; } SCmdSkyboxSettings; -typedef struct { +typedef struct SCmdSkyboxDisables { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x02 */ char pad[2]; @@ -319,19 +319,19 @@ typedef struct { /* 0x05 */ u8 sunMoonDisabled; } SCmdSkyboxDisables; -typedef struct { +typedef struct SCmdEndMarker { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ u32 data2; } SCmdEndMarker; -typedef struct { +typedef struct SCmdExitList { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ s16* data; } SCmdExitList; -typedef struct { +typedef struct SCmdSoundSettings { /* 0x00 */ u8 code; /* 0x01 */ u8 specId; /* 0x02 */ char pad[4]; @@ -339,32 +339,32 @@ typedef struct { /* 0x07 */ u8 seqId; } SCmdSoundSettings; -typedef struct { +typedef struct SCmdEchoSettings { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x02 */ char pad[5]; /* 0x07 */ u8 echo; } SCmdEchoSettings; -typedef struct { +typedef struct SCmdCutsceneData { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ void* data; } SCmdCutsceneData; -typedef struct { +typedef struct SCmdAltHeaders { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ void* data; } SCmdAltHeaders; -typedef struct { +typedef struct SCmdMiscSettings { /* 0x00 */ u8 code; /* 0x01 */ u8 sceneCamType; /* 0x04 */ u32 area; } SCmdMiscSettings; -typedef union { +typedef union SceneCmd { SCmdBase base; SCmdPlayerEntryList playerEntryList; SCmdActorEntryList actorEntryList; @@ -397,7 +397,7 @@ typedef BAD_RETURN(s32) (*SceneCmdHandlerFunc)(struct PlayState*, SceneCmd*); #define DEFINE_SCENE(_0, _1, enum, _3, _4, _5) enum, -typedef enum { +typedef enum SceneID { #include "tables/scene_table.h" /* 0x6E */ SCENE_ID_MAX } SceneID; @@ -423,7 +423,7 @@ typedef enum { // Entrance Index Enum #define DEFINE_ENTRANCE(enum, _1, _2, _3, _4, _5, _6) enum, -typedef enum { +typedef enum EntranceIndex { #include "tables/entrance_table.h" /* 0x614 */ ENTR_MAX } EntranceIndex; @@ -432,7 +432,7 @@ typedef enum { #define ENTR_LOAD_OPENING -1 -typedef enum { +typedef enum ReturnEntranceIndex { /* 0x7FF9 */ ENTR_RETURN_GREAT_FAIRYS_FOUNTAIN_SPELLS = 0x7FF9, /* 0x7FFA */ ENTR_RETURN_SHOOTING_GALLERY, /* 0x7FFB */ ENTR_RETURN_2, // unused @@ -442,7 +442,7 @@ typedef enum { /* 0x7FFF */ ENTR_RETURN_GROTTO // Grottos and normal Fairy Fountain } ReturnEntranceIndex; -typedef enum { +typedef enum SceneDrawConfig { /* 0 */ SDC_DEFAULT, /* 1 */ SDC_HYRULE_FIELD, /* 2 */ SDC_KAKARIKO_VILLAGE, @@ -508,7 +508,7 @@ typedef enum { #define SCENE_CAM_TYPE_SHOOTING_GALLERY 0x50 // Unreferenced in code, and used only by the main layer of the shooting gallery scene // navi hints -typedef enum { +typedef enum NaviQuestHintFileId { NAVI_QUEST_HINTS_NONE, NAVI_QUEST_HINTS_OVERWORLD, NAVI_QUEST_HINTS_DUNGEON @@ -516,7 +516,7 @@ typedef enum { // Scene commands -typedef enum { +typedef enum SceneCommandTypeID { /* 0x00 */ SCENE_CMD_ID_SPAWN_LIST, /* 0x01 */ SCENE_CMD_ID_ACTOR_LIST, /* 0x02 */ SCENE_CMD_ID_UNUSED_2, diff --git a/include/z64skin.h b/include/z64skin.h index a199ed41b1..d29c7c7482 100644 --- a/include/z64skin.h +++ b/include/z64skin.h @@ -7,7 +7,7 @@ * Holds a compact version of a vertex used in the Skin system * It is used to initialise the Vtx used by an animated limb */ -typedef struct { +typedef struct SkinVertex { /* 0x00 */ u16 index; /* 0x02 */ s16 s; // s and t are texture coordinates (also known as u and v) /* 0x04 */ s16 t; @@ -20,7 +20,7 @@ typedef struct { /** * Describes a position displacement and a scale to be applied to a limb at index `limbIndex` */ -typedef struct { +typedef struct SkinTransformation { /* 0x00 */ u8 limbIndex; /* 0x02 */ s16 x; /* 0x04 */ s16 y; @@ -28,7 +28,7 @@ typedef struct { /* 0x08 */ u8 scale; } SkinTransformation; // size = 0xA -typedef struct { +typedef struct SkinLimbModif { /* 0x00 */ u16 vtxCount; // number of vertices in this modif entry /* 0x02 */ u16 transformCount; /* 0x04 */ u16 unk_4; // index of limbTransformations? @@ -36,7 +36,7 @@ typedef struct { /* 0x0C */ SkinTransformation* limbTransformations; } SkinLimbModif; // size = 0x10 -typedef struct { +typedef struct SkinAnimatedLimbData { /* 0x00 */ u16 totalVtxCount; // total vertex count for all modif entries /* 0x02 */ u16 limbModifCount; /* 0x04 */ SkinLimbModif* limbModifications; @@ -46,7 +46,7 @@ typedef struct { #define SKIN_LIMB_TYPE_ANIMATED 4 #define SKIN_LIMB_TYPE_NORMAL 11 -typedef struct { +typedef struct SkinLimb { /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent /* 0x06 */ u8 child; /* 0x07 */ u8 sibling; @@ -54,12 +54,12 @@ typedef struct { /* 0x0C */ void* segment; // Gfx* if segmentType is SKIN_LIMB_TYPE_NORMAL, SkinAnimatedLimbData* if segmentType is SKIN_LIMB_TYPE_ANIMATED, NULL otherwise } SkinLimb; // size = 0x10 -typedef struct { +typedef struct SkinLimbVtx { /* 0x000 */ u8 index; // alternates every draw cycle /* 0x004 */ Vtx* buf[2]; // number of vertices in buffer determined by `totalVtxCount` } SkinLimbVtx; // size = 0xC -typedef struct { +typedef struct Skin { /* 0x000 */ SkeletonHeader* skeletonHeader; /* 0x004 */ MtxF mtx; /* 0x044 */ s32 limbCount; diff --git a/include/z64skybox.h b/include/z64skybox.h index 73017cbb37..e0ebcf0c03 100644 --- a/include/z64skybox.h +++ b/include/z64skybox.h @@ -10,7 +10,7 @@ struct GameState; struct GraphicsContext; -typedef enum { +typedef enum SkyboxId { /* 0x00 */ SKYBOX_NONE, /* 0x01 */ SKYBOX_NORMAL_SKY, /* 0x02 */ SKYBOX_BAZAAR, @@ -41,7 +41,7 @@ typedef enum { /* 0x27 */ SKYBOX_UNSET_27 = 39 } SkyboxId; -typedef enum { +typedef enum SkyboxDrawType { /* 0 */ SKYBOX_DRAW_128, // 128x128 top/bottom faces, 128x64 side faces /* 1 */ SKYBOX_DRAW_256_4FACE, // 256x256 all side faces with per-face palettes /* 2 */ SKYBOX_DRAW_256_3FACE // 256x256 3/4 side faces with per-face palettes @@ -59,7 +59,7 @@ typedef struct SkyboxContext { /* 0x150 */ char unk_150[0x10]; } SkyboxContext; // size = 0x160 -typedef struct { +typedef struct SkyboxFile { /* 0x00 */ RomFile file; /* 0x08 */ RomFile palette; } SkyboxFile; // size = 0x10 diff --git a/include/z64sram.h b/include/z64sram.h index 0f87f55fcd..36478c1716 100644 --- a/include/z64sram.h +++ b/include/z64sram.h @@ -3,14 +3,14 @@ #include "ultra64/ultratypes.h" -typedef struct { +typedef struct SramContext { /* 0x00 */ u8* readBuff; } SramContext; // size = 0x4 #define SRAM_SIZE 0x8000 #define SRAM_HEADER_SIZE 0x10 -typedef enum { +typedef enum SramHeaderField { /* 0x00 */ SRAM_HEADER_SOUND, /* 0x01 */ SRAM_HEADER_ZTARGET, /* 0x02 */ SRAM_HEADER_LANGUAGE, diff --git a/include/z64transition.h b/include/z64transition.h index 9cf74f7229..569b8fb328 100644 --- a/include/z64transition.h +++ b/include/z64transition.h @@ -9,7 +9,7 @@ #define TRANS_TRIGGER_START 20 // start transition (exiting an area) #define TRANS_TRIGGER_END -20 // transition is ending (arriving in a new area) -typedef enum { +typedef enum TransitionMode { /* 0 */ TRANS_MODE_OFF, /* 1 */ TRANS_MODE_SETUP, /* 2 */ TRANS_MODE_INSTANCE_INIT, @@ -30,7 +30,7 @@ typedef enum { /* 17 */ TRANS_MODE_CS_BLACK_FILL } TransitionMode; -typedef enum { +typedef enum TransitionType { /* 0 */ TRANS_TYPE_WIPE, /* 1 */ TRANS_TYPE_TRIFORCE, /* 2 */ TRANS_TYPE_FADE_BLACK, @@ -62,7 +62,7 @@ typedef enum { #define TRANS_TYPE_CIRCLE(appearance, color, speed) ((1 << 5) | ((color & 3) << 3) | ((appearance & 3) << 1) | (speed & 1)) -typedef struct { +typedef struct TransitionContext { union { TransitionFade fade; TransitionCircle circle; diff --git a/include/z64transition_instances.h b/include/z64transition_instances.h index 1d08ab34ba..154b98d008 100644 --- a/include/z64transition_instances.h +++ b/include/z64transition_instances.h @@ -4,12 +4,12 @@ #include "ultra64.h" #include "color.h" -typedef struct { +typedef struct TransitionTileVtxData { /* 0x0 */ f32 x; /* 0x4 */ f32 y; } TransitionTileVtxData; // size = 0x8 -typedef struct { +typedef struct TransitionTile { /* 0x00 */ s32 cols; /* 0x04 */ s32 rows; /* 0x08 */ s32 frame; @@ -23,12 +23,12 @@ typedef struct { /* 0xDC */ u16* zBuffer; } TransitionTile; // size = 0xE0 -typedef enum { +typedef enum TransitionInstanceType { /* 1 */ TRANS_INSTANCE_TYPE_FILL_OUT = 1, /* 2 */ TRANS_INSTANCE_TYPE_FILL_IN } TransitionInstanceType; -typedef struct { +typedef struct TransitionWipe { /* 0x000 */ Color_RGBA8_u32 color; /* 0x004 */ Color_RGBA8_u32 unkColor; /* 0x008 */ u8 direction; @@ -44,7 +44,7 @@ typedef struct { #define TRANS_INSTANCE_TYPE_FADE_FLASH 3 -typedef struct { +typedef struct TransitionFade { /* 0x000 */ u8 type; /* 0x001 */ u8 isDone; /* 0x002 */ u8 direction; @@ -52,26 +52,26 @@ typedef struct { /* 0x008 */ u16 timer; } TransitionFade; // size = 0xC -typedef enum { +typedef enum TransitionCircleAppearance { /* 0 */ TCA_NORMAL, /* 1 */ TCA_WAVE, /* 2 */ TCA_RIPPLE, /* 3 */ TCA_STARBURST } TransitionCircleAppearance; -typedef enum { +typedef enum TransitionCircleColor { /* 0 */ TCC_BLACK, /* 1 */ TCC_WHITE, /* 2 */ TCC_GRAY, /* 3 */ TCC_SPECIAL // color varies depending on appearance. unused and appears broken } TransitionCircleColor; -typedef enum { +typedef enum TransitionCircleSpeed { /* 0 */ TCS_FAST, /* 1 */ TCS_SLOW } TransitionCircleSpeed; -typedef struct { +typedef struct TransitionCircle { /* 0x000 */ Color_RGBA8_u32 color; /* 0x004 */ Color_RGBA8_u32 unkColor; /* 0x008 */ s32 texX; @@ -90,7 +90,7 @@ typedef struct { /* 0x0A8 */ Mtx modelView[2][3]; } TransitionCircle; // size = 0x228 -typedef struct { +typedef struct TransitionTriforce { /* 0x000 */ Color_RGBA8_u32 color; /* 0x004 */ f32 transPos; /* 0x008 */ f32 step; diff --git a/include/z64view.h b/include/z64view.h index 5bce71f485..935b6f79a0 100644 --- a/include/z64view.h +++ b/include/z64view.h @@ -5,14 +5,14 @@ struct GraphicsContext; -typedef struct { +typedef struct Viewport { /* 0x0 */ s32 topY; // uly (upper left y) /* 0x4 */ s32 bottomY; // lry (lower right y) /* 0x8 */ s32 leftX; // ulx (upper left x) /* 0xC */ s32 rightX; // lrx (lower right x) } Viewport; // size = 0x10 -typedef struct { +typedef struct View { /* 0x000 */ s32 magic; // string literal "VIEW" / 0x56494557 /* 0x004 */ struct GraphicsContext* gfxCtx; /* 0x008 */ Viewport viewport; diff --git a/include/z64vis.h b/include/z64vis.h index 371b2346bd..fcd24d1b76 100644 --- a/include/z64vis.h +++ b/include/z64vis.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "color.h" -typedef enum { +typedef enum FramebufferFilterType { /* 0 */ FB_FILTER_NONE, /* 1 */ FB_FILTER_CVG_RGB, /* 2 */ FB_FILTER_CVG_RGB_UNIFORM, @@ -15,12 +15,12 @@ typedef enum { /* 7 */ FB_FILTER_MONO } FramebufferFilterType; -typedef enum { +typedef enum VisScissorType { /* 0 */ VIS_NO_SETSCISSOR, /* 1 */ VIS_SETSCISSOR } VisScissorType; -typedef struct { +typedef struct Vis { /* 0x00 */ u32 type; /* 0x04 */ u32 scissorType; /* 0x08 */ Color_RGBA8_u32 primColor; @@ -33,7 +33,7 @@ typedef struct { #define FB_FILTER_TO_CVG_TYPE(filter) (filter) -typedef enum { +typedef enum VisCvgType { /* 0 */ VIS_CVG_TYPE_NONE = FB_FILTER_TO_CVG_TYPE(FB_FILTER_NONE), /* 1 */ VIS_CVG_TYPE_CVG_RGB = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB), /* 2 */ VIS_CVG_TYPE_CVG_RGB_UNIFORM = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB_UNIFORM), @@ -41,7 +41,7 @@ typedef enum { /* 4 */ VIS_CVG_TYPE_CVG_RGB_FOG = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB_FOG) } VisCvgType; -typedef struct { +typedef struct VisCvg { /* 0x00 */ Vis vis; } VisCvg; // size = 0x10 @@ -71,12 +71,12 @@ void VisMono_Draw(VisMono* this, Gfx** gfxP); #define FB_FILTER_TO_ZBUF_TYPE(filter) ((filter) - FB_FILTER_ZBUF_IA) -typedef enum { +typedef enum VisZBufType { /* 0 */ VIS_ZBUF_TYPE_IA = FB_FILTER_TO_ZBUF_TYPE(FB_FILTER_ZBUF_IA), /* 1 */ VIS_ZBUF_TYPE_RGBA = FB_FILTER_TO_ZBUF_TYPE(FB_FILTER_ZBUF_RGBA) } VisZBufType; -typedef struct { +typedef struct VisZBuf { /* 0x00 */ Vis vis; } VisZBuf; // size = 0x10 diff --git a/src/audio/general.c b/src/audio/general.c index f0dbfa1f76..3bd7df2a5c 100644 --- a/src/audio/general.c +++ b/src/audio/general.c @@ -3,7 +3,7 @@ #define ABS_ALT(x) ((x) < 0 ? -(x) : (x)) -typedef struct { +typedef struct SfxPlayerState { /* 0x0 */ f32 vol; /* 0x4 */ f32 freqScale; /* 0x8 */ s8 reverb; @@ -13,7 +13,7 @@ typedef struct { /* 0xC */ u8 combFilterGain; } SfxPlayerState; -typedef enum { +typedef enum SfxChannelIndex { /* 0x0 */ SFX_CHANNEL_PLAYER0, // SfxPlayerBank /* 0x1 */ SFX_CHANNEL_PLAYER1, /* 0x2 */ SFX_CHANNEL_PLAYER2, @@ -32,20 +32,20 @@ typedef enum { /* 0xF */ SFX_CHANNEL_VOICE1 } SfxChannelIndex; // playerIdx = 2 -typedef struct { +typedef struct FreqLerp { /* 0x0 */ f32 value; /* 0x4 */ f32 target; /* 0x8 */ f32 step; /* 0xC */ s32 remainingFrames; } FreqLerp; -typedef struct { +typedef struct NatureAmbienceDataIO { /* 0x0 */ u16 playerIO; /* 0x2 */ u16 channelMask; /* 0x4 */ u8 channelIO[3 * 33 + 1]; } NatureAmbienceDataIO; // size = 0x68 -typedef enum { +typedef enum AudioDebugPage { /* 0x0 */ PAGE_NON, /* 0x1 */ PAGE_SOUND_CONTROL, /* 0x2 */ PAGE_SPEC_INFO, // unused @@ -66,7 +66,7 @@ typedef enum { #define SCROLL_PRINT_BUF_SIZE 25 -typedef struct { +typedef struct OcarinaStick { s8 x; s8 y; } OcarinaStick; diff --git a/src/audio/lib/heap.c b/src/audio/lib/heap.c index dcb027d491..2a0f859dff 100644 --- a/src/audio/lib/heap.c +++ b/src/audio/lib/heap.c @@ -1345,7 +1345,7 @@ void AudioHeap_DiscardSampleCaches(void) { } } -typedef struct { +typedef struct StorageChange { u32 oldAddr; u32 newAddr; u32 size; diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index 0d2fe051dd..1491790205 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -7,14 +7,14 @@ #define ASYNC_ID(v) ((u8)(v >> 8)) #define ASYNC_LOAD_STATUS(v) ((u8)(v >> 0)) -typedef enum { +typedef enum SlowLoadState { /* 0 */ SLOW_LOAD_STATE_WAITING, /* 1 */ SLOW_LOAD_STATE_START, /* 2 */ SLOW_LOAD_STATE_LOADING, /* 3 */ SLOW_LOAD_STATE_DONE } SlowLoadState; -typedef struct { +typedef struct SampleBankRelocInfo { /* 0x00 */ s32 sampleBankId1; /* 0x04 */ s32 sampleBankId2; /* 0x08 */ s32 baseAddr1; diff --git a/src/audio/lib/seqplayer.c b/src/audio/lib/seqplayer.c index 80f35bf2d0..4caddea4e4 100644 --- a/src/audio/lib/seqplayer.c +++ b/src/audio/lib/seqplayer.c @@ -21,7 +21,7 @@ #define PROCESS_SCRIPT_END -1 -typedef enum { +typedef enum PortamentoMode { /* 0 */ PORTAMENTO_MODE_OFF, /* 1 */ PORTAMENTO_MODE_1, /* 2 */ PORTAMENTO_MODE_2, diff --git a/src/audio/lib/synthesis.c b/src/audio/lib/synthesis.c index 321bd79a51..b93494de4a 100644 --- a/src/audio/lib/synthesis.c +++ b/src/audio/lib/synthesis.c @@ -14,7 +14,7 @@ #define DMEM_WET_LEFT_CH 0xC80 #define DMEM_WET_RIGHT_CH 0xE20 // = DMEM_WET_LEFT_CH + DMEM_1CH_SIZE -typedef enum { +typedef enum HaasEffectDelaySide { /* 0 */ HAAS_EFFECT_DELAY_NONE, /* 1 */ HAAS_EFFECT_DELAY_LEFT, // Delay left channel so that right channel is heard first /* 2 */ HAAS_EFFECT_DELAY_RIGHT // Delay right channel so that left channel is heard first diff --git a/src/audio/sequence.c b/src/audio/sequence.c index e04a5668ac..8d16b94a9b 100644 --- a/src/audio/sequence.c +++ b/src/audio/sequence.c @@ -26,7 +26,7 @@ Audio_ProcessSeqCmd((SEQCMD_OP_SET_SEQPLAYER_VOLUME << 28) | ((u8)(seqPlayerIndex) << 24) | \ ((u8)(duration) << 16) | ((u8)((volume)*127.0f))); -typedef struct { +typedef struct SeqRequest { /* 0x0 */ u8 seqId; /* 0x1 */ u8 priority; // higher values have higher priority } SeqRequest; // size = 0x2 diff --git a/src/audio/sfx.c b/src/audio/sfx.c index a11d8dc0ec..e2efcd1026 100644 --- a/src/audio/sfx.c +++ b/src/audio/sfx.c @@ -2,7 +2,7 @@ #include "global.h" #include "terminal.h" -typedef struct { +typedef struct SfxRequest { /* 0x00 */ u16 sfxId; /* 0x04 */ Vec3f* pos; /* 0x08 */ u8 token; @@ -11,7 +11,7 @@ typedef struct { /* 0x14 */ s8* reverbAdd; } SfxRequest; // size = 0x18 -typedef struct { +typedef struct UnusedBankLerp { /* 0x00 */ f32 value; /* 0x04 */ f32 target; /* 0x08 */ f32 step; diff --git a/src/code/fault.c b/src/code/fault.c index 17d7a214d9..3251bb832a 100644 --- a/src/code/fault.c +++ b/src/code/fault.c @@ -85,7 +85,7 @@ STACK(sFaultStack, 0x600); StackEntry sFaultThreadInfo; FaultMgr gFaultMgr; -typedef struct { +typedef struct FaultClientTask { /* 0x00 */ s32 (*callback)(void*, void*); /* 0x04 */ void* arg0; /* 0x08 */ void* arg1; diff --git a/src/code/fault_drawer.c b/src/code/fault_drawer.c index 5c82b7a0bb..6b85edb430 100644 --- a/src/code/fault_drawer.c +++ b/src/code/fault_drawer.c @@ -7,7 +7,7 @@ #include "global.h" #include "terminal.h" -typedef struct { +typedef struct FaultDrawer { /* 0x00 */ u16* fb; /* 0x04 */ u16 w; /* 0x06 */ u16 h; diff --git a/src/code/flg_set.c b/src/code/flg_set.c index 1904394868..de5b2a3d3f 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -1,6 +1,6 @@ #include "global.h" -typedef struct { +typedef struct FlagSetEntry { /* 0x00 */ u16* value; /* 0x04 */ const char* name; } FlagSetEntry; // size = 0x08 diff --git a/src/code/shrink_window.c b/src/code/shrink_window.c index d2cbf78f37..2dbe295e6e 100644 --- a/src/code/shrink_window.c +++ b/src/code/shrink_window.c @@ -1,6 +1,6 @@ #include "global.h" -typedef enum { +typedef enum LetterboxState { /* 0 */ LETTERBOX_STATE_IDLE, /* 1 */ LETTERBOX_STATE_GROWING, /* 2 */ LETTERBOX_STATE_SHRINKING diff --git a/src/code/speed_meter.c b/src/code/speed_meter.c index dff46d91e3..a9ddee0714 100644 --- a/src/code/speed_meter.c +++ b/src/code/speed_meter.c @@ -56,7 +56,7 @@ volatile OSTime D_8016A578; // Accumulator for `gRDPTimeTotal` volatile OSTime gRDPTimeAcc; -typedef struct { +typedef struct SpeedMeterTimeEntry { /* 0x00 */ volatile OSTime* time; /* 0x04 */ u8 x; /* 0x05 */ u8 y; @@ -74,7 +74,7 @@ SpeedMeterTimeEntry sSpeedMeterTimeEntryArray[] = { { &gGraphUpdatePeriod, 0, 10, GPACK_RGBA5551(255, 0, 255, 1) }, }; -typedef struct { +typedef struct SpeedMeterAllocEntry { /* 0x00 */ s32 maxval; /* 0x04 */ s32 val; /* 0x08 */ u16 backColor; diff --git a/src/code/ucode_disas.c b/src/code/ucode_disas.c index de6f7eed4f..a3540390c5 100644 --- a/src/code/ucode_disas.c +++ b/src/code/ucode_disas.c @@ -1,28 +1,28 @@ #include "global.h" -typedef struct { +typedef struct F3dzexConst { /* 0x00 */ u32 value; /* 0x04 */ const char* name; } F3dzexConst; // size = 0x8 -typedef struct { +typedef struct F3dzexFlag { /* 0x00 */ u32 value; /* 0x04 */ const char* setName; /* 0x08 */ const char* unsetName; } F3dzexFlag; // size = 0x0C -typedef struct { +typedef struct F3dzexRenderMode { /* 0x00 */ const char* name; /* 0x04 */ u32 value; /* 0x08 */ u32 mask; } F3dzexRenderMode; // size = 0x0C -typedef struct { +typedef struct F3dzexSetModeMacroValue { /* 0x00 */ const char* name; /* 0x04 */ u32 value; } F3dzexSetModeMacroValue; // size = 0x8 -typedef struct { +typedef struct F3dzexSetModeMacro { /* 0x00 */ const char* name; /* 0x04 */ u32 shift; /* 0x08 */ u32 len; @@ -69,7 +69,7 @@ F3dzexFlag sUCodeDisasMtxFlags[] = { F3DZEX_FLAG(G_MTX_PUSH, G_MTX_NOPUSH), }; -typedef enum { +typedef enum CombinerArg { COMBINER_A = 1, COMBINER_B, COMBINER_C, diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 9768a272a8..cde373de56 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -235,7 +235,7 @@ void Actor_ProjectPos(PlayState* play, Vec3f* src, Vec3f* xyzDest, f32* cappedIn *cappedInvWDest = (*cappedInvWDest < 1.0f) ? 1.0f : (1.0f / *cappedInvWDest); } -typedef struct { +typedef struct NaviColor { /* 0x00 */ Color_RGBA8 inner; /* 0x04 */ Color_RGBA8 outer; } NaviColor; // size = 0x8 @@ -1540,7 +1540,7 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) { return actor->xyzDistToPlayerSq; } -typedef struct { +typedef struct TargetRangeParams { /* 0x0 */ f32 rangeSq; /* 0x4 */ f32 leashScale; } TargetRangeParams; // size = 0x8 @@ -3745,7 +3745,7 @@ f32 Rand_CenteredFloat(f32 f) { return (Rand_ZeroOne() - 0.5f) * f; } -typedef struct { +typedef struct DoorLockInfo { /* 0x00 */ f32 chainAngle; /* 0x04 */ f32 chainLength; /* 0x08 */ f32 yShift; @@ -3900,7 +3900,7 @@ s32 Npc_UpdateTalking(PlayState* play, Actor* actor, s16* talkState, f32 interac return false; } -typedef struct { +typedef struct NpcTrackingRotLimits { /* 0x00 */ s16 maxHeadYaw; /* 0x02 */ s16 minHeadPitch; /* 0x04 */ s16 maxHeadPitch; @@ -3910,7 +3910,7 @@ typedef struct { /* 0x0C */ u8 rotateYaw; } NpcTrackingRotLimits; // size = 0x10 -typedef struct { +typedef struct NpcTrackingParams { /* 0x00 */ NpcTrackingRotLimits rotLimits; // Fields specific to NPC_TRACKING_PLAYER_AUTO_TURN mode /* 0x10 */ f32 autoTurnDistanceRange; // Max distance to player to enable tracking and auto-turn diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 4906fc556e..0d981f6e7f 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1484,7 +1484,7 @@ s32 BgCheck_IsSpotScene(PlayState* play) { return false; } -typedef struct { +typedef struct BgCheckSceneMemEntry { s16 sceneId; u32 memSize; } BgCheckSceneMemEntry; @@ -1523,7 +1523,7 @@ void BgCheck_SetSubdivisionDimension(f32 min, s32 subdivAmount, f32* max, f32* s *max = *subdivLength * subdivAmount + min; } -typedef struct { +typedef struct BgCheckSceneSubdivisionEntry { s16 sceneId; Vec3s subdivAmount; s32 nodeListMax; // if -1, dynamically compute max nodes diff --git a/src/code/z_camera.c b/src/code/z_camera.c index ae9a744c5f..019a4a8951 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -7041,7 +7041,7 @@ s32 Camera_Special5(Camera* camera) { return true; } -typedef enum { +typedef enum CamElevatorPlatform { /* 0 */ CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR, // ACTOR_BG_HIDAN_ROCK /* 1 */ CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER, // ACTOR_BG_HIDAN_FSLIFT /* 2 */ CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER, // ACTOR_BG_HIDAN_SYOKU diff --git a/src/code/z_camera_data.inc.c b/src/code/z_camera_data.inc.c index dc319636ae..3212173fd7 100644 --- a/src/code/z_camera_data.inc.c +++ b/src/code/z_camera_data.inc.c @@ -1,18 +1,18 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct CameraModeValue { s16 val; s16 dataType; } CameraModeValue; -typedef struct { +typedef struct CameraMode { s16 funcIdx; s16 valueCnt; CameraModeValue* values; } CameraMode; -typedef struct { +typedef struct CameraSetting { union { u32 unk_00; struct { diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 4303b0577b..22f266ca16 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -1602,12 +1602,12 @@ s32 CollisionCheck_SwordHitAudio(Collider* atCol, ColliderElement* acElem) { return true; } -typedef struct { +typedef struct HitInfo { /* 0x0 */ u8 blood; /* 0x1 */ u8 effect; } HitInfo; // size = 0x2 -typedef enum { +typedef enum ColChkBloodType { /* 0 */ BLOOD_NONE, /* 1 */ BLOOD_BLUE, /* 2 */ BLOOD_GREEN, @@ -1616,7 +1616,7 @@ typedef enum { /* 5 */ BLOOD_RED2 } ColChkBloodType; -typedef enum { +typedef enum ColChkHitType { /* 0 */ HIT_WHITE, /* 1 */ HIT_DUST, /* 2 */ HIT_RED, @@ -2687,7 +2687,7 @@ void CollisionCheck_AT(PlayState* play, CollisionCheckContext* colChkCtx) { CollisionCheck_SetHitEffects(play, colChkCtx); } -typedef enum { +typedef enum ColChkMassType { /* 0 */ MASSTYPE_IMMOVABLE, /* 1 */ MASSTYPE_HEAVY, /* 2 */ MASSTYPE_NORMAL diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 7a38b3dedb..3e6e184944 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -1,13 +1,13 @@ #include "global.h" -typedef struct { +typedef struct DebugCamTextBufferEntry { /* 0x0 */ u8 x; /* 0x1 */ u8 y; /* 0x2 */ u8 colorIndex; /* 0x3 */ char text[21]; } DebugCamTextBufferEntry; // size = 0x18 -typedef struct { +typedef struct InputCombo { /* 0x0 */ u16 hold; /* 0x2 */ u16 press; } InputCombo; // size = 0x4 diff --git a/src/code/z_debug_display.c b/src/code/z_debug_display.c index d1d5dd34c5..41ac98f86f 100644 --- a/src/code/z_debug_display.c +++ b/src/code/z_debug_display.c @@ -1,7 +1,7 @@ #include "global.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -typedef struct { +typedef struct DebugDispObjectInfo { /* 0x00 */ s16 drawType; // indicates which draw function to use when displaying the object /* 0x04 */ void* drawArg; // segment address (display list or texture) passed to the draw function when called } DebugDispObjectInfo; // size = 0x8 diff --git a/src/code/z_demo.c b/src/code/z_demo.c index f86e32dcc5..5d7dd7f3e8 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -59,7 +59,7 @@ CutsceneHandler sScriptedCutsceneHandlers[] = { CutsceneHandler_RunScript, // CS_STATE_RUN_UNSTOPPABLE }; -typedef enum { +typedef enum TitleDemoDestination { /* 0 */ TITLE_DEMO_SPIRIT_TEMPLE, /* 1 */ TITLE_DEMO_DEATH_MOUNTAIN_CRATER, /* 2 */ TITLE_DEMO_GANONDORF_HORSE @@ -67,7 +67,7 @@ typedef enum { u8 sTitleDemoDestination = TITLE_DEMO_SPIRIT_TEMPLE; -typedef struct { +typedef struct EntranceCutscene { /* 0x00 */ u16 entrance; // entrance index upon which the cutscene should trigger /* 0x02 */ u8 ageRestriction; // 0 for adult only, 1 for child only, 2 for both ages /* 0x03 */ u8 flag; // eventChkInf flag bound to the entrance cutscene diff --git a/src/code/z_draw.c b/src/code/z_draw.c index 671b8d0e2a..d6d9886768 100644 --- a/src/code/z_draw.c +++ b/src/code/z_draw.c @@ -106,7 +106,7 @@ void GetItem_DrawScale(PlayState* play, s16 drawId); void GetItem_DrawBulletBag(PlayState* play, s16 drawId); void GetItem_DrawWallet(PlayState* play, s16 drawId); -typedef struct { +typedef struct DrawItemTableEntry { /* 0x00 */ void (*drawFunc)(PlayState*, s16); /* 0x04 */ Gfx* dlists[8]; } DrawItemTableEntry; // size = 0x24 diff --git a/src/code/z_fbdemo_circle.c b/src/code/z_fbdemo_circle.c index 72ee6e1288..06f4d9ce3b 100644 --- a/src/code/z_fbdemo_circle.c +++ b/src/code/z_fbdemo_circle.c @@ -1,6 +1,6 @@ #include "global.h" -typedef enum { +typedef enum TransitionCircleDirection { /* 0 */ TRANS_CIRCLE_DIR_IN, /* 1 */ TRANS_CIRCLE_DIR_OUT } TransitionCircleDirection; diff --git a/src/code/z_fbdemo_fade.c b/src/code/z_fbdemo_fade.c index 171df77883..a63e3dbbd1 100644 --- a/src/code/z_fbdemo_fade.c +++ b/src/code/z_fbdemo_fade.c @@ -1,12 +1,12 @@ #include "global.h" #include "terminal.h" -typedef enum { +typedef enum TransitionFadeDirection { /* 0 */ TRANS_FADE_DIR_IN, /* 1 */ TRANS_FADE_DIR_OUT } TransitionFadeDirection; -typedef enum { +typedef enum TransitionFadeType { /* 0 */ TRANS_FADE_TYPE_NONE, /* 1 */ TRANS_FADE_TYPE_ONE_WAY, /* 2 */ TRANS_FADE_TYPE_FLASH diff --git a/src/code/z_fbdemo_wipe1.c b/src/code/z_fbdemo_wipe1.c index aea2235e34..4fb3ba38e0 100644 --- a/src/code/z_fbdemo_wipe1.c +++ b/src/code/z_fbdemo_wipe1.c @@ -1,6 +1,6 @@ #include "global.h" -typedef enum { +typedef enum TransitionWipeDirection { /* 0 */ TRANS_WIPE_DIR_IN, /* 1 */ TRANS_WIPE_DIR_OUT } TransitionWipeDirection; diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index 2348fa13a4..37ac91818b 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -77,7 +77,7 @@ void SkelCurve_SetAnim(SkelCurve* skelCurve, CurveAnimationHeader* animation, f3 skelCurve->animation = animation; } -typedef enum { +typedef enum SkelCurveVecType { /* 0 */ SKELCURVE_VEC_TYPE_SCALE, /* 1 */ SKELCURVE_VEC_TYPE_ROTATION, /* 2 */ SKELCURVE_VEC_TYPE_POSIITON, diff --git a/src/code/z_horse.c b/src/code/z_horse.c index 41fddbccfd..ca5da34b47 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -34,7 +34,7 @@ void func_8006D0AC(PlayState* play) { } } -typedef struct { +typedef struct HorseSpawn { /* 0x00 */ s16 sceneId; /* 0x02 */ Vec3s pos; /* 0x08 */ s16 angle; @@ -121,7 +121,7 @@ void func_8006D0EC(PlayState* play, Player* player) { } } -typedef struct { +typedef struct struct_8011F9B8 { /* 0x00 */ s16 sceneId; /* 0x04 */ s32 cutsceneIndex; /* 0x08 */ Vec3s pos; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index f0f36341d6..f75aceff66 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -9,14 +9,14 @@ #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" -typedef enum { +typedef enum LightningBoltState { /* 0x00 */ LIGHTNING_BOLT_START, /* 0x01 */ LIGHTNING_BOLT_WAIT, /* 0x02 */ LIGHTNING_BOLT_DRAW, /* 0xFF */ LIGHTNING_BOLT_INACTIVE = 0xFF } LightningBoltState; -typedef struct { +typedef struct ZBufValConversionEntry { /* 0x00 */ s32 mantissaShift; // shift applied to the mantissa of the z buffer value /* 0x04 */ s32 base; // 15.3 fixed-point base value for the exponent } ZBufValConversionEntry; // size = 0x8 @@ -41,7 +41,7 @@ u16 gTimeSpeed = 0; u16 sSunScreenDepth = GPACK_ZDZ(G_MAXFBZ, 0); -typedef struct { +typedef struct TimeBasedLightEntry { /* 0x00 */ u16 startTime; /* 0x02 */ u16 endTime; /* 0x04 */ u8 lightSetting; @@ -193,7 +193,7 @@ s16 gLensFlareScale; f32 gLensFlareColorIntensity; s16 gLensFlareGlareStrength; -typedef struct { +typedef struct LightningBolt { /* 0x00 */ u8 state; /* 0x04 */ Vec3f offset; /* 0x10 */ Vec3f pos; @@ -1485,7 +1485,7 @@ void Environment_DrawSunLensFlare(PlayState* play, EnvironmentContext* envCtx, V f32 sLensFlareScales[] = { 23.0f, 12.0f, 7.0f, 5.0f, 3.0f, 10.0f, 6.0f, 2.0f, 3.0f, 1.0f }; -typedef enum { +typedef enum LensFlareType { /* 0 */ LENS_FLARE_CIRCLE0, /* 1 */ LENS_FLARE_CIRCLE1, /* 2 */ LENS_FLARE_RING diff --git a/src/code/z_lights.c b/src/code/z_lights.c index ba197dee19..4f4a9a9cd9 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -3,7 +3,7 @@ #define LIGHTS_BUFFER_SIZE 32 -typedef struct { +typedef struct LightsBuffer { /* 0x000 */ s32 numOccupied; /* 0x004 */ s32 searchIndex; /* 0x008 */ LightNode buf[LIGHTS_BUFFER_SIZE]; diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c index a5e5e5d760..eaaf4c1e72 100644 --- a/src/code/z_map_mark.c +++ b/src/code/z_map_mark.c @@ -2,7 +2,7 @@ #include "terminal.h" #include "assets/textures/parameter_static/parameter_static.h" -typedef struct { +typedef struct MapMarkInfo { /* 0x00 */ void* texture; /* 0x04 */ u32 imageFormat; /* 0x08 */ u32 imageSize; @@ -14,7 +14,7 @@ typedef struct { /* 0x20 */ u32 dtdy; } MapMarkInfo; // size = 0x24 -typedef struct { +typedef struct MapMarkDataOverlay { /* 0x00 */ void* loadedRamAddr; // original name: "allocp" /* 0x04 */ RomFile file; /* 0x0C */ void* vramStart; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 9dc97ff1fc..0950838a62 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -4,7 +4,7 @@ #include "assets/textures/do_action_static/do_action_static.h" #include "assets/textures/icon_item_static/icon_item_static.h" -typedef struct { +typedef struct RestrictionFlags { /* 0x00 */ u8 sceneId; /* 0x01 */ u8 flags1; /* 0x02 */ u8 flags2; diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 7b90a1e35f..bc47ab6ac3 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -3,7 +3,7 @@ #include "assets/objects/object_link_boy/object_link_boy.h" #include "assets/objects/object_link_child/object_link_child.h" -typedef struct { +typedef struct BowSlingshotStringData { /* 0x00 */ Gfx* dList; /* 0x04 */ Vec3f pos; } BowSlingshotStringData; // size = 0x10 @@ -90,7 +90,7 @@ u8 sActionModelGroups[PLAYER_IA_MAX] = { PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_LENS_OF_TRUTH }; -typedef struct { +typedef struct EnvHazardTextTriggerEntry { /* 0x0 */ u8 flag; /* 0x2 */ u16 textId; } EnvHazardTextTriggerEntry; // size = 0x4 diff --git a/src/code/z_quake.c b/src/code/z_quake.c index 50cc448bec..317d053477 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -2,7 +2,7 @@ #include "quake.h" #include "terminal.h" -typedef struct { +typedef struct QuakeRequest { /* 0x00 */ s16 index; /* 0x02 */ s16 duration; /* 0x04 */ Camera* cam; diff --git a/src/code/z_room.c b/src/code/z_room.c index 9c16a53b6d..cb3b624acd 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -69,7 +69,7 @@ void Room_DrawNormal(PlayState* play, Room* room, u32 flags) { CLOSE_DISPS(play->state.gfxCtx, "../z_room.c", 239); } -typedef enum { +typedef enum RoomCullableDebugMode { /* 0 */ ROOM_CULL_DEBUG_MODE_OFF, /* 1 */ ROOM_CULL_DEBUG_MODE_UP_TO_TARGET, /* 2 */ ROOM_CULL_DEBUG_MODE_ONLY_TARGET diff --git a/src/code/z_ss_sram.c b/src/code/z_ss_sram.c index 75c61539a2..dd26d695cb 100644 --- a/src/code/z_ss_sram.c +++ b/src/code/z_ss_sram.c @@ -1,7 +1,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct SsSramContext { /* 0x00 */ OSPiHandle piHandle; /* 0x74 */ OSIoMesg ioMesg; /* 0x8C */ OSMesgQueue msgQueue; diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index caebcec0b8..ca183ce482 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -2,7 +2,7 @@ #include "terminal.h" #include "z64environment.h" -typedef struct { +typedef struct SkyboxFaceParams { /* 0x000 */ s32 xStart; /* 0x004 */ s32 yStart; /* 0x008 */ s32 zStart; diff --git a/src/libultra/os/initialize.c b/src/libultra/os/initialize.c index 3266d1e4dd..0ee8698e7c 100644 --- a/src/libultra/os/initialize.c +++ b/src/libultra/os/initialize.c @@ -1,6 +1,6 @@ #include "global.h" -typedef struct { +typedef struct __osExceptionVector { u32 inst1; // lui $k0, %hi(__osException) u32 inst2; // addiu $k0, $k0, %lo(__osException) u32 inst3; // jr $k0 diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c index 0786f214df..c3d2da05db 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c @@ -10,12 +10,12 @@ #define FLAGS ACTOR_FLAG_4 -typedef enum { +typedef enum BgBdanObjectsPropertyGetter { JABU_OBJECTS_GET_PROP_CAM_SETTING_NORMAL0 = 0, JABU_OBJECTS_GET_PROP_CAM_SETTING_DUNGEON1 = 3, JABU_OBJECTS_GET_PROP_WATCHED_BIGOCTO_INTRO_CUTSCENE = 4 } BgBdanObjectsPropertyGetter; -typedef enum { +typedef enum BgBdanObjectsPropertySetter { JABU_OBJECTS_SET_PROP_CAM_SETTING_NORMAL1 = 1, JABU_OBJECTS_SET_PROP_CAM_SETTING_DUNGEON0 = 2, JABU_OBJECTS_SET_PROP_WATCHED_BIGOCTO_INTRO_CUTSCENE = 4 diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h index 62c5392811..6c802bb3f6 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h @@ -6,7 +6,7 @@ struct BgBdanObjects; -typedef enum { +typedef enum BgBdanObjectsType { JABU_OBJECTS_TYPE_BIG_OCTO_PLATFORM, JABU_OBJECTS_TYPE_SMALL_AUTO_ELEVATOR, JABU_OBJECTS_TYPE_WATERBOX_HEIGHT_CHANGER, diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h index cc0d7ccebc..59266354af 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h @@ -5,7 +5,7 @@ #include "global.h" // BgBdanSwitch.actor.params & 0xFF -typedef enum { +typedef enum BgBdanSwitchType { /* 0x00 */ BLUE, /* 0x01 */ YELLOW_HEAVY, /* 0x02 */ YELLOW, diff --git a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c index b7ca1a7316..ea007f5e9c 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c @@ -11,7 +11,7 @@ #define FLAGS ACTOR_FLAG_4 -typedef struct { +typedef struct BombableWallInfo { /* 0x00 */ CollisionHeader* colHeader; /* 0x04 */ Gfx* dList; /* 0x08 */ s8 colType; diff --git a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h index 6880026c2a..c6dcab1b4f 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h @@ -17,7 +17,7 @@ typedef struct BgBreakwall { /* 0x01EC */ BgBreakwallActionFunc actionFunc; } BgBreakwall; // size = 0x01F0 -typedef enum { +typedef enum BombableWallType { /* 0 */ BWALL_DC_ENTRANCE, // When exploded it will play the Dodongo's Cavern intro cutscene /* 1 */ BWALL_WALL, // Used a lot in Dodongo's Cavern and other places /* 2 */ BWALL_KD_FLOOR, // Used in the King Dodongo boss room diff --git a/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c b/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c index 469aaa75a7..783ea51244 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c +++ b/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c @@ -33,7 +33,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -typedef enum { +typedef enum BgDdanJdState { /* 0 */ STATE_GO_BOTTOM, /* 1 */ STATE_GO_MIDDLE_FROM_BOTTOM, /* 2 */ STATE_GO_MIDDLE_FROM_TOP, diff --git a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h index 02603c6d01..2c8e873ba7 100644 --- a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h +++ b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef enum { +typedef enum BgDodoagoEye { /* 0 */ BGDODOAGO_EYE_LEFT, /* 1 */ BGDODOAGO_EYE_RIGHT } BgDodoagoEye; diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index 5e90d07746..9e79bf7ac9 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -13,13 +13,13 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) -typedef enum { +typedef enum BgDyYoseizoRewardType { /* 0 */ FAIRY_UPGRADE_MAGIC, /* 1 */ FAIRY_UPGRADE_DOUBLE_MAGIC, /* 2 */ FAIRY_UPGRADE_DOUBLE_DEFENSE } BgDyYoseizoRewardType; -typedef enum { +typedef enum BgDyYoseizoSpellType { /* 0 */ FAIRY_SPELL_FARORES_WIND, /* 1 */ FAIRY_SPELL_DINS_FIRE, /* 2 */ FAIRY_SPELL_NAYRUS_LOVE diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h index a1b6765931..fd7aebb3a4 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h @@ -12,7 +12,7 @@ typedef void (*BgDyYoseizoActionFunc)(struct BgDyYoseizo*, PlayState*); #define BG_DY_YOSEIZO_EFFECT_COUNT 200 -typedef struct { +typedef struct BgDyYoseizoEffect { /* 0x00 */ u8 alive; // drawn if 1, respawn if 0 /* 0x04 */ Vec3f pos; /* 0x10 */ Vec3f velocity; diff --git a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c index 88eae8d914..9fa132e0f8 100644 --- a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c +++ b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c @@ -10,7 +10,7 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -typedef enum { +typedef enum FlashState { /* 0x00 */ FLASH_NONE, /* 0x01 */ FLASH_GROW, /* 0x02 */ FLASH_SHRINK diff --git a/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h b/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h index 0899a3abab..39fb42a3aa 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h +++ b/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h @@ -16,7 +16,7 @@ typedef struct BgGndDarkmeiro { /* 0x016C */ BgGndDarkmeiroUpdateFunc updateFunc; } BgGndDarkmeiro; // size = 0x0170 -typedef enum { +typedef enum DarkmeiroType { /* 0 */ DARKMEIRO_INVISIBLE_PATH, // Textures for the invisible path in shadow trial. /* 1 */ DARKMEIRO_CLEAR_BLOCK, /* Clear blocks appear when their switch flag is set and diff --git a/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c b/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c index 7ac595bc19..441455f3d1 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c @@ -9,7 +9,7 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -typedef enum { +typedef enum BgGndIceblockAction { /* 0 */ GNDICE_IDLE, /* 1 */ GNDICE_FALL, /* 2 */ GNDICE_HOLE diff --git a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h index d111c64b76..1297692754 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h +++ b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h @@ -19,7 +19,7 @@ typedef struct BgHakaGate { /* 0x0172 */ s16 actionVar5; } BgHakaGate; // size = 0x0174 -typedef enum { +typedef enum BgHakaGateType { BGHAKAGATE_STATUE, BGHAKAGATE_FLOOR, BGHAKAGATE_GATE, diff --git a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index 9a83cbfcaf..356ec9fc9d 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -10,7 +10,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4) -typedef enum { +typedef enum SpinningScytheTrapMode { /* 0 */ SCYTHE_TRAP_SHADOW_TEMPLE, /* 1 */ SCYTHE_TRAP_SHADOW_TEMPLE_INVISIBLE, /* 2 */ SCYTHE_TRAP_ICE_CAVERN diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h index 111e08e242..a6a34dd426 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef enum { +typedef enum HakaTrapType { /* 0x00 */ HAKA_TRAP_GUILLOTINE_SLOW, /* 0x01 */ HAKA_TRAP_SPIKED_BOX, /* 0x02 */ HAKA_TRAP_SPIKED_WALL, diff --git a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c index dd4b281487..eb0342b5f7 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c +++ b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c @@ -10,7 +10,7 @@ #define FLAGS ACTOR_FLAG_4 -typedef enum { +typedef enum ShadowTempleAssetsType { /* 0x0 */ STA_GIANT_BIRD_STATUE, /* 0x1 */ STA_BOMBABLE_SKULL_WALL, /* 0x2 */ STA_BOMBABLE_RUBBLE, diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h index c6c21d2dfb..62c783fe52 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h @@ -16,7 +16,7 @@ typedef struct BgHeavyBlock { /* 0x0174 */ BgHeavyBlockActionFunc actionFunc; } BgHeavyBlock; // size = 0x0178 -typedef enum { +typedef enum HeavyBlockType { /* 0x00 */ HEAVYBLOCK_UNBREAKABLE, /* 0x01 */ HEAVYBLOCK_BREAKABLE, /* 0x02 */ HEAVYBLOCK_BIG_PIECE, diff --git a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c index 080c74d958..2c336a156d 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c @@ -21,7 +21,7 @@ void BgHidanCurtain_TurnOn(BgHidanCurtain* this, PlayState* play); void BgHidanCurtain_TurnOff(BgHidanCurtain* this, PlayState* play); void BgHidanCurtain_WaitForTimer(BgHidanCurtain* this, PlayState* play); -typedef struct { +typedef struct BgHidanCurtainParams { /* 0x00 */ s16 radius; /* 0x02 */ s16 height; /* 0x04 */ f32 scale; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c index d2cc17d636..2e674ef233 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c @@ -11,7 +11,7 @@ #define FLAGS ACTOR_FLAG_4 -typedef enum { +typedef enum HidanFwbigMoveState { /* 0 */ FWBIG_MOVE, /* 1 */ FWBIG_RESET, /* 2 */ FWBIG_KILL diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c index e8fb098b3f..aeace15738 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c @@ -11,7 +11,7 @@ #define FLAGS 0 -typedef enum { +typedef enum FireTempleBombableObjectsType { /* 0 */ CRACKED_STONE_FLOOR, /* 1 */ BOMBABLE_WALL, /* 2 */ LARGE_BOMBABLE_WALL diff --git a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h index 7fb4a0514b..765b017b32 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h +++ b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h @@ -8,7 +8,7 @@ struct BgIceShelter; typedef void (*BgIceShelterActionFunc)(struct BgIceShelter*, PlayState*); -typedef enum { +typedef enum RedIceType { /* 0 */ RED_ICE_LARGE, // Large red ice block /* 1 */ RED_ICE_SMALL, // Small red ice block /* 2 */ RED_ICE_PLATFORM, // Complex structure that can be climbed and walked on. Unused in vanilla OoT, used in MQ to cover the Ice Cavern Map chest diff --git a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.h b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.h index a869888a8b..eaa6cc843f 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.h +++ b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.h @@ -8,7 +8,7 @@ struct BgIceTurara; typedef void (*BgIceTuraraActionFunc)(struct BgIceTurara*, PlayState*); -typedef enum { +typedef enum BgIceTuraraType { /* 0 */ TURARA_STALAGMITE, /* 1 */ TURARA_STALACTITE, /* 2 */ TURARA_STALACTITE_REGROW diff --git a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c index e0f0b78213..4eddd4a3f8 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c @@ -28,7 +28,7 @@ ActorProfile Bg_Jya_Bigmirror_Profile = { /**/ BgJyaBigmirror_Draw, }; -typedef struct { +typedef struct BigMirrorDataEntry { /* 0x00 */ Vec3f pos; /* 0x0C */ s16 params; /* 0x0E */ s16 solvedRotY; diff --git a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h index 90647a7a8a..52f2b95930 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h +++ b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h @@ -14,7 +14,7 @@ struct BgJyaBigmirror; -typedef struct { +typedef struct BigmirrorCobra { /* 0x00 */ BgJyaCobra* cobra; /* 0x04 */ s16 rotY; } BigmirrorCobra; // size = 0x08 diff --git a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c index b51804cb18..2c5e47019e 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c @@ -59,7 +59,7 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -typedef struct { +typedef struct BgJyaMegamiPieceInit { /* 0x00 */ Vec3f unk_00; /* 0x0C */ f32 velX; /* 0x10 */ s16 rotVelX; diff --git a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h index a85222c940..b24f236013 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h +++ b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h @@ -8,7 +8,7 @@ struct BgJyaMegami; typedef void (*BgJyaMegamiActionFunc)(struct BgJyaMegami*, PlayState*); -typedef struct { +typedef struct BgJyaMegamiPiece { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f vel; /* 0x18 */ s16 rotVelX; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h index 37c0fe2b3b..d5eeaad344 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h +++ b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h @@ -23,7 +23,7 @@ typedef struct BgMizuBwall { /* 0x02B8 */ Gfx* dList; } BgMizuBwall; // size = 0x02BC -typedef enum { +typedef enum BgMizuBwallType { MIZUBWALL_FLOOR, MIZUBWALL_RUTO_ROOM, MIZUBWALL_UNUSED, diff --git a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c index 4d58505b01..a13d50d04b 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c @@ -17,7 +17,7 @@ void BgMizuWater_Draw(Actor* thisx, PlayState* play); void BgMizuWater_WaitForAction(BgMizuWater* this, PlayState* play); void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, PlayState* play); -typedef struct { +typedef struct WaterLevel { s32 switchFlag; s32 yDiff; } WaterLevel; diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h index 5e957f4035..4e6e93a5de 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h +++ b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h @@ -18,7 +18,7 @@ typedef struct BgMoriHashigo { /* 0x01CC */ s8 moriTexObjectSlot; } BgMoriHashigo; // size = 0x01D0 -typedef enum { +typedef enum HasigoType { /* -1 */ HASHIGO_CLASP = -1, /* 0 */ HASHIGO_LADDER } HasigoType; diff --git a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c index 6def1043f6..357301951e 100644 --- a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c +++ b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c @@ -10,7 +10,7 @@ #define FLAGS 0 -typedef enum { +typedef enum PoeFlameColor { POE_FLAME_PURPLE, // Meg POE_FLAME_RED, // Joelle POE_FLAME_BLUE, // Beth diff --git a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c index 038890ee85..892fdca58d 100644 --- a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c +++ b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c @@ -9,7 +9,7 @@ #define FLAGS ACTOR_FLAG_4 -typedef enum { +typedef enum WindmillSetpiecesMode { /* 0 */ WINDMILL_ROTATING_GEAR, /* 1 */ WINDMILL_DAMPE_STONE_DOOR } WindmillSetpiecesMode; diff --git a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c index 95d9f361bd..c4e9946972 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c +++ b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c @@ -10,7 +10,7 @@ #define FLAGS ACTOR_FLAG_4 -typedef enum { +typedef enum DrawbridgeType { /* -1 */ DT_DRAWBRIDGE = -1, /* 0 */ DT_CHAIN_1, /* 1 */ DT_CHAIN_2 diff --git a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h index 3055fb7f87..f6e3daab16 100644 --- a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h +++ b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef enum { +typedef enum BgSpot03TakiState { WATERFALL_CLOSED, WATERFALL_OPENING_IDLE, WATERFALL_OPENING_ANIMATED, diff --git a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index 4d28d392c7..bd4b5b1d64 100644 --- a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_9 -typedef enum { +typedef enum LakeHyliaObjectsType { /* 0x0 */ LHO_WATER_TEMPLE_ENTRACE_GATE, /* 0x1 */ LHO_WATER_TEMPLE_ENTRANCE_LOCK, /* 0x2 */ LHO_WATER_PLANE, /* 0x3 */ LHO_ICE_BLOCK } LakeHyliaObjectsType; -typedef enum { +typedef enum LakeHyliaWaterBoxIndices { /* 0x0 */ LHWB_GERUDO_VALLEY_RIVER_UPPER, // entrance from Gerudo Valley /* 0x1 */ LHWB_GERUDO_VALLEY_RIVER_LOWER, // river flowing from Gerudo Valley /* 0x2 */ LHWB_MAIN_1, // main water box diff --git a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h index 04c9dcab66..9149f9214b 100644 --- a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h +++ b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h @@ -13,7 +13,7 @@ typedef struct BgSstFloor { /* 0x0168 */ s16 drumHeight; } BgSstFloor; // size = 0x016C -typedef enum { +typedef enum BgSstFloorParams { /* 0 */ BONGOFLOOR_REST, /* 1 */ BONGOFLOOR_HIT } BgSstFloorParams; diff --git a/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.h b/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.h index 42fdf5cfb5..c279ae393c 100644 --- a/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.h +++ b/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.h @@ -6,7 +6,7 @@ struct BgVbSima; -typedef enum { +typedef enum BgVbSimaSignal { /* 0 */ VBSIMA_STAND, /* 1 */ VBSIMA_COLLAPSE, /* 2 */ VBSIMA_KILL diff --git a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h index 63105ab48c..616cd4250a 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h +++ b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h @@ -15,7 +15,7 @@ typedef struct BgYdanHasi { /* 0x016A */ s16 timer; //Also used as an offset for the water blocks Y position for a "bobbing" effect } BgYdanHasi; // size = 0x016C -typedef enum { +typedef enum HasiType { /* 0 */ HASI_WATER_BLOCK, /* 1 */ HASI_WATER, /* 2 */ HASI_THREE_BLOCKS diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c index 6a1d989a2a..e1d3a3942b 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c @@ -19,7 +19,7 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, PlayState* play); void BgYdanSp_BurnWallWeb(BgYdanSp* this, PlayState* play); void BgYdanSp_WallWebIdle(BgYdanSp* this, PlayState* play); -typedef enum { +typedef enum BgYdanSpType { /* 0 */ WEB_FLOOR, /* 1 */ WEB_WALL } BgYdanSpType; diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h index 13ccf61d8f..dc5398598d 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h @@ -10,7 +10,7 @@ typedef void (*BossDodongoActionFunc)(struct BossDodongo*, PlayState*); #define BOSS_DODONGO_EFFECT_COUNT 80 -typedef struct { +typedef struct BossDodongoEffect { /* 0x00 */ Vec3f unk_00; /* 0x0C */ Vec3f unk_0C; /* 0x18 */ Vec3f unk_18; diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index 2377494fb9..2baad32059 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -14,20 +14,20 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -typedef enum { +typedef enum BossFdIntroFlyState { /* 0 */ INTRO_FLY_EMERGE, /* 1 */ INTRO_FLY_HOLE, /* 2 */ INTRO_FLY_CAMERA, /* 3 */ INTRO_FLY_RETRAT } BossFdIntroFlyState; -typedef enum { +typedef enum BossFdManeIndex { /* 0 */ MANE_CENTER, /* 1 */ MANE_RIGHT, /* 2 */ MANE_LEFT } BossFdManeIndex; -typedef enum { +typedef enum BossFdEyeState { /* 0 */ EYE_OPEN, /* 1 */ EYE_HALF, /* 2 */ EYE_CLOSED diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h index d855c6c93b..dd1cbc8f0a 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h @@ -8,7 +8,7 @@ struct BossFd; typedef void (*BossFdActionFunc)(struct BossFd*, PlayState*); -typedef enum { +typedef enum BossFdActionState { /* -1 */ BOSSFD_WAIT_INTRO = -1, /* 0 */ BOSSFD_FLY_MAIN, /* 1 */ BOSSFD_FLY_HOLE, @@ -26,7 +26,7 @@ typedef enum { /* 205 */ BOSSFD_SKULL_BURN } BossFdActionState; -typedef enum { +typedef enum BossFdCutsceneState { /* 0 */ BFD_CS_NONE, /* 1 */ BFD_CS_WAIT, /* 2 */ BFD_CS_START, @@ -38,7 +38,7 @@ typedef enum { #define BOSSFD_EFFECT_COUNT 180 -typedef struct { +typedef struct BossFdEffect { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; @@ -58,7 +58,7 @@ typedef struct { #define vFdFxRotY bFdFxFloat2 #define vFdFxYStop bFdFxFloat2 -typedef enum { +typedef enum BossFdEffectType { /* 0 */ BFD_FX_NONE, /* 1 */ BFD_FX_EMBER, /* 2 */ BFD_FX_DEBRIS, @@ -67,13 +67,13 @@ typedef enum { /* 5 */ BFD_FX_SKULL_PIECE } BossFdEffectType; -typedef struct { +typedef struct BossFdMane { /* 0x000 */ Vec3f pos[30]; /* 0x168 */ f32 scale[30]; /* 0x1E0 */ Vec3f head; } BossFdMane; // size = 0x1EC -typedef enum { +typedef enum BossFdS16Var { /* 0 */ BFD_ACTION_STATE, /* 1 */ BFD_MOVE_TIMER, /* 2 */ BFD_VAR_TIMER, @@ -96,7 +96,7 @@ typedef enum { /* 19 */ BFD_SHORT_COUNT } BossFdS16Var; -typedef enum { +typedef enum BossFdF32Var { /* 0 */ BFD_TEX1_SCROLL_X, /* 1 */ BFD_TEX1_SCROLL_Y, /* 2 */ BFD_TEX2_SCROLL_X, diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index 86e22e9093..26e4eab495 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -12,7 +12,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -typedef enum { +typedef enum BossFd2CutsceneState { /* 0 */ DEATH_START, /* 1 */ DEATH_RETREAT, /* 2 */ DEATH_HANDOFF, @@ -21,7 +21,7 @@ typedef enum { /* 5 */ DEATH_FINISH } BossFd2CutsceneState; -typedef enum { +typedef enum BossFd2EyeState { /* 0 */ EYE_OPEN, /* 1 */ EYE_HALF, /* 2 */ EYE_CLOSED diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h index f7d4b795fc..f2d3ff45ad 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h @@ -8,14 +8,14 @@ struct BossFd2; typedef void (*BossFd2ActionFunc)(struct BossFd2*, PlayState*); -typedef enum { +typedef enum BossFd2Signal { /* 0 */ FD2_SIGNAL_NONE, /* 1 */ FD2_SIGNAL_FLY, /* 2 */ FD2_SIGNAL_DEATH, /* 100 */ FD2_SIGNAL_GROUND = 100 } BossFd2Signal; -typedef struct { +typedef struct BossFd2Mane { /* 0x000 */ Vec3f rot[10]; /* 0x078 */ Vec3f pos[10]; /* 0x0F0 */ Vec3f pull[10]; @@ -23,7 +23,7 @@ typedef struct { /* 0x190 */ Vec3f head; } BossFd2Mane; // size = 0x19C -typedef enum { +typedef enum BossFd2S16Var { /* 0 */ FD2_TURN_TO_LINK, /* 1 */ FD2_ACTION_STATE, /* 2 */ FD2_UNK_TIMER, @@ -39,7 +39,7 @@ typedef enum { /* 19 */ FD2_SHORT_COUNT = 19 } BossFd2S16Var; -typedef enum { +typedef enum BossFd2F32Var { /* 0 */ FD2_TEX1_SCROLL_X, /* 1 */ FD2_TEX1_SCROLL_Y, /* 2 */ FD2_TEX2_SCROLL_X, diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index f4d050ac1a..20bad19bad 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -120,7 +120,7 @@ static EnZl3* sZelda; #define BOSSGANON_EFFECT_COUNT 200 -typedef struct { +typedef struct GanondorfEffect { /* 0x00 */ u8 type; /* 0x01 */ u8 timer; /* 0x04 */ Vec3f pos; @@ -502,7 +502,7 @@ void BossGanon_SetupIntroCutscene(BossGanon* this, PlayState* play) { } } -typedef struct { +typedef struct CutsceneCameraPosition { /* 0x00 */ Vec3s eye; /* 0x06 */ Vec3s at; } CutsceneCameraPosition; // size = 0x12 diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h index 85bbc27f12..e0f093455b 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h @@ -8,7 +8,7 @@ struct BossGanon; typedef void (*BossGanonActionFunc)(struct BossGanon*, PlayState*); -typedef enum { +typedef enum GanondorfLimb { /* 0 */ GANONDORF_LIMB_NONE, /* 1 */ GANONDORF_LIMB_ROOT, /* 2 */ GANONDORF_LIMB_TORSO, @@ -38,7 +38,7 @@ typedef enum { /* 26 */ GANONDORF_LIMB_MAX } GanondorfLimb; -typedef enum { +typedef enum GanondorfFwork { /* 0 */ GDF_FWORK_0, /* 1 */ GDF_FWORK_1, /* 2 */ GDF_CENTER_POS, @@ -52,19 +52,19 @@ typedef enum { /* 10 */ GDF_FWORK_MAX } GanondorfFwork; -typedef enum { +typedef enum WindowShatterState { /* 0 */ GDF_WINDOW_SHATTER_OFF, /* 1 */ GDF_WINDOW_SHATTER_PARTIAL, /* 2 */ GDF_WINDOW_SHATTER_FULL } WindowShatterState; -typedef enum { +typedef enum GanondorfShockType { /* 0 */ GDF_SHOCK_DORF_YELLOW, /* 1 */ GDF_SHOCK_PLAYER_YELLOW, /* 2 */ GDF_SHOCK_PLAYER_PURPLE } GanondorfShockType; -typedef enum { +typedef enum GanondorfEffectType { /* 0 */ GDF_EFF_NONE, /* 1 */ GDF_EFF_SPARKLE, /* 2 */ GDF_EFF_LIGHT_RAY, @@ -77,7 +77,7 @@ typedef enum { /* 9 */ GDF_EFF_WINDOW_SHARD } GanondorfEffectType; -typedef enum { +typedef enum GanondorfTriforceType { /* 0 */ GDF_TRIFORCE_PLAYER, /* 1 */ GDF_TRIFORCE_ZELDA, /* 2 */ GDF_TRIFORCE_DORF diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h index 2248b41350..4c4c6f6fbe 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h @@ -8,7 +8,7 @@ struct BossGanon2; typedef void (*BossGanon2ActionFunc)(struct BossGanon2*, PlayState*); -typedef enum { +typedef enum GanonLimb { /* 0 */ GANON_LIMB_NONE, /* 1 */ GANON_LIMB_ROOT, /* 2 */ GANON_LIMB_TORSO, diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2_data.inc.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2_data.inc.c index f31a974108..bcb07e383d 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2_data.inc.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2_data.inc.c @@ -4,7 +4,7 @@ #define BOSS_GANON2_EFFECT_COUNT 100 -typedef struct { +typedef struct BossGanon2Effect { /* 0x00 */ u8 type; /* 0x01 */ u8 unk_01; /* 0x04 */ Vec3f position; diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index 98aa721bb0..2a35833798 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -14,7 +14,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -typedef enum { +typedef enum BossGanondrofDeathState { /* 0 */ NOT_DEAD, /* 1 */ DEATH_START, /* 2 */ DEATH_THROES, @@ -24,24 +24,24 @@ typedef enum { /* 6 */ DEATH_FINISH } BossGanondrofDeathState; -typedef enum { +typedef enum BossGanondrofThrowAction { /* 0 */ THROW_NORMAL, /* 1 */ THROW_SLOW } BossGanondrofThrowAction; -typedef enum { +typedef enum BossGanondrofStunnedAction { /* 0 */ STUNNED_FALL, /* 1 */ STUNNED_GROUND } BossGanondrofStunnedAction; -typedef enum { +typedef enum BossGanondrofChargeAction { /* 0 */ CHARGE_WINDUP, /* 1 */ CHARGE_START, /* 2 */ CHARGE_ATTACK, /* 3 */ CHARGE_FINISH } BossGanondrofChargeAction; -typedef enum { +typedef enum BossGanondrofDeathAction { /* 0 */ DEATH_SPASM, /* 1 */ DEATH_LIMP, /* 2 */ DEATH_HUNCHED diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h index e334123a98..142aea02b6 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h @@ -15,7 +15,7 @@ typedef void (*BossGanondrofActionFunc)(struct BossGanondrof*, PlayState*); #define GND_BOSSROOM_CENTER_Y -33.0f #define GND_BOSSROOM_CENTER_Z -3315.0f -typedef enum { +typedef enum BossGanondrofFlyMode { /* 0 */ GND_FLY_PAINTING, /* 1 */ GND_FLY_NEUTRAL, /* 2 */ GND_FLY_VOLLEY, @@ -23,13 +23,13 @@ typedef enum { /* 4 */ GND_FLY_CHARGE } BossGanondrofFlyMode; -typedef enum { +typedef enum BossGanondrofEyeState { /* 0 */ GND_EYESTATE_NONE, /* 1 */ GND_EYESTATE_FADE, /* 2 */ GND_EYESTATE_BRIGHTEN } BossGanondrofEyeState; -typedef enum { +typedef enum BossGanondrofS16Var { /* 0 */ GND_VARIANCE_TIMER, /* 1 */ GND_US_1, /* 2 */ GND_US_2, @@ -51,7 +51,7 @@ typedef enum { /* 20 */ GND_SHORT_COUNT = 20 } BossGanondrofS16Var; -typedef enum { +typedef enum BossGanondrofF32Var { /* 0 */ GND_FLOAT_SPEED, /* 1 */ GND_END_FRAME, /* 2 */ GND_EYE_BRIGHTNESS, diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index 3e217b2953..e34d1500c8 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -9,13 +9,13 @@ // IRIS_FOLLOW: gohma looks towards the player (iris rotation) // BONUS_IFRAMES: gain invincibility frames when the player does something (throwing things?), or // randomly (see BossGoma_UpdateEye) -typedef enum { +typedef enum GohmaEyeState { EYESTATE_IRIS_FOLLOW_BONUS_IFRAMES, // default, allows not drawing lens and iris when eye is closed EYESTATE_IRIS_NO_FOLLOW_NO_IFRAMES, EYESTATE_IRIS_FOLLOW_NO_IFRAMES } GohmaEyeState; -typedef enum { +typedef enum GohmaVisualState { VISUALSTATE_RED, // main/eye: red VISUALSTATE_DEFAULT, // main: greenish cyan, blinks with dark gray every 16 frames; eye: white VISUALSTATE_DEFEATED, // main/eye: dark gray diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h index 399fa722b1..5931f9ca3d 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h @@ -8,7 +8,7 @@ struct BossGoma; typedef void (*BossGomaActionFunc)(struct BossGoma*, PlayState*); -typedef enum { +typedef enum BossGomaLimb { /* 0 */ BOSSGOMA_LIMB_NONE, /* 1 */ BOSSGOMA_LIMB_ROOT1, /* 2 */ BOSSGOMA_LIMB_ROOT2, diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 1f5dc938fe..4734c8c2ee 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -20,7 +20,7 @@ #define BOSS_MO_EFFECT_COUNT 300 -typedef struct { +typedef struct BossMoEffect { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f vel; /* 0x18 */ Vec3f accel; @@ -59,7 +59,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play); void BossMo_Unknown(void); -typedef enum { +typedef enum BossMoEffectType { /* 0 */ MO_FX_NONE, /* 1 */ MO_FX_SMALL_RIPPLE, /* 2 */ MO_FX_BIG_RIPPLE, @@ -70,7 +70,7 @@ typedef enum { /* 7 */ MO_FX_BUBBLE } BossMoEffectType; -typedef enum { +typedef enum BossMoTentState { /* 0 */ MO_TENT_READY, /* 1 */ MO_TENT_SWING, /* 2 */ MO_TENT_ATTACK, @@ -90,7 +90,7 @@ typedef enum { /* 206 */ MO_TENT_DEATH_6 } BossMoTentState; -typedef enum { +typedef enum BossMoCoreState { /* -11 */ MO_CORE_UNUSED = -11, /* 0 */ MO_CORE_MOVE = 0, /* 1 */ MO_CORE_MAKE_TENT, @@ -102,7 +102,7 @@ typedef enum { /* 21 */ MO_CORE_INTRO_REVEAL } BossMoCoreState; -typedef enum { +typedef enum BossMoCsState { /* 0 */ MO_BATTLE, /* 1 */ MO_INTRO_WAIT, /* 2 */ MO_INTRO_START, diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h index 310a45ce9c..1b7641817e 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h @@ -8,7 +8,7 @@ struct BossMo; typedef void (*BossMoActionFunc)(struct BossMo*, PlayState*); -typedef enum { +typedef enum BossMoTentS16Var { /* 0 */ MO_TENT_ACTION_STATE, /* 1 */ MO_TENT_MOVE_TIMER, /* 2 */ MO_TENT_VAR_TIMER, @@ -21,7 +21,7 @@ typedef enum { /* 9 */ MO_TENT_SHORT_MAX } BossMoTentS16Var; -typedef enum { +typedef enum BossMoCoreS16Var { /* 0 */ MO_CORE_ACTION_STATE, /* 1 */ MO_CORE_MOVE_TIMER, /* 2 */ MO_CORE_VAR_TIMER, @@ -34,7 +34,7 @@ typedef enum { /* 9 */ MO_CORE_SHORT_MAX } BossMoCoreS16Var; -typedef enum { +typedef enum BossMoTentF32Var { /* 0 */ MO_TENT_SWING_LAG_X, /* 1 */ MO_TENT_SWING_SIZE_X, /* 2 */ MO_TENT_SWING_RATE_X, @@ -45,7 +45,7 @@ typedef enum { /* 7 */ MO_TENT_FLOAT_MAX } BossMoTentF32Var; -typedef enum { +typedef enum BossMoCoreF32Var { /* 0 */ MO_CORE_INTRO_WATER_ALPHA, /* 1 */ MO_CORE_FLOAT_MAX } BossMoCoreF32Var; diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index eccf44d43e..cc5f87b0ca 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -24,7 +24,7 @@ #define ROOM_CENTER_Y 0.0f #define ROOM_CENTER_Z 0.0f -typedef enum { +typedef enum BossSstHandState { /* 0 */ HAND_WAIT, /* 1 */ HAND_BEAT, /* 2 */ HAND_RETREAT, @@ -39,7 +39,7 @@ typedef enum { /* 11 */ HAND_DEATH } BossSstHandState; -typedef enum { +typedef enum BossSstEffectMode { /* 0 */ BONGO_NULL, /* 1 */ BONGO_ICE, /* 2 */ BONGO_SHOCKWAVE, diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h index 0524abaab2..f064f2b842 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h @@ -10,7 +10,7 @@ typedef void (*BossSstActionFunc)(struct BossSst*, PlayState*); #define BOSS_SST_EFFECT_COUNT 18 -typedef struct { +typedef struct BossSstEffect { /* 0x0000 */ Vec3f pos; /* 0x0010 */ Vec3f vel; /* 0x0018 */ Vec3s rot; @@ -20,7 +20,7 @@ typedef struct { /* 0x0024 */ u8 alpha; } BossSstEffect; // size = 0x28 -typedef struct { +typedef struct BossSstHandTrail { /* 0x0000 */ PosRot world; /* 0x0014 */ f32 zPosMod; /* 0x0018 */ s16 yRotMod; @@ -54,7 +54,7 @@ typedef struct BossSst { /* 0x09D4 */ BossSstHandTrail handTrails[7]; } BossSst; // size = 0x0A98 -typedef enum { +typedef enum BossSstType { /* -1 */ BONGO_HEAD = -1, /* 0 */ BONGO_LEFT_HAND, /* 1 */ BONGO_RIGHT_HAND diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index ebd911e99d..9b65f089d2 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -5,7 +5,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -typedef enum { +typedef enum TwEffType { /* 0 */ TWEFF_NONE, /* 1 */ TWEFF_DOT, /* 2 */ TWEFF_2, @@ -19,13 +19,13 @@ typedef enum { /* 10 */ TWEFF_SHLD_HIT } TwEffType; -typedef enum { +typedef enum EffectWork { /* 0 */ EFF_ARGS, /* 1 */ EFF_UNKS1, /* 2 */ EFF_WORK_MAX } EffectWork; -typedef enum { +typedef enum EffectFWork { /* 0 */ EFF_SCALE, /* 1 */ EFF_DIST, /* 2 */ EFF_ROLL, @@ -33,7 +33,7 @@ typedef enum { /* 4 */ EFF_FWORK_MAX } EffectFWork; -typedef enum { +typedef enum TwinrovaType { /* 0x00 */ TW_KOTAKE, /* 0x01 */ TW_KOUME, /* 0x02 */ TW_TWINROVA, @@ -47,7 +47,7 @@ typedef enum { #define BOSS_TW_EFFECT_COUNT 150 -typedef struct { +typedef struct BossTwEffect { /* 0x0000 */ u8 type; /* 0x0001 */ u8 frame; /* 0x0004 */ Vec3f pos; diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h index 14190e917c..eb2a4ef74c 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h @@ -8,7 +8,7 @@ struct BossTw; typedef void (*BossTwActionFunc)(struct BossTw* this, PlayState* play); -typedef enum { +typedef enum TwWork { /* 0 */ CS_TIMER_1, /* 1 */ CS_TIMER_2, /* 2 */ TW_PLLR_IDX, @@ -25,7 +25,7 @@ typedef enum { /* 13 */ WORK_MAX } TwWork; -typedef enum { +typedef enum TwFwork { /* 0 */ OUTR_CRWN_TX_X1, /* 1 */ OUTR_CRWN_TX_X2, /* 2 */ INNR_CRWN_TX_X1, @@ -55,7 +55,7 @@ typedef enum { /* 26 */ FWORK_MAX } TwFwork; -typedef enum { +typedef enum TwinrovaKotakeKoumeLimb { /* 0 */ TWINROVA_KOTAKE_KOUME_LIMB_NONE, /* 1 */ TWINROVA_KOTAKE_KOUME_LIMB_PELVIS, /* 2 */ TWINROVA_KOTAKE_KOUME_LIMB_LEFT_THIGH, @@ -86,7 +86,7 @@ typedef enum { /* 27 */ TWINROVA_KOTAKE_KOUME_LIMB_MAX } TwinrovaKotakeKoumeLimb; -typedef enum { +typedef enum TwinrovaLimb { /* 0 */ TWINROVA_LIMB_NONE, /* 1 */ TWINROVA_LIMB_PELVIS, /* 2 */ TWINROVA_LIMB_SASH_1, diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index c84328b57c..3faed8c858 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -41,7 +41,7 @@ typedef struct BossVaEffect { /* 0x54 */ struct BossVa* parent; } BossVaEffect; // size = 0x58 -typedef enum { +typedef enum BossVaEffectType { /* 0 */ VA_NONE, /* 1 */ VA_LARGE_SPARK, /* 2 */ VA_BLAST_SPARK, @@ -53,7 +53,7 @@ typedef enum { /* 8 */ VA_GORE } BossVaEffectType; -typedef enum { +typedef enum BossVaSparkMode { /* 1 */ SPARK_TETHER = 1, /* 2 */ SPARK_BARI, /* 3 */ SPARK_BLAST, @@ -62,25 +62,25 @@ typedef enum { /* 6 */ SPARK_LINK } BossVaSparkMode; -typedef enum { +typedef enum BossVaBloodMode { /* 0 */ BLOOD_DROPLET, /* 1 */ BLOOD_SPLATTER, /* 2 */ BLOOD_SPOT } BossVaBloodMode; -typedef enum { +typedef enum BossVaTumorMode { /* 0 */ TUMOR_UNUSED, /* 1 */ TUMOR_BODY, /* 2 */ TUMOR_ARM } BossVaTumorMode; -typedef enum { +typedef enum BossVaGoreMode { /* 0 */ GORE_PERMANENT, /* 1 */ GORE_FLOOR, /* 2 */ GORE_FADING } BossVaGoreMode; -typedef enum { +typedef enum BossVaCutscene { /* -5 */ INTRO_UNUSED_START = -5, /* -4 */ INTRO_START, /* -3 */ INTRO_LOOK_DOOR, diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.h b/src/overlays/actors/ovl_Boss_Va/z_boss_va.h index 3b5a1ab826..f5e6c8a896 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.h +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.h @@ -47,7 +47,7 @@ typedef struct BossVa { /* 0x0338 */ ColliderQuad colliderLightning; } BossVa; // size = 0x03B8 -typedef enum { +typedef enum BossVaParam { /* -1 */ BOSSVA_BODY = -1, /* 0 */ BOSSVA_SUPPORT_1, /* 1 */ BOSSVA_SUPPORT_2, diff --git a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index 27cac8856d..530e61e718 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -44,7 +44,7 @@ void DemoEc_Destroy(Actor* thisx, PlayState* play); void DemoEc_Update(Actor* thisx, PlayState* play); void DemoEc_Draw(Actor* thisx, PlayState* play); -typedef enum { +typedef enum DemoEcUpdateMode { /* 00 */ EC_UPDATE_COMMON, /* 01 */ EC_UPDATE_INGO, /* 02 */ EC_UPDATE_TALON, @@ -76,7 +76,7 @@ typedef enum { /* 28 */ EC_UPDATE_MALON } DemoEcUpdateMode; -typedef enum { +typedef enum DemoEcDrawconfig { /* 00 */ EC_DRAW_COMMON, /* 01 */ EC_DRAW_INGO, /* 02 */ EC_DRAW_TALON, diff --git a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h index 2e7263e58c..d3c2768bdb 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h @@ -8,71 +8,71 @@ struct DemoEffect; typedef void (*DemoEffectFunc)(struct DemoEffect*, PlayState*); -typedef struct { +typedef struct DemoEffectFireBall { /* 0x00 */ u8 timer; } DemoEffectFireBall; -typedef struct { +typedef struct DemoEffectBlueOrb { /* 0x00 */ u8 alpha; /* 0x01 */ u8 scale; /* 0x02 */ u8 pad; /* 0x04 */ s16 rotation; } DemoEffectBlueOrb; -typedef struct { +typedef struct DemoEffectLight { /* 0x00 */ u8 alpha; /* 0x01 */ u8 scaleFlag; /* 0x02 */ u8 flicker; /* 0x04 */ s16 rotation; } DemoEffectLight; -typedef struct { +typedef struct DemoEffectLgtShower { /* 0x00 */ u8 alpha; } DemoEffectLgtShower; -typedef struct { +typedef struct DemoEffectGodLgt { /* 0x00 */ u8 type; /* 0x01 */ u8 lightRingSpawnDelay; /* 0x02 */ u8 rotation; /* 0x04 */ s16 lightRingSpawnTimer; } DemoEffectGodLgt; -typedef struct { +typedef struct DemoEffectLightRing { /* 0x00 */ u8 timerIncrement; /* 0x01 */ u8 alpha; /* 0x02 */ u8 pad; /* 0x04 */ s16 timer; } DemoEffectLightRing; -typedef struct { +typedef struct DemoEffectTriforceSpot { /* 0x00 */ u8 triforceSpotOpacity; /* 0x01 */ u8 lightColumnOpacity; /* 0x02 */ u8 crystalLightOpacity; /* 0x04 */ s16 rotation; } DemoEffectTriforceSpot; -typedef struct { +typedef struct DemoEffectGetItem { /* 0x00 */ u8 isPositionInit; /* 0x01 */ u8 isLoaded; /* 0x02 */ u8 drawId; /* 0x04 */ s16 rotation; } DemoEffectGetItem; -typedef struct { +typedef struct DemoEffectTimeWarp { /* 0x00 */ u8 pad; /* 0x01 */ u8 pad2; /* 0x02 */ u8 pad3; /* 0x04 */ s16 shrinkTimer; } DemoEffectTimeWarp; -typedef struct { +typedef struct DemoEffectJewel { /* 0x00 */ u8 type; /* 0x01 */ u8 isPositionInit; /* 0x02 */ u8 alpha; /* 0x04 */ s16 timer; } DemoEffectJewel; -typedef struct { +typedef struct DemoEffectDust { /* 0x00 */ u8 timer; } DemoEffectDust; @@ -108,7 +108,7 @@ typedef struct DemoEffect { } DemoEffect; // size = 0x01A0 // These names come from the objects that correspond to this actor type. -typedef enum { +typedef enum DemoEffectType { /* 0x00 */ DEMO_EFFECT_CRYSTAL_LIGHT, /* 0x01 */ DEMO_EFFECT_FIRE_BALL, /* 0x02 */ DEMO_EFFECT_BLUE_ORB, // Object is in GAMEPLAY_KEEP. Not a name from object. It's a blue orb. @@ -138,7 +138,7 @@ typedef enum { /* 0x1A */ DEMO_EFFECT_MAX_TYPE } DemoEffectType; -typedef enum { +typedef enum DemoEffectLightColor { /* 0x00 */ DEMO_EFFECT_LIGHT_RED, /* 0x01 */ DEMO_EFFECT_LIGHT_BLUE, /* 0x02 */ DEMO_EFFECT_LIGHT_GREEN, @@ -148,7 +148,7 @@ typedef enum { /* 0x06 */ DEMO_EFFECT_LIGHT_GREEN2 } DemoEffectLightColor; -typedef enum { +typedef enum DemoEffectGodLgtType { /* 0x00 */ GOD_LGT_DIN, /* 0x01 */ GOD_LGT_NAYRU, /* 0x02 */ GOD_LGT_FARORE diff --git a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c index 384398cba8..b2376abff2 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c @@ -10,13 +10,13 @@ #define FLAGS ACTOR_FLAG_4 -typedef enum { +typedef enum DemoExtAction { /* 0x00 */ EXT_WAIT, /* 0x01 */ EXT_MAINTAIN, /* 0x02 */ EXT_DISPELL } DemoExtAction; -typedef enum { +typedef enum DemoExtDrawMode { /* 0x00 */ EXT_DRAW_NOTHING, /* 0x01 */ EXT_DRAW_VORTEX } DemoExtDrawMode; diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h index 928e92c19c..a29362c9e8 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h @@ -28,7 +28,7 @@ typedef struct DemoGj { * bits 8-10: The amount of collectible that will be dropped when killed. * bits 0- 7: A value of the enum DemoGjType. */ -typedef enum { +typedef enum DemoGjType { /* 04 */ DEMOGJ_TYPE_AROUNDARENA = 4, // This is the indestructible rubble around the arena. This actor keeps alive the whole fight. /* 08 */ DEMOGJ_TYPE_RUBBLE_PILE_1 = 8, // DEMOGJ_TYPE_RUBBLE_PILE_X are the rubbles from where Ganondorf rises. When he transforms into Ganon these are removed from the scene (Actor_Kill). /* 09 */ DEMOGJ_TYPE_RUBBLE_PILE_2, diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.h b/src/overlays/actors/ovl_Demo_Im/z_demo_im.h index 93fb427ddf..94744969be 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.h +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.h @@ -9,7 +9,7 @@ struct DemoIm; typedef void (*DemoImActionFunc)(struct DemoIm*, PlayState*); typedef void (*DemoImDrawFunc)(struct DemoIm*, PlayState*); -typedef enum { +typedef enum ImpaLimb { /* 0x00 */ IMPA_LIMB_NONE, /* 0x01 */ IMPA_LIMB_ROOT, /* 0x02 */ IMPA_LIMB_TORSO, diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h index 0103812c6f..f56184bb33 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h @@ -8,7 +8,7 @@ struct DemoKankyo; typedef void (*DemoKankyoActionFunc)(struct DemoKankyo*, PlayState*); -typedef enum { +typedef enum DemoKankyoType { /* 0x00 */ DEMOKANKYO_BLUE_RAIN, /* 0x01 */ DEMOKANKYO_BLUE_RAIN_2, /* 0x02 */ DEMOKANKYO_ROCK_1, @@ -29,7 +29,7 @@ typedef enum { /* 0x11 */ DEMOKANKYO_SPARKLES } DemoKankyoType; -typedef struct { +typedef struct DemoKankyoUnk150 { /* 0x00 */ Vec3f unk_0; /* 0x0C */ Vec3f unk_C; /* 0x18 */ f32 unk_18; // For Door of Time, this is the amount to translate it by used for when it's opening diff --git a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h index c6711097e4..8e396c4ec6 100644 --- a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h +++ b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h @@ -21,7 +21,7 @@ typedef struct DemoKekkai { /* 0x01F8 */ DemoKekkaiUpdateFunc updateFunc; } DemoKekkai; // size = 0x01FC -typedef enum { +typedef enum DemoKekkaiType { /* 0 */ KEKKAI_TOWER, /* 1 */ KEKKAI_WATER, /* 2 */ KEKKAI_LIGHT, diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c index 57edd774cf..478df2f3e5 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -44,7 +44,7 @@ void DemoSa_DrawNothing(DemoSa* this, PlayState* play); void DemoSa_DrawOpa(DemoSa* this, PlayState* play); void DemoSa_DrawXlu(DemoSa* this, PlayState* play); -typedef enum { +typedef enum SariaEyeState { /* 0 */ SARIA_EYE_OPEN, /* 1 */ SARIA_EYE_HALF, /* 2 */ SARIA_EYE_CLOSED, @@ -52,7 +52,7 @@ typedef enum { /* 4 */ SARIA_EYE_SAD } SariaEyeState; -typedef enum { +typedef enum SariaMouthState { /* 0 */ SARIA_MOUTH_CLOSED2, /* 1 */ SARIA_MOUTH_SUPRISED, /* 2 */ SARIA_MOUTH_CLOSED, diff --git a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c index 8966ec40b2..d71810b23d 100644 --- a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c +++ b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c @@ -14,7 +14,7 @@ void func_80993754(DemoTreLgt* this); void func_8099375C(DemoTreLgt* this, PlayState* play); void func_809937B4(DemoTreLgt* this, PlayState* play, f32 currentFrame); -typedef struct { +typedef struct DemoTreLgtInfo { /* 0x00 */ f32 startFrame; /* 0x04 */ f32 endFrame; /* 0x08 */ f32 unk_08; diff --git a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h index bd8e2e4df8..0cad6996d9 100644 --- a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h +++ b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h @@ -17,7 +17,7 @@ typedef struct DemoTreLgt { /* 0x0178 */ u8 status; } DemoTreLgt; // size = 0x017C -typedef enum { +typedef enum DemoTreLgtAction { /* 0x00 */ DEMO_TRE_LGT_ACTION_WAIT, // wait until animation is needed /* 0x01 */ DEMO_TRE_LGT_ACTION_ANIMATE } DemoTreLgtAction; diff --git a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c index b938e97df6..eac91d538f 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c @@ -13,7 +13,7 @@ #define FLAGS ACTOR_FLAG_4 -typedef enum { +typedef enum DoorKillerBehaviour { /* 0 */ DOOR_KILLER_DOOR, /* 1 */ DOOR_KILLER_RUBBLE_PIECE_1, /* 2 */ DOOR_KILLER_RUBBLE_PIECE_2, diff --git a/src/overlays/actors/ovl_Door_Killer/z_door_killer.h b/src/overlays/actors/ovl_Door_Killer/z_door_killer.h index 1b32564504..597624df1e 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.h +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.h @@ -9,7 +9,7 @@ * ((params >> 8) & 0x3F) == 0x3F means no switch flag is checked / set */ -typedef struct { +typedef struct DoorKillerTextureEntry { /* 0x00 */ s16 objectId; /* 0x04 */ void* texture; } DoorKillerTextureEntry; // size 0x8 diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index c6a4b5bee2..7a5298ebd6 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -60,7 +60,7 @@ ActorProfile Door_Shutter_Profile = { /**/ DoorShutter_Draw, }; -typedef enum { +typedef enum DoorShutterGfxType { /* 0 */ DOORSHUTTER_GFX_DEKU_TREE_1, /* 1 */ DOORSHUTTER_GFX_DEKU_TREE_2, /* 2 */ DOORSHUTTER_GFX_DODONGOS_CAVERN, @@ -83,7 +83,7 @@ typedef enum { /* 19 */ DOORSHUTTER_GFX_ROYAL_FAMILYS_TOMB } DoorShutterGfxType; -typedef enum { +typedef enum DoorShutterStyleType { /* -1 */ DOORSHUTTER_STYLE_FROM_SCENE = -1, // Style is taken from `sSceneInfo` /* 0 */ DOORSHUTTER_STYLE_PHANTOM_GANON, /* 1 */ DOORSHUTTER_STYLE_GOHMA_BLOCK, @@ -104,7 +104,7 @@ typedef enum { /* 16 */ DOORSHUTTER_STYLE_ROYAL_FAMILYS_TOMB } DoorShutterStyleType; -typedef struct { +typedef struct DoorShutterStyleInfo { s16 objectId; u8 gfxType1; u8 gfxType2; @@ -215,7 +215,7 @@ static DoorShutterStyleInfo sStyleInfo[] = { }, }; -typedef struct { +typedef struct DoorShutterGfxInfo { /* 0x0000 */ Gfx* doorDL; /* 0x0004 */ Gfx* barsDL; /* 0x0008 */ u8 barsOpenOffsetY; @@ -269,7 +269,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_STOP), }; -typedef struct { +typedef struct DoorShutterSceneInfo { s16 sceneId; u8 styleType; } DoorShutterSceneInfo; @@ -295,7 +295,7 @@ static DoorShutterSceneInfo sSceneInfo[] = { { -1, DOORSHUTTER_STYLE_GENERIC }, }; -typedef enum { +typedef enum DoorShutterBossDoorTexIndex { /* 0 */ DOORSHUTTER_BOSSDOORTEX_0, /* 1 */ DOORSHUTTER_BOSSDOORTEX_FIRE, /* 2 */ DOORSHUTTER_BOSSDOORTEX_WATER, @@ -305,7 +305,7 @@ typedef enum { /* 6 */ DOORSHUTTER_BOSSDOORTEX_SPIRIT } DoorShutterBossDoorTexIndex; -typedef struct { +typedef struct DoorShutterBossDoorInfo { s16 dungeonSceneId; s16 bossSceneId; u8 texIndex; diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h index 3eb39148c2..204c1d927c 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h @@ -25,7 +25,7 @@ #define DOORSHUTTER_PARAMS(type, switchFlag) ((((type) & 0xF) << 6) | ((switchFlag) & 0x3F)) -typedef enum { +typedef enum DoorShutterType { /* 0x00 */ SHUTTER, /* 0x01 */ SHUTTER_FRONT_CLEAR, /* 0x02 */ SHUTTER_FRONT_SWITCH, diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h index 09e00fbfd0..b41e952e89 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h @@ -6,7 +6,7 @@ struct DoorWarp1; -typedef enum { +typedef enum DoorWarp1Type { /* -2 */ WARP_BLUE_CRYSTAL = -2, /* -1 */ WARP_DUNGEON_ADULT, /* 0 */ WARP_DUNGEON_CHILD, @@ -22,7 +22,7 @@ typedef enum { /* 10 */ WARP_RED } DoorWarp1Type; -typedef enum { +typedef enum DoorWarp1RutoState { /* 0 */ WARP_BLUE_RUTO_STATE_INITIAL, // initial, warp doesn't work yet /* 1 */ WARP_BLUE_RUTO_STATE_READY, // set by ruto, warp can work now /* 2 */ WARP_BLUE_RUTO_STATE_ENTERED, // set by warp, player has stepped into the warp diff --git a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h index 4c9a1edaf6..6d14c32d76 100644 --- a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h +++ b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h @@ -10,7 +10,7 @@ typedef void (*EfcErupcActionFunc)(struct EfcErupc*, PlayState*); #define EFC_ERUPC_EFFECT_COUNT 100 -typedef struct { +typedef struct EfcErupcEffect { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f vel; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h index d5eeaffed4..e77a8e0223 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h @@ -23,7 +23,7 @@ typedef struct EffDust { /* 0x0564 */ EffDustDrawFunc drawFunc; } EffDust; // size = 0x0568 -typedef enum { +typedef enum EffDustType { /* 0x00 */ EFF_DUST_TYPE_0, /* 0x01 */ EFF_DUST_TYPE_1, /* 0x02 */ EFF_DUST_TYPE_2, diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c index 8dfe3fbb2b..587b53fb72 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -28,7 +28,7 @@ void EnAm_Ricochet(EnAm* this, PlayState* play); void EnAm_Stunned(EnAm* this, PlayState* play); void EnAm_RecoilFromDamage(EnAm* this, PlayState* play); -typedef enum { +typedef enum ArmosBehavior { /* 00 */ AM_BEHAVIOR_NONE, /* 01 */ AM_BEHAVIOR_DAMAGED, /* 03 */ AM_BEHAVIOR_DO_NOTHING = 3, @@ -111,7 +111,7 @@ static ColliderQuadInit sQuadInit = { { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -typedef enum { +typedef enum ArmosDamageEffect { /* 0 */ AM_DMGEFF_NONE, // used by anything that cant kill the armos /* 1 */ AM_DMGEFF_NUT, /* 6 */ AM_DMGEFF_STUN = 6, // doesn't include deku nuts diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.h b/src/overlays/actors/ovl_En_Am/z_en_am.h index 61e9042f9e..8bac3338da 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.h +++ b/src/overlays/actors/ovl_En_Am/z_en_am.h @@ -30,7 +30,7 @@ typedef struct EnAm { /* 0x030C */ ColliderQuad hitCollider; } EnAm; // size = 0x038C -typedef enum { +typedef enum ArmosType { /* 0 */ ARMOS_STATUE, /* 1 */ ARMOS_ENEMY } ArmosType; diff --git a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c index 501c25182a..58b130e05e 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c @@ -57,7 +57,7 @@ static ColliderCylinderInit sCylinderInit = { { 29, 103, 0, { 0, 0, 0 } }, }; -typedef enum { +typedef enum AnubiceDamageEffect { /* 0x0 */ ANUBICE_DMGEFF_NONE, /* 0x2 */ ANUBICE_DMGEFF_FIRE = 2, /* 0xF */ ANUBICE_DMGEFF_0xF = 0xF // Treated the same as ANUBICE_DMGEFF_NONE in code diff --git a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h index 73f70a6845..5f3ec8b134 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h @@ -9,7 +9,7 @@ struct EnAnubice; typedef void (*EnAnubiceActionFunc)(struct EnAnubice*, struct PlayState*); -typedef enum { +typedef enum AnubiceLimbs { /* 0 */ ANUBICE_LIMB_NONE, /* 1 */ ANUBICE_LIMB_ROOT, /* 2 */ ANUBICE_LIMB_BODY_ROOT, diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h index 9dee2f8f04..6c5b874a42 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h @@ -25,7 +25,7 @@ typedef struct EnArrow { /* 0x025C */ EnArrowActionFunc actionFunc; } EnArrow; // size = 0x0260 -typedef enum { +typedef enum ArrowType { /* -10 */ ARROW_CS_NUT = -10, // cutscene deku nuts are allowed to update in blocking mode /* -1 */ ARROW_NORMAL_SILENT = -1, // normal arrow that does not make a sound when being shot /* 0 */ ARROW_NORMAL_LIT, // normal arrow lit on fire diff --git a/src/overlays/actors/ovl_En_Ba/z_en_ba.h b/src/overlays/actors/ovl_En_Ba/z_en_ba.h index d19368c199..f39fa33995 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.h +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.h @@ -8,7 +8,7 @@ struct EnBa; typedef void (*EnBaActionFunc)(struct EnBa*, PlayState*); -typedef enum { +typedef enum EnBaType { /* 0x00 */ EN_BA_TENTACLE_RED, /* 0x01 */ EN_BA_TENTACLE_GREEN, /* 0x02 */ EN_BA_TENTACLE_GRAY, diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index a8131ea372..6a0a97b832 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -16,7 +16,7 @@ #define vMoveAngleY actionVar2 #define vFlameTimer actionVar2 -typedef enum { +typedef enum EnBbAction { /* 0 */ BB_DAMAGE, /* 1 */ BB_KILL, /* 2 */ BB_FLAME_TRAIL, @@ -29,24 +29,24 @@ typedef enum { /* 9 */ BB_GREEN } EnBbAction; -typedef enum { +typedef enum EnBbMoveMode { /* 0 */ BBMOVE_NORMAL, /* 1 */ BBMOVE_NOCLIP, /* 2 */ BBMOVE_HIDDEN } EnBbMoveMode; -typedef enum { +typedef enum EnBbBlueActionState { /* 0 */ BBBLUE_NORMAL, /* 1 */ BBBLUE_AGGRO } EnBbBlueActionState; -typedef enum { +typedef enum EnBbRedActionState { /* 0 */ BBRED_WAIT, /* 1 */ BBRED_ATTACK, /* 2 */ BBRED_HIDE } EnBbRedActionState; -typedef enum { +typedef enum EnBbGreenActionState { /* 0 */ BBGREEN_FLAME_ON, /* 1 */ BBGREEN_FLAME_OFF } EnBbGreenActionState; diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.h b/src/overlays/actors/ovl_En_Bb/z_en_bb.h index 3e3d9be467..9908690e06 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.h +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.h @@ -46,7 +46,7 @@ typedef struct EnBb { /* 0x0324 */ Actor* targetActor; } EnBb; // size = 0x0328 -typedef enum { +typedef enum EnBbType { ENBB_GREEN_BIG = -5, ENBB_GREEN, ENBB_WHITE, diff --git a/src/overlays/actors/ovl_En_Bili/z_en_bili.c b/src/overlays/actors/ovl_En_Bili/z_en_bili.c index 312d6172c1..5834f26b9a 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -62,7 +62,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 9, 28, -20, 30 }; -typedef enum { +typedef enum BiriDamageEffect { /* 0x0 */ BIRI_DMGEFF_NONE, /* 0x1 */ BIRI_DMGEFF_DEKUNUT, /* 0x2 */ BIRI_DMGEFF_FIRE, diff --git a/src/overlays/actors/ovl_En_Bili/z_en_bili.h b/src/overlays/actors/ovl_En_Bili/z_en_bili.h index eac275950f..0882a288c0 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.h +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.h @@ -8,7 +8,7 @@ struct EnBili; typedef void (*EnBiliActionFunc)(struct EnBili*, PlayState*); -typedef enum { +typedef enum EnBiliLimb { /* 0 */ EN_BILI_LIMB_NONE, /* 1 */ EN_BILI_LIMB_ROOT, /* 2 */ EN_BILI_LIMB_INNER_HOOD, @@ -29,7 +29,7 @@ typedef struct EnBili { /* 0x01D4 */ ColliderCylinder collider; } EnBili; // size = 0x0220 -typedef enum { +typedef enum EnBiliType { /* -1 */ EN_BILI_TYPE_NORMAL = -1, /* 0 */ EN_BILI_TYPE_VALI_SPAWNED, /* 1 */ EN_BILI_TYPE_DYING diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.h b/src/overlays/actors/ovl_En_Bom/z_en_bom.h index aebadfa064..df49b0ce1e 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.h +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.h @@ -20,7 +20,7 @@ typedef struct EnBom { /* 0x0204 */ EnBomActionFunc actionFunc; } EnBom; // size = 0x0208 -typedef enum { +typedef enum EnBomType { /* 0x00 */ BOMB_BODY, /* 0x01 */ BOMB_EXPLOSION } EnBomType; diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 0373fac491..441cbfdd8e 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -6,7 +6,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_27) -typedef enum { +typedef enum BombchuGirlEyeMode { /* 0 */ CHU_GIRL_EYES_ASLEEP, /* 1 */ CHU_GIRL_EYES_OPEN_SLOWLY, /* 2 */ CHU_GIRL_EYES_BLINK_RAPIDLY, diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h index 226dfebefb..14bc9c6ece 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h @@ -22,7 +22,7 @@ typedef struct EnBombf { /* 0x020C */ f32 flowerBombScale; } EnBombf; // size = 0x0210 -typedef enum { +typedef enum EnBombfType { /* 0xFFFF */ BOMBFLOWER_FLOWER = -1, /* 0x0000 */ BOMBFLOWER_BODY, /* 0x0001 */ BOMBFLOWER_EXPLOSION diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 19c922edc2..4e74c6fd31 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -30,7 +30,7 @@ when set, gets cleared next EnBox_Update call and clip to the floor */ #define ENBOX_MOVE_STICK_TO_GROUND (1 << 4) -typedef enum { +typedef enum EnBoxStateUnk1FB { ENBOX_STATE_0, // waiting for player near / player available / player ? (IDLE) ENBOX_STATE_1, // used only temporarily, maybe "player is ready" ? ENBOX_STATE_2 // waiting for something message context-related diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.h b/src/overlays/actors/ovl_En_Box/z_en_box.h index 6ab9b6c0fb..5dd3040c5f 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.h +++ b/src/overlays/actors/ovl_En_Box/z_en_box.h @@ -11,7 +11,7 @@ struct EnBox; typedef void (*EnBoxActionFunc)(struct EnBox*, PlayState*); -typedef enum { +typedef enum EnBoxType { /* only values 1-11 are used explicitly, other values (like 0) default to another separate behavior */ diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index e7a39c17cd..f0cf652eb3 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -61,7 +61,7 @@ ActorProfile En_Butte_Profile = { /**/ EnButte_Draw, }; -typedef struct { +typedef struct EnButteFlightParams { /* 0x00 */ s16 minTime; /* 0x02 */ s16 maxTime; /* 0x04 */ f32 speedXZTarget; diff --git a/src/overlays/actors/ovl_En_Bw/z_en_bw.h b/src/overlays/actors/ovl_En_Bw/z_en_bw.h index dfd70e440a..5f74f70c4d 100644 --- a/src/overlays/actors/ovl_En_Bw/z_en_bw.h +++ b/src/overlays/actors/ovl_En_Bw/z_en_bw.h @@ -7,7 +7,7 @@ struct EnBw; typedef void (*EnBwActionFunc)(struct EnBw*, PlayState*); -typedef enum { +typedef enum TorchSlugLimb { /* 0 */ TORCH_SLUG_LIMB_NONE, /* 1 */ TORCH_SLUG_LIMB_BODY, /* 2 */ TORCH_SLUG_LIMB_LEFT_EYESTALK_ROOT_ROOT, diff --git a/src/overlays/actors/ovl_En_Changer/z_en_changer.c b/src/overlays/actors/ovl_En_Changer/z_en_changer.c index 3f90555d7b..d473d3f585 100644 --- a/src/overlays/actors/ovl_En_Changer/z_en_changer.c +++ b/src/overlays/actors/ovl_En_Changer/z_en_changer.c @@ -11,7 +11,7 @@ #define FLAGS 0 -typedef enum { +typedef enum ChangerChestSide { /* 0 */ CHEST_LEFT, /* 1 */ CHEST_RIGHT } ChangerChestSide; diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h index b817cdc008..945a5462d6 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h @@ -6,13 +6,13 @@ struct EnClearTag; -typedef enum { +typedef enum ClearTagType { /* 0x00 */ CLEAR_TAG_CUTSCENE_ARWING = 0, /* 0x01 */ CLEAR_TAG_ARWING = 1, /* 0x64 */ CLEAR_TAG_LASER = 100 } ClearTagType; -typedef enum { +typedef enum ClearTagState { /* 0x00 */ CLEAR_TAG_STATE_FLYING = 0, /* 0x01 */ CLEAR_TAG_STATE_TARGET_LOCKED = 1, /* 0x02 */ CLEAR_TAG_STATE_DEMO = 2, @@ -20,19 +20,19 @@ typedef enum { /* 0x64 */ CLEAR_TAG_STATE_LASER = 100 } ClearTagState; -typedef enum { +typedef enum ClearTagDemoMode { /* 0x00 */ CLEAR_TAG_CUTSCENE_MODE_NONE, /* 0x01 */ CLEAR_TAG_CUTSCENE_MODE_SETUP, /* 0x02 */ CLEAR_TAG_CUTSCENE_MODE_PLAY } ClearTagDemoMode; -typedef enum { +typedef enum ClearTagDrawMode { /* 0x00 */ CLEAR_TAG_DRAW_MODE_ARWING, /* 0x01 */ CLEAR_TAG_DRAW_MODE_ALL, /* 0x02 */ CLEAR_TAG_DRAW_MODE_EFFECT } ClearTagDrawMode; -typedef enum { +typedef enum ClearTagEffectType { /* 0x00 */ CLEAR_TAG_EFFECT_AVAILABLE, /* 0x01 */ CLEAR_TAG_EFFECT_DEBRIS, /* 0x02 */ CLEAR_TAG_EFFECT_FIRE, @@ -40,7 +40,7 @@ typedef enum { /* 0x04 */ CLEAR_TAG_EFFECT_FLASH } ClearTagEffectType; -typedef enum { +typedef enum ClearTagTimers { /* 0x00 */ CLEAR_TAG_TIMER_ARWING_UPDATE_STATE = 0, /* 0x00 */ CLEAR_TAG_TIMER_LASER_DEATH = 0, /* 0x01 */ CLEAR_TAG_TIMER_ARWING_ENTER_LOCKED_ON, diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.h b/src/overlays/actors/ovl_En_Cow/z_en_cow.h index 145d937f68..cdec79fca8 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.h +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.h @@ -10,12 +10,12 @@ #define COW_GET_TYPE(thisx) ((thisx)->actor.params) -typedef enum { +typedef enum CowType { /* 0 */ COW_TYPE_BODY, /* 1 */ COW_TYPE_TAIL } CowType; -typedef enum { +typedef enum CowCollider { /* 0 */ COW_COLLIDER_FRONT, /* 1 */ COW_COLLIDER_REAR, /* 2 */ COW_COLLIDER_MAX diff --git a/src/overlays/actors/ovl_En_Cs/z_en_cs.c b/src/overlays/actors/ovl_En_Cs/z_en_cs.c index 89b3e859df..b12ec20f4f 100644 --- a/src/overlays/actors/ovl_En_Cs/z_en_cs.c +++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.c @@ -84,7 +84,7 @@ static DamageTable sDamageTable[] = { /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -typedef enum { +typedef enum EnCsAnimation { /* 0 */ ENCS_ANIM_0, /* 1 */ ENCS_ANIM_1, /* 2 */ ENCS_ANIM_2, diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index 6a497d3185..c590ea0d40 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -4,7 +4,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -typedef struct { +typedef struct EnDaikuEscapeSubCamParam { Vec3f eyePosDeltaLocal; s32 maxFramesActive; } EnDaikuEscapeSubCamParam; @@ -20,7 +20,7 @@ typedef struct { // the gerudo guard was defeated #define ENDAIKU_STATEFLAG_GERUDODEFEATED (1 << 4) -typedef enum { +typedef enum EnDaikuTalkState { /* 0 */ ENDAIKU_STATE_CAN_TALK, /* 2 */ ENDAIKU_STATE_TALKING = 2, /* 3 */ ENDAIKU_STATE_NO_TALK @@ -110,7 +110,7 @@ static DamageTable sDamageTable = { /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -typedef enum { +typedef enum EnDaikuAnimation { /* 0 */ ENDAIKU_ANIM_SHOUT, /* 1 */ ENDAIKU_ANIM_STAND, /* 2 */ ENDAIKU_ANIM_CELEBRATE, diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c index 787551cf77..1fc53f1adb 100644 --- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c +++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c @@ -9,7 +9,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -typedef enum { +typedef enum KakarikoCarpenterType { /* 0x0 */ CARPENTER_ICHIRO, // Red and purple pants, normal hair /* 0x1 */ CARPENTER_SABOORO, // Light blue pants /* 0x2 */ CARPENTER_JIRO, // Green pants @@ -93,7 +93,7 @@ static DamageTable sDamageTable = { /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -typedef enum { +typedef enum EnDaikuKakarikoAnimation { /* 0 */ ENDAIKUKAKARIKO_ANIM_0, /* 1 */ ENDAIKUKAKARIKO_ANIM_1, /* 2 */ ENDAIKUKAKARIKO_ANIM_2, diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index 11f2d0e94d..56f0b09c2f 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -136,7 +136,7 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit sColChkInfoInit = { 2, 25, 25, MASS_IMMOVABLE }; -typedef enum { +typedef enum DekuBabaDamageEffect { /* 0x0 */ DEKUBABA_DMGEFF_NONE, /* 0x1 */ DEKUBABA_DMGEFF_DEKUNUT, /* 0x2 */ DEKUBABA_DMGEFF_FIRE, diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h index b6e5243e95..b1d53307ce 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -8,7 +8,7 @@ struct EnDekubaba; typedef void (*EnDekubabaActionFunc)(struct EnDekubaba*, PlayState*); -typedef enum { +typedef enum DekuBabaType { /* 0 */ DEKUBABA_NORMAL, /* 1 */ DEKUBABA_BIG } DekuBabaType; diff --git a/src/overlays/actors/ovl_En_Dh/z_en_dh.c b/src/overlays/actors/ovl_En_Dh/z_en_dh.c index 8b973ff598..cbb0491339 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -3,7 +3,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_10) -typedef enum { +typedef enum EnDhAction { /* 0 */ DH_WAIT, /* 1 */ DH_RETREAT, /* 2 */ DH_BURROW, diff --git a/src/overlays/actors/ovl_En_Dh/z_en_dh.h b/src/overlays/actors/ovl_En_Dh/z_en_dh.h index afe0ffddea..21872aafce 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.h +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.h @@ -32,7 +32,7 @@ typedef struct EnDh { /* 0x0320 */ f32 dirtWaveAlpha; } EnDh; // size = 0x0324 -typedef enum { +typedef enum EnDhParams { ENDH_HANDS_KILLED_4 = -4, ENDH_HANDS_KILLED_3, ENDH_HANDS_KILLED_2, diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h index 177111b16b..c873e075e3 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h @@ -49,13 +49,13 @@ typedef struct EnDivingGame { /* 0x034C */ ColliderCylinder collider; } EnDivingGame; // size = 0x0398 -typedef enum { +typedef enum EnDivingGamePhase { /* 0 */ ENDIVINGGAME_PHASE_ENDED, /* 1 */ ENDIVINGGAME_PHASE_1, // Player has not received the scale. /* 2 */ ENDIVINGGAME_PHASE_2 // Player got the scale and there are 10 rupees thrown. } EnDivingGamePhase; -typedef enum { +typedef enum EnDivingGameState { /* 0 */ ENDIVINGGAME_STATE_NOTPLAYING, /* 1 */ ENDIVINGGAME_STATE_AWARDPRIZE, // Waiting to give the scale to player. /* 2 */ ENDIVINGGAME_STATE_PLAYING diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.h b/src/overlays/actors/ovl_En_Dns/z_en_dns.h index a6ef632230..d86e96eb43 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.h +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.h @@ -7,7 +7,7 @@ #define DNS_GET_TYPE(thisx) ((thisx)->params) -typedef enum { +typedef enum EnDnsType { /* 0 */ DNS_TYPE_DEKU_NUTS_5, /* 1 */ DNS_TYPE_DEKU_STICKS_1, /* 2 */ DNS_TYPE_HEART_PIECE, @@ -21,7 +21,7 @@ typedef enum { /* 10 */ DNS_TYPE_DEKU_NUT_UPGRADE } EnDnsType; -typedef enum { +typedef enum EnDnsCanBuyResult { /* 0 */ DNS_CANBUY_RESULT_NEED_RUPEES, /* 1 */ DNS_CANBUY_RESULT_CAPACITY_FULL, /* 2 */ DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM, @@ -29,7 +29,7 @@ typedef enum { /* 4 */ DNS_CANBUY_RESULT_SUCCESS } EnDnsCanBuyResult; -typedef enum { +typedef enum EnDnsAnimation { /* 0 */ DNS_ANIM_IDLE, /* 1 */ DNS_ANIM_BURROW, /* 2 */ DNS_ANIM_IDLE_TRANSITION @@ -41,7 +41,7 @@ typedef void (*EnDnsActionFunc)(struct EnDns*, PlayState*); typedef u32 (*EnDnsCanBuyFunc)(struct EnDns*); typedef void (*EnDnsPaymentFunc)(struct EnDns*); -typedef struct { +typedef struct DnsItemEntry { /* 0x00 */ s16 itemPrice; /* 0x02 */ u16 itemAmount; /* 0x04 */ s32 getItemId; diff --git a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c index f4f708959d..e2af5e3d84 100644 --- a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c +++ b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c @@ -12,7 +12,7 @@ #define FLAGS 0 -typedef enum { +typedef enum EnDntDemoResults { /* 0 */ DNT_LIKE, /* 1 */ DNT_HATE, /* 2 */ DNT_LOVE diff --git a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h index 4349a972ea..607810629c 100644 --- a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h +++ b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h @@ -25,7 +25,7 @@ typedef struct EnDntDemo { /* 0x01FC */ struct EnDntJiji* leader; } EnDntDemo; // size = 0x0200 -typedef enum { +typedef enum EnDntSignal { /* 0 */ DNT_SIGNAL_NONE, /* 1 */ DNT_SIGNAL_LOOK, /* 2 */ DNT_SIGNAL_CELEBRATE, @@ -35,27 +35,27 @@ typedef enum { /* 6 */ DNT_SIGNAL_UNUSED } EnDntSignal; -typedef enum { +typedef enum EnDntLeaderAction { /* 0 */ DNT_LEADER_ACTION_NONE, /* 1 */ DNT_LEADER_ACTION_UP, /* 2 */ DNT_LEADER_ACTION_UNUSED, /* 3 */ DNT_LEADER_ACTION_ATTACK } EnDntLeaderAction; -typedef enum { +typedef enum EnDntLeaderSignal { /* 0 */ DNT_LEADER_SIGNAL_NONE, /* 1 */ DNT_LEADER_SIGNAL_UP, /* 2 */ DNT_LEADER_SIGNAL_BURROW, /* 3 */ DNT_LEADER_SIGNAL_RETURN } EnDntLeaderSignal; -typedef enum { +typedef enum EnDntPrize { /* 0 */ DNT_PRIZE_NONE, /* 1 */ DNT_PRIZE_NUTS, /* 2 */ DNT_PRIZE_STICK } EnDntPrize; -typedef enum { +typedef enum EnDntAction { /* 0 */ DNT_ACTION_NONE, /* 1 */ DNT_ACTION_DANCE, /* 2 */ DNT_ACTION_ATTACK, diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index 8f30f194ae..cf5768f351 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -5,7 +5,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -typedef enum { +typedef enum EnDodongoActionState { DODONGO_SWEEP_TAIL, DODONGO_SWALLOW_BOMB, DODONGO_DEATH, diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h index f29c644eba..664b175799 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h @@ -39,7 +39,7 @@ typedef struct EnDodongo { /* 0x05A8 */ ColliderJntSphElement sphElements[6]; } EnDodongo; // size = 0x0728 -typedef enum { +typedef enum EnDodongoParam { EN_DODONGO_NORMAL = -1, EN_DODONGO_SMOKE_DEATH } EnDodongoParam; diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/src/overlays/actors/ovl_En_Dog/z_en_dog.c index 6735211ced..b9d4129e5c 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -55,7 +55,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, 50 }; -typedef enum { +typedef enum EnDogAnimation { /* 0 */ ENDOG_ANIM_0, /* 1 */ ENDOG_ANIM_1, /* 2 */ ENDOG_ANIM_2, @@ -77,7 +77,7 @@ static AnimationInfo sAnimationInfo[] = { { &gDogBow2Anim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -6.0f }, }; -typedef enum { +typedef enum DogBehavior { /* 0x00 */ DOG_WALK, /* 0x01 */ DOG_RUN, /* 0x02 */ DOG_BARK, diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 08bb8cfde4..294918cfc7 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -44,13 +44,13 @@ ActorProfile En_Door_Profile = { /**/ EnDoor_Draw, }; -typedef struct { +typedef struct EnDoorInfo { /* 0x00 */ s16 sceneId; /* 0x02 */ u8 dListIndex; /* 0x04 */ s16 objectId; } EnDoorInfo; -typedef enum { +typedef enum EnDoorDListIndex { /* 0 */ DOOR_DL_DEFAULT, /* 1 */ DOOR_DL_FIRE_TEMPLE, /* 2 */ DOOR_DL_WATER_TEMPLE, diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.h b/src/overlays/actors/ovl_En_Door/z_en_door.h index 58ff784ee5..11ab5a5aa2 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.h +++ b/src/overlays/actors/ovl_En_Door/z_en_door.h @@ -31,7 +31,7 @@ #define ENDOOR_GET_CHECKABLE_TEXT_ID(thisx) ((thisx)->params & 0x3F) -typedef enum { +typedef enum EnDoorType { /* 0x00 */ DOOR_ROOMLOAD, // loads rooms /* 0x01 */ DOOR_LOCKED, // small key locked door /* 0x02 */ DOOR_ROOMLOAD2, // loads rooms diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index 4181108b75..123442317b 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -56,7 +56,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -typedef enum { +typedef enum EnDuAnimation { /* 0 */ ENDU_ANIM_0, /* 1 */ ENDU_ANIM_1, /* 2 */ ENDU_ANIM_2, diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 1beda793a1..b0f49228be 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -80,7 +80,7 @@ static Color_RGBAf sOuterColors[] = { { 255.0f, 50.0f, 100.0f, 255.0f }, }; -typedef struct { +typedef struct FairyColorFlags { u8 r, g, b; } FairyColorFlags; diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.h b/src/overlays/actors/ovl_En_Elf/z_en_elf.h index cc2bfd3961..106e3a5580 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.h +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.h @@ -44,7 +44,7 @@ typedef struct EnElf { /* 0x02CC */ EnElfActionFunc actionFunc; } EnElf; // size = 0x02D0 -typedef enum { +typedef enum FairyType { /* 0x00 */ FAIRY_NAVI, /* 0x01 */ FAIRY_REVIVE_BOTTLE, /* 0x02 */ FAIRY_HEAL_TIMED, diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h index efd770f266..2dc033f98c 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h @@ -30,7 +30,7 @@ typedef struct EnEncount1 { /* 0x016C */ EnReeba* bigLeever; } EnEncount1; // size = 0x0170 -typedef enum { +typedef enum EnEncount1type { /* 0 */ SPAWNER_LEEVER, /* 1 */ SPAWNER_TEKTITE, /* 2 */ SPAWNER_STALCHILDREN, diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index 4ad684fa82..f4b95fab40 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -6,7 +6,7 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -typedef enum { +typedef enum Encount2State { /* 0x0 */ ENCOUNT2_INACTIVE, /* 0x1 */ ENCOUNT2_ACTIVE_DEATH_MOUNTAIN, /* 0x2 */ ENCOUNT2_ACTIVE_GANONS_TOWER diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h index 7141abd17d..c3e0a0655e 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h @@ -10,7 +10,7 @@ typedef void (*EnEncount2ActionFunc)(struct EnEncount2*, PlayState*); #define EN_ENCOUNT2_EFFECT_COUNT 50 -typedef struct { +typedef struct EnEncount2Effect { /* 0x0000 */ Vec3f pos; /* 0x000C */ f32 scale; /* 0x0010 */ u8 isAlive; diff --git a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h index 6c6ff404a7..897826146c 100644 --- a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h +++ b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h @@ -29,7 +29,7 @@ typedef struct EnExItem { /* 0x0180 */ EnExItemLightFunc unk_180; } EnExItem; // size = 0x0184 -typedef enum { +typedef enum EnExItemType { /* 0 */ EXITEM_BOMB_BAG_BOWLING, /* 1 */ EXITEM_HEART_PIECE_BOWLING, /* 2 */ EXITEM_BOMBCHUS_BOWLING, diff --git a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c index 86d7d65ee1..0704ac3de1 100644 --- a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c +++ b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c @@ -302,7 +302,7 @@ void EnExRuppy_Kill(EnExRuppy* this, PlayState* play) { } } -typedef struct { +typedef struct EnExRuppyParentActor { /* 0x000 */ Actor actor; /* 0x14C */ char unk_14C[0x11A]; /* 0x226 */ s16 unk_226; diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index a74a3d5944..86e3f7018b 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -192,7 +192,7 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit2 sColChkInit = { 24, 2, 25, 25, MASS_IMMOVABLE }; -typedef enum { +typedef enum EnFdAnimation { /* 0 */ ENFD_ANIM_0, /* 1 */ ENFD_ANIM_1, /* 2 */ ENFD_ANIM_2, diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.h b/src/overlays/actors/ovl_En_Fd/z_en_fd.h index 8f7f831709..3559410526 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.h +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.h @@ -8,7 +8,7 @@ struct EnFd; typedef void (*EnFdActionFunc)(struct EnFd* this, PlayState* play); -typedef enum { +typedef enum FDEffectType { FD_EFFECT_NONE, FD_EFFECT_FLAME, FD_EFFECT_DOT @@ -16,7 +16,7 @@ typedef enum { #define EN_FD_EFFECT_COUNT 200 -typedef struct { +typedef struct EnFdEffect { /* 0x0000 */ u8 type; /* 0x0001 */ u8 timer; /* 0x0002 */ u8 initialTimer; diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index 55fc46789a..05d934e0a2 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -13,19 +13,19 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -typedef enum { +typedef enum StrikeMode { /* 0 */ STRIKE_INIT, /* 10 */ STRIKE_BURST = 10, /* 11 */ STRIKE_TRAILS } StrikeMode; -typedef enum { +typedef enum TrailMode { /* 0 */ TRAIL_INIT, /* 1 */ TRAIL_APPEAR, /* 2 */ TRAIL_DISSIPATE } TrailMode; -typedef enum { +typedef enum BallKillMode { /* 0 */ BALL_FIZZLE, /* 1 */ BALL_BURST, /* 2 */ BALL_IMPACT diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h index 2f43770770..ac2682aaf1 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h @@ -8,7 +8,7 @@ struct EnFhgFire; typedef void (*EnFhgFireUpdateFunc)(struct EnFhgFire*, PlayState*); -typedef enum { +typedef enum FhgFireParam { /* 1 */ FHGFIRE_LIGHTNING_STRIKE = 1, /* 35 */ FHGFIRE_LIGHTNING_SHOCK = 35, /* 36 */ FHGFIRE_LIGHTNING_BURST, @@ -20,13 +20,13 @@ typedef enum { /* 100 */ FHGFIRE_LIGHTNING_TRAIL = 100 } FhgFireParam; -typedef enum { +typedef enum FhgLightMode { /* 0 */ FHGFIRE_LIGHT_GREEN, /* 1 */ FHGFIRE_LIGHT_BLUE, /* 2 */ FHGFIRE_LIGHT_REFLECT } FhgLightMode; -typedef enum { +typedef enum FhgFireS16Var { /* 0 */ FHGFIRE_TIMER, /* 1 */ FHGFIRE_FX_TIMER, /* 2 */ FHGFIRE_US_2, @@ -37,7 +37,7 @@ typedef enum { /* 7 */ FHGFIRE_SHORT_COUNT } FhgFireS16Var; -typedef enum { +typedef enum FhgFireF32Var { /* 0 */ FHGFIRE_ALPHA, /* 1 */ FHGFIRE_UF_1, /* 2 */ FHGFIRE_UF_2, diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h index 3530cecb75..6e387bdb39 100644 --- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h +++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h @@ -6,7 +6,7 @@ #include "overlays/actors/ovl_En_Encount2/z_en_encount2.h" -typedef enum { +typedef enum EnFireRockType { /* 0x00 */ FIRE_ROCK_SPAWNED_FALLING1, /* 0x01 */ FIRE_ROCK_BROKEN_PIECE1, /* 0x02 */ FIRE_ROCK_BROKEN_PIECE2, diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 344943544e..b77c6d2710 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -28,7 +28,7 @@ void EnFirefly_FrozenFall(EnFirefly* this, PlayState* play); void EnFirefly_Perch(EnFirefly* this, PlayState* play); void EnFirefly_DisturbDiveAttack(EnFirefly* this, PlayState* play); -typedef enum { +typedef enum KeeseAuraType { /* 0 */ KEESE_AURA_NONE, /* 1 */ KEESE_AURA_FIRE, /* 2 */ KEESE_AURA_ICE diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h index 862779e189..165cc5c26e 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h @@ -24,7 +24,7 @@ typedef struct EnFirefly { /* 0x0344 */ ColliderJntSphElement colliderItems[1]; } EnFirefly; // size = 0x0374 -typedef enum { +typedef enum KeeseType { /* 0 */ KEESE_FIRE_FLY, /* 1 */ KEESE_FIRE_PERCH, /* 2 */ KEESE_NORMAL_FLY, diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.h b/src/overlays/actors/ovl_En_Fish/z_en_fish.h index 7169077b58..001d161766 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -23,7 +23,7 @@ typedef struct EnFish { /* 0x0250 */ s32 unk_250; // Set to 0 or 5, arg5 of Actor_UpdateBgCheckInfo } EnFish; // size = 0x0254 -typedef enum { +typedef enum EnFishType { /* -1 */ FISH_SWIMMING_RESPAWNING = -1, // Used in Zora's Domain; code only uses not 0 or 1, runs away from Player /* 0 */ FISH_DROPPED, /* 1 */ FISH_SWIMMING_UNIQUE // Used in grottos diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 773731261d..cf94fd7025 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -83,12 +83,12 @@ sEnFrPointers.flags = 12 - Deactivate frogs, frogs will jump back into the water */ -typedef struct { +typedef struct EnFrPointers { u8 flags; EnFr* frogs[5]; } EnFrPointers; -typedef struct { +typedef struct LogSpotToFromWater { f32 xzDist; f32 yaw; f32 yDist; diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.h b/src/overlays/actors/ovl_En_Fr/z_en_fr.h index 2bd6fa41a9..95a365dd9b 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.h +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.h @@ -9,7 +9,7 @@ struct EnFr; typedef void (*EnFrActionFunc)(struct EnFr*, PlayState*); typedef void (*EnFrBlinkFunc)(struct EnFr*); -typedef enum { +typedef enum FrogType { /* 0 */ FROG_YELLOW, // Middle /* 1 */ FROG_BLUE, // Front Left /* 2 */ FROG_RED, // Front Right @@ -17,7 +17,7 @@ typedef enum { /* 4 */ FROG_WHITE // Back Right } FrogType; -typedef enum { +typedef enum FrogSongType { /* 0 */ FROG_ZL, /* 1 */ FROG_EPONA, /* 2 */ FROG_SARIA, diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 40457c98d5..434b924084 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -66,7 +66,7 @@ static Vec3f sMtxSrc = { 0.0f, }; -typedef enum { +typedef enum EnFuFace { /* 0x00 */ FU_FACE_CALM, /* 0x01 */ FU_FACE_MAD } EnFuFace; diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.h b/src/overlays/actors/ovl_En_Fu/z_en_fu.h index f8135e64c4..dbbcacfc54 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.h +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.h @@ -8,7 +8,7 @@ struct EnFu; typedef void (*EnFuActionFunc)(struct EnFu*, PlayState*); -typedef enum { +typedef enum EnFuLimb { /* 0x00 */ FU_LIMB_ROOT, /* 0x01 */ FU_LIMB_TORSO, /* 0x02 */ FU_LIMB_LEFT_THIGH, diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/src/overlays/actors/ovl_En_Fw/z_en_fw.c index 5f8768ff10..fbe16442c8 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -65,7 +65,7 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit2 D_80A1FB94 = { 8, 2, 25, 25, MASS_IMMOVABLE }; -typedef enum { +typedef enum EnFwAnimation { /* 0 */ ENFW_ANIM_0, /* 1 */ ENFW_ANIM_1, /* 2 */ ENFW_ANIM_2 diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.h b/src/overlays/actors/ovl_En_Fw/z_en_fw.h index 79ccf12d9c..7940a98157 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.h +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.h @@ -10,7 +10,7 @@ typedef void (*EnFwActionFunc)(struct EnFw* this, PlayState* play); #define EN_FW_EFFECT_COUNT 20 -typedef struct { +typedef struct EnFwEffect { /* 0x0000 */ u8 type; /* 0x0001 */ u8 timer; /* 0x0002 */ u8 initialTimer; diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.h b/src/overlays/actors/ovl_En_Fz/z_en_fz.h index dafada3d25..a7fa2d7134 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.h +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.h @@ -9,7 +9,7 @@ struct EnFz; typedef void (*EnFzActionFunc)(struct EnFz*, PlayState*); typedef void (*EnFzSpawnIceSmokeFunc)(struct EnFz*); -typedef struct { +typedef struct EnFzEffect { /* 0x0000 */ u8 type; // 0,1,2: State of freezard (1 not freezing, 2 freezing) /* 0x0001 */ u8 timer; // increments primAlphaState after reaching 7 (freezing), used in Gfx_TwoTexScroll /* 0x0004 */ Vec3f pos; // Random position within 20.0f of actor diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index 9ebf1c4013..594ed758af 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -14,7 +14,7 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -typedef enum { +typedef enum GSwitchMoveState { /* 0 */ MOVE_TARGET, /* 1 */ MOVE_HOME } GSwitchMoveState; diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h index 3631d11704..58e19ea9c1 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h @@ -8,7 +8,7 @@ struct EnGSwitch; typedef void (*EnGSwitchActionFunc)(struct EnGSwitch*, PlayState*); -typedef enum { +typedef enum EnGSwitchMoveMode { /* 0 */ GSWITCH_NONE, /* 1 */ GSWITCH_APPEAR, /* 2 */ GSWITCH_THROW, @@ -17,7 +17,7 @@ typedef enum { /* 5 */ GSWITCH_RIGHT } EnGSwitchMoveMode; -typedef enum { +typedef enum EnGSwitchType { /* 0 */ ENGSWITCH_SILVER_TRACKER, /* 1 */ ENGSWITCH_SILVER_RUPEE, /* 2 */ ENGSWITCH_ARCHERY_POT, @@ -26,7 +26,7 @@ typedef enum { #define EN_GSWITCH_EFFECT_COUNT 100 -typedef struct { +typedef struct EnGSwitchEffect { /* 0x00 */ Vec3f pos; /* 0x0C */ s16 scale; /* 0x0E */ s16 timer; diff --git a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c index b76e89ece2..1b106d6726 100644 --- a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c +++ b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c @@ -38,7 +38,7 @@ static s16 sTearSizesSmall[] = { 0, 0, 0, 0, 0, 0, 0, }; -typedef struct { +typedef struct TearShape { s16* tearAreaSizes; s16 count; } TearShape; // size = 0x8 diff --git a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.h b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.h index 3b416e59eb..f319bfbf83 100644 --- a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.h +++ b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.h @@ -9,7 +9,7 @@ struct EnGanonMant; #define GANON_MANT_NUM_JOINTS 12 #define GANON_MANT_NUM_STRANDS 12 -typedef struct { +typedef struct MantStrand { /* 0x000 */ Vec3f root; // root position along the collar /* 0x00C */ Vec3f joints[GANON_MANT_NUM_JOINTS]; // "joints" for deforming the cloak, stemming from root and propagating down the cloak /* 0x090 */ Vec3f rotations[GANON_MANT_NUM_JOINTS]; // normal vector rotations, x and y only diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.h b/src/overlays/actors/ovl_En_Gb/z_en_gb.h index 99694a59e9..4005075c4c 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.h +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.h @@ -8,14 +8,14 @@ struct EnGb; typedef void (*EnGbActionFunc)(struct EnGb*, PlayState*); -typedef struct { +typedef struct EnGbCagedSoulInfo { /* 0x00 */ Color_RGBA8 prim; /* 0x04 */ Color_RGBA8 env; /* 0x08 */ void* texture; /* 0x0C */ s16 timerMultiplier; } EnGbCagedSoulInfo; // size = 0x10 -typedef struct { +typedef struct EnGbCagedSoul { /* 0x00 */ u8 infoIdx; /* 0x01 */ u8 unk_1; /* 0x02 */ u8 unk_2; diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index de56141d4e..5379f11ed5 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -15,7 +15,7 @@ #define GE1_STATE_IDLE_ANIM (1 << 2) #define GE1_STATE_STOP_FIDGET (1 << 3) -typedef enum { +typedef enum EnGe1Hairstyle { /* 00 */ GE1_HAIR_BOB, /* 01 */ GE1_HAIR_STRAIGHT, /* 02 */ GE1_HAIR_SPIKY diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h index f286ce3146..7fb1692f62 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h @@ -9,7 +9,7 @@ struct EnGe1; typedef void (*EnGe1AnimFunc)(struct EnGe1*); typedef void (*EnGe1ActionFunc)(struct EnGe1*, PlayState*); -typedef enum { +typedef enum EnGe1Type { /* 0x00 */ GE1_TYPE_GATE_GUARD, /* 0x01 */ GE1_TYPE_GATE_OPERATOR, /* 0x04 */ GE1_TYPE_NORMAL = 4, @@ -18,7 +18,7 @@ typedef enum { /* 0x46 */ GE1_TYPE_TRAINING_GROUNDS_GUARD } EnGe1Type; -typedef enum { +typedef enum EnGe1Limb { /* 00 */ GE1_LIMB_NONE, /* 01 */ GE1_LIMB_WAIST, /* 02 */ GE1_LIMB_L_THIGH, diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 3b5b8bea7d..7818f4d8dd 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -15,13 +15,13 @@ #define GE2_STATE_CAPTURING (1 << 3) #define GE2_STATE_TALKED (1 << 4) -typedef enum { +typedef enum EnGe2Type { /* 0 */ GE2_TYPE_PATROLLING, /* 1 */ GE2_TYPE_STATIONARY, /* 2 */ GE2_TYPE_GERUDO_CARD_GIVER } EnGe2Type; -typedef enum { +typedef enum EnGe2Action { /* 0 */ GE2_ACTION_WALK, /* 1 */ GE2_ACTION_ABOUTTURN, /* 2 */ GE2_ACTION_TURNPLAYERSPOTTED, diff --git a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c index ea99032f46..bc1eff34bf 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -9,7 +9,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -typedef enum { +typedef enum EnGeldBAction { /* 0 */ GELDB_WAIT, /* 1 */ GELDB_DEFEAT, /* 2 */ GELDB_DAMAGED, @@ -159,7 +159,7 @@ static ColliderQuadInit sSwordQuadInit = { { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -typedef enum { +typedef enum EnGeldBDamageEffects { /* 0x0 */ GELDB_DMG_NORMAL, /* 0x1 */ GELDB_DMG_STUN, /* 0x6 */ GELDB_DMG_UNK_6 = 0x6, diff --git a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h index 149f8ac0aa..8ca9f1ac6a 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h @@ -6,7 +6,7 @@ struct EnGeldB; -typedef enum { +typedef enum EnGeldBLimb { /* 0x00 */ GELDB_LIMB_NONE, /* 0x01 */ GELDB_LIMB_ROOT, /* 0x02 */ GELDB_LIMB_TORSO, diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 7abec67e2b..2426fdd174 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -141,7 +141,7 @@ static s16 sMaskShopItems[8] = { static u16 sMaskShopFreeToBorrowTextIds[5] = { 0x70B6, 0x70B5, 0x70B4, 0x70B7, 0x70BB }; -typedef struct { +typedef struct ShopItemEntry { /* 0x00 */ s16 objID; /* 0x02 */ s16 giDrawId; /* 0x04 */ void (*hiliteFunc)(Actor*, PlayState*, s32); diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.h b/src/overlays/actors/ovl_En_GirlA/z_en_girla.h index 65725c5c1e..971d0109c4 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.h +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.h @@ -35,7 +35,7 @@ typedef struct EnGirlA { /* 0x01D0 */ EnGirlA3Func hiliteFunc; } EnGirlA; // size = 0x01D4 -typedef enum { +typedef enum EnGirlAShopItem { /* 0x00 */ SI_DEKU_NUTS_5, /* 0x01 */ SI_ARROWS_30, /* 0x02 */ SI_ARROWS_50, @@ -89,7 +89,7 @@ typedef enum { /* 0x32 */ SI_MAX } EnGirlAShopItem; -typedef enum { +typedef enum EnGirlACanBuyResult { /* 0 */ CANBUY_RESULT_SUCCESS_FANFARE, /* 1 */ CANBUY_RESULT_SUCCESS, /* 2 */ CANBUY_RESULT_CANT_GET_NOW, diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index ec34f6db06..e9f3cbf303 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -68,7 +68,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -typedef enum { +typedef enum EnGoAnimation { /* 0 */ ENGO_ANIM_0, /* 1 */ ENGO_ANIM_1, /* 2 */ ENGO_ANIM_2, diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index e18efcf811..b769cff78f 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -25,7 +25,7 @@ typedef s16 (*callback2_80A3ED24)(PlayState*, struct EnGo*); #define EN_GO_EFFECT_COUNT 20 -typedef struct { +typedef struct EnGoEffect { /* 0x0000 */ u8 type; /* 0x0001 */ u8 timer; /* 0x0002 */ u8 initialTimer; diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 2f1f4f3126..a99f0cc0e1 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -125,7 +125,7 @@ static f32 sPlayerTrackingYOffsets[14][2] = { { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, }; -typedef enum { +typedef enum EnGo2Animation { /* 0 */ ENGO2_ANIM_0, /* 1 */ ENGO2_ANIM_1, /* 2 */ ENGO2_ANIM_2, diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index e152841366..9651f6bfeb 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -9,7 +9,7 @@ struct EnGo2; typedef void (*EnGo2ActionFunc)(struct EnGo2*, PlayState*); -typedef enum { +typedef enum GoronType { /* 0x00 */ GORON_CITY_ROLLING_BIG, /* 0x01 */ GORON_CITY_LINK, /* 0x02 */ GORON_DMT_BIGGORON, @@ -41,7 +41,7 @@ typedef enum { // /* 0x0B */ GORON_FIRE_HIGHEST -typedef struct { +typedef struct EnGo2DataStruct1 { s16 unused; s16 yDist; s16 xzDist; @@ -49,14 +49,14 @@ typedef struct { s16 height; } EnGo2DataStruct1; // size = 0xA -typedef struct { +typedef struct EnGo2DataStruct2 { f32 shape_unk_10; f32 scale; s8 actor_unk_1F; f32 interactRange; } EnGo2DataStruct2; // size = 0x10 -typedef struct { +typedef struct EnGo2DustEffectData { u8 initialTimer; f32 scale; f32 scaleStep; diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.h b/src/overlays/actors/ovl_En_Goma/z_en_goma.h index b04162acad..a0a97f20fb 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.h +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef enum { +typedef enum GomaType { /* 0 */ ENGOMA_NORMAL, /* 1 */ ENGOMA_EGG, /* 2 */ ENGOMA_HATCH_DEBRIS, @@ -15,7 +15,7 @@ struct EnGoma; typedef void (*EnGomaActionFunc)(struct EnGoma*, PlayState*); -typedef enum { +typedef enum EnGomaLimb { /* 0 */ GOMA_LIMB_NONE, /* 1 */ GOMA_LIMB_ROOT1, /* 2 */ GOMA_LIMB_ROOT2, diff --git a/src/overlays/actors/ovl_En_Hata/z_en_hata.h b/src/overlays/actors/ovl_En_Hata/z_en_hata.h index f208b1e019..e098bcaab3 100644 --- a/src/overlays/actors/ovl_En_Hata/z_en_hata.h +++ b/src/overlays/actors/ovl_En_Hata/z_en_hata.h @@ -5,7 +5,7 @@ #include "global.h" -typedef enum { +typedef enum EnHataLimb { /* 0x00 */ FLAGPOLE_LIMB_NONE, /* 0x01 */ FLAGPOLE_LIMB_POLE_BASE, /* 0x02 */ FLAGPOLE_LIMB_POLE, @@ -30,7 +30,7 @@ typedef enum { /* 0x15 */ FLAGPOLE_LIMB_MAX } EnHataLimb; -typedef struct { +typedef struct EnHata { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ SkelAnime skelAnime; /* 0x01A8 */ ColliderCylinder collider; // Unused, but indicated by the form of the unused data diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h index 0bc2fc99d4..48e09ca458 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef enum { +typedef enum Heishi4Type { /* 0x00 */ HEISHI4_AT_KAKARIKO_ENTRANCE, /* 0x04 */ HEISHI4_AT_IMPAS_HOUSE = 4, /* 0x07 */ HEISHI4_AT_MARKET_DYING = 7, diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.h b/src/overlays/actors/ovl_En_Holl/z_en_holl.h index cbc4ddb39e..cbff846479 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.h +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.h @@ -23,7 +23,7 @@ * Bg Cover: The background geometry (e.g. room geometry but not actors) fades black as the player approaches. * Invisible: Approaching the holl does not cause any particular visual effect. */ -typedef enum { +typedef enum EnHollType { /* 0 */ ENHOLL_H_VISIBLE_NARROW, /* 1 */ ENHOLL_V_DOWN_BGCOVER_LARGE, // Only allows downwards transitions. 500 units radius. Used in fire temple drops. /* 2 */ ENHOLL_V_INVISIBLE, diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c index d9a689a882..9a3e6d35d0 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -14,7 +14,7 @@ #define HONOTRAP_AC_ACTIVE (1 << 1) #define HONOTRAP_OC_ACTIVE (1 << 2) -typedef enum { +typedef enum EnHonotrapEyeState { /* 0 */ HONOTRAP_EYE_OPEN, /* 1 */ HONOTRAP_EYE_HALF, /* 2 */ HONOTRAP_EYE_CLOSE, diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h index f9e3908bfe..f1b085686c 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h @@ -8,7 +8,7 @@ struct EnHonotrap; typedef void (*EnHonotrapActionFunc)(struct EnHonotrap*, PlayState*); -typedef union { +typedef union EnHonotrapCollider { struct { /* 0x00 */ ColliderTris tris; /* 0x20 */ ColliderTrisElement elements[2]; @@ -29,7 +29,7 @@ typedef struct EnHonotrap { /* 0x0240 */ u8 colChkFlags; } EnHonotrap; // size = 0x0244 -typedef enum { +typedef enum EnHonotrapType { HONOTRAP_TYPE_EYE, HONOTRAP_TYPE_FLAME_MOVE, HONOTRAP_TYPE_FLAME_DROP diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 37df3828ac..6afed872d9 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -147,7 +147,7 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit D_80A65F38 = { 10, 35, 100, MASS_HEAVY }; -typedef struct { +typedef struct EnHorseSpawnpoint { /* 0x0 */ s16 sceneId; /* 0x2 */ Vec3s pos; /* 0x8 */ s16 angle; @@ -329,7 +329,7 @@ static EnHorseSpawnpoint sHorseSpawns[] = { { SCENE_LON_LON_RANCH, 907, 0, -2336, 0 }, }; -typedef struct { +typedef struct BridgeJumpPoint { /* 0x00 */ s16 zMin; /* 0x02 */ s16 zMax; /* 0x04 */ s16 xMin; @@ -345,7 +345,7 @@ static BridgeJumpPoint sBridgeJumps[] = { { -195, -40, -240, -120, -360, 0x4000, 0x7D0, 270, -52, -117 }, }; -typedef struct { +typedef struct RaceWaypoint { /* 0x0 */ s16 x; /* 0x2 */ s16 y; /* 0x4 */ s16 z; @@ -353,7 +353,7 @@ typedef struct { /* 0x8 */ s16 angle; } RaceWaypoint; // size = 0xA -typedef struct { +typedef struct RaceInfo { /* 0x0 */ s32 numWaypoints; /* 0x4 */ RaceWaypoint* waypoints; } RaceInfo; // size = 0x8 @@ -403,7 +403,7 @@ static EnHorseCsFunc sCutsceneActionFuncs[] = { NULL, EnHorse_CsMoveToPoint, EnHorse_CsJump, EnHorse_CsRearing, EnHorse_CsWarpMoveToPoint, EnHorse_CsWarpRearing, }; -typedef struct { +typedef struct CsActionEntry { /* 0x0 */ s32 cueId; /* 0x4 */ s32 csFuncIdx; } CsActionEntry; // size = 0x8 diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.h b/src/overlays/actors/ovl_En_Horse/z_en_horse.h index 785ddc8a9e..a0618973a0 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.h +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef enum { +typedef enum EnHorseAction { /* 0 */ ENHORSE_ACT_FROZEN, /* 1 */ ENHORSE_ACT_INACTIVE, /* 2 */ ENHORSE_ACT_IDLE, @@ -63,7 +63,7 @@ typedef enum { struct EnHorse; -typedef enum { +typedef enum EnHorsePlayerDir { /* 0 */ PLAYER_DIR_FRONT_R, /* 1 */ PLAYER_DIR_FRONT_L, /* 2 */ PLAYER_DIR_BACK_R, @@ -72,7 +72,7 @@ typedef enum { /* 5 */ PLAYER_DIR_SIDE_L } EnHorsePlayerDir; -typedef enum { +typedef enum EnHorseAnimationIndex { /* 0 */ ENHORSE_ANIM_IDLE, /* 1 */ ENHORSE_ANIM_WHINNEY, /* 2 */ ENHORSE_ANIM_STOPPING, @@ -84,7 +84,7 @@ typedef enum { /* 8 */ ENHORSE_ANIM_HIGH_JUMP } EnHorseAnimationIndex; -typedef enum { +typedef enum HorseType { /* 0 */ HORSE_EPONA, /* 1 */ HORSE_HNI } HorseType; diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index 155227b1fe..25683388aa 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -20,7 +20,7 @@ #define INGORACE_SET_TIMER (1 << 1) #define INGORACE_INGO_MOVE (1 << 2) -typedef enum { +typedef enum HorseGameIngoRaceResult { /* 0 */ INGORACE_NO_RESULT, /* 1 */ INGORACE_PLAYER_WIN, /* 2 */ INGORACE_INGO_WIN, @@ -35,7 +35,7 @@ typedef enum { #define MALONRACE_PLAYER_START (1 << 5) #define MALONRACE_PLAYER_ON_MARK (1 << 6) -typedef enum { +typedef enum HorseGameMalonRaceResult { /* 0 */ MALONRACE_NO_RESULT, /* 1 */ MALONRACE_SUCCESS, /* 2 */ MALONRACE_TIME_UP, diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h index 2ef1d2b9a9..96834860e3 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h @@ -54,7 +54,7 @@ typedef union EnHorseGameCheck { EnHorseGameCheckMalonRace malon; } EnHorseGameCheck; // size = 0x01A4 -typedef enum { +typedef enum EnHorseGameCheckType { /* 0 */ HORSEGAME_NONE, /* 1 */ HORSEGAME_INGO_RACE, /* 2 */ HORSEGAME_GERUDO_ARCHERY, diff --git a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c index 49c3661426..a02efe9342 100644 --- a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c +++ b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c @@ -9,7 +9,7 @@ #define FLAGS ACTOR_FLAG_4 -typedef struct { +typedef struct unk_D_80A69248 { /* 0x0 */ Vec3s unk_0; /* 0x6 */ u8 unk_6; } unk_D_80A69248; // size = 0x8 diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c index 2ba604eba3..31b20a59aa 100644 --- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c +++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c @@ -10,17 +10,17 @@ #define FLAGS 0 -typedef struct { +typedef struct EnHorseNormalUnkStruct1 { Vec3s pos; u8 unk_06; // this may be a s16 if the always-0 following byte is actually not padding } EnHorseNormalUnkStruct1; -typedef struct { +typedef struct EnHorseNormalUnkStruct2 { s32 len; EnHorseNormalUnkStruct1* items; } EnHorseNormalUnkStruct2; -typedef enum { +typedef enum EnHorseNormalAction { /* 0x00 */ HORSE_CYCLE_ANIMATIONS, /* 0x01 */ HORSE_WANDER, /* 0x02 */ HORSE_WAIT, diff --git a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c index 09ffab69b0..acfa90aa60 100644 --- a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c +++ b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c @@ -82,7 +82,7 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit sColChkInfoInit = { 10, 35, 100, MASS_HEAVY }; -typedef struct { +typedef struct HorsePosSpeed { /* 0x0 */ Vec3s pos; /* 0x6 */ u8 speedXZ; } HorsePosSpeed; // size = 0x8 diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index 6b9cd5b1d4..ea4fa04c44 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -74,13 +74,13 @@ static void* sEyeTexturesBJI13[] = { object_bji_Tex_0005FC, object_bji_Tex_0009F static void* sEyeTexturesBOJ2[] = { object_boj_Tex_0005FC, object_boj_Tex_0006FC, object_boj_Tex_0007FC, NULL }; static void* sEyeTexturesBOB[] = { object_bob_Tex_0007C8, object_bob_Tex_000FC8, object_bob_Tex_0017C8, NULL }; -typedef struct { +typedef struct EnHyHeadInfo { /* 0x00 */ s16 objectId; /* 0x04 */ Gfx* headDList; /* 0x08 */ void** eyeTextures; } EnHyHeadInfo; // size = 0xC -typedef enum { +typedef enum EnHyHeadIndex { /* 0 */ ENHY_HEAD_AOB, /* 1 */ ENHY_HEAD_BOB, /* 2 */ ENHY_HEAD_BOJ_2, @@ -118,12 +118,12 @@ static EnHyHeadInfo sHeadInfo[] = { /* ENHY_HEAD_COB */ { OBJECT_COB, object_cob_DL_001300, NULL }, }; -typedef struct { +typedef struct EnHySkeletonInfo { /* 0x00 */ s16 objectId; /* 0x04 */ FlexSkeletonHeader* skeleton; } EnHySkeletonInfo; // size = 0x8 -typedef enum { +typedef enum EnHySkeletonIndex { /* 0 */ ENHY_SKEL_AOB, /* 1 */ ENHY_SKEL_BOB, /* 2 */ ENHY_SKEL_BOJ, @@ -145,7 +145,7 @@ static EnHySkeletonInfo sSkeletonInfo[] = { /* ENHY_SKEL_COB */ { OBJECT_COB, &object_cob_Skel_0021F8 }, }; -typedef enum { +typedef enum EnHyAnimationIndex { /* 0 */ ENHY_ANIM_0, /* 1 */ ENHY_ANIM_1, /* 2 */ ENHY_ANIM_2, @@ -205,7 +205,7 @@ static AnimationInfo sAnimationInfo[] = { /* ENHY_ANIM_26 */ { &gObjOsAnim_0BFC, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, }; -typedef struct { +typedef struct EnHyModelInfo { /* 0x00 */ u8 headInfoIndex; // EnHyHeadIndex /* 0x01 */ u8 skelInfoIndex2; // EnHySkeletonIndex, see EnHy.objectSlotSkel2 /* 0x02 */ Color_RGBA8 envColorSeg8; @@ -259,7 +259,7 @@ static EnHyModelInfo sModelInfo[] = { { ENHY_HEAD_AHG_9, ENHY_SKEL_AHG, { 160, 230, 0, 0 }, ENHY_SKEL_AHG, { 0, 150, 110, 0 }, ENHY_ANIM_12 }, }; -typedef struct { +typedef struct EnHyColliderInfo { /* 0x00 */ Vec3s offset; /* 0x06 */ s16 radius; /* 0x08 */ s16 height; @@ -289,7 +289,7 @@ static EnHyColliderInfo sColliderInfo[] = { /* ENHY_TYPE_AHG_20 */ { { 0, 0, 8 }, 20, 58 }, }; -typedef struct { +typedef struct EnHyPlayerTrackingInfo { /* 0x00 */ u8 presetIndex; /* 0x04 */ f32 childYOffset; /* 0x08 */ f32 adultYOffset; @@ -319,7 +319,7 @@ static EnHyPlayerTrackingInfo sPlayerTrackingInfo[] = { /* ENHY_TYPE_AHG_20 */ { 0x0A, 20.0f, 0.0f }, }; -typedef struct { +typedef struct EnHyInit2Info { /* 0x00 */ f32 shadowScale; /* 0x04 */ Vec3f modelOffset; /* 0x10 */ f32 scale; diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.h b/src/overlays/actors/ovl_En_Hy/z_en_hy.h index 760ed9dfed..c8e28bdd4b 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.h +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef enum { +typedef enum EnHyType { /* 0 */ ENHY_TYPE_AOB, /* 1 */ ENHY_TYPE_COB, /* 2 */ ENHY_TYPE_AHG_2, diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 7357a5d1ae..307ff68496 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -15,7 +15,7 @@ typedef void (*EnIkDrawFunc)(struct EnIk*, PlayState*); #define ARMOR_BROKEN (1 << 0) -typedef enum { +typedef enum EnIkCsAction { /* 0x00 */ IK_CS_ACTION_0, /* 0x01 */ IK_CS_ACTION_1, /* 0x02 */ IK_CS_ACTION_2, @@ -24,13 +24,13 @@ typedef enum { /* 0x05 */ IK_CS_ACTION_5 } EnIkCsAction; -typedef enum { +typedef enum EnIkCsDrawMode { /* 0x00 */ IK_CS_DRAW_NOTHING, /* 0x01 */ IK_CS_DRAW_INTRO, /* 0x02 */ IK_CS_DRAW_DEFEAT } EnIkCsDrawMode; -typedef enum { +typedef enum EnIkDamageEffect { /* 0x0 */ EN_IK_DMGEFF_NONE, /* 0x6 */ EN_IK_DMGEFF_ELEMENTAL_MAGIC = 0x6, /* 0xD */ EN_IK_DMGEFF_SPARKS_NO_DMG = 0xD, diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.h b/src/overlays/actors/ovl_En_Ik/z_en_ik.h index efdb9f02d9..7f94019c28 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.h +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.h @@ -12,14 +12,14 @@ typedef void (*EnIkActionFunc)(struct EnIk*, PlayState*); #define IK_GET_ARMOR_TYPE(thisx) ((thisx)->params & 0xFF) #define IK_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 8) & 0xFF) -typedef enum { +typedef enum EnIkType { /* 0 */ IK_TYPE_NABOORU, /* 1 */ IK_TYPE_SILVER, /* 2 */ IK_TYPE_BLACK, /* 3 */ IK_TYPE_WHITE } EnIkType; -typedef enum { +typedef enum IronKnuckleLimb { /* 0x00 */ IRON_KNUCKLE_LIMB_NONE, /* 0x01 */ IRON_KNUCKLE_LIMB_ROOT, /* 0x02 */ IRON_KNUCKLE_LIMB_LOWER_BODY, @@ -55,7 +55,7 @@ typedef enum { // This skeleton is only used in the defeat cutscene that reveals Nabooru under the armor. // The only difference between this skeleton and the main one is that the head and helmet armor limbs are swapped. -typedef enum { +typedef enum IronKnuckleDefeatLimb { /* 0x00 */ IRON_KNUCKLE_DEFEAT_LIMB_NONE, /* 0x01 */ IRON_KNUCKLE_DEFEAT_LIMB_ROOT, /* 0x02 */ IRON_KNUCKLE_DEFEAT_LIMB_LOWER_BODY, diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 20e87a210b..6e17f2c92a 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -58,7 +58,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -typedef enum { +typedef enum EnInAnimation { /* 0 */ ENIN_ANIM_0, /* 1 */ ENIN_ANIM_1, /* 2 */ ENIN_ANIM_2, diff --git a/src/overlays/actors/ovl_En_In/z_en_in.h b/src/overlays/actors/ovl_En_In/z_en_in.h index 57baa280d4..84b5db8bac 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.h +++ b/src/overlays/actors/ovl_En_In/z_en_in.h @@ -8,7 +8,7 @@ struct EnIn; typedef void (*EnInActionFunc)(struct EnIn*, PlayState*); -typedef enum { +typedef enum IngoLimb { /* 0x00 */ INGO_LIMB_NONE, /* 0x01 */ INGO_LIMB_ROOT, /* 0x02 */ INGO_LEFT_THIGH_LIMB, diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.h b/src/overlays/actors/ovl_En_Insect/z_en_insect.h index 2e1931bee4..6ed7b95860 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.h +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.h @@ -39,7 +39,7 @@ typedef struct EnInsect { /* 0x032A */ u8 unk_32A; } EnInsect; // size = 0x032C -typedef enum { +typedef enum EnInsectType { /* 0 */ INSECT_TYPE_PERMANENT, /* 1 */ INSECT_TYPE_SPAWNED, /* 2 */ INSECT_TYPE_FIRST_DROPPED, diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h index 3ce7c72bf3..08d5038206 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef enum { +typedef enum EnIshiType { /* 0x00 */ ROCK_SMALL, /* 0x01 */ ROCK_LARGE } EnIshiType; diff --git a/src/overlays/actors/ovl_En_Jj/z_en_jj.c b/src/overlays/actors/ovl_En_Jj/z_en_jj.c index eaf47d8f97..02ed7fa2b3 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -10,7 +10,7 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -typedef enum { +typedef enum EnJjEyeState { /* 0 */ JABUJABU_EYE_OPEN, /* 1 */ JABUJABU_EYE_HALF, /* 2 */ JABUJABU_EYE_CLOSED, diff --git a/src/overlays/actors/ovl_En_Jj/z_en_jj.h b/src/overlays/actors/ovl_En_Jj/z_en_jj.h index 3d5a9dc154..c5d6241204 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.h +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.h @@ -26,7 +26,7 @@ typedef struct EnJj { /* 0x0311 */ u8 extraBlinkTotal; } EnJj; // size = 0x0314 -typedef enum { +typedef enum EnJjType { /* -1 */ JABUJABU_MAIN = -1, // Head, drawn body, handles updating /* 0 */ JABUJABU_COLLISION, // Static collision for body /* 1 */ JABUJABU_UNUSED_COLLISION // Shaped like a screen diff --git a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.h b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.h index f9d85b6d06..63a694bad6 100644 --- a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.h +++ b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.h @@ -16,7 +16,7 @@ typedef struct EnJsjutan { /* 0x0175 */ u8 unk_175; // setup flag? } EnJsjutan; // size = 0x0178 -typedef enum { +typedef enum EnJsjutanType { /* 0 */ ENJSJUTAN_TYPE_00, /* 1 */ ENJSJUTAN_TYPE_01 } EnJsjutanType; diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index 0ca298c459..ea2e47d9e5 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -29,7 +29,7 @@ #define UPPERRIGHT_HALF (PART_POST_UPPER | PART_UPPER_RIGHT | PART_RIGHT_UPPER | PART_UPPER_LEFT | PART_RIGHT_LOWER) #define ALL_PARTS (LEFT_HALF | RIGHT_HALF | PART_POST_UPPER | PART_POST_LOWER) -typedef enum { +typedef enum EnKanbanActionState { ENKANBAN_SIGN, ENKANBAN_AIR, ENKANBAN_UNUSED, @@ -38,7 +38,7 @@ typedef enum { ENKANBAN_REPAIR } EnKanbanActionState; -typedef enum { +typedef enum EnKanbanPiece { PIECE_WHOLE_SIGN, PIECE_UPPER_HALF, PIECE_LOWER_HALF, @@ -61,7 +61,7 @@ typedef enum { PIECE_OTHER = 100 } EnKanbanPiece; -typedef enum { +typedef enum EnKanbanCutType { CUT_POST, CUT_VERT_L, CUT_HORIZ, diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index 9c820fe171..39509d41ae 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -67,7 +67,7 @@ static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; static void* sFaEyes[] = { gFaEyeOpenTex, gFaEyeHalfTex, gFaEyeClosedTex, NULL }; static void* sKw1Eyes[] = { gKw1EyeOpenTex, gKw1EyeHalfTex, gKw1EyeClosedTex, NULL }; -typedef struct { +typedef struct EnKoHead { /* 0x0 */ s16 objectId; /* 0x4 */ Gfx* dList; /* 0x8 */ void** eyeTextures; @@ -79,7 +79,7 @@ static EnKoHead sHead[] = { { OBJECT_FA, gFaDL, sFaEyes }, }; -typedef struct { +typedef struct EnKoSkeleton { /* 0x0 */ s16 objectId; /* 0x4 */ FlexSkeletonHeader* flexSkeletonHeader; } EnKoSkeleton; // size = 0x8 @@ -89,7 +89,7 @@ static EnKoSkeleton sSkeleton[2] = { { OBJECT_KW1, &gKw1Skel }, }; -typedef enum { +typedef enum EnKoAnimation { /* 0 */ ENKO_ANIM_BLOCKING_NOMORPH, /* 1 */ ENKO_ANIM_BLOCKING_NOMORPH_STATIC, /* 2 */ ENKO_ANIM_STANDUP_1, @@ -202,7 +202,7 @@ static u8 sOsAnimeLookup[13][5] = { ENKO_ANIM_IDLE_NOMORPH }, }; -typedef struct { +typedef struct EnKoModelInfo { /* 0x0 */ u8 headId; /* 0x1 */ u8 bodyId; /* 0x4 */ Color_RGBA8 tunicColor; @@ -210,7 +210,7 @@ typedef struct { /* 0xC */ Color_RGBA8 bootsColor; } EnKoModelInfo; // size = 0x10 -typedef enum { +typedef enum KokiriGender { /* 0 */ KO_BOY, /* 1 */ KO_GIRL, /* 2 */ KO_FADO @@ -232,7 +232,7 @@ static EnKoModelInfo sModelInfo[] = { /* ENKO_TYPE_CHILD_FADO */ { KO_FADO, KO_GIRL, { 70, 190, 60, 255 }, KO_GIRL, { 100, 30, 0, 255 } }, }; -typedef struct { +typedef struct EnKoInteractInfo { /* 0x0 */ s8 targetMode; /* 0x4 */ f32 lookDist; // extended by collider radius /* 0x8 */ f32 appearDist; diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.h b/src/overlays/actors/ovl_En_Ko/z_en_ko.h index a33ac3e38c..08aff76f1d 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.h +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.h @@ -32,7 +32,7 @@ typedef struct EnKo { /* 0x0304 */ s16 unk_304[16]; } EnKo; // size = 0x0324 -typedef enum { +typedef enum KokiriChildren { ENKO_TYPE_CHILD_0, ENKO_TYPE_CHILD_1, ENKO_TYPE_CHILD_2, @@ -49,7 +49,7 @@ typedef enum { ENKO_TYPE_CHILD_MAX } KokiriChildren; -typedef enum { +typedef enum KokiriForestQuestState { ENKO_FQS_CHILD_START, ENKO_FQS_CHILD_STONE, ENKO_FQS_CHILD_SARIA, diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h index 8c8423223c..4a895fe15a 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h @@ -8,7 +8,7 @@ struct EnKusa; typedef void (*EnKusaActionFunc)(struct EnKusa*, PlayState*); -typedef enum { +typedef enum EnKusaType { /* 0 */ ENKUSA_TYPE_0, /* 1 */ ENKUSA_TYPE_1, /* 2 */ ENKUSA_TYPE_2 diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index 6aaab99551..e2e0fd0efd 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -56,7 +56,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -typedef enum { +typedef enum EnKzAnimation { /* 0 */ ENKZ_ANIM_0, /* 1 */ ENKZ_ANIM_1, /* 2 */ ENKZ_ANIM_2 diff --git a/src/overlays/actors/ovl_En_Light/z_en_light.c b/src/overlays/actors/ovl_En_Light/z_en_light.c index f235d0fcdf..7f867e6032 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -28,7 +28,7 @@ ActorProfile En_Light_Profile = { /**/ EnLight_Draw, }; -typedef struct { +typedef struct FlameParams { /* 0x00 */ Color_RGBA8 primColor; /* 0x04 */ Color_RGB8 envColor; /* 0x07 */ u8 scale; diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index 0206c09dd0..f3037e058c 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -57,7 +57,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -typedef enum { +typedef enum EnMa1Animation { /* 0 */ MALON_ANIM_IDLE_NOMORPH, /* 1 */ MALON_ANIM_IDLE, /* 2 */ MALON_ANIM_SING_NOMORPH, diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index 6b727f28fd..eca08b7221 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -51,7 +51,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -typedef enum { +typedef enum EnMa2Animation { /* 0 */ ENMA2_ANIM_0, /* 1 */ ENMA2_ANIM_1, /* 2 */ ENMA2_ANIM_2, diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h index b207e8e7c3..390c61da21 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h @@ -8,7 +8,7 @@ struct EnMa2; typedef void (*EnMa2ActionFunc)(struct EnMa2*, PlayState*); -typedef enum { +typedef enum AdultMalonLimb { /* 0x00 */ MALON_ADULT_LIMB_NONE, /* 0x01 */ MALON_ADULT_ROOT_LIMB, /* 0x02 */ MALON_ADULT_LOWER_CONTROL_LIMB, diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index 3feb7cc332..c65dba93ae 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -54,7 +54,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -typedef enum { +typedef enum EnMa3Animation { /* 0 */ ENMA3_ANIM_0, /* 1 */ ENMA3_ANIM_1, /* 2 */ ENMA3_ANIM_2, diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h index 3edf65f096..2b9dea812d 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h @@ -8,7 +8,7 @@ struct EnMa3; typedef void (*EnMa3ActionFunc)(struct EnMa3*, PlayState*); -typedef enum { +typedef enum AdultMalonLimb { /* 0x00 */ MALON_ADULT_LIMB_NONE, /* 0x01 */ MALON_ADULT_LIMB_ROOT, /* 0x02 */ MALON_ADULT_LIMB_LOWER_CONTROL, diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.h b/src/overlays/actors/ovl_En_Mag/z_en_mag.h index a9f1b9d144..e7c516c629 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.h +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.h @@ -32,7 +32,7 @@ typedef struct EnMag { /* 0xE324 */ char unk_E324[0x0004]; } EnMag; // size = 0xE328 -typedef enum { +typedef enum EnMagGlobalState { /* 0x00 */ MAG_STATE_INITIAL, /* 0x01 */ MAG_STATE_FADE_IN, /* 0x02 */ MAG_STATE_DISPLAY, diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 60c2cff720..6e35915331 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -16,7 +16,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -typedef enum { +typedef enum EnMbType { /* -1 */ ENMB_TYPE_SPEAR_GUARD = -1, /* 0 */ ENMB_TYPE_CLUB, /* 1 */ ENMB_TYPE_SPEAR_PATROL @@ -29,7 +29,7 @@ typedef enum { #define ENMB_ATTACK_CLUB_LEFT 3 /* Spear and Club moblins use a different skeleton but the limbs are organized the same */ -typedef enum { +typedef enum EnMbLimb { /* 1 */ ENMB_LIMB_ROOT = 1, /* 3 */ ENMB_LIMB_WAIST = 3, /* 6 */ ENMB_LIMB_CHEST = 6, @@ -167,7 +167,7 @@ static ColliderQuadInit sAttackColliderInit = { { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -typedef enum { +typedef enum EnMbDamageEffect { /* 0x0 */ ENMB_DMGEFF_IGNORE, /* 0x1 */ ENMB_DMGEFF_STUN, /* 0x5 */ ENMB_DMGEFF_FREEZE = 0x5, diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.h b/src/overlays/actors/ovl_En_Mb/z_en_mb.h index 6ce94942d5..66afb9eeb1 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.h +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.h @@ -8,7 +8,7 @@ struct EnMb; typedef void (*EnMbActionFunc)(struct EnMb*, PlayState*); -typedef enum { +typedef enum EnMbState { /* 0 */ ENMB_STATE_SPEAR_SPEARPATH_DAMAGED, /* 1 */ ENMB_STATE_CLUB_DEAD, /* 2 */ ENMB_STATE_CLUB_KNEELING_DAMAGED, diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 631a58af0d..833971a3ee 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -55,7 +55,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -typedef enum { +typedef enum EnMdAnimation { /* 0 */ ENMD_ANIM_0, /* 1 */ ENMD_ANIM_1, /* 2 */ ENMD_ANIM_2, diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.h b/src/overlays/actors/ovl_En_Md/z_en_md.h index d3075a821f..57b693a39a 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.h +++ b/src/overlays/actors/ovl_En_Md/z_en_md.h @@ -6,7 +6,7 @@ struct EnMd; -typedef enum { +typedef enum EnMdLimb { ENMD_LIMB_NONE, ENMD_LIMB_ROOT, ENMD_LIMB_WAIST, diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index 48771d5490..59b950d1c0 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -10,7 +10,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -typedef enum { +typedef enum RunningManAnimIndex { /* 0 */ RM_ANIM_RUN, /* 1 */ RM_ANIM_SIT, /* 2 */ RM_ANIM_SIT_WAIT, @@ -20,7 +20,7 @@ typedef enum { /* 6 */ RM_ANIM_HAPPY // plays when you sell him the bunny hood } RunningManAnimIndex; -typedef enum { +typedef enum RunningManMouthTex { /* 0 */ RM_MOUTH_CLOSED, /* 1 */ RM_MOUTH_OPEN } RunningManMouthTex; @@ -115,7 +115,7 @@ static AnimationSpeedInfo sAnimationInfo[] = { { &gRunningManHappyAnim, 1.0f, ANIMMODE_LOOP, -12.0f }, }; -typedef struct { +typedef struct EnMmPathInfo { /* 0x00 */ s32 unk_00; /* 0x04 */ s32 unk_04; /* 0x08 */ s32 unk_08; diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index 43df398a87..9d59e93d01 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -10,7 +10,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -typedef enum { +typedef enum RunningManAnimIndex { /* 0 */ RM2_ANIM_RUN, /* 1 */ RM2_ANIM_SIT, /* 2 */ RM2_ANIM_SIT_WAIT, @@ -20,7 +20,7 @@ typedef enum { /* 6 */ RM2_ANIM_HAPPY // plays when you sell him the bunny hood } RunningManAnimIndex; -typedef enum { +typedef enum RunningManMouthTex { /* 0 */ RM2_MOUTH_CLOSED, /* 1 */ RM2_MOUTH_OPEN } RunningManMouthTex; diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 04883b3fca..20f6c34161 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -11,7 +11,7 @@ #define FLAGS ACTOR_FLAG_4 -typedef enum { +typedef enum EnNbAction { /* 0x00 */ NB_CHAMBER_INIT, /* 0x01 */ NB_CHAMBER_UNDERGROUND, /* 0x02 */ NB_CHAMBER_APPEAR, @@ -45,7 +45,7 @@ typedef enum { /* 0x1E */ NB_ACTION_30 } EnNbAction; -typedef enum { +typedef enum EnNbDrawMode { /* 0x00 */ NB_DRAW_NOTHING, /* 0x01 */ NB_DRAW_DEFAULT, /* 0x02 */ NB_DRAW_HIDE, diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.h b/src/overlays/actors/ovl_En_Nb/z_en_nb.h index 89429df6b9..997af0f573 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.h +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.h @@ -6,7 +6,7 @@ struct EnNb; -typedef enum { +typedef enum EnNbLimb { /* 0x00 */ NB_LIMB_NONE, /* 0x01 */ NB_LIMB_ROOT, /* 0x02 */ NB_LIMB_L_THIGH, @@ -55,7 +55,7 @@ typedef struct EnNb { /* 0x0300 */ NpcInteractInfo interactInfo; } EnNb; // size = 0x0328 -typedef enum { +typedef enum EnNbType { /* 0x02 */ NB_TYPE_DEMO02 = 2, /* 0x03 */ NB_TYPE_KIDNAPPED, /* 0x04 */ NB_TYPE_KNUCKLE, diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.h b/src/overlays/actors/ovl_En_Niw/z_en_niw.h index 5f1ab9c809..283b6a52cd 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -8,7 +8,7 @@ struct EnNiw; typedef void (*EnNiwActionFunc)(struct EnNiw*, PlayState*); -typedef struct { +typedef struct EnNiwEffect { /* 0x0000 */ u8 type; /* 0x0004 */ Vec3f pos; /* 0x0010 */ Vec3f vel; diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h index aaf85a6571..00fe77a05c 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h @@ -6,7 +6,7 @@ #define NUTSBALL_GET_TYPE(thisx) ((thisx)->params) -typedef enum { +typedef enum EnNutsballType { /* 0 */ EN_NUTSBALL_TYPE_DEKUNUTS, /* 1 */ EN_NUTSBALL_TYPE_HINTNUTS, /* 2 */ EN_NUTSBALL_TYPE_SHOPNUTS, diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index 0a38ca95c0..ff791ec984 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -25,7 +25,7 @@ void EnNwc_Idle(EnNwc* this, PlayState* play); #define CHICK_BG_FLOOR (1 << 0) #define CHICK_BG_WALL (1 << 1) -typedef enum { +typedef enum ChickTypes { /* 0 */ CHICK_NONE, /* 1 */ CHICK_NORMAL } ChickTypes; diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 5ec2091fa1..9edfbe6a32 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -157,7 +157,7 @@ static char* sShopkeeperPrintName[] = { }; #endif -typedef struct { +typedef struct ShopkeeperObjInfo { /* 0x00 */ s16 objId; /* 0x02 */ s16 unk_02; /* 0x04 */ s16 unk_04; @@ -188,7 +188,7 @@ static f32 sShopkeeperScale[] = { 0.01f, 0.011f, 0.0105f, 0.011f, 0.01f, 0.01f, 0.01f, 0.01f, 0.01f, 0.01f, 0.01f, }; -typedef struct { +typedef struct ShopItem { /* 0x00 */ s16 shopItemIndex; /* 0x02 */ s16 xOffset; /* 0x04 */ s16 yOffset; diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h index 236e47e866..c2101e9d9e 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h @@ -14,7 +14,7 @@ typedef void (*EnOssanInitFunc)(struct EnOssan*, PlayState*); typedef s16 (*EnOssanGetGirlAParamsFunc)(s16); typedef void (*EnOssanStateFunc)(struct EnOssan*, PlayState*, Player*); -typedef struct { +typedef struct StickDirectionPrompt { /* 0x00 */ u32 stickColorR; /* 0x04 */ u32 stickColorG; /* 0x08 */ u32 stickColorB; @@ -83,7 +83,7 @@ typedef struct EnOssan { /* 0x02D4 */ f32 cameraFaceAngle; // stored in degrees } EnOssan; // size = 0x02D8 -typedef enum { +typedef enum OssanType { /* 00 */ OSSAN_TYPE_KOKIRI, /* 01 */ OSSAN_TYPE_KAKARIKO_POTION, /* 02 */ OSSAN_TYPE_BOMBCHUS, @@ -97,7 +97,7 @@ typedef enum { /* 10 */ OSSAN_TYPE_MASK } OssanType; -typedef enum { +typedef enum EnOssanState { /* 00 */ OSSAN_STATE_IDLE, /* 01 */ OSSAN_STATE_START_CONVERSATION, /* 02 */ OSSAN_STATE_FACING_SHOPKEEPER, @@ -127,7 +127,7 @@ typedef enum { /* 26 */ OSSAN_STATE_DISCOUNT_DIALOG // Hylian Shield Discount } EnOssanState; -typedef enum { +typedef enum EnOssanHappyMaskState { OSSAN_HAPPY_STATE_REQUEST_PAYMENT_KEATON_MASK, OSSAN_HAPPY_STATE_REQUEST_PAYMENT_SPOOKY_MASK, OSSAN_HAPPY_STATE_REQUEST_PAYMENT_SKULL_MASK, diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index df91014844..c4ebcbb6c1 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -44,7 +44,7 @@ void func_80ACB680(EnOwl* this, PlayState* play); void func_80ACC460(EnOwl* this); void func_80ACBEA0(EnOwl*, PlayState*); -typedef enum { +typedef enum EnOwlType { /* 0x00 */ OWL_DEFAULT, /* 0x01 */ OWL_OUTSIDE_KOKIRI, /* 0x02 */ OWL_HYRULE_CASTLE, @@ -60,7 +60,7 @@ typedef enum { /* 0x0C */ OWL_LOST_WOODS_POSTSARIA } EnOwlType; -typedef enum { +typedef enum EnOwlMessageChoice { /* 0x00 */ OWL_REPEAT, /* 0x01 */ OWL_OK } EnOwlMessageChoice; diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index b0120cf4ad..1beef8495f 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -119,7 +119,7 @@ static ColliderQuadInit sQuadInit = { { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -typedef enum { +typedef enum DamageEffect { /* 00 */ PEAHAT_DMG_EFF_ATTACK = 0, /* 06 */ PEAHAT_DMG_EFF_LIGHT_ICE_ARROW = 6, /* 12 */ PEAHAT_DMG_EFF_FIRE = 12, @@ -163,7 +163,7 @@ static DamageTable sDamageTable = { /* Unknown 2 */ DMG_ENTRY(0, PEAHAT_DMG_EFF_ATTACK), }; -typedef enum { +typedef enum PeahatState { /* 00 */ PEAHAT_STATE_DYING, /* 01 */ PEAHAT_STATE_EXPLODE, /* 03 */ PEAHAT_STATE_3 = 3, diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h index 706ec34bb1..2449fc3405 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef enum { +typedef enum PeahatType { /* -1 */ PEAHAT_TYPE_GROUNDED = -1, /* 0 */ PEAHAT_TYPE_FLYING = 0, /* 1 */ PEAHAT_TYPE_LARVA = 1 diff --git a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h index 7f5273e744..f07a9233d7 100644 --- a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h +++ b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h @@ -8,12 +8,12 @@ struct EnPoField; typedef void (*EnPoFieldActionFunc)(struct EnPoField*, PlayState*); -typedef enum { +typedef enum EnPoFieldSize { EN_PO_FIELD_SMALL, EN_PO_FIELD_BIG } EnPoFieldSize; -typedef struct { +typedef struct EnPoFieldInfo { /* 0x0000 */ Color_RGB8 primColor; /* 0x0003 */ Color_RGB8 lightColor; /* 0x0006 */ Color_RGB8 envColor; diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.h b/src/overlays/actors/ovl_En_Poh/z_en_poh.h index 1a44a60e81..749047b75f 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.h +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.h @@ -8,19 +8,19 @@ struct EnPoh; typedef void (*EnPohActionFunc)(struct EnPoh*, PlayState*); -typedef enum { +typedef enum EnPohType { EN_POH_NORMAL, EN_POH_RUPEE, EN_POH_SHARP, EN_POH_FLAT } EnPohType; -typedef enum { +typedef enum EnPohInfoType { EN_POH_INFO_NORMAL, EN_POH_INFO_COMPOSER } EnPohInfoType; -typedef struct { +typedef struct EnPohInfo { /* 0x0000 */ Color_RGB8 primColor; /* 0x0003 */ Color_RGB8 lightColor; /* 0x0006 */ u8 unk_6; // limb index diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index b20ed63dd3..f7320699d0 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -29,7 +29,7 @@ void EnRd_Damaged(EnRd* this, PlayState* play); void EnRd_Dead(EnRd* this, PlayState* play); void EnRd_Stunned(EnRd* this, PlayState* play); -typedef enum { +typedef enum EnRdAction { /* 0 */ REDEAD_ACTION_IDLE, /* 1 */ REDEAD_ACTION_STUNNED, /* 2 */ REDEAD_ACTION_WALK_TO_HOME, @@ -44,7 +44,7 @@ typedef enum { /* 11 */ REDEAD_ACTION_RISE_FROM_COFFIN } EnRdAction; -typedef enum { +typedef enum EnRdGrabState { /* 0 */ REDEAD_GRAB_START, /* 1 */ REDEAD_GRAB_INITIAL_DAMAGE, /* 2 */ REDEAD_GRAB_ATTACK, @@ -84,7 +84,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 70, 0, { 0, 0, 0 } }, }; -typedef enum { +typedef enum EnRdDamageEffect { /* 0x0 */ REDEAD_DMGEFF_NONE, // Does not interact with the Gibdo/Redead at all /* 0x1 */ REDEAD_DMGEFF_HOOKSHOT, // Stuns the Gibdo/Redead /* 0x6 */ REDEAD_DMGEFF_ICE_MAGIC = 0x6, // Does not interact with the Gibdo/Redead at all diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.h b/src/overlays/actors/ovl_En_Rd/z_en_rd.h index 864dc13a99..a484573e2d 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.h +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.h @@ -10,7 +10,7 @@ typedef void (*EnRdActionFunc)(struct EnRd*, PlayState*); #define REDEAD_GET_FLAGS(thisx) (((thisx)->params & 0xFF00) >> 8) -typedef enum { +typedef enum RedeadGibdoLimb { /* 0 */ REDEAD_GIBDO_LIMB_NONE, /* 1 */ REDEAD_GIBDO_LIMB_ROOT, /* 2 */ REDEAD_GIBDO_LIMB_LEFT_LEG_ROOT, @@ -40,7 +40,7 @@ typedef enum { /* 26 */ REDEAD_GIBDO_LIMB_MAX } RedeadGibdoLimb; -typedef enum { +typedef enum EnRdType { /* -3 */ REDEAD_TYPE_GIBDO_RISING_OUT_OF_COFFIN = -3, /* -2 */ REDEAD_TYPE_GIBDO, /* -1 */ REDEAD_TYPE_DOES_NOT_MOURN, diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c index e58a655044..14d99d16c5 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -30,7 +30,7 @@ void EnReeba_Die(EnReeba* this, PlayState* play); void EnReeba_Stunned(EnReeba* this, PlayState* play); void EnReeba_StunDie(EnReeba* this, PlayState* play); -typedef enum { +typedef enum LeeverDamageEffect { /* 0x00 */ LEEVER_DMGEFF_NONE, // used by anything that cant kill the Leever /* 0x01 */ LEEVER_DMGEFF_UNK, // used by "unknown 1" attack /* 0x03 */ LEEVER_DMGEFF_ICE = 3, diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h index 06bb946d2c..36173bf355 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h @@ -30,7 +30,7 @@ typedef struct EnReeba { /* 0x0290 */ ColliderCylinder collider; } EnReeba; // size = 0x02DC -typedef enum { +typedef enum LeeverType { /* 0 */ LEEVER_TYPE_SMALL, /* 1 */ LEEVER_TYPE_BIG } LeeverType; diff --git a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.h b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.h index be6d04e65e..c647185217 100644 --- a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.h +++ b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.h @@ -13,7 +13,7 @@ typedef struct EnRiverSound { /* 0x014E */ s16 pathIndex; } EnRiverSound; // size = 0x0150 -typedef enum { +typedef enum RiverSoundType { /* 0x00 */ RS_RIVER_DEFAULT_LOW_FREQ, /* 0x01 */ RS_SMALL_WATERFALL, /* 0x02 */ RS_LAVA_BUBBLES_1, diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 34e1bd21c8..4f2f3a083b 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -15,7 +15,7 @@ #define RR_MOUTH 4 #define RR_BASE 0 -typedef enum { +typedef enum EnRrReachState { /* 0 */ REACH_NONE, /* 1 */ REACH_EXTEND, /* 2 */ REACH_STOP, @@ -24,7 +24,7 @@ typedef enum { /* 5 */ REACH_CLOSE } EnRrReachState; -typedef enum { +typedef enum EnRrDamageEffect { /* 0x0 */ RR_DMG_NONE, /* 0x1 */ RR_DMG_STUN, /* 0x2 */ RR_DMG_FIRE, @@ -37,7 +37,7 @@ typedef enum { /* 0xF */ RR_DMG_NORMAL } EnRrDamageEffect; -typedef enum { +typedef enum EnRrDropType { /* 0 */ RR_DROP_RANDOM_RUPEE, /* 1 */ RR_DROP_MAGIC, /* 2 */ RR_DROP_ARROW, diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.h b/src/overlays/actors/ovl_En_Rr/z_en_rr.h index aa1f782073..44ac232668 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.h +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.h @@ -8,7 +8,7 @@ struct EnRr; typedef void (*EnRrActionFunc)(struct EnRr*, PlayState*); -typedef struct { +typedef struct EnRrBodySegment { /* 0x00 */ f32 height; /* 0x04 */ f32 heightTarget; /* 0x08 */ Vec3f scale; diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h index 29570c980e..8223bfda43 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h @@ -57,7 +57,7 @@ typedef struct EnRu1 { /* 0x0374 */ NpcInteractInfo interactInfo; } EnRu1; // size = 0x039C -typedef enum { +typedef enum RutoLimb { /* 0 */ RUTO_CHILD_NONE, /* 1 */ RUTO_CHILD_ROOT, /* 2 */ RUTO_CHILD_LEFT_THIGH, diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index d6296987e6..3008eabe88 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -17,7 +17,7 @@ void func_80AF683C(EnSa* this, PlayState* play); void func_80AF68E4(EnSa* this, PlayState* play); void func_80AF6B20(EnSa* this, PlayState* play); -typedef enum { +typedef enum SariaEyeState { /* 0 */ SARIA_EYE_OPEN, /* 1 */ SARIA_EYE_HALF, /* 2 */ SARIA_EYE_CLOSED, @@ -25,7 +25,7 @@ typedef enum { /* 4 */ SARIA_EYE_SAD } SariaEyeState; -typedef enum { +typedef enum SariaMouthState { /* 0 */ SARIA_MOUTH_CLOSED2, /* 1 */ SARIA_MOUTH_SUPRISED, /* 2 */ SARIA_MOUTH_CLOSED, @@ -67,7 +67,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -typedef enum { +typedef enum EnSaAnimation1 { /* 0 */ ENSA_ANIM1_0, /* 1 */ ENSA_ANIM1_1, /* 2 */ ENSA_ANIM1_2, @@ -97,7 +97,7 @@ static AnimationFrameCountInfo sAnimationInfo1[] = { { &gSariaPlayingOcarinaAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, }; -typedef enum { +typedef enum EnSaAnimation2 { /* 0 */ ENSA_ANIM2_0, /* 1 */ ENSA_ANIM2_1, /* 2 */ ENSA_ANIM2_2, diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index ef608988e8..fc91448994 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -97,7 +97,7 @@ static Vec3f sFlamePosOffsets[] = { { 0.0f, 0.0f, -5.0f }, }; -typedef enum { +typedef enum ShellbladeBehavior { /* 0x00 */ SHELLBLADE_OPEN, /* 0x01 */ SHELLBLADE_WAIT_CLOSED, /* 0x02 */ SHELLBLADE_WAIT_OPEN, diff --git a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h index b291c5cd2a..23074bfac1 100644 --- a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h +++ b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef enum { +typedef enum EnSiofukiType { /* 0x00 */ EN_SIOFUKI_RAISING, /* 0x01 */ EN_SIOFUKI_LOWERING } EnSiofukiType; diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 1853e7b75b..a7073ca83d 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -10,7 +10,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -typedef enum { +typedef enum StalchildBehavior { SKB_BEHAVIOR_BURIED, SKB_BEHAVIOR_DYING, SKB_BEHAVIOR_DAMAGED, diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 9805f0542d..102d9c690a 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -95,7 +95,7 @@ void EnSkj_SetupWaitInRange(EnSkj* this); #define songFailTimer multiuseTimer #define battleExitTimer multiuseTimer -typedef enum { +typedef enum SkullKidAnim { /* 0 */ SKJ_ANIM_BACKFLIP, /* 1 */ SKJ_ANIM_SHOOT_NEEDLE, /* 2 */ SKJ_ANIM_PLAY_FLUTE, @@ -108,18 +108,18 @@ typedef enum { /* 9 */ SKJ_ANIM_WAIT } SkullKidAnim; -typedef enum { +typedef enum SkullKidStumpSide { /* 0 */ SKULL_KID_LEFT, /* 1 */ SKULL_KID_RIGHT } SkullKidStumpSide; -typedef enum { +typedef enum SkullKidOcarinaGameState { /* 0 */ SKULL_KID_OCARINA_WAIT, /* 1 */ SKULL_KID_OCARINA_PLAY_NOTES, /* 2 */ SKULL_KID_OCARINA_LEAVE_GAME } SkullKidOcarinaGameState; -typedef enum { +typedef enum SkullKidAction { /* 00 */ SKJ_ACTION_FADE, /* 01 */ SKJ_ACTION_WAIT_TO_SHOOT_NEEDLE, /* 02 */ SKJ_ACTION_SARIA_SONG_IDLE, @@ -151,7 +151,7 @@ typedef enum { /* 28 */ SKJ_ACTION_OCARINA_GAME_LEAVE } SkullKidAction; -typedef struct { +typedef struct EnSkjUnkStruct { u8 unk_0; EnSkj* skullkid; } EnSkjUnkStruct; diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index 1cf4f71ad8..cd0918a955 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -8,7 +8,7 @@ #define SSH_STATE_ATTACKED (1 << 3) #define SSH_STATE_SPIN (1 << 4) -typedef enum { +typedef enum EnSshAnimation { SSH_ANIM_UNK0, // Unused animation. Possibly being knocked back? SSH_ANIM_UP, SSH_ANIM_WAIT, diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index 1011149b3b..744048e52e 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -104,7 +104,7 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -typedef enum { +typedef enum EnStAnimation { /* 0 */ ENST_ANIM_0, /* 1 */ ENST_ANIM_1, /* 2 */ ENST_ANIM_2, diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 91d65ef9b9..65f0b47ed6 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -47,7 +47,7 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit2 D_80B0F074 = { 1, 2, 25, 25, MASS_IMMOVABLE }; -typedef enum { +typedef enum EnSwAnimation { /* 0 */ ENSW_ANIM_0, /* 1 */ ENSW_ANIM_1, /* 2 */ ENSW_ANIM_2, diff --git a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c index 5f39b2de69..341f15e13d 100644 --- a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c +++ b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c @@ -6,7 +6,7 @@ #define FLAGS ACTOR_FLAG_4 -typedef enum { +typedef enum EnSyatekItemRound { SYATEKI_ROUND_GREEN_APPEAR, SYATEKI_ROUND_BLUE_SEQUENTIAL, SYATEKI_ROUND_GREEN_THROW, diff --git a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h index c7e01a776b..c670208bec 100644 --- a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h +++ b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h @@ -8,14 +8,14 @@ struct EnSyatekiItm; typedef void (*EnSyatekiItmActionFunc)(struct EnSyatekiItm*, PlayState*); -typedef enum { +typedef enum EnSyatekiSignal { /* 0 */ ENSYATEKI_NONE, /* 1 */ ENSYATEKI_START, /* 2 */ ENSYATEKI_END, /* 3 */ ENSYATEKI_RESULTS } EnSyatekiSignal; -typedef enum { +typedef enum EnSyatekiHitState { /* 0 */ ENSYATEKIHIT_NONE, /* 1 */ ENSYATEKIHIT_MISS, /* 2 */ ENSYATEKIHIT_HIT diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index bcf5c8baf9..6a1bab34e5 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -5,7 +5,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_27) -typedef enum { +typedef enum EnSyatekiManGameResult { /* 0 */ SYATEKI_RESULT_NONE, /* 1 */ SYATEKI_RESULT_WINNER, /* 2 */ SYATEKI_RESULT_ALMOST, @@ -13,7 +13,7 @@ typedef enum { /* 4 */ SYATEKI_RESULT_REFUSE } EnSyatekiManGameResult; -typedef enum { +typedef enum EnSyatekiManTextIdx { /* 0 */ SYATEKI_TEXT_CHOICE, /* 1 */ SYATEKI_TEXT_START_GAME, /* 2 */ SYATEKI_TEXT_NO_RUPEES, diff --git a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h index 5f1cfcf723..9f35c2b05d 100644 --- a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h +++ b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h @@ -8,7 +8,7 @@ struct EnSyatekiNiw; typedef void (*EnSyatekiNiwActionFunc)(struct EnSyatekiNiw*, PlayState*); -typedef struct { +typedef struct EnSyatekiNiwEffect { /* 0x00 */ u8 state; /* 0x0C */ Vec3f pos; /* 0x10 */ Vec3f vel; @@ -70,7 +70,7 @@ typedef struct EnSyatekiNiw { /* 0x0348 */ EnSyatekiNiwEffect effects[EN_SYATEKI_NIW_EFFECT_COUNT]; // feather particles } EnSyatekiNiw; // size = 0x0460 -typedef enum { +typedef enum EnSyatekiMinigame { SYATEKI_MINIGAME_ARCHERY, // unused archery game behavior SYATEKI_MINIGAME_ALLEY // Bombchu Alley behavior } EnSyatekiMinigame; diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index 63e0005eb2..fa7b0d3be7 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -21,14 +21,14 @@ #define TALON_STATE_FLAG_RAISING_HANDS (1 << 8) #define TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY (1 << 9) -typedef enum { +typedef enum TalonEyeIndex { /* 0 */ TALON_EYE_INDEX_OPEN, /* 1 */ TALON_EYE_INDEX_HALF, /* 2 */ TALON_EYE_INDEX_CLOSED, /* 3 */ TALON_EYE_INDEX_MAX } TalonEyeIndex; -typedef enum { +typedef enum TalonCanBuyMilkResult { /* 0 */ TALON_CANBUYMILK_NOT_ENOUGH_RUPEES, /* 1 */ TALON_CANBUYMILK_NO_EMPTY_BOTTLE, /* 2 */ TALON_CANBUYMILK_SUCCESS diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.h b/src/overlays/actors/ovl_En_Ta/z_en_ta.h index 8f7e1f8b5c..eeab7dc775 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.h +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.h @@ -12,13 +12,13 @@ typedef void (*EnTaActionFunc)(struct EnTa*, PlayState*); typedef void (*EnTaBlinkFunc)(struct EnTa*); typedef void (*EnTaAnimFunc)(struct EnTa*); -typedef enum { +typedef enum EnTaType { /* 0xFFFF */ ENTA_CHILD_ERA = -1, /* 0x0001 */ ENTA_IN_KAKARIKO = 1, /* 0x0002 */ ENTA_RETURNED_FROM_KAKARIKO } EnTaType; -typedef enum { +typedef enum EnTaLimb { /* 0x00 */ ENTA_LIMB_NONE, /* 0x01 */ ENTA_LIMB_ROOT, /* 0x02 */ ENTA_LIMB_LEFT_THIGH, diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.c b/src/overlays/actors/ovl_En_Test/z_en_test.c index 6434aa2c12..4ade2d19fb 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -197,7 +197,7 @@ static ColliderQuadInit sSwordColliderInit = { { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -typedef enum { +typedef enum StalfosDamageEffect { /* 0x0 */ STALFOS_DMGEFF_NORMAL, /* 0x1 */ STALFOS_DMGEFF_STUN, /* 0x6 */ STALFOS_DMGEFF_FIREMAGIC = 6, diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.h b/src/overlays/actors/ovl_En_Test/z_en_test.h index 3ddf9f7238..397682cd5a 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.h +++ b/src/overlays/actors/ovl_En_Test/z_en_test.h @@ -8,7 +8,7 @@ struct EnTest; typedef void (*EnTestActionFunc)(struct EnTest*, PlayState*); -typedef enum { +typedef enum StalfosLimb { /* 0x00 */ STALFOS_LIMB_NONE, /* 0x01 */ STALFOS_LIMB_ROOT, /* 0x02 */ STALFOS_LIMB_UPPERBODY_ROOT, @@ -102,7 +102,7 @@ typedef struct EnTest { /* 0x8DC */ ColliderCylinder shieldCollider; } EnTest; // size = 0x928 -typedef enum { +typedef enum StalfosType { /* 0 */ STALFOS_TYPE_INVISIBLE, /* 1 */ STALFOS_TYPE_1, /* 2 */ STALFOS_TYPE_2, diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index 0c2dc38f44..37c6810cb8 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -23,7 +23,7 @@ #define vOnBackTimer actionVar1 #define vLegTwitchTimer actionVar2 -typedef enum { +typedef enum EnTiteAction { /* 0x0 */ TEKTITE_DEATH_CRY, /* 0x1 */ TEKTITE_UNK_1, /* 0x2 */ TEKTITE_UNK_2, @@ -39,14 +39,14 @@ typedef enum { /* 0xC */ TEKTITE_MOVE_TOWARD_PLAYER } EnTiteAction; -typedef enum { +typedef enum EnTiteAttackState { /* 0x0 */ TEKTITE_BEGIN_LUNGE, /* 0x1 */ TEKTITE_MID_LUNGE, /* 0x2 */ TEKTITE_LANDED, /* 0x2 */ TEKTITE_SUBMERGED } EnTiteAttackState; -typedef enum { +typedef enum EnTiteFlipState { /* 0x0 */ TEKTITE_INITIAL, /* 0x1 */ TEKTITE_UNFLIPPED, /* 0x2 */ TEKTITE_FLIPPED diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.h b/src/overlays/actors/ovl_En_Tite/z_en_tite.h index 2faaadf9cb..a049cabaae 100755 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.h +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.h @@ -8,7 +8,7 @@ struct EnTite; typedef void (*EnTiteActionFunc)(struct EnTite*, PlayState*); -typedef enum { +typedef enum EnTiteType { /* -2 */ TEKTITE_BLUE = -2, /* -1 */ TEKTITE_RED } EnTiteType; diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 93d2643bc4..3b285868c3 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -9,7 +9,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -typedef enum { +typedef enum EnTorch2ActionStates { /* 0 */ ENTORCH2_WAIT, /* 1 */ ENTORCH2_ATTACK, /* 2 */ ENTORCH2_DEATH, diff --git a/src/overlays/actors/ovl_En_Tp/z_en_tp.c b/src/overlays/actors/ovl_En_Tp/z_en_tp.c index d71f1d6171..e9cdc93a38 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -29,7 +29,7 @@ void EnTp_Head_Wait(EnTp* this, PlayState* play); void EnTp_Head_SetupBurrowReturnHome(EnTp* this); void EnTp_Head_BurrowReturnHome(EnTp* this, PlayState* play); -typedef enum { +typedef enum TailpasaranAction { /* 0 */ TAILPASARAN_ACTION_FRAGMENT_FADE, /* 1 */ TAILPASARAN_ACTION_DIE, /* 2 */ TAILPASARAN_ACTION_TAIL_FOLLOWHEAD, @@ -78,7 +78,7 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -typedef enum { +typedef enum TailpasaranDamageEffect { /* 00 */ TAILPASARAN_DMGEFF_NONE, /* 01 */ TAILPASARAN_DMGEFF_DEKUNUT, /* 14 */ TAILPASARAN_DMGEFF_SHOCKING = 14, // Kills the Tailpasaran but shocks Player diff --git a/src/overlays/actors/ovl_En_Tp/z_en_tp.h b/src/overlays/actors/ovl_En_Tp/z_en_tp.h index 03ae0d9fd8..f878ab934a 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.h +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.h @@ -28,7 +28,7 @@ typedef struct EnTp { /* 0x01D4 */ struct EnTp* head; } EnTp; // size = 0x01D8 -typedef enum { +typedef enum EnTpType { /* -1 */ TAILPASARAN_HEAD = -1, // Used when scenes spawn them: code only cares about < 0 /* 0 */ TAILPASARAN_TAIL, /* 10 */ TAILPASARAN_FRAGMENT = 10, diff --git a/src/overlays/actors/ovl_En_Tr/z_en_tr.h b/src/overlays/actors/ovl_En_Tr/z_en_tr.h index c3c5f74ae0..faf45d7400 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.h +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.h @@ -8,7 +8,7 @@ struct EnTr; typedef void (*EnTrActionFunc)(struct EnTr*, PlayState*); -typedef enum { +typedef enum KotakeKoumeLimb { /* 0 */ KOTAKE_KOUME_LIMB_NONE, /* 1 */ KOTAKE_KOUME_LIMB_PELVIS, /* 2 */ KOTAKE_KOUME_LIMB_LEFT_THIGH, @@ -53,7 +53,7 @@ typedef struct EnTr { /* 0x02E4 */ AnimationHeader* animation; } EnTr; // size = 0x02E8 -typedef enum { +typedef enum TwinrovaType { /* 0 */ TR_KOUME, /* 1 */ TR_KOTAKE } TwinrovaType; diff --git a/src/overlays/actors/ovl_En_Vali/z_en_vali.c b/src/overlays/actors/ovl_En_Vali/z_en_vali.c index a8f7574e6a..c6d765a1d8 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -83,7 +83,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit sColChkInfoInit = { 2, 18, 32, MASS_HEAVY }; -typedef enum { +typedef enum BariDamageEffect { /* 0x0 */ BARI_DMGEFF_NONE, /* 0x1 */ BARI_DMGEFF_STUN, /* 0x2 */ BARI_DMGEFF_FIRE, diff --git a/src/overlays/actors/ovl_En_Vali/z_en_vali.h b/src/overlays/actors/ovl_En_Vali/z_en_vali.h index 0c94d92288..c5df42825b 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.h +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.h @@ -8,7 +8,7 @@ struct EnVali; typedef void (*EnValiActionFunc)(struct EnVali*, PlayState*); -typedef enum { +typedef enum EnValiLimb { /* 0x00 */ EN_VALI_LIMB_NONE, /* 0x01 */ EN_VALI_LIMB_NUCLEUS_BASE, /* 0x02 */ EN_VALI_LIMB_NUCLEUS, @@ -57,7 +57,7 @@ typedef struct EnVali { /* 0x03FC */ ColliderCylinder bodyCollider; } EnVali; // size = 0x0448 -typedef enum { +typedef enum EnValiType { /* 0 */ BARI_TYPE_NORMAL, /* 1 */ BARI_TYPE_SWORD_DAMAGE } EnValiType; diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h index fee5fe7620..de2bf8ba27 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h @@ -10,7 +10,7 @@ typedef void (*EnViewerActionFunc)(struct EnViewer*, PlayState*); typedef void (*EnViewerDrawFunc)(struct EnViewer*, PlayState*); typedef void (*EnViewerInitAnimFunc)(struct EnViewer*, PlayState*, void*, AnimationHeader*); -typedef enum { +typedef enum EnViewerType { /* 0 */ ENVIEWER_TYPE_0_HORSE_ZELDA, /* 1 */ ENVIEWER_TYPE_1_IMPA, /* 2 */ ENVIEWER_TYPE_2_ZELDA, @@ -23,20 +23,20 @@ typedef enum { /* 9 */ ENVIEWER_TYPE_9_GANONDORF } EnViewerType; -typedef enum { +typedef enum EnViewerDrawType { /* 0 */ ENVIEWER_DRAW_GANONDORF, /* 1 */ ENVIEWER_DRAW_HORSE, /* 2 */ ENVIEWER_DRAW_ZELDA, /* 3 */ ENVIEWER_DRAW_IMPA } EnViewerDrawType; -typedef enum { +typedef enum EnViewerShadowType { /* 0 */ ENVIEWER_SHADOW_NONE, /* 1 */ ENVIEWER_SHADOW_CIRCLE, /* 2 */ ENVIEWER_SHADOW_HORSE } EnViewerShadowType; -typedef struct { +typedef struct EnViewerInitData { /* 0x00 */ s16 skeletonObject; /* 0x02 */ s16 animObject; /* 0x04 */ u8 scale; // divided by 100.0f @@ -48,7 +48,7 @@ typedef struct { /* 0x10 */ AnimationHeader* anim; } EnViewerInitData; // size = 0x14 -typedef struct { +typedef struct EnViewerFireEffect { /* 0x00 */ Vec3f startPos; /* 0x0C */ Vec3f endPos; /* 0x18 */ Vec3f pos; @@ -58,7 +58,7 @@ typedef struct { /* 0x30 */ u8 state; } EnViewerFireEffect; // size = 0x34 -typedef enum { +typedef enum YoungGanondorfLimb { /* 0 */ YOUNG_GANONDORF_LIMB_NONE, /* 1 */ YOUNG_GANONDORF_LIMB_ROOT, /* 2 */ YOUNG_GANONDORF_LIMB_TORSO, diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.h b/src/overlays/actors/ovl_En_Vm/z_en_vm.h index 2be67637c5..5b0fe1629e 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.h +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.h @@ -32,7 +32,7 @@ typedef struct EnVm { /* 0x0334 */ ColliderQuad colliderQuad2; } EnVm; // size = 0x03B4 -typedef enum { +typedef enum BeamosType { /* 0x00 */ BEAMOS_LARGE, /* 0x01 */ BEAMOS_SMALL } BeamosType; diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h index 8b2f8d7ba9..c82df375dc 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef enum { +typedef enum WallmasType { /* 0x00 */ WMT_TIMER, /* 0x01 */ WMT_PROXIMITY, /* 0x02 */ WMT_FLAG diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h index ec7c177341..ccfc0e3f67 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h @@ -14,7 +14,7 @@ typedef struct EnWeatherTag { /* 0x0150 */ char unk_150[0x04]; } EnWeatherTag; // size = 0x0154 -typedef enum { +typedef enum EnWeatherTagType { /* 0x00 */ EN_WEATHER_TAG_TYPE_CLOUDY_MARKET, /* 0x01 */ EN_WEATHER_TAG_TYPE_CLOUDY_LON_LON_RANCH, /* 0x02 */ EN_WEATHER_TAG_TYPE_SNOW_ZORAS_DOMAIN, diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index 00351e785e..15ba1fcbdf 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -143,7 +143,7 @@ static ColliderCylinderInit sTailCylinderInit = { { 15, 20, -15, { 0, 0, 0 } }, }; -typedef enum { +typedef enum EnWfDamageEffect { /* 0 */ ENWF_DMGEFF_NONE, /* 1 */ ENWF_DMGEFF_STUN, /* 6 */ ENWF_DMGEFF_ICE_MAGIC = 6, diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.h b/src/overlays/actors/ovl_En_Wf/z_en_wf.h index 36afdccf5e..83e46e6d19 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.h +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.h @@ -8,7 +8,7 @@ struct EnWf; typedef void (*EnWfActionFunc)(struct EnWf*, PlayState*); -typedef enum { +typedef enum EnWfLimb { /* 0 */ WOLFOS_LIMB_NONE, /* 1 */ WOLFOS_LIMB_ROOT, /* 2 */ WOLFOS_LIMB_BACK_LEFT_THIGH, @@ -34,7 +34,7 @@ typedef enum { /* 22 */ WOLFOS_LIMB_MAX } EnWfLimb; -typedef enum { +typedef enum EnWfAction { /* 0 */ WOLFOS_ACTION_WAIT_TO_APPEAR, /* 2 */ WOLFOS_ACTION_DIE = 2, /* 3 */ WOLFOS_ACTION_DAMAGED, @@ -83,7 +83,7 @@ typedef struct EnWf { /* 0x04D4 */ Vec3s unk_4D4; } EnWf; // size = 0x04DC -typedef enum { +typedef enum EnWfType { /* 0 */ WOLFOS_NORMAL, /* 1 */ WOLFOS_WHITE } EnWfType; diff --git a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h index 117b763c63..4aca3ffe0a 100644 --- a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h +++ b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h @@ -29,7 +29,7 @@ typedef struct EnWonderItem { /* 0x01CC */ char unk_1CC[4]; } EnWonderItem; // size = 0x01D0 -typedef enum { +typedef enum EnWonderItemMode { /* 0 */ WONDERITEM_MULTITAG_FREE, /* 1 */ WONDERITEM_TAG_POINT_FREE, /* 2 */ WONDERITEM_PROXIMITY_DROP, @@ -42,7 +42,7 @@ typedef enum { /* 9 */ WONDERITEM_ROLL_DROP } EnWonderItemMode; -typedef enum { +typedef enum EnWonderItemDrop { /* 0 */ WONDERITEM_DROP_NUTS, /* 1 */ WONDERITEM_DROP_HEART_PIECE, /* 2 */ WONDERITEM_DROP_MAGIC_LARGE, diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index c61f2f1aaa..a5fe529ebd 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -18,13 +18,13 @@ void EnWood02_Draw(Actor* thisx, PlayState* play); * WOOD_SPAWN_SPAWNER is also used by some individual trees: EnWood02_Update also checks for parent before running any * despawning code. * */ -typedef enum { +typedef enum WoodSpawnType { /* 0 */ WOOD_SPAWN_NORMAL, /* 1 */ WOOD_SPAWN_SPAWNED, /* 2 */ WOOD_SPAWN_SPAWNER } WoodSpawnType; -typedef enum { +typedef enum WoodDrawType { /* 0 */ WOOD_DRAW_TREE_CONICAL, /* 1 */ WOOD_DRAW_TREE_OVAL, /* 2 */ WOOD_DRAW_TREE_KAKARIKO_ADULT, diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.h b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.h index 85ec12a5b8..14ca5b967e 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.h +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.h @@ -17,7 +17,7 @@ typedef struct EnWood02 { // Types with SPAWNED in the name are those that can be managed by a spawner, however the actor allows you to spawn them // on their own without a spawner as well. -typedef enum { +typedef enum WoodType { /* 0x00 */ WOOD_TREE_CONICAL_LARGE, /* 0x01 */ WOOD_TREE_CONICAL_MEDIUM, /* 0x02 */ WOOD_TREE_CONICAL_SMALL, diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.h b/src/overlays/actors/ovl_En_Xc/z_en_xc.h index beac1a859b..c01b98a842 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.h +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.h @@ -9,7 +9,7 @@ struct EnXc; typedef void (*EnXcActionFunc)(struct EnXc*, PlayState*); typedef void (*EnXcDrawFunc)(struct Actor*, PlayState*); -typedef enum { +typedef enum EnXcType { /* 0 */ SHEIK_TYPE_0, /* 1 */ SHEIK_TYPE_1, /* 2 */ SHEIK_TYPE_2, @@ -22,7 +22,7 @@ typedef enum { /* 9 */ SHEIK_TYPE_9 } EnXcType; -typedef enum { +typedef enum EnXcDrawMode { /* 0 */ SHEIK_DRAW_NOTHING, /* 1 */ SHEIK_DRAW_DEFAULT, /* 2 */ SHEIK_DRAW_PULLING_OUT_HARP, @@ -31,7 +31,7 @@ typedef enum { /* 5 */ SHEIK_DRAW_SQUINT } EnXcDrawMode; -typedef enum { +typedef enum EnXcAction { /* 00 */ SHEIK_ACTION_INIT, /* 01 */ SHEIK_ACTION_WAIT, /* 02 */ SHEIK_ACTION_GRACEFUL_FALL, diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/src/overlays/actors/ovl_En_Zf/z_en_zf.c index a10d0321d2..f2aa8d29ab 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -151,7 +151,7 @@ static ColliderQuadInit sSwordQuadInit = { { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -typedef enum { +typedef enum EnZfDamageEffect { /* 0x0 */ ENZF_DMGEFF_NONE, /* 0x1 */ ENZF_DMGEFF_STUN, /* 0x6 */ ENZF_DMGEFF_IMMUNE = 6, // Skips damage code, but also skips the top half of Update diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.h b/src/overlays/actors/ovl_En_Zf/z_en_zf.h index b9bcea8000..c5ade78544 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.h +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.h @@ -8,14 +8,14 @@ struct EnZf; typedef void (*EnZfActionFunc)(struct EnZf*, PlayState*); -typedef enum { +typedef enum EnZfType { /* -2 */ ENZF_TYPE_DINOLFOS = -2, /* -1 */ ENZF_TYPE_LIZALFOS_LONE, // Not a miniboss, e.g. Spirit Temple /* 0 */ ENZF_TYPE_LIZALFOS_MINIBOSS_A, // Pair with B /* 1 */ ENZF_TYPE_LIZALFOS_MINIBOSS_B // Pair with A } EnZfType; -typedef enum { +typedef enum EnZfAction { /* 0 */ ENZF_ACTION_DROP_IN, /* 3 */ ENZF_ACTION_3 = 3, // stop and choose action? /* 5 */ ENZF_ACTION_APPROACH_PLAYER = 5, @@ -36,7 +36,7 @@ typedef enum { /* 22 */ ENZF_ACTION_JUMP_UP } EnZfAction; -typedef enum { +typedef enum EnZfLimb { /* 0x00 */ ENZF_LIMB_NONE, /* 0x01 */ ENZF_LIMB_ROOT, /* 0x02 */ ENZF_LIMB_BODY_ROOT, diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index f133f51c2e..3810b7cbeb 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -10,7 +10,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -typedef enum { +typedef enum EnZl4CutsceneState { /* 0 */ ZL4_CS_WAIT, /* 1 */ ZL4_CS_START, /* 2 */ ZL4_CS_MEET, @@ -22,7 +22,7 @@ typedef enum { /* 8 */ ZL4_CS_PLAN } EnZl4CutsceneState; -typedef enum { +typedef enum EnZl4EyeExpression { /* 0 */ ZL4_EYES_NEUTRAL, /* 1 */ ZL4_EYES_SHUT, /* 2 */ ZL4_EYES_LOOK_LEFT, @@ -32,14 +32,14 @@ typedef enum { /* 6 */ ZL4_EYES_OPEN } EnZl4EyeExpression; -typedef enum { +typedef enum EnZl4MouthExpression { /* 0 */ ZL4_MOUTH_NEUTRAL, /* 1 */ ZL4_MOUTH_HAPPY, /* 2 */ ZL4_MOUTH_WORRIED, /* 3 */ ZL4_MOUTH_SURPRISED } EnZl4MouthExpression; -typedef enum { +typedef enum EnZl4EyeState { /* 0 */ ZL4_EYE_OPEN, /* 1 */ ZL4_EYE_BLINK, /* 2 */ ZL4_EYE_SHUT, @@ -92,7 +92,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -typedef enum { +typedef enum EnZl4Animation { /* 0 */ ZL4_ANIM_0, /* 1 */ ZL4_ANIM_1, /* 2 */ ZL4_ANIM_2, diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index c54842fec8..69b577f064 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -9,7 +9,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -typedef enum { +typedef enum EnZoEffectType { /* 0 */ ENZO_EFFECT_NONE, /* 1 */ ENZO_EFFECT_RIPPLE, /* 2 */ ENZO_EFFECT_SPLASH, @@ -311,7 +311,7 @@ ActorProfile En_Zo_Profile = { /**/ EnZo_Draw, }; -typedef enum { +typedef enum EnZoAnimation { /* 0 */ ENZO_ANIM_0, /* 1 */ ENZO_ANIM_1, /* 2 */ ENZO_ANIM_2, diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.h b/src/overlays/actors/ovl_En_Zo/z_en_zo.h index 28eebdf464..837dd260cb 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.h +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.h @@ -8,7 +8,7 @@ struct EnZo; #define EN_ZO_EFFECT_COUNT 15 -typedef struct { +typedef struct EnZoEffect { /* 0x00 */ u8 type; /* 0x04 */ f32 scale; /* 0x08 */ f32 targetScale; diff --git a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c index 6cfd3dd927..f47520e573 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c @@ -12,12 +12,12 @@ #define FLAGS ACTOR_FLAG_4 -typedef struct { +typedef struct EnfHGPainting { /* 0x00 */ Vec3f pos; /* 0x0C */ s16 yRot; } EnfHGPainting; // size = 0x10 -typedef enum { +typedef enum EnfHGIntroState { /* 0 */ INTRO_WAIT, /* 1 */ INTRO_START, /* 2 */ INTRO_FENCE, diff --git a/src/overlays/actors/ovl_En_fHG/z_en_fhg.h b/src/overlays/actors/ovl_En_fHG/z_en_fhg.h index 2bde639715..5432f82341 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.h +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.h @@ -8,7 +8,7 @@ struct EnfHG; typedef void (*EnfHGActionFunc)(struct EnfHG*, PlayState*); -typedef enum { +typedef enum EnfHGSignal { /* 0 */ FHG_NO_SIGNAL, /* 1 */ FHG_RAISE_SPEAR, /* 2 */ FHG_REAR, diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index e2df751b53..b70769e2a6 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -30,14 +30,14 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2); void Fishing_DrawFish(Actor* thisx, PlayState* play); void Fishing_DrawOwner(Actor* thisx, PlayState* play); -typedef struct { +typedef struct FishingFishInit { /* 0x00 */ u8 isLoach; /* 0x02 */ Vec3s pos; /* 0x08 */ u8 baseLength; /* 0x0C */ f32 perception; } FishingFishInit; // size = 0x10 -typedef enum { +typedef enum FishingEffectType { /* 0x00 */ FS_EFF_NONE, /* 0x01 */ FS_EFF_RIPPLE, /* 0x02 */ FS_EFF_DUST_SPLASH, @@ -51,7 +51,7 @@ typedef enum { #define FISHING_EFFECT_COUNT 130 -typedef struct { +typedef struct FishingEffect { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f vel; /* 0x18 */ Vec3f accel; @@ -67,7 +67,7 @@ typedef struct { #define POND_PROP_COUNT 140 -typedef enum { +typedef enum FishingPropType { /* 0x00 */ FS_PROP_NONE, /* 0x01 */ FS_PROP_REED, /* 0x02 */ FS_PROP_LILY_PAD, @@ -76,12 +76,12 @@ typedef enum { /* 0x23 */ FS_PROP_INIT_STOP = 0x23 } FishingPropType; -typedef struct { +typedef struct FishingPropInit { /* 0x00 */ u8 type; /* 0x02 */ Vec3s pos; } FishingPropInit; // size = 0x08 -typedef struct { +typedef struct FishingProp { /* 0x00 */ Vec3f pos; /* 0x0C */ f32 rotX; /* 0x10 */ f32 rotY; @@ -96,14 +96,14 @@ typedef struct { /* 0x38 */ f32 drawDistance; } FishingProp; // size = 0x3C -typedef enum { +typedef enum FishingGroupFishType { /* 0x00 */ FS_GROUP_FISH_NONE, /* 0x01 */ FS_GROUP_FISH_NORMAL } FishingGroupFishType; #define GROUP_FISH_COUNT 60 -typedef struct { +typedef struct FishingGroupFish { /* 0x00 */ u8 type; /* 0x02 */ s16 timer; /* 0x04 */ Vec3f pos; @@ -121,7 +121,7 @@ typedef struct { /* 0x44 */ u8 shouldDraw; } FishingGroupFish; // size = 0x48 -typedef enum { +typedef enum FishingLureTypes { /* 0x00 */ FS_LURE_STOCK, /* 0x01 */ FS_LURE_UNK, // hinted at with an "== 1" /* 0x02 */ FS_LURE_SINKING @@ -166,7 +166,7 @@ static s32 sFishingTimePlayed = 0; static s16 sOwnerTheftTimer = 0; -typedef enum { +typedef enum FishingOwnerHair { /* 0x00 */ FS_OWNER_BALD, /* 0x01 */ FS_OWNER_CAPPED, /* 0x02 */ FS_OWNER_HAIR diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h index a77192c797..c5054884bd 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h @@ -18,7 +18,7 @@ typedef struct ItemEtcetera { /* 0x015C */ ItemEtceteraActionFunc actionFunc; } ItemEtcetera; // size = 0x0160 -typedef enum { +typedef enum ItemEtceteraType { /* 0x00 */ ITEM_ETC_BOTTLE, /* 0x01 */ ITEM_ETC_LETTER, /* 0x02 */ ITEM_ETC_SHIELD_HYLIAN, diff --git a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c index 34accd7558..6af9e712e7 100644 --- a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c +++ b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c @@ -15,14 +15,14 @@ void MagicFire_Draw(Actor* thisx, PlayState* play); void MagicFire_UpdateBeforeCast(Actor* thisx, PlayState* play); -typedef enum { +typedef enum MagicFireAction { /* 0x00 */ DF_ACTION_INITIALIZE, /* 0x01 */ DF_ACTION_EXPAND_SLOWLY, /* 0x02 */ DF_ACTION_STOP_EXPANDING, /* 0x03 */ DF_ACTION_EXPAND_QUICKLY } MagicFireAction; -typedef enum { +typedef enum MagicFireScreenTint { /* 0x00 */ DF_SCREEN_TINT_NONE, /* 0x01 */ DF_SCREEN_TINT_FADE_IN, /* 0x02 */ DF_SCREEN_TINT_MAINTAIN, diff --git a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c index 6828028abb..b8365df41d 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -17,7 +17,7 @@ void MirRay_Draw(Actor* thisx, PlayState* play); s32 MirRay_CheckInFrustum(Vec3f* vecA, Vec3f* vecB, f32 pointx, f32 pointy, f32 pointz, s16 radiusA, s16 radiusB); // Locations of light beams in sMirRayData -typedef enum { +typedef enum MirRayBeamLocations { /* 0 */ MIRRAY_SPIRIT_BOMBCHUIWAROOM_DOWNLIGHT, /* 1 */ MIRRAY_SPIRIT_SUNBLOCKROOM_DOWNLIGHT, /* 2 */ MIRRAY_SPIRIT_SINGLECOBRAROOM_DOWNLIGHT, diff --git a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.h b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.h index 0f645cb4f8..4e93149075 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.h +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.h @@ -6,7 +6,7 @@ struct MirRay; -typedef struct { +typedef struct MirRayDataEntry { /* 0x00 */ Vec3s sourcePoint; /* 0x06 */ Vec3s poolPoint; // point at center of light pool on floor for windows and BigMirror, same as source point for Cobra Mirror /* 0x0C */ s16 sourceEndRadius; // Radius of beam frustum at the source end @@ -19,7 +19,7 @@ typedef struct { /* 0x1F */ u8 params; } MirRayDataEntry; // size = 0x20 -typedef struct { +typedef struct MirRayShieldReflection { /* 0x00 */ Vec3f pos; /* 0x0C */ MtxF mtx; /* 0x4C */ CollisionPoly* reflectionPoly; diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index 5b5e2c7d7c..2e882d44c7 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -104,7 +104,7 @@ static ColliderCylinderInit sCylinderInit = { { 64, 30, -31, { 0, 0, 0 } }, }; -typedef struct { +typedef struct BeenSpeedInfo { f32 velocity; f32 accel; } BeenSpeedInfo; diff --git a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c index 303373ea7a..1a55ca7406 100644 --- a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c +++ b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c @@ -48,7 +48,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit sColChkInfoInit = { 0, 12, 60, MASS_IMMOVABLE }; -typedef struct { +typedef struct HanaParams { /* 0x00 */ Gfx* dList; /* 0x04 */ f32 scale; /* 0x08 */ f32 yOffset; diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index f51118f3cd..daa084ca09 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -38,7 +38,7 @@ ActorProfile Obj_Lift_Profile = { static s16 sFallTimerDurations[] = { 0, 10, 20, 30, 40, 50, 60 }; -typedef struct { +typedef struct ObjLiftFramgentScale { /* 0x00 */ s16 x; /* 0x02 */ s16 z; } ObjLiftFramgentScale; // size = 0x4 diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index 0ed3b55501..a61b6672a7 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -11,7 +11,7 @@ #define FLAGS ACTOR_FLAG_4 -typedef enum { +typedef enum FaceTextureIndex { /* 0x00 */ FACE_EYES_CLOSED, /* 0x01 */ FACE_EYES_OPEN, /* 0x02 */ FACE_EYES_OPEN_SMILING diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h index b8420f2d4e..78af71ed99 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h @@ -8,7 +8,7 @@ struct ObjLightswitch; typedef void (*ObjLightswitchActionFunc)(struct ObjLightswitch*, PlayState*); -typedef enum { +typedef enum ObjLightswitch_Type { /* 0 */ OBJLIGHTSWITCH_TYPE_STAY_ON, // doesn't turn off unless the switch flag is cleared some other way /* 1 */ OBJLIGHTSWITCH_TYPE_1, // turns on and off /* 2 */ OBJLIGHTSWITCH_TYPE_2, // turns on and off diff --git a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c index 234c012c35..34ca887b50 100644 --- a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c +++ b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c @@ -25,7 +25,7 @@ ActorProfile Obj_Makeoshihiki_Profile = { /**/ ObjMakeoshihiki_Draw, }; -typedef struct { +typedef struct BlockConfig { /* 0x00 */ Vec3f posVecs[3]; /* 0x24 */ u8 unk_24[3]; /* 0x27 */ u8 color; diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index e8c297d3a2..e76e2ecc84 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -31,7 +31,7 @@ ActorProfile Obj_Mure_Profile = { /**/ NULL, }; -typedef enum { +typedef enum ObjMureType { /* 0 */ OBJMURE_TYPE_GRASS, /* 1 */ OBJMURE_TYPE_UNDEFINED, /* 2 */ OBJMURE_TYPE_FISH, @@ -39,7 +39,7 @@ typedef enum { /* 4 */ OBJMURE_TYPE_BUTTERFLY } ObjMureType; -typedef enum { +typedef enum ObjMureChildState { /* 0 */ OBJMURE_CHILD_STATE_0, /* 1 */ OBJMURE_CHILD_STATE_1, // Dead /* 2 */ OBJMURE_CHILD_STATE_2 diff --git a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c index 9cb8cac7d8..f9cf6799ca 100644 --- a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c +++ b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c @@ -10,7 +10,7 @@ typedef void (*ObjMure2SetPosFunc)(Vec3f* vec, ObjMure2* this); -typedef struct { +typedef struct Mure2sScatteredShrubInfo { s16 radius; s16 angle; } Mure2sScatteredShrubInfo; diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h index ac4a135c4c..90dce5ca45 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h @@ -6,7 +6,7 @@ struct ObjOshihiki; -typedef enum { +typedef enum PushBlockType { /* 0 */ PUSHBLOCK_SMALL_START_ON, /* 1 */ PUSHBLOCK_MEDIUM_START_ON, /* 2 */ PUSHBLOCK_LARGE_START_ON, diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h index 8c12a9c85c..8fd130f8f5 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h @@ -8,7 +8,7 @@ struct ObjSwitch; typedef void (*ObjSwitchActionFunc)(struct ObjSwitch*, PlayState*); -typedef enum { +typedef enum ObjSwitchType { /* 0 */ OBJSWITCH_TYPE_FLOOR, /* 1 */ OBJSWITCH_TYPE_FLOOR_RUSTY, /* 2 */ OBJSWITCH_TYPE_EYE, @@ -16,7 +16,7 @@ typedef enum { /* 4 */ OBJSWITCH_TYPE_CRYSTAL_TARGETABLE } ObjSwitchType; -typedef enum { +typedef enum ObjSwitchSubType { /* 0 */ OBJSWITCH_SUBTYPE_ONCE, // Switches that can only be turned on (On -> Flag Set) /* 1 */ OBJSWITCH_SUBTYPE_TOGGLE, // Switches that can be turned on and off (On -> Flag Set, Off -> Flag Cleared) /* 2 */ OBJSWITCH_SUBTYPE_HOLD, // Floor Types only, released when not stood on (Down -> Flag Set, Up -> Flag Cleared) @@ -24,12 +24,12 @@ typedef enum { /* 4 */ OBJSWITCH_SUBTYPE_SYNC // Crystal Types only, syncs with the Switch Flag (On -> Flag Set, Off -> Flag Cleared) } ObjSwitchSubType; -typedef struct { +typedef struct ObjSwitchJntSph { /* 0x00 */ ColliderJntSph col; /* 0x20 */ ColliderJntSphElement items[1]; } ObjSwitchJntSph; -typedef struct { +typedef struct ObjSwitchTris { /* 0x00 */ ColliderTris col; /* 0x20 */ ColliderTrisElement items[2]; } ObjSwitchTris; diff --git a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c index 234d903d2f..8bbde05692 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -37,7 +37,7 @@ ActorProfile Obj_Timeblock_Profile = { /**/ ObjTimeblock_Draw, }; -typedef struct { +typedef struct ObjTimeblockSizeOptions { /* 0x00 */ f32 scale; /* 0x04 */ f32 height; /* 0x08 */ s16 demoEffectParams; diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index 76071db8fe..2d39250e0f 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -40,7 +40,7 @@ ActorProfile Obj_Warp2block_Profile = { /**/ ObjWarp2block_Draw, }; -typedef struct { +typedef struct Warp2BlockSpawnData { /* 0x00 */ f32 scale; /* 0x04 */ f32 focus; /* 0x08 */ s16 params; diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.h b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.h index 0b26239bad..9e5131737c 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.h +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef enum { +typedef enum OceffWipeType { /* 0x00 */ OCEFF_WIPE_ZL, /* 0x01 */ OCEFF_WIPE_SOT } OceffWipeType; diff --git a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.h b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.h index 6187289345..3986c1fce5 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.h +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef enum { +typedef enum OceffWipe4Type { /* 0x00 */ OCEFF_WIPE4_SCARECROWS, /* 0x01 */ OCEFF_WIPE4_UNUSED } OceffWipe4Type; diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index c1082be5b7..7809756148 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -33,7 +33,7 @@ ActorProfile Shot_Sun_Profile = { /**/ NULL, }; -typedef enum { +typedef enum FairySpawnerState { /* 0 */ SPAWNER_OUT_OF_RANGE, /* 1 */ SPAWNER_OCARINA_START, /* 2 */ SPAWNER_OCARINA_PLAYING diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index b8d1a8700e..d47b41372e 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -27,7 +27,7 @@ // This is called "adjusted" for now. #define PLAYER_ANIM_ADJUSTED_SPEED (2.0f / 3.0f) -typedef struct { +typedef struct GetItemEntry { /* 0x00 */ u8 itemId; /* 0x01 */ u8 field; // various bit-packed data /* 0x02 */ s8 gi; // defines the draw id and chest opening animation @@ -44,24 +44,24 @@ typedef struct { #define GET_ITEM_NONE \ { ITEM_NONE, 0, 0, 0, OBJECT_INVALID } -typedef struct { +typedef struct ExplosiveInfo { /* 0x00 */ u8 itemId; /* 0x02 */ s16 actorId; } ExplosiveInfo; // size = 0x04 -typedef struct { +typedef struct BottleCatchInfo { /* 0x00 */ s16 actorId; /* 0x02 */ u8 itemId; /* 0x03 */ u8 itemAction; /* 0x04 */ u8 textId; } BottleCatchInfo; // size = 0x06 -typedef struct { +typedef struct BottleDropInfo { /* 0x00 */ s16 actorId; /* 0x02 */ s16 actorParams; } BottleDropInfo; // size = 0x04 -typedef struct { +typedef struct FallImpactInfo { /* 0x00 */ s8 damage; /* 0x01 */ u8 rumbleStrength; /* 0x02 */ u8 rumbleDuration; @@ -69,12 +69,12 @@ typedef struct { /* 0x04 */ u16 sfxId; } FallImpactInfo; // size = 0x06 -typedef struct { +typedef struct SpecialRespawnInfo { /* 0x00 */ Vec3f pos; /* 0x0C */ s16 yaw; } SpecialRespawnInfo; // size = 0x10 -typedef enum { +typedef enum AnimSfxType { /* 1 */ ANIMSFX_TYPE_1 = 1, /* 2 */ ANIMSFX_TYPE_2, /* 3 */ ANIMSFX_TYPE_3, @@ -93,29 +93,29 @@ typedef enum { #define ANIMSFX_GET_TYPE(data) ((data)&0x7800) #define ANIMSFX_GET_FRAME(data) ((data)&0x7FF) -typedef struct { +typedef struct AnimSfxEntry { /* 0x00 */ u16 sfxId; /* 0x02 */ s16 data; } AnimSfxEntry; // size = 0x04 -typedef struct { +typedef struct struct_808551A4 { /* 0x00 */ u16 unk_00; /* 0x02 */ s16 unk_02; } struct_808551A4; // size = 0x04 -typedef struct { +typedef struct ItemChangeInfo { /* 0x00 */ LinkAnimationHeader* anim; /* 0x04 */ u8 changeFrame; } ItemChangeInfo; // size = 0x08 -typedef struct { +typedef struct struct_80854554 { /* 0x00 */ LinkAnimationHeader* unk_00; /* 0x04 */ LinkAnimationHeader* unk_04; /* 0x08 */ u8 unk_08; /* 0x09 */ u8 unk_09; } struct_80854554; // size = 0x0C -typedef struct { +typedef struct struct_80854190 { /* 0x00 */ LinkAnimationHeader* unk_00; /* 0x04 */ LinkAnimationHeader* unk_04; /* 0x08 */ LinkAnimationHeader* unk_08; @@ -123,13 +123,13 @@ typedef struct { /* 0x0D */ u8 unk_0D; } struct_80854190; // size = 0x10 -typedef struct { +typedef struct struct_80854578 { /* 0x00 */ LinkAnimationHeader* anim; /* 0x04 */ f32 unk_04; /* 0x04 */ f32 unk_08; } struct_80854578; // size = 0x0C -typedef struct { +typedef struct struct_80854B18 { /* 0x00 */ s8 type; /* 0x04 */ union { void* ptr; @@ -1395,7 +1395,7 @@ static void (*sItemActionInitFuncs[])(PlayState* play, Player* this) = { Player_InitDefaultIA, // PLAYER_IA_LENS_OF_TRUTH }; -typedef enum { +typedef enum ItemChangeType { /* 0 */ PLAYER_ITEM_CHG_0, /* 1 */ PLAYER_ITEM_CHG_1, /* 2 */ PLAYER_ITEM_CHG_2, @@ -3762,7 +3762,7 @@ s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYaw } } -typedef enum { +typedef enum ActionChangeIndex { /* 0 */ PLAYER_ACTION_CHG_0, /* 1 */ PLAYER_ACTION_CHG_1, /* 2 */ PLAYER_ACTION_CHG_2, @@ -3926,7 +3926,7 @@ s32 Player_TryActionChangeList(PlayState* play, Player* this, s8* actionChangeLi return false; } -typedef enum { +typedef enum PlayerActionInterruptResult { /* -1 */ PLAYER_INTERRUPT_NONE = -1, /* 0 */ PLAYER_INTERRUPT_NEW_ACTION, /* 1 */ PLAYER_INTERRUPT_MOVE @@ -11525,7 +11525,7 @@ skip_update:; } } -typedef struct { +typedef struct BunnyEarKinematics { /* 0x0 */ Vec3s rot; /* 0x6 */ Vec3s angVel; } BunnyEarKinematics; // size = 0xC diff --git a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h index 465997e758..b38f343e8e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h +++ b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsBlastParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.h b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.h index 1f7abc2f95..5d42b118c8 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.h +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsBombInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h index 454303b50b..249a2a6507 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsBomb2InitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h index c8a77cfb3e..3c3c8f80df 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h +++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsBubbleInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ f32 yPosOffset; /* 0x10 */ f32 yPosRandScale; diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h index 44f891a2e8..c59c9add92 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsDFireInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h index 62105f6201..0ea6bd0fda 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsDeadDbInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h index 3b3281cde4..80d46899e7 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsDeadDdInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h index d6a9b9afb8..3714bf41ba 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsDeadDsInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h b/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h index 624159f3d2..cdb20f640b 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsDeadSoundInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h index d7629b3b44..cac4c1a08c 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsDtBubbleInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h index a56bc38f52..5cb686ae94 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsDustInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c index 0845e34af9..8fd5f7d1e3 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c @@ -103,12 +103,12 @@ void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_en_fire.c", 213); } -typedef struct { +typedef struct FireActorF { /* 0x000 */ Actor actor; /* 0x14C */ Vec3f firePos[10]; } FireActorF; -typedef struct { +typedef struct FireActorS { /* 0x000 */ Actor actor; /* 0x14C */ Vec3s firePos[10]; } FireActorS; diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h index bf8839be95..c511827ecf 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsEnFireInitParams { /* 0x00 */ Actor* actor; /* 0x04 */ Vec3f pos; /* 0x10 */ s16 scale; diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h index 985e37b84d..22929d39dd 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsEnIceInitParams { /* 0x00 */ Actor* actor; /* 0x04 */ Vec3f pos; /* 0x10 */ f32 scale; diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h index cc05775c21..c8047d21fa 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsExtraInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; @@ -12,7 +12,7 @@ typedef struct { /* 0x26 */ s16 scoreIdx; } EffectSsExtraInitParams; // size = 0x28 -typedef enum { +typedef enum ExtraScoreIdx { /* 0 */ EXTRA_SCORE_30, /* 1 */ EXTRA_SCORE_60, /* 2 */ EXTRA_SCORE_100 diff --git a/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.h b/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.h index 01709c6aac..2e3eb74184 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.h +++ b/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsFcircleInitParams { /* 0x00 */ Actor* actor; /* 0x04 */ Vec3f pos; /* 0x10 */ s16 radius; diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h index 0d2d9616ef..be8d70bccd 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsFhgFlashInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; @@ -14,12 +14,12 @@ typedef struct { /* 0x2C */ u8 type; } EffectSsFhgFlashInitParams; // size = 0x30 -typedef enum { +typedef enum FhgFlashType { /* 0x00 */ FHGFLASH_LIGHTBALL, /* 0x01 */ FHGFLASH_SHOCK } FhgFlashType; -typedef enum { +typedef enum FhgFlashLightBallParam { /* 0x00 */ FHGFLASH_LIGHTBALL_GREEN, /* 0x01 */ FHGFLASH_LIGHTBALL_LIGHTBLUE, /* 0x02 */ FHGFLASH_LIGHTBALL_RED, @@ -31,7 +31,7 @@ typedef enum { /* 0x08 */ FHGFLASH_LIGHTBALL_WHITE2 } FhgFlashLightBallParam; -typedef enum { +typedef enum FhgFlashLightningParam { /* 0x00 */ FHGFLASH_SHOCK_NO_ACTOR, // Don't attach to any actor. Stays at a fixed position. /* 0x01 */ FHGFLASH_SHOCK_PLAYER, // Move to a random Player body part every frame. /* 0x02 */ FHGFLASH_SHOCK_PG // Move to a random Phantom Ganon body part every frame. diff --git a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h index 48b2079448..70f5df7e19 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h +++ b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsFireTailInitParams { /* 0x00 */ Actor* actor; /* 0x04 */ Vec3f pos; /* 0x10 */ f32 scale; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h index 1fb6af2f2e..cfb5dcfafb 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsGFireInitParams { /* 0x00 */ Vec3f pos; } EffectSsGFireInitParams; // size = 0xC diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.h b/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.h index a63e567e5e..ab1b97a1de 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsGMagmaInitParams { /* 0x00 */ Vec3f pos; } EffectSsGMagmaInitParams; // size = 0xC diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.h b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.h index d1993832c9..715e01e7db 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsGMagma2InitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Color_RGBA8 primColor; /* 0x10 */ Color_RGBA8 envColor; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h index afe8e89e10..63487ee0ca 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsGRippleInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ s16 radius; /* 0x0E */ s16 radiusMax; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h index a4a22cef1f..8627bc0528 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsGSpkInitParams { /* 0x00 */ Actor* actor; /* 0x04 */ Vec3f pos; /* 0x10 */ Vec3f velocity; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h index b761ce332e..c13e19cd1c 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsGSplashInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ u8 type; /* 0x0D */ u8 customColor; diff --git a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h index 9906994317..1385bee8c8 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h +++ b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsHahenInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h b/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h index 74f8e7f80b..6859910455 100644 --- a/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h +++ b/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h @@ -4,13 +4,13 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsHitMarkInitParams { /* 0x00 */ s32 type; /* 0x04 */ s16 scale; /* 0x08 */ Vec3f pos; } EffectSsHitMarkInitParams; // size = 0x14 -typedef enum { +typedef enum EffectSsHitmarkType { EFFECT_HITMARK_WHITE, EFFECT_HITMARK_DUST, EFFECT_HITMARK_RED, diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h index 2a697d74e3..f7b376a7ad 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsIcePieceInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ f32 scale; /* 0x10 */ Vec3f velocity; diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h index 08fc6f7451..64833be518 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsIceSmokeInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h index e8b2c617ca..1896b47a73 100644 --- a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsKFireInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h index 17a4c8da1a..bd55d5c3c5 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h +++ b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsKakeraInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f unk_18; @@ -24,7 +24,7 @@ typedef struct { #define KAKERA_OBJECT_DEFAULT -1 -typedef enum { +typedef enum KakeraColorIndex { /* -1 */ KAKERA_COLOR_NONE = -1, /* 0 */ KAKERA_COLOR_WHITE, /* 1 */ KAKERA_COLOR_BROWN diff --git a/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.h b/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.h index 290fec68d2..7f8c18da3e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.h +++ b/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsKiraKiraInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h index 758f2cce65..ad352e9013 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h +++ b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsLightningInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Color_RGBA8 primColor; /* 0x10 */ Color_RGBA8 envColor; diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h index 321fd334e6..18aaf0d200 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsSibukiInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.h b/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.h index c0201fba0c..7fb20d8b33 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.h +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsSibuki2InitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h index e29ca6e3f6..70aa558b65 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h +++ b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsSolderSrchBallInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c index b3dc6e8a40..77e907b295 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c @@ -20,7 +20,7 @@ EffectSsProfile Effect_Ss_Stick_Profile = { EffectSsStick_Init, }; -typedef struct { +typedef struct StickDrawInfo { /* 0x00 */ s16 objectId; /* 0x04 */ Gfx* displayList; } StickDrawInfo; diff --git a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.h b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.h index a3df5491c6..8e01aeb003 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.h +++ b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsStickInitParams { /* 0x00 */ Vec3f pos; /* 0x0C */ s16 yaw; } EffectSsStickInitParams; // size = 0x10 diff --git a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c index 29901a3874..acf3c9105b 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c @@ -18,7 +18,7 @@ EffectSsProfile Effect_Ss_Stone1_Profile = { EffectSsStone1_Init, }; -typedef struct { +typedef struct EffStoneDrawInfo { /* 0x00 */ void* texture; /* 0x04 */ Color_RGBA8 primColor; /* 0x08 */ Color_RGBA8 envColor; diff --git a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h index 680345014f..d329161277 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h +++ b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "global.h" -typedef struct { +typedef struct EffectSsStone1InitParams { /* 0x00 */ Vec3f pos; /* 0x00 */ s32 unk_C; } EffectSsStone1InitParams; // size = 0x diff --git a/src/overlays/gamestates/ovl_file_choose/file_select.h b/src/overlays/gamestates/ovl_file_choose/file_select.h index 15f78f1437..1bf1d79fb0 100644 --- a/src/overlays/gamestates/ovl_file_choose/file_select.h +++ b/src/overlays/gamestates/ovl_file_choose/file_select.h @@ -19,13 +19,13 @@ // Init mode: Initial setup as the file select is starting up, fades and slides in various menu elements // Config mode: Handles the bulk of the file select, various configuration tasks like picking a file, copy/erase, and the options menu // Select mode: Displays the selected file with various details about it, and allows the player to confirm and open it -typedef enum { +typedef enum MenuMode { /* 0 */ FS_MENU_MODE_INIT, /* 1 */ FS_MENU_MODE_CONFIG, /* 2 */ FS_MENU_MODE_SELECT } MenuMode; -typedef enum { +typedef enum ConfigMode { /* 00 */ CM_FADE_IN_START, /* 01 */ CM_FADE_IN_END, /* 02 */ CM_MAIN_MENU, @@ -69,7 +69,7 @@ typedef enum { /* 40 */ CM_UNUSED_DELAY } ConfigMode; -typedef enum { +typedef enum SelectMode { /* 0 */ SM_FADE_MAIN_TO_SELECT, /* 1 */ SM_MOVE_FILE_TO_TOP, /* 2 */ SM_FADE_IN_FILE_INFO, @@ -80,7 +80,7 @@ typedef enum { /* 7 */ SM_LOAD_GAME } SelectMode; -typedef enum { +typedef enum TitleLabel { /* 0 */ FS_TITLE_SELECT_FILE, // "Please select a file." /* 1 */ FS_TITLE_OPEN_FILE, // "Open this file?" /* 2 */ FS_TITLE_COPY_FROM, // "Copy which file?" @@ -92,7 +92,7 @@ typedef enum { /* 8 */ FS_TITLE_ERASE_COMPLETE // "File erased." } TitleLabel; -typedef enum { +typedef enum WarningLabel { /* -1 */ FS_WARNING_NONE = -1, /* 0 */ FS_WARNING_NO_FILE_COPY, // "No file to copy." /* 1 */ FS_WARNING_NO_FILE_ERASE, // "No file to erase." @@ -101,7 +101,7 @@ typedef enum { /* 4 */ FS_WARNING_FILE_IN_USE // "This file is in use." } WarningLabel; -typedef enum { +typedef enum MainMenuButtonIndex { /* 0 */ FS_BTN_MAIN_FILE_1, /* 1 */ FS_BTN_MAIN_FILE_2, /* 2 */ FS_BTN_MAIN_FILE_3, @@ -110,21 +110,21 @@ typedef enum { /* 5 */ FS_BTN_MAIN_OPTIONS } MainMenuButtonIndex; -typedef enum { +typedef enum CopyMenuButtonIndex { /* 0 */ FS_BTN_COPY_FILE_1, /* 1 */ FS_BTN_COPY_FILE_2, /* 2 */ FS_BTN_COPY_FILE_3, /* 3 */ FS_BTN_COPY_QUIT } CopyMenuButtonIndex; -typedef enum { +typedef enum EraseMenuButtonIndex { /* 0 */ FS_BTN_ERASE_FILE_1, /* 1 */ FS_BTN_ERASE_FILE_2, /* 2 */ FS_BTN_ERASE_FILE_3, /* 3 */ FS_BTN_ERASE_QUIT } EraseMenuButtonIndex; -typedef enum { +typedef enum SelectMenuButtonIndex { /* 0 */ FS_BTN_SELECT_FILE_1, /* 1 */ FS_BTN_SELECT_FILE_2, /* 2 */ FS_BTN_SELECT_FILE_3, @@ -132,29 +132,29 @@ typedef enum { /* 4 */ FS_BTN_SELECT_QUIT } SelectMenuButtonIndex; -typedef enum { +typedef enum ConfirmButtonIndex { /* 0 */ FS_BTN_CONFIRM_YES, /* 1 */ FS_BTN_CONFIRM_QUIT } ConfirmButtonIndex; -typedef enum { +typedef enum ActionButtonIndex { /* 0 */ FS_BTN_ACTION_COPY, /* 1 */ FS_BTN_ACTION_ERASE } ActionButtonIndex; -typedef enum { +typedef enum SettingIndex { /* 0 */ FS_SETTING_AUDIO, /* 1 */ FS_SETTING_TARGET } SettingIndex; -typedef enum { +typedef enum AudioOption { /* 0 */ FS_AUDIO_STEREO, /* 1 */ FS_AUDIO_MONO, /* 2 */ FS_AUDIO_HEADSET, /* 3 */ FS_AUDIO_SURROUND } AudioOption; -typedef enum { +typedef enum CharPage { /* 0 */ FS_CHAR_PAGE_HIRA, /* 1 */ FS_CHAR_PAGE_KATA, /* 2 */ FS_CHAR_PAGE_ENG, @@ -166,7 +166,7 @@ typedef enum { /* 8 */ FS_CHAR_PAGE_ENG_TO_KATA } CharPage; -typedef enum { +typedef enum KeyboardButton { /* 00 */ FS_KBD_BTN_HIRA, /* 01 */ FS_KBD_BTN_KATA, /* 02 */ FS_KBD_BTN_ENG, diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c index f369ce7f32..7e3ec55ee8 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c @@ -1384,7 +1384,7 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) { } #if OOT_NTSC -typedef struct { +typedef struct OptionsMenuTextureInfo { /* 0x00 */ void* texture[2]; /* 0x08 */ u16 width; /* 0x0A */ u16 height; @@ -1394,7 +1394,7 @@ typedef struct { #define OPTIONS_MENU_TEXTURE_WIDTH(info) info.width #define OPTIONS_MENU_TEXTURE_HEIGHT(info) info.height #else -typedef struct { +typedef struct OptionsMenuTextureInfo { /* 0x00 */ void* texture[3]; /* 0x0C */ u16 width[3]; /* 0x12 */ u16 height; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c index 7cb49d8f70..6b8b0d2f28 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c @@ -1,7 +1,7 @@ #include "z_kaleido_scope.h" #include "assets/textures/parameter_static/parameter_static.h" -typedef struct { +typedef struct PauseMapMarkInfo { /* 0x00 */ void* texture; /* 0x04 */ u32 imageFormat; /* 0x08 */ u32 imageSize; From 755604d5fff65365f90bcb9c9da6b2b8bd1b5d8c Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 12 Aug 2024 10:42:53 -0700 Subject: [PATCH 04/33] Match a bunch of overlay draw functions (#2034) * Match a bunch of actor draw functions * Change z_demo_gt.c draw functions to take Actor* thisx --- .../ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c | 11 ++-- .../ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c | 2 +- .../ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c | 1 - .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c | 12 ++-- .../ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c | 6 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 12 ++-- src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c | 41 ++++++------ src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h | 2 +- src/overlays/actors/ovl_En_Ba/z_en_ba.c | 14 ++--- .../actors/ovl_En_Bubble/z_en_bubble.c | 4 +- src/overlays/actors/ovl_En_Fd/z_en_fd.c | 4 +- .../actors/ovl_En_Fd_Fire/z_en_fd_fire.c | 22 +++---- .../actors/ovl_En_G_Switch/z_en_g_switch.c | 11 ++-- src/overlays/actors/ovl_En_Goma/z_en_goma.c | 1 + .../ovl_En_Po_Sisters/z_en_po_sisters.c | 11 ++-- src/overlays/actors/ovl_En_Zo/z_en_zo.c | 2 +- .../actors/ovl_Magic_Dark/z_magic_dark.c | 18 +++--- .../ovl_Obj_Lightswitch/z_obj_lightswitch.c | 63 +++++++++---------- .../actors/ovl_Obj_Switch/z_obj_switch.c | 24 +++---- .../actors/ovl_Obj_Switch/z_obj_switch.h | 1 + .../z_eff_ss_ice_smoke.c | 15 ++--- .../ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c | 1 - .../ovl_file_choose/z_file_nameset.c | 2 - 23 files changed, 131 insertions(+), 149 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c b/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c index 090076a438..f280634d9a 100644 --- a/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c +++ b/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c @@ -96,18 +96,19 @@ void BgGjyoBridge_Update(Actor* thisx, PlayState* play) { } void BgGjyoBridge_Draw(Actor* thisx, PlayState* play) { - BgGjyoBridge* this = (BgGjyoBridge*)thisx; + PlayState* play2 = (PlayState*)play; OPEN_DISPS(play->state.gfxCtx, "../z_bg_gjyo_bridge.c", 260); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TexScroll(play->state.gfxCtx, play->gameplayFrames & 127, play->gameplayFrames * -3 & 127, 32, 32)); + gSPSegment( + POLY_XLU_DISP++, 8, + Gfx_TexScroll(play->state.gfxCtx, play2->gameplayFrames & 127, play2->gameplayFrames * -3 & 127, 32, 32)); gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, -play->gameplayFrames & 127, 32, 32, 1, 0, - play->gameplayFrames & 127, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, -play2->gameplayFrames & 127, 32, 32, 1, 0, + play2->gameplayFrames & 127, 32, 32)); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_gjyo_bridge.c", 281), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c index 3d0ede852d..b736d24e4c 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c @@ -226,9 +226,9 @@ void BgHidanSima_Update(Actor* thisx, PlayState* play) { Gfx* func_8088EB54(PlayState* play, BgHidanSima* this, Gfx* gfx) { MtxF mtxF; - s32 phi_s5; s32 s3; s32 v0; + s32 phi_s5; f32 cos; f32 sin; s32 pad[2]; diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c index 7d779dc94a..f6bcd4283b 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c @@ -286,7 +286,6 @@ void BgMoriHashigo_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_hashigo.c", 516); Gfx_SetupDL_25Opa(play->state.gfxCtx); - if (1) {} gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_mori_hashigo.c", 521), diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c index 7e94e0cbef..b974fa3524 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c @@ -223,13 +223,13 @@ void BgMoriHineri_Update(Actor* thisx, PlayState* play) { void BgMoriHineri_DrawHallAndRoom(Actor* thisx, PlayState* play) { BgMoriHineri* this = (BgMoriHineri*)thisx; - s32 pad; + PlayState* play2 = (PlayState*)play; MtxF mtx; OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_hineri.c", 611); Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play2->objectCtx.slots[this->moriTexObjectSlot].segment); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_mori_hineri.c", 618), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sDLists[this->dyna.actor.params]); @@ -249,9 +249,9 @@ void BgMoriHineri_DrawHallAndRoom(Actor* thisx, PlayState* play) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDungeonDoorDL); } - if ((this->boxObjectSlot > 0) && ((this->boxObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_BOX)) > 0) && - Object_IsLoaded(&play->objectCtx, this->boxObjectSlot)) { - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->boxObjectSlot].segment); + if ((this->boxObjectSlot > 0) && ((this->boxObjectSlot = Object_GetSlot(&play2->objectCtx, OBJECT_BOX)) > 0) && + Object_IsLoaded(&play2->objectCtx, this->boxObjectSlot)) { + gSPSegment(POLY_OPA_DISP++, 0x06, play2->objectCtx.slots[this->boxObjectSlot].segment); gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); Matrix_Put(&mtx); Matrix_Translate(147.0f, -245.0f, -453.0f, MTXMODE_APPLY); @@ -262,7 +262,7 @@ void BgMoriHineri_DrawHallAndRoom(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_OPA_DISP++, gTreasureChestBossKeyChestFrontDL); Matrix_Put(&mtx); Matrix_Translate(167.0f, -218.0f, -453.0f, MTXMODE_APPLY); - if (Flags_GetTreasure(play, 0xE)) { + if (Flags_GetTreasure(play2, 0xE)) { Matrix_RotateZ(BINANG_TO_RAD(0x3500), MTXMODE_APPLY); } else { Matrix_RotateZ(M_PI, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c index a421d428dd..6b0a4a401e 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c +++ b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c @@ -82,7 +82,7 @@ void BgTokiHikari_Draw(Actor* thisx, PlayState* play) { } void func_808BA018(BgTokiHikari* this, PlayState* play) { - s32 pad; + PlayState* play2 = (PlayState*)play; OPEN_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 246); Gfx_SetupDL_25Opa(play->state.gfxCtx); @@ -94,9 +94,9 @@ void func_808BA018(BgTokiHikari* this, PlayState* play) { } else { gSPDisplayList(POLY_OPA_DISP++, object_toki_objects_DL_007E20); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - gSPSegment(POLY_XLU_DISP++, 8, Gfx_TexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 128, 64, 32)); + gSPSegment(POLY_XLU_DISP++, 8, Gfx_TexScroll(play->state.gfxCtx, 0, play2->gameplayFrames % 128, 64, 32)); - gSPSegment(POLY_XLU_DISP++, 9, Gfx_TexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 128, 64, 32)); + gSPSegment(POLY_XLU_DISP++, 9, Gfx_TexScroll(play->state.gfxCtx, 0, play2->gameplayFrames % 128, 64, 32)); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_toki_hikari.c", 278), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index cc5f87b0ca..d4b3b38d23 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -3150,7 +3150,7 @@ void BossSst_UpdateEffects(Actor* thisx, PlayState* play) { } void BossSst_DrawEffects(Actor* thisx, PlayState* play) { - s32 pad; + PlayState* play2 = (PlayState*)play; BossSst* this = (BossSst*)thisx; s32 i; BossSstEffect* effect; @@ -3161,15 +3161,15 @@ void BossSst_DrawEffects(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Xlu(play->state.gfxCtx); if (this->effectMode == BONGO_ICE) { gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, play->gameplayFrames % 256, 0x20, 0x10, - 1, 0, (play->gameplayFrames * 2) % 256, 0x40, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, play2->gameplayFrames % 256, 0x20, 0x10, + 1, 0, (play2->gameplayFrames * 2) % 256, 0x40, 0x20)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, this->effects[0].alpha); gSPDisplayList(POLY_XLU_DISP++, gBongoIceCrystalDL); for (i = 0; i < 18; i++) { effect = &this->effects[i]; if (effect->move) { - func_8003435C(&effect->pos, play); + func_8003435C(&effect->pos, play2); if (this->effects[0].status != 0) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); } else { @@ -3191,8 +3191,8 @@ void BossSst_DrawEffects(Actor* thisx, PlayState* play) { gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->gameplayFrames % 128, 0, 0x20, 0x40, - 1, 0, (play->gameplayFrames * -15) % 256, 0x20, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play2->gameplayFrames % 128, 0, 0x20, 0x40, + 1, 0, (play2->gameplayFrames * -15) % 256, 0x20, 0x40)); for (i = 0; i < 3; i++, scaleY -= 0.001f) { effect = &this->effects[i]; diff --git a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c index b9a1a9e116..fba91ea3fb 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c @@ -629,11 +629,11 @@ void DemoGt_Update8(DemoGt* this, PlayState* play) { func_8097EF00(this, play); } -void DemoGt_Draw1(DemoGt* this, PlayState* play) { +void DemoGt_Draw1(Actor* thisx, PlayState* play) { s32 pad; GraphicsContext* gfxCtx = play->state.gfxCtx; u32 gameplayFrames = play->gameplayFrames; - s16 pad2[2]; + DemoGt* this = (DemoGt*)thisx; s16 spC6; f32 spC0; f32 spBC; @@ -859,17 +859,18 @@ void DemoGt_Update9(DemoGt* this, PlayState* play) { func_8097FD70(this, play); } -void DemoGt_Draw2(DemoGt* this, PlayState* play) { +void DemoGt_Draw2(Actor* thisx, PlayState* play) { GraphicsContext* gfxCtx = play->state.gfxCtx; s32* unk198; s32* unk178; - s32 pad; + DemoGt* this = (DemoGt*)thisx; OPEN_DISPS(gfxCtx, "../z_demo_gt_part2.c", 470); Gfx_SetupDL_25Opa(gfxCtx); unk198 = this->unk_198; unk178 = this->unk_178; + if (1) {} gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_TwoTexScrollEnvColor(gfxCtx, 0, 0, unk198[0], 0x20, 0x40, 1, 0, unk198[1], 0x20, 0x40, unk178[0], unk178[1], unk178[2], 128)); @@ -1179,7 +1180,7 @@ void DemoGt_Update10(DemoGt* this, PlayState* play) { func_80980C90(this, play); } -void DemoGt_Draw3(DemoGt* this, PlayState* play) { +void DemoGt_Draw3(Actor* thisx, PlayState* play) { GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_demo_gt_part3.c", 1026); @@ -1258,11 +1259,11 @@ void DemoGt_Update16(DemoGt* this, PlayState* play) { } } -void DemoGt_Draw4(DemoGt* this, PlayState* play2) { +void DemoGt_Draw4(Actor* thisx, PlayState* play2) { GraphicsContext* gfxCtx; PlayState* play = play2; u16 csCurFrame = play->csCtx.curFrame; - s32 pad; + DemoGt* this = (DemoGt*)thisx; s16 sp76; f32 sp70; f32 sp6C; @@ -1381,9 +1382,9 @@ void DemoGt_Update17(DemoGt* this, PlayState* play) { } } -void DemoGt_Draw5(DemoGt* this, PlayState* play) { +void DemoGt_Draw5(Actor* thisx, PlayState* play) { GraphicsContext* gfxCtx; - s32 pad; + DemoGt* this = (DemoGt*)thisx; s16 sp76; f32 sp70; f32 sp6C; @@ -1478,9 +1479,9 @@ void DemoGt_Update18(DemoGt* this, PlayState* play) { } } -void DemoGt_Draw6(DemoGt* this, PlayState* play) { - DemoGt* this2 = this; - s16 sp78 = this2->unk_172; +void DemoGt_Draw6(Actor* thisx, PlayState* play) { + DemoGt* this = (DemoGt*)thisx; + s16 sp78 = this->unk_172; f32 sp74; f32 sp70; s16 sp6E; @@ -1570,8 +1571,8 @@ void DemoGt_Update14(DemoGt* this, PlayState* play) { func_80981CEC(this, play); } -void DemoGt_Draw7(DemoGt* this, PlayState* play) { - DemoGt* this2 = this; +void DemoGt_Draw7(Actor* thisx, PlayState* play) { + DemoGt* this = (DemoGt*)thisx; GraphicsContext* gfxCtx = play->state.gfxCtx; s16 sp6E; f32 sp68; @@ -1583,7 +1584,7 @@ void DemoGt_Draw7(DemoGt* this, PlayState* play) { Vec3f sp44; f32 sp40; - sp6E = this2->unk_172; + sp6E = this->unk_172; sp68 = fabsf(BINANG_TO_RAD(sp6E)); sp64 = kREG(75); sp62 = kREG(74) + 0x7FEC; @@ -1661,8 +1662,8 @@ void DemoGt_Update15(DemoGt* this, PlayState* play) { func_809820AC(this, play); } -void DemoGt_Draw8(DemoGt* this, PlayState* play) { - DemoGt* this2 = this; +void DemoGt_Draw8(Actor* thisx, PlayState* play) { + DemoGt* this = (DemoGt*)thisx; GraphicsContext* gfxCtx = play->state.gfxCtx; s16 sp6E; f32 sp68; @@ -1674,7 +1675,7 @@ void DemoGt_Draw8(DemoGt* this, PlayState* play) { Vec3f sp44; f32 sp40; - sp6E = this2->unk_172; + sp6E = this->unk_172; sp68 = fabsf(BINANG_TO_RAD(sp6E)); sp64 = kREG(78); sp62 = kREG(77) + 0xBE80; @@ -1763,7 +1764,7 @@ void DemoGt_Init(Actor* thisx, PlayState* play) { } } -void DemoGt_Draw0(DemoGt* this, PlayState* play) { +void DemoGt_Draw0(Actor* thisx, PlayState* play) { } static DemoGtDrawFunc sDrawFuncs[] = { @@ -1781,7 +1782,7 @@ void DemoGt_Draw(Actor* thisx, PlayState* play) { return; } - drawFunc(this, play); + drawFunc(thisx, play); } ActorProfile Demo_Gt_Profile = { diff --git a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h index 83cae1cc18..18b968b15c 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h @@ -7,7 +7,7 @@ struct DemoGt; typedef void (*DemoGtUpdateFunc)(struct DemoGt*, PlayState*); -typedef void (*DemoGtDrawFunc)(struct DemoGt*, PlayState*); +typedef void (*DemoGtDrawFunc)(Actor*, PlayState*); typedef struct DemoGt { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/src/overlays/actors/ovl_En_Ba/z_en_ba.c index 0f927d635d..a0b8c69a4c 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -499,15 +499,11 @@ void EnBa_Draw(Actor* thisx, PlayState* play) { Matrix_RotateZYX(this->unk_2A8[i].x, this->unk_2A8[i].y, this->unk_2A8[i].z, MTXMODE_APPLY); Matrix_Scale(this->unk_200[i].x, this->unk_200[i].y, this->unk_200[i].z, MTXMODE_APPLY); if ((i == 6) || (i == 13)) { - if (mtx) {} - switch (i) { - case 13: - Collider_UpdateSpheres(i, &this->collider); - break; - default: - Matrix_Scale(0.5f, 0.5f, 1.0f, MTXMODE_APPLY); - Collider_UpdateSpheres(8, &this->collider); - break; + if (i == 13) { + Collider_UpdateSpheres(i, &this->collider); + } else { + Matrix_Scale(0.5f, 0.5f, 1.0f, MTXMODE_APPLY); + Collider_UpdateSpheres(8, &this->collider); } } MATRIX_TO_MTX(mtx, "../z_en_ba.c", 970); diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index 093e9aa1b0..7d4c610481 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -405,7 +405,7 @@ void EnBubble_Update(Actor* thisx, PlayState* play) { void EnBubble_Draw(Actor* thisx, PlayState* play) { EnBubble* this = (EnBubble*)thisx; - u32 pad; + PlayState* play2 = (PlayState*)play; OPEN_DISPS(play->state.gfxCtx, "../z_en_bubble.c", 1175); @@ -413,7 +413,7 @@ void EnBubble_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Xlu(play->state.gfxCtx); Math_SmoothStepToF(&this->graphicRotSpeed, 16.0f, 0.2f, 1000.0f, 0.0f); Math_SmoothStepToF(&this->graphicEccentricity, 0.08f, 0.2f, 1000.0f, 0.0f); - Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_ReplaceRotation(&play2->billboardMtxF); Matrix_Scale(this->expansionWidth + 1.0f, this->expansionHeight + 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD((f32)play->state.frames) * this->graphicRotSpeed, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 86e3f7018b..53bc2e2285 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -771,7 +771,6 @@ void EnFd_Draw(Actor* thisx, PlayState* play) { EnFd_DrawEffectsFlames(this, play); Matrix_Pop(); if (this->actionFunc != EnFd_Reappear && !(this->fadeAlpha < 0.9f)) { - if (1) {} Gfx_SetupDL_25Xlu(play->state.gfxCtx); clampedHealth = CLAMP(thisx->colChkInfo.health - 1, 0, 23) / 8; gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, primColors[clampedHealth].r, primColors[clampedHealth].g, @@ -788,6 +787,9 @@ void EnFd_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFd_OverrideLimbDraw, EnFd_PostLimbDraw, this, POLY_XLU_DISP); } + + if (this->fadeAlpha) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_fd.c", 1822); } diff --git a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c index 942a8de3a0..31983c96dd 100644 --- a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c +++ b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c @@ -248,13 +248,11 @@ void EnFdFire_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_fd_fire.c", 572); - Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - sp8E = Math_Vec3f_Yaw(&scale, &this->actor.velocity) - Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); + Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, MTXMODE_NEW); + sp8E = Math_Vec3f_Yaw(&scale, &thisx->velocity) - Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); sp84 = fabsf(Math_CosS(sp8E)); sp88 = Math_SinS(sp8E); - sp80 = Math_Vec3f_DistXZ(&scale, &this->actor.velocity) / 1.5f; - if (1) {} - if (1) {} + sp80 = Math_Vec3f_DistXZ(&scale, &thisx->velocity) / 1.5f; Matrix_RotateY(BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000)), MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD((sp88 * -10.0f) * sp80), MTXMODE_APPLY); scale.x = scale.y = scale.z = this->scale * 0.001f; @@ -270,14 +268,12 @@ void EnFdFire_Draw(Actor* thisx, PlayState* play) { gSPSegment(POLY_XLU_DISP++, 0x8, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x40, 1, 0, play->state.frames * this->tile2Y, 0x20, 0x80)); - gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, primColors[((this->actor.params & 0x8000) >> 0xF)].r, - primColors[((this->actor.params & 0x8000) >> 0xF)].g, - primColors[((this->actor.params & 0x8000) >> 0xF)].b, - primColors[((this->actor.params & 0x8000) >> 0xF)].a); - gDPSetEnvColor(POLY_XLU_DISP++, envColors[((this->actor.params & 0x8000) >> 0xF)].r, - envColors[((this->actor.params & 0x8000) >> 0xF)].g, - envColors[((this->actor.params & 0x8000) >> 0xF)].b, - envColors[((this->actor.params & 0x8000) >> 0xF)].a); + gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, primColors[((thisx->params & 0x8000) >> 0xF)].r, + primColors[((thisx->params & 0x8000) >> 0xF)].g, primColors[((thisx->params & 0x8000) >> 0xF)].b, + primColors[((thisx->params & 0x8000) >> 0xF)].a); + gDPSetEnvColor(POLY_XLU_DISP++, envColors[((thisx->params & 0x8000) >> 0xF)].r, + envColors[((thisx->params & 0x8000) >> 0xF)].g, envColors[((thisx->params & 0x8000) >> 0xF)].b, + envColors[((thisx->params & 0x8000) >> 0xF)].a); gDPPipeSync(POLY_XLU_DISP++); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index 594ed758af..4aeda80522 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -454,15 +454,13 @@ void EnGSwitch_Update(Actor* thisx, PlayState* play) { } void EnGSwitch_DrawPot(Actor* thisx, PlayState* play) { - s32 pad; + PlayState* play2 = (PlayState*)play; EnGSwitch* this = (EnGSwitch*)thisx; if (!this->broken) { OPEN_DISPS(play->state.gfxCtx, "../z_en_g_switch.c", 918); - if (1) {} - - Gfx_SetupDL_25Opa(play->state.gfxCtx); + Gfx_SetupDL_25Opa(play2->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_en_g_switch.c", 925), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_tsubo_DL_0017C0); @@ -475,10 +473,9 @@ static void* sRupeeTextures[] = { }; void EnGSwitch_DrawRupee(Actor* thisx, PlayState* play) { - s32 pad; + PlayState* play2 = (PlayState*)play; EnGSwitch* this = (EnGSwitch*)thisx; - if (1) {} if (!this->broken) { OPEN_DISPS(play->state.gfxCtx, "../z_en_g_switch.c", 951); Gfx_SetupDL_25Opa(play->state.gfxCtx); @@ -490,7 +487,7 @@ void EnGSwitch_DrawRupee(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_en_g_switch.c", 961); } if (this->type == ENGSWITCH_TARGET_RUPEE) { - EnGSwitch_DrawEffects(this, play); + EnGSwitch_DrawEffects(this, play2); } } diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/src/overlays/actors/ovl_En_Goma/z_en_goma.c index 50dbe53d5f..ad518535b4 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -756,6 +756,7 @@ s32 EnGoma_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* 255); if (limbIndex == GOMA_LIMB_EYE_IRIS_ROOT1) { + if (1) {} rot->x += this->eyePitch; rot->y += this->eyeYaw; } else if (limbIndex == GOMA_LIMB_BODY && this->hurtTimer != 0) { diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 17fc773e97..a7de8c83dc 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -1340,13 +1340,13 @@ void EnPoSisters_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s void EnPoSisters_Draw(Actor* thisx, PlayState* play) { EnPoSisters* this = (EnPoSisters*)thisx; - u8 phi_s5; + s32 pad1; f32 phi_f20; s32 i; - u8 spE7; + u8 phi_s5; Color_RGBA8* temp_s1 = &D_80ADD700[this->unk_194]; Color_RGBA8* temp_s7 = &D_80ADD6F0[this->unk_194]; - s32 pad; + s32 pad2; OPEN_DISPS(play->state.gfxCtx, "../z_en_po_sisters.c", 2989); func_80ADC55C(this); @@ -1390,11 +1390,10 @@ void EnPoSisters_Draw(Actor* thisx, PlayState* play) { phi_s5 = ((32 - this->unk_19A) * 255) / 32; phi_f20 = 0.0035f; } else if (this->actionFunc == func_80ADBC88) { - //! @bug uninitialised spE7 - phi_s5 = spE7; + // phi_s5 initialized in loop below phi_f20 = 0.0027f; } else { - phi_s5 = spE7; + // phi_s5 initialized in loop below phi_f20 = this->actor.scale.x * 0.5f; } for (i = 0; i < this->unk_198; i++) { diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 69b577f064..ef37860e2a 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -172,7 +172,7 @@ void EnZo_UpdateEffectsSplashes(EnZo* this) { void EnZo_DrawEffectsRipples(EnZo* this, PlayState* play) { EnZoEffect* effect; s16 i; - u8 materialFlag; + s16 materialFlag; effect = this->effects; OPEN_DISPS(play->state.gfxCtx, "../z_en_zo_eff.c", 217); diff --git a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c index d1605484c0..cab83bbb76 100644 --- a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c +++ b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c @@ -240,10 +240,10 @@ void MagicDark_DiamondDraw(Actor* thisx, PlayState* play) { } void MagicDark_OrbDraw(Actor* thisx, PlayState* play) { - MagicDark* this = (MagicDark*)thisx; + PlayState* play2 = (PlayState*)play; Vec3f pos; - Player* player = GET_PLAYER(play); - s32 pad; + Player* player = GET_PLAYER(play2); + MagicDark* this = (MagicDark*)thisx; f32 sp6C = play->state.frames & 0x1F; if (this->timer < 32) { @@ -263,11 +263,11 @@ void MagicDark_OrbDraw(Actor* thisx, PlayState* play) { return; } - pos.x -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))) * - Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(play)))); - pos.y -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(play)))); - pos.z -= (this->actor.scale.x * 300.0f * Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))) * - Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(play)))); + pos.x -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play2))) * + Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(play2)))); + pos.y -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(play2)))); + pos.z -= (this->actor.scale.x * 300.0f * Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play2))) * + Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(play2)))); OPEN_DISPS(play->state.gfxCtx, "../z_magic_dark.c", 619); @@ -276,7 +276,7 @@ void MagicDark_OrbDraw(Actor* thisx, PlayState* play) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 150, 255, 255); Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_NEW); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play2->billboardMtxF, MTXMODE_APPLY); Matrix_Push(); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_magic_dark.c", 632), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index a61b6672a7..8a25bdef05 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -392,8 +392,8 @@ void ObjLightswitch_Update(Actor* thisx, PlayState* play2) { } } -void ObjLightswitch_DrawOpa(ObjLightswitch* this, PlayState* play) { - Actor* child; +void ObjLightswitch_DrawOpa(Actor* thisx, PlayState* play) { + ObjLightswitch* this = (ObjLightswitch*)thisx; Vec3f pos; Vec3s rot; @@ -404,18 +404,17 @@ void ObjLightswitch_DrawOpa(ObjLightswitch* this, PlayState* play) { (u8)(this->alpha >> 6)); gSPSegment(POLY_OPA_DISP++, 0x09, &D_80116280[2]); - if ((this->actor.params & 1) == 1) { - child = this->actor.child; - this->actor.world.pos.x = child->world.pos.x; - this->actor.world.pos.y = child->world.pos.y + 60.0f; - this->actor.world.pos.z = child->world.pos.z; - Math_Vec3f_Copy(&pos, &this->actor.world.pos); - Matrix_SetTranslateRotateYXZ(pos.x, pos.y, pos.z, &this->actor.shape.rot); - Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + if ((thisx->params & 1) == 1) { + thisx->world.pos.x = thisx->child->world.pos.x; + thisx->world.pos.y = thisx->child->world.pos.y + 60.0f; + thisx->world.pos.z = thisx->child->world.pos.z; + Math_Vec3f_Copy(&pos, &thisx->world.pos); + Matrix_SetTranslateRotateYXZ(pos.x, pos.y, pos.z, &thisx->shape.rot); + Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); } else { - pos.x = this->actor.world.pos.x; - pos.y = this->actor.world.pos.y + this->actor.shape.yOffset * this->actor.scale.y; - pos.z = this->actor.world.pos.z; + pos.x = thisx->world.pos.x; + pos.y = thisx->world.pos.y + thisx->shape.yOffset * thisx->scale.y; + pos.z = thisx->world.pos.z; } gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_obj_lightswitch.c", 841), @@ -423,18 +422,18 @@ void ObjLightswitch_DrawOpa(ObjLightswitch* this, PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sFaceTextures[this->faceTextureIndex])); gSPDisplayList(POLY_OPA_DISP++, object_lightswitch_DL_000260); - rot.x = this->actor.shape.rot.x; - rot.y = this->actor.shape.rot.y; - rot.z = this->actor.shape.rot.z + this->flameRingRot; + rot.x = thisx->shape.rot.x; + rot.y = thisx->shape.rot.y; + rot.z = thisx->shape.rot.z + this->flameRingRot; Matrix_SetTranslateRotateYXZ(pos.x, pos.y, pos.z, &rot); - Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_obj_lightswitch.c", 859), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_lightswitch_DL_000398); - rot.z = this->actor.shape.rot.z - this->flameRingRot; + rot.z = thisx->shape.rot.z - this->flameRingRot; Matrix_SetTranslateRotateYXZ(pos.x, pos.y, pos.z, &rot); - Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_obj_lightswitch.c", 873), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_lightswitch_DL_000408); @@ -442,8 +441,8 @@ void ObjLightswitch_DrawOpa(ObjLightswitch* this, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_obj_lightswitch.c", 878); } -void ObjLightswitch_DrawXlu(ObjLightswitch* this, PlayState* play) { - s32 pad; +void ObjLightswitch_DrawXlu(Actor* thisx, PlayState* play) { + ObjLightswitch* this = (ObjLightswitch*)thisx; Vec3f sp68; Vec3s sp60; @@ -454,28 +453,28 @@ void ObjLightswitch_DrawXlu(ObjLightswitch* this, PlayState* play) { (u8)(this->alpha >> 6)); gSPSegment(POLY_XLU_DISP++, 0x09, D_80116280); - sp68.x = this->actor.world.pos.x; - sp68.y = this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y); - sp68.z = this->actor.world.pos.z; + sp68.x = thisx->world.pos.x; + sp68.y = thisx->world.pos.y + (thisx->shape.yOffset * thisx->scale.y); + sp68.z = thisx->world.pos.z; gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_obj_lightswitch.c", 912), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sFaceTextures[this->faceTextureIndex])); gSPDisplayList(POLY_XLU_DISP++, object_lightswitch_DL_000260); - sp60.x = this->actor.shape.rot.x; - sp60.y = this->actor.shape.rot.y; - sp60.z = this->actor.shape.rot.z + this->flameRingRot; + sp60.x = thisx->shape.rot.x; + sp60.y = thisx->shape.rot.y; + sp60.z = thisx->shape.rot.z + this->flameRingRot; Matrix_SetTranslateRotateYXZ(sp68.x, sp68.y, sp68.z, &sp60); - Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_obj_lightswitch.c", 930), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_lightswitch_DL_000398); - sp60.z = this->actor.shape.rot.z - this->flameRingRot; + sp60.z = thisx->shape.rot.z - this->flameRingRot; Matrix_SetTranslateRotateYXZ(sp68.x, sp68.y, sp68.z, &sp60); - Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_obj_lightswitch.c", 944), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_lightswitch_DL_000408); @@ -492,8 +491,8 @@ void ObjLightswitch_Draw(Actor* thisx, PlayState* play) { } if ((this->actor.params >> 4 & 3) == OBJLIGHTSWITCH_TYPE_BURN && (alpha > 0 || alpha < 255)) { - ObjLightswitch_DrawXlu(this, play); + ObjLightswitch_DrawXlu(thisx, play); } else { - ObjLightswitch_DrawOpa(this, play); + ObjLightswitch_DrawOpa(thisx, play); } } diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index fcaf50a340..9a43f8a7da 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -741,7 +741,7 @@ void ObjSwitch_Update(Actor* thisx, PlayState* play) { } } -void ObjSwitch_DrawFloor(ObjSwitch* this, PlayState* play) { +void ObjSwitch_DrawFloor(Actor* thisx, PlayState* play) { static Gfx* floorSwitchDLists[] = { gFloorSwitch1DL, // OBJSWITCH_SUBTYPE_ONCE gFloorSwitch3DL, // OBJSWITCH_SUBTYPE_TOGGLE @@ -749,14 +749,14 @@ void ObjSwitch_DrawFloor(ObjSwitch* this, PlayState* play) { gFloorSwitch2DL, // OBJSWITCH_SUBTYPE_HOLD_INVERTED }; - Gfx_DrawDListOpa(play, floorSwitchDLists[OBJSWITCH_SUBTYPE(&this->dyna.actor)]); + Gfx_DrawDListOpa(play, floorSwitchDLists[OBJSWITCH_SUBTYPE(thisx)]); } -void ObjSwitch_DrawFloorRusty(ObjSwitch* this, PlayState* play) { +void ObjSwitch_DrawFloorRusty(Actor* thisx, PlayState* play) { Gfx_DrawDListOpa(play, gRustyFloorSwitchDL); } -void ObjSwitch_DrawEye(ObjSwitch* this, PlayState* play) { +void ObjSwitch_DrawEye(Actor* thisx, PlayState* play) { static void* eyeTextures[][4] = { // OBJSWITCH_SUBTYPE_ONCE { gEyeSwitchGoldOpenTex, gEyeSwitchGoldOpeningTex, gEyeSwitchGoldClosingTex, gEyeSwitchGoldClosedTex }, @@ -767,7 +767,7 @@ void ObjSwitch_DrawEye(ObjSwitch* this, PlayState* play) { gEyeSwitch1DL, // OBJSWITCH_SUBTYPE_ONCE gEyeSwitch2DL, // OBJSWITCH_SUBTYPE_TOGGLE }; - s32 pad; + ObjSwitch* this = (ObjSwitch*)thisx; s32 subType = OBJSWITCH_SUBTYPE(&this->dyna.actor); OPEN_DISPS(play->state.gfxCtx, "../z_obj_switch.c", 1459); @@ -781,7 +781,7 @@ void ObjSwitch_DrawEye(ObjSwitch* this, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_obj_switch.c", 1471); } -void ObjSwitch_DrawCrystal(ObjSwitch* this, PlayState* play) { +void ObjSwitch_DrawCrystal(Actor* thisx, PlayState* play) { static Gfx* xluDLists[] = { gCrystalSwitchCoreXluDL, // OBJSWITCH_SUBTYPE_ONCE gCrystalSwitchDiamondXluDL, // OBJSWITCH_SUBTYPE_TOGGLE @@ -796,15 +796,13 @@ void ObjSwitch_DrawCrystal(ObjSwitch* this, PlayState* play) { NULL, // OBJSWITCH_SUBTYPE_HOLD_INVERTED gCrystalSwitchCoreOpaDL // OBJSWITCH_SUBTYPE_SYNC }; - s32 pad1; - s32 pad2; + ObjSwitch* this = (ObjSwitch*)thisx; + s32 pad; s32 subType; subType = OBJSWITCH_SUBTYPE(&this->dyna.actor); func_8002ED80(&this->dyna.actor, play, 0); - if (1) {} - OPEN_DISPS(play->state.gfxCtx, "../z_obj_switch.c", 1494); Gfx_SetupDL_25Xlu(play->state.gfxCtx); @@ -833,7 +831,7 @@ void ObjSwitch_DrawCrystal(ObjSwitch* this, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_obj_switch.c", 1533); } -static ObjSwitchActionFunc sDrawFuncs[] = { +static ObjSwitchDrawFunc sDrawFuncs[] = { ObjSwitch_DrawFloor, // OBJSWITCH_TYPE_FLOOR ObjSwitch_DrawFloorRusty, // OBJSWITCH_TYPE_FLOOR_RUSTY ObjSwitch_DrawEye, // OBJSWITCH_TYPE_EYE @@ -842,7 +840,5 @@ static ObjSwitchActionFunc sDrawFuncs[] = { }; void ObjSwitch_Draw(Actor* thisx, PlayState* play) { - ObjSwitch* this = (ObjSwitch*)thisx; - - sDrawFuncs[OBJSWITCH_TYPE(&this->dyna.actor)](this, play); + sDrawFuncs[OBJSWITCH_TYPE(thisx)](thisx, play); } diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h index 8fd130f8f5..b6fb243f70 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h @@ -7,6 +7,7 @@ struct ObjSwitch; typedef void (*ObjSwitchActionFunc)(struct ObjSwitch*, PlayState*); +typedef void (*ObjSwitchDrawFunc)(Actor*, PlayState*); typedef enum ObjSwitchType { /* 0 */ OBJSWITCH_TYPE_FLOOR, diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c index 5801220095..135d2ff43a 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c @@ -51,23 +51,19 @@ u32 EffectSsIceSmoke_Init(PlayState* play, u32 index, EffectSs* this, void* init } void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this) { - s32 pad; + PlayState* play2 = (PlayState*)play; void* objectPtr; Mtx* mtx; f32 scale; s32 objectSlot; - objectPtr = play->objectCtx.slots[this->rObjectSlot].segment; + objectPtr = play2->objectCtx.slots[this->rObjectSlot].segment; OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_ice_smoke.c", 155); -#if !OOT_DEBUG - if (1) {} -#endif + objectSlot = Object_GetSlot(&play2->objectCtx, OBJECT_FZ); - objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_FZ); - - if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { + if ((objectSlot >= 0) && Object_IsLoaded(&play2->objectCtx, objectSlot)) { gDPPipeSync(POLY_XLU_DISP++); Gfx_SetupDL_25Xlu(play->state.gfxCtx); gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); @@ -79,13 +75,14 @@ void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this) { Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, this->life * 3, this->life * 15, 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_ReplaceRotation(&play2->billboardMtxF); scale = this->rScale * 0.0001f; Matrix_Scale(scale, scale, 1.0f, MTXMODE_APPLY); mtx = MATRIX_NEW(play->state.gfxCtx, "../z_eff_ss_ice_smoke.c", 196); if (mtx != NULL) { + if (1) {} gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gFreezardSteamDL)); } diff --git a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c index acf3c9105b..d876ab0cf1 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c @@ -62,7 +62,6 @@ void EffectSsStone1_Draw(PlayState* play, u32 index, EffectSs* this) { scale = (mfW < 1500.0f) ? 3.0f : (mfW / 1500.0f) * 3.0f; Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - if (1) {} gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gfxCtx, "../z_eff_ss_stone1.c", 168), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Gfx_SetupDL_61Xlu(gfxCtx); diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c index 7e3ec55ee8..a412b17c46 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c @@ -180,8 +180,6 @@ void FileSelect_SetNameEntryVtx(GameState* thisx) { #endif s16 phi_v0; - if (1) {} - OPEN_DISPS(this->state.gfxCtx, "../z_file_nameset_PAL.c", 205); gDPPipeSync(POLY_OPA_DISP++); From f6338bab1fa1fd73af706dd6fe0070a3b4b2f27c Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 12 Aug 2024 11:17:04 -0700 Subject: [PATCH 05/33] Fix tools/ido_block_numbers.py (#2037) --- tools/ido_block_numbers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ido_block_numbers.py b/tools/ido_block_numbers.py index f45bb9745d..a3650e4dff 100755 --- a/tools/ido_block_numbers.py +++ b/tools/ido_block_numbers.py @@ -538,7 +538,7 @@ def main(): file=sys.stderr, ) sys.exit(1) - print(f"Compiler command: {shlex.join(compiler_command_line)}", file=sys.stderr) + print(f"Compiler command: {shlex.join(command_line)}", file=sys.stderr) symbol_table, ucode = run_cfe(command_line, args.keep_files) print_symbol_table(symbol_table) From 91a534cbc9cb4e0b7e5a1198731b1b66972e7b43 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 14 Aug 2024 10:05:36 +0200 Subject: [PATCH 06/33] Rewrite preprocess.py with bash and C (#2035) * add C preprocess_pragmas and Bash preprocess * "line return" -> newline * align tools sources * fix: handle files that are not newline-terminated * use a temp directory with a same-basename file instead of a temp file * macos compat * remove debug code --- Makefile | 2 +- tools/.gitignore | 1 + tools/Makefile | 15 ++-- tools/preprocess.py | 110 -------------------------- tools/preprocess.sh | 83 ++++++++++++++++++++ tools/preprocess_pragmas.c | 154 +++++++++++++++++++++++++++++++++++++ 6 files changed, 247 insertions(+), 118 deletions(-) delete mode 100755 tools/preprocess.py create mode 100755 tools/preprocess.sh create mode 100644 tools/preprocess_pragmas.c diff --git a/Makefile b/Makefile index 4a7ec5ac8b..c5eaeff79a 100644 --- a/Makefile +++ b/Makefile @@ -452,7 +452,7 @@ $(BUILD_DIR)/src/code/jpegdecoder.o: CC := $(CC_OLD) ifeq ($(PERMUTER),) # permuter + preprocess.py misbehaves, permuter doesn't care about rodata diffs or bss ordering so just don't use it in that case # Handle encoding (UTF-8 -> EUC-JP) and custom pragmas -$(BUILD_DIR)/src/%.o: CC := $(PYTHON) tools/preprocess.py -v $(VERSION) -- $(CC) +$(BUILD_DIR)/src/%.o: CC := ./tools/preprocess.sh -v $(VERSION) -- $(CC) endif else diff --git a/tools/.gitignore b/tools/.gitignore index 4dff1be3ae..9583c693b9 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -4,6 +4,7 @@ elf2rom makeromfs mkdmadata mkldscript +preprocess_pragmas reloc_prereq vtxdis yaz0 diff --git a/tools/Makefile b/tools/Makefile index 62bc881e17..3cde87ebc2 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,5 +1,5 @@ CFLAGS := -Wall -Wextra -pedantic -std=c99 -g -O2 -PROGRAMS := elf2rom makeromfs mkdmadata mkldscript reloc_prereq vtxdis +PROGRAMS := elf2rom makeromfs mkdmadata mkldscript preprocess_pragmas reloc_prereq vtxdis ifeq ($(shell command -v clang >/dev/null 2>&1; echo $$?),0) CC := clang @@ -33,12 +33,13 @@ distclean: clean .PHONY: all clean distclean -elf2rom_SOURCES := elf2rom.c elf32.c n64chksum.c util.c -makeromfs_SOURCES := makeromfs.c n64chksum.c util.c -mkdmadata_SOURCES := mkdmadata.c spec.c util.c -mkldscript_SOURCES := mkldscript.c spec.c util.c -reloc_prereq_SOURCES := reloc_prereq.c spec.c util.c -vtxdis_SOURCES := vtxdis.c +elf2rom_SOURCES := elf2rom.c elf32.c n64chksum.c util.c +makeromfs_SOURCES := makeromfs.c n64chksum.c util.c +mkdmadata_SOURCES := mkdmadata.c spec.c util.c +mkldscript_SOURCES := mkldscript.c spec.c util.c +preprocess_pragmas_SOURCES := preprocess_pragmas.c +reloc_prereq_SOURCES := reloc_prereq.c spec.c util.c +vtxdis_SOURCES := vtxdis.c define COMPILE = diff --git a/tools/preprocess.py b/tools/preprocess.py deleted file mode 100755 index c39bf835c8..0000000000 --- a/tools/preprocess.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python3 - -# SPDX-FileCopyrightText: © 2024 ZeldaRET -# SPDX-License-Identifier: CC0-1.0 - -# Usage: preprocess.py [flags] -- [compile command minus input file...] [single input file] -# Preprocess a C file to: -# * Re-encode from UTF-8 to EUC-JP (the repo uses UTF-8 for text encoding, but -# the strings in the ROM are encoded in EUC-JP) -# * Replace `#pragma increment_block_number` with fake structs for controlling BSS ordering - -import argparse -from pathlib import Path -import re -import tempfile -import subprocess -import sys -import typing - - -def fail(message): - print(message, file=sys.stderr) - sys.exit(1) - - -def process_file( - version: str, - filename: str, - input: typing.TextIO, - output: typing.TextIO, -): - output.write(f'#line 1 "{filename}"\n') - # whether the current line follows a #pragma increment_block_number, - # including continuation lines (lines after a \-ending line) - in_pragma_incblocknum = False - # the line where the #pragma increment_block_number is - pragma_incblocknum_first_line_num = None - # all the lines from the #pragma increment_block_number line to the last - # continuation line, as a list[str] - pragma_incblocknum_lines = None - for i, line in enumerate(input, start=1): - if not in_pragma_incblocknum and line.startswith( - "#pragma increment_block_number" - ): - in_pragma_incblocknum = True - pragma_incblocknum_first_line_num = i - pragma_incblocknum_lines = [] - - if in_pragma_incblocknum: - if line.endswith("\\\n"): - pragma_incblocknum_lines.append(line) - else: - in_pragma_incblocknum = False - pragma_incblocknum_lines.append(line) - amount = 0 - for s in pragma_incblocknum_lines: - # Note if we had two versions like "abc-def-version" and "def-version" - # then this code would find either given "def-version", but - # thankfully we don't have such nested version names. - m = re.search(rf"{version}:(\d+)\b", s) - if m: - amount = int(m.group(1)) - break - - # Always generate at least one struct, - # so that fix_bss.py can know where the increment_block_number pragmas are - if amount == 0: - amount = 256 - - # Write fake structs for BSS ordering - # pragma_incblocknum_first_line_num is used for symbol uniqueness, and - # also by fix_bss.py to locate the pragma these symbols originate from. - for j in range(amount): - output.write( - "struct increment_block_number_" - f"{pragma_incblocknum_first_line_num:05}_{j:03};\n" - ) - output.write(f'#line {i + 1} "{filename}"\n') - else: - output.write(line) - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument("-v", "--oot-version", help="Which version should be processed") - parser.add_argument( - "args", - nargs="+", - ) - - args = parser.parse_args() - - filename = Path(args.args[-1]) - with tempfile.TemporaryDirectory(prefix="oot_") as tmpdir: - tmpfile = Path(tmpdir) / filename.name - - with open(filename, mode="r", encoding="utf-8") as input: - with open(tmpfile, mode="w", encoding="euc-jp") as output: - process_file(args.oot_version, filename, input, output) - - compile_command = args.args[:-1] + ["-I", filename.parent, tmpfile] - process = subprocess.run(compile_command) - return process.returncode - - -if __name__ == "__main__": - try: - sys.exit(main()) - except KeyboardInterrupt: - sys.exit(1) diff --git a/tools/preprocess.sh b/tools/preprocess.sh new file mode 100755 index 0000000000..e29c751727 --- /dev/null +++ b/tools/preprocess.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: © 2024 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +# Usage: preprocess [flags] -- [compile command minus input file...] [single input file] +# Flags: -v OOT_VERSION (required) +# Preprocess a C file to: +# * Re-encode from UTF-8 to EUC-JP +# (the repo uses UTF-8 for text encoding, but the strings in the ROM are encoded in EUC-JP) +# * Replace `#pragma increment_block_number` (see preprocess_pragma) + +set -e +set -o pipefail + +if [ "${VERBOSE-}" ] +then + set -x +fi + +for i in `seq ${#@}` +do + if [[ "${!i}" = '--' ]] + then + # flags before -- + flags=("${@:1:$(($i - 1))}") + # compile command, betwen -- and the input source file + compilecmd="${@:$(($i + 1)):$((${#@} - $i - 1))}" + # The last argument, the input source file to be compiled + srcfile="${@: -1}" + break + fi +done + +if [ "${VERBOSE-}" ] +then + echo flags="${flags[@]}" + echo compilecmd="$compilecmd" + echo srcfile="$srcfile" +fi + +while getopts "v:" opt "${flags[@]}" +do + case $opt in + v) + OOT_VERSION=$OPTARG + ;; + ?) + echo "Error: Bad flags" + exit 1 + ;; + esac +done + +if [[ "${!OPTIND}" != '--' ]] +then + echo "Error: Positional arguments in flags not allowed" + exit 1 +fi + +if [ -z "${OOT_VERSION-}" ] +then + echo Missing -v + exit +fi + +# Create a temporary directory, and remove it on script exit +# We use a temp dir instead of a temp file because ido_block_numbers.py and fix_bss.py +# need the symbol table .T file from IDO, which is always named like the input file. +# So we use a file named like the original input file, inside a temp dir. +tempdir=`mktemp -d` +tempfile=$tempdir/`basename $srcfile` +trap "rm -rf $tempdir" EXIT + +# Preprocess pragmas and re-encode from UTF-8 to EUC-JP +{ + printf '#line 1 "%s"\n' "$srcfile" # linemarker + ./tools/preprocess_pragmas $OOT_VERSION "$srcfile" < "$srcfile" +} | iconv -f UTF-8 -t EUC-JP > "$tempfile" + +# Also include the source file's directory to have the include path as if we compiled the original source. +# Pass the processed temporary file for compilation. +$compilecmd -I `dirname $srcfile` $tempfile diff --git a/tools/preprocess_pragmas.c b/tools/preprocess_pragmas.c new file mode 100644 index 0000000000..e31b863d07 --- /dev/null +++ b/tools/preprocess_pragmas.c @@ -0,0 +1,154 @@ + +// SPDX-FileCopyrightText: © 2024 ZeldaRET +// SPDX-License-Identifier: CC0-1.0 + +// Usage: preprocess_pragmas OOT_VERSION filename < source.c +// The filename argument is only used for linemarkers. +// Preprocess C source on stdin, writes to stdout +// Replace `#pragma increment_block_number` with fake structs for controlling BSS ordering. +// The names of these fake structs are expected to be increment_block_number_%d_%d with the first number indicating +// the line number of the #pragma in the original source file. (this is for use by fix_bss.py) + +#include +#include +#include +#include +#include +#include + +const char str_pragma_increment_block_number[] = "#pragma increment_block_number"; + +int main(int argc, char** argv) { + if (argc != 3) { + fprintf(stderr, "Usage: preprocess_pragmas OOT_VERSION filename < source.c\n"); + return EXIT_FAILURE; + } + char* const version = argv[1]; + const int len_version = strlen(version); + char* const filename = argv[2]; + + char buf[32 * 1024]; + char* const bufend = buf + sizeof(buf); + char* bufp = buf; + bool cont = true; + int line_num = 1; + // whether the current line follows a #pragma increment_block_number, + // including continuation lines (lines after a \-ending line) + bool is_in_pragma = false; + // the line where the #pragma increment_block_number is + int pragma_line_number; + // how many fake structs to write to replace the current pragma + int n_fake_structs; + + while (cont) { + size_t nread = fread(bufp, 1, bufend - bufp, stdin); + bufp += nread; + if (nread == 0) { + if (!feof(stdin)) { + perror("fread"); + fprintf(stderr, "Failed to read from stdin\n"); + return EXIT_FAILURE; + } + cont = false; + if (bufp == buf) { + // All lines processed + break; + } else { + // The buffer contains the last line and that line isn't terminated with a newline. + // Add a final newline and do one last iteration. + assert(bufp < bufend); + *bufp = '\n'; + bufp++; + } + } + + char* last_newline = NULL; + for (char* p = bufp - 1; p >= buf; p--) { + if (*p == '\n') { + last_newline = p; + break; + } + } + if (last_newline == NULL) { + // No newline, read more data. + // Assert there is space for it (there should be no line long enough to not fit in buf). + assert(bufp < bufend); + continue; + } + + char* line = buf; + while (true) { + char* line_end = line; + while (*line_end != '\n') { + line_end++; + assert(line_end <= last_newline); + } + if (!strncmp(line, str_pragma_increment_block_number, strlen(str_pragma_increment_block_number))) { + is_in_pragma = true; + pragma_line_number = line_num; + n_fake_structs = 0; + } + if (is_in_pragma) { + *line_end = '\0'; + char* version_amount_item = strstr(line, version); + if (version_amount_item != NULL) { + if (version_amount_item[len_version] != ':') { + fprintf(stderr, "Found version %s in pragma line but no :amount attached\n", version); + fprintf(stderr, "%s\n", line); + return EXIT_FAILURE; + } + char* version_amount_str_start = &version_amount_item[len_version + 1]; + char* version_amount_str_end; + long amount = strtol(version_amount_str_start, &version_amount_str_end, 10); + if (version_amount_str_start == version_amount_str_end) { + fprintf(stderr, "Found version %s in pragma line but no amount integer\n", version); + fprintf(stderr, "%s\n", line); + return EXIT_FAILURE; + } + n_fake_structs = (int)amount; + } + } else { + char* p = line; + size_t sz = line_end + 1 - line; + while (sz != 0) { + size_t nwritten = fwrite(p, 1, sz, stdout); + if (nwritten == 0) { + fprintf(stderr, "Failed to write to stdout\n"); + return EXIT_FAILURE; + } + p += nwritten; + sz -= nwritten; + } + } + if (is_in_pragma && line_end[-1] != '\\') { + is_in_pragma = false; + + // Always generate at least one struct, + // so that fix_bss.py can know where the increment_block_number pragmas are + if (n_fake_structs == 0) { + n_fake_structs = 256; + } + + // Write fake structs for BSS ordering + // pragma_line_number is used for symbol uniqueness, + // and also by fix_bss.py to locate the pragma these symbols originate from. + for (int i = 0; i < n_fake_structs; i++) + fprintf(stdout, "struct increment_block_number_%05d_%03d;\n", pragma_line_number, i); + fprintf(stdout, "#line %d \"%s\"\n", line_num + 1, filename); + } + line_num++; + if (line_end == last_newline) + break; + line = line_end + 1; + } + assert(bufp <= bufend); + assert(bufp > last_newline); + char* next_incomplete_line_start = last_newline + 1; + ptrdiff_t next_incomplete_line_sz = bufp - next_incomplete_line_start; + assert(next_incomplete_line_sz >= 0); + memmove(buf, next_incomplete_line_start, next_incomplete_line_sz); + bufp = buf + next_incomplete_line_sz; + } + + return EXIT_SUCCESS; +} From ab1701b57ad9beac0e43b46250e909665f658924 Mon Sep 17 00:00:00 2001 From: cadmic Date: Wed, 14 Aug 2024 01:42:22 -0700 Subject: [PATCH 07/33] Fix a few function names in disassembly (#2036) * Fix z_message.c function names in disassembly * Fix more functions --- tools/disasm/ntsc-1.2/functions.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/disasm/ntsc-1.2/functions.txt b/tools/disasm/ntsc-1.2/functions.txt index ed0019d32e..34f49890b1 100644 --- a/tools/disasm/ntsc-1.2/functions.txt +++ b/tools/disasm/ntsc-1.2/functions.txt @@ -372,7 +372,7 @@ Actor_WorldDistXYZToActor = 0x80021AEC; // type:func Actor_WorldDistXYZToPoint = 0x80021B18; // type:func Actor_WorldDistXZToActor = 0x80021B3C; // type:func Actor_WorldDistXZToPoint = 0x80021B68; // type:func -func_8002DBD0 = 0x80021B8C; // type:func +Actor_WorldToActorCoords = 0x80021B8C; // type:func Actor_HeightDiff = 0x80021C2C; // type:func Player_GetHeight = 0x80021C40; // type:func func_8002DCE4 = 0x80021CA0; // type:func @@ -1188,7 +1188,7 @@ Jpeg_Decode = 0x8005BBBC; // type:func KaleidoSetup_Update = 0x8005BEF0; // type:func KaleidoSetup_Init = 0x8005C15C; // type:func KaleidoSetup_Destroy = 0x8005C2D4; // type:func -Font_LoadKanji = 0x8005C320; // type:func +Font_LoadCharWide = 0x8005C320; // type:func Font_LoadChar = 0x8005C374; // type:func Font_LoadMessageBoxIcon = 0x8005C3C4; // type:func Font_LoadOrderedFont = 0x8005C408; // type:func @@ -3071,8 +3071,8 @@ Message_SetTextColor = 0x800D71D8; // type:func Message_DrawTextboxIcon = 0x800D748C; // type:func Message_DrawItemIcon = 0x800D7BD4; // type:func Message_HandleOcarina = 0x800D7F20; // type:func -Message_DrawTextJPN = 0x800D8130; // type:func -Message_DrawTextNES = 0x800D9524; // type:func +Message_DrawTextWide = 0x800D8130; // type:func +Message_DrawText = 0x800D9524; // type:func Message_LoadItemIcon = 0x800DA79C; // type:func Message_Decode = 0x800DA93C; // type:func Message_OpenText = 0x800DCE64; // type:func @@ -6888,11 +6888,11 @@ func_808AD3D4 = 0x8095B12C; // type:func func_808AD450 = 0x8095B1A8; // type:func BgHaka_Init = 0x8095B730; // type:func BgHaka_Destroy = 0x8095B7AC; // type:func -func_8087B758 = 0x8095B7E0; // type:func -func_8087B7E8 = 0x8095B870; // type:func -func_8087B938 = 0x8095B9C4; // type:func -func_8087BAAC = 0x8095BB3C; // type:func -func_8087BAE4 = 0x8095BB78; // type:func +BgHaka_CheckPlayerOnDirtPatch = 0x8095B7E0; // type:func +BgHaka_IdleClosed = 0x8095B870; // type:func +BgHaka_Pull = 0x8095B9C4; // type:func +BgHaka_IdleOpened = 0x8095BB3C; // type:func +BgHaka_IdleLockedClosed = 0x8095BB78; // type:func BgHaka_Update = 0x8095BBF0; // type:func BgHaka_Draw = 0x8095BC14; // type:func MagicWind_SetupAction = 0x8095BDF0; // type:func From 137e0d2a10fa5ff4d115d1105846e4da1dc58d56 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 14 Aug 2024 19:53:55 +0200 Subject: [PATCH 08/33] fix preprocess_pragmas and add tests (#2038) --- tools/preprocess_pragmas.c | 14 ++-- tools/tests/README | 1 + tools/tests/test_preprocess_pragmas.py | 107 +++++++++++++++++++++++++ 3 files changed, 115 insertions(+), 7 deletions(-) create mode 100644 tools/tests/README create mode 100644 tools/tests/test_preprocess_pragmas.py diff --git a/tools/preprocess_pragmas.c b/tools/preprocess_pragmas.c index e31b863d07..5e750aab02 100644 --- a/tools/preprocess_pragmas.c +++ b/tools/preprocess_pragmas.c @@ -24,9 +24,14 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } char* const version = argv[1]; - const int len_version = strlen(version); char* const filename = argv[2]; + const size_t len_version = strlen(version); + char version_needle[len_version + 2]; + memcpy(version_needle, version, len_version); + version_needle[len_version] = ':'; + version_needle[len_version + 1] = '\0'; + char buf[32 * 1024]; char* const bufend = buf + sizeof(buf); char* bufp = buf; @@ -90,13 +95,8 @@ int main(int argc, char** argv) { } if (is_in_pragma) { *line_end = '\0'; - char* version_amount_item = strstr(line, version); + char* version_amount_item = strstr(line, version_needle); if (version_amount_item != NULL) { - if (version_amount_item[len_version] != ':') { - fprintf(stderr, "Found version %s in pragma line but no :amount attached\n", version); - fprintf(stderr, "%s\n", line); - return EXIT_FAILURE; - } char* version_amount_str_start = &version_amount_item[len_version + 1]; char* version_amount_str_end; long amount = strtol(version_amount_str_start, &version_amount_str_end, 10); diff --git a/tools/tests/README b/tools/tests/README new file mode 100644 index 0000000000..843622e417 --- /dev/null +++ b/tools/tests/README @@ -0,0 +1 @@ +This folder contains tests for the tools living in this repo. diff --git a/tools/tests/test_preprocess_pragmas.py b/tools/tests/test_preprocess_pragmas.py new file mode 100644 index 0000000000..16caf3fd62 --- /dev/null +++ b/tools/tests/test_preprocess_pragmas.py @@ -0,0 +1,107 @@ +import difflib +from pathlib import Path +import subprocess + + +# change to True to print output source on failed tests +PRINT_FAILED_OUTPUT = False + +PREPROCESS_PRAGMAS_P = Path("tools/preprocess_pragmas") + + +def fake_struct(pragma_line, i): + return f"struct increment_block_number_{pragma_line:05}_{i:03};" + + +def fake_structs(pragma_line, amount): + return "\n".join(fake_struct(pragma_line, i) for i in range(amount)) + + +data = { + "test_noarg": ( + "gc-us", + "source.c", + """\ +abc +#pragma increment_block_number +def +""", + f"""\ +abc +{fake_structs(2, 256)} +#line 3 "source.c" +def +""", + ), + "test_one_arg_match": ( + "gc-us", + "source.c", + """\ +abc +#pragma increment_block_number "gc-us:17" +def +""", + f"""\ +abc +{fake_structs(2, 17)} +#line 3 "source.c" +def +""", + ), + "test_one_arg_no_match": ( + "gc-us", + "source.c", + """\ +abc +#pragma increment_block_number "gc-us-mq:17" +def +""", + f"""\ +abc +{fake_structs(2, 256)} +#line 3 "source.c" +def +""", + ), + "test_several_args": ( + "gc-us", + "source.c", + """\ +abc +#pragma increment_block_number "gc-us-mq:200 gc-us:250" +def +""", + f"""\ +abc +{fake_structs(2, 250)} +#line 3 "source.c" +def +""", + ), +} + +for test_name, (version, filename, source_in, expected_source_out) in data.items(): + p = subprocess.Popen( + [str(PREPROCESS_PRAGMAS_P), version, filename], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + encoding="UTF-8", + ) + source_out, _ = p.communicate(input=source_in) + if p.returncode != 0: + print(f"{PREPROCESS_PRAGMAS_P} ended with {p.returncode} on {test_name}") + exit(1) + if source_out != expected_source_out: + print(f"failed test {test_name}") + if PRINT_FAILED_OUTPUT: + print(source_out) + for l in difflib.unified_diff( + expected_source_out.splitlines(), + source_out.splitlines(), + "expected output", + "actual output", + ): + print(l) + exit(1) + +print("all tests ok") From eaf955ad22ad7252e93c9f1429efeae897400d2b Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Wed, 14 Aug 2024 20:29:43 +0100 Subject: [PATCH 09/33] Generic actor params getters (#1359) * Initial PARAMS_GET macros * NOSHIFT macro * Use number of bits rather than raw mask values * Add descriptions for each generic macro * Reformat * Adjust comment * format * edit en_door macro names * edit redead macro name * edit bdan switch macro name, and remove unneeded comments in go2 * mizushutter macro names * remove PARAMS_GET_S, rework ishi switch flag handling * actually remove PARAMS_GET_S * remove PARAMS_GET2_S * PARAMS_GET_U and PARAMS_GET_S * format * fix merge * format --------- Co-authored-by: fig02 Co-authored-by: Dragorn421 --- include/z64actor.h | 32 +++- src/code/z_en_a_keep.c | 2 +- src/code/z_en_item00.c | 4 +- src/code/z_play.c | 2 +- src/code/z_room.c | 2 +- .../ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c | 2 +- .../ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c | 39 ++--- .../ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h | 1 - .../actors/ovl_Bg_Bombwall/z_bg_bombwall.c | 6 +- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.c | 10 +- .../actors/ovl_Bg_Dodoago/z_bg_dodoago.c | 8 +- .../ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c | 30 ++-- .../ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c | 2 +- .../ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c | 18 +-- .../actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c | 2 +- .../actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c | 2 +- .../ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c | 2 +- .../ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c | 4 +- .../actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c | 2 +- .../actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c | 2 +- .../actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c | 2 +- .../ovl_Bg_Heavy_Block/z_bg_heavy_block.c | 20 +-- .../ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c | 4 +- .../ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c | 2 +- .../ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c | 2 +- .../ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c | 40 ++--- .../ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c | 4 +- .../ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c | 22 +-- .../z_bg_hidan_kowarerukabe.c | 25 ++-- .../ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c | 4 +- .../ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c | 9 +- .../ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c | 4 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 7 +- .../ovl_Bg_Jya_1flift/z_bg_jya_1flift.c | 4 +- .../actors/ovl_Bg_Jya_Block/z_bg_jya_block.c | 2 +- .../z_bg_jya_bombchuiwa.c | 2 +- .../ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c | 8 +- .../actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c | 37 ++--- .../ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c | 8 +- .../ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c | 4 +- .../actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c | 4 +- .../ovl_Bg_Jya_Megami/z_bg_jya_megami.c | 4 +- .../z_bg_menkuri_nisekabe.c | 2 +- .../ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c | 20 +-- .../ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c | 10 +- .../ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c | 22 +-- .../ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h | 9 +- .../ovl_Bg_Mizu_Water/z_bg_mizu_water.c | 4 +- .../ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c | 8 +- .../ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c | 10 +- .../ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c | 2 +- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c | 8 +- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h | 3 + .../ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c | 4 +- .../actors/ovl_Bg_Po_Event/z_bg_po_event.c | 4 +- .../ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c | 2 +- .../ovl_Bg_Relay_Objects/z_bg_relay_objects.c | 4 +- .../z_bg_spot01_objects2.c | 10 +- .../z_bg_spot02_objects.c | 4 +- .../ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c | 2 +- .../ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c | 2 +- .../z_bg_spot06_objects.c | 4 +- .../z_bg_spot08_bakudankabe.c | 4 +- .../z_bg_spot08_iceblock.c | 20 +-- .../z_bg_spot11_bakudankabe.c | 4 +- .../ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c | 4 +- .../ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c | 4 +- .../ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c | 2 +- .../z_bg_spot16_bombstone.c | 4 +- .../z_bg_spot17_bakudankabe.c | 4 +- .../ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c | 10 +- .../ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c | 22 +-- .../z_bg_spot18_shutter.c | 8 +- .../actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c | 4 +- .../ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c | 4 +- .../actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c | 6 +- src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c | 4 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 8 +- src/overlays/actors/ovl_Boss_Va/z_boss_va.c | 2 +- .../actors/ovl_Demo_Effect/z_demo_effect.c | 14 +- src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c | 12 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.c | 12 +- .../actors/ovl_Door_Gerudo/z_door_gerudo.c | 6 +- .../actors/ovl_Door_Killer/z_door_killer.c | 14 +- .../actors/ovl_Door_Shutter/z_door_shutter.h | 4 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 2 +- src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c | 30 ++-- src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c | 16 +- src/overlays/actors/ovl_En_Ba/z_en_ba.c | 2 +- src/overlays/actors/ovl_En_Bb/z_en_bb.c | 6 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 22 +-- src/overlays/actors/ovl_En_Brob/z_en_brob.c | 7 +- src/overlays/actors/ovl_En_Butte/z_en_butte.c | 8 +- src/overlays/actors/ovl_En_Bx/z_en_bx.c | 10 +- src/overlays/actors/ovl_En_Cs/z_en_cs.c | 2 +- src/overlays/actors/ovl_En_Daiku/z_en_daiku.c | 40 ++--- .../z_en_daiku_kakariko.c | 22 +-- .../actors/ovl_En_Dekunuts/z_en_dekunuts.c | 2 +- src/overlays/actors/ovl_En_Dog/z_en_dog.c | 21 +-- src/overlays/actors/ovl_En_Door/z_en_door.c | 4 +- src/overlays/actors/ovl_En_Door/z_en_door.h | 16 +- .../actors/ovl_En_Encount1/z_en_encount1.c | 6 +- .../actors/ovl_En_Ex_Item/z_en_ex_item.c | 4 +- src/overlays/actors/ovl_En_Fd/z_en_fd.c | 10 +- .../actors/ovl_En_Fd_Fire/z_en_fd_fire.c | 16 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 2 +- .../actors/ovl_En_Floormas/z_en_floormas.c | 2 +- .../actors/ovl_En_G_Switch/z_en_g_switch.c | 8 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 8 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 12 +- src/overlays/actors/ovl_En_GeldB/z_en_geldb.c | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 97 ++++++------ src/overlays/actors/ovl_En_Go2/z_en_go2.c | 139 +++++++++--------- .../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 50 ++++--- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 6 +- .../actors/ovl_En_Heishi1/z_en_heishi1.c | 4 +- .../actors/ovl_En_Heishi2/z_en_heishi2.c | 7 +- .../actors/ovl_En_Heishi4/z_en_heishi4.c | 6 +- .../actors/ovl_En_Hintnuts/z_en_hintnuts.c | 2 +- src/overlays/actors/ovl_En_Holl/z_en_holl.h | 4 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 2 +- .../ovl_En_Horse_Normal/z_en_horse_normal.c | 4 +- src/overlays/actors/ovl_En_Hy/z_en_hy.c | 94 ++++++------ src/overlays/actors/ovl_En_Ik/z_en_ik.h | 6 +- .../actors/ovl_En_Insect/z_en_insect.c | 20 +-- src/overlays/actors/ovl_En_Ishi/z_en_ishi.c | 29 ++-- src/overlays/actors/ovl_En_Ishi/z_en_ishi.h | 14 ++ .../actors/ovl_En_Kakasi2/z_en_kakasi2.c | 4 +- .../actors/ovl_En_Karebaba/z_en_karebaba.c | 2 +- src/overlays/actors/ovl_En_Ko/z_en_ko.c | 4 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 16 +- src/overlays/actors/ovl_En_Kz/z_en_kz.c | 8 +- src/overlays/actors/ovl_En_Light/z_en_light.c | 18 +-- .../actors/ovl_En_M_Thunder/z_en_m_thunder.c | 12 +- src/overlays/actors/ovl_En_Mb/z_en_mb.c | 2 +- src/overlays/actors/ovl_En_Md/z_en_md.c | 8 +- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 2 +- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 8 +- .../actors/ovl_En_Niw_Girl/z_en_niw_girl.c | 2 +- .../ovl_En_Okarina_Tag/z_en_okarina_tag.c | 6 +- src/overlays/actors/ovl_En_Okuta/z_en_okuta.c | 2 +- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 12 +- .../actors/ovl_En_Po_Desert/z_en_po_desert.c | 2 +- .../actors/ovl_En_Po_Field/z_en_po_field.c | 2 +- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 6 +- src/overlays/actors/ovl_En_Rd/z_en_rd.c | 4 +- src/overlays/actors/ovl_En_Rd/z_en_rd.h | 2 +- .../ovl_En_River_Sound/z_en_river_sound.c | 4 +- src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 8 +- src/overlays/actors/ovl_En_Ru2/z_en_ru2.c | 8 +- src/overlays/actors/ovl_En_Si/z_en_si.c | 2 +- .../actors/ovl_En_Siofuki/z_en_siofuki.c | 28 ++-- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 2 +- .../actors/ovl_En_Stream/z_en_stream.c | 2 +- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 48 +++--- src/overlays/actors/ovl_En_Trap/z_en_trap.c | 2 +- .../actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c | 4 +- .../actors/ovl_En_Vb_Ball/z_en_vb_ball.c | 2 +- .../actors/ovl_En_Viewer/z_en_viewer.c | 18 +-- src/overlays/actors/ovl_En_Vm/z_en_vm.c | 2 +- .../actors/ovl_En_Wallmas/z_en_wallmas.c | 4 +- .../ovl_En_Weather_Tag/z_en_weather_tag.c | 2 +- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 2 +- .../ovl_En_Wonder_Item/z_en_wonder_item.c | 6 +- .../ovl_En_Wonder_Talk/z_en_wonder_talk.c | 6 +- .../ovl_En_Wonder_Talk2/z_en_wonder_talk2.c | 6 +- .../actors/ovl_En_Wood02/z_en_wood02.c | 2 +- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 4 +- src/overlays/actors/ovl_En_Zl3/z_en_zl3.c | 12 +- src/overlays/actors/ovl_En_Zo/z_en_zo.c | 6 +- .../ovl_Item_Etcetera/z_item_etcetera.c | 8 +- .../actors/ovl_Item_Inbox/z_item_inbox.c | 4 +- src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c | 6 +- src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c | 15 +- .../ovl_Obj_Blockstop/z_obj_blockstop.c | 4 +- .../actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c | 6 +- src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c | 6 +- .../actors/ovl_Obj_Elevator/z_obj_elevator.c | 6 +- .../actors/ovl_Obj_Hamishi/z_obj_hamishi.c | 4 +- src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c | 8 +- .../actors/ovl_Obj_Hsblock/z_obj_hsblock.c | 14 +- .../actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c | 2 +- .../actors/ovl_Obj_Kibako/z_obj_kibako.c | 4 +- .../actors/ovl_Obj_Kibako2/z_obj_kibako2.c | 2 +- src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c | 20 +-- .../ovl_Obj_Lightswitch/z_obj_lightswitch.c | 34 ++--- .../ovl_Obj_Makekinsuta/z_obj_makekinsuta.c | 2 +- .../ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c | 16 +- src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c | 8 +- .../actors/ovl_Obj_Mure2/z_obj_mure2.c | 20 +-- .../actors/ovl_Obj_Mure3/z_obj_mure3.c | 10 +- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c | 28 ++-- .../ovl_Obj_Roomtimer/z_obj_roomtimer.c | 14 +- .../actors/ovl_Obj_Switch/z_obj_switch.c | 19 +-- .../actors/ovl_Obj_Syokudai/z_obj_syokudai.c | 19 +-- .../ovl_Obj_Timeblock/z_obj_timeblock.c | 43 +++--- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 14 +- .../ovl_Obj_Warp2block/z_obj_warp2block.c | 40 ++--- src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 8 +- .../actors/ovl_player_actor/z_player.c | 8 +- 200 files changed, 1113 insertions(+), 1045 deletions(-) diff --git a/include/z64actor.h b/include/z64actor.h index a886160793..e336700999 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -641,9 +641,6 @@ typedef struct ActorContext { /* 0x13C */ void* absoluteSpace; // Space used to allocate actor overlays with alloc type ACTOROVL_ALLOC_ABSOLUTE } ActorContext; // size = 0x140 -#define TRANSITION_ACTOR_PARAMS_INDEX_SHIFT 10 -#define GET_TRANSITION_ACTOR_INDEX(actor) ((u16)(actor)->params >> TRANSITION_ACTOR_PARAMS_INDEX_SHIFT) - // EnDoor and DoorKiller share openAnim and playerIsOpening // Due to alignment, a substruct cannot be used in the structs of these actors. #define DOOR_ACTOR_BASE \ @@ -710,4 +707,33 @@ typedef struct NpcInteractInfo { /* 0x24 */ char unk_24[0x4]; } NpcInteractInfo; // size = 0x28 +// Converts a number of bits to a bitmask, helper for params macros +// e.g. 3 becomes 0b111 (7) +#define NBITS_TO_MASK(n) \ + ((1 << (n)) - 1) + +// Extracts the `n`-bit value at position `s` in `p`, shifts then masks +// Unsigned variant, no possibility of sign extension +#define PARAMS_GET_U(p, s, n) \ + (((p) >> (s)) & NBITS_TO_MASK(n)) + +// Extracts the `n`-bit value at position `s` in `p`, masks then shifts +// Signed variant, possibility of sign extension +#define PARAMS_GET_S(p, s, n) \ + (((p) & (NBITS_TO_MASK(n) << (s))) >> (s)) + +// Extracts all bits past position `s` in `p` +#define PARAMS_GET_NOMASK(p, s) \ + ((p) >> (s)) + +// Extracts the `n`-bit value at position `s` in `p` without shifting it from its current position +#define PARAMS_GET_NOSHIFT(p, s, n) \ + ((p) & (NBITS_TO_MASK(n) << (s))) + +// Generates a bitmask for bit position `s` of length `n` +#define PARAMS_MAKE_MASK(s, n) PARAMS_GET_NOSHIFT(~0, s, n) + +#define TRANSITION_ACTOR_PARAMS_INDEX_SHIFT 10 +#define GET_TRANSITION_ACTOR_INDEX(actor) PARAMS_GET_NOMASK((u16)(actor)->params, 10) + #endif diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 57799c22e9..37c5abcf29 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -80,7 +80,7 @@ void EnAObj_Init(Actor* thisx, PlayState* play) { EnAObj* this = (EnAObj*)thisx; f32 shadowScale = 6.0f; - this->textId = (thisx->params >> 8) & 0xFF; + this->textId = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; switch (thisx->params) { diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 7306c4689f..a009c7cfcd 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -142,10 +142,10 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { f32 yOffset = 980.0f; f32 shadowScale = 6.0f; s32 getItemId = GI_NONE; - s16 spawnParam8000 = this->actor.params & 0x8000; + s16 spawnParam8000 = PARAMS_GET_NOSHIFT(this->actor.params, 15, 1); s32 pad1; - this->collectibleFlag = (this->actor.params & 0x3F00) >> 8; + this->collectibleFlag = PARAMS_GET_S(this->actor.params, 8, 6); this->actor.params &= 0xFF; diff --git a/src/code/z_play.c b/src/code/z_play.c index e211862d60..7ebb6ccea6 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -443,7 +443,7 @@ void Play_Init(GameState* thisx) { Camera_InitDataUsingPlayer(&this->mainCamera, player); Camera_RequestMode(&this->mainCamera, CAM_MODE_NORMAL); - playerStartBgCamIndex = player->actor.params & 0xFF; + playerStartBgCamIndex = PARAMS_GET_U(player->actor.params, 0, 8); if (playerStartBgCamIndex != 0xFF) { PRINTF("player has start camera ID (" VT_FGCOL(BLUE) "%d" VT_RST ")\n", playerStartBgCamIndex); Camera_RequestBgCam(&this->mainCamera, playerStartBgCamIndex); diff --git a/src/code/z_room.c b/src/code/z_room.c index cb3b624acd..3093d4e68c 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -429,7 +429,7 @@ RoomShapeImageMultiBgEntry* Room_GetImageMultiBgEntry(RoomShapeImageMulti* roomS } player = GET_PLAYER(play); - player->actor.params = (player->actor.params & 0xFF00) | bgCamIndex; + player->actor.params = PARAMS_GET_NOSHIFT(player->actor.params, 8, 8) | bgCamIndex; bgEntry = SEGMENTED_TO_VIRTUAL(roomShapeImageMulti->backgrounds); for (i = 0; i < roomShapeImageMulti->numBackgrounds; i++) { diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c index c3d2da05db..4225108842 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c @@ -123,7 +123,7 @@ void BgBdanObjects_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - this->var.switchFlag = (thisx->params >> 8) & 0x3F; + this->var.switchFlag = PARAMS_GET_U(thisx->params, 8, 6); thisx->params &= 0xFF; if (thisx->params == JABU_OBJECTS_TYPE_WATERBOX_HEIGHT_CHANGER) { thisx->flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5; diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index bc19400642..b99d3da3ba 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -120,7 +120,7 @@ void func_8086D0EC(BgBdanSwitch* this) { this->unk_1CC += 0xFA0; } - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case BLUE: case YELLOW_HEAVY: case YELLOW: @@ -143,7 +143,7 @@ void BgBdanSwitch_Init(Actor* thisx, PlayState* play) { s16 type; s32 flag; - type = this->dyna.actor.params & 0xFF; + type = PARAMS_GET_U(this->dyna.actor.params, 0, 8); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); if (type == YELLOW_TALL_1 || type == YELLOW_TALL_2) { this->dyna.actor.scale.z = 0.05f; @@ -169,7 +169,7 @@ void BgBdanSwitch_Init(Actor* thisx, PlayState* play) { break; } - flag = Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); + flag = Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)); switch (type) { case BLUE: @@ -206,7 +206,7 @@ void BgBdanSwitch_Init(Actor* thisx, PlayState* play) { void BgBdanSwitch_Destroy(Actor* thisx, PlayState* play) { BgBdanSwitch* this = (BgBdanSwitch*)thisx; - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case BLUE: case YELLOW_HEAVY: case YELLOW: @@ -223,9 +223,9 @@ void func_8086D4B4(BgBdanSwitch* this, PlayState* play) { s32 pad; s32 type; - if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { - type = this->dyna.actor.params & 0xFF; - Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); + if (!Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) { + type = PARAMS_GET_U(this->dyna.actor.params, 0, 8); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)); if (type == BLUE || type == YELLOW_TALL_2) { OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); } else { @@ -235,9 +235,9 @@ void func_8086D4B4(BgBdanSwitch* this, PlayState* play) { } void func_8086D548(BgBdanSwitch* this, PlayState* play) { - if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { - Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); - if ((this->dyna.actor.params & 0xFF) == YELLOW_TALL_2) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) { + Flags_UnsetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)); + if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == YELLOW_TALL_2) { OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); } } @@ -249,7 +249,7 @@ void func_8086D5C4(BgBdanSwitch* this) { } void func_8086D5E0(BgBdanSwitch* this, PlayState* play) { - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case BLUE: if (func_800435B4(&this->dyna)) { func_8086D67C(this); @@ -288,7 +288,7 @@ void func_8086D730(BgBdanSwitch* this) { } void func_8086D754(BgBdanSwitch* this, PlayState* play) { - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case BLUE: if (!func_800435B4(&this->dyna)) { if (this->unk_1D8 <= 0) { @@ -300,7 +300,7 @@ void func_8086D754(BgBdanSwitch* this, PlayState* play) { } break; case YELLOW: - if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + if (!Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) { func_8086D7FC(this); } break; @@ -410,7 +410,7 @@ void func_8086DB4C(BgBdanSwitch* this) { } void func_8086DB68(BgBdanSwitch* this, PlayState* play) { - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { default: return; case YELLOW_TALL_1: @@ -451,9 +451,9 @@ void func_8086DCCC(BgBdanSwitch* this) { } void func_8086DCE8(BgBdanSwitch* this, PlayState* play) { - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case YELLOW_TALL_1: - if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + if (!Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) { func_8086DDA8(this); } break; @@ -473,7 +473,8 @@ void func_8086DDA8(BgBdanSwitch* this) { } void func_8086DDC0(BgBdanSwitch* this, PlayState* play) { - if ((((this->dyna.actor.params & 0xFF) != YELLOW_TALL_2) || (func_8005B198() == this->dyna.actor.category)) || + if (((PARAMS_GET_U(this->dyna.actor.params, 0, 8) != YELLOW_TALL_2) || + (func_8005B198() == this->dyna.actor.category)) || (this->unk_1DA <= 0)) { this->unk_1C8 += 0.3f; if (this->unk_1C8 >= 2.0f) { @@ -493,7 +494,7 @@ void BgBdanSwitch_Update(Actor* thisx, PlayState* play) { } this->actionFunc(this, play); func_8086D0EC(this); - type = this->dyna.actor.params & 0xFF; + type = PARAMS_GET_U(this->dyna.actor.params, 0, 8); if (type != 3 && type != 4) { this->unk_1D8--; } else { @@ -519,7 +520,7 @@ void func_8086DF58(BgBdanSwitch* this, PlayState* play, Gfx* dlist) { void BgBdanSwitch_Draw(Actor* thisx, PlayState* play) { BgBdanSwitch* this = (BgBdanSwitch*)thisx; - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case YELLOW_HEAVY: case YELLOW: func_8086DF58(this, play, gJabuYellowFloorSwitchDL); diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h index 59266354af..b7914a4f0d 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h @@ -4,7 +4,6 @@ #include "ultra64.h" #include "global.h" -// BgBdanSwitch.actor.params & 0xFF typedef enum BgBdanSwitchType { /* 0x00 */ BLUE, /* 0x01 */ YELLOW_HEAVY, diff --git a/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c b/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c index 17622037f2..db99f735dc 100644 --- a/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c @@ -122,7 +122,7 @@ void BgBombwall_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_SetScale(&this->dyna.actor, 0.1f); - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { func_8086EE94(this, play); } else { BgBombwall_InitDynapoly(this, play); @@ -213,7 +213,7 @@ void func_8086ED70(BgBombwall* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; func_8086EDFC(this, play); - Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); } else if (this->dyna.actor.xzDistToPlayer < 600.0f) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } @@ -232,7 +232,7 @@ void func_8086EE40(BgBombwall* this, PlayState* play) { } else { func_8086EE94(this, play); - if (((this->dyna.actor.params >> 0xF) & 1) != 0) { + if (PARAMS_GET_U(this->dyna.actor.params, 15, 1) != 0) { Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); } } diff --git a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c index ea007f5e9c..cbb95c608c 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c @@ -79,7 +79,7 @@ void BgBreakwall_SetupAction(BgBreakwall* this, BgBreakwallActionFunc actionFunc void BgBreakwall_Init(Actor* thisx, PlayState* play) { BgBreakwall* this = (BgBreakwall*)thisx; s32 pad; - s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF; + s32 wallType = (u8)PARAMS_GET_U(this->dyna.actor.params, 13, 2); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); @@ -91,7 +91,7 @@ void BgBreakwall_Init(Actor* thisx, PlayState* play) { } if (this->bombableWallDList != NULL) { - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { Actor_Kill(&this->dyna.actor); return; } @@ -203,7 +203,7 @@ Actor* BgBreakwall_SpawnFragments(PlayState* play, BgBreakwall* this, Vec3f* pos void BgBreakwall_WaitForObject(BgBreakwall* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { CollisionHeader* colHeader = NULL; - s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF; + s32 wallType = (u8)PARAMS_GET_U(this->dyna.actor.params, 13, 2); this->dyna.actor.objectSlot = this->requiredObjectSlot; Actor_SetObjectDependency(play, &this->dyna.actor); @@ -227,7 +227,7 @@ void BgBreakwall_WaitForObject(BgBreakwall* this, PlayState* play) { void BgBreakwall_Wait(BgBreakwall* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { Vec3f effectPos; - s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF; + s32 wallType = (u8)PARAMS_GET_U(this->dyna.actor.params, 13, 2); DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); effectPos.y = effectPos.z = effectPos.x = 0.0f; @@ -240,7 +240,7 @@ void BgBreakwall_Wait(BgBreakwall* this, PlayState* play) { } BgBreakwall_SpawnFragments(play, this, &effectPos, 0.0f, 6.4f, 5.0f, 1, 2.0f); - Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); if (wallType == BWALL_KD_FLOOR) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_EXPLOSION); diff --git a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c index ac5460a296..419f214972 100644 --- a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c +++ b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c @@ -118,7 +118,7 @@ void BgDodoago_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f); - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { BgDodoago_SetupAction(this, BgDodoago_DoNothing); this->dyna.actor.shape.rot.x = 0x1333; play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] = play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] = 255; @@ -156,7 +156,7 @@ void BgDodoago_WaitExplosives(BgDodoago* this, PlayState* play) { if (((play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] == 255) && (this->state == BGDODOAGO_EYE_RIGHT)) || ((play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] == 255) && (this->state == BGDODOAGO_EYE_LEFT))) { - Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); this->state = 0; Audio_PlaySfxGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -296,9 +296,9 @@ void BgDodoago_Update(Actor* thisx, PlayState* play) { } } else { sTimer++; - Flags_GetSwitch(play, this->dyna.actor.params & 0x3F); + Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); if (!sDisableBombCatcher && sTimer > 140) { - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { // this prevents clearing the actor's parent pointer, effectively disabling the bomb catcher sDisableBombCatcher++; } else { diff --git a/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c b/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c index fc0bc51bf1..7195811d4e 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c @@ -52,7 +52,7 @@ void BgGndDarkmeiro_Init(Actor* thisx, PlayState* play2) { this->updateFunc = BgGndDarkmeiro_Noop; Actor_SetScale(&this->dyna.actor, 0.1f); - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case DARKMEIRO_INVISIBLE_PATH: this->dyna.actor.draw = BgGndDarkmeiro_DrawInvisiblePath; this->dyna.actor.flags |= ACTOR_FLAG_REACT_TO_LENS; @@ -60,14 +60,14 @@ void BgGndDarkmeiro_Init(Actor* thisx, PlayState* play2) { case DARKMEIRO_CLEAR_BLOCK: CollisionHeader_GetVirtual(&gClearBlockCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if (((this->dyna.actor.params >> 8) & 0x3F) == 0x3F) { + if (PARAMS_GET_U(this->dyna.actor.params, 8, 6) == 0x3F) { this->updateFunc = BgGndDarkmeiro_UpdateStaticBlock; this->dyna.actor.draw = BgGndDarkmeiro_DrawStaticBlock; } else { this->actionFlags = this->timer1 = this->timer2 = 0; thisx->draw = BgGndDarkmeiro_DrawSwitchBlock; this->updateFunc = BgGndDarkmeiro_UpdateSwitchBlock; - if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + if (!Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } else { this->timer1 = 64; @@ -79,18 +79,18 @@ void BgGndDarkmeiro_Init(Actor* thisx, PlayState* play2) { this->actionFlags = this->timer1 = this->timer2 = 0; this->updateFunc = BgGndDarkmeiro_UpdateBlockTimer; thisx->draw = NULL; - if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 1)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6) + 1)) { this->timer1 = 64; this->actionFlags |= 4; } - if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 2)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6) + 2)) { this->timer2 = 64; this->actionFlags |= 8; } if ((this->timer1 != 0) || (this->timer2 != 0)) { - Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)); } else { - Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); + Flags_UnsetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)); } break; } @@ -100,7 +100,7 @@ void BgGndDarkmeiro_Destroy(Actor* thisx, PlayState* play2) { PlayState* play = play2; BgGndDarkmeiro* this = (BgGndDarkmeiro*)thisx; - if ((this->dyna.actor.params & 0xFF) != 1) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) != 1) { return; } @@ -113,12 +113,12 @@ void BgGndDarkmeiro_Noop(BgGndDarkmeiro* this, PlayState* play) { void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, PlayState* play) { s16 timeLeft; - if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 1)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6) + 1)) { if (this->actionFlags & 4) { if (this->timer1 > 0) { this->timer1--; } else { - Flags_UnsetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 1); + Flags_UnsetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6) + 1); this->actionFlags &= ~4; } } else { @@ -129,12 +129,12 @@ void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, PlayState* play) { } } - if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 2)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6) + 2)) { if (this->actionFlags & 8) { if (this->timer2 > 0) { this->timer2--; } else { - Flags_UnsetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 2); + Flags_UnsetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6) + 2); this->actionFlags &= ~8; } } else { @@ -150,9 +150,9 @@ void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, PlayState* play) { func_8002F994(&this->dyna.actor, timeLeft); } if ((this->timer1 >= 64) || (this->timer2 >= 64)) { - Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)); } else { - Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); + Flags_UnsetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)); } } @@ -164,7 +164,7 @@ void BgGndDarkmeiro_UpdateSwitchBlock(BgGndDarkmeiro* this, PlayState* play) { this->timer1--; } - if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) { this->timer1 = 64; } diff --git a/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c b/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c index e7e243e9e0..3c100311d0 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c @@ -53,7 +53,7 @@ void BgGndNisekabe_Draw(Actor* thisx, PlayState* play) { gGanonsCastleScrubsFakeWallDL, }; BgGndNisekabe* this = (BgGndNisekabe*)thisx; - u32 index = this->actor.params & 0xFF; + u32 index = PARAMS_GET_U(this->actor.params, 0, 8); if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { Gfx_DrawDListXlu(play, dLists[index]); diff --git a/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c b/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c index 0007e54344..572eb88bb7 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c @@ -65,12 +65,12 @@ void BgGndSoulmeiro_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); this->actionFunc = NULL; - switch (this->actor.params & 0xFF) { + switch (PARAMS_GET_U(this->actor.params, 0, 8)) { case 0: Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actionFunc = func_8087B284; - if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 9); @@ -83,7 +83,7 @@ void BgGndSoulmeiro_Init(Actor* thisx, PlayState* play) { break; case 1: case 2: - if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { this->actor.draw = BgGndSoulmeiro_Draw; } else { this->actor.draw = NULL; @@ -96,7 +96,7 @@ void BgGndSoulmeiro_Init(Actor* thisx, PlayState* play) { void BgGndSoulmeiro_Destroy(Actor* thisx, PlayState* play) { BgGndSoulmeiro* this = (BgGndSoulmeiro*)thisx; - if ((this->actor.params & 0xFF) == 0) { + if (PARAMS_GET_U(this->actor.params, 0, 8) == 0) { Collider_DestroyCylinder(play, &this->collider); } } @@ -112,13 +112,13 @@ void func_8087AF38(BgGndSoulmeiro* this, PlayState* play) { } if (this->unk_198 == 20) { - Flags_SetSwitch(play, (thisx->params >> 8) & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(thisx->params, 8, 6)); thisx->draw = NULL; } // This should be this->unk_198 == 0, this is required to match if (!this->unk_198) { - Flags_SetSwitch(play, (thisx->params >> 8) & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(thisx->params, 8, 6)); Actor_Kill(&this->actor); Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 0, 0, 0, 9); @@ -162,7 +162,7 @@ void func_8087AF38(BgGndSoulmeiro* this, PlayState* play) { void func_8087B284(BgGndSoulmeiro* this, PlayState* play) { s32 pad; - if (!Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { + if (!Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { this->actor.draw = BgGndSoulmeiro_Draw; if (this->collider.base.acFlags & AC_HIT) { Audio_PlaySfxGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -177,7 +177,7 @@ void func_8087B284(BgGndSoulmeiro* this, PlayState* play) { } void func_8087B350(BgGndSoulmeiro* this, PlayState* play) { - if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { this->actor.draw = BgGndSoulmeiro_Draw; } else { this->actor.draw = NULL; @@ -198,7 +198,7 @@ void BgGndSoulmeiro_Draw(Actor* thisx, PlayState* play) { gSpiritTrialLightSourceDL, gSpiritTrialLightFloorDL, }; - s32 params = thisx->params & 0xFF; + s32 params = PARAMS_GET_U(thisx->params, 0, 8); if (1) {} diff --git a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index b83921bf6c..10296bafff 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -74,7 +74,7 @@ void BgHakaGate_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(thisx, sInitChain); - this->switchFlag = (thisx->params >> 8) & 0xFF; + this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; DynaPolyActor_Init(&this->dyna, 0); if (thisx->params == BGHAKAGATE_SKULL) { diff --git a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c index 4b2abe6638..e660ccd38a 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c +++ b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c @@ -49,7 +49,7 @@ void BgHakaHuta_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); CollisionHeader_GetVirtual(&gBotwCoffinLidCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); - this->unk_16A = (thisx->params >> 8) & 0xFF; + this->unk_16A = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; if (Flags_GetSwitch(play, thisx->params)) { this->counter = -1; diff --git a/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c b/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c index 275317dc0e..5171623cbe 100644 --- a/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c +++ b/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c @@ -59,7 +59,7 @@ void BgHakaMeganeBG_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - this->unk_168 = (thisx->params >> 8) & 0xFF; + this->unk_168 = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; if (thisx->params == 2) { diff --git a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index 356ec9fc9d..b8b6158b59 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -138,8 +138,8 @@ void BgHakaSgami_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(thisx, sInitChain); - this->unk_151 = thisx->params & 0xFF; - thisx->params = (thisx->params >> 8) & 0xFF; + this->unk_151 = PARAMS_GET_U(thisx->params, 0, 8); + thisx->params = PARAMS_GET_U(thisx->params, 8, 8); if (this->unk_151 != 0) { thisx->flags |= ACTOR_FLAG_REACT_TO_LENS; diff --git a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c index d462920c63..e24478584e 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c +++ b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c @@ -44,7 +44,7 @@ void BgHakaShip_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - this->switchFlag = (thisx->params >> 8) & 0xFF; + this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8); this->dyna.actor.params &= 0xFF; if (this->dyna.actor.params == 0) { diff --git a/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c index 74ec4f9998..cd4e4de62d 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c +++ b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c @@ -197,7 +197,7 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, PlayState* play) { Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); } else { // Drops a small key and sets a collect flag - collectibleParams = ((this->dyna.actor.params & 0x3F) << 8) | ITEM00_SMALL_KEY; + collectibleParams = (PARAMS_GET_U(this->dyna.actor.params, 0, 6) << 8) | ITEM00_SMALL_KEY; Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); } if (collectibleParams != -1) { diff --git a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c index eb0342b5f7..33629f1427 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c +++ b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c @@ -77,7 +77,7 @@ void BgHakaZou_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(thisx, sInitChain); - this->switchFlag = (thisx->params >> 8) & 0xFF; + this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; if (thisx->params == STA_UNKNOWN) { diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index 683bf85b70..8a0288dabb 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -94,7 +94,7 @@ void BgHeavyBlock_Init(Actor* thisx, PlayState* play) { thisx->params |= 4; } - switch (thisx->params & 0xFF) { + switch (PARAMS_GET_U(thisx->params, 0, 8)) { case HEAVYBLOCK_BIG_PIECE: thisx->draw = BgHeavyBlock_DrawPiece; this->actionFunc = BgHeavyBlock_MovePiece; @@ -114,7 +114,7 @@ void BgHeavyBlock_Init(Actor* thisx, PlayState* play) { case HEAVYBLOCK_BREAKABLE: BgHeavyBlock_SetupDynapoly(this, play); - if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 8, 6))) { Actor_Kill(thisx); return; } @@ -124,7 +124,7 @@ void BgHeavyBlock_Init(Actor* thisx, PlayState* play) { case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE: BgHeavyBlock_SetupDynapoly(this, play); - if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 8, 6))) { this->actionFunc = BgHeavyBlock_DoNothing; thisx->shape.rot.x = thisx->world.rot.x = 0x8AD0; thisx->shape.rot.y = thisx->world.rot.y = 0xC000; @@ -151,7 +151,7 @@ void BgHeavyBlock_Init(Actor* thisx, PlayState* play) { void BgHeavyBlock_Destroy(Actor* thisx, PlayState* play) { BgHeavyBlock* this = (BgHeavyBlock*)thisx; - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case HEAVYBLOCK_BIG_PIECE: break; case HEAVYBLOCK_SMALL_PIECE: @@ -320,7 +320,7 @@ void BgHeavyBlock_Wait(BgHeavyBlock* this, PlayState* play) { if (Actor_HasParent(&this->dyna.actor, play)) { this->timer = 0; - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case HEAVYBLOCK_BREAKABLE: OnePointCutscene_Init(play, 4020, 270, &this->dyna.actor, CAM_ID_MAIN); break; @@ -393,10 +393,10 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, PlayState* play) { if (this->dyna.actor.home.pos.y <= yIntersect) { Rumble_Request(0.0f, 255, 60, 4); - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case HEAVYBLOCK_BREAKABLE: BgHeavyBlock_SpawnPieces(this, play); - Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)); Actor_Kill(&this->dyna.actor); quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); @@ -420,7 +420,7 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, PlayState* play) { Quake_SetDuration(quakeIndex, 40); this->actionFunc = BgHeavyBlock_Land; - Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)); break; case HEAVYBLOCK_UNBREAKABLE: Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U); @@ -457,7 +457,7 @@ void BgHeavyBlock_Land(BgHeavyBlock* this, PlayState* play) { this->dyna.actor.world.pos = this->dyna.actor.home.pos; Actor_MoveXZGravity(&this->dyna.actor); this->dyna.actor.home.pos = this->dyna.actor.world.pos; - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE: BgHeavyBlock_SpawnDust(play, Rand_CenteredFloat(30.0f) + 1678.0f, Rand_ZeroFloat(100.0f) + 1286.0f, Rand_CenteredFloat(30.0f) + 552.0f, 0.0f, 0.0f, 0.0f, 0); @@ -513,7 +513,7 @@ void BgHeavyBlock_Draw(Actor* thisx, PlayState* play) { } void BgHeavyBlock_DrawPiece(Actor* thisx, PlayState* play) { - switch (thisx->params & 0xFF) { + switch (PARAMS_GET_U(thisx->params, 0, 8)) { case HEAVYBLOCK_BIG_PIECE: Matrix_Translate(50.0f, -260.0f, -20.0f, MTXMODE_APPLY); Gfx_DrawDListOpa(play, gHeavyBlockBigPieceDL); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c index 2c336a156d..2195ec4ea6 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c @@ -72,7 +72,7 @@ void BgHidanCurtain_Init(Actor* thisx, PlayState* play) { PRINTF("Curtain (arg_data 0x%04x)\n", this->actor.params); Actor_SetFocus(&this->actor, 20.0f); - this->type = (thisx->params >> 0xC) & 0xF; + this->type = PARAMS_GET_U(thisx->params, 12, 4); if (this->type > 6) { // "Type is not set" PRINTF("Error : object のタイプが設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_hidan_curtain.c", 352, @@ -83,7 +83,7 @@ void BgHidanCurtain_Init(Actor* thisx, PlayState* play) { this->size = ((this->type == 2) || (this->type == 4)) ? 1 : 0; hcParams = &sHCParams[this->size]; - this->treasureFlag = (thisx->params >> 6) & 0x3F; + this->treasureFlag = PARAMS_GET_U(thisx->params, 6, 6); thisx->params &= 0x3F; if (OOT_DEBUG && ((this->actor.params < 0) || (this->actor.params > 0x3F))) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c index 7e7732883f..028f2e4a23 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c @@ -106,7 +106,7 @@ void BgHidanDalm_Init(Actor* thisx, PlayState* play) { Collider_InitTris(play, &this->collider); Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems); - this->switchFlag = (thisx->params >> 8) & 0xFF; + this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; if (Flags_GetSwitch(play, this->switchFlag)) { Actor_Kill(thisx); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c index 2e674ef233..e33330d8d1 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c @@ -76,7 +76,7 @@ void BgHidanFwbig_Init(Actor* thisx, PlayState* play2) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->direction = (u16)(thisx->params >> 8); + this->direction = (u16)PARAMS_GET_NOMASK(thisx->params, 8); thisx->params &= 0xFF; if (this->direction != 0) { this->actor.home.pos.x = 1560.0f; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c index 0368e6b708..ae69ffc58a 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c @@ -113,7 +113,7 @@ s32 BgHidanHamstep_SpawnChildren(BgHidanHamstep* this, PlayState* play2) { pos.z = (((i * 160.0f) + 60.0f) * cos) + this->dyna.actor.home.pos.z; params = (i + 1) & 0xFF; - params |= (this->dyna.actor.params & 0xFF00); + params |= PARAMS_GET_NOSHIFT(this->dyna.actor.params, 8, 8); step = (BgHidanHamstep*)Actor_SpawnAsChild(&play->actorCtx, &step->dyna.actor, play, ACTOR_BG_HIDAN_HAMSTEP, pos.x, pos.y, pos.z, this->dyna.actor.world.rot.x, @@ -138,7 +138,7 @@ void BgHidanHamstep_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if ((this->dyna.actor.params & 0xFF) == 0) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) { Collider_InitTris(play, &this->collider); Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderItems); @@ -152,7 +152,7 @@ void BgHidanHamstep_Init(Actor* thisx, PlayState* play) { } } - if ((this->dyna.actor.params & 0xFF) == 0) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) { CollisionHeader_GetVirtual(&gFireTempleStoneStep1Col, &colHeader); } else { CollisionHeader_GetVirtual(&gFireTempleStoneStep2Col, &colHeader); @@ -160,16 +160,16 @@ void BgHidanHamstep_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0xFF)) { - if ((this->dyna.actor.params & 0xFF) == 0) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 8))) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + (-20.0f); BgHidanHamstep_SetupAction(this, 4); } else { this->dyna.actor.world.pos.y = - sYPosOffsets[(this->dyna.actor.params & 0xFF) - 1] + this->dyna.actor.home.pos.y; + sYPosOffsets[PARAMS_GET_U(this->dyna.actor.params, 0, 8) - 1] + this->dyna.actor.home.pos.y; BgHidanHamstep_SetupAction(this, 4); } - } else if ((this->dyna.actor.params & 0xFF) == 0) { + } else if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) { BgHidanHamstep_SetupAction(this, 0); } else { BgHidanHamstep_SetupAction(this, 2); @@ -178,7 +178,7 @@ void BgHidanHamstep_Init(Actor* thisx, PlayState* play) { this->dyna.actor.gravity = -1.2f; this->dyna.actor.minVelocityY = -12.0f; - if ((this->dyna.actor.params & 0xFF) == 0) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) { // "Fire Temple Object [Hammer Step] appears" PRINTF("◯◯◯炎の神殿オブジェクト【ハンマーステップ】出現\n"); if (BgHidanHamstep_SpawnChildren(this, play) == 0) { @@ -201,7 +201,7 @@ void BgHidanHamstep_Destroy(Actor* thisx, PlayState* play) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); - if ((this->dyna.actor.params & 0xFF) == 0) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) { Collider_DestroyTris(play, &this->collider); } } @@ -232,7 +232,7 @@ void func_80888638(BgHidanHamstep* this, PlayState* play) { BgHidanHamstep* child = (BgHidanHamstep*)this->dyna.actor.child; while (child != NULL) { - if ((child->dyna.actor.params & 0xFF) != 0) { + if (PARAMS_GET_U(child->dyna.actor.params, 0, 8) != 0) { func_808884C8(child, play); } child = (BgHidanHamstep*)child->dyna.actor.child; @@ -242,7 +242,7 @@ void func_80888638(BgHidanHamstep* this, PlayState* play) { void func_80888694(BgHidanHamstep* this, BgHidanHamstep* parent) { BgHidanHamstep* child; - if ((this->dyna.actor.params & 0xFF) >= 2) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) >= 2) { if (parent->dyna.actor.world.pos.y < this->dyna.actor.world.pos.y) { this->dyna.actor.world.pos.y = parent->dyna.actor.world.pos.y; } else if ((this->dyna.actor.world.pos.y - parent->dyna.actor.world.pos.y) < -100.0f) { @@ -267,7 +267,7 @@ void func_80888734(BgHidanHamstep* this) { if (parent != NULL) { this->dyna.actor.velocity.y = parent->dyna.actor.velocity.y; - if ((this->dyna.actor.params & 0xFF) == 1) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 1) { this->dyna.actor.world.pos.y = parent->dyna.actor.world.pos.y - 100.0f; } else { this->dyna.actor.world.pos.y += (this->dyna.actor.velocity.y * frameDivisor); @@ -283,7 +283,7 @@ void func_808887C4(BgHidanHamstep* this, PlayState* play) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_HAMMER_SWITCH); this->collider.base.acFlags = AC_NONE; BgHidanHamstep_SetupAction(this, 1); - Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0xFF); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 8)); } else { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } @@ -329,9 +329,9 @@ void func_808889B8(BgHidanHamstep* this, PlayState* play) { func_80888734(this); if ((parent->action == 4) || ((parent->action == 3) && (parent->unk_244 >= 5))) { - if ((this->dyna.actor.params & 0xFF) == 1) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 1) { this->dyna.actor.world.pos.y = - sYPosOffsets[(this->dyna.actor.params & 0xFF) - 1] + this->dyna.actor.home.pos.y; + sYPosOffsets[PARAMS_GET_U(this->dyna.actor.params, 0, 8) - 1] + this->dyna.actor.home.pos.y; BgHidanHamstep_SetupAction(this, 4); } else { BgHidanHamstep_SetupAction(this, 3); @@ -348,7 +348,7 @@ void func_80888A58(BgHidanHamstep* this, PlayState* play) { func_80888694(this, (BgHidanHamstep*)this->dyna.actor.parent); #if OOT_DEBUG - if (((this->dyna.actor.params & 0xFF) <= 0) || ((this->dyna.actor.params & 0xFF) >= 6)) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) <= 0 || PARAMS_GET_U(this->dyna.actor.params, 0, 8) >= 6) { // "[Hammer Step] arg_data strange (arg_data = %d)" PRINTF("【ハンマーステップ】 arg_data おかしい (arg_data = %d)", this->dyna.actor.params); PRINTF("%s %d\n", "../z_bg_hidan_hamstep.c", 696); @@ -356,13 +356,13 @@ void func_80888A58(BgHidanHamstep* this, PlayState* play) { #endif if (((this->dyna.actor.world.pos.y - this->dyna.actor.home.pos.y) <= - sYPosOffsets[(this->dyna.actor.params & 0xFF) - 1]) && + sYPosOffsets[PARAMS_GET_U(this->dyna.actor.params, 0, 8) - 1]) && (this->dyna.actor.velocity.y <= 0.0f)) { this->unk_244++; if (this->unk_244 >= 7) { this->dyna.actor.world.pos.y = - sYPosOffsets[(this->dyna.actor.params & 0xFF) - 1] + this->dyna.actor.home.pos.y; + sYPosOffsets[PARAMS_GET_U(this->dyna.actor.params, 0, 8) - 1] + this->dyna.actor.home.pos.y; BgHidanHamstep_SetupAction(this, 3); } else { this->dyna.actor.velocity.y *= -0.24f; @@ -379,7 +379,7 @@ void func_80888A58(BgHidanHamstep* this, PlayState* play) { Rumble_Request(SQ(100.0f), 255, 20, 150); func_808884C8(this, play); - if ((this->dyna.actor.params & 0xFF) == 5) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 5) { Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); } @@ -406,7 +406,7 @@ void BgHidanHamstep_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_hidan_hamstep.c", 787), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if ((thisx->params & 0xFF) == 0) { + if (PARAMS_GET_U(thisx->params, 0, 8) == 0) { gSPDisplayList(POLY_OPA_DISP++, gFireTempleStoneStep1DL); } else { gSPDisplayList(POLY_OPA_DISP++, gFireTempleStoneStep2DL); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c index 99440ae979..b59e5a3fd9 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c @@ -85,8 +85,8 @@ void BgHidanHrock_Init(Actor* thisx, PlayState* play) { Vec3f* vtx; Actor_ProcessInitChain(thisx, sInitChain); - this->unk_16A = thisx->params & 0x3F; - thisx->params = (thisx->params >> 8) & 0xFF; + this->unk_16A = PARAMS_GET_U(thisx->params, 0, 6); + thisx->params = PARAMS_GET_U(thisx->params, 8, 8); Collider_InitTris(play, &this->collider); Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems); DynaPolyActor_Init(&this->dyna, 0); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c index d013eaab6f..0a4309f112 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c @@ -69,21 +69,21 @@ void BgHidanKousi_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); Actor_SetFocus(thisx, 50.0f); - PRINTF("◯◯◯炎の神殿オブジェクト【格子(arg_data : %0x)】出現 (%d %d)\n", thisx->params, thisx->params & 0xFF, - ((s32)thisx->params >> 8) & 0xFF); + PRINTF("◯◯◯炎の神殿オブジェクト【格子(arg_data : %0x)】出現 (%d %d)\n", thisx->params, + PARAMS_GET_U(thisx->params, 0, 8), PARAMS_GET_U((s32)thisx->params, 8, 8)); Actor_ProcessInitChain(thisx, sInitChain); #if OOT_DEBUG - if (((thisx->params & 0xFF) < 0) || ((thisx->params & 0xFF) >= 3)) { + if (PARAMS_GET_U(thisx->params, 0, 8) < 0 || PARAMS_GET_U(thisx->params, 0, 8) >= 3) { PRINTF("arg_data おかしい 【格子】\n"); } #endif - CollisionHeader_GetVirtual(sMetalFencesCollisions[thisx->params & 0xFF], &colHeader); + CollisionHeader_GetVirtual(sMetalFencesCollisions[PARAMS_GET_U(thisx->params, 0, 8)], &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); - thisx->world.rot.y = D_80889E7C[this->dyna.actor.params & 0xFF] + thisx->shape.rot.y; - if (Flags_GetSwitch(play, (thisx->params >> 8) & 0xFF)) { + thisx->world.rot.y = D_80889E7C[PARAMS_GET_U(this->dyna.actor.params, 0, 8)] + thisx->shape.rot.y; + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 8, 8))) { func_80889ACC(this); BgHidanKousi_SetupAction(this, func_80889D28); } else { @@ -99,15 +99,15 @@ void BgHidanKousi_Destroy(Actor* thisx, PlayState* play) { void func_80889ACC(BgHidanKousi* this) { s32 pad[2]; Vec3s* rot = &this->dyna.actor.world.rot; - f32 temp1 = D_80889E40[this->dyna.actor.params & 0xFF] * Math_SinS(rot->y); - f32 temp2 = D_80889E40[this->dyna.actor.params & 0xFF] * Math_CosS(rot->y); + f32 temp1 = D_80889E40[PARAMS_GET_U(this->dyna.actor.params, 0, 8)] * Math_SinS(rot->y); + f32 temp2 = D_80889E40[PARAMS_GET_U(this->dyna.actor.params, 0, 8)] * Math_CosS(rot->y); this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + temp1; this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + temp2; } void func_80889B5C(BgHidanKousi* this, PlayState* play) { - if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0xFF)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 8))) { BgHidanKousi_SetupAction(this, func_80889BC0); OnePointCutscene_Attention(play, &this->dyna.actor); this->unk_168 = 0xC8; @@ -133,7 +133,7 @@ void func_80889C18(BgHidanKousi* this, PlayState* play) { void func_80889C90(BgHidanKousi* this, PlayState* play) { Actor_UpdatePos(&this->dyna.actor); - if (D_80889E40[this->dyna.actor.params & 0xFF] < + if (D_80889E40[PARAMS_GET_U(this->dyna.actor.params, 0, 8)] < Math_Vec3f_DistXYZ(&this->dyna.actor.home.pos, &this->dyna.actor.world.pos)) { func_80889ACC(this); BgHidanKousi_SetupAction(this, func_80889D28); @@ -159,7 +159,7 @@ void BgHidanKousi_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_hidan_kousi.c", 354), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, sMetalFencesDLs[thisx->params & 0xFF]); + gSPDisplayList(POLY_OPA_DISP++, sMetalFencesDLs[PARAMS_GET_U(thisx->params, 0, 8)]); CLOSE_DISPS(play->state.gfxCtx, "../z_bg_hidan_kousi.c", 359); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c index aeace15738..494119b2ad 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c @@ -77,9 +77,9 @@ void BgHidanKowarerukabe_InitDynaPoly(BgHidanKowarerukabe* this, PlayState* play CollisionHeader* colHeader = NULL; s32 pad2; - if (collisionHeaders[this->dyna.actor.params & 0xFF] != NULL) { + if (collisionHeaders[PARAMS_GET_U(this->dyna.actor.params, 0, 8)] != NULL) { DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(collisionHeaders[this->dyna.actor.params & 0xFF], &colHeader); + CollisionHeader_GetVirtual(collisionHeaders[PARAMS_GET_U(this->dyna.actor.params, 0, 8)], &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } else { this->dyna.bgId = BGACTOR_NEG_ONE; @@ -94,14 +94,15 @@ void BgHidanKowarerukabe_InitColliderSphere(BgHidanKowarerukabe* this, PlayState Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); - this->collider.elements[0].dim.modelSphere.radius = sphereRadii[this->dyna.actor.params & 0xFF]; - this->collider.elements[0].dim.modelSphere.center.y = sphereYPositions[this->dyna.actor.params & 0xFF]; + this->collider.elements[0].dim.modelSphere.radius = sphereRadii[PARAMS_GET_U(this->dyna.actor.params, 0, 8)]; + this->collider.elements[0].dim.modelSphere.center.y = sphereYPositions[PARAMS_GET_U(this->dyna.actor.params, 0, 8)]; } void BgHidanKowarerukabe_OffsetActorYPos(BgHidanKowarerukabe* this) { static f32 actorYPosOffsets[] = { 0.7f, 0.0f, 0.0f }; - this->dyna.actor.world.pos.y = actorYPosOffsets[this->dyna.actor.params & 0xFF] + this->dyna.actor.home.pos.y; + this->dyna.actor.world.pos.y = + actorYPosOffsets[PARAMS_GET_U(this->dyna.actor.params, 0, 8)] + this->dyna.actor.home.pos.y; } static InitChainEntry sInitChain[] = { @@ -115,8 +116,8 @@ void BgHidanKowarerukabe_Init(Actor* thisx, PlayState* play) { BgHidanKowarerukabe_InitDynaPoly(this, play); - if (((this->dyna.actor.params & 0xFF) < CRACKED_STONE_FLOOR) || - ((this->dyna.actor.params & 0xFF) > LARGE_BOMBABLE_WALL)) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) < CRACKED_STONE_FLOOR || + PARAMS_GET_U(this->dyna.actor.params, 0, 8) > LARGE_BOMBABLE_WALL) { // "Error: Fire Temple Breakable Walls. arg_data I can't determine the (%s %d)(arg_data 0x%04x)" PRINTF("Error : 炎の神殿 壊れる壁 の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n", "../z_bg_hidan_kowarerukabe.c", 254, this->dyna.actor.params); @@ -124,7 +125,7 @@ void BgHidanKowarerukabe_Init(Actor* thisx, PlayState* play) { return; } - if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) { Actor_Kill(&this->dyna.actor); return; } @@ -283,7 +284,7 @@ void BgHidanKowarerukabe_LargeWallBreak(BgHidanKowarerukabe* this, PlayState* pl } void BgHidanKowarerukabe_Break(BgHidanKowarerukabe* this, PlayState* play) { - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case CRACKED_STONE_FLOOR: BgHidanKowarerukabe_FloorBreak(this, play); break; @@ -304,9 +305,9 @@ void BgHidanKowarerukabe_Update(Actor* thisx, PlayState* play) { if (Actor_GetCollidedExplosive(play, &this->collider.base) != NULL) { BgHidanKowarerukabe_Break(this, play); - Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)); - if ((this->dyna.actor.params & 0xFF) == 0) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) { SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_EXPLOSION); } else { SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); @@ -329,7 +330,7 @@ void BgHidanKowarerukabe_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_hidan_kowarerukabe.c", 568), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, sBreakableWallDLists[this->dyna.actor.params & 0xFF]); + gSPDisplayList(POLY_OPA_DISP++, sBreakableWallDLists[PARAMS_GET_U(this->dyna.actor.params, 0, 8)]); Collider_UpdateSpheres(0, &this->collider); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index 307f6f2608..8ea9f48b9d 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -74,10 +74,10 @@ void BgHidanRock_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - this->type = thisx->params & 0xFF; + this->type = PARAMS_GET_U(thisx->params, 0, 8); this->unk_169 = 0; - thisx->params = ((thisx->params) >> 8) & 0xFF; + thisx->params = PARAMS_GET_U(thisx->params, 8, 8); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); diff --git a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c index d00519f2b6..ce609e765c 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c +++ b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c @@ -9,8 +9,8 @@ #define FLAGS 0 -#define BGICESHELTER_GET_TYPE(thisx) (((thisx)->params >> 8) & 7) -#define BGICESHELTER_NO_SWITCH_FLAG(thisx) (((thisx)->params >> 6) & 1) +#define BGICESHELTER_GET_TYPE(thisx) PARAMS_GET_U((thisx)->params, 8, 3) +#define BGICESHELTER_NO_SWITCH_FLAG(thisx) PARAMS_GET_U((thisx)->params, 6, 1) void BgIceShelter_Init(Actor* thisx, PlayState* play); void BgIceShelter_Destroy(Actor* thisx, PlayState* play); @@ -183,7 +183,8 @@ void BgIceShelter_Init(Actor* thisx, PlayState* play) { this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; // The only red ice actor in the game that doesn't use a switch flag is the one for King Zora - if (!BGICESHELTER_NO_SWITCH_FLAG(&this->dyna.actor) && (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F))) { + if (!BGICESHELTER_NO_SWITCH_FLAG(&this->dyna.actor) && + (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)))) { Actor_Kill(&this->dyna.actor); return; } @@ -432,7 +433,7 @@ void BgIceShelter_Melt(BgIceShelter* this, PlayState* play) { if (this->alpha <= 0) { if (!BGICESHELTER_NO_SWITCH_FLAG(&this->dyna.actor)) { - Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); } if (type == RED_ICE_KING_ZORA) { diff --git a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c index 1e99bbaf1b..a27d455caf 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c +++ b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c @@ -53,8 +53,8 @@ void BgIceShutter_Init(Actor* thisx, PlayState* play) { colHeader = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - sp28 = this->dyna.actor.params & 0xFF; - this->dyna.actor.params = (this->dyna.actor.params >> 8) & 0xFF; + sp28 = PARAMS_GET_U(this->dyna.actor.params, 0, 8); + this->dyna.actor.params = PARAMS_GET_U(this->dyna.actor.params, 8, 8); CollisionHeader_GetVirtual(&object_ice_objects_Col_002854, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (sp28 == 2) { diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 47a008c9fc..626bfa6505 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -51,7 +51,8 @@ void BgInGate_Init(Actor* thisx, PlayState* play) { } Actor_SetScale(&this->dyna.actor, 0.1f); - if (((this->dyna.actor.params & 1) != 0) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6)) { + if ((PARAMS_GET_U(this->dyna.actor.params, 0, 1) != 0) && + (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6)) { play->csCtx.curFrame = 0; BgInGate_SetupAction(this, func_80892890); } else { @@ -72,7 +73,7 @@ void func_80892890(BgInGate* this, PlayState* play) { if (play->csCtx.curFrame >= 50) { phi0 = 0x4000; - if ((this->dyna.actor.params & 2) == 0) { + if (!PARAMS_GET_NOSHIFT(this->dyna.actor.params, 1, 1)) { phi0 = -0x4000; } this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y + phi0; @@ -86,7 +87,7 @@ void func_80892890(BgInGate* this, PlayState* play) { } csFrames = (Math_SinS(csFrames) * 16384.0f); phi1 = csFrames; - if ((this->dyna.actor.params & 2) == 0) { + if (!PARAMS_GET_NOSHIFT(this->dyna.actor.params, 1, 1)) { phi1 = -phi1; } this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y + phi1; diff --git a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c index e9395d9037..83df9766dd 100644 --- a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c +++ b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c @@ -105,7 +105,7 @@ void BgJya1flift_Init(Actor* thisx, PlayState* play) { BgJya1flift_InitDynapoly(this, play, &g1fliftCol, 0); Actor_ProcessInitChain(thisx, sInitChain); BgJya1flift_InitCollision(thisx, play); - if (Flags_GetSwitch(play, (thisx->params & 0x3F))) { + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) { LINK_AGE_IN_YEARS == YEARS_ADULT ? BgJya1flift_ChangeDirection(this) : BgJya1flift_SetupDoNothing(this); } else { BgJya1flift_SetupWaitForSwitch(this); @@ -131,7 +131,7 @@ void BgJya1flift_SetupWaitForSwitch(BgJya1flift* this) { } void BgJya1flift_WaitForSwitch(BgJya1flift* this, PlayState* play) { - if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { BgJya1flift_ChangeDirection(this); } } diff --git a/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c b/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c index c6923c6621..4481c99f09 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c +++ b/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c @@ -43,7 +43,7 @@ void BgJyaBlock_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if ((LINK_AGE_IN_YEARS != YEARS_CHILD) || !Flags_GetSwitch(play, thisx->params & 0x3F)) { + if ((LINK_AGE_IN_YEARS != YEARS_CHILD) || !Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) { Actor_Kill(&this->dyna.actor); } } diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c index 1fa70be0da..42321d8fec 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c @@ -78,7 +78,7 @@ void BgJyaBombchuiwa_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); BgJyaBombchuiwa_SetupCollider(this, play); - if (Flags_GetSwitch(play, this->actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 0, 6))) { BgJyaBombchuiwa_SpawnLightRay(this, play); } else { BgJyaBombchuiwa_SetupWaitForExplosion(this, play); diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c index 103471d3c6..bacf471b9b 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c @@ -91,17 +91,17 @@ void BgJyaBombiwa_InitCollider(BgJyaBombiwa* this, PlayState* play) { void BgJyaBombiwa_Init(Actor* thisx, PlayState* play) { BgJyaBombiwa* this = (BgJyaBombiwa*)thisx; - if ((this->dyna.actor.params & 0x3F) != 0x29) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 6) != 0x29) { PRINTF(VT_COL(YELLOW, BLACK)); // "Warning: Switch Number changed (%s %d)(SW %d)" PRINTF("Warning : Switch Number が変更された(%s %d)(SW %d)\n", "../z_bg_jya_bombiwa.c", 218, - this->dyna.actor.params & 0x3F); + PARAMS_GET_U(this->dyna.actor.params, 0, 6)); PRINTF(VT_RST); } BgJyaBombiwa_SetupDynaPoly(this, play, &gBombiwaCol, 0); BgJyaBombiwa_InitCollider(this, play); - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { Actor_Kill(&this->dyna.actor); } else { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -167,7 +167,7 @@ void BgJyaBombiwa_Update(Actor* thisx, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { BgJyaBombiwa_Break(this, play); - Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); Actor_Kill(&this->dyna.actor); } else { diff --git a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c index 079b2cc877..0c6a191db9 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c +++ b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c @@ -153,7 +153,7 @@ void func_80895A70(BgJyaCobra* this) { BgJyaBigmirror* mirror = (BgJyaBigmirror*)this->dyna.actor.parent; MirRay* mirRay; - switch (this->dyna.actor.params & 3) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 2)) { case 0: mirRay = (MirRay*)this->dyna.actor.child; if (mirRay == NULL) { @@ -186,7 +186,7 @@ void func_80895A70(BgJyaCobra* this) { mirRay->unLit = 0; Math_Vec3f_Copy(&mirRay->sourcePt, &this->unk_180); Matrix_RotateY(BINANG_TO_RAD(this->dyna.actor.shape.rot.y), MTXMODE_NEW); - Matrix_RotateX(BINANG_TO_RAD(D_80897308[this->dyna.actor.params & 3]), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD(D_80897308[PARAMS_GET_U(this->dyna.actor.params, 0, 2)]), MTXMODE_APPLY); sp28.x = 0.0f; sp28.y = 0.0; sp28.z = this->unk_190 * 2800.0f; @@ -212,14 +212,14 @@ void func_80895C74(BgJyaCobra* this, PlayState* play) { BgJyaBigmirror* mirror = (BgJyaBigmirror*)this->dyna.actor.parent; f32 phi_f0; - if ((params & 3) == 2 && mirror != NULL && + if (PARAMS_GET_U(params, 0, 2) == 2 && mirror != NULL && (!(mirror->puzzleFlags & BIGMIR_PUZZLE_BOMBIWA_DESTROYED) || !(mirror->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED))) { Math_StepToF(&this->unk_18C, 0.0f, 0.05f); } else { this->unk_18C = 1.0f; - if (D_80897310[params & 3]) { - phi_v0 = this->dyna.actor.shape.rot.y - D_80897314[params & 3]; + if (D_80897310[PARAMS_GET_U(params, 0, 2)]) { + phi_v0 = this->dyna.actor.shape.rot.y - D_80897314[PARAMS_GET_U(params, 0, 2)]; phi_v0 = ABS(phi_v0); if (phi_v0 < 0x2000 && phi_v0 != -0x8000) { this->unk_18C += (phi_v0 - 0x2000) * (3.0f / 0x4000); @@ -234,9 +234,9 @@ void func_80895C74(BgJyaCobra* this, PlayState* play) { this->unk_180.y = this->dyna.actor.world.pos.y + 57.0f; this->unk_180.z = this->dyna.actor.world.pos.z; - if ((params & 3) == 0) { + if (PARAMS_GET_U(params, 0, 2) == 0) { this->unk_190 = 0.1f; - } else if ((params & 3) == 1) { + } else if (PARAMS_GET_U(params, 0, 2) == 1) { phi_f0 = 0.1f; phi_v0 = this->dyna.actor.shape.rot.y - 0x8000; if (phi_v0 < 0x500 && phi_v0 > -0x500) { @@ -249,7 +249,7 @@ void func_80895C74(BgJyaCobra* this, PlayState* play) { } } Math_StepToF(&this->unk_190, phi_f0, 0.04f); - } else if ((params & 3) == 2) { + } else if (PARAMS_GET_U(params, 0, 2) == 2) { phi_f0 = 0.1f; phi_v0 = this->dyna.actor.shape.rot.y - 0x8000; if (phi_v0 < 0x500 && phi_v0 > -0x500) { @@ -286,8 +286,8 @@ void BgJyaCobra_UpdateShadowFromSide(BgJyaCobra* this) { Lib_MemSet(shadowTex, COBRA_SHADOW_TEX_SIZE, 0); Matrix_RotateX((M_PI / 4), MTXMODE_NEW); - rotY = !(this->dyna.actor.params & 3) ? (this->dyna.actor.shape.rot.y + 0x4000) - : (this->dyna.actor.shape.rot.y - 0x4000); + rotY = !PARAMS_GET_U(this->dyna.actor.params, 0, 2) ? (this->dyna.actor.shape.rot.y + 0x4000) + : (this->dyna.actor.shape.rot.y - 0x4000); Matrix_RotateY(BINANG_TO_RAD(rotY), MTXMODE_APPLY); Matrix_Scale(0.9f, 0.9f, 0.9f, MTXMODE_APPLY); @@ -408,21 +408,22 @@ void BgJyaCobra_Init(Actor* thisx, PlayState* play) { BgJyaCobra_InitDynapoly(this, play, &gCobraCol, 0); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (!(this->dyna.actor.params & 3) && Flags_GetSwitch(play, ((s32)this->dyna.actor.params >> 8) & 0x3F)) { + if (!PARAMS_GET_U(this->dyna.actor.params, 0, 2) && + Flags_GetSwitch(play, PARAMS_GET_U((s32)this->dyna.actor.params, 8, 6))) { this->dyna.actor.world.rot.y = this->dyna.actor.home.rot.y = this->dyna.actor.shape.rot.y = 0; } - if (!(this->dyna.actor.params & 3)) { + if (!PARAMS_GET_U(this->dyna.actor.params, 0, 2)) { BgJyaCobra_SpawnRay(this, play); } func_80896918(this, play); - if ((this->dyna.actor.params & 3) == 1 || (this->dyna.actor.params & 3) == 2) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 2) == 1 || PARAMS_GET_U(this->dyna.actor.params, 0, 2) == 2) { this->dyna.actor.room = -1; } - if ((this->dyna.actor.params & 3) == 1) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 2) == 1) { BgJyaCobra_UpdateShadowFromTop(this); } @@ -528,7 +529,7 @@ void BgJyaCobra_Update(Actor* thisx, PlayState* play2) { func_80895C74(this, play); func_80895A70(this); - if ((this->dyna.actor.params & 3) == 0 || (this->dyna.actor.params & 3) == 2) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 2) == 0 || PARAMS_GET_U(this->dyna.actor.params, 0, 2) == 2) { BgJyaCobra_UpdateShadowFromSide(this); } } @@ -551,7 +552,7 @@ void func_80896D78(BgJyaCobra* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_jya_cobra.c", 924); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - sp44.x = D_80897308[this->dyna.actor.params & 3] + this->dyna.actor.shape.rot.x; + sp44.x = D_80897308[PARAMS_GET_U(this->dyna.actor.params, 0, 2)] + this->dyna.actor.shape.rot.x; sp44.y = this->dyna.actor.shape.rot.y; sp44.z = this->dyna.actor.shape.rot.z; Matrix_SetTranslateRotateYXZ(this->unk_180.x, this->unk_180.y, this->unk_180.z, &sp44); @@ -567,7 +568,7 @@ void func_80896D78(BgJyaCobra* this, PlayState* play) { void BgJyaCobra_DrawShadow(BgJyaCobra* this, PlayState* play) { s32 pad; - s16 params = this->dyna.actor.params & 3; + s16 params = PARAMS_GET_U(this->dyna.actor.params, 0, 2); Vec3f sp64; Vec3s* phi_a3; @@ -618,7 +619,7 @@ void BgJyaCobra_Draw(Actor* thisx, PlayState* play) { func_80896D78(this, play); } - if ((this->dyna.actor.params & 3) == 2) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 2) == 2) { BgJyaBigmirror* mirror = (BgJyaBigmirror*)this->dyna.actor.parent; if (mirror != NULL && (mirror->puzzleFlags & BIGMIR_PUZZLE_BOMBIWA_DESTROYED) && diff --git a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c index 8d955b4020..9059be8344 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c +++ b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c @@ -84,7 +84,7 @@ void BgJyaIronobj_InitCylinder(BgJyaIronobj* this, PlayState* play) { Collider_InitCylinder(play, colCylinder); Collider_SetCylinder(play, colCylinder, &this->dyna.actor, &sCylinderInit); - if ((this->dyna.actor.params & 1) == 1) { + if (PARAMS_GET_U(this->dyna.actor.params, 0, 1) == 1) { this->colCylinder.dim.radius = 40; this->colCylinder.dim.height = 100; } @@ -227,7 +227,7 @@ void BgJyaIronobj_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); BgJyaIronobj_InitCylinder(this, play); - CollisionHeader_GetVirtual(sCollisionHeaders[thisx->params & 1], &colHeader); + CollisionHeader_GetVirtual(sCollisionHeaders[PARAMS_GET_U(thisx->params, 0, 1)], &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); func_808992D8(this); } @@ -253,7 +253,7 @@ void func_808992E8(BgJyaIronobj* this, PlayState* play) { actor = this->colCylinder.base.ac; this->colCylinder.base.acFlags &= ~AC_HIT; if (actor != NULL && actor->id == ACTOR_EN_IK) { - particleFunc[this->dyna.actor.params & 1](this, play, (EnIk*)actor); + particleFunc[PARAMS_GET_U(this->dyna.actor.params, 0, 1)](this, play, (EnIk*)actor); SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 80, NA_SE_EN_IRONNACK_BREAK_PILLAR); dropPos.x = this->dyna.actor.world.pos.x; dropPos.y = this->dyna.actor.world.pos.y + 20.0f; @@ -277,5 +277,5 @@ void BgJyaIronobj_Update(Actor* thisx, PlayState* play) { } void BgJyaIronobj_Draw(Actor* thisx, PlayState* play) { - Gfx_DrawDListOpa(play, sOpaDL[thisx->params & 1]); + Gfx_DrawDListOpa(play, sOpaDL[PARAMS_GET_U(thisx->params, 0, 1)]); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c index 3c752333b0..1f4287aa2f 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c @@ -63,7 +63,7 @@ void BgJyaKanaami_Init(Actor* thisx, PlayState* play) { BgJyaKanaami_InitDynaPoly(this, play, &gKanaamiCol, 0); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { func_80899A08(this); } else { func_80899880(this); @@ -83,7 +83,7 @@ void func_80899880(BgJyaKanaami* this) { } void func_80899894(BgJyaKanaami* this, PlayState* play) { - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || this->unk_16A > 0) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)) || this->unk_16A > 0) { if (this->dyna.actor.world.pos.x > -1000.0f && this->unk_16A == 0) { OnePointCutscene_Init(play, 3450, -99, &this->dyna.actor, CAM_ID_MAIN); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c index 4d5a3367e5..d26f9e400e 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c +++ b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c @@ -63,7 +63,7 @@ void BgJyaLift_Init(Actor* thisx, PlayState* play) { PRINTF("女神リフト CT\n"); BgJyaLift_InitDynapoly(this, play, &gLiftCol, 0); Actor_ProcessInitChain(thisx, sInitChain); - if (Flags_GetSwitch(play, (thisx->params & 0x3F))) { + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) { BgJyaLift_SetFinalPosY(this); } else { BgJyaLift_SetInitPosY(this); @@ -92,7 +92,7 @@ void BgJyaLift_SetInitPosY(BgJyaLift* this) { } void BgJyaLift_DelayMove(BgJyaLift* this, PlayState* play) { - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || (this->moveDelay > 0)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)) || (this->moveDelay > 0)) { this->moveDelay++; if (this->moveDelay >= 20) { OnePointCutscene_Init(play, 3430, -99, &this->dyna.actor, CAM_ID_MAIN); diff --git a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c index 2c5e47019e..e0486556ca 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c @@ -161,7 +161,7 @@ void BgJyaMegami_Init(Actor* thisx, PlayState* play) { BgJyaMegami_InitDynaPoly(this, play, &GMegamiCol, 0); BgJyaMegami_InitCollider(this, play); - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { Actor_Kill(&this->dyna.actor); } else { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -195,7 +195,7 @@ void BgJyaMegami_DetectLight(BgJyaMegami* this, PlayState* play) { this->lightTimer--; } if (this->lightTimer > 40) { - Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); BgJyaMegami_SetupExplode(this); SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 100, NA_SE_EV_FACE_EXPLOSION); OnePointCutscene_Init(play, 3440, -99, &this->dyna.actor, CAM_ID_MAIN); diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c index 0bd95411b4..589ecd6d7a 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c @@ -49,7 +49,7 @@ void BgMenkuriNisekabe_Update(Actor* thisx, PlayState* play) { void BgMenkuriNisekabe_Draw(Actor* thisx, PlayState* play) { BgMenkuriNisekabe* this = (BgMenkuriNisekabe*)thisx; - u32 index = this->actor.params & 0xFF; + u32 index = PARAMS_GET_U(this->actor.params, 0, 8); if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { Gfx_DrawDListXlu(play, sDLists[index]); diff --git a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c index 3123b1ea5b..49ec76cda0 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c @@ -176,12 +176,12 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->yRot = this->dyna.actor.world.pos.y; - this->dList = sDLists[(u16)this->dyna.actor.params & 0xF]; + this->dList = sDLists[PARAMS_GET_U((u16)this->dyna.actor.params, 0, 4)]; DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - CollisionHeader_GetVirtual(sColHeaders[(u16)this->dyna.actor.params & 0xF], &colHeader); + CollisionHeader_GetVirtual(sColHeaders[PARAMS_GET_U((u16)this->dyna.actor.params, 0, 4)], &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - switch ((u16)this->dyna.actor.params & 0xF) { + switch (PARAMS_GET_U((u16)this->dyna.actor.params, 0, 4)) { case MIZUBWALL_FLOOR: { f32 sin; f32 cos; @@ -190,7 +190,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { Vec3f offset; Vec3f vtx[3]; - if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 8, 6))) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; @@ -229,7 +229,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { Vec3f offset; Vec3f vtx[3]; - if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 8, 6))) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; @@ -268,7 +268,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { Vec3f offset; Vec3f vtx[3]; - if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 8, 6))) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; @@ -309,7 +309,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { Vec3f offset; Vec3f vtx[3]; - if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 8, 6))) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; @@ -351,7 +351,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { Vec3f offset; Vec3f vtx[3]; - if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 8, 6))) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; @@ -444,7 +444,7 @@ void BgMizuBwall_SpawnDebris(BgMizuBwall* this, PlayState* play) { Vec3f debrisOffsets[15]; for (i = 0; i < ARRAY_COUNT(debrisOffsets); i++) { - switch ((u16)this->dyna.actor.params & 0xF) { + switch (PARAMS_GET_U((u16)this->dyna.actor.params, 0, 4)) { case MIZUBWALL_FLOOR: debrisOffsets[i].x = (Rand_ZeroOne() * 80.0f) - 40.0f; debrisOffsets[i].y = Rand_ZeroOne() * 0; @@ -484,7 +484,7 @@ void BgMizuBwall_Idle(BgMizuBwall* this, PlayState* play) { BgMizuBwall_SetAlpha(this, play); if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - Flags_SetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 8, 6)); this->breakTimer = 1; DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c index 302d72a68c..fa3812cb94 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c @@ -10,11 +10,11 @@ #define FLAGS ACTOR_FLAG_4 -#define MOVEBG_TYPE(params) (((u16)(params) >> 0xC) & 0xF) -#define MOVEBG_FLAGS(params) ((u16)(params)&0x3F) -#define MOVEBG_PATH_ID(params) (((u16)(params) >> 0x8) & 0xF) -#define MOVEBG_POINT_ID(params) ((u16)(params)&0xF) -#define MOVEBG_SPEED(params) (((u16)(params) >> 0x4) & 0xF) +#define MOVEBG_TYPE(params) PARAMS_GET_U((u16)(params), 12, 4) +#define MOVEBG_FLAGS(params) PARAMS_GET_U((u16)(params), 0, 6) +#define MOVEBG_PATH_ID(params) PARAMS_GET_U((u16)(params), 8, 4) +#define MOVEBG_POINT_ID(params) PARAMS_GET_U((u16)(params), 0, 4) +#define MOVEBG_SPEED(params) PARAMS_GET_U((u16)(params), 4, 4) void BgMizuMovebg_Init(Actor* thisx, PlayState* play); void BgMizuMovebg_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c index 8af0447f24..b92f747655 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c @@ -52,30 +52,30 @@ void BgMizuShutter_Init(Actor* thisx, PlayState* play) { s32 pad3; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - this->displayList = sDisplayLists[BGMIZUSHUTTER_SIZE_PARAM(&this->dyna.actor)]; + this->displayList = sDisplayLists[BGMIZUSHUTTER_GET_SIZE(&this->dyna.actor)]; DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - CollisionHeader_GetVirtual(sCollisionHeaders[BGMIZUSHUTTER_SIZE_PARAM(&this->dyna.actor)], &colHeader); + CollisionHeader_GetVirtual(sCollisionHeaders[BGMIZUSHUTTER_GET_SIZE(&this->dyna.actor)], &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if ((BGMIZUSHUTTER_SIZE_PARAM(&this->dyna.actor) == BGMIZUSHUTTER_SMALL) || - (BGMIZUSHUTTER_SIZE_PARAM(&this->dyna.actor) == BGMIZUSHUTTER_LARGE)) { + if ((BGMIZUSHUTTER_GET_SIZE(&this->dyna.actor) == BGMIZUSHUTTER_SMALL) || + (BGMIZUSHUTTER_GET_SIZE(&this->dyna.actor) == BGMIZUSHUTTER_LARGE)) { this->closedPos = this->dyna.actor.world.pos; this->timer = 0; - this->timerMax = BGMIZUSHUTTER_TIMER_PARAM(&this->dyna.actor) * 20; + this->timerMax = BGMIZUSHUTTER_GET_TIMER(&this->dyna.actor) * 20; Matrix_RotateY(BINANG_TO_RAD(this->dyna.actor.world.rot.y), MTXMODE_NEW); Matrix_RotateX(BINANG_TO_RAD(this->dyna.actor.world.rot.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD(this->dyna.actor.world.rot.z), MTXMODE_APPLY); - Matrix_MultVec3f(&sDisplacements[BGMIZUSHUTTER_SIZE_PARAM(&this->dyna.actor)], &this->openPos); + Matrix_MultVec3f(&sDisplacements[BGMIZUSHUTTER_GET_SIZE(&this->dyna.actor)], &this->openPos); this->openPos.x += this->dyna.actor.world.pos.x; this->openPos.y += this->dyna.actor.world.pos.y; this->openPos.z += this->dyna.actor.world.pos.z; if (this->timerMax != 0x3F * 20) { - Flags_UnsetSwitch(play, BGMIZUSHUTTER_SWITCH_PARAM(&this->dyna.actor)); + Flags_UnsetSwitch(play, BGMIZUSHUTTER_GET_SWITCH(&this->dyna.actor)); this->dyna.actor.world.pos = this->closedPos; } - if (Flags_GetSwitch(play, BGMIZUSHUTTER_SWITCH_PARAM(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGMIZUSHUTTER_GET_SWITCH(&this->dyna.actor))) { this->dyna.actor.world.pos = this->openPos; this->actionFunc = BgMizuShutter_WaitForTimer; } else { @@ -92,7 +92,7 @@ void BgMizuShutter_Destroy(Actor* thisx, PlayState* play) { } void BgMizuShutter_WaitForSwitch(BgMizuShutter* this, PlayState* play) { - if (Flags_GetSwitch(play, BGMIZUSHUTTER_SWITCH_PARAM(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGMIZUSHUTTER_GET_SWITCH(&this->dyna.actor))) { if (ABS(this->dyna.actor.world.rot.x) > 0x2C60) { OnePointCutscene_Init(play, 4510, -99, &this->dyna.actor, CAM_ID_MAIN); } else { @@ -111,7 +111,7 @@ void BgMizuShutter_WaitForCutscene(BgMizuShutter* this, PlayState* play) { } void BgMizuShutter_Move(BgMizuShutter* this, PlayState* play) { - if (Flags_GetSwitch(play, BGMIZUSHUTTER_SWITCH_PARAM(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGMIZUSHUTTER_GET_SWITCH(&this->dyna.actor))) { Math_SmoothStepToF(&this->dyna.actor.world.pos.x, this->openPos.x, 1.0f, 4.0f, 0.1f); Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->openPos.y, 1.0f, 4.0f, 0.1f); Math_SmoothStepToF(&this->dyna.actor.world.pos.z, this->openPos.z, 1.0f, 4.0f, 0.1f); @@ -141,7 +141,7 @@ void BgMizuShutter_WaitForTimer(BgMizuShutter* this, PlayState* play) { func_8002F994(&this->dyna.actor, this->timer); if (this->timer == 0) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_METALDOOR_CLOSE); - Flags_UnsetSwitch(play, BGMIZUSHUTTER_SWITCH_PARAM(&this->dyna.actor)); + Flags_UnsetSwitch(play, BGMIZUSHUTTER_GET_SWITCH(&this->dyna.actor)); this->actionFunc = BgMizuShutter_Move; } } diff --git a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h index 58f822fdbe..cc42e4ddf3 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h +++ b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h @@ -4,10 +4,11 @@ #include "ultra64.h" #include "global.h" -#define BGMIZUSHUTTER_SIZE_PARAM(thisx) (((u16)(thisx)->params >> 0xC) & 0xF) -#define BGMIZUSHUTTER_TIMER_PARAM(thisx) (((u16)(thisx)->params >> 0x6) & 0x3F) -#define BGMIZUSHUTTER_SWITCH_PARAM(thisx) (((u16)(thisx)->params >> 0x0) & 0x3F) -#define BGMIZUSHUTTER_PARAMS(size, timer, switchFlag) (((size) << 0xC) | ((timer) << 0x6) | (switchFlag)) +#define BGMIZUSHUTTER_GET_SIZE(thisx) PARAMS_GET_U((u16)(thisx)->params, 12, 4) +#define BGMIZUSHUTTER_GET_TIMER(thisx) PARAMS_GET_U((u16)(thisx)->params, 6, 6) +#define BGMIZUSHUTTER_GET_SWITCH(thisx) PARAMS_GET_U((u16)(thisx)->params, 0, 6) + +#define BGMIZUSHUTTER_PARAMS(size, timer, switchFlag) (((size) << 12) | ((timer) << 6) | (switchFlag)) struct BgMizuShutter; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c index a13d50d04b..e6f353eacf 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c @@ -98,8 +98,8 @@ void BgMizuWater_Init(Actor* thisx, PlayState* play) { s32 waterLevelActionIndex; waterBoxes = play->colCtx.colHeader->waterBoxes; - this->type = this->actor.params & 0xFF; - this->switchFlag = (this->actor.params >> 8) & 0xFF; + this->type = PARAMS_GET_U(this->actor.params, 0, 8); + this->switchFlag = PARAMS_GET_U(this->actor.params, 8, 8); Actor_ProcessInitChain(&this->actor, sInitChain); initialActorY = this->actor.world.pos.y; this->baseY = initialActorY; diff --git a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c index afb9469ab6..074323a043 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c +++ b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c @@ -75,7 +75,7 @@ void BgMoriBigst_Init(Actor* thisx, PlayState* play) { // "mori (bigST.keyceiling)" PRINTF("mori (bigST.鍵型天井)(arg : %04x)(sw %d)(noE %d)(roomC %d)(playerPosY %f)\n", this->dyna.actor.params, - Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F), + Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)), Flags_GetTempClear(play, this->dyna.actor.room), Flags_GetClear(play, this->dyna.actor.room), GET_PLAYER(play)->actor.world.pos.y); BgMoriBigst_InitDynapoly(this, play, &gMoriBigstCol, 0); @@ -88,7 +88,7 @@ void BgMoriBigst_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->dyna.actor); return; } - if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; } else { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 270.0f; @@ -114,7 +114,7 @@ void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) { thisx->draw = BgMoriBigst_Draw; if (Flags_GetClear(play, thisx->room) && (GET_PLAYER(play)->actor.world.pos.y > 700.0f)) { - if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 8, 6))) { BgMoriBigst_SetupDone(this, play); } else { BgMoriBigst_SetupStalfosFight(this, play); @@ -219,7 +219,7 @@ void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, PlayState* play) { void BgMoriBigst_StalfosPairFight(BgMoriBigst* this, PlayState* play) { if ((this->dyna.actor.home.rot.z == 0) && !Player_InCsMode(play)) { - Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)); BgMoriBigst_SetupDone(this, play); } } diff --git a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c index b5bbda9f23..5ef566f145 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c +++ b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c @@ -139,7 +139,7 @@ void BgMoriElevator_SetupWaitAfterInit(BgMoriElevator* this) { void BgMoriElevator_WaitAfterInit(BgMoriElevator* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) { - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { if (play->roomCtx.curRoom.num == 2) { this->dyna.actor.world.pos.y = 73.0f; BgMoriElevator_SetupSetPosition(this); @@ -214,12 +214,12 @@ void BgMoriElevator_SetPosition(BgMoriElevator* this, PlayState* play) { } else if ((play->roomCtx.curRoom.num == 17) && (-275.0f < this->dyna.actor.world.pos.y)) { this->targetY = -779.0f; BgMoriElevator_StopMovement(this); - } else if ((play->roomCtx.curRoom.num == 2) && Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) && + } else if ((play->roomCtx.curRoom.num == 2) && Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)) && (this->unk_16C == 0)) { this->targetY = 73.0f; func_808A1C30(this); - } else if ((play->roomCtx.curRoom.num == 2) && !Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) && - (this->unk_16C != 0)) { + } else if ((play->roomCtx.curRoom.num == 2) && + !Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)) && (this->unk_16C != 0)) { this->targetY = 233.0f; func_808A1CF4(this, play); } @@ -249,7 +249,7 @@ void BgMoriElevator_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); this->unk_170 = this->dyna.interactFlags; - this->unk_16C = Flags_GetSwitch(play, (thisx->params & 0x3F)); + this->unk_16C = Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6)); } void BgMoriElevator_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c index ca0224f17a..03c49720d6 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c @@ -71,7 +71,7 @@ void BgMoriHashira4_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashira4* this = (BgMoriHashira4*)thisx; - this->switchFlag = (this->dyna.actor.params >> 8) & 0x3F; + this->switchFlag = PARAMS_GET_U(this->dyna.actor.params, 8, 6); this->dyna.actor.params &= 0xFF; if (this->dyna.actor.params == 0) { diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c index b974fa3524..a1222249ca 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c @@ -61,16 +61,16 @@ void BgMoriHineri_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - switchFlagParam = this->dyna.actor.params & 0x3F; - t6 = this->dyna.actor.params & 0x4000; + switchFlagParam = PARAMS_GET_U(this->dyna.actor.params, 0, 6); + t6 = PARAMS_GET_NOSHIFT(this->dyna.actor.params, 14, 1); if (t6 != 0) { this->switchFlag = switchFlagParam; } else { - this->switchFlag = ((this->dyna.actor.params >> 8) & 0x3F); + this->switchFlag = PARAMS_GET_U(this->dyna.actor.params, 8, 6); this->switchFlag = (Flags_GetSwitch(play, this->switchFlag)) ? 1 : 0; } - this->dyna.actor.params = ((this->dyna.actor.params & 0x8000) >> 0xE); + this->dyna.actor.params = TWISTED_HALLWAY_GET_PARAM_15(&this->dyna.actor); if (Flags_GetSwitch(play, switchFlagParam)) { if (this->dyna.actor.params == 0) { this->dyna.actor.params = 1; diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h index 8d4323e630..468bb29656 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h @@ -6,6 +6,9 @@ struct BgMoriHineri; +// Due to a unique access pattern, this param cannot use the generic "PARAMS_GET_U" macros +#define TWISTED_HALLWAY_GET_PARAM_15(thisx) (((thisx)->params & (NBITS_TO_MASK(1) << (15))) >> ((15) - (1))) + typedef void (*BgMoriHineriActionFunc)(struct BgMoriHineri*, PlayState*); typedef struct BgMoriHineri { diff --git a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c index d16ebaa95b..5b89be9abb 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c +++ b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c @@ -58,7 +58,7 @@ void BgMoriIdomizu_Init(Actor* thisx, PlayState* play) { this->actor.scale.z = 1.0f; this->actor.world.pos.x = 119.0f; this->actor.world.pos.z = -1820.0f; - this->prevSwitchFlagSet = Flags_GetSwitch(play, this->actor.params & 0x3F); + this->prevSwitchFlagSet = Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 0, 6)); if (this->prevSwitchFlagSet != 0) { this->actor.world.pos.y = -282.0f; BgMoriIdomizu_SetWaterLevel(play, -282); @@ -111,7 +111,7 @@ void BgMoriIdomizu_Main(BgMoriIdomizu* this, PlayState* play) { s32 switchFlagSet; roomNum = play->roomCtx.curRoom.num; - switchFlagSet = Flags_GetSwitch(play, thisx->params & 0x3F); + switchFlagSet = Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6)); if (switchFlagSet) { this->targetWaterLevel = -282.0f; } else { diff --git a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index 9111d5e0ed..67fedc30b6 100644 --- a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -196,8 +196,8 @@ void BgPoEvent_Init(Actor* thisx, PlayState* play) { BgPoEvent* this = (BgPoEvent*)thisx; Actor_ProcessInitChain(thisx, sInitChain); - this->type = (thisx->params >> 8) & 0xF; - this->index = (thisx->params >> 0xC) & 0xF; + this->type = PARAMS_GET_U(thisx->params, 8, 4); + this->index = PARAMS_GET_U(thisx->params, 12, 4); thisx->params &= 0x3F; if (this->type >= 2) { diff --git a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c index 357301951e..ec97d9a604 100644 --- a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c +++ b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c @@ -80,7 +80,7 @@ void BgPoSyokudai_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(thisx, sInitChain); - this->flameColor = (thisx->params >> 8) & 0xFF; + this->flameColor = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0x3F; thisx->colChkInfo.mass = MASS_IMMOVABLE; diff --git a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c index 892fdca58d..caa1c6e897 100644 --- a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c +++ b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c @@ -50,8 +50,8 @@ void BgRelayObjects_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(thisx, sInitChain); - this->switchFlag = thisx->params & 0x3F; - thisx->params = (thisx->params >> 8) & 0xFF; + this->switchFlag = PARAMS_GET_U(thisx->params, 0, 6); + thisx->params = PARAMS_GET_U(thisx->params, 8, 8); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); if (thisx->params == WINDMILL_ROTATING_GEAR) { CollisionHeader_GetVirtual(&gWindmillRotatingPlatformCol, &colHeader); diff --git a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c index 921cc601e7..6b35c92126 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c @@ -45,7 +45,7 @@ static Gfx* D_808AC510[] = { void BgSpot01Objects2_Init(Actor* thisx, PlayState* play) { BgSpot01Objects2* this = (BgSpot01Objects2*)thisx; - switch (this->dyna.actor.params & 7) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 3)) { case 0: case 1: case 2: @@ -99,7 +99,7 @@ void func_808AC2BC(BgSpot01Objects2* this, PlayState* play) { this->dyna.actor.objectSlot = this->requiredObjectSlot; DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - switch (this->dyna.actor.params & 7) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 3)) { case 4: // Shooting gallery CollisionHeader_GetVirtual(&gKakarikoShootingGalleryCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); @@ -108,10 +108,10 @@ void func_808AC2BC(BgSpot01Objects2* this, PlayState* play) { CollisionHeader_GetVirtual(&object_spot01_matoyab_col, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); if (IS_DAY) { - func_808AC22C(play->pathList, &position, ((s32)thisx->params >> 8) & 0xFF, 0); + func_808AC22C(play->pathList, &position, PARAMS_GET_U((s32)thisx->params, 8, 8), 0); Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_DAIKU_KAKARIKO, position.x, position.y, position.z, thisx->world.rot.x, thisx->world.rot.y, thisx->world.rot.z, - ((((s32)thisx->params >> 8) & 0xFF) << 8) + 1); + (PARAMS_GET_U((s32)thisx->params, 8, 8) << 8) + 1); } break; case 0: // Potion Shop Poster @@ -135,5 +135,5 @@ void BgSpot01Objects2_Update(Actor* thisx, PlayState* play) { } void func_808AC4A4(Actor* thisx, PlayState* play) { - Gfx_DrawDListOpa(play, D_808AC510[thisx->params & 7]); + Gfx_DrawDListOpa(play, D_808AC510[PARAMS_GET_U(thisx->params, 0, 3)]); } diff --git a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c index 18dd4eae44..1d7cbed6ca 100644 --- a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c @@ -53,8 +53,8 @@ void BgSpot02Objects_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); - this->unk_16B = (u16)(thisx->params >> 8); - thisx->params = (u16)(thisx->params & 0xFF); + this->unk_16B = (u16)PARAMS_GET_NOMASK(thisx->params, 8); + thisx->params = (u16)PARAMS_GET_U(thisx->params, 0, 8); switch (thisx->params) { case 0: diff --git a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c index 39bd576873..a71fce5a55 100644 --- a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c +++ b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c @@ -47,7 +47,7 @@ void BgSpot03Taki_Init(Actor* thisx, PlayState* play) { s16 pad; CollisionHeader* colHeader = NULL; - this->switchFlag = (this->dyna.actor.params & 0x3F); + this->switchFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 6); DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_spot03_object_Col_000C98, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); diff --git a/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c b/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c index 4eed722101..843b3e5235 100644 --- a/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c +++ b/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c @@ -45,7 +45,7 @@ void BgSpot05Soko_Init(Actor* thisx, PlayState* play) { s32 pad2; Actor_ProcessInitChain(thisx, sInitChain); - this->switchFlag = (thisx->params >> 8) & 0xFF; + this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; DynaPolyActor_Init(&this->dyna, 0); if (thisx->params == 0) { diff --git a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index bd4b5b1d64..d55b4e6ad7 100644 --- a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -96,8 +96,8 @@ void BgSpot06Objects_Init(Actor* thisx, PlayState* play) { s32 pad; CollisionHeader* colHeader = NULL; - this->switchFlag = thisx->params & 0xFF; - thisx->params = (thisx->params >> 8) & 0xFF; + this->switchFlag = PARAMS_GET_U(thisx->params, 0, 8); + thisx->params = PARAMS_GET_U(thisx->params, 8, 8); PRINTF("spot06 obj nthisx->arg_data=[%d]", thisx->params); diff --git a/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c index 4174abb0b2..4427ebd827 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c @@ -162,7 +162,7 @@ void BgSpot08Bakudankabe_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); - if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { Actor_Kill(&this->dyna.actor); return; } @@ -184,7 +184,7 @@ void BgSpot08Bakudankabe_Update(Actor* thisx, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { func_808B0324(this, play); - Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F)); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->dyna.actor); diff --git a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c index 4c8336f9ec..9fcaf42f7e 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c +++ b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c @@ -59,7 +59,7 @@ void BgSpot08Iceblock_InitDynaPoly(BgSpot08Iceblock* this, PlayState* play, Coll // Sets params to 0x10 (medium, nonrotating) if not in the cases listed. void BgSpot08Iceblock_CheckParams(BgSpot08Iceblock* this) { - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case 0xFF: this->dyna.actor.params = 0x10; break; @@ -90,7 +90,7 @@ void BgSpot08Iceblock_SinkUnderPlayer(BgSpot08Iceblock* this) { f32 target; f32 step; - switch (this->dyna.actor.params & 0xF0) { + switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 4, 4)) { case 0: step = 0.15f; break; @@ -177,7 +177,7 @@ void BgSpot08Iceblock_Roll(BgSpot08Iceblock* this, PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); - switch (this->dyna.actor.params & 0xFF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case 0x11: // Medium nonrotating rollDataIndex = 0; break; @@ -262,7 +262,7 @@ void BgSpot08Iceblock_SpawnTwinFloe(BgSpot08Iceblock* this, PlayState* play) { sin = Math_SinS(this->dyna.actor.home.rot.y) * 100.0f; cos = Math_CosS(this->dyna.actor.home.rot.y) * 100.0f; - if (!(this->dyna.actor.params & 0x100)) { + if (!PARAMS_GET_NOSHIFT(this->dyna.actor.params, 8, 1)) { Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_SPOT08_ICEBLOCK, this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.y, this->dyna.actor.home.pos.z, this->dyna.actor.home.rot.x, this->dyna.actor.home.rot.y, this->dyna.actor.home.rot.z, @@ -291,7 +291,7 @@ void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) { PRINTF("(spot08 流氷)(arg_data 0x%04x)\n", this->dyna.actor.params); BgSpot08Iceblock_CheckParams(this); - switch (this->dyna.actor.params & 0x200) { + switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 9, 1)) { case 0: colHeader = &gZorasFountainIcebergCol; break; @@ -300,7 +300,7 @@ void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) { break; } - switch (this->dyna.actor.params & 0xF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 4)) { case 2: case 3: BgSpot08Iceblock_InitDynaPoly(this, play, colHeader, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); @@ -317,7 +317,7 @@ void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - switch (this->dyna.actor.params & 0xF0) { + switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 4, 4)) { case 0: Actor_SetScale(&this->dyna.actor, 0.2f); break; @@ -334,7 +334,7 @@ void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) { this->surfaceNormal.y = 1.0f; this->rotationAxis.x = 1.0f; - switch (this->dyna.actor.params & 0xF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 4)) { case 0: case 1: BgSpot08Iceblock_SetupFloatNonrotating(this); @@ -395,7 +395,7 @@ void BgSpot08Iceblock_FloatOrbitingTwins(BgSpot08Iceblock* this, PlayState* play BgSpot08Iceblock_SetWaterline(this); // parent handles rotations of both - if (!(this->dyna.actor.params & 0x100)) { + if (!PARAMS_GET_NOSHIFT(this->dyna.actor.params, 8, 1)) { this->dyna.actor.world.rot.y += 0x190; sin = Math_SinS(this->dyna.actor.world.rot.y) * 100.0f; cos = Math_CosS(this->dyna.actor.world.rot.y) * 100.0f; @@ -436,7 +436,7 @@ void BgSpot08Iceblock_Draw(Actor* thisx, PlayState* play) { Gfx* dList; BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; - switch (this->dyna.actor.params & 0x200) { + switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 9, 1)) { case 0: dList = gZorasFountainIcebergDL; break; diff --git a/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c index b8ce8ddaee..465740952f 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c @@ -113,7 +113,7 @@ void BgSpot11Bakudankabe_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); - if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { Actor_Kill(&this->dyna.actor); return; } @@ -136,7 +136,7 @@ void BgSpot11Bakudankabe_Update(Actor* thisx, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { func_808B2218(this, play); - Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F)); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); SfxSource_PlaySfxAtFixedWorldPos(play, &D_808B2738, 40, NA_SE_EV_WALL_BROKEN); Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->dyna.actor); diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c index f7262bc13b..f38397020b 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c @@ -67,7 +67,7 @@ void BgSpot12Gate_Init(Actor* thisx, PlayState* play) { BgSpot12Gate_InitDynaPoly(this, play, &gGerudoFortressWastelandGateCol, 0); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { func_808B3274(this); } else { func_808B30C0(this); @@ -86,7 +86,7 @@ void func_808B30C0(BgSpot12Gate* this) { } void func_808B30D8(BgSpot12Gate* this, PlayState* play) { - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { func_808B3134(this); OnePointCutscene_Init(play, 4160, -99, &this->dyna.actor, CAM_ID_MAIN); } diff --git a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c index 5d62353472..ef9e86b905 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c @@ -63,7 +63,7 @@ void BgSpot12Saku_Init(Actor* thisx, PlayState* play) { func_808B3420(this, play, &gGerudoFortressGTGShutterCol, 0); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { func_808B3714(this); } else { func_808B3550(this); @@ -84,7 +84,7 @@ void func_808B3550(BgSpot12Saku* this) { } void func_808B357C(BgSpot12Saku* this, PlayState* play) { - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { func_808B35E4(this); this->timer = 20; OnePointCutscene_Init(play, 4170, -99, &this->dyna.actor, CAM_ID_MAIN); diff --git a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c index ee673af661..1b0b3a9edf 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c +++ b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c @@ -126,7 +126,7 @@ void BgSpot15Rrbox_Init(Actor* thisx, PlayState* play) { func_808B3960(this, play, &gLonLonMilkCrateCol, 0); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); func_808B3A34(this); - if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { func_808B44B8(this, play); this->dyna.actor.world.pos = D_808B45C4[D_808B4590]; D_808B4590++; diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index d705589500..ced99d7824 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -144,8 +144,8 @@ static f32 D_808B6074[] = { 66.0f, 51.0f, 48.0f, 36.0f, 21.0f }; static s16 D_808B6088[] = { 0, 1, 2, 3, 4 }; void func_808B4C30(BgSpot16Bombstone* this) { - this->switchFlag = (this->actor.params >> 8) & 0x3F; - this->actor.params &= 0xFF; + this->switchFlag = PARAMS_GET_U(this->actor.params, 8, 6); + this->actor.params = PARAMS_GET_U(this->actor.params, 0, 8); } void func_808B4C4C(BgSpot16Bombstone* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c index ddb0b0f26b..28376b557c 100644 --- a/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c @@ -96,7 +96,7 @@ void BgSpot17Bakudankabe_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); - if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { Actor_Kill(&this->dyna.actor); return; } @@ -115,7 +115,7 @@ void BgSpot17Bakudankabe_Update(Actor* thisx, PlayState* play) { BgSpot17Bakudankabe* this = (BgSpot17Bakudankabe*)thisx; if (this->dyna.actor.xzDistToPlayer < 650.0f && func_80033684(play, &this->dyna.actor) != NULL) { func_808B6BC0(this, play); - Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F)); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->dyna.actor); diff --git a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c index 8f9d890b60..4aafd3439f 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c @@ -144,7 +144,7 @@ void BgSpot18Basket_Init(Actor* thisx, PlayState* play) { this->dyna.actor.home.pos.y += 0.01f; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; - if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) { func_808B7BB0(this); return; } @@ -174,7 +174,7 @@ void func_808B7AEC(BgSpot18Basket* this) { } void func_808B7AFC(BgSpot18Basket* this, PlayState* play) { - if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) { OnePointCutscene_Init(play, 4220, 80, &this->dyna.actor, CAM_ID_MAIN); func_808B7B58(this); } @@ -382,15 +382,15 @@ void func_808B81A0(BgSpot18Basket* this, PlayState* play) { } } } else if (this->unk_218 == 2) { - if ((this->unk_21A != 0) || Flags_GetCollectible(play, (actor->params & 0x3F))) { + if ((this->unk_21A != 0) || Flags_GetCollectible(play, PARAMS_GET_U(actor->params, 0, 6))) { collectible = Item_DropCollectible(play, &tempVector, ITEM00_RUPEE_PURPLE); if (collectible != NULL) { collectible->actor.velocity.y = 11.0f; collectible->actor.world.rot.y = D_808B85E4[1]; } } else { - collectible = - Item_DropCollectible(play, &tempVector, ((actor->params & 0x3F) << 8) | ITEM00_HEART_PIECE); + collectible = Item_DropCollectible(play, &tempVector, + (PARAMS_GET_U(actor->params, 0, 6) << 8) | ITEM00_HEART_PIECE); if (collectible != NULL) { collectible->actor.velocity.y = 11.0f; collectible->actor.world.rot.y = D_808B85E4[1]; diff --git a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c index 6c65828e81..fed7a4263e 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c @@ -101,13 +101,13 @@ s32 func_808B8910(BgSpot18Obj* this, PlayState* play) { return 0; } - switch (D_808B90F0[this->dyna.actor.params & 0xF][age]) { + switch (D_808B90F0[PARAMS_GET_U(this->dyna.actor.params, 0, 4)][age]) { case 0: case 1: - if (D_808B90F0[this->dyna.actor.params & 0xF][age] == 0) { + if (D_808B90F0[PARAMS_GET_U(this->dyna.actor.params, 0, 4)][age] == 0) { PRINTF("出現しない Object (0x%04x)\n", this->dyna.actor.params); } - return D_808B90F0[this->dyna.actor.params & 0xF][age]; + return D_808B90F0[PARAMS_GET_U(this->dyna.actor.params, 0, 4)][age]; case 2: PRINTF("Error : Obj出現判定が設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot18_obj.c", 202, this->dyna.actor.params); @@ -120,7 +120,7 @@ s32 func_808B8910(BgSpot18Obj* this, PlayState* play) { } s32 func_808B8A5C(BgSpot18Obj* this, PlayState* play) { - Actor_SetScale(&this->dyna.actor, D_808B90F4[this->dyna.actor.params & 0xF]); + Actor_SetScale(&this->dyna.actor, D_808B90F4[PARAMS_GET_U(this->dyna.actor.params, 0, 4)]); return 1; } @@ -129,13 +129,13 @@ s32 func_808B8A98(BgSpot18Obj* this, PlayState* play) { CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(D_808B90FC[this->dyna.actor.params & 0xF], &colHeader); + CollisionHeader_GetVirtual(D_808B90FC[PARAMS_GET_U(this->dyna.actor.params, 0, 4)], &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); return 1; } s32 func_808B8B08(BgSpot18Obj* this, PlayState* play) { - this->dyna.actor.flags |= D_808B9104[this->dyna.actor.params & 0xF]; + this->dyna.actor.flags |= D_808B9104[PARAMS_GET_U(this->dyna.actor.params, 0, 4)]; return 1; } @@ -155,7 +155,7 @@ s32 func_808B8BB4(BgSpot18Obj* this, PlayState* play) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { func_808B9030(this); - } else if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + } else if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) { func_808B9030(this); this->dyna.actor.world.pos.x = (Math_SinS(this->dyna.actor.world.rot.y) * 80.0f) + this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.actor.world.rot.y) * 80.0f) + this->dyna.actor.home.pos.z; @@ -172,8 +172,8 @@ s32 func_808B8C90(BgSpot18Obj* this, PlayState* play) { } s32 func_808B8CC8(BgSpot18Obj* this, PlayState* play) { - if ((D_808B913C[this->dyna.actor.params & 0xF] != NULL) && - (!D_808B913C[this->dyna.actor.params & 0xF](this, play))) { + if ((D_808B913C[PARAMS_GET_U(this->dyna.actor.params, 0, 4)] != NULL) && + (!D_808B913C[PARAMS_GET_U(this->dyna.actor.params, 0, 4)](this, play))) { return 0; } return 1; @@ -255,7 +255,7 @@ void func_808B8F08(BgSpot18Obj* this, PlayState* play) { this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.actor.world.rot.y) * 80.0f) + this->dyna.actor.home.pos.z; this->dyna.unk_150 = 0.0f; player->stateFlags2 &= ~PLAYER_STATE2_4; - Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)); Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } else { @@ -281,5 +281,5 @@ void BgSpot18Obj_Update(Actor* thisx, PlayState* play) { } void BgSpot18Obj_Draw(Actor* thisx, PlayState* play) { - Gfx_DrawDListOpa(play, sDlists[thisx->params & 0xF]); + Gfx_DrawDListOpa(play, sDlists[PARAMS_GET_U(thisx->params, 0, 4)]); } diff --git a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c index eabb541546..af649f2e79 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c @@ -39,7 +39,7 @@ static InitChainEntry sInitChain[] = { void BgSpot18Shutter_Init(Actor* thisx, PlayState* play) { s32 pad; BgSpot18Shutter* this = (BgSpot18Shutter*)thisx; - s32 param = (this->dyna.actor.params >> 8) & 1; + s32 param = PARAMS_GET_U(this->dyna.actor.params, 8, 1); CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); @@ -54,7 +54,7 @@ void BgSpot18Shutter_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_808B9618; } } else { - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { this->actionFunc = func_808B95AC; this->dyna.actor.world.pos.y += 180.0f; } else { @@ -85,7 +85,7 @@ void func_808B95AC(BgSpot18Shutter* this, PlayState* play) { } void func_808B95B8(BgSpot18Shutter* this, PlayState* play) { - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { Actor_SetFocus(&this->dyna.actor, 70.0f); OnePointCutscene_Attention(play, &this->dyna.actor); this->actionFunc = func_808B9698; @@ -95,7 +95,7 @@ void func_808B95B8(BgSpot18Shutter* this, PlayState* play) { void func_808B9618(BgSpot18Shutter* this, PlayState* play) { if (GET_INFTABLE(INFTABLE_109)) { Actor_SetFocus(&this->dyna.actor, 70.0f); - if (((this->dyna.actor.params >> 8) & 1) == 0) { + if (PARAMS_GET_U(this->dyna.actor.params, 8, 1) == 0) { this->actionFunc = func_808B9698; } else { this->actionFunc = func_808B971C; diff --git a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c index 885abc5da1..2574e5640c 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c @@ -44,8 +44,8 @@ void BgYdanHasi_Init(Actor* thisx, PlayState* play) { WaterBox* waterBox; Actor_ProcessInitChain(thisx, sInitChain); - this->type = ((thisx->params >> 8) & 0x3F); - thisx->params &= 0xFF; + this->type = PARAMS_GET_U(thisx->params, 8, 6); + thisx->params = PARAMS_GET_U(thisx->params, 0, 8); waterBox = &play->colCtx.colHeader->waterBoxes[1]; DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); if (thisx->params == HASI_WATER) { diff --git a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c index 142960fead..3fe00945b0 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c @@ -88,8 +88,8 @@ void BgYdanMaruta_Init(Actor* thisx, PlayState* play) { Collider_InitTris(play, &this->collider); Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->elements); - this->switchFlag = this->dyna.actor.params & 0xFFFF; - thisx->params = (thisx->params >> 8) & 0xFF; // thisx is required to match here + this->switchFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 16); + thisx->params = PARAMS_GET_U(thisx->params, 8, 8); // thisx is required to match here if (this->dyna.actor.params == 0) { triInit = &sTrisElementsInit[0]; diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c index e1d3a3942b..50f47d37a2 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c @@ -91,9 +91,9 @@ void BgYdanSp_Init(Actor* thisx, PlayState* play) { f32 nSinsX; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - this->isDestroyedSwitchFlag = thisx->params & 0x3F; - this->burnSwitchFlag = (thisx->params >> 6) & 0x3F; - this->dyna.actor.params = (thisx->params >> 0xC) & 0xF; + this->isDestroyedSwitchFlag = PARAMS_GET_U(thisx->params, 0, 6); + this->burnSwitchFlag = PARAMS_GET_U(thisx->params, 6, 6); + this->dyna.actor.params = PARAMS_GET_U(thisx->params, 12, 4); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); Collider_InitTris(play, &this->trisCollider); Collider_SetTris(play, &this->trisCollider, &this->dyna.actor, &sTrisInit, this->trisColliderItems); diff --git a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c index 06ff7dbff3..de6446e02f 100644 --- a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c +++ b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c @@ -59,13 +59,13 @@ void func_808C0C50(BgZg* this) { } s32 func_808C0C98(BgZg* this, PlayState* play) { - s32 flag = (this->dyna.actor.params >> 8) & 0xFF; + s32 flag = PARAMS_GET_U(this->dyna.actor.params, 8, 8); return Flags_GetSwitch(play, flag); } s32 func_808C0CC8(BgZg* this) { - s32 flag = this->dyna.actor.params & 0xFF; + s32 flag = PARAMS_GET_U(this->dyna.actor.params, 0, 8); return flag; } diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 904dc40b5f..2a87600073 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -910,8 +910,8 @@ void func_808FF898(BossGanon2* this, PlayState* play) { if (actor->id == ACTOR_DEMO_GJ) { DemoGj* gj = (DemoGj*)actor; - if (((actor->params & 0xFF) == 0x10) || ((actor->params & 0xFF) == 0x11) || - ((actor->params & 0xFF) == 0x16)) { + if ((PARAMS_GET_U(actor->params, 0, 8) == 0x10) || (PARAMS_GET_U(actor->params, 0, 8) == 0x11) || + (PARAMS_GET_U(actor->params, 0, 8) == 0x16)) { if (SQ(this->unk_218.x - gj->dyna.actor.world.pos.x) + SQ(this->unk_218.z - gj->dyna.actor.world.pos.z) < SQ(100.0f)) { @@ -951,8 +951,8 @@ s32 func_808FFA24(BossGanon2* this, PlayState* play) { if (actor->id == ACTOR_DEMO_GJ) { DemoGj* gj = (DemoGj*)actor; - if (((actor->params & 0xFF) == 0x10) || ((actor->params & 0xFF) == 0x11) || - ((actor->params & 0xFF) == 0x16)) { + if ((PARAMS_GET_U(actor->params, 0, 8) == 0x10) || (PARAMS_GET_U(actor->params, 0, 8) == 0x11) || + (PARAMS_GET_U(actor->params, 0, 8) == 0x16)) { if (SQ(this->actor.world.pos.x - gj->dyna.actor.world.pos.x) + SQ(this->actor.world.pos.z - gj->dyna.actor.world.pos.z) < SQ(200.0f)) { diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 3faed8c858..0cb779268a 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -2659,7 +2659,7 @@ void BossVa_BariPhase2Attack(BossVa* this, PlayState* play) { sp4C = 200.0f; BossVa_Spark(play, this, 1, 125, 15.0f, 7.0f, SPARK_TETHER, 1.0f, true); this->actor.flags &= ~ACTOR_FLAG_0; - if (this->actor.params & 1) { + if (PARAMS_GET_U(this->actor.params, 0, 1)) { sp4C = -200.0f; } diff --git a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c index e6ec54a62e..4639979c7b 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -170,8 +170,8 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) { DemoEffect* crystalLight; DemoEffect* lightRing; - effectType = (this->actor.params & 0x00FF); - lightEffect = ((this->actor.params & 0xF000) >> 12); + effectType = PARAMS_GET_S(this->actor.params, 0, 8); + lightEffect = PARAMS_GET_S(this->actor.params, 12, 4); PRINTF(VT_FGCOL(CYAN) " no = %d\n" VT_RST, effectType); @@ -504,7 +504,7 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) { void DemoEffect_Destroy(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; - s32 effectType = (this->actor.params & 0x00FF); + s32 effectType = PARAMS_GET_S(this->actor.params, 0, 8); if (effectType == DEMO_EFFECT_TIMEWARP_MASTERSWORD || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL) { @@ -661,7 +661,7 @@ void DemoEffect_UpdateGetItem(DemoEffect* this, PlayState* play) { * 3) Timeblock is cleared with the Song of Time (Large and Small have different versions of Timewarp) */ void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play) { - s32 effectType = (this->actor.params & 0x00FF); + s32 effectType = PARAMS_GET_S(this->actor.params, 0, 8); if (!SkelCurve_Init(play, &this->skelCurve, &gTimeWarpSkel, &gTimeWarpAnim)) { ASSERT(0, "0", "../z_demo_effect.c", 1283); @@ -773,7 +773,7 @@ void DemoEffect_UpdateTimeWarpTimeblock(DemoEffect* this, PlayState* play) { shrinkProgress = (100 - this->timeWarp.shrinkTimer) * 0.010f; scale = shrinkProgress * 0.14f; - if ((this->actor.params & 0x00FF) == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL) { + if (PARAMS_GET_S(this->actor.params, 0, 8) == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL) { scale *= 0.6f; } @@ -1016,7 +1016,7 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) { u16 pad; s32 isLargeSize; - isLargeSize = ((this->actor.params & 0x0F00) >> 8); + isLargeSize = PARAMS_GET_S(this->actor.params, 8, 4); if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.actorCues[this->cueChannel] != NULL) { DemoEffect_SetPosRotFromCue(this, play, this->cueChannel, 0); @@ -2005,7 +2005,7 @@ s32 DemoEffect_OverrideLimbDrawTimeWarp(PlayState* play, SkelCurve* skelCurve, s void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play) { GraphicsContext* gfxCtx = play->state.gfxCtx; DemoEffect* this = (DemoEffect*)thisx; - u8 effectType = (this->actor.params & 0x00FF); + u8 effectType = PARAMS_GET_S(this->actor.params, 0, 8); if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL || CutsceneFlags_Get(play, 1) || IS_CUTSCENE_LAYER || gSaveContext.save.entranceIndex == ENTR_TEMPLE_OF_TIME_4) { diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index 9d4ba2fa36..0219f57776 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -77,23 +77,23 @@ typedef void (*DemoGjDrawFunc)(DemoGj*, PlayState*); // bits 11-15 s32 DemoGj_GetCollectibleType(DemoGj* this) { - s32 params = this->dyna.actor.params >> 0xB; + s32 type = PARAMS_GET_U(this->dyna.actor.params, 11, 5); - return params & 0x1F; + return type; } // bits 8-10 s32 DemoGj_GetCollectibleAmount(DemoGj* this) { - s32 params = this->dyna.actor.params >> 0x8; + s32 amount = PARAMS_GET_U(this->dyna.actor.params, 8, 3); - return params & 7; + return amount; } // bits 0-7 s32 DemoGj_GetType(DemoGj* this) { - s32 params = this->dyna.actor.params; + s32 type = PARAMS_GET_U(this->dyna.actor.params, 0, 8); - return params & 0xFF; + return type; } void DemoGj_InitCylinder(DemoGj* this, PlayState* play, ColliderCylinder* cylinder, diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 948b1b8a2b..7886a55e2b 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -66,9 +66,9 @@ void DoorAna_Init(Actor* thisx, PlayState* play) { this->actor.shape.rot.z = 0; this->actor.shape.rot.y = this->actor.shape.rot.z; // init block for grottos that are initially "hidden" (require explosives/hammer/song of storms to open) - if ((this->actor.params & 0x300) != 0) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 8, 2) != 0) { // only allocate collider for grottos that need bombing/hammering open - if ((this->actor.params & 0x200) != 0) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 9, 1) != 0) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); } else { @@ -86,7 +86,7 @@ void DoorAna_Destroy(Actor* thisx, PlayState* play) { DoorAna* this = (DoorAna*)thisx; // free collider if it has one - if ((this->actor.params & 0x200) != 0) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 9, 1) != 0) { Collider_DestroyCylinder(play, &this->collider); } } @@ -95,7 +95,7 @@ void DoorAna_Destroy(Actor* thisx, PlayState* play) { void DoorAna_WaitClosed(DoorAna* this, PlayState* play) { u32 openGrotto = false; - if (!(this->actor.params & 0x200)) { + if (!PARAMS_GET_NOSHIFT(this->actor.params, 9, 1)) { // opening with song of storms if (this->actor.xyzDistToPlayerSq < SQ(200.0f) && CutsceneFlags_Get(play, 5)) { openGrotto = true; @@ -130,11 +130,11 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) { if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f)) { if ((this->actor.targetMode != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (player->stateFlags1 & PLAYER_STATE1_31) && (player->av1.actionVar1 == 0)) { - destinationIdx = ((this->actor.params >> 0xC) & 7) - 1; + destinationIdx = PARAMS_GET_U(this->actor.params, 12, 3) - 1; Play_SetupRespawnPoint(play, RESPAWN_MODE_RETURN, 0x4FF); gSaveContext.respawn[RESPAWN_MODE_RETURN].pos.y = this->actor.world.pos.y; gSaveContext.respawn[RESPAWN_MODE_RETURN].yaw = this->actor.home.rot.y; - gSaveContext.respawn[RESPAWN_MODE_RETURN].data = this->actor.params & 0xFFFF; + gSaveContext.respawn[RESPAWN_MODE_RETURN].data = PARAMS_GET_U(this->actor.params, 0, 16); if (destinationIdx < 0) { destinationIdx = this->actor.home.rot.z + 1; } diff --git a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c index f12bccb5b9..323c09dabf 100644 --- a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c +++ b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c @@ -44,7 +44,7 @@ void DoorGerudo_Init(Actor* thisx, PlayState* play) { CollisionHeader_GetVirtual(&gGerudoCellDoorCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); - if (Flags_GetSwitch(play, thisx->params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) { this->actionFunc = func_8099485C; thisx->world.pos.y = thisx->home.pos.y + 200.0f; } else { @@ -100,7 +100,7 @@ void func_8099485C(DoorGerudo* this, PlayState* play) { if (this->isActive) { this->actionFunc = func_8099496C; gSaveContext.save.info.inventory.dungeonKeys[gSaveContext.mapIndex] -= 1; - Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } else { s32 direction = func_80994750(this, play); @@ -110,7 +110,7 @@ void func_8099485C(DoorGerudo* this, PlayState* play) { if (gSaveContext.save.info.inventory.dungeonKeys[gSaveContext.mapIndex] <= 0) { player->naviTextId = -0x203; - } else if (!Flags_GetCollectible(play, (this->dyna.actor.params >> 8) & 0x1F)) { + } else if (!Flags_GetCollectible(play, PARAMS_GET_U(this->dyna.actor.params, 8, 5))) { player->naviTextId = -0x225; } else { player->doorType = PLAYER_DOORTYPE_SLIDING; diff --git a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c index eac91d538f..711b861183 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c @@ -121,7 +121,7 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) { this->openAnim = 0; this->playerIsOpening = false; - switch ((u8)(this->actor.params & 0xFF)) { + switch ((u8)PARAMS_GET_U(this->actor.params, 0, 8)) { case DOOR_KILLER_DOOR: // `jointTable` is used for both the `jointTable` and `morphTable` args here. Because this actor doesn't // play any animations it does not cause problems, but it would need to be changed otherwise. @@ -144,8 +144,8 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) { this->colliderJntSph.elements[0].dim.worldSphere.center.z = (s16)this->actor.world.pos.z; // If tied to a switch flag and that switch flag is already set, kill the actor. - if ((((this->actor.params >> 8) & 0x3F) != 0x3F) && - Flags_GetSwitch(play, ((this->actor.params >> 8) & 0x3F))) { + if ((PARAMS_GET_U(this->actor.params, 8, 6) != 0x3F) && + Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { Actor_Kill(&this->actor); } break; @@ -180,7 +180,7 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) { void DoorKiller_Destroy(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; - if ((thisx->params & 0xFF) == DOOR_KILLER_DOOR) { + if (PARAMS_GET_U(thisx->params, 0, 8) == DOOR_KILLER_DOOR) { Collider_DestroyCylinder(play, &this->colliderCylinder); Collider_DestroyJntSph(play, &this->colliderJntSph); } @@ -241,7 +241,7 @@ void DoorKiller_SetAC(DoorKiller* this, PlayState* play) { } void DoorKiller_Die(DoorKiller* this, PlayState* play) { - s32 switchFlag = (this->actor.params >> 8) & 0x3F; + s32 switchFlag = PARAMS_GET_U(this->actor.params, 8, 6); // Can set a switch flag on death based on params if (switchFlag != 0x3F) { @@ -472,7 +472,7 @@ void DoorKiller_UpdateTexture(Actor* thisx, PlayState* play) { void DoorKiller_WaitForObject(DoorKiller* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { DoorKiller_UpdateTexture(&this->actor, play); - switch (this->actor.params & 0xFF) { + switch (PARAMS_GET_U(this->actor.params, 0, 8)) { case DOOR_KILLER_DOOR: this->actionFunc = DoorKiller_Wait; this->actor.draw = DoorKiller_DrawDoor; @@ -515,7 +515,7 @@ void DoorKiller_DrawDoor(Actor* thisx, PlayState* play) { void DoorKiller_DrawRubble(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { object_door_killer_DL_001250, object_door_killer_DL_001550, object_door_killer_DL_0017B8, object_door_killer_DL_001A58 }; - s32 rubblePieceIndex = (thisx->params & 0xFF) - 1; + s32 rubblePieceIndex = PARAMS_GET_U(thisx->params, 0, 8) - 1; DoorKiller* this = (DoorKiller*)thisx; if ((this->timer >= 20) || ((this->timer & 1) == 0)) { diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h index 204c1d927c..83660c5930 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h @@ -20,8 +20,8 @@ * */ -#define DOORSHUTTER_GET_TYPE(actor) (((actor)->params >> 6) & 0xF) -#define DOORSHUTTER_GET_SWITCH_FLAG(actor) ((actor)->params & 0x3F) +#define DOORSHUTTER_GET_TYPE(actor) PARAMS_GET_U((actor)->params, 6, 4) +#define DOORSHUTTER_GET_SWITCH_FLAG(actor) PARAMS_GET_U((actor)->params, 0, 6) #define DOORSHUTTER_PARAMS(type, switchFlag) ((((type) & 0xF) << 6) | ((switchFlag) & 0x3F)) diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index f6aa53916c..eab6346b66 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -167,7 +167,7 @@ void DoorWarp1_SetupWarp(DoorWarp1* this, PlayState* play) { gSaveContext.save.entranceIndex == ENTR_DESERT_COLOSSUS_8 || gSaveContext.save.entranceIndex == ENTR_GRAVEYARD_8) && !IS_CUTSCENE_LAYER) || - (GET_PLAYER(play)->actor.params & 0xF00) != 0x200) { + PARAMS_GET_NOSHIFT(GET_PLAYER(play)->actor.params, 8, 4) != 0x200) { Actor_Kill(&this->actor); } if (Actor_WorldDistXZToActor(&player->actor, &this->actor) > 100.0f) { diff --git a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c index 13057532a4..8cbdb05334 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -53,21 +53,21 @@ s32 ElfMsg_KillCheck(ElfMsg* this, PlayState* play) { if ((this->actor.world.rot.y > 0) && (this->actor.world.rot.y < 0x41) && Flags_GetSwitch(play, this->actor.world.rot.y - 1)) { LOG_STRING("共倒れ", "../z_elf_msg.c", 161); // "Mutual destruction" - if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); + if (PARAMS_GET_U(this->actor.params, 8, 6) != 0x3F) { + Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); } Actor_Kill(&this->actor); return 1; } else if ((this->actor.world.rot.y == -1) && Flags_GetClear(play, this->actor.room)) { LOG_STRING("共倒れ", "../z_elf_msg.c", 172); // "Mutual destruction" - if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); + if (PARAMS_GET_U(this->actor.params, 8, 6) != 0x3F) { + Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); } Actor_Kill(&this->actor); return 1; - } else if (((this->actor.params >> 8) & 0x3F) == 0x3F) { + } else if (PARAMS_GET_U(this->actor.params, 8, 6) == 0x3F) { return 0; - } else if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { + } else if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { Actor_Kill(&this->actor); return 1; } @@ -78,7 +78,7 @@ void ElfMsg_Init(Actor* thisx, PlayState* play) { ElfMsg* this = (ElfMsg*)thisx; // "Conditions for Elf Tag disappearing" - PRINTF(VT_FGCOL(CYAN) "\nエルフ タグ 消える条件 %d" VT_RST "\n", (thisx->params >> 8) & 0x3F); + PRINTF(VT_FGCOL(CYAN) "\nエルフ タグ 消える条件 %d" VT_RST "\n", PARAMS_GET_U(thisx->params, 8, 6)); PRINTF(VT_FGCOL(CYAN) "\nthisx->shape.angle.sy = %d\n" VT_RST, thisx->shape.rot.y); if (thisx->shape.rot.y >= 0x41) { // "Conditions for Elf Tag appearing" @@ -100,7 +100,7 @@ void ElfMsg_Init(Actor* thisx, PlayState* play) { thisx->scale.y = thisx->world.rot.z * 0.04f; } - if (thisx->params & 0x4000) { + if (PARAMS_GET_NOSHIFT(thisx->params, 14, 1)) { ElfMsg_SetupAction(this, ElfMsg_CallNaviCuboid); } else { ElfMsg_SetupAction(this, ElfMsg_CallNaviCylinder); @@ -115,10 +115,10 @@ void ElfMsg_Destroy(Actor* thisx, PlayState* play) { s32 ElfMsg_GetMessageId(ElfMsg* this) { // Negative message ID forces link to talk to Navi - if (this->actor.params & 0x8000) { - return (this->actor.params & 0xFF) + 0x100; + if (PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) { + return PARAMS_GET_U(this->actor.params, 0, 8) + 0x100; } else { - return -((this->actor.params & 0xFF) + 0x100); + return -(PARAMS_GET_U(this->actor.params, 0, 8) + 0x100); } } @@ -156,8 +156,8 @@ void ElfMsg_Update(Actor* thisx, PlayState* play) { if (!ElfMsg_KillCheck(this, play)) { if (Actor_TalkOfferAccepted(&this->actor, play)) { - if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); + if (PARAMS_GET_U(this->actor.params, 8, 6) != 0x3F) { + Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); } Actor_Kill(&this->actor); return; @@ -180,7 +180,7 @@ void ElfMsg_Draw(Actor* thisx, PlayState* play) { } Gfx_SetupDL_25Opa(play->state.gfxCtx); - if (thisx->params & 0x8000) { + if (PARAMS_GET_NOSHIFT(thisx->params, 15, 1)) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 100, 100, R_NAVI_MSG_REGION_ALPHA); } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, R_NAVI_MSG_REGION_ALPHA); @@ -190,7 +190,7 @@ void ElfMsg_Draw(Actor* thisx, PlayState* play) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_809AD278); - if (thisx->params & 0x4000) { + if (PARAMS_GET_NOSHIFT(thisx->params, 14, 1)) { gSPDisplayList(POLY_XLU_DISP++, sCubeDL); } else { gSPDisplayList(POLY_XLU_DISP++, sCylinderDL); diff --git a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c index 9a7eb92f4b..3d515b08de 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c @@ -53,21 +53,21 @@ s32 ElfMsg2_KillCheck(ElfMsg2* this, PlayState* play) { if ((this->actor.world.rot.y > 0) && (this->actor.world.rot.y < 0x41) && Flags_GetSwitch(play, this->actor.world.rot.y - 1)) { LOG_STRING("共倒れ", "../z_elf_msg2.c", 171); // "Mutual destruction" - if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(play, ((this->actor.params >> 8) & 0x3F)); + if (PARAMS_GET_U(this->actor.params, 8, 6) != 0x3F) { + Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); } Actor_Kill(&this->actor); return 1; } else if ((this->actor.world.rot.y == -1) && Flags_GetClear(play, this->actor.room)) { LOG_STRING("共倒れ2", "../z_elf_msg2.c", 182); // "Mutual destruction 2" - if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(play, ((this->actor.params >> 8) & 0x3F)); + if (PARAMS_GET_U(this->actor.params, 8, 6) != 0x3F) { + Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); } Actor_Kill(&this->actor); return 1; - } else if (((this->actor.params >> 8) & 0x3F) == 0x3F) { + } else if (PARAMS_GET_U(this->actor.params, 8, 6) == 0x3F) { return 0; - } else if (Flags_GetSwitch(play, ((this->actor.params >> 8) & 0x3F))) { + } else if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { LOG_STRING("共倒れ", "../z_elf_msg2.c", 192); // "Mutual destruction" Actor_Kill(&this->actor); return 1; @@ -99,7 +99,7 @@ void ElfMsg2_Destroy(Actor* thisx, PlayState* play) { } s32 ElfMsg2_GetMessageId(ElfMsg2* this) { - return (this->actor.params & 0xFF) + 0x100; + return PARAMS_GET_U(this->actor.params, 0, 8) + 0x100; } /** @@ -112,7 +112,7 @@ void ElfMsg2_WaitForTextClose(ElfMsg2* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.world.rot.z != 1) { Actor_Kill(&this->actor); - switchFlag = (this->actor.params >> 8) & 0x3F; + switchFlag = PARAMS_GET_U(this->actor.params, 8, 6); if (switchFlag != 0x3F) { Flags_SetSwitch(play, switchFlag); } diff --git a/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/src/overlays/actors/ovl_En_Ba/z_en_ba.c index a0b8c69a4c..14ff7ea8c8 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -104,7 +104,7 @@ void EnBa_Init(Actor* thisx, PlayState* play) { } this->actor.targetMode = 4; - this->upperParams = (thisx->params >> 8) & 0xFF; + this->upperParams = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; if (this->actor.params < EN_BA_DEAD_BLOB) { diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index 6a0a97b832..93accb1ec9 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -319,15 +319,15 @@ void EnBb_Init(Actor* thisx, PlayState* play) { Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, this->elements); - this->actionState = thisx->params >> 8; + this->actionState = PARAMS_GET_NOMASK(thisx->params, 8); - if (thisx->params & 0x80) { + if (PARAMS_GET_NOSHIFT(thisx->params, 7, 1)) { thisx->params |= 0xFF00; } if (thisx->params <= ENBB_BLUE) { ActorShape_Init(&thisx->shape, 200.0f, ActorShadow_DrawCircle, 35.0f); } - if (thisx->params & 0xFF00) { + if (PARAMS_GET_NOSHIFT(thisx->params, 8, 8)) { this->timer = 0; this->flameScaleY = 80.0f; this->flameScaleX = 100.0f; diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 4e74c6fd31..6d80f7b14d 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -109,7 +109,7 @@ void EnBox_Init(Actor* thisx, PlayState* play2) { DynaPoly_DisableCeilingCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->movementFlags = 0; - this->type = thisx->params >> 12 & 0xF; + this->type = PARAMS_GET_U(thisx->params, 12, 4); this->iceSmokeTimer = 0; this->unk_1FB = ENBOX_STATE_0; this->dyna.actor.gravity = -5.5f; @@ -118,7 +118,7 @@ void EnBox_Init(Actor* thisx, PlayState* play2) { if (play) {} // helps the compiler store play2 into s1 - if (Flags_GetTreasure(play, this->dyna.actor.params & 0x1F)) { + if (Flags_GetTreasure(play, PARAMS_GET_U(this->dyna.actor.params, 0, 5))) { this->alpha = 255; this->iceSmokeTimer = 100; EnBox_SetupAction(this, EnBox_Open); @@ -264,7 +264,7 @@ void EnBox_Fall(EnBox* this, PlayState* play) { } void EnBox_FallOnSwitchFlag(EnBox* this, PlayState* play) { - s32 treasureFlag = this->dyna.actor.params & 0x1F; + s32 treasureFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 5); if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) { Actor_SetClosestSecretDistance(&this->dyna.actor, play); @@ -283,7 +283,7 @@ void EnBox_FallOnSwitchFlag(EnBox* this, PlayState* play) { // used for types 9, 10 void func_809C9700(EnBox* this, PlayState* play) { - s32 treasureFlag = this->dyna.actor.params & 0x1F; + s32 treasureFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 5); Player* player = GET_PLAYER(play); if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) { @@ -320,7 +320,7 @@ void func_809C9700(EnBox* this, PlayState* play) { } void EnBox_AppearOnSwitchFlag(EnBox* this, PlayState* play) { - s32 treasureFlag = this->dyna.actor.params & 0x1F; + s32 treasureFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 5); if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) { Actor_SetClosestSecretDistance(&this->dyna.actor, play); @@ -334,7 +334,7 @@ void EnBox_AppearOnSwitchFlag(EnBox* this, PlayState* play) { } void EnBox_AppearOnRoomClear(EnBox* this, PlayState* play) { - s32 treasureFlag = this->dyna.actor.params & 0x1F; + s32 treasureFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 5); if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) { Actor_SetClosestSecretDistance(&this->dyna.actor, play); @@ -417,16 +417,16 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) { Audio_PlayFanfare(NA_BGM_OPEN_TRE_BOX | 0x900); } } - PRINTF("Actor_Environment_Tbox_On() %d\n", this->dyna.actor.params & 0x1F); - Flags_SetTreasure(play, this->dyna.actor.params & 0x1F); + PRINTF("Actor_Environment_Tbox_On() %d\n", PARAMS_GET_U(this->dyna.actor.params, 0, 5)); + Flags_SetTreasure(play, PARAMS_GET_U(this->dyna.actor.params, 0, 5)); } else { player = GET_PLAYER(play); Actor_WorldToActorCoords(&this->dyna.actor, &sp4C, &player->actor.world.pos); if (sp4C.z > -50.0f && sp4C.z < 0.0f && fabsf(sp4C.y) < 10.0f && fabsf(sp4C.x) < 20.0f && Player_IsFacingActor(&this->dyna.actor, 0x3000, play)) { - Actor_OfferGetItemNearby(&this->dyna.actor, play, 0 - (this->dyna.actor.params >> 5 & 0x7F)); + Actor_OfferGetItemNearby(&this->dyna.actor, play, -PARAMS_GET_U(this->dyna.actor.params, 5, 7)); } - if (Flags_GetTreasure(play, this->dyna.actor.params & 0x1F)) { + if (Flags_GetTreasure(play, PARAMS_GET_U(this->dyna.actor.params, 0, 5))) { EnBox_SetupAction(this, EnBox_Open); } } @@ -537,7 +537,7 @@ void EnBox_Update(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->dyna.actor, 40.0f); } - if ((this->dyna.actor.params >> 5 & 0x7F) == GI_ICE_TRAP && this->actionFunc == EnBox_Open && + if (PARAMS_GET_U(this->dyna.actor.params, 5, 7) == GI_ICE_TRAP && this->actionFunc == EnBox_Open && this->skelanime.curFrame > 45 && this->iceSmokeTimer < 100) { EnBox_SpawnIceSmoke(this, play); } diff --git a/src/overlays/actors/ovl_En_Brob/z_en_brob.c b/src/overlays/actors/ovl_En_Brob/z_en_brob.c index 32a7a3b363..948414a1dc 100644 --- a/src/overlays/actors/ovl_En_Brob/z_en_brob.c +++ b/src/overlays/actors/ovl_En_Brob/z_en_brob.c @@ -70,18 +70,17 @@ void EnBrob_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->colliders[1]); Collider_SetCylinder(play, &this->colliders[1], &this->dyna.actor, &sCylinderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); - - if (((thisx->params >> 8) & 0xFF) == 0) { + if (PARAMS_GET_U(thisx->params, 8, 8) == 0) { Actor_SetScale(&this->dyna.actor, 0.01f); thisx->params &= 0xFF; if (thisx->params != 0xFF) { - thisx->scale.y *= (thisx->params & 0xFF) * (1.0f / 30.0f); + thisx->scale.y *= PARAMS_GET_U(thisx->params, 0, 8) * (1.0f / 30.0f); } } else { Actor_SetScale(&this->dyna.actor, 0.005f); thisx->params &= 0xFF; if (thisx->params != 0xFF) { - thisx->scale.y *= (thisx->params & 0xFF) * (2.0f / 30.0f); + thisx->scale.y *= PARAMS_GET_U(thisx->params, 0, 8) * (2.0f / 30.0f); } } diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index f0cf652eb3..12e5850de8 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -154,7 +154,7 @@ void EnButte_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); - if ((this->actor.params & 1) == 1) { + if (PARAMS_GET_U(this->actor.params, 0, 1) == 1) { this->actor.uncullZoneScale = 200.0f; } @@ -268,7 +268,7 @@ void EnButte_FlyAround(EnButte* this, PlayState* play) { EnButte_SelectFlightParams(this, &sFlyAroundParams[this->flightParamsIdx]); } - if (((this->actor.params & 1) == 1) && (player->heldItemAction == PLAYER_IA_DEKU_STICK) && + if ((PARAMS_GET_U(this->actor.params, 0, 1) == 1) && (player->heldItemAction == PLAYER_IA_DEKU_STICK) && (this->swordDownTimer <= 0) && ((Math3D_Dist2DSq(player->actor.world.pos.x, player->actor.world.pos.z, this->actor.home.pos.x, this->actor.home.pos.z) < SQ(120.0f)) || @@ -396,7 +396,7 @@ void EnButte_Update(Actor* thisx, PlayState* play) { this->unk_25E += 0x1000; this->unk_260 += 0x600; - if ((this->actor.params & 1) == 1) { + if (PARAMS_GET_U(this->actor.params, 0, 1) == 1) { if (GET_PLAYER(play)->meleeWeaponState == 0) { if (this->swordDownTimer > 0) { this->swordDownTimer--; @@ -427,7 +427,7 @@ void EnButte_Draw(Actor* thisx, PlayState* play) { Collider_UpdateSpheres(0, &this->collider); } - if (((this->actor.params & 1) == 1) && (this->actionFunc == EnButte_TransformIntoFairy)) { + if ((PARAMS_GET_U(this->actor.params, 0, 1) == 1) && (this->actionFunc == EnButte_TransformIntoFairy)) { EnButte_DrawTransformationEffect(this, play); } } diff --git a/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/src/overlays/actors/ovl_En_Bx/z_en_bx.c index 4ce0d62c9b..2475ebf854 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -99,7 +99,7 @@ void EnBx_Init(Actor* thisx, PlayState* play) { thisx->colChkInfo.mass = MASS_IMMOVABLE; this->unk_14C = 0; thisx->uncullZoneDownward = 2000.0f; - if (Flags_GetSwitch(play, (thisx->params >> 8) & 0xFF)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 8, 8))) { Actor_Kill(&this->actor); } thisx->params &= 0xFF; @@ -141,7 +141,7 @@ void EnBx_Update(Actor* thisx, PlayState* play) { (&player->actor == this->collider.base.ac) || (&player->actor == this->colliderQuad.base.at)) { tmp33 = player->invincibilityTimer & 0xFF; tmp32 = thisx->world.rot.y; - if (!(thisx->params & 0x80)) { + if (!PARAMS_GET_NOSHIFT(thisx->params, 7, 1)) { tmp32 = thisx->yawTowardsPlayer; } if ((&player->actor != this->collider.base.at) && (&player->actor != this->collider.base.ac) && @@ -190,7 +190,7 @@ void EnBx_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(thisx, &this->collider); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); - if (thisx->params & 0x80) { + if (PARAMS_GET_NOSHIFT(thisx->params, 7, 1)) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderQuad.base); } } @@ -212,14 +212,14 @@ void EnBx_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0C, mtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809D2560[this->actor.params & 0x7F])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809D2560[PARAMS_GET_U(this->actor.params, 0, 7)])); gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 16, 16, 1, 0, (play->gameplayFrames * -10) % 128, 32, 32)); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_en_bx.c", 478), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if (this->actor.params & 0x80) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 7, 1)) { func_809D1D0C(&this->actor, play); } diff --git a/src/overlays/actors/ovl_En_Cs/z_en_cs.c b/src/overlays/actors/ovl_En_Cs/z_en_cs.c index b12ec20f4f..bbe4939528 100644 --- a/src/overlays/actors/ovl_En_Cs/z_en_cs.c +++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.c @@ -144,7 +144,7 @@ void EnCs_Init(Actor* thisx, PlayState* play) { sAnimationInfo[ENCS_ANIM_0].morphFrames); this->actor.targetMode = 6; - this->path = this->actor.params & 0xFF; + this->path = PARAMS_GET_U(this->actor.params, 0, 8); this->unk_1EC = 0; // This variable is unused anywhere else this->talkState = 0; this->currentAnimIndex = -1; diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index c590ea0d40..803ef523e0 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -152,13 +152,13 @@ void EnDaiku_Init(Actor* thisx, PlayState* play) { s32 noKill = true; s32 isFree = false; - if ((this->actor.params & 3) == 0 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(0))) { + if (PARAMS_GET_U(this->actor.params, 0, 2) == 0 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(0))) { isFree = true; - } else if ((this->actor.params & 3) == 1 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(1))) { + } else if (PARAMS_GET_U(this->actor.params, 0, 2) == 1 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(1))) { isFree = true; - } else if ((this->actor.params & 3) == 2 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(2))) { + } else if (PARAMS_GET_U(this->actor.params, 0, 2) == 2 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(2))) { isFree = true; - } else if ((this->actor.params & 3) == 3 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(3))) { + } else if (PARAMS_GET_U(this->actor.params, 0, 2) == 3 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(3))) { isFree = true; } @@ -200,7 +200,7 @@ void EnDaiku_Init(Actor* thisx, PlayState* play) { this->stateFlags |= ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2; this->actionFunc = EnDaiku_Jailed; } else { - if ((this->actor.params & 3) == 1 || (this->actor.params & 3) == 3) { + if (PARAMS_GET_U(this->actor.params, 0, 2) == 1 || PARAMS_GET_U(this->actor.params, 0, 2) == 3) { EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_SIT, &this->currentAnimIndex); this->stateFlags |= ENDAIKU_STATEFLAG_1; } else { @@ -295,7 +295,7 @@ void EnDaiku_UpdateText(EnDaiku* this, PlayState* play) { this->actor.textId = 0x6007; } } else if (play->sceneId == SCENE_CARPENTERS_TENT) { - switch (this->actor.params & 3) { + switch (PARAMS_GET_U(this->actor.params, 0, 2)) { case 0: if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { this->actor.textId = 0x6060; @@ -378,7 +378,7 @@ void EnDaiku_Jailed(EnDaiku* this, PlayState* play) { void EnDaiku_WaitFreedom(EnDaiku* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; EnDaiku_UpdateText(this, play); } @@ -400,14 +400,14 @@ void EnDaiku_InitEscape(EnDaiku* this, PlayState* play) { this->stateFlags &= ~(ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2); gSaveContext.save.info.eventChkInf[EVENTCHKINF_CARPENTERS_FREE_INDEX] |= - EVENTCHKINF_CARPENTERS_FREE_MASK(this->actor.params & 3); + EVENTCHKINF_CARPENTERS_FREE_MASK(PARAMS_GET_U(this->actor.params, 0, 2)); this->actor.gravity = -1.0f; - this->escapeSubCamTimer = sEscapeSubCamParams[this->actor.params & 3].maxFramesActive; + this->escapeSubCamTimer = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].maxFramesActive; EnDaiku_InitSubCamera(this, play); exitLoop = false; - path = &play->pathList[this->actor.params >> 4 & 0xF]; + path = &play->pathList[PARAMS_GET_U(this->actor.params, 4, 4)]; while (!exitLoop) { pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint; dx = pointPos->x - this->actor.world.pos.x; @@ -444,11 +444,11 @@ void EnDaiku_InitSubCamera(EnDaiku* this, PlayState* play) { Vec3f eyePosDeltaWorld; this->subCamActive = true; - this->escapeSubCamTimer = sEscapeSubCamParams[this->actor.params & 3].maxFramesActive; + this->escapeSubCamTimer = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].maxFramesActive; - eyePosDeltaLocal.x = sEscapeSubCamParams[this->actor.params & 3].eyePosDeltaLocal.x; - eyePosDeltaLocal.y = sEscapeSubCamParams[this->actor.params & 3].eyePosDeltaLocal.y; - eyePosDeltaLocal.z = sEscapeSubCamParams[this->actor.params & 3].eyePosDeltaLocal.z; + eyePosDeltaLocal.x = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].eyePosDeltaLocal.x; + eyePosDeltaLocal.y = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].eyePosDeltaLocal.y; + eyePosDeltaLocal.z = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].eyePosDeltaLocal.z; Matrix_RotateY(BINANG_TO_RAD(this->actor.world.rot.y), MTXMODE_NEW); Matrix_MultVec3f(&eyePosDeltaLocal, &eyePosDeltaWorld); @@ -524,7 +524,7 @@ void EnDaiku_EscapeRun(EnDaiku* this, PlayState* play) { f32 dxz; Vec3s* pointPos; - path = &play->pathList[this->actor.params >> 4 & 0xF]; + path = &play->pathList[PARAMS_GET_U(this->actor.params, 4, 4)]; pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint; dx = pointPos->x - this->actor.world.pos.x; dz = pointPos->z - this->actor.world.pos.z; @@ -594,13 +594,13 @@ void EnDaiku_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - if ((thisx->params & 3) == 0) { + if (PARAMS_GET_U(thisx->params, 0, 2) == 0) { gDPSetEnvColor(POLY_OPA_DISP++, 170, 10, 70, 255); - } else if ((thisx->params & 3) == 1) { + } else if (PARAMS_GET_U(thisx->params, 0, 2) == 1) { gDPSetEnvColor(POLY_OPA_DISP++, 170, 200, 255, 255); - } else if ((thisx->params & 3) == 2) { + } else if (PARAMS_GET_U(thisx->params, 0, 2) == 2) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 230, 70, 255); - } else if ((thisx->params & 3) == 3) { + } else if (PARAMS_GET_U(thisx->params, 0, 2) == 3) { gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 150, 255); } @@ -637,7 +637,7 @@ void EnDaiku_PostLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3s* rot, vo if (limb == 15) { // head Matrix_MultVec3f(&targetPosHeadLocal, &this->actor.focus.pos); - gSPDisplayList(POLY_OPA_DISP++, hairDLists[this->actor.params & 3]); + gSPDisplayList(POLY_OPA_DISP++, hairDLists[PARAMS_GET_U(this->actor.params, 0, 2)]); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku.c", 1330); diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c index 1fc53f1adb..4efda14ceb 100644 --- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c +++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c @@ -133,7 +133,7 @@ void EnDaikuKakariko_Init(Actor* thisx, PlayState* play) { case SCENE_KAKARIKO_VILLAGE: if (IS_DAY) { this->flags |= 1; - this->flags |= initFlags[this->actor.params & 3]; + this->flags |= initFlags[PARAMS_GET_U(this->actor.params, 0, 2)]; } break; case SCENE_KAKARIKO_CENTER_GUEST_HOUSE: @@ -184,7 +184,8 @@ void EnDaikuKakariko_Init(Actor* thisx, PlayState* play) { this->actionFunc = EnDaikuKakariko_Run; } else { if (this->flags & 8) { - if (((this->actor.params & 3) == CARPENTER_SABOORO) || ((this->actor.params & 3) == CARPENTER_SHIRO)) { + if ((PARAMS_GET_U(this->actor.params, 0, 2) == CARPENTER_SABOORO) || + (PARAMS_GET_U(this->actor.params, 0, 2) == CARPENTER_SHIRO)) { EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_5, &this->currentAnimIndex); this->flags |= 0x800; } else { @@ -244,10 +245,11 @@ void EnDaikuKakariko_HandleTalking(EnDaikuKakariko* this, PlayState* play) { if ((sp26 >= 0) && (sp26 <= 320) && (sp24 >= 0) && (sp24 <= 240) && (this->talkState == 0) && (Actor_OfferTalk(&this->actor, play, 100.0f) == 1)) { - this->actor.textId = MaskReaction_GetTextId(play, sMaskReactionSets[this->actor.params & 3]); + this->actor.textId = + MaskReaction_GetTextId(play, sMaskReactionSets[PARAMS_GET_U(this->actor.params, 0, 2)]); if (this->actor.textId == 0) { - switch (this->actor.params & 3) { + switch (PARAMS_GET_U(this->actor.params, 0, 2)) { case 0: if (this->flags & 8) { this->actor.textId = 0x5076; @@ -364,7 +366,7 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, PlayState* play) { s32 run; do { - path = &play->pathList[(this->actor.params >> 8) & 0xFF]; + path = &play->pathList[PARAMS_GET_U(this->actor.params, 8, 8)]; pathPos = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->waypoint]; xDist = pathPos->x - this->actor.world.pos.x; zDist = pathPos->z - this->actor.world.pos.z; @@ -536,7 +538,7 @@ void EnDaikuKakariko_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, V if (limbIndex == 15) { Matrix_MultVec3f(&unkVec, &this->actor.focus.pos); - gSPDisplayList(POLY_OPA_DISP++, carpenterHeadDLists[this->actor.params & 3]); + gSPDisplayList(POLY_OPA_DISP++, carpenterHeadDLists[PARAMS_GET_U(this->actor.params, 0, 2)]); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku_kakariko.c", 1113); @@ -549,13 +551,13 @@ void EnDaikuKakariko_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - if ((thisx->params & 3) == CARPENTER_ICHIRO) { + if (PARAMS_GET_U(thisx->params, 0, 2) == CARPENTER_ICHIRO) { gDPSetEnvColor(POLY_OPA_DISP++, 170, 10, 70, 255); - } else if ((thisx->params & 3) == CARPENTER_SABOORO) { + } else if (PARAMS_GET_U(thisx->params, 0, 2) == CARPENTER_SABOORO) { gDPSetEnvColor(POLY_OPA_DISP++, 170, 200, 255, 255); - } else if ((thisx->params & 3) == CARPENTER_JIRO) { + } else if (PARAMS_GET_U(thisx->params, 0, 2) == CARPENTER_JIRO) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 230, 70, 255); - } else if ((thisx->params & 3) == CARPENTER_SHIRO) { + } else if (PARAMS_GET_U(thisx->params, 0, 2) == CARPENTER_SHIRO) { gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 150, 255); } diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index 583c09705c..b34e0eb63b 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -119,7 +119,7 @@ void EnDekunuts_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); - this->shotsPerRound = ((thisx->params >> 8) & 0xFF); + this->shotsPerRound = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; if ((this->shotsPerRound == 0xFF) || (this->shotsPerRound == 0)) { this->shotsPerRound = 1; diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/src/overlays/actors/ovl_En_Dog/z_en_dog.c index b9d4129e5c..320bfbc98b 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -190,7 +190,7 @@ s8 EnDog_CanFollow(EnDog* this, PlayState* play) { if (gSaveContext.dogParams != 0) { return 0; } - gSaveContext.dogParams = (this->actor.params & 0x7FFF); + gSaveContext.dogParams = PARAMS_GET_S(this->actor.params, 0, 15); return 1; } @@ -248,12 +248,12 @@ void EnDog_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, NULL, this->jointTable, this->morphTable, 13); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDOG_ANIM_0); - if ((this->actor.params & 0x8000) == 0) { - this->actor.params = (this->actor.params & 0xF0FF) | ((((this->actor.params & 0x0F00) >> 8) + 1) << 8); + if (!PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) { + this->actor.params = (this->actor.params & ~(0xF << 8)) | ((PARAMS_GET_S(this->actor.params, 8, 4) + 1) << 8); } followingDog = ((gSaveContext.dogParams & 0x0F00) >> 8); - if (followingDog == ((this->actor.params & 0x0F00) >> 8) && ((this->actor.params & 0x8000) == 0)) { + if (followingDog == PARAMS_GET_S(this->actor.params, 8, 4) && !PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) { Actor_Kill(&this->actor); return; } @@ -264,16 +264,16 @@ void EnDog_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.0075f); this->waypoint = 0; this->actor.gravity = -1.0f; - this->path = Path_GetByIndex(play, (this->actor.params & 0x00F0) >> 4, 0xF); + this->path = Path_GetByIndex(play, PARAMS_GET_S(this->actor.params, 4, 4), 0xF); switch (play->sceneId) { case SCENE_MARKET_NIGHT: - if ((!gSaveContext.dogIsLost) && (((this->actor.params & 0x0F00) >> 8) == 1)) { + if ((!gSaveContext.dogIsLost) && PARAMS_GET_S(this->actor.params, 8, 4) == 1) { Actor_Kill(&this->actor); } break; case SCENE_DOG_LADY_HOUSE: // Richard's Home - if (!(this->actor.params & 0x8000)) { + if (!PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) { if (!gSaveContext.dogIsLost) { this->nextBehavior = DOG_SIT; this->actionFunc = EnDog_Wait; @@ -287,7 +287,7 @@ void EnDog_Init(Actor* thisx, PlayState* play) { break; } - if (this->actor.params & 0x8000) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) { this->nextBehavior = DOG_WALK; this->actionFunc = EnDog_FollowPlayer; } else { @@ -477,8 +477,9 @@ void EnDog_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); - gDPSetEnvColor(POLY_OPA_DISP++, colors[this->actor.params & 0xF].r, colors[this->actor.params & 0xF].g, - colors[this->actor.params & 0xF].b, colors[this->actor.params & 0xF].a); + gDPSetEnvColor(POLY_OPA_DISP++, colors[PARAMS_GET_S(this->actor.params, 0, 4)].r, + colors[PARAMS_GET_S(this->actor.params, 0, 4)].g, colors[PARAMS_GET_S(this->actor.params, 0, 4)].b, + colors[PARAMS_GET_S(this->actor.params, 0, 4)].a); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDog_OverrideLimbDraw, EnDog_PostLimbDraw, this); diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 294918cfc7..fdb8cf1b9b 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -144,7 +144,7 @@ void EnDoor_Init(Actor* thisx, PlayState* play2) { } // Double doors - if (ENDOOR_IS_DOUBLE_DOOR(&this->actor)) { + if (ENDOOR_GET_IS_DOUBLE_DOOR(&this->actor)) { EnDoor* other; xOffset = Math_CosS(this->actor.shape.rot.y) * 30.0f; @@ -152,7 +152,7 @@ void EnDoor_Init(Actor* thisx, PlayState* play2) { other = (EnDoor*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DOOR, this->actor.world.pos.x + xOffset, this->actor.world.pos.y, this->actor.world.pos.z - zOffset, 0, this->actor.shape.rot.y + 0x8000, 0, - this->actor.params & ~ENDOOR_PARAMS_DOUBLE_DOOR_FLAG); + this->actor.params & ~ENDOOR_PARAMS_IS_DOUBLE_DOOR_MASK); if (other != NULL) { other->unk_192 = 1; } diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.h b/src/overlays/actors/ovl_En_Door/z_en_door.h index 11ab5a5aa2..608702b6f3 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.h +++ b/src/overlays/actors/ovl_En_Door/z_en_door.h @@ -22,14 +22,16 @@ * */ -#define ENDOOR_PARAMS_TYPE_SHIFT 7 -#define ENDOOR_PARAMS_TYPE_MASK (7 << ENDOOR_PARAMS_TYPE_SHIFT) -#define ENDOOR_GET_TYPE(thisx) ((thisx)->params >> ENDOOR_PARAMS_TYPE_SHIFT & 7) -#define ENDOOR_PARAMS_DOUBLE_DOOR_FLAG 0x40 -#define ENDOOR_IS_DOUBLE_DOOR(thisx) ((thisx)->params & ENDOOR_PARAMS_DOUBLE_DOOR_FLAG) -#define ENDOOR_GET_LOCKED_SWITCH_FLAG(thisx) ((thisx)->params & 0x3F) -#define ENDOOR_GET_CHECKABLE_TEXT_ID(thisx) ((thisx)->params & 0x3F) +#define ENDOOR_PARAMS_TYPE_SHIFT 7 +#define ENDOOR_PARAMS_TYPE_MASK PARAMS_MAKE_MASK(7, 3) +#define ENDOOR_GET_TYPE(thisx) PARAMS_GET_U((thisx)->params, 7, 3) +#define ENDOOR_PARAMS_IS_DOUBLE_DOOR_MASK PARAMS_MAKE_MASK(6, 1) +#define ENDOOR_GET_IS_DOUBLE_DOOR(thisx) PARAMS_GET_NOSHIFT((thisx)->params, 6, 1) + +#define ENDOOR_GET_LOCKED_SWITCH_FLAG(thisx) PARAMS_GET_U((thisx)->params, 0, 6) + +#define ENDOOR_GET_CHECKABLE_TEXT_ID(thisx) PARAMS_GET_U((thisx)->params, 0, 6) typedef enum EnDoorType { /* 0x00 */ DOOR_ROOMLOAD, // loads rooms diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index fb342b6152..abc426e329 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -44,9 +44,9 @@ void EnEncount1_Init(Actor* thisx, PlayState* play) { return; } - this->spawnType = (this->actor.params >> 0xB) & 0x1F; - this->maxCurSpawns = (this->actor.params >> 6) & 0x1F; - this->maxTotalSpawns = this->actor.params & 0x3F; + this->spawnType = PARAMS_GET_U(this->actor.params, 11, 5); + this->maxCurSpawns = PARAMS_GET_U(this->actor.params, 6, 5); + this->maxTotalSpawns = PARAMS_GET_U(this->actor.params, 0, 6); this->curNumSpawn = this->totalNumSpawn = 0; spawnRange = 120.0f + (40.0f * this->actor.world.rot.z); this->spawnRange = spawnRange; diff --git a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c index bf6028d8e0..49b2b458bd 100644 --- a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c +++ b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c @@ -52,8 +52,8 @@ void EnExItem_Init(Actor* thisx, PlayState* play) { EnExItem* this = (EnExItem*)thisx; this->actor.flags &= ~ACTOR_FLAG_0; - this->type = this->actor.params & 0xFF; - this->unusedParam = (this->actor.params >> 8) & 0xFF; + this->type = PARAMS_GET_U(this->actor.params, 0, 8); + this->unusedParam = PARAMS_GET_U(this->actor.params, 8, 8); PRINTF("\n\n"); // "What will come out?" PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ なにがでるかな? ☆☆☆☆☆ %d\n" VT_RST, this->type); diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 53bc2e2285..4024e71682 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -10,9 +10,6 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9) -#define FLG_COREDEAD (0x4000) -#define FLG_COREDONE (0x8000) - void EnFd_Init(Actor* thisx, PlayState* play); void EnFd_Destroy(Actor* thisx, PlayState* play); void EnFd_Update(Actor* thisx, PlayState* play); @@ -627,6 +624,9 @@ void EnFd_Run(EnFd* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speed, 8.0f, 0.1f, 1.0f, 0.0f); } +#define FLG_COREDEAD (0x4000) +#define FLG_COREDONE (0x8000) + /** * En_Fw will set `this` params when it is done with its action. * It will set FLG_COREDONE when the core has returned to `this`'s initial @@ -638,9 +638,9 @@ void EnFd_WaitForCore(EnFd* this, PlayState* play) { if (this->spinTimer == 0) { Actor_Kill(&this->actor); } - } else if (this->actor.params & FLG_COREDONE) { + } else if (PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) { // FLG_COREDONE this->actionFunc = EnFd_Reappear; - } else if (this->actor.params & FLG_COREDEAD) { + } else if (PARAMS_GET_NOSHIFT(this->actor.params, 14, 1)) { // FLG_COREDEAD this->actor.params = 0; this->spinTimer = 30; } diff --git a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c index 31983c96dd..f3c9f148d0 100644 --- a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c +++ b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c @@ -155,7 +155,7 @@ void func_80A0E70C(EnFdFire* this, PlayState* play) { this->actor.velocity = velocity; this->actor.speed = 0.0f; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; - if (this->actor.params & 0x8000) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) { this->deathTimer = 200; this->actionFunc = EnFdFire_DanceTowardsPlayer; } else { @@ -179,7 +179,7 @@ void EnFdFire_DanceTowardsPlayer(EnFdFire* this, PlayState* play) { Vec3f pos; s16 idx; - idx = ((play->state.frames / 10) + (this->actor.params & 0x7FFF)) % ARRAY_COUNT(angles); + idx = ((play->state.frames / 10) + PARAMS_GET_S(this->actor.params, 0, 15)) % ARRAY_COUNT(angles); pos = player->actor.world.pos; pos.x += 120.0f * sinf(angles[idx]); pos.z += 120.0f * cosf(angles[idx]); @@ -268,12 +268,12 @@ void EnFdFire_Draw(Actor* thisx, PlayState* play) { gSPSegment(POLY_XLU_DISP++, 0x8, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x40, 1, 0, play->state.frames * this->tile2Y, 0x20, 0x80)); - gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, primColors[((thisx->params & 0x8000) >> 0xF)].r, - primColors[((thisx->params & 0x8000) >> 0xF)].g, primColors[((thisx->params & 0x8000) >> 0xF)].b, - primColors[((thisx->params & 0x8000) >> 0xF)].a); - gDPSetEnvColor(POLY_XLU_DISP++, envColors[((thisx->params & 0x8000) >> 0xF)].r, - envColors[((thisx->params & 0x8000) >> 0xF)].g, envColors[((thisx->params & 0x8000) >> 0xF)].b, - envColors[((thisx->params & 0x8000) >> 0xF)].a); + gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, primColors[PARAMS_GET_S(thisx->params, 15, 1)].r, + primColors[PARAMS_GET_S(thisx->params, 15, 1)].g, primColors[PARAMS_GET_S(thisx->params, 15, 1)].b, + primColors[PARAMS_GET_S(thisx->params, 15, 1)].a); + gDPSetEnvColor(POLY_XLU_DISP++, envColors[PARAMS_GET_S(thisx->params, 15, 1)].r, + envColors[PARAMS_GET_S(thisx->params, 15, 1)].g, envColors[PARAMS_GET_S(thisx->params, 15, 1)].b, + envColors[PARAMS_GET_S(thisx->params, 15, 1)].a); gDPPipeSync(POLY_XLU_DISP++); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index b77c6d2710..fe8bb5be3a 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -146,7 +146,7 @@ void EnFirefly_Init(Actor* thisx, PlayState* play) { Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - if ((this->actor.params & 0x8000) != 0) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 15, 1) != 0) { this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; if (1) {} this->actor.draw = EnFirefly_DrawInvisible; diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 6da11b6f5d..f95d077d5d 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -133,7 +133,7 @@ void EnFloormas_Init(Actor* thisx, PlayState* play2) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->zOffset = -1600; - invisble = this->actor.params & SPAWN_INVISIBLE; + invisble = PARAMS_GET_NOSHIFT(this->actor.params, 15, 1); // SPAWN_INVISIBLE // s16 cast needed this->actor.params &= (s16) ~(SPAWN_INVISIBLE); diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index 4aeda80522..663991c54e 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -82,8 +82,8 @@ void EnGSwitch_Init(Actor* thisx, PlayState* play) { if (play) {} - this->type = (this->actor.params >> 0xC) & 0xF; - this->switchFlag = this->actor.params & 0x3F; + this->type = PARAMS_GET_U(this->actor.params, 12, 4); + this->switchFlag = PARAMS_GET_U(this->actor.params, 0, 6); this->numEffects = EN_GSWITCH_EFFECT_COUNT; // "index" PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ インデックス ☆☆☆☆☆ %x\n" VT_RST, this->type); @@ -95,7 +95,9 @@ void EnGSwitch_Init(Actor* thisx, PlayState* play) { // "parent switch spawn" PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 親スイッチ発生 ☆☆☆☆☆ %x\n" VT_RST, this->actor.params); sCollectedCount = 0; - this->silverCount = this->actor.params >> 6; + // Ideally the following two lines would be + // this->silverCount = PARAMS_GET_U(this->actor.params, 6, 6); + this->silverCount = PARAMS_GET_NOMASK(this->actor.params, 6); this->silverCount &= 0x3F; // "maximum number of checks" PRINTF(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 最大チェック数 ☆☆☆☆☆ %d\n" VT_RST, this->silverCount); diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 5379f11ed5..5a6bbadc68 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -103,7 +103,7 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { this->actor.uncullZoneForward = ((play->sceneId == SCENE_GERUDO_VALLEY) ? 1000.0f : 1200.0f); - switch (this->actor.params & 0xFF) { + switch (PARAMS_GET_U(this->actor.params, 0, 8)) { case GE1_TYPE_GATE_GUARD: this->hairstyle = GE1_HAIR_SPIKY; @@ -329,7 +329,7 @@ void EnGe1_WaitTillOpened_GTGGuard(EnGe1* this, PlayState* play) { void EnGe1_Open_GTGGuard(EnGe1* this, PlayState* play) { if (this->stateFlags & GE1_STATE_IDLE_ANIM) { this->actionFunc = EnGe1_WaitTillOpened_GTGGuard; - Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); this->cutsceneTimer = 50; Message_CloseTextbox(play); } else if ((this->skelAnime.curFrame == 15.0f) || (this->skelAnime.curFrame == 19.0f)) { @@ -422,7 +422,7 @@ void EnGe1_WaitUntilGateOpened_GateOp(EnGe1* this, PlayState* play) { void EnGe1_OpenGate_GateOp(EnGe1* this, PlayState* play) { if (this->stateFlags & GE1_STATE_IDLE_ANIM) { this->actionFunc = EnGe1_WaitUntilGateOpened_GateOp; - Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); this->cutsceneTimer = 50; Message_CloseTextbox(play); } else if ((this->skelAnime.curFrame == 15.0f) || (this->skelAnime.curFrame == 19.0f)) { @@ -444,7 +444,7 @@ void EnGe1_SetupOpenGate_GateOp(EnGe1* this, PlayState* play) { } void EnGe1_CheckGate_GateOp(EnGe1* this, PlayState* play) { - if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { EnGe1_SetTalkAction(this, play, 0x6018, 100.0f, EnGe1_WaitGateOpen_GateOp); } else { EnGe1_SetTalkAction(this, play, 0x6017, 100.0f, EnGe1_SetupOpenGate_GateOp); diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 7818f4d8dd..5b51c9d9ab 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -133,7 +133,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { this->actor.world.rot.z = 0; this->actor.shape.rot.z = 0; - switch (thisx->params & 0xFF) { + switch (PARAMS_GET_S(thisx->params, 0, 8)) { case GE2_TYPE_PATROLLING: EnGe2_ChangeAction(this, GE2_ACTION_WALK); if (EnGe2_CheckCarpentersFreed()) { @@ -166,7 +166,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { this->actor.minVelocityY = -4.0f; this->actor.gravity = -1.0f; this->walkDirection = this->actor.world.rot.y; - this->walkDuration = ((thisx->params & 0xFF00) >> 8) * 10; + this->walkDuration = PARAMS_GET_S(thisx->params, 8, 8) * 10; } void EnGe2_Destroy(Actor* thisx, PlayState* play) { @@ -426,7 +426,7 @@ void EnGe2_LookAtPlayer(EnGe2* this, PlayState* play) { void EnGe2_SetActionAfterTalk(EnGe2* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - switch (this->actor.params & 0xFF) { + switch (PARAMS_GET_S(this->actor.params, 0, 8)) { case GE2_TYPE_PATROLLING: EnGe2_ChangeAction(this, GE2_ACTION_ABOUTTURN); break; @@ -521,7 +521,7 @@ void EnGe2_UpdateFriendly(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if (Actor_TalkOfferAccepted(&this->actor, play)) { - if ((this->actor.params & 0xFF) == GE2_TYPE_PATROLLING) { + if (PARAMS_GET_S(this->actor.params, 0, 8) == GE2_TYPE_PATROLLING) { this->actor.speed = 0.0f; EnGe2_ChangeAction(this, GE2_ACTION_WAITLOOKATPLAYER); } @@ -578,7 +578,7 @@ void EnGe2_Update(Actor* thisx, PlayState* play) { EnGe2_SetupCapturePlayer(this, play); } - if (((this->actor.params & 0xFF) == GE2_TYPE_STATIONARY) && (this->actor.xzDistToPlayer < 100.0f)) { + if ((PARAMS_GET_S(this->actor.params, 0, 8) == GE2_TYPE_STATIONARY) && (this->actor.xzDistToPlayer < 100.0f)) { // "Discovered!" PRINTF(VT_FGCOL(GREEN) "発見!!!!!!!!!!!!\n" VT_RST); EnGe2_SetupCapturePlayer(this, play); @@ -586,7 +586,7 @@ void EnGe2_Update(Actor* thisx, PlayState* play) { } if (!(this->stateFlags & GE2_STATE_KO)) { - paramsType = this->actor.params & 0xFF; // Not necessary, but looks a bit nicer + paramsType = PARAMS_GET_S(this->actor.params, 0, 8); // Not necessary, but looks a bit nicer if ((paramsType == GE2_TYPE_PATROLLING) || (paramsType == GE2_TYPE_STATIONARY)) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c index bc1eff34bf..469f88b78e 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -228,7 +228,7 @@ void EnGeldB_Init(Actor* thisx, PlayState* play) { thisx->colChkInfo.cylRadius = 50; thisx->colChkInfo.cylHeight = 100; thisx->naviEnemyId = NAVI_ENEMY_GERUDO_THIEF; - this->keyFlag = thisx->params & 0xFF00; + this->keyFlag = PARAMS_GET_NOSHIFT(thisx->params, 8, 8); thisx->params &= 0xFF; this->blinkState = 0; this->unkFloat = 10.0f; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index e9f3cbf303..086e630a82 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -89,7 +89,7 @@ void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) { u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { Player* player = GET_PLAYER(play); - switch (thisx->params & 0xF0) { + switch (PARAMS_GET_NOSHIFT(thisx->params, 4, 4)) { case 0x90: if (gSaveContext.save.info.playerData.bgsFlag) { return 0x305E; @@ -133,7 +133,7 @@ u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { } } case 0x10: - if (Flags_GetSwitch(play, thisx->params >> 8)) { + if (Flags_GetSwitch(play, PARAMS_GET_NOMASK(thisx->params, 8))) { return 0x3052; } else { return 0x3051; @@ -349,26 +349,30 @@ s32 EnGo_UpdateTalking(PlayState* play, Actor* thisx, s16* talkState, f32 intera void EnGo_ChangeAnim(EnGo* this, s32 index) { Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, - sAnimationInfo[index].playSpeed * ((this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f), 0.0f, - Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, + sAnimationInfo[index].playSpeed * + (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f), + 0.0f, Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } s32 EnGo_IsActorSpawned(EnGo* this, PlayState* play) { if (((this->actor.params) & 0xF0) == 0x90) { return true; - } else if (play->sceneId == SCENE_FIRE_TEMPLE && !Flags_GetSwitch(play, (this->actor.params) >> 8) && - LINK_IS_ADULT && (this->actor.params & 0xF0) == 0x10) { + } else if (play->sceneId == SCENE_FIRE_TEMPLE && !Flags_GetSwitch(play, PARAMS_GET_NOMASK(this->actor.params, 8)) && + LINK_IS_ADULT && PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x10) { return true; - } else if (play->sceneId == SCENE_GORON_CITY && LINK_IS_ADULT && (this->actor.params & 0xF0) == 0x00) { + } else if (play->sceneId == SCENE_GORON_CITY && LINK_IS_ADULT && + PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x00) { return true; } else if (play->sceneId == SCENE_DEATH_MOUNTAIN_TRAIL && LINK_IS_CHILD && - ((this->actor.params & 0xF0) == 0x20 || (this->actor.params & 0xF0) == 0x30 || - (this->actor.params & 0xF0) == 0x40)) { + (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x20 || + PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x30 || + PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x40)) { return true; } else if (play->sceneId == SCENE_GORON_CITY && LINK_IS_CHILD && - ((this->actor.params & 0xF0) == 0x50 || (this->actor.params & 0xF0) == 0x60 || - (this->actor.params & 0xF0) == 0x70)) { + (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x50 || + PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x60 || + PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x70)) { return true; } else { return false; @@ -376,7 +380,7 @@ s32 EnGo_IsActorSpawned(EnGo* this, PlayState* play) { } f32 EnGo_GetPlayerTrackingYOffset(EnGo* this) { - switch (this->actor.params & 0xF0) { + switch (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4)) { case 0x00: return 10.0f; case 0x20: @@ -426,7 +430,7 @@ s32 EnGo_IsCameraModified(EnGo* this, PlayState* play) { } xyzDistSq = (this->actor.scale.x / 0.01f) * SQ(100.0f); - if ((this->actor.params & 0xF0) == 0x90) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) { Camera_RequestSetting(mainCam, CAM_SET_DIRECTED_YAW); xyzDistSq *= 4.8f; } @@ -467,11 +471,11 @@ s32 EnGo_FollowPath(EnGo* this, PlayState* play) { f32 xDist; f32 zDist; - if ((this->actor.params & 0xF) == 15) { + if (PARAMS_GET_U(this->actor.params, 0, 4) == 15) { return false; } - path = &play->pathList[this->actor.params & 0xF]; + path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 4)]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += this->unk_218; xDist = pointPos->x - this->actor.world.pos.x; @@ -484,9 +488,9 @@ s32 EnGo_FollowPath(EnGo* this, PlayState* play) { this->unk_218 = 0; } - if ((this->actor.params & 0xF0) != 0x00) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x00) { return true; - } else if (Flags_GetSwitch(play, this->actor.params >> 8)) { + } else if (Flags_GetSwitch(play, PARAMS_GET_NOMASK(this->actor.params, 8))) { return true; } else if (this->unk_218 >= this->actor.shape.rot.z) { this->unk_218 = 0; @@ -502,10 +506,10 @@ s32 EnGo_SetMovedPos(EnGo* this, PlayState* play) { Path* path; Vec3s* pointPos; - if ((this->actor.params & 0xF) == 0xF) { + if (PARAMS_GET_U(this->actor.params, 0, 4) == 0xF) { return false; } else { - path = &play->pathList[this->actor.params & 0xF]; + path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 4)]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += (path->count - 1); this->actor.world.pos.x = pointPos->x; @@ -579,11 +583,11 @@ void func_80A3F908(EnGo* this, PlayState* play) { interactRange = (this->collider.dim.radius + 30.0f); interactRange *= (this->actor.scale.x / 0.01f); - if ((this->actor.params & 0xF0) == 0x90) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) { interactRange *= 4.8f; } - if ((this->actor.params & 0xF0) == 0x90) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) { dialogStarted = EnGo_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, interactRange, EnGo_GetTextID, EnGo_UpdateTalkState); } else { @@ -591,7 +595,7 @@ void func_80A3F908(EnGo* this, PlayState* play) { EnGo_GetTextID, EnGo_UpdateTalkState); } - if (((this->actor.params & 0xF0) == 0x90) && (dialogStarted == true)) { + if ((PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) && (dialogStarted == true)) { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_BROKEN_GORONS_SWORD) { if (func_8002F368(play) == EXCH_ITEM_BROKEN_GORONS_SWORD) { if (GET_INFTABLE(INFTABLE_B4)) { @@ -634,7 +638,7 @@ void EnGo_Init(Actor* thisx, PlayState* play) { return; } - if ((this->actor.params & 0xF0) && ((this->actor.params & 0xF0) != 0x90)) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) && (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x90)) { this->actor.flags &= ~ACTOR_FLAG_4; this->actor.flags &= ~ACTOR_FLAG_5; } @@ -644,7 +648,7 @@ void EnGo_Init(Actor* thisx, PlayState* play) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; this->actor.gravity = -1.0f; - switch (this->actor.params & 0xF0) { + switch (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4)) { case 0x00: Actor_SetScale(&this->actor, 0.008f); if (CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) { @@ -746,7 +750,7 @@ void func_80A4008C(EnGo* this, PlayState* play) { } void EnGo_GoronLinkRolling(EnGo* this, PlayState* play) { - if ((EnGo_FollowPath(this, play) == true) && Flags_GetSwitch(play, this->actor.params >> 8) && + if ((EnGo_FollowPath(this, play) == true) && Flags_GetSwitch(play, PARAMS_GET_NOMASK(this->actor.params, 8)) && (this->unk_218 == 0)) { this->actor.speed = 0.0f; EnGo_SetupAction(this, func_80A4008C); @@ -769,10 +773,10 @@ void EnGo_CurledUp(EnGo* this, PlayState* play) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->skelAnime.playSpeed = 0.1f; - this->skelAnime.playSpeed *= (this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f; + this->skelAnime.playSpeed *= PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f; EnGo_SetupAction(this, EnGo_WakeUp); - if ((this->actor.params & 0xF0) == 0x90) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) { OnePointCutscene_Init(play, 4200, -99, &this->actor, CAM_ID_MAIN); } } @@ -782,8 +786,9 @@ void EnGo_WakeUp(EnGo* this, PlayState* play) { f32 frame; if (this->skelAnime.playSpeed != 0.0f) { - Math_SmoothStepToF(&this->skelAnime.playSpeed, ((this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f) * 0.5f, 0.1f, - 1000.0f, 0.1f); + Math_SmoothStepToF(&this->skelAnime.playSpeed, + (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f) * 0.5f, 0.1f, 1000.0f, + 0.1f); frame = this->skelAnime.curFrame; frame += this->skelAnime.playSpeed; @@ -792,7 +797,7 @@ void EnGo_WakeUp(EnGo* this, PlayState* play) { } else { this->skelAnime.curFrame = 12.0f; this->skelAnime.playSpeed = 0.0f; - if ((this->actor.params & 0xF0) != 0x90) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x90) { this->unk_212 = 30; return; } @@ -813,8 +818,9 @@ void EnGo_WakeUp(EnGo* this, PlayState* play) { void func_80A40494(EnGo* this, PlayState* play) { f32 frame; - Math_SmoothStepToF(&this->skelAnime.playSpeed, ((this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f) * -0.5f, 0.1f, - 1000.0f, 0.1f); + Math_SmoothStepToF(&this->skelAnime.playSpeed, + (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f) * -0.5f, 0.1f, 1000.0f, + 0.1f); frame = this->skelAnime.curFrame; frame += this->skelAnime.playSpeed; @@ -835,8 +841,8 @@ void func_80A405CC(EnGo* this, PlayState* play) { f32 frame; lastFrame = Animation_GetLastFrame(&gGoronAnim_004930); - Math_SmoothStepToF(&this->skelAnime.playSpeed, (this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f, 0.1f, 1000.0f, - 0.1f); + Math_SmoothStepToF(&this->skelAnime.playSpeed, PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f, + 0.1f, 1000.0f, 0.1f); frame = this->skelAnime.curFrame; frame += this->skelAnime.playSpeed; @@ -845,7 +851,7 @@ void func_80A405CC(EnGo* this, PlayState* play) { this->skelAnime.curFrame = lastFrame; this->skelAnime.playSpeed = 0.0f; this->unk_212 = Rand_S16Offset(30, 30); - if (((this->actor.params & 0xF0) == 0x40) && !GET_INFTABLE(INFTABLE_EB)) { + if ((PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x40) && !GET_INFTABLE(INFTABLE_EB)) { EnGo_SetupAction(this, func_80A40B1C); } else { EnGo_SetupAction(this, EnGo_BiggoronActionFunc); @@ -854,7 +860,8 @@ void func_80A405CC(EnGo* this, PlayState* play) { } void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { - if (((this->actor.params & 0xF0) == 0x90) && (this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) { + if ((PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) && + (this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) { if (gSaveContext.save.info.playerData.bgsFlag) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; } else { @@ -873,7 +880,8 @@ void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { EnGo_GetItem(this, play); } } - } else if (((this->actor.params & 0xF0) == 0) && (this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) { + } else if ((PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0) && + (this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) { EnGo_SetupAction(this, EnGo_GetItem); play->msgCtx.stateTimer = 4; play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; @@ -881,7 +889,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { if ((DECR(this->unk_212) == 0) && !EnGo_IsCameraModified(this, play)) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = -0.1f; - this->skelAnime.playSpeed *= (this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f; + this->skelAnime.playSpeed *= PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f; EnGo_SetupAction(this, func_80A408D8); } } @@ -891,8 +899,9 @@ void func_80A408D8(EnGo* this, PlayState* play) { f32 frame; if (this->skelAnime.playSpeed != 0.0f) { - Math_SmoothStepToF(&this->skelAnime.playSpeed, ((this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f) * -1.0f, - 0.1f, 1000.0f, 0.1f); + Math_SmoothStepToF(&this->skelAnime.playSpeed, + (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f) * -1.0f, 0.1f, 1000.0f, + 0.1f); frame = this->skelAnime.curFrame; frame += this->skelAnime.playSpeed; if (frame >= 12.0f) { @@ -900,7 +909,7 @@ void func_80A408D8(EnGo* this, PlayState* play) { } else { this->skelAnime.curFrame = 12.0f; this->skelAnime.playSpeed = 0.0f; - if ((this->actor.params & 0xF0) != 0x90) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x90) { this->unk_212 = 30; return; } @@ -951,7 +960,7 @@ void EnGo_GetItem(EnGo* this, PlayState* play) { EnGo_SetupAction(this, func_80A40C78); } else { this->unk_20C = 0; - if ((this->actor.params & 0xF0) == 0x90) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_CLAIM_CHECK) { getItemId = GI_SWORD_BIGGORON; this->unk_20C = 1; @@ -964,7 +973,7 @@ void EnGo_GetItem(EnGo* this, PlayState* play) { } } - if ((this->actor.params & 0xF0) == 0) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0) { getItemId = GI_TUNIC_GORON; } @@ -977,7 +986,7 @@ void EnGo_GetItem(EnGo* this, PlayState* play) { void func_80A40C78(EnGo* this, PlayState* play) { if (this->interactInfo.talkState == NPC_TALK_STATE_ITEM_GIVEN) { EnGo_SetupAction(this, EnGo_BiggoronActionFunc); - if ((this->actor.params & 0xF0) != 0x90) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x90) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; } else if (this->unk_20C) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index a99f0cc0e1..102eaa6ef0 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -32,15 +32,6 @@ INFTABLE_10F - (not on cloud modding) INFTABLE_11E - Bomb bag upgrade obtained from rolling Goron -EnGo -pathIndex: this->actor.params & 0xF -Goron: this->actor.params & 0xF0 - -EnGo2 -(this->actor.params & 0x3E0) >> 5 -(this->actor.params & 0xFC00) >> 0xA - Gorons in Fire Temple -this->actor.params & 0x1F - Gorons only move when this->interactInfo.talkState == NPC_TALK_STATE_IDLE */ @@ -296,7 +287,7 @@ s32 EnGo2_GetDialogState(EnGo2* this, PlayState* play) { } u16 EnGo2_GoronFireGenericGetTextId(EnGo2* this) { - switch ((this->actor.params & 0xFC00) >> 0xA) { + switch (PARAMS_GET_S(this->actor.params, 10, 6)) { case 3: return 0x3069; case 5: @@ -641,7 +632,7 @@ s16 EnGo2_UpdateTalkStateGoronDmtBiggoron(PlayState* play, EnGo2* this) { } u16 EnGo2_GetTextIdGoronFireGeneric(PlayState* play, EnGo2* this) { - if (Flags_GetSwitch(play, (this->actor.params & 0xFC00) >> 0xA)) { + if (Flags_GetSwitch(play, PARAMS_GET_S(this->actor.params, 10, 6))) { return 0x3071; } else { return 0x3051; @@ -741,7 +732,7 @@ u16 EnGo2_GetTextId(PlayState* play, Actor* thisx) { if (textId != 0) { return textId; } else { - switch (this->actor.params & 0x1F) { + switch (PARAMS_GET_S(this->actor.params, 0, 5)) { case GORON_CITY_ROLLING_BIG: return EnGo2_GetTextIdGoronCityRollingBig(play, this); case GORON_CITY_LINK: @@ -779,7 +770,7 @@ u16 EnGo2_GetTextId(PlayState* play, Actor* thisx) { s16 EnGo2_UpdateTalkState(PlayState* play, Actor* thisx) { EnGo2* this = (EnGo2*)thisx; - switch (this->actor.params & 0x1F) { + switch (PARAMS_GET_S(this->actor.params, 0, 5)) { case GORON_CITY_ROLLING_BIG: return EnGo2_UpdateTalkStateGoronCityRollingBig(play, this); case GORON_CITY_LINK: @@ -817,10 +808,11 @@ s16 EnGo2_UpdateTalkState(PlayState* play, Actor* thisx) { } s32 func_80A44790(EnGo2* this, PlayState* play) { - if ((this->actor.params & 0x1F) != GORON_DMT_BIGGORON && (this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG) { + if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_DMT_BIGGORON && + PARAMS_GET_S(this->actor.params, 0, 5) != GORON_CITY_ROLLING_BIG) { return Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->interactRange, EnGo2_GetTextId, EnGo2_UpdateTalkState); - } else if (((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) && + } else if ((PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) && !(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { return false; } else { @@ -838,14 +830,14 @@ s32 func_80A44790(EnGo2* this, PlayState* play) { } void EnGo2_SetColliderDim(EnGo2* this) { - u8 index = this->actor.params & 0x1F; + u8 index = PARAMS_GET_S(this->actor.params, 0, 5); this->collider.dim.radius = D_80A4816C[index].radius; this->collider.dim.height = D_80A4816C[index].height; } void EnGo2_SetShape(EnGo2* this) { - u8 index = this->actor.params & 0x1F; + u8 index = PARAMS_GET_S(this->actor.params, 0, 5); this->actor.shape.shadowScale = D_80A481F8[index].shape_unk_10; Actor_SetScale(&this->actor, D_80A481F8[index].scale); @@ -861,10 +853,10 @@ void EnGo2_CheckCollision(EnGo2* this, PlayState* play) { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y; pos.z = this->actor.world.pos.z; - xzDist = D_80A4816C[this->actor.params & 0x1F].xzDist; + xzDist = D_80A4816C[PARAMS_GET_S(this->actor.params, 0, 5)].xzDist; pos.x += (s16)(xzDist * Math_SinS(this->actor.shape.rot.y)); pos.z += (s16)(xzDist * Math_CosS(this->actor.shape.rot.y)); - pos.y += D_80A4816C[this->actor.params & 0x1F].yDist; + pos.y += D_80A4816C[PARAMS_GET_S(this->actor.params, 0, 5)].yDist; this->collider.dim.pos = pos; CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); @@ -882,7 +874,7 @@ s32 func_80A44AB0(EnGo2* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 arg2; - if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { + if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { return false; } else { if ((this->actionFunc != EnGo2_SlowRolling) && (this->actionFunc != EnGo2_ReverseRolling) && @@ -962,11 +954,11 @@ s32 func_80A44D84(EnGo2* this) { s32 EnGo2_IsWakingUp(EnGo2* this) { s16 yawDiff; - f32 xyzDist = (this->actor.params & 0x1F) == GORON_DMT_BIGGORON ? 800.0f : 200.0f; - f32 yDist = (this->actor.params & 0x1F) == GORON_DMT_BIGGORON ? 400.0f : 60.0f; + f32 xyzDist = PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON ? 800.0f : 200.0f; + f32 yDist = PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON ? 400.0f : 60.0f; s16 yawDiffAbs; - if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { + if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { if (!(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { this->actor.flags &= ~ACTOR_FLAG_0; return false; @@ -1003,8 +995,9 @@ s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 arg1, f32 arg2, s16 arg3) { } if (this->unk_59C >= 2) { - Actor_PlaySfx(&this->actor, (this->actor.params & 0x1F) == GORON_CITY_ROLLING_BIG ? NA_SE_EN_GOLON_LAND_BIG - : NA_SE_EN_DODO_M_GND); + Actor_PlaySfx(&this->actor, (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_ROLLING_BIG) + ? NA_SE_EN_GOLON_LAND_BIG + : NA_SE_EN_DODO_M_GND); } this->unk_59C--; @@ -1026,7 +1019,7 @@ s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 arg1, f32 arg2, s16 arg3) { void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { u16 textId; - if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { + if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { if (gSaveContext.save.info.playerData.bgsFlag) { if (func_8002F368(play) == EXCH_ITEM_CLAIM_CHECK) { this->actor.textId = 0x3003; @@ -1090,7 +1083,7 @@ void func_80A45288(EnGo2* this, PlayState* play) { if (this->actionFunc != EnGo2_GoronFireGenericAction) { this->interactInfo.trackPos = player->actor.world.pos; this->interactInfo.yOffset = - sPlayerTrackingYOffsets[this->actor.params & 0x1F][((void)0, gSaveContext.save.linkAge)]; + sPlayerTrackingYOffsets[PARAMS_GET_S(this->actor.params, 0, 5)][((void)0, gSaveContext.save.linkAge)]; Npc_TrackPoint(&this->actor, &this->interactInfo, 4, this->trackingMode); } if ((this->actionFunc != EnGo2_SetGetItem) && (this->isAwake == true)) { @@ -1123,7 +1116,7 @@ void EnGo2_RollForward(EnGo2* this) { } void func_80A454CC(EnGo2* this) { - switch (this->actor.params & 0x1F) { + switch (PARAMS_GET_S(this->actor.params, 0, 5)) { case GORON_CITY_ROLLING_BIG: case GORON_DMT_DC_ENTRANCE: case GORON_CITY_ENTRANCE: @@ -1145,8 +1138,8 @@ void func_80A454CC(EnGo2* this) { } f32 EnGo2_GetTargetXZSpeed(EnGo2* this) { - f32 yDist = (this->actor.params & 0x1F) == GORON_DMT_BIGGORON ? 400.0f : 60.0f; - s32 index = this->actor.params & 0x1F; + f32 yDist = PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON ? 400.0f : 60.0f; + s32 index = PARAMS_GET_S(this->actor.params, 0, 5); if (index == GORON_CITY_LINK && (fabsf(this->actor.yDistToPlayer) < yDist) && (this->actor.xzDistToPlayer < 400.0f)) { @@ -1159,7 +1152,7 @@ f32 EnGo2_GetTargetXZSpeed(EnGo2* this) { s32 EnGo2_IsCameraModified(EnGo2* this, PlayState* play) { Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN]; - if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { + if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { if (EnGo2_IsWakingUp(this)) { Camera_RequestSetting(mainCam, CAM_SET_DIRECTED_YAW); Camera_UnsetStateFlag(mainCam, CAM_STATE_CHECK_BG); @@ -1169,9 +1162,11 @@ s32 EnGo2_IsCameraModified(EnGo2* this, PlayState* play) { } } - if ((this->actor.params & 0x1F) == GORON_FIRE_GENERIC || (this->actor.params & 0x1F) == GORON_CITY_ROLLING_BIG || - (this->actor.params & 0x1F) == GORON_CITY_STAIRWELL || (this->actor.params & 0x1F) == GORON_DMT_BIGGORON || - (this->actor.params & 0x1F) == GORON_MARKET_BAZAAR) { + if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_FIRE_GENERIC || + PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_ROLLING_BIG || + PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_STAIRWELL || + PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON || + PARAMS_GET_S(this->actor.params, 0, 5) == GORON_MARKET_BAZAAR) { return true; } else if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) { return true; @@ -1195,7 +1190,7 @@ void EnGo2_DefaultWakingUp(EnGo2* this) { } void EnGo2_WakingUp(EnGo2* this) { - f32 xyzDist = (this->actor.params & 0x1F) == GORON_DMT_BIGGORON ? 800.0f : 200.0f; + f32 xyzDist = PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON ? 800.0f : 200.0f; s32 isTrue = true; xyzDist = SQ(xyzDist); @@ -1218,7 +1213,7 @@ void EnGo2_BiggoronWakingUp(EnGo2* this) { } void EnGo2_SelectGoronWakingUp(EnGo2* this) { - switch (this->actor.params & 0x1F) { + switch (PARAMS_GET_S(this->actor.params, 0, 5)) { case GORON_DMT_BOMB_FLOWER: this->isAwake = true; this->trackingMode = EnGo2_IsWakingUp(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; @@ -1273,7 +1268,7 @@ void EnGo2_EyeMouthTexState(EnGo2* this) { void EnGo2_SitDownAnimation(EnGo2* this) { if ((this->skelAnime.playSpeed != 0.0f) && (this->skelAnime.animation == &gGoronAnim_004930)) { if (this->skelAnime.playSpeed > 0.0f && this->skelAnime.curFrame == 14.0f) { - if ((this->actor.params & 0x1F) != GORON_DMT_BIGGORON) { + if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_DMT_BIGGORON) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_SIT_DOWN); } else { func_800F4524(&gSfxDefaultPos, NA_SE_EN_GOLON_SIT_DOWN, 60); @@ -1291,7 +1286,7 @@ void EnGo2_SitDownAnimation(EnGo2* this) { } void EnGo2_GetDustData(EnGo2* this, s32 index2) { - s32 index1 = (this->actor.params & 0x1F) == GORON_CITY_ROLLING_BIG ? 1 : 0; + s32 index1 = PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_ROLLING_BIG ? 1 : 0; EnGo2DustEffectData* dustEffectData = &sDustEffectData[index1][index2]; EnGo2_SpawnDust(this, dustEffectData->initialTimer, dustEffectData->scale, dustEffectData->scaleStep, @@ -1299,7 +1294,7 @@ void EnGo2_GetDustData(EnGo2* this, s32 index2) { } void EnGo2_RollingAnimation(EnGo2* this, PlayState* play) { - if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { + if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { this->actor.flags &= ~ACTOR_FLAG_0; Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10); this->skelAnime.playSpeed = -0.5f; @@ -1316,13 +1311,13 @@ void EnGo2_RollingAnimation(EnGo2* this, PlayState* play) { void EnGo2_WakeUp(EnGo2* this, PlayState* play) { if (this->skelAnime.playSpeed == 0.0f) { - if ((this->actor.params & 0x1F) != GORON_DMT_BIGGORON) { + if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_DMT_BIGGORON) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_WAKE_UP); } else { func_800F4524(&gSfxDefaultPos, NA_SE_EN_GOLON_WAKE_UP, 60); } } - if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { + if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { OnePointCutscene_Init(play, 4200, -99, &this->actor, CAM_ID_MAIN); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10); this->skelAnime.playSpeed = 0.5f; @@ -1343,7 +1338,8 @@ void EnGo2_GetItemAnimation(EnGo2* this, PlayState* play) { } void EnGo2_SetupRolling(EnGo2* this, PlayState* play) { - if ((this->actor.params & 0x1F) == GORON_CITY_ROLLING_BIG || (this->actor.params & 0x1F) == GORON_CITY_LINK) { + if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_ROLLING_BIG || + PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_LINK) { this->collider.elem.acElemFlags = ACELEM_ON; this->actor.speed = GET_INFTABLE(INFTABLE_11E) ? 6.0f : 3.6000001f; } else { @@ -1359,8 +1355,9 @@ void EnGo2_SetupRolling(EnGo2* this, PlayState* play) { void EnGo2_StopRolling(EnGo2* this, PlayState* play) { EnBom* bomb; - if (((this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG) && ((this->actor.params & 0x1F) != GORON_CITY_LINK)) { - if ((this->actor.params & 0x1F) == GORON_DMT_ROLLING_SMALL) { + if ((PARAMS_GET_S(this->actor.params, 0, 5) != GORON_CITY_ROLLING_BIG) && + (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_CITY_LINK)) { + if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_ROLLING_SMALL) { bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (bomb != NULL) { @@ -1380,20 +1377,21 @@ void EnGo2_StopRolling(EnGo2* this, PlayState* play) { } s32 EnGo2_IsFreeingGoronInFire(EnGo2* this, PlayState* play) { - if ((this->actor.params & 0x1F) != GORON_FIRE_GENERIC) { + if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_FIRE_GENERIC) { return false; } // shaking curled up this->actor.world.pos.x += (play->state.frames & 1) ? 1.0f : -1.0f; - if (Flags_GetSwitch(play, (this->actor.params & 0xFC00) >> 0xA)) { + if (Flags_GetSwitch(play, PARAMS_GET_S(this->actor.params, 10, 6))) { return true; } return false; } s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) { - if ((this->actor.params & 0x1F) != GORON_DMT_BOMB_FLOWER || this->interactInfo.talkState != NPC_TALK_STATE_ACTION) { + if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_DMT_BOMB_FLOWER || + this->interactInfo.talkState != NPC_TALK_STATE_ACTION) { return false; } @@ -1406,7 +1404,7 @@ s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) { } s32 EnGo2_IsGoronRollingBig(EnGo2* this, PlayState* play) { - if ((this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG || + if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_CITY_ROLLING_BIG || (this->interactInfo.talkState != NPC_TALK_STATE_ACTION)) { return false; } @@ -1417,7 +1415,8 @@ s32 EnGo2_IsGoronRollingBig(EnGo2* this, PlayState* play) { } s32 EnGo2_IsGoronFireGeneric(EnGo2* this) { - if ((this->actor.params & 0x1F) != GORON_FIRE_GENERIC || this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { + if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_FIRE_GENERIC || + this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { return false; } this->actionFunc = EnGo2_GoronFireGenericAction; @@ -1425,7 +1424,7 @@ s32 EnGo2_IsGoronFireGeneric(EnGo2* this) { } s32 EnGo2_IsGoronLinkReversing(EnGo2* this) { - if ((this->actor.params & 0x1F) != GORON_CITY_LINK || (this->waypoint >= this->unk_216) || + if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_CITY_LINK || (this->waypoint >= this->unk_216) || !EnGo2_IsWakingUp(this)) { return false; } @@ -1448,7 +1447,7 @@ s32 EnGo2_IsRolling(EnGo2* this) { void EnGo2_GoronLinkAnimation(EnGo2* this, PlayState* play) { s32 animation = ARRAY_COUNT(sAnimationInfo); - if ((this->actor.params & 0x1F) == GORON_CITY_LINK) { + if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_LINK) { if ((this->actor.textId == 0x3035 && this->unk_20C == 0) || (this->actor.textId == 0x3036 && this->unk_20C == 0)) { if (this->skelAnime.animation != &gGoronAnim_000D5C) { @@ -1501,7 +1500,8 @@ void EnGo2_GoronFireClearCamera(EnGo2* this, PlayState* play) { void EnGo2_BiggoronAnimation(EnGo2* this) { if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_BROKEN_GORONS_SWORD && INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_EYE_DROPS && - (this->actor.params & 0x1F) == GORON_DMT_BIGGORON && this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { + PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON && + this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { if (DECR(this->animTimer) == 0) { this->animTimer = Rand_S16Offset(30, 30); func_800F4524(&gSfxDefaultPos, NA_SE_EN_GOLON_EYE_BIG, 60); @@ -1520,7 +1520,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); // Not GORON_CITY_ROLLING_BIG, GORON_CITY_LINK, GORON_DMT_BIGGORON - switch (this->actor.params & 0x1F) { + switch (PARAMS_GET_S(this->actor.params, 0, 5)) { case GORON_FIRE_GENERIC: case GORON_DMT_BOMB_FLOWER: case GORON_DMT_ROLLING_SMALL: @@ -1548,8 +1548,8 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { this->waypoint = 0; this->unk_216 = this->actor.shape.rot.z; this->trackingMode = NPC_TRACKING_NONE; - this->path = Path_GetByIndex(play, (this->actor.params & 0x3E0) >> 5, 0x1F); - switch (this->actor.params & 0x1F) { + this->path = Path_GetByIndex(play, PARAMS_GET_S(this->actor.params, 5, 5), 0x1F); + switch (PARAMS_GET_S(this->actor.params, 0, 5)) { case GORON_CITY_ENTRANCE: case GORON_CITY_ISLAND: case GORON_CITY_LOWEST_FLOOR: @@ -1578,18 +1578,18 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { } } else { CLEAR_INFTABLE(INFTABLE_10C); - this->collider.dim.height = (D_80A4816C[this->actor.params & 0x1F].height * 0.6f); + this->collider.dim.height = (D_80A4816C[PARAMS_GET_S(this->actor.params, 0, 5)].height * 0.6f); EnGo2_SetupRolling(this, play); this->isAwake = true; } break; case GORON_CITY_ROLLING_BIG: case GORON_DMT_ROLLING_SMALL: - this->collider.dim.height = (D_80A4816C[this->actor.params & 0x1F].height * 0.6f); + this->collider.dim.height = (D_80A4816C[PARAMS_GET_S(this->actor.params, 0, 5)].height * 0.6f); EnGo2_SetupRolling(this, play); break; case GORON_FIRE_GENERIC: - if (Flags_GetSwitch(play, (this->actor.params & 0xFC00) >> 0xA)) { + if (Flags_GetSwitch(play, PARAMS_GET_S(this->actor.params, 10, 6))) { Actor_Kill(&this->actor); } else { this->isAwake = true; @@ -1625,12 +1625,12 @@ void EnGo2_Destroy(Actor* thisx, PlayState* play) { } void EnGo2_CurledUp(EnGo2* this, PlayState* play) { - u8 index = this->actor.params & 0x1F; + u8 index = PARAMS_GET_S(this->actor.params, 0, 5); s16 height; s32 quakeIndex; if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { + if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, -0x3CB0); Quake_SetPerturbations(quakeIndex, 8, 0, 0, 0); @@ -1653,13 +1653,13 @@ void EnGo2_CurledUp(EnGo2* this, PlayState* play) { this->isAwake = false; EnGo2_WakeUp(this, play); } - if (((this->actor.params & 0x1F) != GORON_FIRE_GENERIC) && EnGo2_IsWakingUp(this)) { + if ((PARAMS_GET_S(this->actor.params, 0, 5) != GORON_FIRE_GENERIC) && EnGo2_IsWakingUp(this)) { EnGo2_WakeUp(this, play); } } void func_80A46B40(EnGo2* this, PlayState* play) { - u8 index = (this->actor.params & 0x1F); + u8 index = PARAMS_GET_S(this->actor.params, 0, 5); f32 height; if (this->unk_211 == true) { @@ -1676,7 +1676,7 @@ void func_80A46B40(EnGo2* this, PlayState* play) { } } else { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { + if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { this->actor.flags |= ACTOR_FLAG_0; } func_80A454CC(this); @@ -1714,7 +1714,8 @@ void EnGo2_GoronRollingBigContinueRolling(EnGo2* this, PlayState* play) { void EnGo2_ContinueRolling(EnGo2* this, PlayState* play) { f32 float1 = 1000.0f; - if (((this->actor.params & 0x1F) != GORON_DMT_ROLLING_SMALL || !(this->actor.xyzDistToPlayerSq > SQ(float1))) && + if ((PARAMS_GET_S(this->actor.params, 0, 5) != GORON_DMT_ROLLING_SMALL || + !(this->actor.xyzDistToPlayerSq > SQ(float1))) && DECR(this->animTimer) == 0) { this->actionFunc = EnGo2_SlowRolling; this->actor.speed *= 0.5f; // slowdown @@ -1735,7 +1736,7 @@ void EnGo2_SlowRolling(EnGo2* this, PlayState* play) { EnGo2_GetDustData(this, 3); } orientation = EnGo2_Orient(this, play); - index = this->actor.params & 0x1F; + index = PARAMS_GET_S(this->actor.params, 0, 5); if (index != GORON_CITY_LINK) { if ((index == GORON_DMT_ROLLING_SMALL) && (orientation == 1) && (this->waypoint == 0)) { EnGo2_StopRolling(this, play); @@ -1754,7 +1755,7 @@ void EnGo2_GroundRolling(EnGo2* this, PlayState* play) { if (EnGo2_IsRollingOnGround(this, 4, 8.0f, 0)) { EnGo2_GetDustData(this, 0); if (this->unk_59C == 0) { - switch (this->actor.params & 0x1F) { + switch (PARAMS_GET_S(this->actor.params, 0, 5)) { case GORON_CITY_LINK: this->goronState = 0; this->actionFunc = EnGo2_GoronLinkStopRolling; @@ -1936,9 +1937,9 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) { } else { this->animTimer = 0; this->actor.speed = 0.0f; - if ((((this->actor.params & 0xFC00) >> 0xA) != 1) && (((this->actor.params & 0xFC00) >> 0xA) != 2) && - (((this->actor.params & 0xFC00) >> 0xA) != 4) && (((this->actor.params & 0xFC00) >> 0xA) != 5) && - (((this->actor.params & 0xFC00) >> 0xA) != 9) && (((this->actor.params & 0xFC00) >> 0xA) != 11)) { + if ((PARAMS_GET_S(this->actor.params, 10, 6) != 1) && (PARAMS_GET_S(this->actor.params, 10, 6) != 2) && + (PARAMS_GET_S(this->actor.params, 10, 6) != 4) && (PARAMS_GET_S(this->actor.params, 10, 6) != 5) && + (PARAMS_GET_S(this->actor.params, 10, 6) != 9) && (PARAMS_GET_S(this->actor.params, 10, 6) != 11)) { this->goronState++; } this->goronState++; diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index 3e9793f982..71cdfb185c 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -97,7 +97,7 @@ void EnGoroiwa_UpdateCollider(EnGoroiwa* this) { Sphere16* worldSphere = &this->collider.elements[0].dim.worldSphere; worldSphere->center.x = this->actor.world.pos.x; - worldSphere->center.y = this->actor.world.pos.y + yOffsets[(this->actor.params >> 10) & 1]; + worldSphere->center.y = this->actor.world.pos.y + yOffsets[PARAMS_GET_U(this->actor.params, 10, 1)]; worldSphere->center.z = this->actor.world.pos.z; } @@ -147,7 +147,7 @@ void EnGoroiwa_SetSpeed(EnGoroiwa* this, PlayState* play) { } void EnGoroiwa_FaceNextWaypoint(EnGoroiwa* this, PlayState* play) { - Path* path = &play->pathList[this->actor.params & 0xFF]; + Path* path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 8)]; Vec3s* nextPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; Vec3f nextPosF; @@ -159,8 +159,8 @@ void EnGoroiwa_FaceNextWaypoint(EnGoroiwa* this, PlayState* play) { } void EnGoroiwa_GetPrevWaypointDiff(EnGoroiwa* this, PlayState* play, Vec3f* dest) { - s16 loopMode = (this->actor.params >> 8) & 3; - Path* path = &play->pathList[this->actor.params & 0xFF]; + s16 loopMode = PARAMS_GET_U(this->actor.params, 8, 2); + Path* path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 8)]; s16 prevWaypoint = this->currentWaypoint - this->pathDirection; Vec3s* prevPointPos; Vec3s* currentPointPos; @@ -187,7 +187,7 @@ void EnGoroiwa_GetPrevWaypointDiff(EnGoroiwa* this, PlayState* play, Vec3f* dest } void EnGoroiw_CheckEndOfPath(EnGoroiwa* this) { - s16 loopMode = (this->actor.params >> 8) & 3; + s16 loopMode = PARAMS_GET_U(this->actor.params, 8, 2); if (this->nextWaypoint < 0) { if (loopMode == ENGOROIWA_LOOPMODE_ONEWAY || loopMode == ENGOROIWA_LOOPMODE_ONEWAY_BREAK) { @@ -225,14 +225,14 @@ void EnGoroiwa_ReverseDirection(EnGoroiwa* this) { } void EnGoroiwa_InitPath(EnGoroiwa* this, PlayState* play) { - this->endWaypoint = play->pathList[this->actor.params & 0xFF].count - 1; + this->endWaypoint = play->pathList[PARAMS_GET_U(this->actor.params, 0, 8)].count - 1; this->currentWaypoint = 0; this->nextWaypoint = 1; this->pathDirection = 1; } void EnGoroiwa_TeleportToWaypoint(EnGoroiwa* this, PlayState* play, s32 waypoint) { - Path* path = &play->pathList[this->actor.params & 0xFF]; + Path* path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 8)]; Vec3s* pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + waypoint; this->actor.world.pos.x = pointPos->x; @@ -247,7 +247,7 @@ void EnGoroiwa_InitRotation(EnGoroiwa* this) { s32 EnGoroiwa_GetAscendDirection(EnGoroiwa* this, PlayState* play) { s32 pad; - Path* path = &play->pathList[this->actor.params & 0xFF]; + Path* path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 8)]; Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; Vec3s* currentPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->currentWaypoint; @@ -313,7 +313,7 @@ s32 EnGoroiwa_MoveAndFall(EnGoroiwa* this, PlayState* play) { Math_StepToF(&this->actor.speed, EN_GOROIWA_SPEED(this), 0.3f); Actor_UpdateVelocityXZGravity(&this->actor); - path = &play->pathList[this->actor.params & 0xFF]; + path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 8)]; nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; result = true; result &= Math_StepToF(&this->actor.world.pos.x, nextPointPos->x, fabsf(this->actor.velocity.x)); @@ -323,7 +323,7 @@ s32 EnGoroiwa_MoveAndFall(EnGoroiwa* this, PlayState* play) { } s32 EnGoroiwa_Move(EnGoroiwa* this, PlayState* play) { - Path* path = &play->pathList[this->actor.params & 0xFF]; + Path* path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 8)]; s32 pad; Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; Vec3s* currentPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->currentWaypoint; @@ -355,7 +355,7 @@ s32 EnGoroiwa_Move(EnGoroiwa* this, PlayState* play) { s32 EnGoroiwa_MoveUpToNextWaypoint(EnGoroiwa* this, PlayState* play) { s32 pad; - Path* path = &play->pathList[this->actor.params & 0xFF]; + Path* path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 8)]; Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; Math_StepToF(&this->actor.velocity.y, EN_GOROIWA_SPEED(this) * 0.5f, 0.18f); @@ -366,7 +366,7 @@ s32 EnGoroiwa_MoveUpToNextWaypoint(EnGoroiwa* this, PlayState* play) { s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, PlayState* play) { s32 pad; - Path* path = &play->pathList[this->actor.params & 0xFF]; + Path* path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 8)]; Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; f32 nextPointY; f32 thisY; @@ -485,7 +485,7 @@ void EnGoroiwa_UpdateRotation(EnGoroiwa* this, PlayState* play) { } void EnGoroiwa_NextWaypoint(EnGoroiwa* this, PlayState* play) { - s16 loopMode = (this->actor.params >> 8) & 3; + s16 loopMode = PARAMS_GET_U(this->actor.params, 8, 2); EnGoroiwa_SetNextWaypoint(this); @@ -509,7 +509,7 @@ void EnGoroiwa_SpawnFragments(EnGoroiwa* this, PlayState* play) { f32 cos1; f32 sin1; f32 sin2; - s16 yOffsetIdx = (this->actor.params >> 10) & 1; + s16 yOffsetIdx = PARAMS_GET_U(this->actor.params, 10, 1); s32 i; for (i = 0, angle1 = 0; i < 16; i++, angle1 += 0x4E20) { @@ -548,7 +548,7 @@ void EnGoroiwa_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); EnGoroiwa_InitCollider(this, play); - pathIdx = this->actor.params & 0xFF; + pathIdx = PARAMS_GET_U(this->actor.params, 0, 8); if (pathIdx == 0xFF) { // "Error: Invalid arg_data" PRINTF("Error : arg_data が不正(%s %d)(arg_data 0x%04x)\n", "../z_en_gr.c", 1033, this->actor.params); @@ -562,7 +562,8 @@ void EnGoroiwa_Init(Actor* thisx, PlayState* play) { return; } CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - ActorShape_Init(&this->actor.shape, yOffsets[(this->actor.params >> 10) & 1], ActorShadow_DrawCircle, 9.4f); + ActorShape_Init(&this->actor.shape, yOffsets[PARAMS_GET_U(this->actor.params, 10, 1)], ActorShadow_DrawCircle, + 9.4f); this->actor.shape.shadowAlpha = 200; EnGoroiwa_SetSpeed(this, play); EnGoroiwa_InitPath(this, play); @@ -571,8 +572,9 @@ void EnGoroiwa_Init(Actor* thisx, PlayState* play) { EnGoroiwa_FaceNextWaypoint(this, play); EnGoroiwa_SetupRoll(this); // "(Goroiwa)" - PRINTF("(ごろ岩)(arg 0x%04x)(rail %d)(end %d)(bgc %d)(hit %d)\n", this->actor.params, this->actor.params & 0xFF, - (this->actor.params >> 8) & 3, (this->actor.params >> 10) & 1, this->actor.home.rot.z & 1); + PRINTF("(ごろ岩)(arg 0x%04x)(rail %d)(end %d)(bgc %d)(hit %d)\n", this->actor.params, + PARAMS_GET_U(this->actor.params, 0, 8), PARAMS_GET_U(this->actor.params, 8, 2), + PARAMS_GET_U(this->actor.params, 10, 1), this->actor.home.rot.z & 1); } void EnGoroiwa_Destroy(Actor* thisx, PlayState* play2) { @@ -602,7 +604,7 @@ void EnGoroiwa_Roll(EnGoroiwa* this, PlayState* play) { yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; if (yawDiff > -0x4000 && yawDiff < 0x4000) { this->stateFlags |= ENGOROIWA_PLAYER_IN_THE_WAY; - if (((this->actor.params >> 10) & 1) || (this->actor.home.rot.z & 1) != 1) { + if (PARAMS_GET_U(this->actor.params, 10, 1) || (this->actor.home.rot.z & 1) != 1) { EnGoroiwa_ReverseDirection(this); EnGoroiwa_FaceNextWaypoint(this, play); } @@ -611,13 +613,13 @@ void EnGoroiwa_Roll(EnGoroiwa* this, PlayState* play) { PRINTF(VT_FGCOL(CYAN)); PRINTF("Player ぶっ飛ばし\n"); // "Player knocked down" PRINTF(VT_RST); - onHitSetupFuncs[(this->actor.params >> 10) & 1](this); + onHitSetupFuncs[PARAMS_GET_U(this->actor.params, 10, 1)](this); Player_PlaySfx(GET_PLAYER(play), NA_SE_PL_BODY_HIT); if ((this->actor.home.rot.z & 1) == 1) { this->collisionDisabledTimer = 50; } - } else if (moveFuncs[(this->actor.params >> 10) & 1](this, play)) { - loopMode = (this->actor.params >> 8) & 3; + } else if (moveFuncs[PARAMS_GET_U(this->actor.params, 10, 1)](this, play)) { + loopMode = PARAMS_GET_U(this->actor.params, 8, 2); if (loopMode == ENGOROIWA_LOOPMODE_ONEWAY_BREAK && (this->nextWaypoint == 0 || this->nextWaypoint == this->endWaypoint)) { EnGoroiwa_SpawnFragments(this, play); @@ -626,7 +628,7 @@ void EnGoroiwa_Roll(EnGoroiwa* this, PlayState* play) { if ((loopMode == ENGOROIWA_LOOPMODE_ROUNDTRIP) && (this->currentWaypoint == 0 || this->currentWaypoint == this->endWaypoint)) { EnGoroiwa_SetupWait(this); - } else if (!((this->actor.params >> 10) & 1) && this->currentWaypoint != 0 && + } else if (!PARAMS_GET_U(this->actor.params, 10, 1) && this->currentWaypoint != 0 && this->currentWaypoint != this->endWaypoint) { ascendDirection = EnGoroiwa_GetAscendDirection(this, play); if (ascendDirection > 0) { @@ -742,7 +744,7 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) { this->collisionDisabledTimer--; } this->actionFunc(this, play); - switch ((this->actor.params >> 10) & 1) { + switch (PARAMS_GET_U(this->actor.params, 10, 1)) { case 1: Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 6a7da4f559..f354e81d2f 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -123,7 +123,7 @@ s32 func_80A4E3EC(EnGs* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x2054: - this->actor.textId = (this->actor.params & 0xFF) + 0x400; + this->actor.textId = PARAMS_GET_U(this->actor.params, 0, 8) + 0x400; ret = 1; break; default: @@ -169,7 +169,7 @@ void func_80A4E470(EnGs* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); } this->unk_19D = 0; - Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { player->stateFlags2 |= PLAYER_STATE2_23; } @@ -499,7 +499,7 @@ void func_80A4F700(EnGs* this, PlayState* play) { } void func_80A4F734(EnGs* this, PlayState* play) { - if (!Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { + if (!Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { func_80A4E470(this, play); } } diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index 0668b8395c..7b49afeee3 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -72,8 +72,8 @@ void EnHeishi1_Init(Actor* thisx, PlayState* play2) { Actor_SetScale(&this->actor, 0.01f); SkelAnime_Init(play, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, this->morphTable, 17); - this->type = (this->actor.params >> 8) & 0xFF; - this->path = this->actor.params & 0xFF; + this->type = PARAMS_GET_U(this->actor.params, 8, 8); + this->path = PARAMS_GET_U(this->actor.params, 0, 8); for (i = 0; i < ARRAY_COUNT(sAnimParamsInit[0]); i++) { this->animParams[i] = sAnimParamsInit[this->type][i]; diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index f8fad950d6..c0ddc8bb29 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -87,7 +87,7 @@ void EnHeishi2_Init(Actor* thisx, PlayState* play) { EnHeishi2* this = (EnHeishi2*)thisx; Actor_SetScale(&this->actor, 0.01f); - this->type = this->actor.params & 0xFF; + this->type = PARAMS_GET_U(this->actor.params, 0, 8); this->actor.colChkInfo.mass = MASS_IMMOVABLE; if ((this->type == 6) || (this->type == 9)) { @@ -148,14 +148,15 @@ void EnHeishi2_Init(Actor* thisx, PlayState* play) { break; } - this->unk_2F0 = (this->actor.params >> 8) & 0xFF; + this->unk_2F0 = PARAMS_GET_U(this->actor.params, 8, 8); PRINTF("\n\n"); // "Soldier Set 2 Completed!" PRINTF(VT_FGCOL(GREEN) " ☆☆☆☆☆ 兵士2セット完了! ☆☆☆☆☆ %d\n" VT_RST, this->actor.params); // "Identification Completed!" PRINTF(VT_FGCOL(YELLOW) " ☆☆☆☆☆ 識別完了! ☆☆☆☆☆ %d\n" VT_RST, this->type); // "Message completed!" - PRINTF(VT_FGCOL(MAGENTA) " ☆☆☆☆☆ メッセージ完了! ☆☆☆☆☆ %x\n\n" VT_RST, (this->actor.params >> 8) & 0xF); + PRINTF(VT_FGCOL(MAGENTA) " ☆☆☆☆☆ メッセージ完了! ☆☆☆☆☆ %x\n\n" VT_RST, + PARAMS_GET_U(this->actor.params, 8, 4)); } } diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index 5298317f01..4d7d8d3e57 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -59,7 +59,7 @@ void EnHeishi4_Init(Actor* thisx, PlayState* play) { EnHeishi4* this = (EnHeishi4*)thisx; Actor_SetScale(thisx, 0.01f); - this->type = thisx->params & 0xFF; + this->type = PARAMS_GET_U(thisx->params, 0, 8); thisx->colChkInfo.mass = MASS_IMMOVABLE; this->pos = thisx->world.pos; thisx->targetMode = 6; @@ -93,11 +93,11 @@ void EnHeishi4_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80A56544; break; } - this->unk_27C = (thisx->params >> 8) & 0xFF; + this->unk_27C = PARAMS_GET_U(thisx->params, 8, 8); PRINTF("\n\n"); PRINTF(VT_FGCOL(GREEN) " ☆☆☆☆☆ 兵士2セット完了! ☆☆☆☆☆ %d\n" VT_RST, thisx->params); PRINTF(VT_FGCOL(YELLOW) " ☆☆☆☆☆ 識別完了!\t ☆☆☆☆☆ %d\n" VT_RST, this->type); - PRINTF(VT_FGCOL(MAGENTA) " ☆☆☆☆☆ メッセージ完了! ☆☆☆☆☆ %x\n\n" VT_RST, (thisx->params >> 8) & 0xF); + PRINTF(VT_FGCOL(MAGENTA) " ☆☆☆☆☆ メッセージ完了! ☆☆☆☆☆ %x\n\n" VT_RST, PARAMS_GET_U(thisx->params, 8, 4)); PRINTF("\n\n"); } diff --git a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c index 8a9400eebf..fec4d5e61a 100644 --- a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c +++ b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c @@ -83,7 +83,7 @@ void EnHintnuts_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - Actor_SetTextWithPrefix(play, &this->actor, (this->actor.params >> 8) & 0xFF); + Actor_SetTextWithPrefix(play, &this->actor, PARAMS_GET_U(this->actor.params, 8, 8)); this->textIdCopy = this->actor.textId; this->actor.params &= 0xFF; sPuzzleCounter = 0; diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.h b/src/overlays/actors/ovl_En_Holl/z_en_holl.h index cbff846479..2c87dc346b 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.h +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.h @@ -4,8 +4,8 @@ #include "ultra64.h" #include "global.h" -#define ENHOLL_GET_TYPE(thisx) (((thisx)->params >> 6) & 7) -#define ENHOLL_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x3F) +#define ENHOLL_GET_TYPE(thisx) PARAMS_GET_U((thisx)->params, 6, 3) +#define ENHOLL_GET_SWITCH_FLAG(thisx) PARAMS_GET_U((thisx)->params, 0, 6) /** * Two kinds of holls: diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 6afed872d9..6b1c908785 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -756,7 +756,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { DREG(4) = 70; } - if (this->actor.params & 0x8000) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) { this->actor.params &= ~0x8000; this->type = HORSE_HNI; diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c index 31b20a59aa..2aa6fba140 100644 --- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c +++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c @@ -259,7 +259,7 @@ void EnHorseNormal_Init(Actor* thisx, PlayState* play) { Skin_Init(play, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]); } - if ((this->actor.params & 0xF0) == 0x10 && (this->actor.params & 0xF) != 0xF) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x10 && PARAMS_GET_U(this->actor.params, 0, 4) != 0xF) { func_80A6B91C(this, play); } else { func_80A6BC48(this); @@ -286,7 +286,7 @@ void func_80A6B91C(EnHorseNormal* this, PlayState* play) { } void EnHorseNormal_FollowPath(EnHorseNormal* this, PlayState* play) { - Path* path = &play->pathList[this->actor.params & 0xF]; + Path* path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 4)]; Vec3s* pointPos = SEGMENTED_TO_VIRTUAL(path->points); f32 dx; f32 dz; diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index ea4fa04c44..5893143f52 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -352,9 +352,9 @@ static EnHyInit2Info sInit2Info[] = { }; s32 EnHy_FindSkelAndHeadObjects(EnHy* this, PlayState* play) { - u8 headInfoIndex = sModelInfo[this->actor.params & 0x7F].headInfoIndex; - u8 skelInfoIndex2 = sModelInfo[this->actor.params & 0x7F].skelInfoIndex2; - u8 skelInfoIndex1 = sModelInfo[this->actor.params & 0x7F].skelInfoIndex1; + u8 headInfoIndex = sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].headInfoIndex; + u8 skelInfoIndex2 = sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].skelInfoIndex2; + u8 skelInfoIndex1 = sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].skelInfoIndex1; this->objectSlotSkel1 = Object_GetSlot(&play->objectCtx, sSkeletonInfo[skelInfoIndex1].objectId); if (this->objectSlotSkel1 < 0) { @@ -417,16 +417,16 @@ void func_80A6F7CC(EnHy* this, PlayState* play, s32 getItemId) { u16 EnHy_GetTextId(PlayState* play, Actor* thisx) { Player* player = GET_PLAYER(play); EnHy* this = (EnHy*)thisx; - u16 textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_37 + (this->actor.params & 0x7F)); + u16 textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_37 + PARAMS_GET_S(this->actor.params, 0, 7)); if (textId != 0) { - if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_5) { + if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_5) { player->exchangeItemId = EXCH_ITEM_BOTTLE_BLUE_FIRE; } return textId; } - switch (this->actor.params & 0x7F) { + switch (PARAMS_GET_S(this->actor.params, 0, 7)) { case ENHY_TYPE_AOB: if (play->sceneId == SCENE_KAKARIKO_CENTER_GUEST_HOUSE) { return (this->unk_330 & EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_MASK) @@ -678,7 +678,7 @@ s16 EnHy_UpdateTalkState(PlayState* play, Actor* thisx) { void EnHy_UpdateEyes(EnHy* this) { if (DECR(this->nextEyeIndexTimer) == 0) { - u8 headInfoIndex = sModelInfo[this->actor.params & 0x7F].headInfoIndex; + u8 headInfoIndex = sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].headInfoIndex; this->curEyeIndex++; if ((sHeadInfo[headInfoIndex].eyeTextures != NULL) && @@ -690,14 +690,14 @@ void EnHy_UpdateEyes(EnHy* this) { } void EnHy_InitCollider(EnHy* this) { - u8 type = this->actor.params & 0x7F; + u8 type = PARAMS_GET_S(this->actor.params, 0, 7); this->collider.dim.radius = sColliderInfo[type].radius; this->collider.dim.height = sColliderInfo[type].height; } void EnHy_InitSetProperties(EnHy* this) { - u8 type = this->actor.params & 0x7F; + u8 type = PARAMS_GET_S(this->actor.params, 0, 7); this->actor.shape.shadowScale = sInit2Info[type].shadowScale; Actor_SetScale(&this->actor, sInit2Info[type].scale); @@ -713,9 +713,9 @@ void EnHy_UpdateCollider(EnHy* this, PlayState* play) { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y; pos.z = this->actor.world.pos.z; - pos.x += sColliderInfo[this->actor.params & 0x7F].offset.x; - pos.y += sColliderInfo[this->actor.params & 0x7F].offset.y; - pos.z += sColliderInfo[this->actor.params & 0x7F].offset.z; + pos.x += sColliderInfo[PARAMS_GET_S(this->actor.params, 0, 7)].offset.x; + pos.y += sColliderInfo[PARAMS_GET_S(this->actor.params, 0, 7)].offset.y; + pos.z += sColliderInfo[PARAMS_GET_S(this->actor.params, 0, 7)].offset.z; this->collider.dim.pos = pos; CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } @@ -723,7 +723,7 @@ void EnHy_UpdateCollider(EnHy* this, PlayState* play) { void func_80A70834(EnHy* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_5) { + if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_5) { if (!Inventory_HasSpecificBottle(ITEM_BOTTLE_BLUE_FIRE) && !Inventory_HasSpecificBottle(ITEM_BOTTLE_BUG) && !Inventory_HasSpecificBottle(ITEM_BOTTLE_FISH)) { switch (func_8002F368(play)) { @@ -765,7 +765,7 @@ void func_80A70978(EnHy* this, PlayState* play) { Player* player = GET_PLAYER(play); s16 trackingMode; - switch (this->actor.params & 0x7F) { + switch (PARAMS_GET_S(this->actor.params, 0, 7)) { case ENHY_TYPE_BOJ_3: case ENHY_TYPE_BJI_7: case ENHY_TYPE_BOJ_9: @@ -793,13 +793,13 @@ void func_80A70978(EnHy* this, PlayState* play) { this->interactInfo.trackPos = player->actor.world.pos; if (LINK_IS_ADULT) { - this->interactInfo.yOffset = sPlayerTrackingInfo[this->actor.params & 0x7F].adultYOffset; + this->interactInfo.yOffset = sPlayerTrackingInfo[PARAMS_GET_S(this->actor.params, 0, 7)].adultYOffset; } else { - this->interactInfo.yOffset = sPlayerTrackingInfo[this->actor.params & 0x7F].childYOffset; + this->interactInfo.yOffset = sPlayerTrackingInfo[PARAMS_GET_S(this->actor.params, 0, 7)].childYOffset; } - Npc_TrackPoint(&this->actor, &this->interactInfo, sPlayerTrackingInfo[this->actor.params & 0x7F].presetIndex, - trackingMode); + Npc_TrackPoint(&this->actor, &this->interactInfo, + sPlayerTrackingInfo[PARAMS_GET_S(this->actor.params, 0, 7)].presetIndex, trackingMode); if (Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->interactRange, EnHy_GetTextId, EnHy_UpdateTalkState)) { @@ -810,29 +810,31 @@ void func_80A70978(EnHy* this, PlayState* play) { s32 EnHy_ShouldSpawn(EnHy* this, PlayState* play) { switch (play->sceneId) { case SCENE_KAKARIKO_VILLAGE: - if (!((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_9 || (this->actor.params & 0x7F) == ENHY_TYPE_BOJ_10 || - (this->actor.params & 0x7F) == ENHY_TYPE_BOJ_12 || (this->actor.params & 0x7F) == ENHY_TYPE_AHG_2 || - (this->actor.params & 0x7F) == ENHY_TYPE_BJI_7)) { + if (!(PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_9 || + PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_10 || + PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_12 || + PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_AHG_2 || + PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BJI_7)) { return true; } else if (!LINK_IS_ADULT) { return true; - } else if ((this->actor.params & 0x7F) != ENHY_TYPE_BOJ_12 && IS_NIGHT) { + } else if (PARAMS_GET_S(this->actor.params, 0, 7) != ENHY_TYPE_BOJ_12 && IS_NIGHT) { return false; } else { return true; } case SCENE_IMPAS_HOUSE: - if ((this->actor.params & 0x7F) != ENHY_TYPE_BOJ_10) { + if (PARAMS_GET_S(this->actor.params, 0, 7) != ENHY_TYPE_BOJ_10) { return true; } else if (LINK_IS_CHILD) { return false; - } else if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_10 && IS_DAY) { + } else if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_10 && IS_DAY) { return false; } else { return true; } case SCENE_DOG_LADY_HOUSE: - if ((this->actor.params & 0x7F) != ENHY_TYPE_AOB) { + if (PARAMS_GET_S(this->actor.params, 0, 7) != ENHY_TYPE_AOB) { return true; } else if (IS_DAY) { return false; @@ -840,11 +842,11 @@ s32 EnHy_ShouldSpawn(EnHy* this, PlayState* play) { return true; } case SCENE_KAKARIKO_CENTER_GUEST_HOUSE: - if ((this->actor.params & 0x7F) == ENHY_TYPE_AOB) { + if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_AOB) { return !LINK_IS_ADULT ? false : true; - } else if (!((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_9 || - (this->actor.params & 0x7F) == ENHY_TYPE_AHG_2 || - (this->actor.params & 0x7F) == ENHY_TYPE_BJI_7)) { + } else if (!(PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_9 || + PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_AHG_2 || + PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BJI_7)) { return true; } else if (IS_DAY) { return false; @@ -855,7 +857,7 @@ s32 EnHy_ShouldSpawn(EnHy* this, PlayState* play) { } case SCENE_BACK_ALLEY_DAY: case SCENE_BACK_ALLEY_NIGHT: - if ((this->actor.params & 0x7F) != ENHY_TYPE_BOJ_14) { + if (PARAMS_GET_S(this->actor.params, 0, 7) != ENHY_TYPE_BOJ_14) { return true; } else if (IS_NIGHT) { return false; @@ -865,7 +867,7 @@ s32 EnHy_ShouldSpawn(EnHy* this, PlayState* play) { return true; } default: - switch (this->actor.params & 0x7F) { + switch (PARAMS_GET_S(this->actor.params, 0, 7)) { case ENHY_TYPE_BJI_19: case ENHY_TYPE_AHG_20: if (LINK_IS_ADULT) { @@ -879,7 +881,7 @@ s32 EnHy_ShouldSpawn(EnHy* this, PlayState* play) { void EnHy_Init(Actor* thisx, PlayState* play) { EnHy* this = (EnHy*)thisx; - if ((this->actor.params & 0x7F) >= ENHY_TYPE_MAX || !EnHy_FindOsAnimeObject(this, play) || + if (PARAMS_GET_S(this->actor.params, 0, 7) >= ENHY_TYPE_MAX || !EnHy_FindOsAnimeObject(this, play) || !EnHy_FindSkelAndHeadObjects(this, play)) { Actor_Kill(&this->actor); } @@ -902,15 +904,16 @@ void EnHy_InitImpl(EnHy* this, PlayState* play) { this->actor.objectSlot = this->objectSlotSkel1; gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); SkelAnime_InitFlex(play, &this->skelAnime, - sSkeletonInfo[sModelInfo[this->actor.params & 0x7F].skelInfoIndex1].skeleton, NULL, - this->jointTable, this->morphTable, 16); + sSkeletonInfo[sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].skelInfoIndex1].skeleton, + NULL, this->jointTable, this->morphTable, 16); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotOsAnime].segment); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sColCylInit); EnHy_InitCollider(this); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, sModelInfo[this->actor.params & 0x7F].animInfoIndex); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, + sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].animInfoIndex); if ((play->sceneId == SCENE_BACK_ALLEY_DAY) || (play->sceneId == SCENE_MARKET_DAY)) { this->actor.flags &= ~ACTOR_FLAG_4; @@ -922,9 +925,9 @@ void EnHy_InitImpl(EnHy* this, PlayState* play) { } EnHy_InitSetProperties(this); - this->path = Path_GetByIndex(play, (this->actor.params & 0x780) >> 7, 15); + this->path = Path_GetByIndex(play, PARAMS_GET_S(this->actor.params, 7, 4), 15); - switch (this->actor.params & 0x7F) { + switch (PARAMS_GET_S(this->actor.params, 0, 7)) { case ENHY_TYPE_BOJ_3: if (this->path != NULL) { this->actor.speed = 3.0f; @@ -1111,7 +1114,7 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if (limbIndex == 15) { gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlotHead].segment); gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotHead].segment); - i = sModelInfo[this->actor.params & 0x7F].headInfoIndex; + i = sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].headInfoIndex; *dList = sHeadInfo[i].headDList; if (sHeadInfo[i].eyeTextures != NULL) { @@ -1158,7 +1161,7 @@ void EnHy_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotSkel2].segment); } - if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_3 && limbIndex == 8) { + if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_3 && limbIndex == 8) { gSPDisplayList(POLY_OPA_DISP++, object_boj_DL_005BC8); } @@ -1190,10 +1193,10 @@ void EnHy_Draw(Actor* thisx, PlayState* play) { if (this->actionFunc != EnHy_InitImpl) { Gfx_SetupDL_25Opa(play->state.gfxCtx); Matrix_Translate(this->modelOffset.x, this->modelOffset.y, this->modelOffset.z, MTXMODE_APPLY); - envColorSeg8 = sModelInfo[this->actor.params & 0x7F].envColorSeg8; - envColorSeg9 = sModelInfo[this->actor.params & 0x7F].envColorSeg9; + envColorSeg8 = sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].envColorSeg8; + envColorSeg9 = sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].envColorSeg9; - switch (this->actor.params & 0x7F) { + switch (PARAMS_GET_S(this->actor.params, 0, 7)) { // ENHY_TYPE_AOB // ENHY_TYPE_COB case ENHY_TYPE_AHG_2: @@ -1222,11 +1225,12 @@ void EnHy_Draw(Actor* thisx, PlayState* play) { EnHy_SetEnvColor(play->state.gfxCtx, envColorSeg9.r, envColorSeg9.g, envColorSeg9.b, envColorSeg9.a)); - if ((this->actor.params & 0x7F) == ENHY_TYPE_CNE_8 || (this->actor.params & 0x7F) == ENHY_TYPE_CNE_11) { - if ((this->actor.params & 0x7F) == ENHY_TYPE_CNE_8) { + if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_CNE_8 || + PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_CNE_11) { + if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_CNE_8) { envColorSeg10 = envColorSeg8; } - if ((this->actor.params & 0x7F) == ENHY_TYPE_CNE_11) { + if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_CNE_11) { envColorSeg10.r = envColorSeg10.g = envColorSeg10.b = 255; envColorSeg10.a = 0; } diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.h b/src/overlays/actors/ovl_En_Ik/z_en_ik.h index 7f94019c28..70c45063b5 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.h +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.h @@ -8,9 +8,9 @@ struct EnIk; typedef void (*EnIkActionFunc)(struct EnIk*, PlayState*); -#define IK_GET_UPPER_PARAMS(thisx) ((thisx)->params & 0xFF00) -#define IK_GET_ARMOR_TYPE(thisx) ((thisx)->params & 0xFF) -#define IK_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 8) & 0xFF) +#define IK_GET_UPPER_PARAMS(thisx) PARAMS_GET_NOSHIFT(this->actor.params, 8, 8) +#define IK_GET_ARMOR_TYPE(thisx) PARAMS_GET_U((thisx)->params, 0, 8) +#define IK_GET_SWITCH_FLAG(thisx) PARAMS_GET_U((thisx)->params, 8, 8) typedef enum EnIkType { /* 0 */ IK_TYPE_NABOORU, diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.c b/src/overlays/actors/ovl_En_Insect/z_en_insect.c index 4cb346977d..7ad1fe0d80 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -99,7 +99,7 @@ static InitChainEntry sInitChain[] = { }; void EnInsect_InitFlags(EnInsect* this) { - this->insectFlags = sInitInsectFlags[this->actor.params & 3]; + this->insectFlags = sInitInsectFlags[PARAMS_GET_U(this->actor.params, 0, 2)]; } f32 EnInsect_XZDistanceSquared(Vec3f* v1, Vec3f* v2) { @@ -187,7 +187,7 @@ void EnInsect_Init(Actor* thisx, PlayState* play2) { Actor_ProcessInitChain(&this->actor, sInitChain); EnInsect_InitFlags(this); - type = this->actor.params & 3; + type = PARAMS_GET_U(this->actor.params, 0, 2); SkelAnime_Init(play, &this->skelAnime, &gBugSkel, &gBugCrawlAnim, this->jointTable, this->morphTable, 24); Collider_InitJntSph(play, &this->collider); @@ -242,7 +242,7 @@ void EnInsect_Destroy(Actor* thisx, PlayState* play) { s16 type; EnInsect* this = (EnInsect*)thisx; - type = this->actor.params & 3; + type = PARAMS_GET_U(this->actor.params, 0, 2); Collider_DestroyJntSph(play, &this->collider); if ((type == INSECT_TYPE_FIRST_DROPPED || type == INSECT_TYPE_EXTRA_DROPPED) && sDroppedCount > 0) { sDroppedCount--; @@ -261,7 +261,7 @@ void EnInsect_SlowDown(EnInsect* this, PlayState* play) { s16 type; f32 playSpeed; - type = this->actor.params & 3; + type = PARAMS_GET_U(this->actor.params, 0, 2); Math_SmoothStepToF(&this->actor.speed, 0.0f, 0.1f, 0.5f, 0.0f); @@ -297,7 +297,7 @@ void EnInsect_Crawl(EnInsect* this, PlayState* play) { s32 pad1; s32 pad2; s16 yaw; - s16 type = this->actor.params & 3; + s16 type = PARAMS_GET_U(this->actor.params, 0, 2); Math_SmoothStepToF(&this->actor.speed, 1.5f, 0.1f, 0.5f, 0.0f); @@ -469,7 +469,7 @@ void EnInsect_WalkOnWater(EnInsect* this, PlayState* play) { s16 type; Vec3f ripplePoint; - type = this->actor.params & 3; + type = PARAMS_GET_U(this->actor.params, 0, 2); if (this->actionTimer > 80) { Math_StepToF(&this->actor.speed, 0.6f, 0.08f); @@ -571,7 +571,7 @@ void EnInsect_Dropped(EnInsect* this, PlayState* play) { f32 sp34; sp50 = 0; - type = this->actor.params & 3; + type = PARAMS_GET_U(this->actor.params, 0, 2); if (this->soilActor != NULL) { distanceSq = Math3D_Vec3fDistSq(&this->actor.world.pos, &this->soilActor->actor.world.pos); @@ -672,8 +672,8 @@ void EnInsect_Dropped(EnInsect* this, PlayState* play) { !(this->insectFlags & INSECT_FLAG_7)) { if (this->unk_32A >= 15) { if (this->soilActor != NULL) { - if (!(GET_GS_FLAGS(((this->soilActor->actor.params >> 8) & 0x1F) - 1) & - (this->soilActor->actor.params & 0xFF))) { + if (!(GET_GS_FLAGS(PARAMS_GET_U(this->soilActor->actor.params, 8, 5) - 1) & + PARAMS_GET_U(this->soilActor->actor.params, 0, 8))) { Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); } } @@ -764,7 +764,7 @@ void EnInsect_Update(Actor* thisx, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - tmp = this->actor.params & 3; + tmp = PARAMS_GET_U(this->actor.params, 0, 2); if (tmp == INSECT_TYPE_FIRST_DROPPED || tmp == INSECT_TYPE_EXTRA_DROPPED) { Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index 8ab5e481b1..365df1e74a 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -106,7 +106,7 @@ void EnIshi_InitCollider(Actor* thisx, PlayState* play) { EnIshi* this = (EnIshi*)thisx; Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInits[this->actor.params & 1]); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInits[PARAMS_GET_U(this->actor.params, 0, 1)]); Collider_UpdateCylinder(&this->actor, &this->collider); } @@ -249,8 +249,8 @@ void EnIshi_SpawnDustLarge(EnIshi* this, PlayState* play) { void EnIshi_DropCollectible(EnIshi* this, PlayState* play) { s16 dropParams; - if ((this->actor.params & 1) == ROCK_SMALL) { - dropParams = (this->actor.params >> 8) & 0xF; + if (PARAMS_GET_U(this->actor.params, 0, 1) == ROCK_SMALL) { + dropParams = PARAMS_GET_U(this->actor.params, 8, 4); if (dropParams >= 0xD) { dropParams = 0; @@ -308,7 +308,7 @@ static InitChainEntry sInitChains[][5] = { void EnIshi_Init(Actor* thisx, PlayState* play) { EnIshi* this = (EnIshi*)thisx; - s16 type = this->actor.params & 1; + s16 type = PARAMS_GET_U(this->actor.params, 0, 1); Actor_ProcessInitChain(&this->actor, sInitChains[type]); if (play->csCtx.state != CS_STATE_IDLE) { @@ -319,14 +319,13 @@ void EnIshi_Init(Actor* thisx, PlayState* play) { } Actor_SetScale(&this->actor, sRockScales[type]); EnIshi_InitCollider(&this->actor, play); - if ((type == ROCK_LARGE) && - Flags_GetSwitch(play, ((this->actor.params >> 0xA) & 0x3C) | ((this->actor.params >> 6) & 3))) { + if ((type == ROCK_LARGE) && Flags_GetSwitch(play, ISHI_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); return; } CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); this->actor.shape.yOffset = D_80A7FA20[type]; - if (!((this->actor.params >> 5) & 1) && !EnIshi_SnapToFloor(this, play, 0.0f)) { + if (!PARAMS_GET_U(this->actor.params, 5, 1) && !EnIshi_SnapToFloor(this, play, 0.0f)) { Actor_Kill(&this->actor); return; } @@ -347,12 +346,12 @@ void EnIshi_SetupWait(EnIshi* this) { void EnIshi_Wait(EnIshi* this, PlayState* play) { static u16 liftSfxIds[] = { NA_SE_PL_PULL_UP_ROCK, NA_SE_PL_PULL_UP_BIGROCK }; s32 pad; - s16 type = this->actor.params & 1; + s16 type = PARAMS_GET_U(this->actor.params, 0, 1); if (Actor_HasParent(&this->actor, play)) { EnIshi_SetupLiftedUp(this); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, liftSfxIds[type]); - if ((this->actor.params >> 4) & 1) { + if (PARAMS_GET_U(this->actor.params, 4, 1)) { EnIshi_SpawnBugs(this, play); } } else if ((this->collider.base.acFlags & AC_HIT) && (type == ROCK_SMALL) && @@ -389,12 +388,12 @@ void EnIshi_SetupLiftedUp(EnIshi* this) { void EnIshi_LiftedUp(EnIshi* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { this->actor.room = play->roomCtx.curRoom.num; - if ((this->actor.params & 1) == ROCK_LARGE) { - Flags_SetSwitch(play, ((this->actor.params >> 0xA) & 0x3C) | ((this->actor.params >> 6) & 3)); + if (PARAMS_GET_U(this->actor.params, 0, 1) == ROCK_LARGE) { + Flags_SetSwitch(play, ISHI_GET_SWITCH_FLAG(&this->actor)); } EnIshi_SetupFly(this); EnIshi_Fall(this); - func_80A7ED94(&this->actor.velocity, D_80A7FA28[this->actor.params & 1]); + func_80A7ED94(&this->actor.velocity, D_80A7FA28[PARAMS_GET_U(this->actor.params, 0, 1)]); Actor_UpdatePos(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_6 | @@ -405,7 +404,7 @@ void EnIshi_LiftedUp(EnIshi* this, PlayState* play) { void EnIshi_SetupFly(EnIshi* this) { this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speed; this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speed; - if ((this->actor.params & 1) == ROCK_SMALL) { + if (PARAMS_GET_U(this->actor.params, 0, 1) == ROCK_SMALL) { sRotSpeedX = (Rand_ZeroOne() - 0.5f) * 16000.0f; sRotSpeedY = (Rand_ZeroOne() - 0.5f) * 2400.0f; } else { @@ -418,7 +417,7 @@ void EnIshi_SetupFly(EnIshi* this) { void EnIshi_Fly(EnIshi* this, PlayState* play) { s32 pad; - s16 type = this->actor.params & 1; + s16 type = PARAMS_GET_U(this->actor.params, 0, 1); s32 pad2; s32 quakeIndex; Vec3f contactPos; @@ -501,5 +500,5 @@ static EnIshiDrawFunc sDrawFuncs[] = { EnIshi_DrawSmall, EnIshi_DrawLarge }; void EnIshi_Draw(Actor* thisx, PlayState* play) { EnIshi* this = (EnIshi*)thisx; - sDrawFuncs[this->actor.params & 1](this, play); + sDrawFuncs[PARAMS_GET_U(this->actor.params, 0, 1)](this, play); } diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h index 08d5038206..3a7ab66fbd 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h @@ -4,6 +4,20 @@ #include "ultra64.h" #include "global.h" +// The switch flag value for this actor is constructed in a unique way. +// There are two seperate param values which get OR'd together to create one final switch flag index. +// These two values are seperated within the overall actor param value. See below: +// +// | A B C D | _ _ _ _ | E F | _ _ _ _ _ _ | +// 16 12 8 6 0 +// After the OR operation, the final switch flag is constructed to form "0bABCDEF" +// +// Due to the unique form of access to obtain the upper bits of the switch flag, `ISHI_GET_SWITCH_FLAG_UPPER` +// cannot use the generic `PARAMS_GET_U` macros. +#define ISHI_GET_SWITCH_FLAG_UPPER(thisx) ((((thisx)->params) >> (12 - 2)) & (NBITS_TO_MASK(4) << 2)) +#define ISHI_GET_SWITCH_FLAG_LOWER(thisx) PARAMS_GET_U((thisx)->params, 6, 2) +#define ISHI_GET_SWITCH_FLAG(thisx) (ISHI_GET_SWITCH_FLAG_UPPER(thisx) | ISHI_GET_SWITCH_FLAG_LOWER(thisx)) + typedef enum EnIshiType { /* 0x00 */ ROCK_SMALL, /* 0x01 */ ROCK_LARGE diff --git a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c index 6fb57a361c..b842b45967 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c @@ -63,8 +63,8 @@ void EnKakasi2_Init(Actor* thisx, PlayState* play) { // "Visit Umeda" PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 梅田参号見参! ☆☆☆☆☆ \n" VT_RST); - this->switchFlag = this->actor.params & 0x3F; - spawnRangeY = (this->actor.params >> 6) & 0xFF; + this->switchFlag = PARAMS_GET_U(this->actor.params, 0, 6); + spawnRangeY = PARAMS_GET_U(this->actor.params, 6, 8); spawnRangeXZ = this->actor.world.rot.z; if (this->switchFlag == 0x3F) { this->switchFlag = -1; diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index 2974272305..d4e0744573 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -471,7 +471,7 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); if (this->actionFunc == EnKarebaba_DeadItemDrop) { - if (this->actor.params > 40 || (this->actor.params & 1)) { + if (this->actor.params > 40 || PARAMS_GET_U(this->actor.params, 0, 1)) { Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_en_karebaba.c", 1066), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index 39509d41ae..3a0fa5ced7 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -13,8 +13,8 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -#define ENKO_TYPE (this->actor.params & 0xFF) -#define ENKO_PATH ((this->actor.params & 0xFF00) >> 8) +#define ENKO_TYPE PARAMS_GET_S(this->actor.params, 0, 8) +#define ENKO_PATH PARAMS_GET_S(this->actor.params, 8, 8) void EnKo_Init(Actor* thisx, PlayState* play); void EnKo_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index 7bfa8183df..48f0043d9d 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -126,10 +126,10 @@ s32 EnKusa_SnapToFloor(EnKusa* this, PlayState* play, f32 yOffset) { void EnKusa_DropCollectible(EnKusa* this, PlayState* play) { s16 dropParams; - switch (this->actor.params & 3) { + switch (PARAMS_GET_U(this->actor.params, 0, 2)) { case ENKUSA_TYPE_0: case ENKUSA_TYPE_2: - dropParams = (this->actor.params >> 8) & 0xF; + dropParams = PARAMS_GET_U(this->actor.params, 8, 4); if (dropParams >= 0xD) { dropParams = 0; @@ -253,7 +253,7 @@ void EnKusa_Init(Actor* thisx, PlayState* play) { return; } - this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[thisx->params & 3]); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[PARAMS_GET_U(thisx->params, 0, 2)]); if (this->requiredObjectSlot < 0) { // "Bank danger!" @@ -307,11 +307,11 @@ void EnKusa_Main(EnKusa* this, PlayState* play) { EnKusa_DropCollectible(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); - if ((this->actor.params >> 4) & 1) { + if (PARAMS_GET_U(this->actor.params, 4, 1)) { EnKusa_SpawnBugs(this, play); } - if ((this->actor.params & 3) == ENKUSA_TYPE_0) { + if (PARAMS_GET_U(this->actor.params, 0, 2) == ENKUSA_TYPE_0) { Actor_Kill(&this->actor); return; } @@ -379,7 +379,7 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) { } EnKusa_SpawnFragments(this, play); EnKusa_DropCollectible(this, play); - switch (this->actor.params & 3) { + switch (PARAMS_GET_U(this->actor.params, 0, 2)) { case ENKUSA_TYPE_0: case ENKUSA_TYPE_2: Actor_Kill(&this->actor); @@ -424,7 +424,7 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) { } void EnKusa_SetupCut(EnKusa* this) { - switch (this->actor.params & 3) { + switch (PARAMS_GET_U(this->actor.params, 0, 2)) { case ENKUSA_TYPE_2: EnKusa_SetupAction(this, EnKusa_DoNothing); break; @@ -504,6 +504,6 @@ void EnKusa_Draw(Actor* thisx, PlayState* play) { if (this->actor.flags & ACTOR_FLAG_ENKUSA_CUT) { Gfx_DrawDListOpa(play, object_kusa_DL_0002E0); } else { - Gfx_DrawDListOpa(play, dLists[thisx->params & 3]); + Gfx_DrawDListOpa(play, dLists[PARAMS_GET_U(thisx->params, 0, 2)]); } } diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index e2e0fd0efd..bb1a467c12 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -281,11 +281,11 @@ s32 EnKz_FollowPath(EnKz* this, PlayState* play) { f32 pathDiffX; f32 pathDiffZ; - if ((this->actor.params & 0xFF00) == 0xFF00) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 8, 8) == 0xFF00) { return 0; } - path = &play->pathList[(this->actor.params & 0xFF00) >> 8]; + path = &play->pathList[PARAMS_GET_S(this->actor.params, 8, 8)]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += this->waypoint; @@ -307,11 +307,11 @@ s32 EnKz_SetMovedPos(EnKz* this, PlayState* play) { Path* path; Vec3s* lastPointPos; - if ((this->actor.params & 0xFF00) == 0xFF00) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 8, 8) == 0xFF00) { return 0; } - path = &play->pathList[(this->actor.params & 0xFF00) >> 8]; + path = &play->pathList[PARAMS_GET_S(this->actor.params, 8, 8)]; lastPointPos = SEGMENTED_TO_VIRTUAL(path->points); lastPointPos += path->count - 1; diff --git a/src/overlays/actors/ovl_En_Light/z_en_light.c b/src/overlays/actors/ovl_En_Light/z_en_light.c index 7f867e6032..5f6939117e 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -60,10 +60,10 @@ void EnLight_Init(Actor* thisx, PlayState* play) { } this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); - Actor_SetScale(&this->actor, D_80A9E840[this->actor.params & 0xF].scale * 0.0001f); + Actor_SetScale(&this->actor, D_80A9E840[PARAMS_GET_S(this->actor.params, 0, 4)].scale * 0.0001f); this->timer = (s32)(Rand_ZeroOne() * 255.0f); - if ((this->actor.params & 0x400) != 0) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 10, 1)) { this->actor.update = EnLight_UpdateSwitch; } } @@ -92,7 +92,7 @@ void EnLight_Update(Actor* thisx, PlayState* play) { s16 radius; EnLight* this = (EnLight*)thisx; - flameParams = &D_80A9E840[this->actor.params & 0xF]; + flameParams = &D_80A9E840[PARAMS_GET_S(this->actor.params, 0, 4)]; intensity = (Rand_ZeroOne() * 0.5f) + 0.5f; radius = (this->actor.params < 0) ? 100 : 300; Lights_PointSetColorAndRadius(&this->lightInfo, (flameParams->primColor.r * intensity), @@ -111,11 +111,11 @@ void EnLight_UpdateSwitch(Actor* thisx, PlayState* play) { EnLight* this = (EnLight*)thisx; f32 scale; - flameParams = &D_80A9E840[this->actor.params & 0xF]; + flameParams = &D_80A9E840[PARAMS_GET_S(this->actor.params, 0, 4)]; scale = this->actor.scale.x / ((f32)flameParams->scale * 0.0001); - if ((this->actor.params & 0x800) != 0) { - if (Flags_GetSwitch(play, (this->actor.params & 0x3F0) >> 4)) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 11, 1)) { + if (Flags_GetSwitch(play, PARAMS_GET_S(this->actor.params, 4, 6))) { Math_StepToF(&scale, 1.0f, 0.05f); } else { if (scale < 0.1f) { @@ -125,7 +125,7 @@ void EnLight_UpdateSwitch(Actor* thisx, PlayState* play) { Math_StepToF(&scale, 0.0f, 0.05f); } } else { - if (Flags_GetSwitch(play, (this->actor.params & 0x3F0) >> 4)) { + if (Flags_GetSwitch(play, PARAMS_GET_S(this->actor.params, 4, 6))) { if (scale < 0.1f) { Actor_SetScale(&this->actor, 0.0f); return; @@ -156,7 +156,7 @@ void EnLight_Draw(Actor* thisx, PlayState* play) { if (1) {} - flameParams = &D_80A9E840[this->actor.params & 0xF]; + flameParams = &D_80A9E840[PARAMS_GET_S(this->actor.params, 0, 4)]; OPEN_DISPS(play->state.gfxCtx, "../z_en_light.c", 441); @@ -184,7 +184,7 @@ void EnLight_Draw(Actor* thisx, PlayState* play) { Matrix_RotateY(BINANG_TO_RAD((s16)((Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y) + 0x8000)), MTXMODE_APPLY); - if (this->actor.params & 1) { + if (PARAMS_GET_S(this->actor.params, 0, 1)) { Matrix_RotateY(M_PI, MTXMODE_APPLY); } diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index 7fce325335..e703f4b94f 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -59,7 +59,7 @@ void EnMThunder_Init(Actor* thisx, PlayState* play2) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &D_80AA0420); - this->unk_1C7 = (this->actor.params & 0xFF) - 1; + this->unk_1C7 = PARAMS_GET_S(this->actor.params, 0, 8) - 1; Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 255, 255, 255, 0); this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); @@ -78,8 +78,8 @@ void EnMThunder_Init(Actor* thisx, PlayState* play2) { if (player->stateFlags2 & PLAYER_STATE2_17) { if (!gSaveContext.save.info.playerData.isMagicAcquired || (gSaveContext.magicState != MAGIC_STATE_IDLE) || - (((this->actor.params & 0xFF00) >> 8) && - !(Magic_RequestChange(play, (this->actor.params & 0xFF00) >> 8, MAGIC_CONSUME_NOW)))) { + (PARAMS_GET_S(this->actor.params, 8, 8) && + !(Magic_RequestChange(play, PARAMS_GET_S(this->actor.params, 8, 8), MAGIC_CONSUME_NOW)))) { Audio_PlaySfxGeneral(NA_SE_IT_ROLLING_CUT, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); Audio_PlaySfxGeneral(NA_SE_IT_SWORD_SWING_HARD, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, @@ -151,8 +151,8 @@ void func_80A9F408(EnMThunder* this, PlayState* play) { if (this->unk_1CA == 0) { if (player->unk_858 >= 0.1f) { if ((gSaveContext.magicState != MAGIC_STATE_IDLE) || - (((this->actor.params & 0xFF00) >> 8) && - !(Magic_RequestChange(play, (this->actor.params & 0xFF00) >> 8, MAGIC_CONSUME_WAIT_PREVIEW)))) { + (PARAMS_GET_S(this->actor.params, 8, 8) && + !(Magic_RequestChange(play, PARAMS_GET_S(this->actor.params, 8, 8), MAGIC_CONSUME_WAIT_PREVIEW)))) { func_80A9F350(this, play); func_80A9EFE0(this, func_80A9F350); this->unk_1C8 = 0; @@ -185,7 +185,7 @@ void func_80A9F408(EnMThunder* this, PlayState* play) { return; } else { player->stateFlags2 &= ~PLAYER_STATE2_17; - if ((this->actor.params & 0xFF00) >> 8) { + if (PARAMS_GET_S(this->actor.params, 8, 8)) { gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP; } if (player->unk_858 < 0.85f) { diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 6e35915331..b166870321 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -316,7 +316,7 @@ void EnMb_Init(Actor* thisx, PlayState* play) { this->morphTable, 28); Actor_SetScale(&this->actor, 0.014f); - this->path = (thisx->params & 0xFF00) >> 8; + this->path = PARAMS_GET_S(thisx->params, 8, 8); this->actor.params = ENMB_TYPE_SPEAR_PATROL; this->waypoint = 0; this->actor.colChkInfo.health = 1; diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 833971a3ee..c82d225370 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -592,11 +592,11 @@ u8 EnMd_FollowPath(EnMd* this, PlayState* play) { f32 pathDiffX; f32 pathDiffZ; - if ((this->actor.params & 0xFF00) == 0xFF00) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 8, 8) == 0xFF00) { return 0; } - path = &play->pathList[(this->actor.params & 0xFF00) >> 8]; + path = &play->pathList[PARAMS_GET_S(this->actor.params, 8, 8)]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += this->waypoint; @@ -619,11 +619,11 @@ u8 EnMd_SetMovedPos(EnMd* this, PlayState* play) { Path* path; Vec3s* lastPointPos; - if ((this->actor.params & 0xFF00) == 0xFF00) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 8, 8) == 0xFF00) { return 0; } - path = &play->pathList[(this->actor.params & 0xFF00) >> 8]; + path = &play->pathList[PARAMS_GET_S(this->actor.params, 8, 8)]; lastPointPos = SEGMENTED_TO_VIRTUAL(path->points); lastPointPos += path->count - 1; diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index 59b950d1c0..cee7f3a4cb 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -173,7 +173,7 @@ void EnMm_Init(Actor* thisx, PlayState* play) { Animation_GetLastFrame(sAnimationInfo[RM_ANIM_RUN].animation), sAnimationInfo[RM_ANIM_RUN].mode, sAnimationInfo[RM_ANIM_RUN].morphFrames); - this->path = this->actor.params & 0xFF; + this->path = PARAMS_GET_U(this->actor.params, 0, 8); this->unk_1F0 = 2; this->unk_1E8 = 0; this->actor.targetMode = 2; diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 20f6c34161..cb5563cfbf 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -90,15 +90,15 @@ static s32 D_80AB4318 = 0; #include "z_en_nb_cutscene_data.inc.c" s32 EnNb_GetPath(EnNb* this) { - s32 path = this->actor.params >> 8; + s32 path = PARAMS_GET_U(this->actor.params, 8, 8); - return path & 0xFF; + return path; } s32 EnNb_GetType(EnNb* this) { - s32 type = this->actor.params; + s32 type = PARAMS_GET_U(this->actor.params, 0, 8); - return type & 0xFF; + return type; } void EnNb_UpdatePath(EnNb* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c index d318e9f051..cf063c2153 100644 --- a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c +++ b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c @@ -65,7 +65,7 @@ void EnNiwGirl_Init(Actor* thisx, PlayState* play) { if (this->actor.params < 0) { this->actor.params = 0; } - this->path = ((this->actor.params >> 8) & 0xFF); + this->path = PARAMS_GET_U(this->actor.params, 8, 8); this->actor.gravity = -3.0f; Matrix_RotateY(BINANG_TO_RAD_ALT(this->actor.shape.rot.y), MTXMODE_NEW); vec2.x = vec2.y = vec2.z = 0.0f; diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index 1e4ade9f29..b04c498fe3 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -47,9 +47,9 @@ void EnOkarinaTag_Init(Actor* thisx, PlayState* play) { // "Ocarina tag outbreak" PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ オカリナタグ発生 ☆☆☆☆☆ %x\n" VT_RST, this->actor.params); this->actor.flags &= ~ACTOR_FLAG_0; - this->type = (this->actor.params >> 0xA) & 0x3F; - this->ocarinaSong = (this->actor.params >> 6) & 0xF; - this->switchFlag = this->actor.params & 0x3F; + this->type = PARAMS_GET_U(this->actor.params, 10, 6); + this->ocarinaSong = PARAMS_GET_U(this->actor.params, 6, 4); + this->switchFlag = PARAMS_GET_U(this->actor.params, 0, 6); if (this->switchFlag == 0x3F) { this->switchFlag = -1; } diff --git a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index 21dc7500d8..31f78da323 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -121,7 +121,7 @@ void EnOkuta_Init(Actor* thisx, PlayState* play) { s32 floorBgId; Actor_ProcessInitChain(thisx, sInitChain); - this->numShots = (thisx->params >> 8) & 0xFF; + this->numShots = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; if (thisx->params == 0) { SkelAnime_Init(play, &this->skelAnime, &gOctorokSkel, &gOctorokAppearAnim, this->jointTable, this->morphTable, diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index c4ebcbb6c1..d8da9e0143 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -125,8 +125,8 @@ void EnOwl_Init(Actor* thisx, PlayState* play) { this->unk_405 = 4; this->unk_404 = this->unk_407 = 0; this->unk_408 = 4; - owlType = (this->actor.params & 0xFC0) >> 6; - switchFlag = (this->actor.params & 0x3F); + owlType = PARAMS_GET_S(this->actor.params, 6, 6); + switchFlag = PARAMS_GET_S(this->actor.params, 0, 6); if (this->actor.params == 0xFFF) { owlType = OWL_OUTSIDE_KOKIRI; switchFlag = 0x20; @@ -302,7 +302,7 @@ void func_80ACA5C8(EnOwl* this) { } void func_80ACA62C(EnOwl* this, PlayState* play) { - s32 switchFlag = this->actor.params & 0x3F; + s32 switchFlag = PARAMS_GET_S(this->actor.params, 0, 6); if (switchFlag < 0x20) { Flags_SetSwitch(play, switchFlag); @@ -728,7 +728,7 @@ void func_80ACB748(EnOwl* this, PlayState* play) { static Vec3f D_80ACD62C = { 0.0f, 0.0f, 0.0f }; f32 dist; f32 weight; - s32 owlType = (this->actor.params & 0xFC0) >> 6; + s32 owlType = PARAMS_GET_S(this->actor.params, 6, 6); dist = Math3D_Vec3f_DistXYZ(&this->eye, &play->view.eye) / 45.0f; this->eye.x = play->view.eye.x; @@ -926,7 +926,7 @@ void func_80ACC00C(EnOwl* this, PlayState* play) { if (this->actor.xzDistToPlayer < 50.0f) { if (!Play_InCsMode(play)) { - owlType = (this->actor.params & 0xFC0) >> 6; + owlType = PARAMS_GET_S(this->actor.params, 6, 6); PRINTF(VT_FGCOL(CYAN)); PRINTF("%dのフクロウ\n", owlType); // "%d owl" PRINTF(VT_RST); @@ -1057,7 +1057,7 @@ s32 func_80ACC5CC(EnOwl* this) { } s32 func_80ACC624(EnOwl* this, PlayState* play) { - s32 switchFlag = (this->actor.params & 0xFC0) >> 6; + s32 switchFlag = PARAMS_GET_S(this->actor.params, 6, 6); if (play->sceneId != SCENE_DESERT_COLOSSUS) { return true; diff --git a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c index 6adf35d68b..5440de81a8 100644 --- a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c +++ b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c @@ -74,7 +74,7 @@ void EnPoDesert_Init(Actor* thisx, PlayState* play) { 255, 255, 255, 200); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 37.0f); this->currentPathPoint = 1; - this->actor.params = (this->actor.params >> 8) & 0xFF; + this->actor.params = PARAMS_GET_U(this->actor.params, 8, 8); this->targetY = this->actor.world.pos.y; EnPoDesert_SetNextPathPoint(this, play); } diff --git a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c index 88542082e9..8398397417 100644 --- a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c +++ b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c @@ -153,7 +153,7 @@ void EnPoField_Init(Actor* thisx, PlayState* play) { sSpawnPositions[sNumSpawned].x = this->actor.world.pos.x; sSpawnPositions[sNumSpawned].y = this->actor.world.pos.y; sSpawnPositions[sNumSpawned].z = this->actor.world.pos.z; - sSpawnSwitchFlags[sNumSpawned] = this->actor.params & 0xFF; + sSpawnSwitchFlags[sNumSpawned] = PARAMS_GET_U(this->actor.params, 0, 8); sNumSpawned++; } if (sNumSpawned >= 2) { diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index a7de8c83dc..735f07fe70 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -191,17 +191,17 @@ void EnPoSisters_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - this->unk_194 = (thisx->params >> 8) & 3; + this->unk_194 = PARAMS_GET_U(thisx->params, 8, 2); this->actor.naviEnemyId = this->unk_194 + NAVI_ENEMY_POE_SISTER_MEG; if (1) {} - this->unk_195 = (thisx->params >> 0xA) & 3; + this->unk_195 = PARAMS_GET_U(thisx->params, 10, 2); this->unk_196 = 32; this->unk_197 = 20; this->unk_198 = 1; this->unk_199 = 32; this->unk_294 = 110.0f; this->actor.flags &= ~ACTOR_FLAG_0; - if (this->actor.params & 0x1000) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 12, 1)) { func_80ADA094(this, play); } else if (this->unk_194 == 0) { if (this->unk_195 == 0) { diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index f7320699d0..d030db2ad0 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -151,9 +151,9 @@ void EnRd_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 8; this->alpha = this->unk_31D = 255; - this->rdFlags = REDEAD_GET_FLAGS(thisx); + this->rdFlags = REDEAD_GET_RDFLAGS(thisx); - if (this->actor.params & 0x80) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 7, 1)) { this->actor.params |= 0xFF00; } else { this->actor.params &= 0xFF; diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.h b/src/overlays/actors/ovl_En_Rd/z_en_rd.h index a484573e2d..4c46a5e1e1 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.h +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.h @@ -8,7 +8,7 @@ struct EnRd; typedef void (*EnRdActionFunc)(struct EnRd*, PlayState*); -#define REDEAD_GET_FLAGS(thisx) (((thisx)->params & 0xFF00) >> 8) +#define REDEAD_GET_RDFLAGS(thisx) PARAMS_GET_S((thisx)->params, 8, 8) typedef enum RedeadGibdoLimb { /* 0 */ REDEAD_GIBDO_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c index 0cbcbdb024..8aa760ecaf 100644 --- a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c +++ b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c @@ -29,8 +29,8 @@ void EnRiverSound_Init(Actor* thisx, PlayState* play) { EnRiverSound* this = (EnRiverSound*)thisx; this->playSfx = false; - this->pathIndex = (this->actor.params >> 8) & 0xFF; - this->actor.params &= 0xFF; + this->pathIndex = PARAMS_GET_U(this->actor.params, 8, 8); + this->actor.params = PARAMS_GET_U(this->actor.params, 0, 8); if (this->actor.params >= RS_GANON_TOWER_0) { // Incrementally increase volume of NA_BGM_GANON_TOWER for each new room during the climb of Ganon's Tower diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 9f11eba226..e6abcb837b 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -189,13 +189,13 @@ void func_80AEADD8(EnRu1* this) { } u8 func_80AEADE0(EnRu1* this) { - u8 params = this->actor.params >> 8; + u8 params = PARAMS_GET_U(this->actor.params, 8, 8); return params; } u8 func_80AEADF0(EnRu1* this) { - s16 params = this->actor.params; + u8 params = PARAMS_GET_U(this->actor.params, 0, 8); return params; } @@ -324,7 +324,7 @@ Actor* func_80AEB124(PlayState* play) { Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_BOSS].head; while (actorIt != NULL) { - if ((actorIt->id == ACTOR_DEMO_EFFECT) && ((actorIt->params & 0xFF) == DEMO_EFFECT_JEWEL_ZORA)) { + if ((actorIt->id == ACTOR_DEMO_EFFECT) && (PARAMS_GET_U(actorIt->params, 0, 8) == DEMO_EFFECT_JEWEL_ZORA)) { return actorIt; } actorIt = actorIt->next; @@ -1529,7 +1529,7 @@ void func_80AEE2F8(EnRu1* this, PlayState* play) { floorBgId = this->actor.floorBgId; dynaPolyActor = DynaPoly_GetActor(&play->colCtx, floorBgId); if ((dynaPolyActor != NULL) && (dynaPolyActor->actor.id == ACTOR_BG_BDAN_SWITCH)) { - if (((dynaPolyActor->actor.params >> 8) & 0x3F) == 0x38) { + if (PARAMS_GET_U(dynaPolyActor->actor.params, 8, 6) == 0x38) { SET_INFTABLE(INFTABLE_140); return; } diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index e93011fc4b..9bcb6c8d72 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -127,15 +127,15 @@ void func_80AF2608(EnRu2* this) { } s32 func_80AF2690(EnRu2* this) { - s32 params_shift = this->actor.params >> 8; + s32 params_shift = PARAMS_GET_U(this->actor.params, 8, 8); - return params_shift & 0xFF; + return params_shift; } s32 func_80AF26A0(EnRu2* this) { - s16 params = this->actor.params; + s32 params = PARAMS_GET_U(this->actor.params, 0, 8); - return params & 0xFF; + return params; } #if OOT_DEBUG diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.c b/src/overlays/actors/ovl_En_Si/z_en_si.c index cac674c404..eb0a7acfb8 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -128,7 +128,7 @@ void func_80AFB950(EnSi* this, PlayState* play) { if (Message_GetState(&play->msgCtx) != TEXT_STATE_CLOSING) { player->actor.freezeTimer = 10; } else { - SET_GS_FLAGS((this->actor.params & 0x1F00) >> 8, this->actor.params & 0xFF); + SET_GS_FLAGS(PARAMS_GET_S(this->actor.params, 8, 5), PARAMS_GET_S(this->actor.params, 0, 8)); Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c index 1335c1b7ad..6d6f5baba0 100644 --- a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c +++ b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c @@ -51,7 +51,7 @@ void EnSiofuki_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->sfxFlags |= 1; - type = ((u16)thisx->params >> 0xC) & 0xF; + type = PARAMS_GET_U((u16)thisx->params, 12, 4); if (!((type == 0) || (type == 1))) { Actor_Kill(thisx); return; @@ -81,13 +81,13 @@ void EnSiofuki_Init(Actor* thisx, PlayState* play) { thisx->shape.rot.y = 0; thisx->shape.rot.z = 0; - type = ((u16)thisx->params >> 0xC) & 0xF; + type = PARAMS_GET_U((u16)thisx->params, 12, 4); if (type == EN_SIOFUKI_RAISING) { this->currentHeight = 10.0f; this->targetHeight = 10.0f; this->actionFunc = func_80AFC34C; } else if (type == EN_SIOFUKI_LOWERING) { - if (Flags_GetTreasure(play, (u16)thisx->params & 0x3F)) { + if (Flags_GetTreasure(play, PARAMS_GET_U((u16)thisx->params, 0, 6))) { this->currentHeight = -45.0f; this->targetHeight = -45.0f; this->actionFunc = func_80AFC544; @@ -190,8 +190,8 @@ void func_80AFC218(EnSiofuki* this, PlayState* play) { this->timer--; if (this->timer < 0) { - Flags_UnsetSwitch(play, ((u16)this->dyna.actor.params >> 6) & 0x3F); - switch (((u16)this->dyna.actor.params >> 0xC) & 0xF) { + Flags_UnsetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 6, 6)); + switch (PARAMS_GET_U((u16)this->dyna.actor.params, 12, 4)) { case EN_SIOFUKI_RAISING: this->targetHeight = 10.0f; this->actionFunc = func_80AFC34C; @@ -205,11 +205,11 @@ void func_80AFC218(EnSiofuki* this, PlayState* play) { func_8002F994(&this->dyna.actor, this->timer); } - if (((((u16)this->dyna.actor.params >> 0xC) & 0xF) == EN_SIOFUKI_LOWERING) && - Flags_GetTreasure(play, (u16)this->dyna.actor.params & 0x3F)) { + if ((PARAMS_GET_U((u16)this->dyna.actor.params, 12, 4) == EN_SIOFUKI_LOWERING) && + Flags_GetTreasure(play, PARAMS_GET_U((u16)this->dyna.actor.params, 0, 6))) { this->currentHeight = -45.0f; this->targetHeight = -45.0f; - Flags_UnsetSwitch(play, ((u16)this->dyna.actor.params >> 6) & 0x3F); + Flags_UnsetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 6, 6)); this->actionFunc = func_80AFC544; } } @@ -219,7 +219,7 @@ void func_80AFC34C(EnSiofuki* this, PlayState* play) { func_80AFBE8C(this, play); func_80AFC1D0(this, play); - if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 6) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 6, 6))) { this->targetHeight = 400.0f; this->timer = 300; this->actionFunc = func_80AFC218; @@ -238,7 +238,7 @@ void func_80AFC3C8(EnSiofuki* this, PlayState* play) { this->actionFunc = func_80AFC218; } - if (Flags_GetTreasure(play, (u16)this->dyna.actor.params & 0x3F)) { + if (Flags_GetTreasure(play, PARAMS_GET_U((u16)this->dyna.actor.params, 0, 6))) { this->currentHeight = -45.0f; this->targetHeight = -45.0f; this->actionFunc = func_80AFC544; @@ -250,14 +250,14 @@ void func_80AFC478(EnSiofuki* this, PlayState* play) { func_80AFBE8C(this, play); func_80AFC1D0(this, play); - if (((u16)this->dyna.actor.params >> 0xC & 0xF) == EN_SIOFUKI_LOWERING) { - if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 6) & 0x3F)) { + if (PARAMS_GET_U((u16)this->dyna.actor.params, 12, 4) == EN_SIOFUKI_LOWERING) { + if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 6, 6))) { this->timer = 20; this->actionFunc = func_80AFC3C8; OnePointCutscene_Init(play, 5010, 40, &this->dyna.actor, CAM_ID_MAIN); } - if (Flags_GetTreasure(play, (u16)this->dyna.actor.params & 0x3F)) { + if (Flags_GetTreasure(play, PARAMS_GET_U((u16)this->dyna.actor.params, 0, 6))) { this->currentHeight = -45.0f; this->targetHeight = -45.0f; this->actionFunc = func_80AFC544; @@ -298,7 +298,7 @@ void EnSiofuki_Draw(Actor* thisx, PlayState* play) { if (this->sfxFlags & 1) { f32 heightRatio; - switch (((u16)thisx->params >> 0xC) & 0xF) { + switch (PARAMS_GET_U((u16)thisx->params, 12, 4)) { case EN_SIOFUKI_RAISING: heightRatio = (this->currentHeight - 10.0f) / (400.0f - 10.0f); func_800F436C(&thisx->projectedPos, NA_SE_EV_FOUNTAIN - SFX_FLAG, 1.0f + heightRatio); diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 102d9c690a..ff68488558 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -360,7 +360,7 @@ void EnSkj_SetNaviId(EnSkj* this) { } void EnSkj_Init(Actor* thisx, PlayState* play2) { - s16 type = (thisx->params >> 0xA) & 0x3F; + s16 type = PARAMS_GET_U(thisx->params, 10, 6); EnSkj* this = (EnSkj*)thisx; PlayState* play = play2; s32 pad; diff --git a/src/overlays/actors/ovl_En_Stream/z_en_stream.c b/src/overlays/actors/ovl_En_Stream/z_en_stream.c index afd36981f5..c5c3a56494 100644 --- a/src/overlays/actors/ovl_En_Stream/z_en_stream.c +++ b/src/overlays/actors/ovl_En_Stream/z_en_stream.c @@ -38,7 +38,7 @@ void EnStream_SetupAction(EnStream* this, EnStreamActionFunc actionFunc) { void EnStream_Init(Actor* thisx, PlayState* play) { EnStream* this = (EnStream*)thisx; - this->unk_150 = thisx->params & 0xFF; + this->unk_150 = PARAMS_GET_U(thisx->params, 0, 8); Actor_ProcessInitChain(thisx, sInitChain); if ((this->unk_150 != 0) && (this->unk_150 == 1)) { thisx->scale.y = 0.01f; diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 65f0b47ed6..2b2d3632e6 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -220,18 +220,18 @@ void EnSw_Init(Actor* thisx, PlayState* play) { Vec3f sp4C = { 0.0f, 0.0f, 0.0f }; s32 pad; - if (thisx->params & 0x8000) { - phi_v0 = (((thisx->params - 0x8000) & 0xE000) >> 0xD) + 1; - thisx->params = (thisx->params & 0x1FFF) | (phi_v0 << 0xD); + if (PARAMS_GET_NOSHIFT(thisx->params, 15, 1)) { + phi_v0 = PARAMS_GET_S(thisx->params - 0x8000, 13, 3) + 1; + thisx->params = PARAMS_GET_S(thisx->params, 0, 13) | (phi_v0 << 0xD); } - if (((thisx->params & 0xE000) >> 0xD) > 0) { - phi_v0 = ((thisx->params & 0x1F00) >> 8) - 1; - thisx->params = (thisx->params & 0xE0FF) | (phi_v0 << 8); + if (PARAMS_GET_S(thisx->params, 13, 3) > 0) { + phi_v0 = PARAMS_GET_S(thisx->params, 8, 5) - 1; + thisx->params = (thisx->params & ~(0x1F << 8)) | (phi_v0 << 8); } // Check to see if this gold skull token has already been retrieved. - if (GET_GS_FLAGS((thisx->params & 0x1F00) >> 8) & (thisx->params & 0xFF)) { + if (GET_GS_FLAGS(PARAMS_GET_S(thisx->params, 8, 5)) & PARAMS_GET_S(thisx->params, 0, 8)) { Actor_Kill(&this->actor); return; } @@ -244,7 +244,7 @@ void EnSw_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0xE), &D_80B0F074); this->actor.scale.x = 0.02f; - if (((thisx->params & 0xE000) >> 0xD) == 0) { + if (PARAMS_GET_S(thisx->params, 13, 3) == 0) { this->actor.world.rot.x = 0; this->actor.world.rot.z = 0; thisx->shape.rot = this->actor.world.rot; @@ -266,12 +266,12 @@ void EnSw_Init(Actor* thisx, PlayState* play) { func_80B0C0CC(this, play, 1); } - if (((thisx->params & 0xE000) >> 0xD) >= 3) { + if (PARAMS_GET_S(thisx->params, 13, 3) >= 3) { Audio_PlaySfxGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - switch ((thisx->params & 0xE000) >> 0xD) { + switch (PARAMS_GET_S(thisx->params, 13, 3)) { case 3: case 4: this->unk_360 = 1; @@ -299,11 +299,11 @@ void EnSw_Init(Actor* thisx, PlayState* play) { this->actor.home.pos = this->actor.world.pos; thisx->shape.rot = this->actor.world.rot; - if (((thisx->params & 0xE000) >> 0xD) >= 3) { + if (PARAMS_GET_S(thisx->params, 13, 3) >= 3) { this->unk_38C = 0x28; this->unk_394 = 1; this->actionFunc = func_80B0D364; - } else if (((thisx->params & 0xE000) >> 0xD) == 0) { + } else if (PARAMS_GET_S(thisx->params, 13, 3) == 0) { this->actionFunc = func_80B0E5E0; } else { this->actionFunc = func_80B0D590; @@ -319,7 +319,7 @@ void EnSw_Destroy(Actor* thisx, PlayState* play) { s32 func_80B0C9F0(EnSw* this, PlayState* play) { s32 phi_v1 = false; - if (this->actor.xyzDistToPlayerSq < SQ(400.0f) && ((this->actor.params & 0xE000) >> 0xD) == 0 && + if (this->actor.xyzDistToPlayerSq < SQ(400.0f) && PARAMS_GET_S(this->actor.params, 13, 3) == 0 && play->actorCtx.unk_02 != 0) { this->actor.colChkInfo.damage = this->actor.colChkInfo.health; @@ -336,7 +336,7 @@ s32 func_80B0C9F0(EnSw* this, PlayState* play) { return true; } Enemy_StartFinishingBlow(play, &this->actor); - if (((this->actor.params & 0xE000) >> 0xD) != 0) { + if (PARAMS_GET_S(this->actor.params, 13, 3) != 0) { this->skelAnime.playSpeed = 8.0f; if ((play->state.frames & 1) == 0) { this->unk_420 = 0.1f; @@ -370,7 +370,7 @@ s32 func_80B0C9F0(EnSw* this, PlayState* play) { } void func_80B0CBE8(EnSw* this, PlayState* play) { - if ((((this->actor.params & 0xE000) >> 0xD) > 0) && (this->actionFunc != func_80B0D590)) { + if ((PARAMS_GET_S(this->actor.params, 13, 3) > 0) && (this->actionFunc != func_80B0D590)) { if (this->unk_392 != 0) { this->unk_392--; } @@ -438,8 +438,8 @@ void func_80B0CEA8(EnSw* this, PlayState* play) { Camera* activeCam = GET_ACTIVE_CAM(play); if (!(Math_Vec3f_DistXYZ(&this->actor.world.pos, &activeCam->eye) >= 380.0f)) { - Actor_PlaySfx(&this->actor, - ((this->actor.params & 0xE000) >> 0xD) > 0 ? NA_SE_EN_STALGOLD_ROLL : NA_SE_EN_STALWALL_ROLL); + Actor_PlaySfx(&this->actor, (PARAMS_GET_S(this->actor.params, 13, 3) > 0) ? NA_SE_EN_STALGOLD_ROLL + : NA_SE_EN_STALWALL_ROLL); } } } @@ -483,7 +483,7 @@ void func_80B0D14C(EnSw* this, PlayState* play, s32 cnt) { } void func_80B0D364(EnSw* this, PlayState* play) { - if (((this->actor.params & 0xE000) >> 0xD) == 4) { + if (PARAMS_GET_S(this->actor.params, 13, 3) == 4) { this->unk_38C = 0; this->actionFunc = func_80B0D3AC; } else { @@ -536,7 +536,7 @@ void func_80B0D3AC(EnSw* this, PlayState* play) { void func_80B0D590(EnSw* this, PlayState* play) { f32 sp2C; - if (((this->actor.params & 0xE000) >> 0xD) == 2) { + if (PARAMS_GET_S(this->actor.params, 13, 3) == 2) { if (this->actor.scale.x < 0.0139999995f) { this->collider.elements[0].base.atElemFlags = ATELEM_NONE; this->collider.elements[0].base.acElemFlags = ACELEM_NONE; @@ -560,7 +560,7 @@ void func_80B0D590(EnSw* this, PlayState* play) { this->unk_420 = ((play->state.frames % 2) == 0) ? 0.1f : -0.1f; this->unk_38A = 1; this->unk_38C = Rand_S16Offset(30, 60); - if (((this->actor.params & 0xE000) >> 0xD) != 0) { + if (PARAMS_GET_S(this->actor.params, 13, 3) != 0) { this->unk_38C *= 2; this->unk_420 *= 2.0f; } @@ -571,7 +571,7 @@ void func_80B0D590(EnSw* this, PlayState* play) { this->unk_38E = Rand_S16Offset(15, 30); this->unk_38A = 0; this->skelAnime.playSpeed = 0.0f; - if (((this->actor.params & 0xE000) >> 0xD) != 0) { + if (PARAMS_GET_S(this->actor.params, 13, 3) != 0) { this->unk_38E /= 2; } } else if (this->unk_38A != 0) { @@ -581,7 +581,7 @@ void func_80B0D590(EnSw* this, PlayState* play) { if (this->skelAnime.playSpeed > 0.0f) { func_80B0CEA8(this, play); } - if (((this->actor.params & 0xE000) >> 0xD) != 0) { + if (PARAMS_GET_S(this->actor.params, 13, 3) != 0) { this->skelAnime.playSpeed *= 2.0f; } } else { @@ -910,7 +910,7 @@ s32 EnSw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po OPEN_DISPS(play->state.gfxCtx, "../z_en_sw.c", 2084); - if (((this->actor.params & 0xE000) >> 0xD) != 0) { + if (PARAMS_GET_S(this->actor.params, 13, 3) != 0) { switch (limbIndex) { case 23: *dList = object_st_DL_004788; @@ -1001,7 +1001,7 @@ void EnSw_Draw(Actor* thisx, PlayState* play) { EnSw* this = (EnSw*)thisx; Color_RGBA8 sp30 = { 184, 0, 228, 255 }; - if (((this->actor.params & 0xE000) >> 0xD) != 0) { + if (PARAMS_GET_S(this->actor.params, 13, 3) != 0) { Matrix_RotateX(DEG_TO_RAD(-80), MTXMODE_APPLY); if (this->actor.colChkInfo.health != 0) { Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Trap/z_en_trap.c b/src/overlays/actors/ovl_En_Trap/z_en_trap.c index 44ab7726dd..1aa70e21b5 100644 --- a/src/overlays/actors/ovl_En_Trap/z_en_trap.c +++ b/src/overlays/actors/ovl_En_Trap/z_en_trap.c @@ -67,7 +67,7 @@ void EnTrap_Init(Actor* thisx, PlayState* play) { EnTrap* this = (EnTrap*)thisx; ColliderCylinder* unused = &this->collider; // required to match - this->upperParams = (thisx->params >> 8) & 0xFF; + this->upperParams = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; Actor_SetScale(thisx, 0.1f); thisx->gravity = -2.0f; diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index 45da6ae14b..ddf25dac22 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -72,10 +72,10 @@ void EnTuboTrap_Destroy(Actor* thisx, PlayState* play) { void EnTuboTrap_DropCollectible(EnTuboTrap* this, PlayState* play) { s16 params = this->actor.params; - s16 dropType = (params >> 6) & 0x3FF; + s16 dropType = PARAMS_GET_U(params, 6, 10); if (dropType >= 0 && dropType < ITEM00_MAX) { - Item_DropCollectible(play, &this->actor.world.pos, dropType | ((params & 0x3F) << 8)); + Item_DropCollectible(play, &this->actor.world.pos, dropType | (PARAMS_GET_U(params, 0, 6) << 8)); } } diff --git a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c index e4b89045db..5954f121d5 100644 --- a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c +++ b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c @@ -134,7 +134,7 @@ void EnVbBall_UpdateBones(EnVbBall* this, PlayState* play) { this->actor.velocity.x = sinf(angle) * 10.0f; this->actor.velocity.z = cosf(angle) * 10.0f; this->actor.velocity.y *= -0.5f; - if (this->actor.params & 1) { + if (PARAMS_GET_U(this->actor.params, 0, 1)) { Audio_PlaySfxGeneral(NA_SE_EN_VALVAISA_LAND, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index ef8df01190..077bc517c6 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -95,7 +95,7 @@ void EnViewer_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); EnViewer_SetupAction(this, EnViewer_InitImpl); sHorseSfxPlayed = false; - type = this->actor.params >> 8; + type = PARAMS_GET_NOMASK(this->actor.params, 8); this->unused = 0; this->state = 0; this->isVisible = false; @@ -114,7 +114,7 @@ void EnViewer_Destroy(Actor* thisx, PlayState* play) { void EnViewer_InitAnimGanondorfOrZelda(EnViewer* this, PlayState* play, void* skeletonHeaderSeg, AnimationHeader* anim) { - s16 type = this->actor.params >> 8; + s16 type = PARAMS_GET_NOMASK(this->actor.params, 8); if (type == ENVIEWER_TYPE_2_ZELDA || type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_5_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF || type == ENVIEWER_TYPE_9_GANONDORF) { @@ -142,7 +142,7 @@ void EnViewer_InitAnimHorse(EnViewer* this, PlayState* play, void* skeletonHeade u8 type; Skin_Init(play, &this->skin, skeletonHeaderSeg, anim); - type = this->actor.params >> 8; + type = PARAMS_GET_NOMASK(this->actor.params, 8); if (!(type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_4_HORSE_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF || type == ENVIEWER_TYPE_9_GANONDORF)) { @@ -166,7 +166,7 @@ static ActorShadowFunc sShadowDrawFuncs[] = { }; void EnViewer_InitImpl(EnViewer* this, PlayState* play) { - EnViewerInitData* initData = &sInitData[this->actor.params >> 8]; + EnViewerInitData* initData = &sInitData[PARAMS_GET_NOMASK(this->actor.params, 8)]; s32 skelObjectSlot = Object_GetSlot(&play->objectCtx, initData->skeletonObject); ASSERT(skelObjectSlot >= 0, "bank_ID >= 0", "../z_en_viewer.c", 576); @@ -194,7 +194,7 @@ void EnViewer_InitImpl(EnViewer* this, PlayState* play) { static s16 sTimer = 0; void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { - u8 type = this->actor.params >> 8; + u8 type = PARAMS_GET_NOMASK(this->actor.params, 8); u16 csCurFrame; s32 animationEnded; @@ -534,7 +534,7 @@ void EnViewer_DrawGanondorf(EnViewer* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1405); - type = this->actor.params >> 8; + type = PARAMS_GET_NOMASK(this->actor.params, 8); if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_5_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF) { @@ -704,7 +704,7 @@ void EnViewer_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1760); if (this->isVisible) { - type = this->actor.params >> 8; + type = PARAMS_GET_NOMASK(this->actor.params, 8); if (type <= ENVIEWER_TYPE_2_ZELDA) { // zelda's horse, impa and zelda if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.actorCues[0] != NULL) { Gfx_SetupDL_25Opa(play->state.gfxCtx); @@ -723,7 +723,7 @@ void EnViewer_UpdatePosition(EnViewer* this, PlayState* play) { Vec3f startPos; Vec3f endPos; f32 lerpFactor; - s16 type = this->actor.params >> 8; + s16 type = PARAMS_GET_NOMASK(this->actor.params, 8); if (type <= ENVIEWER_TYPE_2_ZELDA) { // zelda's horse, impa and zelda if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.actorCues[0] != NULL && @@ -872,7 +872,7 @@ void EnViewer_UpdateGanondorfCape(PlayState* play, EnViewer* this) { Vec3f forearmModelOffset; Vec3f forearmWorldOffset; - if ((this->actor.params >> 8) != ENVIEWER_TYPE_5_GANONDORF) { + if (PARAMS_GET_NOMASK(this->actor.params, 8) != ENVIEWER_TYPE_5_GANONDORF) { return; } diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.c b/src/overlays/actors/ovl_En_Vm/z_en_vm.c index 4ea733cc22..f03b0b3500 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -142,7 +142,7 @@ void EnVm_Init(Actor* thisx, PlayState* play) { Collider_SetQuad(play, &this->colliderQuad1, thisx, &sQuadInit1); Collider_InitQuad(play, &this->colliderQuad2); Collider_SetQuad(play, &this->colliderQuad2, thisx, &sQuadInit2); - this->beamSightRange = (thisx->params >> 8) * 40.0f; + this->beamSightRange = PARAMS_GET_NOMASK(thisx->params, 8) * 40.0f; thisx->params &= 0xFF; thisx->naviEnemyId = NAVI_ENEMY_BEAMOS; diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 9e56239051..ae4cc3f89e 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -124,8 +124,8 @@ void EnWallmas_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); - this->switchFlag = (u8)(thisx->params >> 0x8); - thisx->params &= 0xFF; + this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8); + thisx->params = PARAMS_GET_U(thisx->params, 0, 8); if (thisx->params == WMT_FLAG) { if (Flags_GetSwitch(play, this->switchFlag) != 0) { diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 18ae59f2b4..254d105224 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -55,7 +55,7 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_0; - switch (this->actor.params & 0xF) { + switch (PARAMS_GET_U(this->actor.params, 0, 4)) { case EN_WEATHER_TAG_TYPE_CLOUDY_MARKET: PRINTF("\n\n"); // "☆☆☆☆☆ (;o;) About ☆☆☆☆☆☆" diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index 15ba1fcbdf..ef24ceba45 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -220,7 +220,7 @@ void EnWf_Init(Actor* thisx, PlayState* play) { thisx->colChkInfo.health = 8; thisx->colChkInfo.cylRadius = 50; thisx->colChkInfo.cylHeight = 100; - this->switchFlag = (thisx->params >> 8) & 0xFF; + this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; this->eyeIndex = 0; this->unk_2F4 = 10.0f; // Set and not used diff --git a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c index 1bfad680c6..62ec08f937 100644 --- a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c +++ b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c @@ -124,9 +124,9 @@ void EnWonderItem_Init(Actor* thisx, PlayState* play) { PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 不思議不思議まか不思議 \t ☆☆☆☆☆ %x\n" VT_RST, this->actor.params); this->actor.flags &= ~ACTOR_FLAG_0; - this->wonderMode = (this->actor.params >> 0xB) & 0x1F; - this->itemDrop = (this->actor.params >> 6) & 0x1F; - this->switchFlag = this->actor.params & 0x3F; + this->wonderMode = PARAMS_GET_U(this->actor.params, 11, 5); + this->itemDrop = PARAMS_GET_U(this->actor.params, 6, 5); + this->switchFlag = PARAMS_GET_U(this->actor.params, 0, 6); if (this->switchFlag == 0x3F) { this->switchFlag = -1; } diff --git a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c index cb51d8868a..b51363b764 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c @@ -39,9 +39,9 @@ void EnWonderTalk_Init(Actor* thisx, PlayState* play) { // "Special conversation" PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 特殊会話くん ☆☆☆☆☆ %x\n" VT_RST, this->actor.params); - this->unk_150 = (this->actor.params >> 0xB) & 0x1F; - this->unk_152 = (this->actor.params >> 6) & 0x1F; - this->switchFlag = this->actor.params & 0x3F; + this->unk_150 = PARAMS_GET_U(this->actor.params, 11, 5); + this->unk_152 = PARAMS_GET_U(this->actor.params, 6, 5); + this->switchFlag = PARAMS_GET_U(this->actor.params, 0, 6); if (this->switchFlag == 0x3F) { this->switchFlag = -1; } diff --git a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c index 69117b0cbd..b03e704756 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c @@ -43,7 +43,7 @@ void EnWonderTalk2_Init(Actor* thisx, PlayState* play) { PRINTF("\n\n"); // "Transparent message" PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 透明メッセージ君 ☆☆☆☆☆ %x\n" VT_RST, this->actor.params); - this->baseMsgId = (this->actor.params >> 6) & 0xFF; + this->baseMsgId = PARAMS_GET_U(this->actor.params, 6, 8); if (this->actor.world.rot.z > 0) { s32 rangeIndex = 0; s16 rotZmod10 = this->actor.world.rot.z; @@ -73,8 +73,8 @@ void EnWonderTalk2_Init(Actor* thisx, PlayState* play) { } this->initPos = this->actor.world.pos; - this->switchFlag = (this->actor.params & 0x3F); - this->talkMode = ((this->actor.params >> 0xE) & 3); + this->switchFlag = PARAMS_GET_U(this->actor.params, 0, 6); + this->talkMode = PARAMS_GET_U(this->actor.params, 14, 2); if (this->switchFlag == 0x3F) { this->switchFlag = -1; diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index a5fe529ebd..df2da294b7 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -169,7 +169,7 @@ void EnWood02_Init(Actor* thisx, PlayState* play2) { spawnType = WOOD_SPAWN_NORMAL; actorScale = 1.0f; - this->unk_14C = (this->actor.params >> 8) & 0xFF; + this->unk_14C = PARAMS_GET_U(this->actor.params, 8, 8); if (this->actor.home.rot.z != 0) { this->actor.home.rot.z = (this->actor.home.rot.z << 8) | this->unk_14C; diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/src/overlays/actors/ovl_En_Zf/z_en_zf.c index f2aa8d29ab..3057fcb640 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -283,12 +283,12 @@ void EnZf_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(thisx, sInitChain); thisx->targetMode = 3; - this->clearFlag = (thisx->params & 0xFF00) >> 8; + this->clearFlag = PARAMS_GET_S(thisx->params, 8, 8); /* Strip the top byte of params */ thisx->params &= 0xFF; /* Return the params to their original value if they were originally negative, i.e. 0xFFFF or 0xFFFE */ - if (thisx->params & 0x80) { + if (PARAMS_GET_NOSHIFT(thisx->params, 7, 1)) { thisx->params |= 0xFF00; } diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index a4d62f84c4..52c65cbca6 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -726,21 +726,21 @@ void EnZl3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, } s32 func_80B54DB4(EnZl3* this) { - s32 params = this->actor.params >> 8; + s32 params = PARAMS_GET_U(this->actor.params, 8, 8); - return params & 0xFF; + return params; } s32 func_80B54DC4(EnZl3* this) { - s32 params = this->actor.params >> 4; + s32 params = PARAMS_GET_U(this->actor.params, 4, 4); - return params & 0xF; + return params; } s32 func_80B54DD4(EnZl3* this) { - s32 params = this->actor.params; + s32 params = PARAMS_GET_U(this->actor.params, 0, 4); - return params & 0xF; + return params; } void func_80B54DE0(EnZl3* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index ef37860e2a..eb90fce902 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -363,7 +363,7 @@ u16 EnZo_GetTextId(PlayState* play, Actor* thisx) { return textId; } - switch (thisx->params & 0x3F) { + switch (PARAMS_GET_U(thisx->params, 0, 6)) { case 8: if (GET_EVENTCHKINF(EVENTCHKINF_30)) { return 0x402A; @@ -581,7 +581,7 @@ void EnZo_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInit); - if (LINK_IS_ADULT && ((this->actor.params & 0x3F) == 8)) { + if (LINK_IS_ADULT && (PARAMS_GET_U(this->actor.params, 0, 6) == 8)) { Actor_Kill(&this->actor); return; } @@ -596,7 +596,7 @@ void EnZo_Init(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, this->collider.dim.height * 0.5f, this->collider.dim.radius, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - if (this->actor.depthInWater < 54.0f || (this->actor.params & 0x3F) == 8) { + if (this->actor.depthInWater < 54.0f || PARAMS_GET_U(this->actor.params, 0, 6) == 8) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->actor.shape.shadowScale = 24.0f; Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENZO_ANIM_1); diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index 3efe62cc24..83f282da0d 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -96,7 +96,7 @@ void ItemEtcetera_Init(Actor* thisx, PlayState* play) { s32 type; s32 objectSlot; - type = this->actor.params & 0xFF; + type = PARAMS_GET_U(this->actor.params, 0, 8); PRINTF("no = %d\n", type); objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[type]); PRINTF("bank_ID = %d\n", objectSlot); @@ -152,7 +152,7 @@ void ItemEtcetera_WaitForObject(ItemEtcetera* this, PlayState* play) { void func_80B85824(ItemEtcetera* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { - if ((this->actor.params & 0xFF) == 1) { + if (PARAMS_GET_U(this->actor.params, 0, 8) == 1) { SET_EVENTCHKINF(EVENTCHKINF_31); Flags_SetSwitch(play, 0xB); } @@ -164,7 +164,7 @@ void func_80B85824(ItemEtcetera* this, PlayState* play) { void func_80B858B4(ItemEtcetera* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { - if ((this->actor.params & 0xFF) == 1) { + if (PARAMS_GET_U(this->actor.params, 0, 8) == 1) { SET_EVENTCHKINF(EVENTCHKINF_31); Flags_SetSwitch(play, 0xB); } @@ -206,7 +206,7 @@ void ItemEtcetera_MoveFireArrowDown(ItemEtcetera* this, PlayState* play) { } void func_80B85B28(ItemEtcetera* this, PlayState* play) { - if (Flags_GetTreasure(play, (this->actor.params >> 8) & 0x1F)) { + if (Flags_GetTreasure(play, PARAMS_GET_U(this->actor.params, 8, 5))) { Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c index b93b680a2a..f621c3c831 100644 --- a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c +++ b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c @@ -38,7 +38,7 @@ void ItemInbox_Destroy(Actor* thisx, PlayState* play) { } void ItemInbox_Wait(ItemInbox* this, PlayState* play) { - if (Flags_GetTreasure(play, (this->actor.params >> 8) & 0x1F)) { + if (Flags_GetTreasure(play, PARAMS_GET_U(this->actor.params, 8, 5))) { Actor_Kill(&this->actor); } } @@ -54,5 +54,5 @@ void ItemInbox_Draw(Actor* thisx, PlayState* play) { func_8002EBCC(&this->actor, play, 0); func_8002ED80(&this->actor, play, 0); - GetItem_Draw(play, this->actor.params & 0xFF); + GetItem_Draw(play, PARAMS_GET_U(this->actor.params, 0, 8)); } diff --git a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c index b8365df41d..dbfbe678a9 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -136,7 +136,7 @@ void MirRay_MakeShieldLight(MirRay* this, PlayState* play) { player->actor.world.pos.y + 30.0f, player->actor.world.pos.z, this->sourceEndRad, this->poolEndRad)) { - if (dataEntry->params & 8) { // Light beams from mirrors + if (PARAMS_GET_NOSHIFT(dataEntry->params, 3, 1)) { // Light beams from mirrors Math_Vec3f_Diff(&player->actor.world.pos, &this->sourcePt, &reflectionPt); } else { // Light beams from windows Math_Vec3f_Diff(&this->poolPt, &this->sourcePt, &reflectionPt); @@ -207,10 +207,10 @@ void MirRay_Init(Actor* thisx, PlayState* play) { this->shieldCorners[5].x = 758.0f; this->shieldCorners[5].y = -800.0f; - if (dataEntry->params & 2) { + if (PARAMS_GET_NOSHIFT(dataEntry->params, 1, 1)) { Collider_InitJntSph(play, &this->colliderSph); Collider_SetJntSph(play, &this->colliderSph, &this->actor, &sJntSphInit, &this->colliderSphItem); - if (!(dataEntry->params & 4)) { // Beams not from mirrors + if (!PARAMS_GET_NOSHIFT(dataEntry->params, 2, 1)) { // Beams not from mirrors MirRay_SetupCollider(this); } } diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index 2e882d44c7..664b1a87fa 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -227,13 +227,13 @@ void ObjBean_SetDrawMode(ObjBean* this, u8 drawFlag) { } void ObjBean_SetupPathCount(ObjBean* this, PlayState* play) { - this->pathCount = play->pathList[(this->dyna.actor.params >> 8) & 0x1F].count - 1; + this->pathCount = play->pathList[PARAMS_GET_U(this->dyna.actor.params, 8, 5)].count - 1; this->currentPointIndex = 0; this->nextPointIndex = 1; } void ObjBean_SetupPath(ObjBean* this, PlayState* play) { - Path* path = &play->pathList[(this->dyna.actor.params >> 8) & 0x1F]; + Path* path = &play->pathList[PARAMS_GET_U(this->dyna.actor.params, 8, 5)]; Math_Vec3s_ToVec3f(&this->pathPoints, SEGMENTED_TO_VIRTUAL(path->points)); } @@ -245,7 +245,7 @@ void ObjBean_FollowPath(ObjBean* this, PlayState* play) { Vec3s* nextPathPoint; Math_StepToF(&this->dyna.actor.speed, sBeanSpeeds[this->unk_1F6].velocity, sBeanSpeeds[this->unk_1F6].accel); - path = &play->pathList[(this->dyna.actor.params >> 8) & 0x1F]; + path = &play->pathList[PARAMS_GET_U(this->dyna.actor.params, 8, 5)]; nextPathPoint = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->nextPointIndex]; Math_Vec3s_ToVec3f(&pathPointsFloat, nextPathPoint); @@ -469,8 +469,8 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); if (LINK_AGE_IN_YEARS == YEARS_ADULT) { - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || (OOT_DEBUG && mREG(1) == 1)) { - path = (this->dyna.actor.params >> 8) & 0x1F; + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)) || (OOT_DEBUG && mREG(1) == 1)) { + path = PARAMS_GET_U(this->dyna.actor.params, 8, 5); if (path == 0x1F) { PRINTF(VT_COL(RED, WHITE)); // "No path data?" @@ -504,7 +504,8 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->dyna.actor); return; } - } else if ((Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) != 0) || (OOT_DEBUG && mREG(1) == 1)) { + } else if ((Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)) != 0) || + (OOT_DEBUG && mREG(1) == 1)) { ObjBean_SetupWaitForWater(this); } else { ObjBean_SetupWaitForBean(this); @@ -538,7 +539,7 @@ void ObjBean_WaitForBean(ObjBean* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->dyna.actor, play)) { if (func_8002F368(play) == EXCH_ITEM_MAGIC_BEAN) { func_80B8FE00(this); - Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); } } else { Actor_OfferTalkExchangeEquiCylinder(&this->dyna.actor, play, 40.0f, EXCH_ITEM_MAGIC_BEAN); diff --git a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c index 615793c909..cb7cba62c0 100644 --- a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c +++ b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c @@ -50,8 +50,8 @@ void ObjBlockstop_Update(Actor* thisx, PlayState* play) { dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); if (dynaPolyActor != NULL && dynaPolyActor->actor.id == ACTOR_OBJ_OSHIHIKI) { - if ((dynaPolyActor->actor.params & 0x000F) == PUSHBLOCK_HUGE_START_ON || - (dynaPolyActor->actor.params & 0x000F) == PUSHBLOCK_HUGE_START_OFF) { + if (PARAMS_GET_U(dynaPolyActor->actor.params, 0, 4) == PUSHBLOCK_HUGE_START_ON || + PARAMS_GET_U(dynaPolyActor->actor.params, 0, 4) == PUSHBLOCK_HUGE_START_OFF) { Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); } else { Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c index d2e2aa5eb9..d728309122 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -74,7 +74,7 @@ void ObjBombiwa_InitCollision(Actor* thisx, PlayState* play) { void ObjBombiwa_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(thisx, sInitChain); ObjBombiwa_InitCollision(thisx, play); - if ((Flags_GetSwitch(play, thisx->params & 0x3F) != 0)) { + if ((Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6)) != 0)) { Actor_Kill(thisx); } else { CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); @@ -127,9 +127,9 @@ void ObjBombiwa_Update(Actor* thisx, PlayState* play) { if ((func_80033684(play, &this->actor) != NULL) || ((this->collider.base.acFlags & AC_HIT) && (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HAMMER))) { ObjBombiwa_Break(this, play); - Flags_SetSwitch(play, this->actor.params & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 0, 6)); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EV_WALL_BROKEN); - if (((this->actor.params >> 0xF) & 1) != 0) { + if (PARAMS_GET_U(this->actor.params, 15, 1) != 0) { Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); } Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index 37ed2432fe..3bf36e799d 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -128,14 +128,14 @@ void ObjComb_Break(ObjComb* this, PlayState* play) { } void ObjComb_ChooseItemDrop(ObjComb* this, PlayState* play) { - s16 params = this->actor.params & 0x1F; + s16 params = PARAMS_GET_U(this->actor.params, 0, 5); if ((params > 0) || (params < ITEM00_MAX)) { // conditional always true. May have been intended to be && if (params == ITEM00_HEART_PIECE) { - if (Flags_GetCollectible(play, (this->actor.params >> 8) & 0x3F)) { + if (Flags_GetCollectible(play, PARAMS_GET_U(this->actor.params, 8, 6))) { params = -1; } else { - params = (params | (((this->actor.params >> 8) & 0x3F) << 8)); + params = (params | (PARAMS_GET_U(this->actor.params, 8, 6) << 8)); } } else if (Rand_ZeroOne() < 0.5f) { params = -1; diff --git a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c index c1d6507abe..4377ac6e26 100644 --- a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c +++ b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c @@ -66,9 +66,9 @@ void ObjElevator_Init(Actor* thisx, PlayState* play) { f32 temp_f0; func_80B92B08(this, play, &object_d_elevator_Col_000360, DYNA_TRANSFORM_POS); - Actor_SetScale(thisx, sScales[thisx->params & 1]); + Actor_SetScale(thisx, sScales[PARAMS_GET_U(thisx->params, 0, 1)]); Actor_ProcessInitChain(thisx, sInitChain); - temp_f0 = (thisx->params >> 8) & 0xF; + temp_f0 = PARAMS_GET_U(thisx->params, 8, 4); this->unk_16C = temp_f0 + temp_f0; func_80B92C5C(this); PRINTF("(Dungeon Elevator)(arg_data 0x%04x)\n", thisx->params); @@ -91,7 +91,7 @@ void func_80B92C80(ObjElevator* this, PlayState* play) { if ((this->dyna.interactFlags & DYNA_INTERACT_PLAYER_ON_TOP) && !(this->unk_170 & DYNA_INTERACT_PLAYER_ON_TOP)) { sub = thisx->world.pos.y - thisx->home.pos.y; if (fabsf(sub) < 0.1f) { - this->unk_168 = thisx->home.pos.y + ((thisx->params >> 0xC) & 0xF) * 80.0f; + this->unk_168 = thisx->home.pos.y + (PARAMS_GET_U(thisx->params, 12, 4)) * 80.0f; } else { this->unk_168 = thisx->home.pos.y; } diff --git a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c index 245325d25d..8647a52fc1 100644 --- a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c +++ b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c @@ -149,7 +149,7 @@ void ObjHamishi_Init(Actor* thisx, PlayState* play) { ObjHamishi_InitCollision(&this->actor, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - if (Flags_GetSwitch(play, this->actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 0, 6))) { Actor_Kill(&this->actor); return; } @@ -180,7 +180,7 @@ void ObjHamishi_Update(Actor* thisx, PlayState* play) { } else { ObjHamishi_Break(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); - Flags_SetSwitch(play, this->actor.params & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 0, 6)); Actor_Kill(&this->actor); } } else { diff --git a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c index 1a55ca7406..0d7737401b 100644 --- a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c +++ b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c @@ -71,7 +71,7 @@ static InitChainEntry sInitChain[] = { void ObjHana_Init(Actor* thisx, PlayState* play) { ObjHana* this = (ObjHana*)thisx; - s16 type = this->actor.params & 3; + s16 type = PARAMS_GET_U(this->actor.params, 0, 2); HanaParams* params = &sHanaParams[type]; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -94,7 +94,7 @@ void ObjHana_Init(Actor* thisx, PlayState* play) { void ObjHana_Destroy(Actor* thisx, PlayState* play) { ObjHana* this = (ObjHana*)thisx; - if (sHanaParams[this->actor.params & 3].radius >= 0) { + if (sHanaParams[PARAMS_GET_U(this->actor.params, 0, 2)].radius >= 0) { Collider_DestroyCylinder(play, &this->collider); } } @@ -102,11 +102,11 @@ void ObjHana_Destroy(Actor* thisx, PlayState* play) { void ObjHana_Update(Actor* thisx, PlayState* play) { ObjHana* this = (ObjHana*)thisx; - if (sHanaParams[this->actor.params & 3].radius >= 0 && this->actor.xzDistToPlayer < 400.0f) { + if (sHanaParams[PARAMS_GET_U(this->actor.params, 0, 2)].radius >= 0 && this->actor.xzDistToPlayer < 400.0f) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } void ObjHana_Draw(Actor* thisx, PlayState* play) { - Gfx_DrawDListOpa(play, sHanaParams[thisx->params & 3].dList); + Gfx_DrawDListOpa(play, sHanaParams[PARAMS_GET_U(thisx->params, 0, 2)].dList); } diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index e7e37675a1..08cc347fd1 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -71,7 +71,7 @@ void func_80B93B68(ObjHsblock* this, PlayState* play, CollisionHeader* collision } void func_80B93BF0(ObjHsblock* this, PlayState* play) { - if ((this->dyna.actor.params >> 5) & 1) { + if (PARAMS_GET_U(this->dyna.actor.params, 5, 1)) { Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_OBJ_ICE_POLY, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, 1); @@ -81,17 +81,17 @@ void func_80B93BF0(ObjHsblock* this, PlayState* play) { void ObjHsblock_Init(Actor* thisx, PlayState* play) { ObjHsblock* this = (ObjHsblock*)thisx; - func_80B93B68(this, play, sCollisionHeaders[thisx->params & 3], 0); + func_80B93B68(this, play, sCollisionHeaders[PARAMS_GET_U(thisx->params, 0, 2)], 0); Actor_ProcessInitChain(thisx, sInitChain); func_80B93BF0(this, play); - switch (thisx->params & 3) { + switch (PARAMS_GET_U(thisx->params, 0, 2)) { case 0: case 2: func_80B93D90(this); break; case 1: - if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 8, 6))) { func_80B93D90(this); } else { func_80B93DB0(this); @@ -122,7 +122,7 @@ void func_80B93DB0(ObjHsblock* this) { } void func_80B93DF4(ObjHsblock* this, PlayState* play) { - if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) { func_80B93E38(this); } } @@ -147,7 +147,7 @@ void ObjHsblock_Update(Actor* thisx, PlayState* play) { if (this->actionFunc != NULL) { this->actionFunc(this, play); } - Actor_SetFocus(thisx, D_80B940C0[thisx->params & 3]); + Actor_SetFocus(thisx, D_80B940C0[PARAMS_GET_U(thisx->params, 0, 2)]); } void ObjHsblock_Draw(Actor* thisx, PlayState* play) { @@ -178,7 +178,7 @@ void ObjHsblock_Draw(Actor* thisx, PlayState* play) { } gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 255); - gSPDisplayList(POLY_OPA_DISP++, sDLists[thisx->params & 3]); + gSPDisplayList(POLY_OPA_DISP++, sDLists[PARAMS_GET_U(thisx->params, 0, 2)]); CLOSE_DISPS(play->state.gfxCtx, "../z_obj_hsblock.c", 399); } diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index 5aa41d15ec..ea3f8273b0 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -77,7 +77,7 @@ static Color_RGBA8 sColorGray = { 180, 180, 180, 255 }; void ObjIcePoly_Init(Actor* thisx, PlayState* play) { ObjIcePoly* this = (ObjIcePoly*)thisx; - this->unk_151 = (thisx->params >> 8) & 0xFF; + this->unk_151 = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; if (thisx->params < 0 || thisx->params >= 3) { Actor_Kill(thisx); diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index c6c503a806..dedcb559b3 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -66,9 +66,9 @@ static InitChainEntry sInitChain[] = { void ObjKibako_SpawnCollectible(ObjKibako* this, PlayState* play) { s16 collectible; - collectible = this->actor.params & 0x1F; + collectible = PARAMS_GET_U(this->actor.params, 0, 5); if ((collectible >= 0) && (collectible < ITEM00_MAX)) { - Item_DropCollectible(play, &this->actor.world.pos, collectible | (((this->actor.params >> 8) & 0x3F) << 8)); + Item_DropCollectible(play, &this->actor.world.pos, collectible | (PARAMS_GET_U(this->actor.params, 8, 6) << 8)); } } diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c index 231b504b0a..f1300c3c98 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c @@ -159,7 +159,7 @@ void ObjKibako2_Idle(ObjKibako2* this, PlayState* play) { void ObjKibako2_Kill(ObjKibako2* this, PlayState* play) { s16 params = this->dyna.actor.params; - if ((params & 0x8000) == 0) { + if (PARAMS_GET_NOSHIFT(params, 15, 1) == 0) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.shape.rot.y, 0, params | 0x8000); } diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index daa084ca09..23d798d6fe 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -100,9 +100,9 @@ void ObjLift_SpawnFragments(ObjLift* this, PlayState* play) { OBJECT_D_LIFT, gCollapsingPlatformDL); } - if (((this->dyna.actor.params >> 1) & 1) == 0) { + if (PARAMS_GET_U(this->dyna.actor.params, 1, 1) == 0) { func_80033480(play, &this->dyna.actor.world.pos, 120.0f, 12, 120, 100, 1); - } else if (((this->dyna.actor.params >> 1) & 1) == 1) { + } else if (PARAMS_GET_U(this->dyna.actor.params, 1, 1) == 1) { func_80033480(play, &this->dyna.actor.world.pos, 60.0f, 8, 60, 100, 1); } } @@ -112,12 +112,12 @@ void ObjLift_Init(Actor* thisx, PlayState* play) { ObjLift_InitDynaPoly(this, play, &gCollapsingPlatformCol, DYNA_TRANSFORM_POS); - if (Flags_GetSwitch(play, (this->dyna.actor.params >> 2) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 2, 6))) { Actor_Kill(&this->dyna.actor); return; } - Actor_SetScale(&this->dyna.actor, sScales[(this->dyna.actor.params >> 1) & 1]); + Actor_SetScale(&this->dyna.actor, sScales[PARAMS_GET_U(this->dyna.actor.params, 1, 1)]); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->shakeOrientation.x = Rand_ZeroOne() * 65535.5f; this->shakeOrientation.y = Rand_ZeroOne() * 65535.5f; @@ -133,7 +133,7 @@ void ObjLift_Destroy(Actor* thisx, PlayState* play) { } void ObjLift_SetupWait(ObjLift* this) { - this->timer = sFallTimerDurations[(this->dyna.actor.params >> 8) & 7]; + this->timer = sFallTimerDurations[PARAMS_GET_U(this->dyna.actor.params, 8, 3)]; ObjLift_SetupAction(this, ObjLift_Wait); } @@ -143,7 +143,7 @@ void ObjLift_Wait(ObjLift* this, PlayState* play) { if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { if (this->timer <= 0) { - if (((this->dyna.actor.params >> 8) & 7) == 7) { + if (PARAMS_GET_U(this->dyna.actor.params, 8, 3) == 7) { ObjLift_SetupFall(this); } else { quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1); @@ -154,7 +154,7 @@ void ObjLift_Wait(ObjLift* this, PlayState* play) { } } } else { - this->timer = sFallTimerDurations[(this->dyna.actor.params >> 8) & 7]; + this->timer = sFallTimerDurations[PARAMS_GET_U(this->dyna.actor.params, 8, 3)]; } } @@ -199,15 +199,15 @@ void ObjLift_Fall(ObjLift* this, PlayState* play) { Actor_MoveXZGravity(&this->dyna.actor); Math_Vec3f_Copy(&pos, &this->dyna.actor.prevPos); - pos.y += sMaxFallDistances[(this->dyna.actor.params >> 1) & 1]; + pos.y += sMaxFallDistances[PARAMS_GET_U(this->dyna.actor.params, 1, 1)]; this->dyna.actor.floorHeight = BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &pos); if ((this->dyna.actor.floorHeight - this->dyna.actor.world.pos.y) >= - (sMaxFallDistances[(this->dyna.actor.params >> 1) & 1] - 0.001f)) { + (sMaxFallDistances[PARAMS_GET_U(this->dyna.actor.params, 1, 1)] - 0.001f)) { ObjLift_SpawnFragments(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 20, NA_SE_EV_BOX_BREAK); - Flags_SetSwitch(play, (this->dyna.actor.params >> 2) & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 2, 6)); Actor_Kill(&this->dyna.actor); } } diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index 8a25bdef05..e3e63eb72e 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -104,10 +104,10 @@ void ObjLightswitch_SetSwitchFlag(ObjLightswitch* this, PlayState* play) { Actor* thisx = &this->actor; // required s32 type; - if (!Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) { - type = this->actor.params >> 4 & 3; + if (!Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { + type = PARAMS_GET_U(this->actor.params, 4, 2); - Flags_SetSwitch(play, this->actor.params >> 8 & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); if (type == OBJLIGHTSWITCH_TYPE_1) { OnePointCutscene_AttentionSetSfx(play, thisx, NA_SE_SY_TRE_BOX_APPEAR); @@ -120,10 +120,10 @@ void ObjLightswitch_SetSwitchFlag(ObjLightswitch* this, PlayState* play) { } void ObjLightswitch_ClearSwitchFlag(ObjLightswitch* this, PlayState* play) { - if (Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) { - Flags_UnsetSwitch(play, this->actor.params >> 8 & 0x3F); + if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { + Flags_UnsetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); - if ((this->actor.params >> 4 & 3) == OBJLIGHTSWITCH_TYPE_1) { + if (PARAMS_GET_U(this->actor.params, 4, 2) == OBJLIGHTSWITCH_TYPE_1) { OnePointCutscene_AttentionSetSfx(play, &this->actor, NA_SE_SY_TRE_BOX_APPEAR); } } @@ -161,13 +161,13 @@ void ObjLightswitch_SpawnDisappearEffects(ObjLightswitch* this, PlayState* play) void ObjLightswitch_Init(Actor* thisx, PlayState* play) { ObjLightswitch* this = (ObjLightswitch*)thisx; - s32 switchFlagSet = Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F); + s32 switchFlagSet = Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); s32 removeSelf = false; Actor_ProcessInitChain(&this->actor, sInitChain); Actor_SetFocus(&this->actor, 0.0f); if (switchFlagSet) { - if ((this->actor.params >> 4 & 3) == OBJLIGHTSWITCH_TYPE_BURN) { + if (PARAMS_GET_U(this->actor.params, 4, 2) == OBJLIGHTSWITCH_TYPE_BURN) { removeSelf = true; } else { ObjLightswitch_SetupOn(this); @@ -175,7 +175,7 @@ void ObjLightswitch_Init(Actor* thisx, PlayState* play) { } else { ObjLightswitch_SetupOff(this); } - if ((this->actor.params & 1) == 1) { + if (PARAMS_GET_U(this->actor.params, 0, 1) == 1) { if (switchFlagSet) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80B97F68); Math_Vec3f_Copy(&this->actor.home.pos, &D_80B97F68); @@ -221,7 +221,7 @@ void ObjLightswitch_SetupOff(ObjLightswitch* this) { } void ObjLightswitch_Off(ObjLightswitch* this, PlayState* play) { - switch (this->actor.params >> 4 & 3) { + switch (PARAMS_GET_U(this->actor.params, 4, 2)) { case OBJLIGHTSWITCH_TYPE_STAY_ON: case OBJLIGHTSWITCH_TYPE_2: if (this->collider.base.acFlags & AC_HIT) { @@ -288,9 +288,9 @@ void ObjLightswitch_SetupOn(ObjLightswitch* this) { } void ObjLightswitch_On(ObjLightswitch* this, PlayState* play) { - switch (this->actor.params >> 4 & 3) { + switch (PARAMS_GET_U(this->actor.params, 4, 2)) { case OBJLIGHTSWITCH_TYPE_STAY_ON: - if (!Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) { + if (!Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { ObjLightswitch_SetupTurnOff(this); } break; @@ -324,7 +324,7 @@ void ObjLightswitch_SetupTurnOff(ObjLightswitch* this) { } void ObjLightswitch_TurnOff(ObjLightswitch* this, PlayState* play) { - if ((this->actor.params >> 4 & 3) != OBJLIGHTSWITCH_TYPE_1 || func_8005B198() == this->actor.category || + if (PARAMS_GET_U(this->actor.params, 4, 2) != OBJLIGHTSWITCH_TYPE_1 || func_8005B198() == this->actor.category || this->toggleDelay <= 0) { this->timer--; @@ -378,7 +378,7 @@ void ObjLightswitch_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); if (this->actor.update != NULL) { - if ((this->actor.params & 1) == 1) { + if (PARAMS_GET_U(this->actor.params, 0, 1) == 1) { this->actor.world.pos.x = this->actor.child->world.pos.x; this->actor.world.pos.y = this->actor.child->world.pos.y + 60.0f; this->actor.world.pos.z = this->actor.child->world.pos.z; @@ -404,7 +404,7 @@ void ObjLightswitch_DrawOpa(Actor* thisx, PlayState* play) { (u8)(this->alpha >> 6)); gSPSegment(POLY_OPA_DISP++, 0x09, &D_80116280[2]); - if ((thisx->params & 1) == 1) { + if (PARAMS_GET_U(thisx->params, 0, 1) == 1) { thisx->world.pos.x = thisx->child->world.pos.x; thisx->world.pos.y = thisx->child->world.pos.y + 60.0f; thisx->world.pos.z = thisx->child->world.pos.z; @@ -486,11 +486,11 @@ void ObjLightswitch_Draw(Actor* thisx, PlayState* play) { ObjLightswitch* this = (ObjLightswitch*)thisx; s32 alpha = this->alpha >> 6 & 0xFF; - if ((this->actor.params & 1) == 1) { + if (PARAMS_GET_U(this->actor.params, 0, 1) == 1) { Collider_UpdateSpheres(0, &this->collider); } - if ((this->actor.params >> 4 & 3) == OBJLIGHTSWITCH_TYPE_BURN && (alpha > 0 || alpha < 255)) { + if (PARAMS_GET_U(this->actor.params, 4, 2) == OBJLIGHTSWITCH_TYPE_BURN && (alpha > 0 || alpha < 255)) { ObjLightswitch_DrawXlu(thisx, play); } else { ObjLightswitch_DrawOpa(thisx, play); diff --git a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index aebbdc3d28..86db9ebfe6 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -30,7 +30,7 @@ ActorProfile Obj_Makekinsuta_Profile = { void ObjMakekinsuta_Init(Actor* thisx, PlayState* play) { ObjMakekinsuta* this = (ObjMakekinsuta*)thisx; - if ((this->actor.params & 0x6000) == 0x4000) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 13, 2) == 0x4000) { PRINTF(VT_FGCOL(BLUE)); // "Gold Star Enemy(arg_data %x)" PRINTF("金スタ発生敵(arg_data %x)\n", this->actor.params); diff --git a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c index 34ca887b50..eeaf2bdd60 100644 --- a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c +++ b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c @@ -59,9 +59,9 @@ void ObjMakeoshihiki_Init(Actor* thisx, PlayState* play) { s32 typeIdx; Vec3f* spawnPos; - if (!((thisx->params >> 6) & 1) && Flags_GetSwitch(play, thisx->params & 0x3F)) { + if (!PARAMS_GET_U(thisx->params, 6, 1) && Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) { typeIdx = 1; - } else if (!((thisx->params >> 0xE) & 1) && Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { + } else if (!PARAMS_GET_U(thisx->params, 14, 1) && Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 8, 6))) { typeIdx = 2; } else { typeIdx = 0; @@ -96,10 +96,10 @@ void ObjMakeoshihiki_Draw(Actor* thisx, PlayState* play) { for (i = 0; i < 3; i++) { if (Math3D_Vec3fDistSq(&thisx->child->world.pos, &block->posVecs[i]) < 0.001f) { if (block->unk_24[i] & 1) { - if ((thisx->params >> 6) & 1) { + if (PARAMS_GET_U(thisx->params, 6, 1)) { sfxCond1 = false; } else { - if (Flags_GetSwitch(play, thisx->params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) { cond = true; } else { cond = false; @@ -107,10 +107,10 @@ void ObjMakeoshihiki_Draw(Actor* thisx, PlayState* play) { sfxCond1 = sFlags[i][0] ^ cond; } - if ((thisx->params >> 0xE) & 1) { + if (PARAMS_GET_U(thisx->params, 14, 1)) { sfxCond2 = false; } else { - if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 8, 6))) { cond2 = true; } else { cond2 = false; @@ -123,8 +123,8 @@ void ObjMakeoshihiki_Draw(Actor* thisx, PlayState* play) { } } - sFlagSwitchFuncs[sFlags[i][0]](play, thisx->params & 0x3F); - sFlagSwitchFuncs[sFlags[i][1]](play, (thisx->params >> 8) & 0x3F); + sFlagSwitchFuncs[sFlags[i][0]](play, PARAMS_GET_U(thisx->params, 0, 6)); + sFlagSwitchFuncs[sFlags[i][1]](play, PARAMS_GET_U(thisx->params, 8, 6)); if (block->unk_24[i] & 2) { ((ObjOshihiki*)thisx->child)->cantMove = true; diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index e76e2ecc84..d41108174a 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -89,10 +89,10 @@ s32 ObjMure_SetCulling(Actor* thisx, PlayState* play) { void ObjMure_Init(Actor* thisx, PlayState* play) { ObjMure* this = (ObjMure*)thisx; - this->chNum = (thisx->params >> 0xC) & 0x0F; - this->ptn = (thisx->params >> 8) & 0x07; - this->svNum = (thisx->params >> 5) & 0x03; - this->type = thisx->params & 0x1F; + this->chNum = PARAMS_GET_U(thisx->params, 12, 4); + this->ptn = PARAMS_GET_U(thisx->params, 8, 3); + this->svNum = PARAMS_GET_U(thisx->params, 5, 2); + this->type = PARAMS_GET_U(thisx->params, 0, 5); if (this->ptn >= 4) { PRINTF("Error 群れな敵 (%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 237, thisx->params); diff --git a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c index f9cf6799ca..7539520b3d 100644 --- a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c +++ b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c @@ -52,7 +52,7 @@ void ObjMure2_SetPosShrubCircle(Vec3f* vec, ObjMure2* this) { s32 i; Math_Vec3f_Copy(vec, &this->actor.world.pos); - for (i = 1; i < D_80B9A818[this->actor.params & 3]; i++) { + for (i = 1; i < D_80B9A818[PARAMS_GET_U(this->actor.params, 0, 2)]; i++) { Math_Vec3f_Copy(vec + i, &this->actor.world.pos); (vec + i)->x += (80.0f * Math_SinS((i - 1) * 0x2000)); (vec + i)->z += (80.0f * Math_CosS((i - 1) * 0x2000)); @@ -67,7 +67,7 @@ static Mure2sScatteredShrubInfo sScatteredShrubInfo[] = { void ObjMure2_SetPosShrubScattered(Vec3f* vec, ObjMure2* this) { s32 i; - for (i = 0; i < D_80B9A818[this->actor.params & 3]; i++) { + for (i = 0; i < D_80B9A818[PARAMS_GET_U(this->actor.params, 0, 2)]; i++) { Math_Vec3f_Copy(vec + i, &this->actor.world.pos); (vec + i)->x += (sScatteredShrubInfo[i].radius * Math_CosS(sScatteredShrubInfo[i].angle)); (vec + i)->z -= (sScatteredShrubInfo[i].radius * Math_SinS(sScatteredShrubInfo[i].angle)); @@ -77,7 +77,7 @@ void ObjMure2_SetPosShrubScattered(Vec3f* vec, ObjMure2* this) { void ObjMure2_SetPosRockCircle(Vec3f* vec, ObjMure2* this) { s32 i; - for (i = 0; i < D_80B9A818[this->actor.params & 3]; i++) { + for (i = 0; i < D_80B9A818[PARAMS_GET_U(this->actor.params, 0, 2)]; i++) { Math_Vec3f_Copy(vec + i, &this->actor.world.pos); (vec + i)->x += (80.0f * Math_SinS(i * 0x2000)); (vec + i)->z += (80.0f * Math_CosS(i * 0x2000)); @@ -86,12 +86,12 @@ void ObjMure2_SetPosRockCircle(Vec3f* vec, ObjMure2* this) { void ObjMure2_SetActorSpawnParams(s16* params, ObjMure2* this) { static s16 actorSpawnParams[] = { 0, 0, 0 }; - s16 dropTable = (this->actor.params >> 8) & 0xF; + s16 dropTable = PARAMS_GET_U(this->actor.params, 8, 4); if (dropTable >= 13) { dropTable = 0; } - *params = actorSpawnParams[this->actor.params & 3] & 0xF0FF; + *params = actorSpawnParams[PARAMS_GET_U(this->actor.params, 0, 2)] & 0xF0FF; *params |= (dropTable << 8); } @@ -101,7 +101,7 @@ void ObjMure2_SpawnActors(ObjMure2* this, PlayState* play) { ObjMure2_SetPosShrubScattered, ObjMure2_SetPosRockCircle, }; - s32 actorNum = this->actor.params & 3; + s32 actorNum = PARAMS_GET_U(this->actor.params, 0, 2); s32 i; Vec3f spawnPos[12]; s16 params; @@ -130,7 +130,7 @@ void ObjMure2_SpawnActors(ObjMure2* this, PlayState* play) { void ObjMure2_CleanupAndDie(ObjMure2* this, PlayState* play) { s32 i; - for (i = 0; i < D_80B9A818[this->actor.params & 3]; i++) { + for (i = 0; i < D_80B9A818[PARAMS_GET_U(this->actor.params, 0, 2)]; i++) { if (((this->currentActorNum >> i) & 1) == 0) { if (this->actorSpawnPtrList[i] != NULL) { if (Actor_HasParent(this->actorSpawnPtrList[i], play)) { @@ -149,7 +149,7 @@ void ObjMure2_CleanupAndDie(ObjMure2* this, PlayState* play) { void func_80B9A534(ObjMure2* this) { s32 i; - for (i = 0; i < D_80B9A818[this->actor.params & 3]; i++) { + for (i = 0; i < D_80B9A818[PARAMS_GET_U(this->actor.params, 0, 2)]; i++) { if (this->actorSpawnPtrList[i] != NULL && (((this->currentActorNum >> i) & 1) == 0) && (this->actorSpawnPtrList[i]->update == NULL)) { this->currentActorNum |= (1 << i); @@ -188,7 +188,7 @@ void func_80B9A658(ObjMure2* this) { void func_80B9A668(ObjMure2* this, PlayState* play) { if (Math3D_Dist1DSq(this->actor.projectedPos.x, this->actor.projectedPos.z) < - (sDistSquared1[this->actor.params & 3] * this->unk_184)) { + (sDistSquared1[PARAMS_GET_U(this->actor.params, 0, 2)] * this->unk_184)) { this->actor.flags |= ACTOR_FLAG_4; ObjMure2_SpawnActors(this, play); func_80B9A6E8(this); @@ -201,7 +201,7 @@ void func_80B9A6E8(ObjMure2* this) { void func_80B9A6F8(ObjMure2* this, PlayState* play) { func_80B9A534(this); - if ((sDistSquared2[this->actor.params & 3] * this->unk_184) <= + if ((sDistSquared2[PARAMS_GET_U(this->actor.params, 0, 2)] * this->unk_184) <= Math3D_Dist1DSq(this->actor.projectedPos.x, this->actor.projectedPos.z)) { this->actor.flags &= ~ACTOR_FLAG_4; ObjMure2_CleanupAndDie(this, play); diff --git a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c index ad4801d1f2..1ed11535ca 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c @@ -104,7 +104,7 @@ void func_80B9ABA0(ObjMure3* this, PlayState* play) { } void func_80B9ACE4(ObjMure3* this, PlayState* play) { - s16 count = sRupeeCounts[(this->actor.params >> 13) & 7]; + s16 count = sRupeeCounts[PARAMS_GET_U(this->actor.params, 13, 3)]; s32 i; EnItem00** collectible; @@ -123,7 +123,7 @@ void func_80B9ACE4(ObjMure3* this, PlayState* play) { } void func_80B9ADCC(ObjMure3* this, PlayState* play) { - s16 count = sRupeeCounts[(this->actor.params >> 13) & 7]; + s16 count = sRupeeCounts[PARAMS_GET_U(this->actor.params, 13, 3)]; s32 i; for (i = 0; i < count; i++) { @@ -131,7 +131,7 @@ void func_80B9ADCC(ObjMure3* this, PlayState* play) { if ((*collectible != NULL) && !((this->unk_16C >> i) & 1)) { if (Actor_HasParent(&(*collectible)->actor, play)) { - Flags_SetSwitch(play, this->actor.params & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 0, 6)); } if ((*collectible)->actor.update == NULL) { this->unk_16C |= (1 << i); @@ -145,7 +145,7 @@ void ObjMure3_Init(Actor* thisx, PlayState* play) { s32 pad; ObjMure3* this = (ObjMure3*)thisx; - if (Flags_GetSwitch(play, this->actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 0, 6))) { Actor_Kill(&this->actor); return; } @@ -173,7 +173,7 @@ void func_80B9AF64(ObjMure3* this, PlayState* play) { if (Math3D_Dist1DSq(this->actor.projectedPos.x, this->actor.projectedPos.z) < SQ(1150.0f)) { this->actor.flags |= ACTOR_FLAG_4; - spawnFuncs[(this->actor.params >> 13) & 7](this, play); + spawnFuncs[PARAMS_GET_U(this->actor.params, 13, 3)](this, play); func_80B9AFEC(this); } } diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index d6e825e902..9bd23876e5 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -116,7 +116,7 @@ s32 ObjOshihiki_StrongEnough(ObjOshihiki* this) { return 0; } strength = Player_GetStrength(); - switch (this->dyna.actor.params & 0xF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 4)) { case PUSHBLOCK_SMALL_START_ON: case PUSHBLOCK_MEDIUM_START_ON: case PUSHBLOCK_SMALL_START_OFF: @@ -183,16 +183,16 @@ s32 ObjOshihiki_NoSwitchPress(ObjOshihiki* this, DynaPolyActor* dyna, PlayState* if (dyna == NULL) { return 1; } else if (dyna->actor.id == ACTOR_OBJ_SWITCH) { - dynaSwitchFlag = (dyna->actor.params >> 8) & 0x3F; - switch (dyna->actor.params & 0x33) { - case 0x20: // Normal blue switch - if ((dynaSwitchFlag == ((this->dyna.actor.params >> 8) & 0x3F)) && + dynaSwitchFlag = PARAMS_GET_U(dyna->actor.params, 8, 6); + switch (dyna->actor.params & 0x33) { // Does not fit any standard params getter macro + case 0x20: // Normal blue switch + if ((dynaSwitchFlag == PARAMS_GET_U(this->dyna.actor.params, 8, 6)) && Flags_GetSwitch(play, dynaSwitchFlag)) { return 0; } break; case 0x30: // Inverse blue switch - if ((dynaSwitchFlag == ((this->dyna.actor.params >> 8) & 0x3F)) && + if ((dynaSwitchFlag == PARAMS_GET_U(this->dyna.actor.params, 8, 6)) && !Flags_GetSwitch(play, dynaSwitchFlag)) { return 0; } @@ -203,7 +203,7 @@ s32 ObjOshihiki_NoSwitchPress(ObjOshihiki* this, DynaPolyActor* dyna, PlayState* } void ObjOshihiki_CheckType(ObjOshihiki* this, PlayState* play) { - switch (this->dyna.actor.params & 0xF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 4)) { case PUSHBLOCK_SMALL_START_ON: case PUSHBLOCK_MEDIUM_START_ON: case PUSHBLOCK_LARGE_START_ON: @@ -223,11 +223,11 @@ void ObjOshihiki_CheckType(ObjOshihiki* this, PlayState* play) { } void ObjOshihiki_SetScale(ObjOshihiki* this, PlayState* play) { - Actor_SetScale(&this->dyna.actor, sScales[this->dyna.actor.params & 0xF]); + Actor_SetScale(&this->dyna.actor, sScales[PARAMS_GET_U(this->dyna.actor.params, 0, 4)]); } void ObjOshihiki_SetTexture(ObjOshihiki* this, PlayState* play) { - switch (this->dyna.actor.params & 0xF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 4)) { case PUSHBLOCK_SMALL_START_ON: case PUSHBLOCK_MEDIUM_START_ON: case PUSHBLOCK_SMALL_START_OFF: @@ -247,7 +247,7 @@ void ObjOshihiki_SetTexture(ObjOshihiki* this, PlayState* play) { void ObjOshihiki_SetColor(ObjOshihiki* this, PlayState* play2) { PlayState* play = play2; - s16 paramsColorIdx = (this->dyna.actor.params >> 6) & 3; + s16 paramsColorIdx = PARAMS_GET_U(this->dyna.actor.params, 6, 2); Color_RGB8* color = &this->color; Color_RGB8* src; s32 i; @@ -276,9 +276,9 @@ void ObjOshihiki_Init(Actor* thisx, PlayState* play2) { ObjOshihiki_CheckType(this, play); - if ((((this->dyna.actor.params >> 8) & 0xFF) >= 0) && (((this->dyna.actor.params >> 8) & 0xFF) <= 0x3F)) { - if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { - switch (this->dyna.actor.params & 0xF) { + if ((PARAMS_GET_U(this->dyna.actor.params, 8, 8) >= 0) && (PARAMS_GET_U(this->dyna.actor.params, 8, 8) <= 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 4)) { case PUSHBLOCK_SMALL_START_ON: case PUSHBLOCK_MEDIUM_START_ON: case PUSHBLOCK_LARGE_START_ON: @@ -287,7 +287,7 @@ void ObjOshihiki_Init(Actor* thisx, PlayState* play2) { return; } } else { - switch (this->dyna.actor.params & 0xF) { + switch (PARAMS_GET_U(this->dyna.actor.params, 0, 4)) { case PUSHBLOCK_SMALL_START_OFF: case PUSHBLOCK_MEDIUM_START_OFF: case PUSHBLOCK_LARGE_START_OFF: diff --git a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c index 3b33a5ac99..5648c809ca 100644 --- a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c +++ b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c @@ -29,18 +29,12 @@ ActorProfile Obj_Roomtimer_Profile = { void ObjRoomtimer_Init(Actor* thisx, PlayState* play) { ObjRoomtimer* this = (ObjRoomtimer*)thisx; - s16 params = this->actor.params; - this->switchFlag = (params >> 10) & 0x3F; - this->actor.params = params & 0x3FF; - params = this->actor.params; + this->switchFlag = PARAMS_GET_U(this->actor.params, 10, 6); + this->actor.params = PARAMS_GET_U(this->actor.params, 0, 10); - if (params != 0x3FF) { - if (params > 600) { - this->actor.params = 600; - } else { - this->actor.params = params; - } + if (this->actor.params != 0x3FF) { + this->actor.params = CLAMP_MAX(this->actor.params, 600); } this->actionFunc = func_80B9D054; diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index 9a43f8a7da..f3f4799a31 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -10,10 +10,11 @@ #define FLAGS ACTOR_FLAG_4 -#define OBJSWITCH_TYPE(thisx) ((thisx)->params & 7) -#define OBJSWITCH_SUBTYPE(thisx) (((thisx)->params >> 4) & 7) -#define OBJSWITCH_SWITCH_FLAG(thisx) (((thisx)->params >> 8) & 0x3F) -#define OBJSWITCH_FROZEN(thisx) (((thisx)->params >> 7) & 1) +#define OBJSWITCH_TYPE(thisx) PARAMS_GET_U((thisx)->params, 0, 3) +#define OBJSWITCH_SUBTYPE(thisx) PARAMS_GET_U((thisx)->params, 4, 3) +#define OBJSWITCH_SWITCH_FLAG(thisx) PARAMS_GET_U((thisx)->params, 8, 6) +#define OBJSWITCH_FROZEN(thisx) PARAMS_GET_U((thisx)->params, 7, 1) + #define OBJSWITCH_FROZEN_FLAG (1 << 7) void ObjSwitch_Init(Actor* thisx, PlayState* play); @@ -290,11 +291,8 @@ void ObjSwitch_UpdateTwoTexScrollXY(ObjSwitch* this) { void ObjSwitch_Init(Actor* thisx, PlayState* play) { ObjSwitch* this = (ObjSwitch*)thisx; - s32 isSwitchFlagSet; - s32 type; - - isSwitchFlagSet = Flags_GetSwitch(play, OBJSWITCH_SWITCH_FLAG(&this->dyna.actor)); - type = OBJSWITCH_TYPE(&this->dyna.actor); + s32 isSwitchFlagSet = Flags_GetSwitch(play, OBJSWITCH_SWITCH_FLAG(&this->dyna.actor)); + s32 type = OBJSWITCH_TYPE(&this->dyna.actor); if (type == OBJSWITCH_TYPE_FLOOR || type == OBJSWITCH_TYPE_FLOOR_RUSTY) { ObjSwitch_InitDynaPoly(this, play, &gFloorSwitchCol, DYNA_TRANSFORM_POS); @@ -798,9 +796,8 @@ void ObjSwitch_DrawCrystal(Actor* thisx, PlayState* play) { }; ObjSwitch* this = (ObjSwitch*)thisx; s32 pad; - s32 subType; + s32 subType = OBJSWITCH_SUBTYPE(&this->dyna.actor); - subType = OBJSWITCH_SUBTYPE(&this->dyna.actor); func_8002ED80(&this->dyna.actor, play, 0); OPEN_DISPS(play->state.gfxCtx, "../z_obj_switch.c", 1494); diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index 81b969a328..5450d8650d 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -81,14 +81,14 @@ void ObjSyokudai_Init(Actor* thisx, PlayState* play) { static u8 sColTypesStand[] = { 0x09, 0x0B, 0x0B }; s32 pad; ObjSyokudai* this = (ObjSyokudai*)thisx; - s32 torchType = this->actor.params & 0xF000; + s32 torchType = PARAMS_GET_NOSHIFT(this->actor.params, 12, 4); Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); Collider_InitCylinder(play, &this->colliderStand); Collider_SetCylinder(play, &this->colliderStand, &this->actor, &sCylInitStand); - this->colliderStand.base.colType = sColTypesStand[this->actor.params >> 0xC]; + this->colliderStand.base.colType = sColTypesStand[PARAMS_GET_NOMASK(this->actor.params, 12)]; Collider_InitCylinder(play, &this->colliderFlame); Collider_SetCylinder(play, &this->colliderFlame, &this->actor, &sCylInitFlame); @@ -99,7 +99,8 @@ void ObjSyokudai_Init(Actor* thisx, PlayState* play) { this->actor.world.pos.z, 255, 255, 180, -1); this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); - if ((this->actor.params & 0x400) || ((torchType != 2) && Flags_GetSwitch(play, this->actor.params & 0x3F))) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 10, 1) || + ((torchType != 2) && Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 0, 6)))) { this->litTimer = -1; } @@ -120,9 +121,9 @@ void ObjSyokudai_Destroy(Actor* thisx, PlayState* play) { void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; ObjSyokudai* this = (ObjSyokudai*)thisx; - s32 torchCount = (this->actor.params >> 6) & 0xF; - s32 switchFlag = this->actor.params & 0x3F; - s32 torchType = this->actor.params & 0xF000; + s32 torchCount = PARAMS_GET_U(this->actor.params, 6, 4); + s32 switchFlag = PARAMS_GET_U(this->actor.params, 0, 6); + s32 torchType = PARAMS_GET_NOSHIFT(this->actor.params, 12, 4); s32 litTimeScale; WaterBox* dummy; f32 waterSurface; @@ -153,7 +154,7 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { } else { player = GET_PLAYER(play); interactionType = 0; - if (this->actor.params & 0x400) { + if (PARAMS_GET_NOSHIFT(this->actor.params, 10, 1)) { this->litTimer = -1; } if (torchCount != 0) { @@ -263,7 +264,7 @@ void ObjSyokudai_Draw(Actor* thisx, PlayState* play) { ObjSyokudai* this = (ObjSyokudai*)thisx; s32 timerMax; - timerMax = (((this->actor.params >> 6) & 0xF) * 50) + 100; + timerMax = PARAMS_GET_U(this->actor.params, 6, 4) * 50 + 100; OPEN_DISPS(play->state.gfxCtx, "../z_obj_syokudai.c", 707); Gfx_SetupDL_25Opa(play->state.gfxCtx); @@ -271,7 +272,7 @@ void ObjSyokudai_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_obj_syokudai.c", 714), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, displayLists[(u16)this->actor.params >> 0xC]); + gSPDisplayList(POLY_OPA_DISP++, displayLists[PARAMS_GET_NOMASK((u16)this->actor.params, 12)]); if (this->litTimer != 0) { f32 flameScale = 1.0f; diff --git a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c index 8bbde05692..dcd27116c1 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -63,11 +63,11 @@ static Color_RGB8 sPrimColors[] = { }; u32 ObjTimeblock_CalculateIsVisible(ObjTimeblock* this) { - if (!((this->dyna.actor.params >> 10) & 1)) { + if (!PARAMS_GET_U(this->dyna.actor.params, 10, 1)) { if (this->unk_177 == 0) { return this->unk_175; } else { - u8 temp = ((this->dyna.actor.params >> 15) & 1) ? true : false; + u8 temp = PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? true : false; if (this->unk_177 == 1) { return this->unk_174 ^ temp; @@ -78,14 +78,14 @@ u32 ObjTimeblock_CalculateIsVisible(ObjTimeblock* this) { } } } else { - return (((this->dyna.actor.params >> 15) & 1) ? true : false) ^ this->unk_174; + return (PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? true : false) ^ this->unk_174; } } void ObjTimeblock_SpawnDemoEffect(ObjTimeblock* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 0, - sSizeOptions[(this->dyna.actor.params >> 8) & 1].demoEffectParams); + sSizeOptions[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].demoEffectParams); } void ObjTimeblock_ToggleSwitchFlag(PlayState* play, s32 flag) { @@ -109,23 +109,23 @@ void ObjTimeblock_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - Actor_SetScale(&this->dyna.actor, sSizeOptions[(this->dyna.actor.params >> 8) & 1].scale); + Actor_SetScale(&this->dyna.actor, sSizeOptions[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].scale); - if ((this->dyna.actor.params >> 6) & 1) { + if (PARAMS_GET_U(this->dyna.actor.params, 6, 1)) { this->unk_177 = 0; } else { - this->unk_177 = ((this->dyna.actor.params & 0x3F) < 0x38) ? 2 : 1; + this->unk_177 = (PARAMS_GET_U(this->dyna.actor.params, 0, 6) < 0x38) ? 2 : 1; } this->songObserverFunc = ObjTimeblock_WaitForOcarina; - Actor_SetFocus(&this->dyna.actor, sSizeOptions[(this->dyna.actor.params >> 8) & 1].height); + Actor_SetFocus(&this->dyna.actor, sSizeOptions[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].height); - this->unk_174 = (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) ? true : false; - this->unk_175 = ((this->dyna.actor.params >> 15) & 1) ? true : false; + this->unk_174 = (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) ? true : false; + this->unk_175 = PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? true : false; this->isVisible = ObjTimeblock_CalculateIsVisible(this); - if (!((this->dyna.actor.params >> 10) & 1)) { + if (!PARAMS_GET_U(this->dyna.actor.params, 10, 1)) { ObjTimeblock_SetupNormal(this); } else if (this->isVisible) { ObjTimeblock_SetupAltBehaviorVisible(this); @@ -135,8 +135,8 @@ void ObjTimeblock_Init(Actor* thisx, PlayState* play) { // "Block of time" PRINTF("時のブロック ( %04xH save:%d color:%d range:%d move:%d)\n", (u16)this->dyna.actor.params, - this->unk_177, this->dyna.actor.home.rot.z & 7, (this->dyna.actor.params >> 11) & 7, - (this->dyna.actor.params >> 10) & 1); + this->unk_177, this->dyna.actor.home.rot.z & 7, PARAMS_GET_U(this->dyna.actor.params, 11, 3), + PARAMS_GET_U(this->dyna.actor.params, 10, 1)); } void ObjTimeblock_Destroy(Actor* thisx, PlayState* play) { @@ -151,7 +151,7 @@ u8 ObjTimeblock_PlayerIsInRange(ObjTimeblock* this, PlayState* play) { return false; } - if (this->dyna.actor.xzDistToPlayer <= sRanges[(this->dyna.actor.params >> 11) & 7]) { + if (this->dyna.actor.xzDistToPlayer <= sRanges[PARAMS_GET_U(this->dyna.actor.params, 11, 3)]) { Vec3f playerRelativePos; f32 blockSize; @@ -225,7 +225,7 @@ void ObjTimeblock_Normal(ObjTimeblock* this, PlayState* play) { if (this->unk_177 == 0) { this->dyna.actor.params ^= 0x8000; } else { - ObjTimeblock_ToggleSwitchFlag(play, this->dyna.actor.params & 0x3F); + ObjTimeblock_ToggleSwitchFlag(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); } } @@ -234,9 +234,9 @@ void ObjTimeblock_Normal(ObjTimeblock* this, PlayState* play) { this->demoEffectFirstPartTimer--; if (this->demoEffectFirstPartTimer == 0) { if (this->unk_177 == 0) { - this->unk_175 = ((this->dyna.actor.params >> 15) & 1) ? true : false; + this->unk_175 = PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? true : false; } else { - this->unk_174 = (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) ? true : false; + this->unk_174 = (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) ? true : false; } } } @@ -253,7 +253,7 @@ void ObjTimeblock_Normal(ObjTimeblock* this, PlayState* play) { } void func_80BA06AC(ObjTimeblock* this, PlayState* play) { - s32 switchFlag = this->dyna.actor.params & 0x3F; + s32 switchFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 6); this->unk_172 = play->msgCtx.lastPlayedSong; @@ -277,7 +277,7 @@ void ObjTimeblock_AltBehaviorVisible(ObjTimeblock* this, PlayState* play) { OnePointCutscene_Attention(play, &this->dyna.actor); // "Time Block Attention Camera (frame counter)" PRINTF("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", play->state.frames); - ObjTimeblock_ToggleSwitchFlag(play, this->dyna.actor.params & 0x3F); + ObjTimeblock_ToggleSwitchFlag(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); } func_80BA06AC(this, play); @@ -296,10 +296,11 @@ void ObjTimeblock_SetupAltBehaviourNotVisible(ObjTimeblock* this) { } void ObjTimeblock_AltBehaviourNotVisible(ObjTimeblock* this, PlayState* play) { - s32 switchFlag = this->dyna.actor.params & 0x3F; + s32 switchFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 6); s8 switchFlagIsSet = (Flags_GetSwitch(play, switchFlag)) ? true : false; - if (this->unk_176 ^ switchFlagIsSet && switchFlagIsSet ^ (((this->dyna.actor.params >> 15) & 1) ? true : false)) { + if (this->unk_176 ^ switchFlagIsSet && + switchFlagIsSet ^ (PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? true : false)) { if (this->demoEffectTimer <= 0) { ObjTimeblock_SpawnDemoEffect(this, play); this->demoEffectTimer = 160; diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index d19818c246..ab73a0c9fa 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -83,10 +83,10 @@ static InitChainEntry sInitChain[] = { }; void ObjTsubo_SpawnCollectible(ObjTsubo* this, PlayState* play) { - s16 dropParams = this->actor.params & 0x1F; + s16 dropParams = PARAMS_GET_U(this->actor.params, 0, 5); if ((dropParams >= 0) && (dropParams < ITEM00_MAX)) { - Item_DropCollectible(play, &this->actor.world.pos, (dropParams | (((this->actor.params >> 9) & 0x3F) << 8))); + Item_DropCollectible(play, &this->actor.world.pos, dropParams | (PARAMS_GET_U(this->actor.params, 9, 6) << 8)); } } @@ -135,7 +135,7 @@ void ObjTsubo_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); return; } - this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[(this->actor.params >> 8) & 1]); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[PARAMS_GET_U(this->actor.params, 8, 1)]); if (this->requiredObjectSlot < 0) { PRINTF("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", this->actor.params, "../z_obj_tsubo.c", 410); Actor_Kill(&this->actor); @@ -183,7 +183,8 @@ void ObjTsubo_AirBreak(ObjTsubo* this, PlayState* play) { } EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -240, arg5, 10, 10, 0, (Rand_ZeroOne() * 95.0f) + 15.0f, 0, 32, 60, KAKERA_COLOR_NONE, - sObjectIds[(this->actor.params >> 8) & 1], D_80BA1B8C[(this->actor.params >> 8) & 1]); + sObjectIds[PARAMS_GET_U(this->actor.params, 8, 1)], + D_80BA1B8C[PARAMS_GET_U(this->actor.params, 8, 1)]); } func_80033480(play, &this->actor.world.pos, 30.0f, 4, 20, 50, 1); } @@ -212,7 +213,8 @@ void ObjTsubo_WaterBreak(ObjTsubo* this, PlayState* play) { phi_s0 = (Rand_ZeroOne() < .2f) ? 64 : 32; EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -180, phi_s0, 30, 30, 0, (Rand_ZeroOne() * 95.0f) + 15.0f, 0, 32, 70, KAKERA_COLOR_NONE, - sObjectIds[(this->actor.params >> 8) & 1], D_80BA1B8C[(this->actor.params >> 8) & 1]); + sObjectIds[PARAMS_GET_U(this->actor.params, 8, 1)], + D_80BA1B8C[PARAMS_GET_U(this->actor.params, 8, 1)]); } } @@ -338,5 +340,5 @@ void ObjTsubo_Update(Actor* thisx, PlayState* play) { } void ObjTsubo_Draw(Actor* thisx, PlayState* play) { - Gfx_DrawDListOpa(play, D_80BA1B84[(thisx->params >> 8) & 1]); + Gfx_DrawDListOpa(play, D_80BA1B84[PARAMS_GET_U(thisx->params, 8, 1)]); } diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index 2d39250e0f..0deb125538 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -66,11 +66,11 @@ static Color_RGB8 sColors[] = { void ObjWarp2block_Spawn(ObjWarp2block* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, - this->dyna.actor.world.pos.z, 0, 0, 0, sSpawnData[(this->dyna.actor.params >> 8) & 1].params); + this->dyna.actor.world.pos.z, 0, 0, 0, sSpawnData[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].params); Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->dyna.actor.child->world.pos.x, this->dyna.actor.child->world.pos.y, this->dyna.actor.child->world.pos.z, 0, 0, 0, - sSpawnData[(this->dyna.actor.child->params >> 8) & 1].params); + sSpawnData[PARAMS_GET_U(this->dyna.actor.child->params, 8, 1)].params); } s32 func_80BA1ECC(ObjWarp2block* this, PlayState* play) { @@ -83,8 +83,8 @@ s32 func_80BA1ECC(ObjWarp2block* this, PlayState* play) { Vec3f sp20; f32 temp_f2; - if ((this->dyna.actor.xzDistToPlayer <= sDistances[(((this->dyna.actor.params >> 0xB) & 7))]) || - (temp_a3->xzDistToPlayer <= sDistances[(((temp_a3->params >> 0xB) & 7))])) { + if ((this->dyna.actor.xzDistToPlayer <= sDistances[PARAMS_GET_U(this->dyna.actor.params, 11, 3)]) || + (temp_a3->xzDistToPlayer <= sDistances[PARAMS_GET_U(temp_a3->params, 11, 3)])) { Actor_WorldToActorCoords(&this->dyna.actor, &sp20, &player->actor.world.pos); temp_f2 = (this->dyna.actor.scale.x * 50.0f) + 6.0f; @@ -140,14 +140,15 @@ void ObjWarp2block_SwapWithChild(ObjWarp2block* this, PlayState* play) { this->dyna.actor.focus.rot = this->dyna.actor.child->focus.rot; this->dyna.actor.child->focus.rot = tempRot; - temp = this->dyna.actor.params & 0x7FFF; - this->dyna.actor.params = (this->dyna.actor.params & 0x8000) | (this->dyna.actor.child->params & 0x7FFF); - this->dyna.actor.child->params = (this->dyna.actor.child->params & 0x8000) | (temp & 0x7FFF); + temp = PARAMS_GET_U(this->dyna.actor.params, 0, 15); + this->dyna.actor.params = + PARAMS_GET_NOSHIFT(this->dyna.actor.params, 15, 1) | PARAMS_GET_U(this->dyna.actor.child->params, 0, 15); + this->dyna.actor.child->params = PARAMS_GET_NOSHIFT(this->dyna.actor.child->params, 15, 1) | (temp & 0x7FFF); if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos) < 0.01f) { - Flags_UnsetSwitch(play, this->dyna.actor.params & 0x3F); + Flags_UnsetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); } else { - Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); } } @@ -201,13 +202,13 @@ void ObjWarp2block_Init(Actor* thisx, PlayState* play2) { this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z = 0; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - Actor_SetScale(&this->dyna.actor, sSpawnData[(this->dyna.actor.params >> 8) & 1].scale); + Actor_SetScale(&this->dyna.actor, sSpawnData[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].scale); this->func_168 = func_80BA2218; - Actor_SetFocus(&this->dyna.actor, sSpawnData[(this->dyna.actor.params >> 8) & 1].focus); + Actor_SetFocus(&this->dyna.actor, sSpawnData[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].focus); - if ((this->dyna.actor.params >> 0xF) & 1) { + if (PARAMS_GET_U(this->dyna.actor.params, 15, 1)) { func_80BA24E8(this); - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { this->dyna.actor.draw = NULL; } DynaPolyActor_Init(&this->dyna, 0); @@ -217,13 +218,14 @@ void ObjWarp2block_Init(Actor* thisx, PlayState* play2) { ObjWarp2block_SetInactive(this); } - PRINTF("時のブロック(ワープ2) ( %04xH color:%d range:%d)\n", this->dyna.actor.params & 0xFFFF, - this->dyna.actor.home.rot.z & 7, (this->dyna.actor.params >> 0xB) & 7); + PRINTF("時のブロック(ワープ2) ( %04xH color:%d range:%d)\n", + PARAMS_GET_U(this->dyna.actor.params, 0, 16), this->dyna.actor.home.rot.z & 7, + PARAMS_GET_U(this->dyna.actor.params, 11, 3)); } void ObjWarp2block_Destroy(Actor* thisx, PlayState* play) { ObjWarp2block* this = (ObjWarp2block*)thisx; - if ((this->dyna.actor.params >> 0xF) & 1) { + if (PARAMS_GET_U(this->dyna.actor.params, 15, 1)) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -244,10 +246,10 @@ void func_80BA24F8(ObjWarp2block* this, PlayState* play) { Actor* current = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; while (current != NULL) { - if (current->id == ACTOR_OBJ_WARP2BLOCK && !((current->params >> 0xF) & 1) && - ((this->dyna.actor.params & 0x3F) == (current->params & 0x3F))) { + if (current->id == ACTOR_OBJ_WARP2BLOCK && !PARAMS_GET_U(current->params, 15, 1) && + (PARAMS_GET_U(this->dyna.actor.params, 0, 6) == PARAMS_GET_U(current->params, 0, 6))) { this->dyna.actor.child = current; - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { ObjWarp2block_SwapWithChild(this, play); this->dyna.actor.draw = ObjWarp2block_Draw; } diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 7809756148..34820860a5 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -65,7 +65,7 @@ void ShotSun_Init(Actor* thisx, PlayState* play) { // "Ocarina secret occurrence" PRINTF("%d ---- オカリナの秘密発生!!!!!!!!!!!!!\n", this->actor.params); - params = this->actor.params & 0xFF; + params = PARAMS_GET_U(this->actor.params, 0, 8); if (params == 0x40 || params == 0x41) { this->fairySpawnerState = SPAWNER_OUT_OF_RANGE; this->actor.flags |= ACTOR_FLAG_4; @@ -82,7 +82,7 @@ void ShotSun_Init(Actor* thisx, PlayState* play) { void ShotSun_Destroy(Actor* thisx, PlayState* play) { ShotSun* this = (ShotSun*)thisx; - s32 params = this->actor.params & 0xFF; + s32 params = PARAMS_GET_U(this->actor.params, 0, 8); if (params != 0x40 && params != 0x41) { Collider_DestroyCylinder(play, &this->collider); @@ -90,7 +90,7 @@ void ShotSun_Destroy(Actor* thisx, PlayState* play) { } void ShotSun_SpawnFairy(ShotSun* this, PlayState* play) { - s32 params = this->actor.params & 0xFF; + s32 params = PARAMS_GET_U(this->actor.params, 0, 8); s32 fairyType; if (this->timer > 0) { @@ -128,7 +128,7 @@ void ShotSun_TriggerFairy(ShotSun* this, PlayState* play) { void ShotSun_UpdateFairySpawner(ShotSun* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 pad; - s32 params = this->actor.params & 0xFF; + s32 params = PARAMS_GET_U(this->actor.params, 0, 8); if (Math3D_Vec3fDistSq(&this->actor.world.pos, &player->actor.world.pos) > SQ(150.0f)) { this->fairySpawnerState = SPAWNER_OUT_OF_RANGE; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index d47b41372e..a1894e51ad 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -5200,7 +5200,7 @@ void func_8083A0F4(PlayState* play, Player* this) { Player_SetupAction(play, this, Player_Action_80846120, 0); this->stateFlags1 |= PLAYER_STATE1_29; anim = &gPlayerAnim_link_normal_heavy_carry; - } else if ((interactActorId == ACTOR_EN_ISHI) && ((interactRangeActor->params & 0xF) == 1)) { + } else if ((interactActorId == ACTOR_EN_ISHI) && (PARAMS_GET_U(interactRangeActor->params, 0, 4) == 1)) { Player_SetupAction(play, this, Player_Action_80846260, 0); anim = &gPlayerAnim_link_silver_carry; } else if (((interactActorId == ACTOR_EN_BOMBF) || (interactActorId == ACTOR_EN_KUSA)) && @@ -6921,7 +6921,7 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) { } else { s32 strength = Player_GetStrength(); - if ((interactedActor->id == ACTOR_EN_ISHI) && ((interactedActor->params & 0xF) == 1) && + if ((interactedActor->id == ACTOR_EN_ISHI) && (PARAMS_GET_U(interactedActor->params, 0, 4) == 1) && (strength < PLAYER_STR_SILVER_G)) { return 0; } @@ -10158,7 +10158,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { } if (func_80845C68(play, (respawnFlag == 2) ? 1 : 0) == 0) { - gSaveContext.respawn[RESPAWN_MODE_DOWN].playerParams = (thisx->params & 0xFF) | 0xD00; + gSaveContext.respawn[RESPAWN_MODE_DOWN].playerParams = PARAMS_GET_S(thisx->params, 0, 8) | 0xD00; } gSaveContext.respawn[RESPAWN_MODE_DOWN].data = 1; @@ -10167,7 +10167,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { gSaveContext.save.info.infTable[INFTABLE_1AX_INDEX] |= gBitFlags[play->sceneId]; } - initMode = (thisx->params & 0xF00) >> 8; + initMode = PARAMS_GET_S(thisx->params, 8, 4); if ((initMode == 5) || (initMode == 6)) { if (gSaveContext.save.cutsceneIndex >= 0xFFF0) { initMode = 13; From c8ec6042e11f4973930e72f261bc094776551440 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 15 Aug 2024 00:53:39 +0200 Subject: [PATCH 10/33] checksums for ntsc 1.2 JP and US, accept both as baserom (#2030) --- Makefile | 12 ++++++- ...pressed.md5 => checksum-JP-compressed.md5} | 0 .../{checksum.md5 => checksum-JP.md5} | 0 baseroms/ntsc-1.2/checksum-US-compressed.md5 | 1 + baseroms/ntsc-1.2/checksum-US.md5 | 1 + baseroms/ntsc-1.2/config.yml | 3 ++ tools/decompress_baserom.py | 32 +++++++++++-------- tools/version_config.py | 2 ++ 8 files changed, 37 insertions(+), 14 deletions(-) rename baseroms/ntsc-1.2/{checksum-compressed.md5 => checksum-JP-compressed.md5} (100%) rename baseroms/ntsc-1.2/{checksum.md5 => checksum-JP.md5} (100%) create mode 100644 baseroms/ntsc-1.2/checksum-US-compressed.md5 create mode 100644 baseroms/ntsc-1.2/checksum-US.md5 diff --git a/Makefile b/Makefile index c5eaeff79a..f2ba949a4b 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ COMPILER ?= ido # gc-eu-mq GameCube Europe/PAL Master Quest # gc-eu-mq-dbg GameCube Europe/PAL Master Quest Debug (default) # The following versions are work-in-progress and not yet matching: -# ntsc-1.2 N64 NTSC 1.2 (Japan) +# ntsc-1.2 N64 NTSC 1.2 (Japan/US depending on REGION) VERSION ?= gc-eu-mq-dbg # Number of threads to extract and compress with N_THREADS ?= $(shell nproc) @@ -45,8 +45,10 @@ CFLAGS ?= CPPFLAGS ?= CPP_DEFINES ?= +REGIONAL_CHECKSUM := 0 # Version-specific settings ifeq ($(VERSION),ntsc-1.2) + REGIONAL_CHECKSUM := 1 REGION ?= JP PLATFORM := N64 PAL := 0 @@ -470,13 +472,21 @@ all: rom compress rom: $(ROM) ifneq ($(COMPARE),0) @md5sum $(ROM) + ifneq ($(REGIONAL_CHECKSUM),0) + @md5sum -c $(BASEROM_DIR)/checksum-$(REGION).md5 + else @md5sum -c $(BASEROM_DIR)/checksum.md5 + endif endif compress: $(ROMC) ifneq ($(COMPARE),0) @md5sum $(ROMC) + ifneq ($(REGIONAL_CHECKSUM),0) + @md5sum -c $(BASEROM_DIR)/checksum-$(REGION)-compressed.md5 + else @md5sum -c $(BASEROM_DIR)/checksum-compressed.md5 + endif endif clean: diff --git a/baseroms/ntsc-1.2/checksum-compressed.md5 b/baseroms/ntsc-1.2/checksum-JP-compressed.md5 similarity index 100% rename from baseroms/ntsc-1.2/checksum-compressed.md5 rename to baseroms/ntsc-1.2/checksum-JP-compressed.md5 diff --git a/baseroms/ntsc-1.2/checksum.md5 b/baseroms/ntsc-1.2/checksum-JP.md5 similarity index 100% rename from baseroms/ntsc-1.2/checksum.md5 rename to baseroms/ntsc-1.2/checksum-JP.md5 diff --git a/baseroms/ntsc-1.2/checksum-US-compressed.md5 b/baseroms/ntsc-1.2/checksum-US-compressed.md5 new file mode 100644 index 0000000000..001d6babd3 --- /dev/null +++ b/baseroms/ntsc-1.2/checksum-US-compressed.md5 @@ -0,0 +1 @@ +57a9719ad547c516342e1a15d5c28c3d build/ntsc-1.2/oot-ntsc-1.2-compressed.z64 diff --git a/baseroms/ntsc-1.2/checksum-US.md5 b/baseroms/ntsc-1.2/checksum-US.md5 new file mode 100644 index 0000000000..75c1434d1a --- /dev/null +++ b/baseroms/ntsc-1.2/checksum-US.md5 @@ -0,0 +1 @@ +12fcafeba93992facaf65c2ba00f3089 build/ntsc-1.2/oot-ntsc-1.2.z64 diff --git a/baseroms/ntsc-1.2/config.yml b/baseroms/ntsc-1.2/config.yml index 5a0765a700..89a4c73e02 100644 --- a/baseroms/ntsc-1.2/config.yml +++ b/baseroms/ntsc-1.2/config.yml @@ -1,3 +1,6 @@ +checksums: + - checksum-JP + - checksum-US dmadata_start: 0x7960 text_lang_pal: false incbins: diff --git a/tools/decompress_baserom.py b/tools/decompress_baserom.py index 2feb2b935c..aeea9e3dae 100755 --- a/tools/decompress_baserom.py +++ b/tools/decompress_baserom.py @@ -10,6 +10,7 @@ import hashlib import io from pathlib import Path import struct +from typing import Iterable import crunch64 import ipl3checksum @@ -101,10 +102,10 @@ def get_str_hash(byte_array): return str(hashlib.md5(byte_array).hexdigest()) -def check_existing_rom(rom_path: Path, correct_str_hash: str): +def check_existing_rom(rom_path: Path, correct_str_hashes: Iterable[str]): # If the baserom exists and is correct, we don't need to change anything if rom_path.exists(): - if get_str_hash(rom_path.read_bytes()) == correct_str_hash: + if get_str_hash(rom_path.read_bytes()) in correct_str_hashes: return True return False @@ -176,12 +177,17 @@ def main(): config = version_config.load_version_config(version) dmadata_start = config.dmadata_start - compressed_str_hash = ( - (baserom_dir / "checksum-compressed.md5").read_text().split()[0] - ) - decompressed_str_hash = (baserom_dir / "checksum.md5").read_text().split()[0] + compressed_str_hashes = [] + decompressed_str_hashes = [] + for checksum_stem in config.checksums: + compressed_str_hashes.append( + (baserom_dir / f"{checksum_stem}-compressed.md5").read_text().split()[0] + ) + decompressed_str_hashes.append( + (baserom_dir / f"{checksum_stem}.md5").read_text().split()[0] + ) - if check_existing_rom(uncompressed_path, decompressed_str_hash): + if check_existing_rom(uncompressed_path, decompressed_str_hashes): print("Found valid baserom - exiting early") return @@ -220,12 +226,12 @@ def main(): # Check to see if the ROM is a "vanilla" ROM str_hash = get_str_hash(file_content) if version == "gc-eu-mq-dbg": - correct_str_hash = decompressed_str_hash + correct_str_hashes = decompressed_str_hashes else: - correct_str_hash = compressed_str_hash - if str_hash != correct_str_hash: + correct_str_hashes = compressed_str_hashes + if str_hash not in correct_str_hashes: print( - f"Error: Expected a hash of {correct_str_hash} but got {str_hash}. The baserom has probably been tampered, find a new one" + f"Error: Expected a hash of {' or '.join(correct_str_hashes)} but got {str_hash}. The baserom has probably been tampered, find a new one" ) if version == "gc-eu-mq-dbg": @@ -247,9 +253,9 @@ def main(): # Double check the hash str_hash = get_str_hash(file_content) - if str_hash != decompressed_str_hash: + if str_hash not in decompressed_str_hashes: print( - f"Error: Expected a hash of {decompressed_str_hash} after decompression but got {str_hash}!" + f"Error: Expected a hash of {' or '.join(decompressed_str_hashes)} after decompression but got {str_hash}!" ) exit(1) diff --git a/tools/version_config.py b/tools/version_config.py index f1666d1452..9377637763 100644 --- a/tools/version_config.py +++ b/tools/version_config.py @@ -20,6 +20,7 @@ PROJECT_ROOT = Path(__file__).parent.parent class VersionConfig: # Version name version: str + checksums: list[str] # ROM offset to start of DMA table dmadata_start: int # Whether the languages are PAL (EN/DE/FR) or not (JP/EN) @@ -89,6 +90,7 @@ def load_version_config(version: str) -> VersionConfig: return VersionConfig( version=version, + checksums=config.get("checksums", ["checksum"]), dmadata_start=config["dmadata_start"], text_lang_pal=config["text_lang_pal"], dmadata_segments=load_dmadata_segments(version), From d3b9ba17da552430ffb5a5a766b8489bd4156f39 Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Thu, 15 Aug 2024 01:54:31 +0100 Subject: [PATCH 11/33] [Audio 4/?] Build Samplebanks, match Audiotable (#2032) * [Audio 4/?] Build Samplebanks, match Audiotable * Fix some makefile formatting * Add missing scope in MARK chunk handling * Add comment to generate asm file when buffer bug data is emitted, remove duplicate CC4 definition * Adjust comment * SBCFLAGS * Remove unnecessary comments on notes_lut * Split build directories creation command into several to avoid it becoming too long * objcopy -j -> --only-section * Fix mkdir warning when extracted/VERSION/assets doesn't exist --- Makefile | 72 +++- README.md | 3 +- docs/BUILDING_MACOS.md | 3 +- spec | 8 +- tools/audio/.clang-format | 29 ++ tools/audio/.gitignore | 3 + tools/audio/Makefile | 32 +- tools/audio/aifc.c | 552 ++++++++++++++++++++++++++++++ tools/audio/aifc.h | 75 ++++ tools/audio/samplebank.c | 124 +++++++ tools/audio/samplebank.h | 36 ++ tools/audio/samplebank_compiler.c | 203 +++++++++++ tools/audio/util.c | 144 ++++++++ tools/audio/util.h | 72 ++++ tools/audio/xml.c | 393 +++++++++++++++++++++ tools/audio/xml.h | 61 ++++ 16 files changed, 1795 insertions(+), 15 deletions(-) create mode 100644 tools/audio/.clang-format create mode 100644 tools/audio/.gitignore create mode 100644 tools/audio/aifc.c create mode 100644 tools/audio/aifc.h create mode 100644 tools/audio/samplebank.c create mode 100644 tools/audio/samplebank.h create mode 100644 tools/audio/samplebank_compiler.c create mode 100644 tools/audio/util.c create mode 100644 tools/audio/util.h create mode 100644 tools/audio/xml.c create mode 100644 tools/audio/xml.h diff --git a/Makefile b/Makefile index f2ba949a4b..e0026e2a5f 100644 --- a/Makefile +++ b/Makefile @@ -229,13 +229,16 @@ ZAPD := tools/ZAPD/ZAPD.out FADO := tools/fado/fado.elf PYTHON ?= $(VENV)/bin/python3 -# Command to replace path variables in the spec file. We can't use the C -# preprocessor for this because it won't substitute inside string literals. -SPEC_REPLACE_VARS := sed -e 's|$$(BUILD_DIR)|$(BUILD_DIR)|g' +# Command to replace $(BUILD_DIR) in some files with the build path. +# We can't use the C preprocessor for this because it won't substitute inside string literals. +BUILD_DIR_REPLACE := sed -e 's|$$(BUILD_DIR)|$(BUILD_DIR)|g' # Audio tools AUDIO_EXTRACT := $(PYTHON) tools/audio_extraction.py SAMPLECONV := tools/audio/sampleconv/sampleconv +SBC := tools/audio/sbc + +SBCFLAGS := --matching CFLAGS += $(CPP_DEFINES) CPPFLAGS += $(CPP_DEFINES) @@ -303,8 +306,10 @@ endif ifneq ($(wildcard $(EXTRACTED_DIR)/assets/audio),) SAMPLE_EXTRACT_DIRS := $(shell find $(EXTRACTED_DIR)/assets/audio/samples -type d) + SAMPLEBANK_EXTRACT_DIRS := $(shell find $(EXTRACTED_DIR)/assets/audio/samplebanks -type d) else SAMPLE_EXTRACT_DIRS := + SAMPLEBANK_EXTRACT_DIRS := endif ifneq ($(wildcard assets/audio/samples),) @@ -313,10 +318,22 @@ else SAMPLE_DIRS := endif +ifneq ($(wildcard assets/audio/samplebanks),) + SAMPLEBANK_DIRS := $(shell find assets/audio/samplebanks -type d) +else + SAMPLEBANK_DIRS := +endif + SAMPLE_FILES := $(foreach dir,$(SAMPLE_DIRS),$(wildcard $(dir)/*.wav)) SAMPLE_EXTRACT_FILES := $(foreach dir,$(SAMPLE_EXTRACT_DIRS),$(wildcard $(dir)/*.wav)) AIFC_FILES := $(foreach f,$(SAMPLE_FILES),$(BUILD_DIR)/$(f:.wav=.aifc)) $(foreach f,$(SAMPLE_EXTRACT_FILES:.wav=.aifc),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) +SAMPLEBANK_XMLS := $(foreach dir,$(SAMPLEBANK_DIRS),$(wildcard $(dir)/*.xml)) +SAMPLEBANK_EXTRACT_XMLS := $(foreach dir,$(SAMPLEBANK_EXTRACT_DIRS),$(wildcard $(dir)/*.xml)) +SAMPLEBANK_BUILD_XMLS := $(foreach f,$(SAMPLEBANK_XMLS),$(BUILD_DIR)/$f) $(foreach f,$(SAMPLEBANK_EXTRACT_XMLS),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) +SAMPLEBANK_O_FILES := $(foreach f,$(SAMPLEBANK_BUILD_XMLS),$(f:.xml=.o)) +SAMPLEBANK_DEP_FILES := $(foreach f,$(SAMPLEBANK_O_FILES),$(f:.o=.d)) + # create extracted directories $(shell mkdir -p $(EXTRACTED_DIR) $(EXTRACTED_DIR)/assets $(EXTRACTED_DIR)/text) @@ -345,7 +362,7 @@ O_FILES := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f) \ $(foreach f,$(ASSET_C_FILES_COMMITTED:.c=.o),$(BUILD_DIR)/$f) \ $(foreach f,$(BASEROM_BIN_FILES),$(BUILD_DIR)/baserom/$(notdir $f).o) -OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(SPEC_REPLACE_VARS) | grep -o '[^"]*_reloc.o' ) +OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(BUILD_DIR_REPLACE) | grep -o '[^"]*_reloc.o' ) # Automatic dependency files # (Only asm_processor dependencies and reloc dependencies are handled for now) @@ -363,15 +380,21 @@ TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG_EXTRACTED:.png=.inc.c),$(f: # create build directories $(shell mkdir -p $(BUILD_DIR)/baserom \ - $(BUILD_DIR)/assets/text \ - $(foreach dir, \ + $(BUILD_DIR)/assets/text) +$(shell mkdir -p $(foreach dir, \ $(SRC_DIRS) \ $(UNDECOMPILED_DATA_DIRS) \ + $(SAMPLE_DIRS) \ + $(SAMPLEBANK_DIRS) \ $(ASSET_BIN_DIRS_COMMITTED), \ - $(BUILD_DIR)/$(dir)) \ - $(foreach dir, \ + $(BUILD_DIR)/$(dir))) +ifneq ($(wildcard $(EXTRACTED_DIR)/assets),) +$(shell mkdir -p $(foreach dir, \ + $(SAMPLE_EXTRACT_DIRS) \ + $(SAMPLEBANK_EXTRACT_DIRS) \ $(ASSET_BIN_DIRS_EXTRACTED), \ $(dir:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%))) +endif ifeq ($(COMPILER),ido) $(BUILD_DIR)/src/boot/stackcheck.o: OPTFLAGS := -O2 @@ -543,7 +566,8 @@ $(ROMC): $(ROM) $(ELF) $(BUILD_DIR)/compress_ranges.txt $(PYTHON) tools/compress.py --in $(ROM) --out $@ --dmadata-start `./tools/dmadata_start.sh $(NM) $(ELF)` --compress `cat $(BUILD_DIR)/compress_ranges.txt` --threads $(N_THREADS) $(PYTHON) -m ipl3checksum sum --cic 6105 --update $@ -$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(LDSCRIPT) $(BUILD_DIR)/undefined_syms.txt +$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(LDSCRIPT) $(BUILD_DIR)/undefined_syms.txt \ + $(SAMPLEBANK_O_FILES) $(LD) -T $(LDSCRIPT) -T $(BUILD_DIR)/undefined_syms.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map $(MAP) -o $@ ## Order-only prerequisites @@ -559,7 +583,7 @@ $(O_FILES): | asset_files .PHONY: o_files asset_files $(BUILD_DIR)/$(SPEC): $(SPEC) - $(CPP) $(CPPFLAGS) $< | $(SPEC_REPLACE_VARS) > $@ + $(CPP) $(CPPFLAGS) $< | $(BUILD_DIR_REPLACE) > $@ $(LDSCRIPT): $(BUILD_DIR)/$(SPEC) $(MKLDSCRIPT) $< $@ @@ -596,7 +620,7 @@ ifneq ($(COMPILER),gcc) else $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< endif - $(OBJCOPY) -O binary -j.rodata $@ $@.bin + $(OBJCOPY) -O binary --only-section .rodata $@ $@.bin $(BUILD_DIR)/assets/%.o: assets/%.c $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< @@ -677,6 +701,9 @@ AUDIO_BUILD_DEBUG ?= 0 # first build samples... +.PRECIOUS: $(BUILD_DIR)/assets/audio/samples/%.aifc +.PRECIOUS: $(BUILD_DIR)/assets/audio/samples/%.half.aifc + $(BUILD_DIR)/assets/audio/samples/%.half.aifc: assets/audio/samples/%.half.wav $(SAMPLECONV) vadpcm-half $< $@ @@ -695,6 +722,29 @@ ifeq ($(AUDIO_BUILD_DEBUG),1) @(cmp $( $@ + +$(BUILD_DIR)/assets/audio/samplebanks/%.xml: $(EXTRACTED_DIR)/assets/audio/samplebanks/%.xml + cat $< | $(BUILD_DIR_REPLACE) > $@ + +.PRECIOUS: $(BUILD_DIR)/assets/audio/samplebanks/%.s +$(BUILD_DIR)/assets/audio/samplebanks/%.s: $(BUILD_DIR)/assets/audio/samplebanks/%.xml | $(AIFC_FILES) + $(SBC) $(SBCFLAGS) --makedepend $(@:.s=.d) $< $@ + +-include $(SAMPLEBANK_DEP_FILES) + +$(BUILD_DIR)/assets/audio/samplebanks/%.o: $(BUILD_DIR)/assets/audio/samplebanks/%.s + $(AS) $(ASFLAGS) $< -o $@ +ifeq ($(AUDIO_BUILD_DEBUG),1) + $(OBJCOPY) -O binary --only-section .rodata $@ $(@:.o=.bin) + @cmp $(@:.o=.bin) $(patsubst $(BUILD_DIR)/assets/audio/samplebanks/%,$(EXTRACTED_DIR)/baserom_audiotest/audiotable_files/%,$(@:.o=.bin)) && echo "$( +#include +#include +#include +#include +#include + +#include "aifc.h" +#include "util.h" + +#define CC4_CHECK(buf, str) \ + ((buf)[0] == (str)[0] && (buf)[1] == (str)[1] && (buf)[2] == (str)[2] && (buf)[3] == (str)[3]) + +#define CC4(c1, c2, c3, c4) (((c1) << 24) | ((c2) << 16) | ((c3) << 8) | (c4)) + +#define FREAD(file, data, size) \ + do { \ + if (fread((data), (size), 1, (file)) != 1) { \ + error("[%s:%d] Could not read %lu bytes from file", __FILE__, __LINE__, (size_t)(size)); \ + } \ + } while (0) + +#define VADPCM_VER ((int16_t)1) + +#if 0 +#define DEBUGF(fmt, ...) printf(fmt, ##__VA_ARGS__) +#else +#define DEBUGF(fmt, ...) (void)0 +#endif + +typedef struct { + int16_t numChannels; + uint16_t numFramesH; + uint16_t numFramesL; + int16_t sampleSize; + uint8_t sampleRate[10]; // 80-bit float + // followed by compression type + compression name pstring +} aiff_COMM; + +typedef struct { + uint16_t nMarkers; +} aiff_MARK; + +typedef struct { + uint16_t MarkerID; + uint16_t positionH; + uint16_t positionL; +} Marker; + +typedef enum { + LOOP_PLAYMODE_NONE = 0, + LOOP_PLAYMODE_FWD = 1, + LOOP_PLAYMODE_FWD_BWD = 2 +} aiff_loop_playmode; + +typedef struct { + int16_t playMode; // aiff_loop_playmode + // Marker IDs + int16_t beginLoop; + int16_t endLoop; +} Loop; + +typedef struct { + int8_t baseNote; + int8_t detune; + int8_t lowNote; + int8_t highNote; + int8_t lowVelocity; + int8_t highVelocity; + int16_t gain; + Loop sustainLoop; + Loop releaseLoop; +} aiff_INST; + +typedef struct { + int32_t offset; + int32_t blockSize; +} aiff_SSND; + +static_assert(sizeof(double) == sizeof(uint64_t), "Double is assumed to be 64-bit"); + +#define F64_GET_SGN(bits) (((bits) >> 63) & 1) // 1-bit +#define F64_GET_EXP(bits) ((((bits) >> 52) & 0x7FF) - 0x3FF) // 15-bit +#define F64_GET_MANT_H(bits) (((bits) >> 32) & 0xFFFFF) // 20-bit +#define F64_GET_MANT_L(bits) ((bits)&0xFFFFFFFF) // 32-bit + +static UNUSED void +f64_to_f80(double f64, uint8_t *f80) +{ + union { + uint32_t w[3]; + uint8_t b[12]; + } f80tmp; + + // get f64 bits + + uint64_t f64_bits = *(uint64_t *)&f64; + + int f64_sgn = F64_GET_SGN(f64_bits); + int f64_exponent = F64_GET_EXP(f64_bits); + uint32_t f64_mantissa_hi = F64_GET_MANT_H(f64_bits); + uint32_t f64_mantissa_lo = F64_GET_MANT_L(f64_bits); + + // build f80 words + + f80tmp.w[0] = (f64_sgn << 15) | (f64_exponent + 0x3FFF); + f80tmp.w[1] = (1 << 31) | (f64_mantissa_hi << 11) | (f64_mantissa_lo >> 21); + f80tmp.w[2] = f64_mantissa_lo << 11; + + // byteswap to BE + + f80tmp.w[0] = htobe32(f80tmp.w[0]); + f80tmp.w[1] = htobe32(f80tmp.w[1]); + f80tmp.w[2] = htobe32(f80tmp.w[2]); + + // write bytes + + for (size_t i = 0; i < 10; i++) + f80[i] = f80tmp.b[i + 2]; +} + +static void +f80_to_f64(double *f64, uint8_t *f80) +{ + union { + uint32_t w[3]; + uint8_t b[12]; + } f80tmp; + + // read bytes + + f80tmp.b[0] = f80tmp.b[1] = 0; + for (size_t i = 0; i < 10; i++) + f80tmp.b[i + 2] = f80[i]; + + // byteswap from BE + + f80tmp.w[0] = be32toh(f80tmp.w[0]); + f80tmp.w[1] = be32toh(f80tmp.w[1]); + f80tmp.w[2] = be32toh(f80tmp.w[2]); + + // get f64 parts + + int f64_sgn = (f80tmp.w[0] >> 15) & 1; + int f64_exponent = (f80tmp.w[0] & 0x7FFF) - 0x3FFF; + uint32_t f64_mantissa_hi = (f80tmp.w[1] >> 11) & 0xFFFFF; + uint32_t f64_mantissa_lo = ((f80tmp.w[1] & 0x7FF) << 21) | (f80tmp.w[2] >> 11); + + // build bitwise f64 + + uint64_t f64_bits = ((uint64_t)f64_sgn << 63) | ((((uint64_t)f64_exponent + 0x3FF) & 0x7FF) << 52) | + ((uint64_t)f64_mantissa_hi << 32) | ((uint64_t)f64_mantissa_lo); + + // write double + + *f64 = *(double *)&f64_bits; +} + +static void +read_pstring(FILE *f, char *out) +{ + unsigned char len; + + // read string length + FREAD(f, &len, sizeof(len)); + + // read string and null-terminate it + FREAD(f, out, len); + out[len] = '\0'; + + // pad to 2-byte boundary + if (!(len & 1)) + FREAD(f, &len, 1); +} + +static char * +read_pstring_alloc(FILE *f) +{ + unsigned char len; + + // read string length + FREAD(f, &len, sizeof(len)); + + // alloc + char *out = malloc(len + 1); + + // read string and null-terminate it + FREAD(f, out, len); + out[len] = '\0'; + + // pad to 2-byte boundary + if (!(len & 1)) + FREAD(f, &len, 1); + + return out; +} + +void +aifc_read(aifc_data *af, const char *path, uint8_t *match_buf, size_t *match_buf_pos) +{ + FILE *in; + bool has_comm = false; + bool has_ssnd = false; + + memset(af, 0, sizeof(aifc_data)); + + DEBUGF("[aifc] path [%s]\n", path); + + if (path == NULL) + return; + + in = fopen(path, "rb"); + if (in == NULL) + error("Failed to open \"%s\" for reading", path); + + char form[4]; + uint32_t size; + char aifc[4]; + + FREAD(in, form, 4); + FREAD(in, &size, 4); + size = be32toh(size); + FREAD(in, aifc, 4); + + DEBUGF("total size = 0x%X\n", size); + + if (!CC4_CHECK(form, "FORM") || !CC4_CHECK(aifc, "AIFC")) + error("Not an aifc file?"); + + af->path = path; + + while (true) { + char cc4[4]; + uint32_t chunk_size; + + long start = ftell(in); + if (start > 8 + size) { + error("Overran file"); + } + if (start == 8 + size) { + break; + } + + FREAD(in, cc4, 4); + FREAD(in, &chunk_size, 4); + chunk_size = be32toh(chunk_size); + + chunk_size++; + chunk_size &= ~1; + + DEBUGF("%c%c%c%c\n", cc4[0], cc4[1], cc4[2], cc4[3]); + + switch (CC4(cc4[0], cc4[1], cc4[2], cc4[3])) { + case CC4('C', 'O', 'M', 'M'): { + aiff_COMM comm; + FREAD(in, &comm, sizeof(comm)); + comm.numChannels = be16toh(comm.numChannels); + comm.numFramesH = be16toh(comm.numFramesH); + comm.numFramesL = be16toh(comm.numFramesL); + comm.sampleSize = be16toh(comm.sampleSize); + + assert(comm.numChannels == 1); // mono + assert(comm.sampleSize == 16); // 16-bit samples + + af->num_channels = comm.numChannels; + af->sample_size = comm.sampleSize; + af->num_frames = (comm.numFramesH << 16) | comm.numFramesL; + f80_to_f64(&af->sample_rate, comm.sampleRate); + + uint32_t comp_type = CC4('N', 'O', 'N', 'E'); + if (chunk_size > sizeof(aiff_COMM)) { + uint32_t compressionType; + FREAD(in, &compressionType, sizeof(compressionType)); + comp_type = be32toh(compressionType); + } + af->compression_type = comp_type; + + af->compression_name = NULL; + if (chunk_size > sizeof(aiff_COMM) + 4) { + af->compression_name = read_pstring_alloc(in); + } + + DEBUGF(" numChannels %d\n" + " numFrames %u\n" + " sampleSize %d\n" + " sampleRate %f\n" + " compressionType %c%c%c%c (%s)\n", + af->num_channels, af->num_frames, af->sample_size, af->sample_rate, af->compression_type >> 24, + af->compression_type >> 16, af->compression_type >> 8, af->compression_type, + af->compression_name); + + has_comm = true; + } break; + + case CC4('I', 'N', 'S', 'T'): { + aiff_INST inst; + FREAD(in, &inst, sizeof(inst)); + inst.gain = be16toh(inst.gain); + inst.sustainLoop.playMode = be16toh(inst.sustainLoop.playMode); + inst.sustainLoop.beginLoop = be16toh(inst.sustainLoop.beginLoop); + inst.sustainLoop.endLoop = be16toh(inst.sustainLoop.endLoop); + inst.releaseLoop.playMode = be16toh(inst.releaseLoop.playMode); + inst.releaseLoop.beginLoop = be16toh(inst.releaseLoop.beginLoop); + inst.releaseLoop.endLoop = be16toh(inst.releaseLoop.endLoop); + + // basenote + + DEBUGF(" baseNote = %d (%d)\n" + " detune = %d\n" + " lowNote = %d\n" + " highNote = %d\n" + " lowVelocity = %d\n" + " highVelocity= %d\n" + " gain = %d\n" + " sustainLoop = %d [%d:%d]\n" + " releaseLoop = %d [%d:%d]\n", + inst.baseNote, NOTE_MIDI_TO_Z64(inst.baseNote), inst.detune, inst.lowNote, inst.highNote, + inst.lowVelocity, inst.highVelocity, inst.gain, inst.sustainLoop.playMode, + inst.sustainLoop.beginLoop, inst.sustainLoop.endLoop, inst.releaseLoop.playMode, + inst.releaseLoop.beginLoop, inst.releaseLoop.endLoop); + + af->basenote = inst.baseNote; + af->detune = inst.detune; + af->has_inst = true; + } break; + + case CC4('M', 'A', 'R', 'K'): { + aiff_MARK mark; + FREAD(in, &mark, sizeof(mark)); + mark.nMarkers = be16toh(mark.nMarkers); + + af->num_markers = mark.nMarkers; + af->markers = malloc(mark.nMarkers * sizeof(aifc_marker)); + + for (size_t i = 0; i < mark.nMarkers; i++) { + Marker marker; + FREAD(in, &marker, sizeof(marker)); + marker.MarkerID = be16toh(marker.MarkerID); + marker.positionH = be16toh(marker.positionH); + marker.positionL = be16toh(marker.positionL); + + (*af->markers)[i].id = marker.MarkerID; + (*af->markers)[i].pos = (marker.positionH << 16) | marker.positionL; + (*af->markers)[i].label = read_pstring_alloc(in); + + DEBUGF(" MARKER: %d @ %u [%s]\n", (*af->markers)[i].id, (*af->markers)[i].pos, + (*af->markers)[i].label); + } + } break; + + case CC4('A', 'P', 'P', 'L'): { + char subcc4[4]; + + FREAD(in, subcc4, 4); + + DEBUGF(" %c%c%c%c\n", subcc4[0], subcc4[1], subcc4[2], subcc4[3]); + + switch (CC4(subcc4[0], subcc4[1], subcc4[2], subcc4[3])) { + case CC4('s', 't', 'o', 'c'): { + char chunk_name[257]; + read_pstring(in, chunk_name); + + DEBUGF(" %s\n", chunk_name); + + if (strequ(chunk_name, "VADPCMCODES")) { + int16_t version; + uint16_t order; + uint16_t npredictors; + + FREAD(in, &version, sizeof(version)); + version = be16toh(version); + FREAD(in, &order, sizeof(order)); + order = be16toh(order); + FREAD(in, &npredictors, sizeof(npredictors)); + npredictors = be16toh(npredictors); + + if (version != VADPCM_VER) + error("Non-identical codebook chunk versions"); + + size_t book_size = 8 * order * npredictors; + + af->book.order = order; + af->book.npredictors = npredictors; + af->book_state = malloc(book_size * sizeof(int16_t)); + FREAD(in, af->book_state, book_size * sizeof(int16_t)); + + for (size_t i = 0; i < book_size; i++) + (*af->book_state)[i] = be16toh((*af->book_state)[i]); + + af->has_book = true; + + // DEBUG + + DEBUGF(" order = %d\n" + " npredictors = %d\n", + af->book.order, af->book.npredictors); + + for (size_t i = 0; i < book_size; i++) { + if (i % 8 == 0) + DEBUGF("\n "); + DEBUGF("%04X ", (uint16_t)(*af->book_state)[i]); + } + DEBUGF("\n"); + } else if (strequ(chunk_name, "VADPCMLOOPS")) { + int16_t version; + int16_t nloops; + + FREAD(in, &version, sizeof(version)); + version = be16toh(version); + FREAD(in, &nloops, sizeof(nloops)); + nloops = be16toh(nloops); + + if (version != VADPCM_VER) + error("Non-identical loop chunk versions"); + + if (nloops != 1) + error("Only one loop is supported, got %d", nloops); + + FREAD(in, &af->loop, sizeof(ALADPCMloop)); + af->loop.start = be32toh(af->loop.start); + af->loop.end = be32toh(af->loop.end); + af->loop.count = be32toh(af->loop.count); + for (size_t i = 0; i < ARRAY_COUNT(af->loop.state); i++) + af->loop.state[i] = be16toh(af->loop.state[i]); + + af->has_loop = true; + + // DEBUG + + DEBUGF(" start = %d\n" + " end = %d\n" + " count = %d\n", + af->loop.start, af->loop.end, af->loop.count); + + for (size_t i = 0; i < ARRAY_COUNT(af->loop.state); i++) { + if (i % 8 == 0) + DEBUGF("\n "); + DEBUGF("%04X ", (uint16_t)af->loop.state[i]); + } + DEBUGF("\n"); + } else { + warning("Skipping unknown APPL::stoc subchunk: \"%s\"", chunk_name); + } + } break; + + default: + warning("Skipping unknown APPL subchunk: \"%c%c%c%c\"", subcc4[0], subcc4[1], subcc4[2], + subcc4[3]); + break; + } + } break; + + case CC4('S', 'S', 'N', 'D'): { + aiff_SSND ssnd; + FREAD(in, &ssnd, sizeof(ssnd)); + ssnd.offset = be32toh(ssnd.offset); + ssnd.blockSize = be32toh(ssnd.blockSize); + + assert(ssnd.offset == 0); + assert(ssnd.blockSize == 0); + + af->ssnd_offset = ftell(in); + // TODO use numFrames instead? + af->ssnd_size = chunk_size - sizeof(ssnd); + + // Skip reading the rest of the chunk + fseek(in, af->ssnd_size, SEEK_CUR); + + DEBUGF(" offset = 0x%lX size = 0x%lX\n", af->ssnd_offset, af->ssnd_size); + + has_ssnd = true; + } break; + + default: // skip it + break; + } + + long read_size = ftell(in) - start - 8; + + if (read_size > chunk_size) + error("overran chunk: %lu vs %u\n", read_size, chunk_size); + else if (read_size < chunk_size) + warning("did not read entire %.*s chunk: %lu vs %u", 4, cc4, read_size, chunk_size); + + fseek(in, start + 8 + chunk_size, SEEK_SET); + } + + if (!has_comm) + error("aiff/aifc has no COMM chunk"); + if (!has_ssnd) + error("aiff/aifc has no SSND chunk"); + + // replicate buffer bug in original tool + if (match_buf != NULL && match_buf_pos != NULL) { + size_t buf_pos = ALIGN16(*match_buf_pos) % BUG_BUF_SIZE; + size_t rem = af->ssnd_size; + long seek_offset = 0; + + if (rem > BUG_BUF_SIZE) { + // The sample is so large that it will cover the buffer more than once, let's only read as much as we + // need to. + + // Advance to the buffer position to read only the final data into + buf_pos = (buf_pos + rem - BUG_BUF_SIZE) % BUG_BUF_SIZE; + // We need to seek to the actual data in the file that would be read at this point + seek_offset = rem - BUG_BUF_SIZE; + // The remaining data to read is just 1 buffer's worth of data + rem = BUG_BUF_SIZE; + } + + fseek(in, af->ssnd_offset + seek_offset, SEEK_SET); + + if (rem > BUG_BUF_SIZE - buf_pos) { + // rem will circle around in the buffer + + // Fill up to the end of the buffer + FREAD(in, &match_buf[buf_pos], BUG_BUF_SIZE - buf_pos); + rem -= BUG_BUF_SIZE - buf_pos; + // Return to the start of the buffer + buf_pos = 0; + } + // rem fits in the buffer without circling back, fill buffer + FREAD(in, &match_buf[buf_pos], rem); + + *match_buf_pos = (buf_pos + rem) % BUG_BUF_SIZE; + } + + fclose(in); +} + +void +aifc_dispose(aifc_data *af) +{ + free(af->book_state); + af->has_book = false; + + af->has_loop = false; + + free(af->compression_name); + + for (size_t i = 0; i < af->num_markers; i++) + free((*af->markers)[i].label); + free(af->markers); +} diff --git a/tools/audio/aifc.h b/tools/audio/aifc.h new file mode 100644 index 0000000000..3e9920fd09 --- /dev/null +++ b/tools/audio/aifc.h @@ -0,0 +1,75 @@ +/** + * SPDX-FileCopyrightText: Copyright (C) 2024 ZeldaRET + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#ifndef AIFC_H_ +#define AIFC_H_ + +#include +#include +#include + +typedef struct { + int32_t order; + int32_t npredictors; +} ALADPCMbookhead; + +typedef int16_t ALADPCMbookstate[]; + +typedef struct { + uint32_t start; + uint32_t end; + uint32_t count; + int16_t state[16]; +} ALADPCMloop; + +typedef struct { + int16_t id; + uint32_t pos; + char *label; +} aifc_marker; + +typedef struct { + const char *path; // for debugging + // COMM + uint32_t num_frames; + int16_t num_channels; + int16_t sample_size; + double sample_rate; + uint32_t compression_type; + char *compression_name; + // SSND + long ssnd_offset; + size_t ssnd_size; + // INST + bool has_inst; + int8_t basenote; + int8_t detune; + // MARK + size_t num_markers; + aifc_marker (*markers)[]; + // APPL::stoc::VADPCMCODES + bool has_book; + ALADPCMbookhead book; + ALADPCMbookstate *book_state; + // APPL::stoc::VADPCMLOOPS + bool has_loop; + ALADPCMloop loop; +} aifc_data; + +#define BUG_BUF_SIZE 0x10000 + +void +aifc_read(aifc_data *af, const char *path, uint8_t *match_buf, size_t *match_buf_pos); + +void +aifc_dispose(aifc_data *af); + +// Subtract 21, if negative wrap into [0, 128) +#define NOTE_MIDI_TO_Z64(b) (((b)-21 < 0) ? ((b)-21 + 128) : ((b)-21)) + +#endif diff --git a/tools/audio/samplebank.c b/tools/audio/samplebank.c new file mode 100644 index 0000000000..8eda227f27 --- /dev/null +++ b/tools/audio/samplebank.c @@ -0,0 +1,124 @@ +/** + * SPDX-FileCopyrightText: Copyright (C) 2024 ZeldaRET + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#include + +#include "xml.h" +#include "samplebank.h" +#include "util.h" + +const char * +samplebank_path_forname(samplebank *sb, const char *name) +{ + assert(name != NULL); + + for (size_t i = 0; i < sb->num_samples; i++) { + if (strequ(sb->sample_names[i], name)) + return sb->sample_paths[i]; + } + return NULL; +} + +typedef struct { + const char *name; + const char *path; +} samplebank_xml_entry; + +void +read_samplebank_xml(samplebank *sb, xmlDocPtr doc) +{ + // XML Example: + // + // + // + // + + static const xml_attr_spec header_spec = { + {"Name", false, xml_parse_c_identifier, offsetof(samplebank, name) }, + { "Index", false, xml_parse_int, offsetof(samplebank, index) }, + { "Medium", false, xml_parse_c_identifier, offsetof(samplebank, medium) }, + { "CachePolicy", false, xml_parse_c_identifier, offsetof(samplebank, cache_policy)}, + { "BufferBug", true, xml_parse_bool, offsetof(samplebank, buffer_bug) }, + }; + static const xml_attr_spec entry_spec = { + {"Name", false, xml_parse_c_identifier, offsetof(samplebank_xml_entry, name)}, + { "Path", false, xml_parse_string, offsetof(samplebank_xml_entry, path)}, + }; + + xmlNodePtr root = xmlDocGetRootElement(doc); + + if (!strequ(XMLSTR_TO_STR(root->name), "SampleBank")) + error("Root node must be "); + + sb->buffer_bug = false; + xml_parse_node_by_spec(sb, root, header_spec, ARRAY_COUNT(header_spec)); + + if (root->children == NULL) + error("Missing samples list"); + + size_t entries_cap = 8; + size_t entries_len = 0; + sb->sample_names = malloc(entries_cap * sizeof(const char *)); + sb->sample_paths = malloc(entries_cap * sizeof(const char *)); + sb->is_sample = malloc(entries_cap * sizeof(bool)); + + size_t pointers_cap = 4; + size_t pointers_len = 0; + sb->pointer_indices = malloc(pointers_cap * sizeof(int)); + + LL_FOREACH(xmlNodePtr, node, root->children) { + if (node->type != XML_ELEMENT_NODE) + continue; + + if (node->children != NULL) { + xmlNodePtr first_child = node->children; + const char *child_name = XMLSTR_TO_STR(first_child->name); + error("Unexpected child node(s) (first is %s) in samples list (line %d)", child_name, first_child->line); + } + + const char *node_name = XMLSTR_TO_STR(node->name); + bool is_sample; + + if (strequ(node_name, "Sample")) { + is_sample = true; + } else if (strequ(node_name, "Blob")) { + is_sample = false; + } else if (strequ(node_name, "Pointer")) { + // pointer entry + int ptr_index; + xml_get_single_property(&ptr_index, node, "Index", xml_parse_int); + + if (pointers_len == pointers_cap) { + pointers_cap *= 2; + sb->pointer_indices = realloc(sb->pointer_indices, pointers_cap * sizeof(int)); + } + sb->pointer_indices[pointers_len++] = ptr_index; + continue; + } else { + error("Unexpected element node %s in samples list (line %d)", node_name, node->line); + } + + samplebank_xml_entry ent; + xml_parse_node_by_spec(&ent, node, entry_spec, ARRAY_COUNT(entry_spec)); + + if (entries_len == entries_cap) { + entries_cap *= 2; + sb->sample_names = realloc(sb->sample_names, entries_cap * sizeof(const char *)); + sb->sample_paths = realloc(sb->sample_paths, entries_cap * sizeof(const char *)); + sb->is_sample = realloc(sb->is_sample, entries_cap * sizeof(bool)); + } + + sb->sample_names[entries_len] = ent.name; + sb->sample_paths[entries_len] = ent.path; + sb->is_sample[entries_len] = is_sample; + entries_len++; + } + + sb->num_samples = entries_len; + sb->num_pointers = pointers_len; +} diff --git a/tools/audio/samplebank.h b/tools/audio/samplebank.h new file mode 100644 index 0000000000..c436253fc6 --- /dev/null +++ b/tools/audio/samplebank.h @@ -0,0 +1,36 @@ +/** + * SPDX-FileCopyrightText: Copyright (C) 2024 ZeldaRET + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#ifndef SAMPLEBANK_H_ +#define SAMPLEBANK_H_ + +#include "xml.h" + +typedef struct { + const char *name; + int index; + const char *medium; + const char *cache_policy; + bool buffer_bug; + + size_t num_samples; + const char **sample_paths; + const char **sample_names; + bool *is_sample; + + size_t num_pointers; + int *pointer_indices; +} samplebank; + +const char * +samplebank_path_forname(samplebank *sb, const char *name); + +void +read_samplebank_xml(samplebank *sb, xmlDocPtr doc); + +#endif diff --git a/tools/audio/samplebank_compiler.c b/tools/audio/samplebank_compiler.c new file mode 100644 index 0000000000..c53515dc1f --- /dev/null +++ b/tools/audio/samplebank_compiler.c @@ -0,0 +1,203 @@ +/** + * SPDX-FileCopyrightText: Copyright (C) 2024 ZeldaRET + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#include +#include +#include + +#include "xml.h" +#include "aifc.h" +#include "samplebank.h" +#include "util.h" + +NORETURN static void +usage(const char *progname) +{ + fprintf(stderr, "Usage: %s [--matching] [--makedepend ] \n", progname); + exit(EXIT_FAILURE); +} + +int +main(int argc, char **argv) +{ + static uint8_t match_buf[BUG_BUF_SIZE]; + const char *filename = NULL; + xmlDocPtr document; + const char *outfilename = NULL; + const char *mdfilename = NULL; + FILE *mdfile; + FILE *outf; + samplebank sb; + uint8_t *match_buf_ptr; + size_t match_buf_pos; + bool matching = false; + + // parse args + +#define arg_error(fmt, ...) \ + do { \ + fprintf(stderr, fmt "\n", ##__VA_ARGS__); \ + usage(argv[0]); \ + } while (0) + + int argn = 0; + for (int i = 1; i < argc; i++) { + if (argv[i][0] == '-') { + // Optional args + + if (strequ(argv[i], "--matching")) { + if (matching) + arg_error("Received --matching option twice"); + + matching = true; + continue; + } + if (strequ(argv[i], "--makedepend")) { + if (mdfilename != NULL) + arg_error("Received --makedepend option twice"); + if (i + 1 == argc) + arg_error("--makedepend missing required argument"); + + mdfilename = argv[++i]; + continue; + } + arg_error("Unknown option \"%s\"", argv[i]); + } else { + // Required args + + switch (argn) { + case 0: + filename = argv[i]; + break; + case 1: + outfilename = argv[i]; + break; + default: + arg_error("Unknown positional argument \"%s\"", argv[i]); + break; + } + argn++; + } + } + if (argn != 2) + arg_error("Not enough positional arguments"); + +#undef arg_error + + // open xml + document = xmlReadFile(filename, NULL, XML_PARSE_NONET); + if (document == NULL) + return EXIT_FAILURE; + + // parse xml + read_samplebank_xml(&sb, document); + + // open output asm file + outf = fopen(outfilename, "w"); + if (outf == NULL) + error("Unable to open output file [%s] for writing", outfilename); + + // open output dep file if applicable + if (mdfilename != NULL) { + mdfile = fopen(mdfilename, "w"); + if (mdfile == NULL) + error("Unable to open dependency file [%s] for writing", mdfilename); + + fprintf(mdfile, "%s: \\\n %s", outfilename, filename); + } + + // write output + + fprintf(outf, + // clang-format off + ".rdata" "\n" + ".balign 16" "\n" + "\n" + ".global %s_Start" "\n" + "%s_Start:" "\n" + "$start:" "\n", + // clang-format on + sb.name, sb.name); + + // original tool appears to have a buffer clearing bug involving a buffer sized BUG_BUF_SIZE + match_buf_ptr = (matching) ? match_buf : NULL; + match_buf_pos = 0; + + for (size_t i = 0; i < sb.num_samples; i++) { + const char *name = sb.sample_names[i]; + const char *path = sb.sample_paths[i]; + bool is_sample = sb.is_sample[i]; + + if (mdfilename != NULL) + fprintf(mdfile, " \\\n %s", path); + + if (!is_sample) { + // blob + fprintf(outf, + // clang-format off + "\n" + "# BLOB %s" "\n" + "\n" + ".incbin \"%s\"" "\n" + "\n" + ".balign 16" "\n" + "\n", + // clang-format on + name, path); + continue; + } + + // aifc sample + fprintf(outf, + // clang-format off + "\n" + "# SAMPLE %lu" "\n" + "\n" + ".global %s_%s_Abs" "\n" + "%s_%s_Abs:" "\n" + ".global %s_%s_Off" "\n" + ".set %s_%s_Off, . - $start" "\n" + "\n", + // clang-format on + i, sb.name, name, sb.name, name, sb.name, name, sb.name, name); + + aifc_data aifc; + aifc_read(&aifc, path, match_buf_ptr, &match_buf_pos); + + fprintf(outf, ".incbin \"%s\", 0x%lX, 0x%lX\n", path, aifc.ssnd_offset, aifc.ssnd_size); + + if (matching && sb.buffer_bug && i == sb.num_samples - 1) { + // emplace garbage + size_t end = ALIGN16(match_buf_pos); + + fprintf(outf, "\n# Garbage data from buffer bug\n"); + for (; match_buf_pos < end; match_buf_pos++) + fprintf(outf, ".byte 0x%02X\n", match_buf[match_buf_pos]); + } else { + fputs("\n.balign 16\n", outf); + } + + aifc_dispose(&aifc); + } + + if (mdfilename != NULL) { + fputs("\n", mdfile); + fclose(mdfile); + } + + fprintf(outf, + // clang-format off + ".global %s_Size" "\n" + ".set %s_Size, . - $start" "\n", + // clang-format on + sb.name, sb.name); + + fclose(outf); + xmlFreeDoc(document); + return EXIT_SUCCESS; +} diff --git a/tools/audio/util.c b/tools/audio/util.c new file mode 100644 index 0000000000..8043f95775 --- /dev/null +++ b/tools/audio/util.c @@ -0,0 +1,144 @@ +/* SPDX-FileCopyrightText: Copyright (C) 2024 ZeldaRET */ +/* SPDX-License-Identifier: CC0-1.0 */ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include + +#include "util.h" + +// TODO ideally we should be collecting all errors and displaying them all before exiting + +NORETURN void +error(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + fprintf(stderr, "\x1b[91m" + "Error: " + "\x1b[97m"); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\x1b[0m" + "\n"); + va_end(ap); + + exit(EXIT_FAILURE); +} + +void +warning(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + fprintf(stderr, "\x1b[95m" + "Warning: " + "\x1b[97m"); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\x1b[0m" + "\n"); + va_end(ap); +} + +void * +util_read_whole_file(const char *filename, size_t *size_out) +{ + FILE *file = fopen(filename, "rb"); + void *buffer = NULL; + size_t size; + + if (file == NULL) + error("failed to open file '%s' for reading: %s", filename, strerror(errno)); + + // get size + fseek(file, 0, SEEK_END); + size = ftell(file); + + // if the file is empty, return NULL buffer and 0 size + if (size != 0) { + // allocate buffer + buffer = malloc(size + 1); + if (buffer == NULL) + error("could not allocate buffer for file '%s'", filename); + + // read file + fseek(file, 0, SEEK_SET); + if (fread(buffer, size, 1, file) != 1) + error("error reading from file '%s': %s", filename, strerror(errno)); + + // null-terminate the buffer (in case of text files) + ((char *)buffer)[size] = '\0'; + } + + fclose(file); + + if (size_out != NULL) + *size_out = size; + return buffer; +} + +void +util_write_whole_file(const char *filename, const void *data, size_t size) +{ + FILE *file = fopen(filename, "wb"); + + if (file == NULL) + error("failed to open file '%s' for writing: %s", filename, strerror(errno)); + + if (fwrite(data, size, 1, file) != 1) + error("error writing to file '%s': %s", filename, strerror(errno)); + + fclose(file); +} + +bool +str_is_c_identifier(const char *str) +{ + // A C language identifier must: + // - ONLY contain [_, abc..xyz, ABC..XYZ, 0..9] (we do not support unicode or extensions like $) + // - NOT be a keyword + // - NOT start with a digit [0..9] + + static const char *const c_kwds[] = { + "auto", "break", "case", "char", "const", "continue", "default", "do", + "double", "else", "enum", "extern", "float", "for", "goto", "if", + "inline", "int", "long", "register", "restrict", "return", "short", "signed", + "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned", "void", + "volatile", "while", + + "_Alignas", "_Alignof", "_Atomic", "_Bool", "_Complex", "_Generic", "_Imaginary", "_Noreturn", + "_Static_assert", "_Thread_local", + }; + + if (str == NULL) { + return false; + } + if (isdigit(str[0])) { + // Starts with a digit, fail + return false; + } + + size_t len = strlen(str); + for (size_t i = 0; i < len; i++) { + char c = str[i]; + + bool alpha = isalpha(c); + bool digit = isdigit(c); + bool uscore = c == '_'; + + if (!(alpha || digit || uscore)) { + // Contains bad character, fail + return false; + } + } + + for (size_t i = 0; i < ARRAY_COUNT(c_kwds); i++) { + if (strequ(str, c_kwds[i])) { + // Matched a C keyword, fail + return false; + } + } + return true; +} diff --git a/tools/audio/util.h b/tools/audio/util.h new file mode 100644 index 0000000000..69a877f602 --- /dev/null +++ b/tools/audio/util.h @@ -0,0 +1,72 @@ +/* SPDX-FileCopyrightText: Copyright (C) 2024 ZeldaRET */ +/* SPDX-License-Identifier: CC0-1.0 */ +#ifndef UTIL_H_ +#define UTIL_H_ + +#include +#include +#include + +// Endian + +#if defined(__linux__) || defined(__CYGWIN__) +#include +#elif defined(__APPLE__) +#include + +#define htobe16(x) OSSwapHostToBigInt16(x) +#define htole16(x) OSSwapHostToLittleInt16(x) +#define be16toh(x) OSSwapBigToHostInt16(x) +#define le16toh(x) OSSwapLittleToHostInt16(x) + +#define htobe32(x) OSSwapHostToBigInt32(x) +#define htole32(x) OSSwapHostToLittleInt32(x) +#define be32toh(x) OSSwapBigToHostInt32(x) +#define le32toh(x) OSSwapLittleToHostInt32(x) + +#define htobe64(x) OSSwapHostToBigInt64(x) +#define htole64(x) OSSwapHostToLittleInt64(x) +#define be64toh(x) OSSwapBigToHostInt64(x) +#define le64toh(x) OSSwapLittleToHostInt64(x) +#else +#error "Endian conversion unsupported, add it" +#endif + +// Attribute macros + +#define ALWAYS_INLINE inline __attribute__((always_inline)) + +#define NORETURN __attribute__((noreturn)) +#define UNUSED __attribute__((unused)) + +// Helper macros + +#define strequ(s1, s2) ((__builtin_constant_p(s2) ? strncmp(s1, s2, sizeof(s2) - 1) : strcmp(s1, s2)) == 0) + +#define str_endswith(str, len, endswith) \ + ((len) > (sizeof(endswith) - 1) && strequ(&(str)[(len) - sizeof(endswith) + 1], (endswith))) + +#define LL_FOREACH(type, x, base) for (type(x) = (base); (x) != NULL; (x) = (x)->next) + +#define ARRAY_COUNT(arr) (sizeof(arr) / sizeof((arr)[0])) + +#define ALIGN16(x) (((x) + 0xF) & ~0xF) + +#define BOOL_STR(b) ((b) ? "true" : "false") + +// util.c functions + +__attribute__((format(printf, 1, 2))) NORETURN void +error(const char *fmt, ...); +__attribute__((format(printf, 1, 2))) void +warning(const char *fmt, ...); + +void * +util_read_whole_file(const char *filename, size_t *size_out); +void +util_write_whole_file(const char *filename, const void *data, size_t size); + +bool +str_is_c_identifier(const char *str); + +#endif diff --git a/tools/audio/xml.c b/tools/audio/xml.c new file mode 100644 index 0000000000..3df2c60a80 --- /dev/null +++ b/tools/audio/xml.c @@ -0,0 +1,393 @@ +/** + * SPDX-FileCopyrightText: Copyright (C) 2024 ZeldaRET + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#include +#include +#include +#include +#include + +#include "xml.h" +#include "util.h" + +#define copy_out(out, v) memcpy((out), &(v), sizeof(v)); + +/** + * Parse a string as an integer. + * + * The expected value matches case-insensitive regex `^\s*[-+]?(0x[0-9A-F]+|[0-9]+)\s*$`. + * The value may be base 10, or base 16 with a (case-insensitive) 0x prefix. + * Leading and trailing whitespace is ignored. + */ +static int +xml_str_to_int(const char *value) +{ + if (value == NULL || value[0] == '\0') + goto err; + + bool neg = false; + int res; + + size_t value_len = strlen(value); + size_t start; + + // consume initial whitespace + for (start = 0; start < value_len; start++) { + if (!isspace(value[start])) + break; + } + // if we consumed the whole string, it was bad + if (start == value_len) + goto err; + + // handle sign character if present + if (value[start] == '+' || value[start] == '-') { + neg = value[start] == '-'; + start++; + } + + int base; + + // get absolute value in either base 10 or 16 + if (start + 2 < value_len && value[start + 0] == '0' && tolower(value[start + 1]) == 'x') { + start += 2; + base = 16; + } else { + base = 10; + } + + char *str_end; + res = strtol(&value[start], &str_end, base); + size_t end = str_end - value; + if (start == end) + goto err; + + // consume trailing whitespace + while (value[end] != '\0') { + if (!isspace(value[end])) + goto err; + end++; + } + + assert(end == value_len); + + // apply sign + return neg ? -res : res; +err: + error("bad int value %s", value); +} + +void +xml_parse_int(const char *value, void *out) +{ + int v = xml_str_to_int(value); + + copy_out(out, v); +} + +void +xml_parse_uint(const char *value, void *out) +{ + int v = xml_str_to_int(value); + if (v < 0) + error("Value should be unsigned"); + + copy_out(out, v); +} + +void +xml_parse_s16(const char *value, void *out) +{ + int v = xml_str_to_int(value); + if (v < INT16_MIN || v > INT16_MAX) + error("Value %d out of range for s16", v); + int16_t vs16 = v; + + copy_out(out, vs16); +} + +void +xml_parse_u8(const char *value, void *out) +{ + int v = xml_str_to_int(value); + if (v < 0 || v > UINT8_MAX) + error("Value %d out of range for u8", v); + uint8_t vu8 = v; + + copy_out(out, vu8); +} + +void +xml_parse_s8(const char *value, void *out) +{ + int v = xml_str_to_int(value); + if (v < INT8_MIN || v > INT8_MAX) + error("Value %d out of range for s8", v); + int8_t vs8 = v; + + copy_out(out, vs8); +} + +/** + * Parse a note number name to its s8 [0;127] value. + * For example "PITCH_EF4" -> 42. + */ +void +xml_parse_note_number(const char *value, void *out) +{ + size_t value_len = strlen(value); + int8_t vs8; + char c; + + if (value_len == 0) + goto err; + + // consume initial whitespace + size_t start; + for (start = 0; start < value_len; start++) { + if (!isspace(value[start])) + break; + } + // if we consumed the whole string, it was bad + if (start == value_len) + goto err; + + c = toupper(value[start]); + + if (c >= 'A' && c <= 'G') { + start++; + + // got a note number + static const int8_t notes_lut[] = { + /* A */ 12, + /* B */ 14, + /* C */ 3, + /* D */ 5, + /* E */ 7, + /* F */ 8, + /* G */ 10, + }; + char cm = toupper(value[start]); + int mod = 0; + int v; + + if (value_len > start && (cm == 'F' || cm == 'S')) { + // handle flat/sharp modifier + mod = (cm == 'S') ? 1 : -1; + start++; + } + + if (start == value_len) + goto err; + + bool neg = false; + int res; + + // if value starts with NEG (ignoring case) + if (start + 3 <= value_len && toupper(value[start + 0]) == 'N' && toupper(value[start + 1]) == 'E' && + toupper(value[start + 2]) == 'G') { + neg = true; + start += 3; + } + + int base = 10; + + char *str_end; + res = strtol(&value[start], &str_end, base); + size_t end = str_end - value; + if (start == end) + goto err; + + // consume trailing whitespace + while (value[end] != '\0') { + if (!isspace(value[end])) + goto err; + end++; + } + + assert(end == value_len); + + // apply sign + v = neg ? -res : res; + + if (v < -1 || v > 10) + error("Value %d out of range for note number", v); + + vs8 = (v - 1) * 12 + notes_lut[c - 'A'] + mod; + if (vs8 < 0) + vs8 += 128; + } else { // got a raw value + vs8 = xml_str_to_int(&value[start]); + } + + if (vs8 < 0) + goto err; + + copy_out(out, vs8); + return; +err: + error("Invalid note %s", value); +} + +void +xml_parse_string(const char *value, void *out) +{ + // copies only the pointer to the string + copy_out(out, value); +} + +void +xml_parse_c_identifier(const char *value, void *out) +{ + if (!str_is_c_identifier(value)) + error("Input %s is not a valid C Language identifier", value); + + // copies only the pointer to the string + copy_out(out, value); +} + +void +xml_parse_bool(const char *value, void *out) +{ + bool v; + + // TODO make case-insensitive + if (strequ(value, "true")) + v = true; + else if (strequ(value, "false")) + v = false; + else + error("Invalid value %s for bool", value); + + copy_out(out, v); +} + +void +xml_parse_float(const char *value, void *out) +{ + char *end; + float v = strtof(value, &end); + + if (value == end) + error("Invalid value %s for float", value); + if (v < 0.0f) + error("Only positive floats are allowed"); + + copy_out(out, v); +} + +void +xml_parse_double(const char *value, void *out) +{ + char *end; + double v = strtod(value, &end); + + if (value == end) + error("Invalid value %s for double", value); + if (v < 0.0) + error("Only positive doubles are allowed"); + + copy_out(out, v); +} + +void +xml_get_single_property(void *out, const xmlNodePtr node, const char *name, xml_parser_func parser) +{ + xmlAttrPtr attr = node->properties; + + if (attr == NULL || attr->next != NULL) + error("Expected only property %s on line %d", name, node->line); + + const char *prop_name = XMLSTR_TO_STR(attr->name); + + if (!strequ(prop_name, name)) + error("Unexpected attribute on line %d: got: \"%s\", expected: \"%s\"", node->line, prop_name, name); + + xmlChar *xvalue = xmlNodeListGetString(node->doc, attr->children, 1); + const char *value = XMLSTR_TO_STR(xvalue); + + parser(value, (uint8_t *)out); + + if (parser != xml_parse_string && parser != xml_parse_c_identifier) + free(xvalue); +} + +void +xml_parse_node_by_spec(void *out, const xmlNodePtr node, const xml_attr_spec spec, size_t spec_length) +{ + bool *got = alloca(spec_length * sizeof(bool)); + memset(got, false, spec_length * sizeof(bool)); + + LL_FOREACH(xmlAttrPtr, attr, node->properties) { + const char *name = XMLSTR_TO_STR(attr->name); + bool found = false; + + for (size_t i = 0; i < spec_length; i++) { + if (strequ(name, spec[i].name)) { + // strictly speaking this pointer needs to be freed but we may want to save the string itself + // so we just don't free it and let it clean up when the program terminates + xmlChar *xvalue = xmlNodeListGetString(node->doc, attr->children, 1); + const char *value = XMLSTR_TO_STR(xvalue); + + spec[i].parser_func(value, (uint8_t *)out + spec[i].offset); + + if (spec[i].parser_func != xml_parse_string && spec[i].parser_func != xml_parse_c_identifier) + free(xvalue); // free when we don't need the string in the future, TODO strdup when we do need it? + + got[i] = true; + found = true; + break; + } + } + + if (!found) + error("Unrecognized attribute %s on line %d", name, node->line); + } + + for (size_t i = 0; i < spec_length; i++) { + if (!spec[i].optional && !got[i]) + error("Expected a %s attribute on line %d", spec[i].name, node->line); + } +} + +static void +xml_print_rec(xmlNodePtr base, int *pIndent) +{ + LL_FOREACH(xmlNodePtr, node, base) { + if (node->type != XML_ELEMENT_NODE) + continue; + + fprintf(stdout, "%*cChild is <%s> (%i)\n", *pIndent, ' ', node->name, node->type); + *pIndent += 4; + + LL_FOREACH(xmlAttrPtr, attr, node->properties) { + xmlChar *value = xmlNodeListGetString(node->doc, attr->children, 1); + fprintf(stdout, "%*c- Property <%s> \"%s\"\n", *pIndent, ' ', attr->name, XMLSTR_TO_STR(value)); + free(value); + } + + xml_print_rec(node->children, pIndent); + *pIndent -= 4; + } +} + +void +xml_print_tree(xmlDocPtr document) +{ + xmlNodePtr root = xmlDocGetRootElement(document); + int indent = 4; + fprintf(stdout, "Root is <%s> (%i)\n", root->name, root->type); + + LL_FOREACH(xmlAttrPtr, attr, root->properties) { + xmlChar *value = xmlNodeListGetString(root->doc, attr->children, 1); + fprintf(stdout, "%*c- Property <%s> \"%s\"\n", indent, ' ', attr->name, XMLSTR_TO_STR(value)); + free(value); + } + + xml_print_rec(root->children, &indent); +} diff --git a/tools/audio/xml.h b/tools/audio/xml.h new file mode 100644 index 0000000000..dabfbcfefe --- /dev/null +++ b/tools/audio/xml.h @@ -0,0 +1,61 @@ +/** + * SPDX-FileCopyrightText: Copyright (C) 2024 ZeldaRET + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#ifndef XML_H +#define XML_H + +#include +#include +#include + +#include + +#define XMLSTR_TO_STR(s) ((const char *)(s)) + +typedef void (*xml_parser_func)(const char *, void *); + +typedef struct { + const char *name; + bool optional; + xml_parser_func parser_func; + size_t offset; +} xml_attr_spec[]; + +void +xml_parse_int(const char *value, void *out); +void +xml_parse_uint(const char *value, void *out); +void +xml_parse_s16(const char *value, void *out); +void +xml_parse_u8(const char *value, void *out); +void +xml_parse_s8(const char *value, void *out); +void +xml_parse_note_number(const char *value, void *out); +void +xml_parse_string(const char *value, void *out); +void +xml_parse_c_identifier(const char *value, void *out); +void +xml_parse_bool(const char *value, void *out); +void +xml_parse_float(const char *value, void *out); +void +xml_parse_double(const char *value, void *out); + +void +xml_get_single_property(void *out, const xmlNodePtr node, const char *name, xml_parser_func parser); + +void +xml_parse_node_by_spec(void *out, const xmlNodePtr node, const xml_attr_spec spec, size_t spec_length); + +void +xml_print_tree(xmlDocPtr document); + +#endif From fda0e6ad4badc0eea701934b80354de4ab5cad98 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 15 Aug 2024 04:05:41 +0200 Subject: [PATCH 12/33] [ntsc-1.2] Match z_construct.c, z_draw.c, z_kaleido_setup.c and partially z_actor.c (#2039) * func_80033C30 * Interface_Init * z_draw.c * KaleidoSetup_Destroy , n64dd.h * z_kaleido_setup.c * add n64dd files to spec according to tools/disasm/ntsc-1.2/files_code.csv , they're between irqmgr.o and fault.o putting them before or after malloc_debug.o in the spec is an arbitrary choice --- include/n64dd.h | 12 ++++++++++++ include/z64interface.h | 22 +++++++++++++++++++++- spec | 4 ++++ src/code/code_n64dd_800AD4C0.c | 2 ++ src/code/z_actor.c | 2 -- src/code/z_construct.c | 16 ++++++++++------ src/code/z_draw.c | 24 ++++++++++++------------ src/code/z_kaleido_setup.c | 21 +++++++++++++++++++++ 8 files changed, 82 insertions(+), 21 deletions(-) create mode 100644 include/n64dd.h diff --git a/include/n64dd.h b/include/n64dd.h new file mode 100644 index 0000000000..d35311a123 --- /dev/null +++ b/include/n64dd.h @@ -0,0 +1,12 @@ +#ifndef N64DD_H +#define N64DD_H + +typedef struct n64ddStruct_80121AF0 { + char unk_00[0x3C]; + void (*unk_3C)(void); + void (*unk_40)(void); +} n64ddStruct_80121AF0; // size = ? + +extern n64ddStruct_80121AF0* B_80121AF0; + +#endif diff --git a/include/z64interface.h b/include/z64interface.h index e3b533970f..ba8630ab3f 100644 --- a/include/z64interface.h +++ b/include/z64interface.h @@ -144,14 +144,34 @@ typedef struct InterfaceContext { } InterfaceContext; // size = 0x270 /** - * Button HUD Positions (Upper Left) + * Button HUD positions and colors */ #define A_BUTTON_X 186 #define A_BUTTON_Y 9 +#if PLATFORM_N64 +#define A_BUTTON_R 90 +#define A_BUTTON_G 90 +#define A_BUTTON_B 255 +#else +#define A_BUTTON_R 0 +#define A_BUTTON_G 200 +#define A_BUTTON_B 50 +#endif + #define B_BUTTON_X 160 #define B_BUTTON_Y 17 +#if PLATFORM_N64 +#define B_BUTTON_R 0 +#define B_BUTTON_G 150 +#define B_BUTTON_B 0 +#else +#define B_BUTTON_R 255 +#define B_BUTTON_G 30 +#define B_BUTTON_B 30 +#endif + #define C_LEFT_BUTTON_X 227 #define C_LEFT_BUTTON_Y 18 diff --git a/spec b/spec index 83eefc5c6f..c821e8b298 100644 --- a/spec +++ b/spec @@ -480,6 +480,10 @@ beginseg include "$(BUILD_DIR)/src/code/sys_rumble.o" include "$(BUILD_DIR)/src/code/code_800D31A0.o" include "$(BUILD_DIR)/src/code/irqmgr.o" +#if PLATFORM_N64 + include "$(BUILD_DIR)/src/code/code_n64dd_800AD410.o" + include "$(BUILD_DIR)/src/code/code_n64dd_800AD4C0.o" +#endif #if OOT_DEBUG include "$(BUILD_DIR)/src/code/debug_malloc.o" #endif diff --git a/src/code/code_n64dd_800AD4C0.c b/src/code/code_n64dd_800AD4C0.c index 8b13789179..f75d79f5ef 100644 --- a/src/code/code_n64dd_800AD4C0.c +++ b/src/code/code_n64dd_800AD4C0.c @@ -1 +1,3 @@ +#include "n64dd.h" +n64ddStruct_80121AF0* B_80121AF0; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index cde373de56..89dd9400c7 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3685,8 +3685,6 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 8120); - if (0) {} // Necessary to match - POLY_OPA_DISP = Gfx_SetupDL(POLY_OPA_DISP, SETUPDL_44); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, alpha); diff --git a/src/code/z_construct.c b/src/code/z_construct.c index f9bfa5efdc..a7bd1a6583 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -177,16 +177,20 @@ void Interface_Init(PlayState* play) { interfaceCtx->unk_23C = interfaceCtx->unk_242 = 0; R_ITEM_BTN_X(0) = B_BUTTON_X; - R_B_BTN_COLOR(0) = 255; - R_B_BTN_COLOR(1) = 30; - R_B_BTN_COLOR(2) = 30; + + R_B_BTN_COLOR(0) = B_BUTTON_R; + R_B_BTN_COLOR(1) = B_BUTTON_G; + R_B_BTN_COLOR(2) = B_BUTTON_B; + R_ITEM_ICON_X(0) = B_BUTTON_X; R_ITEM_AMMO_X(0) = B_BUTTON_X + 2; + R_A_BTN_X = A_BUTTON_X; R_A_ICON_X = A_BUTTON_X; - R_A_BTN_COLOR(0) = 0; - R_A_BTN_COLOR(1) = 200; - R_A_BTN_COLOR(2) = 50; + + R_A_BTN_COLOR(0) = A_BUTTON_R; + R_A_BTN_COLOR(1) = A_BUTTON_G; + R_A_BTN_COLOR(2) = A_BUTTON_B; } #define TEXTBOX_SEGMENT_SIZE \ diff --git a/src/code/z_draw.c b/src/code/z_draw.c index d6d9886768..b4ecd2ffaf 100644 --- a/src/code/z_draw.c +++ b/src/code/z_draw.c @@ -519,14 +519,14 @@ void GetItem_DrawSkullToken(PlayState* play, s16 drawId) { } void GetItem_DrawEggOrMedallion(PlayState* play, s16 drawId) { - s32 pad; + DrawItemTableEntry* entry = &sDrawItemTable[drawId]; OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 772); Gfx_SetupDL_26Opa(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_draw.c", 776), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(POLY_OPA_DISP++, entry->dlists[0]); + gSPDisplayList(POLY_OPA_DISP++, entry->dlists[1]); CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 783); } @@ -664,14 +664,14 @@ void GetItem_DrawOpa0Xlu1(PlayState* play, s16 drawId) { } void GetItem_DrawXlu01(PlayState* play, s16 drawId) { - s32 pad; + DrawItemTableEntry* entry = &sDrawItemTable[drawId]; OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 998); Gfx_SetupDL_25Xlu(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_draw.c", 1002), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); - gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(POLY_XLU_DISP++, entry->dlists[0]); + gSPDisplayList(POLY_XLU_DISP++, entry->dlists[1]); CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1008); } @@ -801,20 +801,20 @@ void GetItem_DrawScale(PlayState* play, s16 drawId) { } void GetItem_DrawBulletBag(PlayState* play, s16 drawId) { - s32 pad; + DrawItemTableEntry* entry = &sDrawItemTable[drawId]; OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1188); Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_draw.c", 1192), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); - gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(POLY_OPA_DISP++, entry->dlists[1]); + gSPDisplayList(POLY_OPA_DISP++, entry->dlists[0]); Gfx_SetupDL_25Xlu(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_draw.c", 1200), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); - gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]); - gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[4]); + gSPDisplayList(POLY_XLU_DISP++, entry->dlists[2]); + gSPDisplayList(POLY_XLU_DISP++, entry->dlists[3]); + gSPDisplayList(POLY_XLU_DISP++, entry->dlists[4]); CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1207); } diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 3148d6fb58..1f4f2d2cda 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -1,4 +1,7 @@ #include "global.h" +#if PLATFORM_N64 +#include "n64dd.h" +#endif /* * The following three arrays are effectively unused. @@ -57,6 +60,9 @@ f32 sKaleidoSetupRightPageEyeZ[] = { void KaleidoSetup_Update(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; Input* input = &play->state.input[0]; +#if PLATFORM_N64 + s32 pad; +#endif if (!IS_PAUSED(pauseCtx) && play->gameOverCtx.state == GAMEOVER_INACTIVE && play->transitionTrigger == TRANS_TRIGGER_OFF && play->transitionMode == TRANS_MODE_OFF && @@ -169,7 +175,22 @@ void KaleidoSetup_Init(PlayState* play) { pauseCtx->cursorSpecialPos = 0; View_Init(&pauseCtx->view, play->state.gfxCtx); + +#if PLATFORM_N64 + if (B_80121AF0 != NULL) { + if (B_80121AF0->unk_3C != NULL) { + B_80121AF0->unk_3C(); + } + } +#endif } void KaleidoSetup_Destroy(PlayState* play) { +#if PLATFORM_N64 + if (B_80121AF0 != NULL) { + if (B_80121AF0->unk_40 != NULL) { + B_80121AF0->unk_40(); + } + } +#endif } From 1649bf32d64523ba79f6896d2b9c816a9cd20e77 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 15 Aug 2024 04:13:23 +0200 Subject: [PATCH 13/33] padutils.c, line numbers (#2040) --- src/boot/z_std_dma.c | 4 ++++ src/code/graph.c | 10 ++++++++++ src/code/padmgr.c | 4 ++++ src/code/padutils.c | 14 ++++++++++++++ 4 files changed, 32 insertions(+) diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 5fe82a1859..6b5211432e 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -581,7 +581,11 @@ void DmaMgr_Init(void) { PRINTF("_bootSegmentRomStart(%08x) != dma_rom_ad[0].rom_b(%08x)\n", _bootSegmentRomStart, gDmaDataTable[0].file.vromEnd); //! @bug The main code file where fault.c resides is not yet loaded +#if PLATFORM_N64 + Fault_AddHungupAndCrash("../z_std_dma.c", 840); +#else Fault_AddHungupAndCrash("../z_std_dma.c", 1055); +#endif } // Start the DMA manager diff --git a/src/code/graph.c b/src/code/graph.c index 3e5df91458..8ebad9d4ef 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -366,14 +366,22 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { PRINTF("%c", BEL); // "Dynamic area head is destroyed" PRINTF(VT_COL(RED, WHITE) "ダイナミック領域先頭が破壊されています\n" VT_RST); +#if PLATFORM_N64 + Fault_AddHungupAndCrash("../graph.c", 951); +#else Fault_AddHungupAndCrash("../graph.c", 1070); +#endif } if (pool->tailMagic != GFXPOOL_TAIL_MAGIC) { problem = true; PRINTF("%c", BEL); // "Dynamic region tail is destroyed" PRINTF(VT_COL(RED, WHITE) "ダイナミック領域末尾が破壊されています\n" VT_RST); +#if PLATFORM_N64 + Fault_AddHungupAndCrash("../graph.c", 957); +#else Fault_AddHungupAndCrash("../graph.c", 1076); +#endif } } @@ -465,6 +473,8 @@ void Graph_ThreadEntry(void* arg0) { sprintf(faultMsg, "CLASS SIZE= %d bytes", size); Fault_AddHungupAndCrashImpl("GAME CLASS MALLOC FAILED", faultMsg); +#elif PLATFORM_N64 + Fault_AddHungupAndCrash("../graph.c", 1081); #else Fault_AddHungupAndCrash("../graph.c", 1200); #endif diff --git a/src/code/padmgr.c b/src/code/padmgr.c index 74ca9bd4f6..2d2b91eb9d 100644 --- a/src/code/padmgr.c +++ b/src/code/padmgr.c @@ -334,7 +334,11 @@ void PadMgr_UpdateInputs(PadMgr* padMgr) { default: // Unknown error response LOG_HEX("padnow1->errno", pad->errno, "../padmgr.c", 396); +#if PLATFORM_N64 + Fault_AddHungupAndCrash("../padmgr.c", 382); +#else Fault_AddHungupAndCrash("../padmgr.c", 397); +#endif break; } diff --git a/src/code/padutils.c b/src/code/padutils.c index 2f0f571620..7a0407ef96 100644 --- a/src/code/padutils.c +++ b/src/code/padutils.c @@ -9,6 +9,10 @@ void func_800FCB70(void) { void PadUtils_ResetPressRel(Input* input) { input->press.button = 0; +#if PLATFORM_N64 + input->press.stick_x = 0; + input->press.stick_y = 0; +#endif input->rel.button = 0; } @@ -65,6 +69,16 @@ s8 PadUtils_GetRelY(Input* input) { return PadUtils_GetRelYImpl(input); } +#if PLATFORM_N64 +s8 PadUtils_GetPressX(Input* input) { + return input->press.stick_x; +} + +s8 PadUtils_GetPressY(Input* input) { + return input->press.stick_y; +} +#endif + void PadUtils_UpdateRelXY(Input* input) { s32 curX = PadUtils_GetCurX(input); s32 curY = PadUtils_GetCurY(input); From 70716be96d1ede6b11eef078d205678ee5a422bf Mon Sep 17 00:00:00 2001 From: cadmic Date: Wed, 14 Aug 2024 20:39:34 -0700 Subject: [PATCH 14/33] Build all GC retail ROMs in Jenkins (#2027) * Build all GC retail ROMs in Jenkins * Delete progress tracking Doesn't play nicely with deleting extracted/ and build/ after each version, and it currently serves no purpose * Update Jenkinsfile Co-authored-by: Dragorn421 * Reorder ROMs * Symlink ROMs instead of copying --------- Co-authored-by: Dragorn421 --- Jenkinsfile | 89 ++++++++++++++++++------------ progress.py | 153 ---------------------------------------------------- 2 files changed, 54 insertions(+), 188 deletions(-) delete mode 100755 progress.py diff --git a/Jenkinsfile b/Jenkinsfile index 2566f13e3d..e8934a557f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,52 +24,71 @@ pipeline { sh 'python3 tools/check_format.py --verbose --compare-to origin/main' } } - stage('Setup gc-eu-mq-dbg') { + // The ROMs are built in an order that maximizes compiler flags coverage in a "fail fast" approach. + // Specifically we start with a retail ROM for BSS ordering, and make sure we cover all of + // NTSC/PAL/MQ/DEBUG as quickly as possible. + stage('Build gc-jp') { steps { - sh 'cp /usr/local/etc/roms/oot-gc-eu-mq-dbg.z64 baseroms/gc-eu-mq-dbg/baserom.z64' - sh 'make -j setup' - } - } - stage('Build gc-eu-mq-dbg') { - steps { - sh 'make -j RUN_CC_CHECK=0' - } - } - stage('Setup gc-eu-mq') { - steps { - sh 'cp /usr/local/etc/roms/oot-gc-eu-mq.z64 baseroms/gc-eu-mq/baserom.z64' - sh 'make -j setup VERSION=gc-eu-mq' + sh 'ln -s /usr/local/etc/roms/oot-gc-jp.z64 baseroms/gc-jp/baserom.z64' + sh 'make -j setup VERSION=gc-jp' + sh 'make -j RUN_CC_CHECK=0 VERSION=gc-jp' + sh 'make clean assetclean VERSION=gc-jp' } } stage('Build gc-eu-mq') { steps { - sh 'make -j VERSION=gc-eu-mq RUN_CC_CHECK=0' + sh 'ln -s /usr/local/etc/roms/oot-gc-eu-mq.z64 baseroms/gc-eu-mq/baserom.z64' + sh 'make -j setup VERSION=gc-eu-mq' + sh 'make -j RUN_CC_CHECK=0 VERSION=gc-eu-mq' + sh 'make clean assetclean VERSION=gc-eu-mq' } } - stage('Report Progress') { - when { - branch 'main' - } + stage('Build gc-eu-mq-dbg') { steps { - sh 'mkdir reports' - sh 'python3 progress.py csv >> reports/progress-oot-nonmatching.csv' - sh 'python3 progress.py csv -m >> reports/progress-oot-matching.csv' - sh 'python3 progress.py shield-json > reports/progress-oot-shield.json' - stash includes: 'reports/*', name: 'reports' + sh 'ln -s /usr/local/etc/roms/oot-gc-eu-mq-dbg.z64 baseroms/gc-eu-mq-dbg/baserom.z64' + sh 'make -j setup VERSION=gc-eu-mq-dbg' + sh 'make -j RUN_CC_CHECK=0 VERSION=gc-eu-mq-dbg' + sh 'make clean assetclean VERSION=gc-eu-mq-dbg' } } - stage('Update Progress') { - when { - branch 'main' - } - agent { - label 'zeldaret_website' - } + stage('Build gc-us') { steps { - unstash 'reports' - sh 'cat reports/progress-oot-nonmatching.csv >> /var/www/zelda64.dev/assets/csv/progress-oot-nonmatching.csv' - sh 'cat reports/progress-oot-matching.csv >> /var/www/zelda64.dev/assets/csv/progress-oot-matching.csv' - sh 'cat reports/progress-oot-shield.json > /var/www/zelda64.dev/assets/csv/progress-oot-shield.json' + sh 'ln -s /usr/local/etc/roms/oot-gc-us.z64 baseroms/gc-us/baserom.z64' + sh 'make -j setup VERSION=gc-us' + sh 'make -j RUN_CC_CHECK=0 VERSION=gc-us' + sh 'make clean assetclean VERSION=gc-us' + } + } + stage('Build gc-jp-ce') { + steps { + sh 'ln -s /usr/local/etc/roms/oot-gc-jp-ce.z64 baseroms/gc-jp-ce/baserom.z64' + sh 'make -j setup VERSION=gc-jp-ce' + sh 'make -j RUN_CC_CHECK=0 VERSION=gc-jp-ce' + sh 'make clean assetclean VERSION=gc-jp-ce' + } + } + stage('Build gc-eu') { + steps { + sh 'ln -s /usr/local/etc/roms/oot-gc-eu.z64 baseroms/gc-eu/baserom.z64' + sh 'make -j setup VERSION=gc-eu' + sh 'make -j RUN_CC_CHECK=0 VERSION=gc-eu' + sh 'make clean assetclean VERSION=gc-eu' + } + } + stage('Build gc-jp-mq') { + steps { + sh 'ln -s /usr/local/etc/roms/oot-gc-jp-mq.z64 baseroms/gc-jp-mq/baserom.z64' + sh 'make -j setup VERSION=gc-jp-mq' + sh 'make -j RUN_CC_CHECK=0 VERSION=gc-jp-mq' + sh 'make clean assetclean VERSION=gc-jp-mq' + } + } + stage('Build gc-us-mq') { + steps { + sh 'ln -s /usr/local/etc/roms/oot-gc-us-mq.z64 baseroms/gc-us-mq/baserom.z64' + sh 'make -j setup VERSION=gc-us-mq' + sh 'make -j RUN_CC_CHECK=0 VERSION=gc-us-mq' + sh 'make clean assetclean VERSION=gc-us-mq' } } } diff --git a/progress.py b/progress.py deleted file mode 100755 index 0556ae6f77..0000000000 --- a/progress.py +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import json -import git -import os -import re - -parser = argparse.ArgumentParser(description="Computes current progress throughout the whole project.") -parser.add_argument("format", nargs="?", default="text", choices=["text", "csv", "shield-json"]) -parser.add_argument("-m", "--matching", dest='matching', action='store_true', - help="Output matching progress instead of decompilation progress") -args = parser.parse_args() - -NON_MATCHING_PATTERN = r"#ifdef\s+NON_MATCHING.*?#pragma\s+GLOBAL_ASM\s*\(\s*\"(.*?)\"\s*\).*?#endif" - -def GetNonMatchingFunctions(files): - functions = [] - - for file in files: - with open(file) as f: - functions += re.findall(NON_MATCHING_PATTERN, f.read(), re.DOTALL) - - return functions - -def ReadAllLines(fileName): - lineList = list() - with open(fileName) as f: - lineList = f.readlines() - - return lineList - -def GetFiles(path, ext): - files = [] - - for r, d, f in os.walk(path): - for file in f: - if file.endswith(ext): - files.append(os.path.join(r, file)) - - return files - -nonMatchingFunctions = GetNonMatchingFunctions(GetFiles("src", ".c")) if not args.matching else [] - -def GetNonMatchingSize(path): - size = 0 - - asmFiles = GetFiles(path, ".s") - - for asmFilePath in asmFiles: - if asmFilePath not in nonMatchingFunctions: - asmLines = ReadAllLines(asmFilePath) - - for asmLine in asmLines: - if (asmLine.startswith("/*")): - size += 4 - - return size - -def IsCFile(objfile): - srcfile = objfile.strip().replace("build/gc-eu-mq-dbg/", "").replace(".o", ".c") - return os.path.isfile(srcfile) - -mapFile = ReadAllLines("build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.map") -curSegment = None -src = 0 -code = 0 -boot = 0 -ovl = 0 - -for line in mapFile: - - if "_codeSegmentStart" in line: - curSegment = "code" - elif "_bootSegmentStart" in line: - curSegment = "boot" - elif "_codeSegmentEnd" in line or "_bootSegmentEnd" in line: - curSegment = None - - lineSplit = list(filter(None, line.split(" "))) - - if (len(lineSplit) == 4 and lineSplit[0].startswith(".")): - section = lineSplit[0] - size = int(lineSplit[2], 16) - objFile = lineSplit[3] - - if (section == ".text" and IsCFile(objFile)): - if objFile.startswith("build/gc-eu-mq-dbg/src"): - src += size - - if curSegment == "code": - code += size - elif curSegment == "boot": - boot += size - else: - ovl += size - -nonMatchingASM = GetNonMatchingSize("asm/non_matchings") -nonMatchingASMBoot = GetNonMatchingSize("asm/non_matchings/boot") -nonMatchingASMCode = GetNonMatchingSize("asm/non_matchings/code") -nonMatchingASMOvl = GetNonMatchingSize("asm/non_matchings/overlays") - -src -= nonMatchingASM -code -= nonMatchingASMCode -boot -= nonMatchingASMBoot -ovl -= nonMatchingASMOvl - -bootSize = 31408 # decompilable code only -codeSize = 999984 # decompilable code only -ovlSize = 2812000 # .text sections - -total = src + nonMatchingASM -srcPct = 100 * src / total -codePct = 100 * code / codeSize -bootPct = 100 * boot / bootSize -ovlPct = 100 * ovl / ovlSize - -bytesPerHeartPiece = total // 80 - -if args.format == 'csv': - csv_version = 2 - git_object = git.Repo().head.object - timestamp = str(git_object.committed_date) - git_hash = git_object.hexsha - csv_list = [str(csv_version), timestamp, git_hash, str(src), str(total), str(code), str(codeSize), str(boot), str(bootSize), str(ovl), str(ovlSize), str(nonMatchingASM), str(len(nonMatchingFunctions))] - print(",".join(csv_list)) -elif args.format == 'shield-json': - # https://shields.io/endpoint - print(json.dumps({ - "schemaVersion": 1, - "label": "progress", - "message": f"{srcPct:.3g}%", - "color": 'yellow' if srcPct < 100 else 'brightgreen', - })) -elif args.format == 'text': - adjective = "decompiled" if not args.matching else "matched" - - print(str(total) + " total bytes of decompilable code\n") - print(str(src) + " bytes " + adjective + " in src " + str(srcPct) + "%\n") - print(str(boot) + "/" + str(bootSize) + " bytes " + adjective + " in boot " + str(bootPct) + "%\n") - print(str(code) + "/" + str(codeSize) + " bytes " + adjective + " in code " + str(codePct) + "%\n") - print(str(ovl) + "/" + str(ovlSize) + " bytes " + adjective + " in overlays " + str(ovlPct) + "%\n") - print("------------------------------------\n") - - heartPieces = int(src / bytesPerHeartPiece) - rupees = int(((src % bytesPerHeartPiece) * 100) / bytesPerHeartPiece) - - if (rupees > 0): - print("You have " + str(heartPieces) + "/80 heart pieces and " + str(rupees) + " rupee(s).\n") - else: - print("You have " + str(heartPieces) + "/80 heart pieces.\n") -else: - print("Unknown format argument: " + args.format) From 7fb9fbb4a2dc4a6e51d0035429e16440eaf27cdd Mon Sep 17 00:00:00 2001 From: cadmic Date: Thu, 15 Aug 2024 00:54:06 -0700 Subject: [PATCH 15/33] Match ntsc-1.2 z_skelanime.c, z_view.c, z_viszbuf.c (#2041) --- src/code/z_skelanime.c | 9 +++++---- src/code/z_view.c | 4 ++-- src/code/z_viszbuf.c | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index c7ea06fd51..6e43f2fb30 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -41,8 +41,6 @@ void SkelAnime_DrawLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3 } } - if (1) {} - if (postLimbDraw != NULL) { postLimbDraw(play, limbIndex, &dList, &rot, arg); } @@ -261,8 +259,6 @@ void SkelAnime_DrawLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3 } } - if (1) {} - if (postLimbDraw != NULL) { postLimbDraw(play, limbIndex, &dList, &rot, arg); } @@ -855,9 +851,14 @@ AnimTask* AnimTaskQueue_NewTask(AnimTaskQueue* animTaskQueue, s32 type) { return task; } +#if PLATFORM_N64 +#define LINK_ANIMATION_OFFSET(addr, offset) \ + (((uintptr_t)_link_animetionSegmentRomStart) + SEGMENT_OFFSET(addr) + (offset)) +#else #define LINK_ANIMATION_OFFSET(addr, offset) \ (((uintptr_t)_link_animetionSegmentRomStart) + ((uintptr_t)(addr)) - ((uintptr_t)_link_animetionSegmentStart) + \ (offset)) +#endif /** * Creates a task which will load a single frame of animation data from the link_animetion file. diff --git a/src/code/z_view.c b/src/code/z_view.c index 850979368d..31563b959a 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -142,8 +142,8 @@ void View_GetViewport(View* view, Viewport* viewport) { void View_ApplyLetterbox(View* view) { GraphicsContext* gfxCtx = view->gfxCtx; - s32 letterboxSize; s32 pillarboxSize; + s32 letterboxSize; s32 ulx; s32 uly; s32 lrx; @@ -400,9 +400,9 @@ s32 View_ApplyPerspective(View* view) { } s32 View_ApplyOrtho(View* view) { + GraphicsContext* gfxCtx = view->gfxCtx; Vp* vp; Mtx* projection; - GraphicsContext* gfxCtx = view->gfxCtx; OPEN_DISPS(gfxCtx, "../z_view.c", 726); diff --git a/src/code/z_viszbuf.c b/src/code/z_viszbuf.c index 3e9f15eb52..5a542bc124 100644 --- a/src/code/z_viszbuf.c +++ b/src/code/z_viszbuf.c @@ -66,6 +66,7 @@ void VisZBuf_Destroy(VisZBuf* this) { void VisZBuf_Draw(VisZBuf* this, Gfx** gfxP) { Gfx* gfx = *gfxP; + s32 pad; u16* zbufFrag = D_0E000000; s32 fmt; s32 y; From b734a159e380fd6de49094e5aecbaf7b6b0836c6 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 15 Aug 2024 22:07:22 +0200 Subject: [PATCH 16/33] Update links in readme (#2043) --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 4f04daffd9..b7e191a0d8 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ [jenkins]: https://jenkins.deco.mp/job/OOT/job/main [jenkins-badge]: https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fjenkins.deco.mp%2Fjob%2FOOT%2Fjob%2Fmain -[progress]: https://zelda64.dev/games/oot -[progress-badge]: https://img.shields.io/endpoint?url=https://zelda64.dev/assets/csv/progress-oot-shield.json +[progress]: https://zelda.deco.mp/games/oot +[progress-badge]: https://img.shields.io/endpoint?url=https://zelda.deco.mp/assets/csv/progress-oot-shield.json [contributors]: https://github.com/zeldaret/oot/graphs/contributors [contributors-badge]: https://img.shields.io/github/contributors/zeldaret/oot -[discord]: https://discord.zelda64.dev +[discord]: https://discord.zelda.deco.mp [discord-badge]: https://img.shields.io/discord/688807550715560050?color=%237289DA&logo=discord&logoColor=%23FFFFFF ```diff @@ -23,7 +23,7 @@ the codebase can drastically change at any time. Also note that some parts of th 'shiftable' yet, so modifying them could be difficult at this point. ``` -This is a WIP **decompilation** of ***The Legend of Zelda: Ocarina of Time***. The purpose of the project is to recreate a source code base for the game from scratch, using information found inside the game along with static and/or dynamic analysis. **It is not producing a PC port.** For more information you can get in touch with the team on our [Discord server](https://discord.zelda64.dev). +This is a WIP **decompilation** of ***The Legend of Zelda: Ocarina of Time***. The purpose of the project is to recreate a source code base for the game from scratch, using information found inside the game along with static and/or dynamic analysis. **It is not producing a PC port.** For more information you can get in touch with the team on our [Discord server][discord]. The only build currently supported is Master Quest (Debug), but other versions are planned to be supported. @@ -33,9 +33,9 @@ It builds the following ROM: **Note: This repository does not include any of the assets necessary to build the ROM. A prior copy of the game is required to extract the needed assets.** -**Website:** +**Website:** -**Discord:** +**Discord:** ## Installation @@ -156,4 +156,4 @@ Both of these have the disadvantage that the ordering of the terminal output is All contributions are welcome. This is a group effort, and even small contributions can make a difference. Some tasks also don't require much knowledge to get started. -Most discussions happen on our [Discord Server](https://discord.zelda64.dev), where you are welcome to ask if you need help getting started, or if you have any questions regarding this project and other decompilation projects. +Most discussions happen on our [Discord Server][discord], where you are welcome to ask if you need help getting started, or if you have any questions regarding this project and other decompilation projects. From b82f54bb957ffdeda4105fe0b81e3923e107b291 Mon Sep 17 00:00:00 2001 From: cadmic Date: Thu, 15 Aug 2024 20:44:05 -0700 Subject: [PATCH 17/33] Decompile N64 anti-piracy checks in overlays (#2042) * Decompile N64 anti-piracy checks in overlays * Fix BSS splits (I think) * Use physical address and comment on meaning Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> --------- Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> --- include/cic6105.h | 8 ++++++++ include/variables.h | 1 + spec | 3 +++ src/boot/cic6105.c | 2 ++ src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c | 10 ++++++++++ src/overlays/actors/ovl_En_Zl2/z_en_zl2.c | 20 ++++++++++++++------ src/overlays/actors/ovl_Fishing/z_fishing.c | 12 +++++++++++- tools/disasm/ntsc-1.2/files_boot.csv | 2 +- 8 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 include/cic6105.h diff --git a/include/cic6105.h b/include/cic6105.h new file mode 100644 index 0000000000..ab004d63a3 --- /dev/null +++ b/include/cic6105.h @@ -0,0 +1,8 @@ +#ifndef CIC6105_H +#define CIC6105_H + +#include "ultra64.h" + +extern u32 B_80008EE0; + +#endif diff --git a/include/variables.h b/include/variables.h index 930a4c2cad..3bb6a6794d 100644 --- a/include/variables.h +++ b/include/variables.h @@ -9,6 +9,7 @@ extern Mtx D_01000000; extern u32 osTvType; extern u32 osRomBase; extern u32 osResetType; +extern u32 osCicId; extern u32 osMemSize; extern u8 osAppNMIBuffer[0x40]; diff --git a/spec b/spec index c821e8b298..6c926d9566 100644 --- a/spec +++ b/spec @@ -20,6 +20,9 @@ beginseg include "$(BUILD_DIR)/src/boot/z_std_dma.o" include "$(BUILD_DIR)/src/boot/yaz0.o" include "$(BUILD_DIR)/src/boot/z_locale.o" +#if PLATFORM_N64 + include "$(BUILD_DIR)/src/boot/cic6105.o" +#endif #if OOT_DEBUG include "$(BUILD_DIR)/src/boot/assert.o" #endif diff --git a/src/boot/cic6105.c b/src/boot/cic6105.c index 8b13789179..6e5515b931 100644 --- a/src/boot/cic6105.c +++ b/src/boot/cic6105.c @@ -1 +1,3 @@ +#include "cic6105.h" +u32 B_80008EE0; diff --git a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c index de6446e02f..e10ede8d2f 100644 --- a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c +++ b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c @@ -71,6 +71,16 @@ s32 func_808C0CC8(BgZg* this) { } void func_808C0CD4(BgZg* this, PlayState* play) { +#if PLATFORM_N64 + // Anti-piracy check, bars will not open if the check fails. + // The address 0x000002E8 is near the start of RDRAM, and is written when IPL3 copies itself to + // RDRAM after RDRAM has been initialized. Specifically, this is an instruction from some + // embedded RSP code at offset 0x7F8 into IPL3 (0xC86E2000 disassembles to `lqv $v14[0], ($3)`). + if (IO_READ(0x000002E8) != 0xC86E2000) { + return; + } +#endif + if (func_808C0C98(this, play) != 0) { this->action = 1; func_808C0C50(this); diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index c3867c17f7..f06b5fbd1a 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -447,17 +447,25 @@ void func_80B4F230(EnZl2* this, s16 arg1, s32 arg2) { s32 func_80B4F45C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { s32 pad; EnZl2* this = (EnZl2*)thisx; - Mtx* sp74; - MtxF sp34; - Vec3s sp2C; - s16 pad2; - s16* unk_1DC = this->unk_1DC; if (limbIndex == 14) { - sp74 = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx) * 7); + Mtx* sp74 = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx) * 7); + MtxF sp34; + Vec3s sp2C; + s16 pad2; + s16* unk_1DC = this->unk_1DC; + gSPSegment((*gfx)++, 0x0C, sp74); Matrix_Push(); + +#if PLATFORM_N64 + // Anti-piracy check, Zelda's hair is misshapen if the check fails + if (osCicId != 6105) { + Matrix_Scale(2.0f, 0.5f, 2.0f, MTXMODE_APPLY); + } +#endif + Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_APPLY); Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY); Matrix_Push(); diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index b70769e2a6..42595eb432 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -10,8 +10,11 @@ #include "assets/objects/object_fish/object_fish.h" #include "ichain.h" #include "terminal.h" +#if PLATFORM_N64 +#include "cic6105.h" +#endif -#pragma increment_block_number "gc-eu:205 gc-eu-mq:205 gc-jp:207 gc-jp-ce:207 gc-jp-mq:207 gc-us:207 gc-us-mq:207" +#pragma increment_block_number "gc-eu:204 gc-eu-mq:204 gc-jp:206 gc-jp-ce:206 gc-jp-mq:206 gc-us:206 gc-us-mq:206" #define FLAGS ACTOR_FLAG_4 @@ -852,7 +855,14 @@ void Fishing_Init(Actor* thisx, PlayState* play2) { if (thisx->params < EN_FISH_PARAM) { FishingGroupFish* fish; +#if PLATFORM_N64 + // Anti-piracy check, if the check fails the line can't be reeled in if + // a fish is caught and the fish will always let go after 50 frames. + sReelLock = !(B_80008EE0 == 0xAD090010); +#else sReelLock = 0; +#endif + sFishingMain = this; Collider_InitJntSph(play, &sFishingMain->collider); Collider_SetJntSph(play, &sFishingMain->collider, thisx, &sJntSphInit, sFishingMain->colliderElements); diff --git a/tools/disasm/ntsc-1.2/files_boot.csv b/tools/disasm/ntsc-1.2/files_boot.csv index 248233ea98..a028cff131 100644 --- a/tools/disasm/ntsc-1.2/files_boot.csv +++ b/tools/disasm/ntsc-1.2/files_boot.csv @@ -126,7 +126,7 @@ offset,vram,.bss 72F0,80007750,src/boot/idle 7F00,80008360,src/boot/z_std_dma 8670,80008AD0,src/boot/yaz0 -8A80,80008EE0,src/boot/z_locale +8A80,80008EE0,src/boot/cic6105 8AA0,80008F00,src/libultra/io/driverominit 8B20,80008F80,src/libultra/io/piacs 8B40,80008FA0,src/libultra/os/initialize From 56ca23663a890af509ef665ee4674a742f8e9a22 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 17 Aug 2024 22:42:09 +0200 Subject: [PATCH 18/33] Fixup printf args fake matches (#2049) --- src/code/game.c | 2 +- src/code/z_map_exp.c | 2 +- src/code/z_skin_matrix.c | 2 +- .../actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c | 4 ++-- .../actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c | 4 ++-- src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c | 2 +- src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c | 10 +++++----- src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c | 2 +- .../actors/ovl_En_Syateki_Man/z_en_syateki_man.c | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/code/game.c b/src/code/game.c index ec67cde03e..7a247dafe6 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -341,7 +341,7 @@ void GameState_Update(GameState* gameState) { void GameState_InitArena(GameState* gameState, size_t size) { void* arena; - PRINTF("ハイラル確保 サイズ=%u バイト\n"); // "Hyrule reserved size = %u bytes" + PRINTF("ハイラル確保 サイズ=%u バイト\n", size); // "Hyrule reserved size = %u bytes" arena = GAME_ALLOC_MALLOC(&gameState->alloc, size, "../game.c", 992); if (arena != NULL) { diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index a4eb9d5207..4360f92fd5 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -235,7 +235,7 @@ void Map_Init(PlayState* play) { interfaceCtx->mapSegment = GAME_STATE_ALLOC(&play->state, 0x1000, "../z_map_exp.c", 457); // "MAP texture initialization scene_data_ID=%d mapSegment=%x" PRINTF("\n\n\nMAP テクスチャ初期化 scene_data_ID=%d\nmapSegment=%x\n\n", play->sceneId, - interfaceCtx->mapSegment, play); + interfaceCtx->mapSegment); ASSERT(interfaceCtx->mapSegment != NULL, "parameter->mapSegment != NULL", "../z_map_exp.c", 459); switch (play->sceneId) { diff --git a/src/code/z_skin_matrix.c b/src/code/z_skin_matrix.c index 46d2fbe4c1..98f8fc4d24 100644 --- a/src/code/z_skin_matrix.c +++ b/src/code/z_skin_matrix.c @@ -589,7 +589,7 @@ Mtx* SkinMatrix_MtxFToNewMtx(GraphicsContext* gfxCtx, MtxF* src) { Mtx* mtx = GRAPH_ALLOC(gfxCtx, sizeof(Mtx)); if (mtx == NULL) { - PRINTF("Skin_Matrix_to_Mtx_new() 確保失敗:NULLを返して終了\n", mtx); + PRINTF("Skin_Matrix_to_Mtx_new() 確保失敗:NULLを返して終了\n"); return NULL; } SkinMatrix_MtxFToMtx(src, mtx); diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c index 4225108842..9b30e3bbb6 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c @@ -95,7 +95,7 @@ s32 BgBdanObjects_GetProperty(BgBdanObjects* this, s32 arg1) { case JABU_OBJECTS_GET_PROP_CAM_SETTING_DUNGEON1: return this->cameraSetting == CAM_SET_DUNGEON1; default: - PRINTF("Bg_Bdan_Objects_Get_Contact_Ru1\nそんな受信モードは無い%d!!!!!!!!\n"); + PRINTF("Bg_Bdan_Objects_Get_Contact_Ru1\nそんな受信モードは無い%d!!!!!!!!\n", arg1); return -1; } } @@ -112,7 +112,7 @@ void BgBdanObjects_SetProperty(BgBdanObjects* this, s32 arg1) { SET_INFTABLE(INFTABLE_146); break; default: - PRINTF("Bg_Bdan_Objects_Set_Contact_Ru1\nそんな送信モードは無い%d!!!!!!!!\n"); + PRINTF("Bg_Bdan_Objects_Set_Contact_Ru1\nそんな送信モードは無い%d!!!!!!!!\n", arg1); } } diff --git a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c index 9059be8344..ccfb377a4a 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c +++ b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c @@ -108,7 +108,7 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, PlayState* play, EnIk #if OOT_DEBUG if (enIk->unk_2FF <= 0 || enIk->unk_2FF >= 4) { - PRINTF("Error 攻撃方法が分からない(%s %d)\n", "../z_bg_jya_ironobj.c", 233, enIk->unk_2FF); + PRINTF("Error 攻撃方法が分からない(%s %d)\n", "../z_bg_jya_ironobj.c", 233); return; } #endif @@ -174,7 +174,7 @@ void BgJyaIronobj_SpawnThroneParticles(BgJyaIronobj* this, PlayState* play, EnIk #if OOT_DEBUG if (enIk->unk_2FF <= 0 || enIk->unk_2FF >= 4) { - PRINTF("Error 攻撃方法が分からない(%s %d)\n", "../z_bg_jya_ironobj.c", 362, enIk->unk_2FF); + PRINTF("Error 攻撃方法が分からない(%s %d)\n", "../z_bg_jya_ironobj.c", 362); return; } #endif diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index 0219f57776..d0186dafb8 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -1415,7 +1415,7 @@ void DemoGj_Init(Actor* thisx, PlayState* play) { default: // "Demo_Gj_Actor_ct There is no such argument!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "Demo_Gj_Actor_ct そんな引数は無い!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST, play, this); + PRINTF(VT_FGCOL(RED) "Demo_Gj_Actor_ct そんな引数は無い!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); Actor_Kill(&this->dyna.actor); } } diff --git a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c index 49b2b458bd..54ed4e8621 100644 --- a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c +++ b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c @@ -122,11 +122,11 @@ void EnExItem_WaitForObject(EnExItem* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { // "End of transfer" - PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this); - PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this); - PRINTF(VT_FGCOL(BLUE) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this); - PRINTF(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this); - PRINTF(VT_FGCOL(CYAN) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n\n" VT_RST, this->actor.params, this); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params); + PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params); + PRINTF(VT_FGCOL(BLUE) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params); + PRINTF(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params); + PRINTF(VT_FGCOL(CYAN) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n\n" VT_RST, this->actor.params); this->actor.objectSlot = this->requiredObjectSlot; this->actor.draw = EnExItem_Draw; this->stopRotate = false; diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c index 9a3e6d35d0..b6ed63175c 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -142,7 +142,7 @@ void EnHonotrap_GetNormal(Vec3f* normal, Vec3f* vec) { f32 magnitude = Math3D_Vec3fMagnitude(vec); if (magnitude < 0.001f) { - PRINTF("Warning : vector size zero (%s %d)\n", "../z_en_honotrap.c", 328, normal); + PRINTF("Warning : vector size zero (%s %d)\n", "../z_en_honotrap.c", 328); normal->x = normal->y = 0.0f; normal->z = 1.0f; diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 6a1bab34e5..2992bc4e53 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -430,7 +430,7 @@ void EnSyatekiMan_RestartGame(EnSyatekiMan* this, PlayState* play) { this->gameResult = SYATEKI_RESULT_NONE; this->actionFunc = EnSyatekiMan_WaitForGame; // "Let's try again! Baby!" - PRINTF(VT_FGCOL(BLUE) "再挑戦だぜ!ベイビー!" VT_RST "\n", this); + PRINTF(VT_FGCOL(BLUE) "再挑戦だぜ!ベイビー!" VT_RST "\n"); } } } From ba5574be6d151c8f332ba2469906538e3a7bfcae Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Sat, 17 Aug 2024 22:42:15 +0100 Subject: [PATCH 19/33] [Audio 5/?] Build the Samplebank Table (#2044) --- Makefile | 16 ++ baseroms/gc-eu-mq-dbg/config.yml | 4 - baseroms/gc-eu-mq/config.yml | 4 - baseroms/gc-eu/config.yml | 4 - baseroms/gc-jp-ce/config.yml | 4 - baseroms/gc-jp-mq/config.yml | 4 - baseroms/gc-jp/config.yml | 4 - baseroms/gc-us-mq/config.yml | 4 - baseroms/gc-us/config.yml | 4 - baseroms/ntsc-1.2/config.yml | 4 - data/audio_tables.rodata.s | 3 - include/attributes.h | 1 + include/variables.h | 2 +- include/z64audio.h | 23 ++- linker_scripts/audio_table_rodata.ld | 17 ++ spec | 1 + src/audio/lib/heap.c | 6 +- src/audio/lib/load.c | 32 +-- src/audio/tables/samplebank_table.c | 50 +++++ src/code/z_play.c | 2 + src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- tools/audio/.gitignore | 1 + tools/audio/Makefile | 11 +- tools/audio/audio_tablegen.c | 208 ++++++++++++++++++++ 24 files changed, 343 insertions(+), 68 deletions(-) create mode 100644 linker_scripts/audio_table_rodata.ld create mode 100644 src/audio/tables/samplebank_table.c create mode 100644 tools/audio/audio_tablegen.c diff --git a/Makefile b/Makefile index e0026e2a5f..772f45fb9a 100644 --- a/Makefile +++ b/Makefile @@ -237,6 +237,7 @@ BUILD_DIR_REPLACE := sed -e 's|$$(BUILD_DIR)|$(BUILD_DIR)|g' AUDIO_EXTRACT := $(PYTHON) tools/audio_extraction.py SAMPLECONV := tools/audio/sampleconv/sampleconv SBC := tools/audio/sbc +ATBLGEN := tools/audio/atblgen SBCFLAGS := --matching @@ -745,6 +746,21 @@ ifeq ($(AUDIO_BUILD_DEBUG),1) @cmp $(@:.o=.bin) $(patsubst $(BUILD_DIR)/assets/audio/samplebanks/%,$(EXTRACTED_DIR)/baserom_audiotest/audiotable_files/%,$(@:.o=.bin)) && echo "$( rodata + +$(BUILD_DIR)/src/audio/tables/samplebank_table.o: src/audio/tables/samplebank_table.c $(BUILD_DIR)/assets/audio/samplebank_table.h +ifneq ($(RUN_CC_CHECK),0) + $(CC_CHECK) $< +endif + $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $(@:.o=.tmp) $< + $(LD) -r -T linker_scripts/audio_table_rodata.ld $(@:.o=.tmp) -o $@ + @$(RM) $(@:.o=.tmp) + -include $(DEP_FILES) # Print target for debugging diff --git a/baseroms/gc-eu-mq-dbg/config.yml b/baseroms/gc-eu-mq-dbg/config.yml index 512337ac0b..c9841df4c2 100644 --- a/baseroms/gc-eu-mq-dbg/config.yml +++ b/baseroms/gc-eu-mq-dbg/config.yml @@ -41,10 +41,6 @@ incbins: segment: code vram: 0x80155500 size: 0x6F0 - - name: gSampleBankTable - segment: code - vram: 0x80155BF0 - size: 0x80 - name: aspMainData segment: code vram: 0x80155C70 diff --git a/baseroms/gc-eu-mq/config.yml b/baseroms/gc-eu-mq/config.yml index ad493eab93..6a44327d54 100644 --- a/baseroms/gc-eu-mq/config.yml +++ b/baseroms/gc-eu-mq/config.yml @@ -33,10 +33,6 @@ incbins: segment: code vram: 0x801108A0 size: 0x6F0 - - name: gSampleBankTable - segment: code - vram: 0x80110F90 - size: 0x80 - name: aspMainData segment: code vram: 0x80111010 diff --git a/baseroms/gc-eu/config.yml b/baseroms/gc-eu/config.yml index 0773143f50..a17207c192 100644 --- a/baseroms/gc-eu/config.yml +++ b/baseroms/gc-eu/config.yml @@ -33,10 +33,6 @@ incbins: segment: code vram: 0x801108C0 size: 0x6F0 - - name: gSampleBankTable - segment: code - vram: 0x80110FB0 - size: 0x80 - name: aspMainData segment: code vram: 0x80111030 diff --git a/baseroms/gc-jp-ce/config.yml b/baseroms/gc-jp-ce/config.yml index 40488a239b..853c09a025 100644 --- a/baseroms/gc-jp-ce/config.yml +++ b/baseroms/gc-jp-ce/config.yml @@ -33,10 +33,6 @@ incbins: segment: code vram: 0x801130B0 size: 0x6F0 - - name: gSampleBankTable - segment: code - vram: 0x801137A0 - size: 0x80 - name: aspMainData segment: code vram: 0x80113820 diff --git a/baseroms/gc-jp-mq/config.yml b/baseroms/gc-jp-mq/config.yml index d1726da23a..e3b01e7ede 100644 --- a/baseroms/gc-jp-mq/config.yml +++ b/baseroms/gc-jp-mq/config.yml @@ -33,10 +33,6 @@ incbins: segment: code vram: 0x801130B0 size: 0x6F0 - - name: gSampleBankTable - segment: code - vram: 0x801137A0 - size: 0x80 - name: aspMainData segment: code vram: 0x80113820 diff --git a/baseroms/gc-jp/config.yml b/baseroms/gc-jp/config.yml index e3d01b9350..4479cd93be 100644 --- a/baseroms/gc-jp/config.yml +++ b/baseroms/gc-jp/config.yml @@ -33,10 +33,6 @@ incbins: segment: code vram: 0x801130D0 size: 0x6F0 - - name: gSampleBankTable - segment: code - vram: 0x801137C0 - size: 0x80 - name: aspMainData segment: code vram: 0x80113840 diff --git a/baseroms/gc-us-mq/config.yml b/baseroms/gc-us-mq/config.yml index 74b989ff1e..ec6f1f1be4 100644 --- a/baseroms/gc-us-mq/config.yml +++ b/baseroms/gc-us-mq/config.yml @@ -33,10 +33,6 @@ incbins: segment: code vram: 0x80113090 size: 0x6F0 - - name: gSampleBankTable - segment: code - vram: 0x80113780 - size: 0x80 - name: aspMainData segment: code vram: 0x80113800 diff --git a/baseroms/gc-us/config.yml b/baseroms/gc-us/config.yml index d4102a9208..7612a6970d 100644 --- a/baseroms/gc-us/config.yml +++ b/baseroms/gc-us/config.yml @@ -33,10 +33,6 @@ incbins: segment: code vram: 0x801130B0 size: 0x6F0 - - name: gSampleBankTable - segment: code - vram: 0x801137A0 - size: 0x80 - name: aspMainData segment: code vram: 0x80113820 diff --git a/baseroms/ntsc-1.2/config.yml b/baseroms/ntsc-1.2/config.yml index 89a4c73e02..4455c86879 100644 --- a/baseroms/ntsc-1.2/config.yml +++ b/baseroms/ntsc-1.2/config.yml @@ -36,10 +36,6 @@ incbins: segment: code vram: 0x80114220 size: 0x6F0 - - name: gSampleBankTable - segment: code - vram: 0x80114910 - size: 0x80 - name: aspMainData segment: code vram: 0x80114990 diff --git a/data/audio_tables.rodata.s b/data/audio_tables.rodata.s index 4f6655c861..88f9cee98a 100644 --- a/data/audio_tables.rodata.s +++ b/data/audio_tables.rodata.s @@ -17,6 +17,3 @@ glabel gSequenceFontTable glabel gSequenceTable .incbin "incbin/gSequenceTable" - -glabel gSampleBankTable - .incbin "incbin/gSampleBankTable" diff --git a/include/attributes.h b/include/attributes.h index f58cc8122d..ce1365fde3 100644 --- a/include/attributes.h +++ b/include/attributes.h @@ -8,5 +8,6 @@ #define UNUSED __attribute__((unused)) #define FALLTHROUGH __attribute__((fallthrough)) #define NORETURN __attribute__((noreturn)) +#define NO_REORDER __attribute__((no_reorder)) #endif diff --git a/include/variables.h b/include/variables.h index 3bb6a6794d..b25f7f31d8 100644 --- a/include/variables.h +++ b/include/variables.h @@ -171,7 +171,7 @@ extern s16 gOcarinaSongItemMap[]; extern u8 gSoundFontTable[]; extern u8 gSequenceFontTable[]; extern u8 gSequenceTable[]; -extern u8 gSampleBankTable[]; +extern AudioTable gSampleBankTable; extern SaveContext gSaveContext; diff --git a/include/z64audio.h b/include/z64audio.h index 006e6d3186..6c2a34edf0 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -1,6 +1,9 @@ #ifndef Z64_AUDIO_H #define Z64_AUDIO_H +#include "ultra64.h" +#include "sequence.h" + typedef void (*AudioCustomUpdateFunction)(void); @@ -110,6 +113,14 @@ typedef enum AudioCacheType { /* 3 */ CACHE_PERMANENT } AudioCacheType; +typedef enum AudioCacheLoadType { + /* 0 */ CACHE_LOAD_PERMANENT, + /* 1 */ CACHE_LOAD_PERSISTENT, + /* 2 */ CACHE_LOAD_TEMPORARY, + /* 3 */ CACHE_LOAD_EITHER, + /* 4 */ CACHE_LOAD_EITHER_NOSYNC +} AudioCacheLoadType; + typedef enum AudioLoadStatus { /* 0 */ LOAD_STATUS_NOT_LOADED, // the entry data is not loaded /* 1 */ LOAD_STATUS_IN_PROGRESS, // the entry data is being loaded asynchronously @@ -807,6 +818,13 @@ typedef struct AudioSlowLoad { /* 0x4C */ OSIoMesg ioMesg; } AudioSlowLoad; // size = 0x64 +typedef struct AudioTableHeader { + /* 0x00 */ s16 numEntries; + /* 0x02 */ s16 unkMediumParam; + /* 0x04 */ uintptr_t romAddr; + /* 0x08 */ char pad[0x8]; +} AudioTableHeader; // size = 0x10 + typedef struct AudioTableEntry { /* 0x00 */ u32 romAddr; /* 0x04 */ u32 size; @@ -818,10 +836,7 @@ typedef struct AudioTableEntry { } AudioTableEntry; // size = 0x10 typedef struct AudioTable { - /* 0x00 */ s16 numEntries; - /* 0x02 */ s16 unkMediumParam; - /* 0x04 */ u32 romAddr; - /* 0x08 */ char pad[0x8]; + /* 0x00 */ AudioTableHeader header; /* 0x10 */ AudioTableEntry entries[1]; // (dynamic size) } AudioTable; // size >= 0x20 diff --git a/linker_scripts/audio_table_rodata.ld b/linker_scripts/audio_table_rodata.ld new file mode 100644 index 0000000000..27eab49fc4 --- /dev/null +++ b/linker_scripts/audio_table_rodata.ld @@ -0,0 +1,17 @@ +OUTPUT_ARCH (mips) + +/* Audio Table Linker Script, maps data into rodata */ + +SECTIONS { + + .rodata : + { + *(.data*) + *(.rodata*) + } + + /DISCARD/ : + { + *(*); + } +} diff --git a/spec b/spec index 6c926d9566..2edafc4fb2 100644 --- a/spec +++ b/spec @@ -649,6 +649,7 @@ beginseg include_no_data "$(BUILD_DIR)/src/code/z_game_over.o" include "$(BUILD_DIR)/src/code/z_construct.o" include "$(BUILD_DIR)/data/audio_tables.rodata.o" + include "$(BUILD_DIR)/src/audio/tables/samplebank_table.o" include "$(BUILD_DIR)/data/rsp.text.o" include "$(BUILD_DIR)/data/rsp.rodata.o" endseg diff --git a/src/audio/lib/heap.c b/src/audio/lib/heap.c index 2a0f859dff..e68ef6eec9 100644 --- a/src/audio/lib/heap.c +++ b/src/audio/lib/heap.c @@ -1265,7 +1265,7 @@ void AudioHeap_DiscardSampleCacheEntry(SampleCacheEntry* entry) { s32 sampleBankId2; s32 fontId; - numFonts = gAudioCtx.soundFontTable->numEntries; + numFonts = gAudioCtx.soundFontTable->header.numEntries; for (fontId = 0; fontId < numFonts; fontId++) { sampleBankId1 = gAudioCtx.soundFontList[fontId].sampleBankId1; sampleBankId2 = gAudioCtx.soundFontList[fontId].sampleBankId2; @@ -1322,7 +1322,7 @@ void AudioHeap_DiscardSampleCaches(void) { s32 fontId; s32 j; - numFonts = gAudioCtx.soundFontTable->numEntries; + numFonts = gAudioCtx.soundFontTable->header.numEntries; for (fontId = 0; fontId < numFonts; fontId++) { sampleBankId1 = gAudioCtx.soundFontList[fontId].sampleBankId1; sampleBankId2 = gAudioCtx.soundFontList[fontId].sampleBankId2; @@ -1392,7 +1392,7 @@ void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId) { s32 pad[4]; sampleBankTable = gAudioCtx.sampleBankTable; - numFonts = gAudioCtx.soundFontTable->numEntries; + numFonts = gAudioCtx.soundFontTable->header.numEntries; change.oldAddr = (u32)AudioHeap_SearchCaches(SAMPLE_TABLE, CACHE_EITHER, sampleBankId); if (change.oldAddr == 0) { return; diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index 1491790205..807bab3171 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -338,10 +338,10 @@ void AudioLoad_SetSampleFontLoadStatus(s32 sampleBankId, s32 loadStatus) { void AudioLoad_InitTable(AudioTable* table, u32 romAddr, u16 unkMediumParam) { s32 i; - table->unkMediumParam = unkMediumParam; - table->romAddr = romAddr; + table->header.unkMediumParam = unkMediumParam; + table->header.romAddr = romAddr; - for (i = 0; i < table->numEntries; i++) { + for (i = 0; i < table->header.numEntries; i++) { if ((table->entries[i].size != 0) && (table->entries[i].medium == MEDIUM_CART)) { table->entries[i].romAddr += romAddr; } @@ -401,7 +401,7 @@ s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) { if (sample->medium == MEDIUM_UNK) { AudioLoad_SyncDmaUnkMedium((u32)sample->sampleAddr, sampleAddr, sample->size, - gAudioCtx.sampleBankTable->unkMediumParam); + gAudioCtx.sampleBankTable->header.unkMediumParam); } else { AudioLoad_SyncDma((u32)sample->sampleAddr, sampleAddr, sample->size, sample->medium); } @@ -707,7 +707,7 @@ void* AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) { *didAllocate = true; if (medium == MEDIUM_UNK) { - AudioLoad_SyncDmaUnkMedium(romAddr, ramAddr, size, (s16)table->unkMediumParam); + AudioLoad_SyncDmaUnkMedium(romAddr, ramAddr, size, (s16)table->header.unkMediumParam); } else { AudioLoad_SyncDma(romAddr, ramAddr, size, medium); } @@ -1066,8 +1066,8 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, } if (medium == MEDIUM_UNK) { - AudioLoad_StartAsyncLoadUnkMedium((s16)table->unkMediumParam, devAddr, ramAddr, size, medium, nChunks, - retQueue, MK_ASYNC_MSG(retData, tableType, id, loadStatus)); + AudioLoad_StartAsyncLoadUnkMedium((s16)table->header.unkMediumParam, devAddr, ramAddr, size, medium, + nChunks, retQueue, MK_ASYNC_MSG(retData, tableType, id, loadStatus)); } else { AudioLoad_StartAsyncLoad(devAddr, ramAddr, size, medium, nChunks, retQueue, MK_ASYNC_MSG(retData, tableType, realId, loadStatus)); @@ -1215,10 +1215,10 @@ void AudioLoad_Init(void* heap, u32 heapSize) { // Set audio tables pointers gAudioCtx.sequenceTable = (AudioTable*)gSequenceTable; gAudioCtx.soundFontTable = (AudioTable*)gSoundFontTable; - gAudioCtx.sampleBankTable = (AudioTable*)gSampleBankTable; + gAudioCtx.sampleBankTable = &gSampleBankTable; gAudioCtx.sequenceFontTable = gSequenceFontTable; - gAudioCtx.numSequences = gAudioCtx.sequenceTable->numEntries; + gAudioCtx.numSequences = gAudioCtx.sequenceTable->header.numEntries; gAudioCtx.specId = 0; gAudioCtx.resetStatus = 1; // Set reset to immediately initialize the audio heap @@ -1229,7 +1229,7 @@ void AudioLoad_Init(void* heap, u32 heapSize) { AudioLoad_InitTable(gAudioCtx.sequenceTable, (u32)_AudioseqSegmentRomStart, 0); AudioLoad_InitTable(gAudioCtx.soundFontTable, (u32)_AudiobankSegmentRomStart, 0); AudioLoad_InitTable(gAudioCtx.sampleBankTable, (u32)_AudiotableSegmentRomStart, 0); - numFonts = gAudioCtx.soundFontTable->numEntries; + numFonts = gAudioCtx.soundFontTable->header.numEntries; gAudioCtx.soundFontList = AudioHeap_Alloc(&gAudioCtx.initPool, numFonts * sizeof(SoundFont)); for (i = 0; i < numFonts; i++) { @@ -1295,7 +1295,7 @@ s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* status) { slowLoad->seqOrFontId = fontId; slowLoad->instId = instId; if (slowLoad->medium == MEDIUM_UNK) { - slowLoad->unkMediumParam = gAudioCtx.sampleBankTable->unkMediumParam; + slowLoad->unkMediumParam = gAudioCtx.sampleBankTable->header.unkMediumParam; } gAudioCtx.slowLoadPos ^= 1; @@ -1439,7 +1439,7 @@ s32 AudioLoad_SlowLoadSeq(s32 seqId, u8* ramAddr, s8* status) { slowLoad->seqOrFontId = seqId; if (slowLoad->medium == MEDIUM_UNK) { - slowLoad->unkMediumParam = seqTable->unkMediumParam; + slowLoad->unkMediumParam = seqTable->header.unkMediumParam; } gAudioCtx.slowLoadPos ^= 1; @@ -1616,7 +1616,7 @@ void AudioLoad_ProcessAsyncLoad(AudioAsyncLoad* asyncLoad, s32 resetStatus) { if (asyncLoad->bytesRemaining < asyncLoad->chunkSize) { if (asyncLoad->medium == MEDIUM_UNK) { AudioLoad_AsyncDmaUnkMedium(asyncLoad->curDevAddr, asyncLoad->curRamAddr, asyncLoad->bytesRemaining, - sampleBankTable->unkMediumParam); + sampleBankTable->header.unkMediumParam); } else { AudioLoad_AsyncDma(asyncLoad, asyncLoad->bytesRemaining); } @@ -1626,7 +1626,7 @@ void AudioLoad_ProcessAsyncLoad(AudioAsyncLoad* asyncLoad, s32 resetStatus) { if (asyncLoad->medium == MEDIUM_UNK) { AudioLoad_AsyncDmaUnkMedium(asyncLoad->curDevAddr, asyncLoad->curRamAddr, asyncLoad->chunkSize, - sampleBankTable->unkMediumParam); + sampleBankTable->header.unkMediumParam); } else { AudioLoad_AsyncDma(asyncLoad, asyncLoad->chunkSize); } @@ -1783,7 +1783,7 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* fontData case false: if (sample->medium == MEDIUM_UNK) { AudioLoad_SyncDmaUnkMedium((u32)sample->sampleAddr, sampleRamAddr, sample->size, - gAudioCtx.sampleBankTable->unkMediumParam); + gAudioCtx.sampleBankTable->header.unkMediumParam); sample->sampleAddr = sampleRamAddr; sample->medium = MEDIUM_RAM; } else { @@ -2039,7 +2039,7 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, SampleBankRelocInfo* case false: if (sample->medium == MEDIUM_UNK) { AudioLoad_SyncDmaUnkMedium((u32)sample->sampleAddr, addr, sample->size, - gAudioCtx.sampleBankTable->unkMediumParam); + gAudioCtx.sampleBankTable->header.unkMediumParam); sample->sampleAddr = addr; sample->medium = MEDIUM_RAM; } else { diff --git a/src/audio/tables/samplebank_table.c b/src/audio/tables/samplebank_table.c new file mode 100644 index 0000000000..58ebf06f22 --- /dev/null +++ b/src/audio/tables/samplebank_table.c @@ -0,0 +1,50 @@ +#include "attributes.h" +#include "z64audio.h" + +// Symbol definition + +extern AudioTable gSampleBankTable; +#pragma weak gSampleBankTable = sSampleBankTableHeader + +// Externs for table + +#define DEFINE_SAMPLE_BANK(name, medium, cachePolicy) \ + extern u8 name##_Start[]; \ + extern u8 name##_Size[]; +#define DEFINE_SAMPLE_BANK_PTR(index, medium, cachePolicy) /*empty*/ + +#include "assets/audio/samplebank_table.h" + +#undef DEFINE_SAMPLE_BANK +#undef DEFINE_SAMPLE_BANK_PTR + +// Table header + +NO_REORDER AudioTableHeader sSampleBankTableHeader = { +// The table contains the number of samplebanks, count them with the preprocessor +#define DEFINE_SAMPLE_BANK(name, medium, cachePolicy) 1 + +#define DEFINE_SAMPLE_BANK_PTR(index, medium, cachePolicy) 1 + + +#include "assets/audio/samplebank_table.h" + 0, + +#undef DEFINE_SAMPLE_BANK +#undef DEFINE_SAMPLE_BANK_PTR + + 0, + 0x00000000, + { 0, 0, 0, 0, 0, 0, 0, 0 }, +}; + +// Table body + +NO_REORDER AudioTableEntry sSampleBankTableEntries[] = { +#define DEFINE_SAMPLE_BANK(name, medium, cachePolicy) \ + { (u32)name##_Start, (u32)name##_Size, (medium), (cachePolicy), 0, 0, 0 }, +#define DEFINE_SAMPLE_BANK_PTR(index, medium, cachePolicy) { (index), 0, (medium), (cachePolicy), 0, 0, 0 }, + +#include "assets/audio/samplebank_table.h" + +#undef DEFINE_SAMPLE_BANK +#undef DEFINE_SAMPLE_BANK_PTR +}; diff --git a/src/code/z_play.c b/src/code/z_play.c index 7ebb6ccea6..ab3b475009 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -4,6 +4,8 @@ #include "z64frame_advance.h" +#pragma increment_block_number "gc-eu:24 gc-eu-mq:24 gc-jp:28 gc-jp-ce:28 gc-jp-mq:28 gc-us:28 gc-us-mq:28" + TransitionTile gTransitionTile; s32 gTransitionTileState; VisMono gPlayVisMono; diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 42595eb432..fd81943337 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -14,7 +14,7 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:204 gc-eu-mq:204 gc-jp:206 gc-jp-ce:206 gc-jp-mq:206 gc-us:206 gc-us-mq:206" +#pragma increment_block_number "gc-eu:198 gc-eu-mq:198 gc-jp:200 gc-jp-ce:200 gc-jp-mq:200 gc-us:200 gc-us-mq:200" #define FLAGS ACTOR_FLAG_4 diff --git a/tools/audio/.gitignore b/tools/audio/.gitignore index f1de1d520d..8a45b347ef 100644 --- a/tools/audio/.gitignore +++ b/tools/audio/.gitignore @@ -1,3 +1,4 @@ __pycache__/ +atblgen sbc diff --git a/tools/audio/Makefile b/tools/audio/Makefile index 5068591798..9b859a84c3 100644 --- a/tools/audio/Makefile +++ b/tools/audio/Makefile @@ -1,4 +1,4 @@ -PROGRAMS := sbc +PROGRAMS := atblgen sbc ifeq ($(shell which xml2-config),) $(error xml2-config not found. Did you install libxml2-dev?) @@ -30,11 +30,14 @@ format: $(CLANG_FORMAT) $(FORMAT_ARGS) $(shell find . -maxdepth 1 -type f -name "*.[ch]") $(MAKE) -C sampleconv format -sbc_SOURCES := samplebank_compiler.c samplebank.c aifc.c xml.c util.c +atblgen_SOURCES := audio_tablegen.c samplebank.c xml.c util.c +sbc_SOURCES := samplebank_compiler.c samplebank.c aifc.c xml.c util.c -sbc_CFLAGS := $(XML_CFLAGS) +atblgen_CFLAGS := $(XML_CFLAGS) +sbc_CFLAGS := $(XML_CFLAGS) -sbc_LDFLAGS := $(XML_LDFLAGS) +atblgen_LDFLAGS := $(XML_LDFLAGS) +sbc_LDFLAGS := $(XML_LDFLAGS) define COMPILE = $(1): $($1_SOURCES) diff --git a/tools/audio/audio_tablegen.c b/tools/audio/audio_tablegen.c new file mode 100644 index 0000000000..b9fba94cc5 --- /dev/null +++ b/tools/audio/audio_tablegen.c @@ -0,0 +1,208 @@ +/** + * SPDX-FileCopyrightText: Copyright (C) 2024 ZeldaRET + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#include +#include +#include +#include +#include +#include +#include + +#include "samplebank.h" +#include "xml.h" +#include "util.h" + +/* Utility */ + +static bool +is_xml(const char *path) +{ + size_t len = strlen(path); + + if (len < 4) + return false; + if (path[len - 4] == '.' && tolower(path[len - 3]) == 'x' && tolower(path[len - 2]) == 'm' && + tolower(path[len - 1]) == 'l') + return true; + + return false; +} + +/* Samplebanks */ + +static int +tablegen_samplebanks(const char *sb_hdr_out, const char **samplebanks_paths, int num_samplebank_files) +{ + // Read in all samplebank xml files + + samplebank *samplebanks = malloc(num_samplebank_files * sizeof(samplebank)); + + for (int i = 0; i < num_samplebank_files; i++) { + const char *path = samplebanks_paths[i]; + + if (!is_xml(path)) + error("Not an xml file? (\"%s\")", path); + + xmlDocPtr document = xmlReadFile(path, NULL, XML_PARSE_NONET); + if (document == NULL) + error("Could not read xml file \"%s\"\n", path); + + read_samplebank_xml(&samplebanks[i], document); + } + + // Find largest index, including pointer indices + + size_t index_max = 0; + + for (int i = 0; i < num_samplebank_files; i++) { + samplebank *sb = &samplebanks[i]; + unsigned index = sb->index; + if (index > index_max) + index_max = index; + + for (size_t j = 0; j < sb->num_pointers; j++) { + index = sb->pointer_indices[j]; + if (index > index_max) + index_max = index; + } + } + + size_t indices_len = index_max + 1; + + // Classify indices and check that no two indices are the same + +#define INDEX_NONE 0 +#define INDEX_NOPOINTER 1 +#define INDEX_POINTER 2 + + struct sb_index_info { + const char *name; + unsigned index_type; + unsigned ptr_index; + const char *medium; + const char *cache_policy; + }; + struct sb_index_info *index_info = calloc(indices_len, sizeof(struct sb_index_info)); + + for (int i = 0; i < num_samplebank_files; i++) { + samplebank *sb = &samplebanks[i]; + unsigned index = sb->index; + + if (index_info[index].index_type != INDEX_NONE) + error("Overlapping samplebank indices, saw index %u more than once", index); + index_info[index].index_type = INDEX_NOPOINTER; + + index_info[index].name = sb->name; + index_info[index].medium = sb->medium; + index_info[index].cache_policy = sb->cache_policy; + + unsigned real_index = index; + + // Add pointers defined for this bank + for (size_t j = 0; j < sb->num_pointers; j++) { + index = sb->pointer_indices[j]; + + if (index_info[index].index_type != INDEX_NONE) + error("Overlapping samplebank indices, saw index %u more than once", index); + index_info[index].index_type = INDEX_POINTER; + + index_info[index].ptr_index = real_index; + index_info[index].medium = sb->medium; + index_info[index].cache_policy = sb->cache_policy; + } + } + + // Check that we have no gaps in the indices + + for (size_t i = 0; i < indices_len; i++) { + if (index_info[i].index_type == INDEX_NONE) + error("Missing samplebank index %lu", i); + } + + // Emit the table + + FILE *out = fopen(sb_hdr_out, "w"); + if (out == NULL) + error("Failed to open samplebank header output"); + + fprintf(out, + // clang-format off + "/**" "\n" + " * DEFINE_SAMPLE_BANK(name, medium, cachePolicy)" "\n" + " * DEFINE_SAMPLE_BANK_PTR(index, medium, cachePolicy)" "\n" + " */" "\n" + // clang-format on + ); + + for (size_t i = 0; i < indices_len; i++) { + unsigned index_type = index_info[i].index_type; + + // By this point we shouldn't have any INDEX_NONEs, since it would have been caught before this + // when we checked for gaps + assert(index_type == INDEX_NOPOINTER || index_type == INDEX_POINTER); + + if (index_type == INDEX_NOPOINTER) { + fprintf(out, "DEFINE_SAMPLE_BANK (%s, %s, %s)\n", index_info[i].name, index_info[i].medium, + index_info[i].cache_policy); + } else { + fprintf(out, "DEFINE_SAMPLE_BANK_PTR(%u, %s, %s)\n", index_info[i].ptr_index, index_info[i].medium, + index_info[i].cache_policy); + } + } + + fclose(out); + + free(index_info); + free(samplebanks); + + return EXIT_SUCCESS; +} + +/* Common */ + +static int +usage(const char *progname) +{ + fprintf(stderr, + // clang-format off + "%s: Generate code tables for audio data" "\n" + "Usage:" "\n" + " %s --banks " "\n", + // clang-format on + progname, progname); + return EXIT_FAILURE; +} + +int +main(int argc, char **argv) +{ + int ret = EXIT_SUCCESS; + + const char *progname = argv[0]; + + if (argc < 2) + return usage(progname); + + const char *mode = argv[1]; + + if (strequ(mode, "--banks")) { + if (argc < 4) + return usage(progname); + + const char *sb_hdr_out = argv[2]; + const char **samplebanks_paths = (const char **)&argv[3]; + int num_samplebank_files = argc - 3; + + ret = tablegen_samplebanks(sb_hdr_out, samplebanks_paths, num_samplebank_files); + } else { + return usage(progname); + } + + return ret; +} From aed15faaf4935e0bcd7ab3c8c9a573c639c08bf6 Mon Sep 17 00:00:00 2001 From: cadmic Date: Sun, 18 Aug 2024 13:12:02 -0700 Subject: [PATCH 20/33] Use BSS section start from map file in fix_bss.py instead of guessing (#2045) * Use BSS section start from map file * Expand comment about section start heuristic * Reword --- tools/fix_bss.py | 52 ++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/tools/fix_bss.py b/tools/fix_bss.py index 49c1962d86..35333fd583 100755 --- a/tools/fix_bss.py +++ b/tools/fix_bss.py @@ -69,6 +69,12 @@ class Pointer: build_value: int +@dataclass +class BssSection: + start_address: int + pointers: list[Pointer] + + # Read relocations from an ELF file section def read_relocs(object_path: Path, section_name: str) -> list[Reloc]: with open(object_path, "rb") as f: @@ -169,7 +175,7 @@ def get_file_pointers_worker(file: mapfile_parser.mapfile.File) -> list[Pointer] # Compare pointers between the baserom and the current build, returning a dictionary from # C files to a list of pointers into their BSS sections -def compare_pointers(version: str) -> dict[Path, list[Pointer]]: +def compare_pointers(version: str) -> dict[Path, BssSection]: mapfile_path = Path(f"build/{version}/oot-{version}.map") if not mapfile_path.exists(): raise FixBssException(f"Could not open {mapfile_path}") @@ -235,7 +241,7 @@ def compare_pointers(version: str) -> dict[Path, list[Pointer]]: pointers.sort(key=lambda p: p.base_value) # Go through sections and collect differences - pointers_by_file = {} + bss_sections = {} for mapfile_segment in source_code_segments: for file in mapfile_segment: if not file.sectionType == ".bss": @@ -246,13 +252,11 @@ def compare_pointers(version: str) -> dict[Path, list[Pointer]]: for p in pointers if file.vram <= p.build_value < file.vram + file.size ] - if not pointers_in_section: - continue c_file = file.filepath.relative_to(f"build/{version}").with_suffix(".c") - pointers_by_file[c_file] = pointers_in_section + bss_sections[c_file] = BssSection(file.vram, pointers_in_section) - return pointers_by_file + return bss_sections @dataclass @@ -356,16 +360,18 @@ def predict_bss_ordering(variables: list[BssVariable]) -> list[BssSymbol]: # Match up BSS variables between the baserom and the build using the pointers from relocations. # Note that we may not be able to match all variables if a variable is not referenced by any pointer. def determine_base_bss_ordering( - build_bss_symbols: list[BssSymbol], pointers: list[Pointer] + build_bss_symbols: list[BssSymbol], + bss_section: BssSection, ) -> list[BssSymbol]: - # Assume that the lowest address is the start of the BSS section - base_section_start = min(p.base_value for p in pointers) - build_section_start = min(p.build_value for p in pointers) + # For the baserom, assume that the lowest address is the start of the BSS section. This might + # not be true if the first BSS variable is not referenced, but in practice this doesn't seem + # to happen for the files which typically have BSS ordering issues. + base_start_address = min(p.base_value for p in bss_section.pointers) found_symbols: dict[str, BssSymbol] = {} - for p in pointers: - base_offset = p.base_value - base_section_start - build_offset = p.build_value - build_section_start + for p in bss_section.pointers: + base_offset = p.base_value - base_start_address + build_offset = p.build_value - bss_section.start_address new_symbol = None new_offset = 0 @@ -599,7 +605,7 @@ def update_source_file(version_to_update: str, file: Path, new_pragmas: list[Pra def process_file( file: Path, - pointers: list[Pointer], + bss_section: BssSection, make_log: list[str], dry_run: bool, version: str, @@ -628,10 +634,10 @@ def process_file( f" offset=0x{symbol.offset:04X} size=0x{symbol.size:04X} align=0x{symbol.align:X} {symbol.name}" ) - if not pointers: + if not bss_section.pointers: raise FixBssException(f"No pointers to BSS found in ROM for {file}") - base_bss_symbols = determine_base_bss_ordering(build_bss_symbols, pointers) + base_bss_symbols = determine_base_bss_ordering(build_bss_symbols, bss_section) print("Baserom BSS ordering:") for symbol in base_bss_symbols: print( @@ -709,17 +715,19 @@ def main(): args = parser.parse_args() version = args.oot_version - pointers_by_file = compare_pointers(version) + bss_sections = compare_pointers(version) files_with_reordering = [] - for file, pointers in pointers_by_file.items(): + for file, bss_section in bss_sections.items(): + if not bss_section.pointers: + continue # Try to detect if the section is shifted by comparing the lowest # address among any pointer into the section between base and build - base_min_address = min(p.base_value for p in pointers) - build_min_address = min(p.build_value for p in pointers) + base_min_address = min(p.base_value for p in bss_section.pointers) + build_min_address = min(p.build_value for p in bss_section.pointers) if not all( p.build_value - build_min_address == p.base_value - base_min_address - for p in pointers + for p in bss_section.pointers ): files_with_reordering.append(file) @@ -747,7 +755,7 @@ def main(): process_file_worker, ( file, - pointers_by_file.get(file, []), + bss_sections[file], make_log, args.dry_run, version, From 74ab9178047405f01c4e13010c2346e6b43014a5 Mon Sep 17 00:00:00 2001 From: cadmic Date: Sun, 18 Aug 2024 18:55:25 -0700 Subject: [PATCH 21/33] Add DEG_TO_BINANG2/RAD_TO_BINANG2 to match ntsc-1.2 z_en_gs.c, z_en_mm.c, z_en_toryo.c (#2047) * Add DEG_TO_BINANG2/RAD_TO_BINANG2 * Remove redundant cast --- include/z64math.h | 11 +++++++++++ .../actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c | 2 +- .../ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c | 2 +- src/overlays/actors/ovl_En_Fd/z_en_fd.c | 2 +- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 12 ++++++------ src/overlays/actors/ovl_En_Mm/z_en_mm.c | 4 ++-- src/overlays/actors/ovl_En_Toryo/z_en_toryo.c | 2 +- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 2 +- 8 files changed, 24 insertions(+), 13 deletions(-) diff --git a/include/z64math.h b/include/z64math.h index 8e665a7830..7ed235e587 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -123,6 +123,17 @@ typedef VecSphGeo VecGeo; #define BINANG_TO_RAD_ALT(binang) (((f32)(binang) / (f32)0x8000) * M_PI) #define BINANG_TO_RAD_ALT2(binang) (((f32)(binang) * M_PI) / 0x8000) +// Angle conversion macros required for matching. These were probably the original macros used, but +// we prefer DEG_TO_BINANG/RAD_TO_BINANG where possible to avoid possible undefined behavior with input +// values outside of [-180, 180) degrees or [-PI, PI) radians. +#if PLATFORM_N64 +#define DEG_TO_BINANG2(degrees) (f32)((degrees) * (0x8000 / 180.0f)) +#define RAD_TO_BINANG2(radians) (f32)((radians) * (0x8000 / M_PI)) +#else +#define DEG_TO_BINANG2(degrees) (s32)((degrees) * (0x8000 / 180.0f)) +#define RAD_TO_BINANG2(radians) (s32)((radians) * (0x8000 / M_PI)) +#endif + // Angle conversion macros (Camera) // these two angle conversion macros are slightly inaccurate #define CAM_DEG_TO_BINANG(degrees) (s16)TRUNCF_BINANG((degrees) * 182.04167f + .5f) diff --git a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index 10296bafff..ce41d4717c 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -194,7 +194,7 @@ void BgHakaGate_StatueTurn(BgHakaGate* this, PlayState* play) { this->vTurnRateDeg10 = CLAMP_MAX(this->vTurnRateDeg10, 5); turnFinished = Math_StepToS(&this->vTurnAngleDeg10, 600, this->vTurnRateDeg10); turnAngle = this->vTurnAngleDeg10 * this->vTurnDirection; - this->dyna.actor.shape.rot.y = (this->vRotYDeg10 + turnAngle) * 0.1f * (0x10000 / 360.0f); + this->dyna.actor.shape.rot.y = DEG_TO_BINANG((this->vRotYDeg10 + turnAngle) * 0.1f); if ((player->stateFlags2 & PLAYER_STATE2_4) && (sStatueDistToPlayer > 0.0f)) { player->actor.world.pos.x = this->dyna.actor.home.pos.x + diff --git a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c index ab012874bb..a46a332f34 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c +++ b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c @@ -138,7 +138,7 @@ void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play) { thisx->world.rot.y = thisx->shape.rot.y = thisx->home.rot.y; Sfx_PlaySfxCentered2(NA_SE_EV_STONEDOOR_STOP); } else { - rotY = this->rotYdeg * (0x10000 / 360.0f); + rotY = DEG_TO_BINANG(this->rotYdeg); thisx->world.rot.y = thisx->shape.rot.y = thisx->home.rot.y + rotY; Sfx_PlaySfxCentered2(NA_SE_EV_WALL_SLIDE - SFX_FLAG); } diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 4024e71682..10bf1520b3 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -234,7 +234,7 @@ void EnFd_SpawnChildFire(EnFd* this, PlayState* play, s16 fireCnt, s16 color) { s32 i; for (i = 0; i < fireCnt; i++) { - s16 angle = (s16)((((i * 360.0f) / fireCnt) * (0x10000 / 360.0f))) + this->actor.yawTowardsPlayer; + s16 angle = DEG_TO_BINANG((i * 360.0f) / fireCnt) + this->actor.yawTowardsPlayer; Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FD_FIRE, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, angle, 0, (color << 0xF) | i); } diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index f354e81d2f..ef8cb8cc89 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -240,7 +240,7 @@ void func_80A4EA08(EnGs* this, PlayState* play) { this->unk_200 = 0; this->unk_19F = 1; } else if (this->unk_19F == 1) { - this->unk_1A0[0].z = (((this->unk_200 % 8) / 8.0f) * 360.0f) * (0x10000 / 360.0f); + this->unk_1A0[0].z = DEG_TO_BINANG(((this->unk_200 % 8) / 8.0f) * 360.0f); this->unk_1A0[1].z = -this->unk_1A0[0].z; if (func_80A4E754(this, play, &this->unk_1E8, &this->unk_1EC, &this->unk_200, 0.8f, 0.005f, 0.001f, 7, 0) == 0.0f) { @@ -408,14 +408,14 @@ void func_80A4F13C(EnGs* this, PlayState* play) { if (this->unk_19F == 1) { Math_SmoothStepToF(&this->unk_1F0, this->unk_1F4, 1.0f, 0.1f, 0.001f); tmpf1 = Math_SmoothStepToF(&this->unk_1E8, this->unk_1EC, 1.0f, this->unk_1F0, 0.001f); - this->unk_1A0[0].y += (s32)(this->unk_1E8 * (0x10000 / 360.0f)); + this->unk_1A0[0].y += DEG_TO_BINANG2(this->unk_1E8); if (tmpf1 == 0.0f) { this->unk_200 = 0; this->unk_19F = 2; } } if (this->unk_19F == 2) { - this->unk_1A0[0].y += (s32)(this->unk_1E8 * (0x10000 / 360.0f)); + this->unk_1A0[0].y += DEG_TO_BINANG2(this->unk_1E8); if (this->unk_200++ > 40) { this->unk_1E8 = this->unk_1B4[0].y - 1.0f; this->unk_1EC = 1.5f; @@ -426,7 +426,7 @@ void func_80A4F13C(EnGs* this, PlayState* play) { } } if (this->unk_19F == 3) { - this->unk_1A0[0].y += 0x4000; + this->unk_1A0[0].y += DEG_TO_BINANG2(90.0f); tmpf1 = Math_SmoothStepToF(&this->unk_1E8, this->unk_1EC, 0.8f, 0.2f, 0.001f); Math_SmoothStepToF(&this->unk_1F0, this->unk_1F4, 0.8f, 0.2f, 0.001f); this->unk_1B4[0].x = this->unk_1F0 + 1.0f; @@ -438,7 +438,7 @@ void func_80A4F13C(EnGs* this, PlayState* play) { } } if (this->unk_19F == 4) { - tmpf1 = Math_SmoothStepToF(&this->unk_1E8, this->unk_1EC, 0.8f, 16384.0f, 3640.0f); + tmpf1 = Math_SmoothStepToF(&this->unk_1E8, this->unk_1EC, 0.8f, DEG_TO_BINANG2(90.0f), 3640.0f); this->unk_1A0[0].y += (s16)this->unk_1E8; if (tmpf1 == 0.0f) { @@ -458,7 +458,7 @@ void func_80A4F13C(EnGs* this, PlayState* play) { tmp -= 0xFFFF; } this->unk_1E8 = tmp; - tmpf1 = Math_SmoothStepToF(&this->unk_1E8, this->unk_1EC, 0.8f, 3640.0f, 0.001f); + tmpf1 = Math_SmoothStepToF(&this->unk_1E8, this->unk_1EC, 0.8f, DEG_TO_BINANG2(20.0f), 0.001f); this->unk_1A0[0].y = this->unk_1E8; if (tmpf1 == 0.0f) { this->unk_1E8 = this->unk_1B4[0].y - 1.0f; diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index cee7f3a4cb..a07ce7822d 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -334,7 +334,7 @@ s32 func_80AADEF0(EnMm* this, PlayState* play) { xDiff = waypointPos.x - this->actor.world.pos.x; zDiff = waypointPos.z - this->actor.world.pos.z; - this->yawToWaypoint = (s32)(Math_FAtan2F(xDiff, zDiff) * (0x8000 / M_PI)); + this->yawToWaypoint = RAD_TO_BINANG2(Math_FAtan2F(xDiff, zDiff)); this->distToWaypoint = sqrtf(SQ(xDiff) + SQ(zDiff)); while ((this->distToWaypoint <= 10.44f) && (this->unk_1E8 != 0)) { @@ -379,7 +379,7 @@ s32 func_80AADEF0(EnMm* this, PlayState* play) { xDiff = waypointPos.x - this->actor.world.pos.x; zDiff = waypointPos.z - this->actor.world.pos.z; - this->yawToWaypoint = (s32)(Math_FAtan2F(xDiff, zDiff) * (0x8000 / M_PI)); + this->yawToWaypoint = RAD_TO_BINANG2(Math_FAtan2F(xDiff, zDiff)); this->distToWaypoint = sqrtf(SQ(xDiff) + SQ(zDiff)); } diff --git a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c index 74c25006c4..2f41c55ad2 100644 --- a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c +++ b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c @@ -367,7 +367,7 @@ void EnToryo_Update(Actor* thisx, PlayState* play) { } rot = thisx->yawTowardsPlayer - thisx->shape.rot.y; - if ((rot < 14563.0f) && (rot > -14563.0f)) { + if ((rot < DEG_TO_BINANG2(80.0f)) && (rot > DEG_TO_BINANG2(-80.0f))) { Npc_TrackPoint(thisx, &this->interactInfo, 0, NPC_TRACKING_HEAD_AND_TORSO); } else { Npc_TrackPoint(thisx, &this->interactInfo, 0, NPC_TRACKING_NONE); diff --git a/src/overlays/actors/ovl_En_Vali/z_en_vali.c b/src/overlays/actors/ovl_En_Vali/z_en_vali.c index c6d765a1d8..96b6ef9db2 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -347,7 +347,7 @@ void EnVali_FloatIdle(EnVali* this, PlayState* play) { curFrame = ((curFrame > 40) ? (80 - curFrame) : curFrame); - this->actor.shape.rot.y += (s16)((curFrame + 4) * 0.4f * (0x10000 / 360.0f)); + this->actor.shape.rot.y += DEG_TO_BINANG((curFrame + 4) * 0.4f); if (this->actor.xzDistToPlayer > 250.0f) { EnVali_SetupReturnToLurk(this); } From 006a00448d5c5f6283033a8accec613df710986d Mon Sep 17 00:00:00 2001 From: cadmic Date: Sun, 18 Aug 2024 22:00:04 -0700 Subject: [PATCH 22/33] Miscellaneous N64 actor changes (#2048) * Misc N64 actor changes * Apply naming suggestions --- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 27 ++++++++++-------- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 2 ++ src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 28 +++++++++++++------ 3 files changed, 38 insertions(+), 19 deletions(-) diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 4734c8c2ee..e5f79ee068 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -57,7 +57,7 @@ void BossMo_DrawEffects(BossMoEffect* effect, PlayState* play); void BossMo_SetupTentacle(BossMo* this, PlayState* play); void BossMo_Tentacle(BossMo* this, PlayState* play); -void BossMo_Unknown(void); +void BossMo_SfxTest(void); typedef enum BossMoEffectType { /* 0 */ MO_FX_NONE, @@ -188,7 +188,7 @@ s32 BossMo_NearLand(Vec3f* pos, f32 margin) { void BossMo_SpawnRipple(BossMoEffect* effect, Vec3f* pos, f32 scale, f32 maxScale, s16 maxAlpha, s16 countLimit, u8 type) { - static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; + static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; s16 i; for (i = 0; i < countLimit; i++, effect++) { @@ -196,8 +196,8 @@ void BossMo_SpawnRipple(BossMoEffect* effect, Vec3f* pos, f32 scale, f32 maxScal effect->stopTimer = 0; effect->type = type; effect->pos = *pos; - effect->vel = zeroVec; - effect->accel = zeroVec; + effect->vel = sZeroVec; + effect->accel = sZeroVec; effect->scale = scale * 0.0025f; effect->fwork[MO_FX_MAX_SIZE] = maxScale * 0.0025f; if (scale > 300.0f) { @@ -2258,7 +2258,10 @@ void BossMo_UpdateCore(Actor* thisx, PlayState* play) { if (player->actor.parent != NULL) { this->actor.flags &= ~ACTOR_FLAG_0; } - BossMo_Unknown(); + +#if PLATFORM_GC + BossMo_SfxTest(); +#endif } void BossMo_UpdateTent(Actor* thisx, PlayState* play) { @@ -2440,7 +2443,7 @@ static Gfx* sTentDLists[41] = { }; void BossMo_DrawTentacle(BossMo* this, PlayState* play) { - static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; + static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; s16 i; s16 notCut; s16 index; @@ -2540,9 +2543,9 @@ void BossMo_DrawTentacle(BossMo* this, PlayState* play) { Matrix_Pop(); } - Matrix_MultVec3f(&zeroVec, &this->tentPos[i]); + Matrix_MultVec3f(&sZeroVec, &this->tentPos[i]); if (i == 36) { - Matrix_MultVec3f(&zeroVec, &this->actor.focus.pos); + Matrix_MultVec3f(&sZeroVec, &this->actor.focus.pos); } if (i == 24) { MtxF sp98; @@ -3046,9 +3049,10 @@ void BossMo_DrawEffects(BossMoEffect* effect, PlayState* play) { CLOSE_DISPS(gfxCtx, "../z_boss_mo.c", 7482); } -void BossMo_Unknown(void) { +#if PLATFORM_GC +void BossMo_SfxTest(void) { // Appears to be a test function for sound effects. - static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; + static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; static u16 unkSfx[] = { // Walking NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_DIRT, @@ -3592,10 +3596,11 @@ void BossMo_Unknown(void) { if (BREG(32) != 0) { BREG(32)--; SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); - Sfx_PlaySfxAtPos(&zeroVec, unkSfx[BREG(33)]); + Sfx_PlaySfxAtPos(&sZeroVec, unkSfx[BREG(33)]); } if (BREG(34) != 0) { BREG(34) = 0; SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, BREG(35)); } } +#endif diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 102eaa6ef0..ebbb8e2b78 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1577,7 +1577,9 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { this->actionFunc = EnGo2_CurledUp; } } else { +#if PLATFORM_GC CLEAR_INFTABLE(INFTABLE_10C); +#endif this->collider.dim.height = (D_80A4816C[PARAMS_GET_S(this->actor.params, 0, 5)].height * 0.6f); EnGo2_SetupRolling(this, play); this->isAwake = true; diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 9edfbe6a32..147f14cf83 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -16,6 +16,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) +#if PLATFORM_N64 +#define CURSOR_COLOR_R 0 +#define CURSOR_COLOR_G 80 +#define CURSOR_COLOR_B 255 +#define CURSOR_COLOR_A 255 +#else +#define CURSOR_COLOR_R 0 +#define CURSOR_COLOR_G 255 +#define CURSOR_COLOR_B 80 +#define CURSOR_COLOR_A 255 +#endif + void EnOssan_Init(Actor* thisx, PlayState* play); void EnOssan_Destroy(Actor* thisx, PlayState* play); void EnOssan_Update(Actor* thisx, PlayState* play); @@ -1882,10 +1894,10 @@ void EnOssan_UpdateCursorAnim(EnOssan* this) { this->cursorAnimState = 0; } } - this->cursorColorR = ColChanMix(0, 0.0f, t); - this->cursorColorG = ColChanMix(255, 80.0f, t); - this->cursorColorB = ColChanMix(80, 0.0f, t); - this->cursorColorA = ColChanMix(255, 0.0f, t); + this->cursorColorR = ColChanMix(CURSOR_COLOR_R, 0.0f, t); + this->cursorColorG = ColChanMix(CURSOR_COLOR_G, 80.0f, t); + this->cursorColorB = ColChanMix(CURSOR_COLOR_B, 0.0f, t); + this->cursorColorA = ColChanMix(CURSOR_COLOR_A, 0.0f, t); this->cursorAnimTween = t; } @@ -2142,10 +2154,10 @@ void EnOssan_InitActionFunc(EnOssan* this, PlayState* play) { this->cursorIndex = 0; this->cursorZ = 1.5f; - this->cursorColorR = 0; - this->cursorColorG = 255; - this->cursorColorB = 80; - this->cursorColorA = 255; + this->cursorColorR = CURSOR_COLOR_R; + this->cursorColorG = CURSOR_COLOR_G; + this->cursorColorB = CURSOR_COLOR_B; + this->cursorColorA = CURSOR_COLOR_A; this->cursorAnimTween = 0; this->cursorAnimState = 0; From 46a5fa919b7bb261c3a11b93fe502c6720619b52 Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 19 Aug 2024 01:24:02 -0700 Subject: [PATCH 23/33] Match ntsc-1.2 z_scene_table.c (#2050) * Match z_scene_table.c * Attempt to fix bss ordering * Forward declare PlayState instead * Untangle circular includes in z64scene.h --- include/n64dd.h | 6 + include/z64interface.h | 2 + include/z64scene.h | 13 +- src/code/z_play.c | 2 +- src/code/z_player_lib.c | 2 + src/code/z_scene_table.c | 165 ++++++++++++++++---- src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- 7 files changed, 160 insertions(+), 32 deletions(-) diff --git a/include/n64dd.h b/include/n64dd.h index d35311a123..d2bf02c1c6 100644 --- a/include/n64dd.h +++ b/include/n64dd.h @@ -1,10 +1,16 @@ #ifndef N64DD_H #define N64DD_H +#include "z64scene.h" + +struct PlayState; + typedef struct n64ddStruct_80121AF0 { char unk_00[0x3C]; void (*unk_3C)(void); void (*unk_40)(void); + char unk_44[0x28]; + void (*unk_6C)(struct PlayState*, SceneDrawConfigFunc*); } n64ddStruct_80121AF0; // size = ? extern n64ddStruct_80121AF0* B_80121AF0; diff --git a/include/z64interface.h b/include/z64interface.h index ba8630ab3f..012faa274e 100644 --- a/include/z64interface.h +++ b/include/z64interface.h @@ -1,6 +1,8 @@ #ifndef Z64INTERFACE_H #define Z64INTERFACE_H +#include "z64view.h" + extern u8 _icon_item_staticSegmentRomStart[]; extern u8 _icon_item_24_staticSegmentRomStart[]; diff --git a/include/z64scene.h b/include/z64scene.h index ec3d33f855..72fb4ebd8b 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -1,11 +1,18 @@ #ifndef Z64SCENE_H #define Z64SCENE_H -#include "z64.h" -#include "z64dma.h" // for RomFile +#include "macros.h" +#include "ultra64.h" +#include "z64bgcheck.h" +#include "z64dma.h" +#include "z64environment.h" +#include "z64light.h" +#include "z64math.h" #include "command_macros_base.h" +struct PlayState; + typedef struct SceneTableEntry { /* 0x00 */ RomFile sceneFile; /* 0x08 */ RomFile titleFile; @@ -499,6 +506,8 @@ typedef enum SceneDrawConfig { /* 53 */ SDC_MAX } SceneDrawConfig; +typedef void (*SceneDrawConfigFunc)(struct PlayState*); + // R_SCENE_CAM_TYPE values #define SCENE_CAM_TYPE_DEFAULT 0 #define SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT 0x10 // Camera exhibits fixed behaviors and viewpoint changing is handled by shops diff --git a/src/code/z_play.c b/src/code/z_play.c index ab3b475009..5323a2c692 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -4,7 +4,7 @@ #include "z64frame_advance.h" -#pragma increment_block_number "gc-eu:24 gc-eu-mq:24 gc-jp:28 gc-jp-ce:28 gc-jp-mq:28 gc-us:28 gc-us-mq:28" +#pragma increment_block_number "gc-eu:24 gc-eu-mq:24 gc-jp:24 gc-jp-ce:24 gc-jp-mq:24 gc-us:24 gc-us-mq:24" TransitionTile gTransitionTile; s32 gTransitionTileState; diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index bc47ab6ac3..c591f4834e 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -3,6 +3,8 @@ #include "assets/objects/object_link_boy/object_link_boy.h" #include "assets/objects/object_link_child/object_link_child.h" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" + typedef struct BowSlingshotStringData { /* 0x00 */ Gfx* dList; /* 0x04 */ Vec3f pos; diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index d1cd007abd..0317844921 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -2,6 +2,9 @@ #include "quake.h" #include "z64frame_advance.h" +#if PLATFORM_N64 +#include "n64dd.h" +#endif #include "assets/scenes/indoors/miharigoya/miharigoya_scene.h" #include "assets/scenes/indoors/souko/souko_scene.h" @@ -27,6 +30,60 @@ #include "overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h" +void Scene_DrawConfigDefault(PlayState* play); +void Scene_DrawConfigHyruleField(PlayState* play); +void Scene_DrawConfigKakarikoVillage(PlayState* play); +void Scene_DrawConfigZorasRiver(PlayState* play); +void Scene_DrawConfigKokiriForest(PlayState* play); +void Scene_DrawConfigLakeHylia(PlayState* play); +void Scene_DrawConfigZorasDomain(PlayState* play); +void Scene_DrawConfigZorasFountain(PlayState* play); +void Scene_DrawConfigGerudoValley(PlayState* play); +void Scene_DrawConfigLostWoods(PlayState* play); +void Scene_DrawConfigDesertColossus(PlayState* play); +void Scene_DrawConfigGerudosFortress(PlayState* play); +void Scene_DrawConfigHauntedWasteland(PlayState* play); +void Scene_DrawConfigHyruleCastle(PlayState* play); +void Scene_DrawConfigDeathMountainTrail(PlayState* play); +void Scene_DrawConfigDeathMountainCrater(PlayState* play); +void Scene_DrawConfigGoronCity(PlayState* play); +void Scene_DrawConfigLonLonRanch(PlayState* play); +void Scene_DrawConfigFireTemple(PlayState* play); +void Scene_DrawConfigDekuTree(PlayState* play); +void Scene_DrawConfigDodongosCavern(PlayState* play); +void Scene_DrawConfigJabuJabu(PlayState* play); +void Scene_DrawConfigForestTemple(PlayState* play); +void Scene_DrawConfigWaterTemple(PlayState* play); +void Scene_DrawConfigShadowTempleAndWell(PlayState* play); +void Scene_DrawConfigSpiritTemple(PlayState* play); +void Scene_DrawConfigInsideGanonsCastle(PlayState* play); +void Scene_DrawConfigGerudoTrainingGround(PlayState* play); +void Scene_DrawConfigDekuTreeBoss(PlayState* play); +void Scene_DrawConfigWaterTempleBoss(PlayState* play); +void Scene_DrawConfigTempleOfTime(PlayState* play); +void Scene_DrawConfigGrottos(PlayState* play); +void Scene_DrawConfigChamberOfTheSages(PlayState* play); +void Scene_DrawConfigGreatFairyFountain(PlayState* play); +void Scene_DrawConfigShootingGallery(PlayState* play); +void Scene_DrawConfigCastleCourtyardGuards(PlayState* play); +void Scene_DrawConfigOutsideGanonsCastle(PlayState* play); +void Scene_DrawConfigIceCavern(PlayState* play); +void Scene_DrawConfigGanonsTowerCollapseExterior(PlayState* play); +void Scene_DrawConfigFairysFountain(PlayState* play); +void Scene_DrawConfigThievesHideout(PlayState* play); +void Scene_DrawConfigBombchuBowlingAlley(PlayState* play); +void Scene_DrawConfigRoyalFamilysTomb(PlayState* play); +void Scene_DrawConfigLakesideLaboratory(PlayState* play); +void Scene_DrawConfigLonLonBuildings(PlayState* play); +void Scene_DrawConfigMarketGuardHouse(PlayState* play); +void Scene_DrawConfigPotionShopGranny(PlayState* play); +void Scene_DrawConfigCalmWater(PlayState* play); +void Scene_DrawConfigGraveExitLightShining(PlayState* play); +void Scene_DrawConfigBesitu(PlayState* play); +void Scene_DrawConfigFishingPond(PlayState* play); +void Scene_DrawConfigGanonsTowerCollapseInterior(PlayState* play); +void Scene_DrawConfigInsideGanonsCastleCollapse(PlayState* play); + // Entrance Table definition #define DEFINE_ENTRANCE(_0, sceneId, spawn, continueBgm, displayTitleCard, endTransType, startTransType) \ { sceneId, spawn, \ @@ -80,6 +137,75 @@ Gfx sDefaultDisplayList[] = { gsSPEndDisplayList(), }; +#if PLATFORM_N64 // Scene_Draw is at end of file in GC versions + +SceneDrawConfigFunc sSceneDrawConfigs[SDC_MAX] = { + Scene_DrawConfigDefault, // SDC_DEFAULT + Scene_DrawConfigHyruleField, // SDC_HYRULE_FIELD + Scene_DrawConfigKakarikoVillage, // SDC_KAKARIKO_VILLAGE + Scene_DrawConfigZorasRiver, // SDC_ZORAS_RIVER + Scene_DrawConfigKokiriForest, // SDC_KOKIRI_FOREST + Scene_DrawConfigLakeHylia, // SDC_LAKE_HYLIA + Scene_DrawConfigZorasDomain, // SDC_ZORAS_DOMAIN + Scene_DrawConfigZorasFountain, // SDC_ZORAS_FOUNTAIN + Scene_DrawConfigGerudoValley, // SDC_GERUDO_VALLEY + Scene_DrawConfigLostWoods, // SDC_LOST_WOODS + Scene_DrawConfigDesertColossus, // SDC_DESERT_COLOSSUS + Scene_DrawConfigGerudosFortress, // SDC_GERUDOS_FORTRESS + Scene_DrawConfigHauntedWasteland, // SDC_HAUNTED_WASTELAND + Scene_DrawConfigHyruleCastle, // SDC_HYRULE_CASTLE + Scene_DrawConfigDeathMountainTrail, // SDC_DEATH_MOUNTAIN_TRAIL + Scene_DrawConfigDeathMountainCrater, // SDC_DEATH_MOUNTAIN_CRATER + Scene_DrawConfigGoronCity, // SDC_GORON_CITY + Scene_DrawConfigLonLonRanch, // SDC_LON_LON_RANCH + Scene_DrawConfigFireTemple, // SDC_FIRE_TEMPLE + Scene_DrawConfigDekuTree, // SDC_DEKU_TREE + Scene_DrawConfigDodongosCavern, // SDC_DODONGOS_CAVERN + Scene_DrawConfigJabuJabu, // SDC_JABU_JABU + Scene_DrawConfigForestTemple, // SDC_FOREST_TEMPLE + Scene_DrawConfigWaterTemple, // SDC_WATER_TEMPLE + Scene_DrawConfigShadowTempleAndWell, // SDC_SHADOW_TEMPLE_AND_WELL + Scene_DrawConfigSpiritTemple, // SDC_SPIRIT_TEMPLE + Scene_DrawConfigInsideGanonsCastle, // SDC_INSIDE_GANONS_CASTLE + Scene_DrawConfigGerudoTrainingGround, // SDC_GERUDO_TRAINING_GROUND + Scene_DrawConfigDekuTreeBoss, // SDC_DEKU_TREE_BOSS + Scene_DrawConfigWaterTempleBoss, // SDC_WATER_TEMPLE_BOSS + Scene_DrawConfigTempleOfTime, // SDC_TEMPLE_OF_TIME + Scene_DrawConfigGrottos, // SDC_GROTTOS + Scene_DrawConfigChamberOfTheSages, // SDC_CHAMBER_OF_THE_SAGES + Scene_DrawConfigGreatFairyFountain, // SDC_GREAT_FAIRYS_FOUNTAIN + Scene_DrawConfigShootingGallery, // SDC_SHOOTING_GALLERY + Scene_DrawConfigCastleCourtyardGuards, // SDC_CASTLE_COURTYARD_GUARDS + Scene_DrawConfigOutsideGanonsCastle, // SDC_OUTSIDE_GANONS_CASTLE + Scene_DrawConfigIceCavern, // SDC_ICE_CAVERN + Scene_DrawConfigGanonsTowerCollapseExterior, // SDC_GANONS_TOWER_COLLAPSE_EXTERIOR + Scene_DrawConfigFairysFountain, // SDC_FAIRYS_FOUNTAIN + Scene_DrawConfigThievesHideout, // SDC_THIEVES_HIDEOUT + Scene_DrawConfigBombchuBowlingAlley, // SDC_BOMBCHU_BOWLING_ALLEY + Scene_DrawConfigRoyalFamilysTomb, // SDC_ROYAL_FAMILYS_TOMB + Scene_DrawConfigLakesideLaboratory, // SDC_LAKESIDE_LABORATORY + Scene_DrawConfigLonLonBuildings, // SDC_LON_LON_BUILDINGS + Scene_DrawConfigMarketGuardHouse, // SDC_MARKET_GUARD_HOUSE + Scene_DrawConfigPotionShopGranny, // SDC_POTION_SHOP_GRANNY + Scene_DrawConfigCalmWater, // SDC_CALM_WATER + Scene_DrawConfigGraveExitLightShining, // SDC_GRAVE_EXIT_LIGHT_SHINING + Scene_DrawConfigBesitu, // SDC_BESITU + Scene_DrawConfigFishingPond, // SDC_FISHING_POND + Scene_DrawConfigGanonsTowerCollapseInterior, // SDC_GANONS_TOWER_COLLAPSE_INTERIOR + Scene_DrawConfigInsideGanonsCastleCollapse, // SDC_INSIDE_GANONS_CASTLE_COLLAPSE +}; + +void Scene_Draw(PlayState* play) { + if (B_80121AF0 != NULL && B_80121AF0->unk_6C != NULL) { + B_80121AF0->unk_6C(play, sSceneDrawConfigs); + return; + } + + sSceneDrawConfigs[play->sceneDrawConfig](play); +} + +#endif + void Scene_DrawConfigDefault(PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 4725); @@ -169,7 +295,7 @@ void Scene_DrawConfigDodongosCavern(PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x0C, displayListHead); gDPPipeSync(displayListHead++); gDPSetEnvColor(displayListHead++, 255, 255, 255, play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT]); - gSPEndDisplayList(displayListHead); + gSPEndDisplayList(displayListHead++); CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 4956); } @@ -269,8 +395,6 @@ void Scene_DrawConfigGrottos(PlayState* play) { void Scene_DrawConfigChamberOfTheSages(PlayState* play) { u32 gameplayFrames; - if (1) {} - OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5226); gameplayFrames = play->gameplayFrames; @@ -539,8 +663,6 @@ void Scene_DrawConfigOutsideGanonsCastle(PlayState* play) { u32 gameplayFrames; s8 sp83; - if (1) {} // Necessary to match - sp83 = coss(play->gameplayFrames * 1500) >> 8; OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5894); @@ -595,8 +717,6 @@ void Scene_DrawConfigGanonsTowerCollapseExterior(PlayState* play) { u32 gameplayFrames; s8 sp7B; - if (1) {} // Necessary to match - sp7B = coss((play->gameplayFrames * 1500) & 0xFFFF) >> 8; OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5968); @@ -641,8 +761,6 @@ void* sIceCavernEntranceTextures[] = { void Scene_DrawConfigIceCavern(PlayState* play) { u32 gameplayFrames; - if (0) {} // Necessary to match - OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6042); gameplayFrames = play->gameplayFrames; @@ -972,7 +1090,7 @@ void Scene_DrawConfigHyruleField(PlayState* play) { gSPSegment(POLY_XLU_DISP++, 0x0A, displayListHead); if ((gSaveContext.save.dayTime > CLOCK_TIME(7, 0)) && (gSaveContext.save.dayTime <= CLOCK_TIME(18, 30))) { - gSPEndDisplayList(displayListHead); + gSPEndDisplayList(displayListHead++); } else { if (gSaveContext.save.dayTime > CLOCK_TIME(18, 30)) { if (play->roomCtx.unk_74[0] != 255) { @@ -985,11 +1103,8 @@ void Scene_DrawConfigHyruleField(PlayState* play) { } gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, play->roomCtx.unk_74[0]); - - if (1) {} - gSPDisplayList(displayListHead++, spot00_room_0DL_012B20); - gSPEndDisplayList(displayListHead); + gSPEndDisplayList(displayListHead++); } CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6866); @@ -1053,9 +1168,6 @@ void Scene_DrawConfigKokiriForest(PlayState* play) { spA0 = 500; displayListHead = GRAPH_ALLOC(play->state.gfxCtx, 6 * sizeof(Gfx)); - if (1) {} - if (1) {} - OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6965); gameplayFrames = play->gameplayFrames; @@ -1091,7 +1203,7 @@ void Scene_DrawConfigKokiriForest(PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x0B, displayListHead); gDPPipeSync(displayListHead++); gDPSetEnvColor(displayListHead++, 128, 128, 128, spA0 * 0.1f); - gSPEndDisplayList(displayListHead); + gSPEndDisplayList(displayListHead++); gSPSegment(POLY_OPA_DISP++, 0x0C, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, (s16)(-play->roomCtx.unk_74[0] * 0.02f), 32, 16, @@ -1213,8 +1325,6 @@ void Scene_DrawConfigGerudoValley(PlayState* play) { void Scene_DrawConfigLostWoods(PlayState* play) { u32 gameplayFrames; - if (0) {} // Necessary to match - OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7274); gameplayFrames = play->gameplayFrames; @@ -1327,10 +1437,8 @@ void Scene_DrawConfigDeathMountainTrail(PlayState* play) { gSPSegment(POLY_XLU_DISP++, 0x08, displayListHead); - if (1) {} - if ((gSaveContext.save.dayTime > CLOCK_TIME(7, 0)) && (gSaveContext.save.dayTime <= CLOCK_TIME(18, 0))) { - gSPEndDisplayList(displayListHead); + gSPEndDisplayList(displayListHead++); } else { if (gSaveContext.save.dayTime > CLOCK_TIME(18, 0)) { if (play->roomCtx.unk_74[0] != 255) { @@ -1343,11 +1451,8 @@ void Scene_DrawConfigDeathMountainTrail(PlayState* play) { } gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, play->roomCtx.unk_74[0]); - - if (0) {} - gSPDisplayList(displayListHead++, spot16_room_0DL_00AA48); - gSPEndDisplayList(displayListHead); + gSPEndDisplayList(displayListHead++); } gDPPipeSync(POLY_OPA_DISP++); @@ -1588,7 +1693,9 @@ void Scene_DrawConfigBesitu(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7910); } -void (*sSceneDrawConfigs[SDC_MAX])(PlayState*) = { +#if PLATFORM_GC // Scene_Draw is at beginning of file in N64 versions + +SceneDrawConfigFunc sSceneDrawConfigs[SDC_MAX] = { Scene_DrawConfigDefault, // SDC_DEFAULT Scene_DrawConfigHyruleField, // SDC_HYRULE_FIELD Scene_DrawConfigKakarikoVillage, // SDC_KAKARIKO_VILLAGE @@ -1685,3 +1792,5 @@ void Scene_Draw(PlayState* play) { sSceneDrawConfigs[play->sceneDrawConfig](play); #endif } + +#endif diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index fd81943337..0f94da285a 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -14,7 +14,7 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:198 gc-eu-mq:198 gc-jp:200 gc-jp-ce:200 gc-jp-mq:200 gc-us:200 gc-us-mq:200" +#pragma increment_block_number "gc-eu:197 gc-eu-mq:197 gc-jp:199 gc-jp-ce:199 gc-jp-mq:199 gc-us:199 gc-us-mq:199" #define FLAGS ACTOR_FLAG_4 From f5fd8daffb02bafff5869f181a13da48b0f3ae0e Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 19 Aug 2024 09:16:04 -0700 Subject: [PATCH 24/33] Use incremental link for z_message/z_game_over data shenanigans (#2051) Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> --- Makefile | 9 ++++- linker_scripts/audio_table_rodata.ld | 17 -------- linker_scripts/data_with_rodata.ld | 22 +++++++++++ spec | 10 ++--- tools/mkldscript.c | 59 +++++++++++----------------- tools/spec.c | 9 +---- tools/spec.h | 4 -- 7 files changed, 56 insertions(+), 74 deletions(-) delete mode 100644 linker_scripts/audio_table_rodata.ld create mode 100644 linker_scripts/data_with_rodata.ld diff --git a/Makefile b/Makefile index 772f45fb9a..72b1509f91 100644 --- a/Makefile +++ b/Makefile @@ -361,7 +361,8 @@ O_FILES := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f) \ $(foreach f,$(SRC_C_FILES:.c=.o),$(BUILD_DIR)/$f) \ $(foreach f,$(ASSET_C_FILES_EXTRACTED:.c=.o),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \ $(foreach f,$(ASSET_C_FILES_COMMITTED:.c=.o),$(BUILD_DIR)/$f) \ - $(foreach f,$(BASEROM_BIN_FILES),$(BUILD_DIR)/baserom/$(notdir $f).o) + $(foreach f,$(BASEROM_BIN_FILES),$(BUILD_DIR)/baserom/$(notdir $f).o) \ + $(BUILD_DIR)/src/code/z_message_z_game_over.o OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(BUILD_DIR_REPLACE) | grep -o '[^"]*_reloc.o' ) @@ -634,6 +635,10 @@ $(BUILD_DIR)/assets/%.o: $(EXTRACTED_DIR)/assets/%.c $(BUILD_DIR)/src/%.o: src/%.s $(CPP) $(CPPFLAGS) -Iinclude $< | $(AS) $(ASFLAGS) -o $@ +# Incremental link to move z_message and z_game_over data into rodata +$(BUILD_DIR)/src/code/z_message_z_game_over.o: $(BUILD_DIR)/src/code/z_message.o $(BUILD_DIR)/src/code/z_game_over.o + $(LD) -r -T linker_scripts/data_with_rodata.ld -o $@ $^ + $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt: $(BUILD_DIR)/$(SPEC) $(MKDMADATA) $< $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt @@ -758,7 +763,7 @@ ifneq ($(RUN_CC_CHECK),0) $(CC_CHECK) $< endif $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $(@:.o=.tmp) $< - $(LD) -r -T linker_scripts/audio_table_rodata.ld $(@:.o=.tmp) -o $@ + $(LD) -r -T linker_scripts/data_with_rodata.ld $(@:.o=.tmp) -o $@ @$(RM) $(@:.o=.tmp) -include $(DEP_FILES) diff --git a/linker_scripts/audio_table_rodata.ld b/linker_scripts/audio_table_rodata.ld deleted file mode 100644 index 27eab49fc4..0000000000 --- a/linker_scripts/audio_table_rodata.ld +++ /dev/null @@ -1,17 +0,0 @@ -OUTPUT_ARCH (mips) - -/* Audio Table Linker Script, maps data into rodata */ - -SECTIONS { - - .rodata : - { - *(.data*) - *(.rodata*) - } - - /DISCARD/ : - { - *(*); - } -} diff --git a/linker_scripts/data_with_rodata.ld b/linker_scripts/data_with_rodata.ld new file mode 100644 index 0000000000..8d508ee18b --- /dev/null +++ b/linker_scripts/data_with_rodata.ld @@ -0,0 +1,22 @@ +OUTPUT_ARCH (mips) + +/* Maps data into rodata, used for audio tables and z_message/z_game_over */ + +SECTIONS { + .rodata : + { + *(.data) + *(.rodata) + *(.rodata.str*) + *(.rodata.cst*) + } + + /DISCARD/ : + { + /* GNU ld assumes that the linker script always combines .gptab.data and + * .gptab.sdata into .gptab.sdata, and likewise for .gptab.bss and .gptab.sbss. + * To avoid dealing with this, we just discard all .gptab sections. + */ + *(.gptab.*) + } +} diff --git a/spec b/spec index 2edafc4fb2..9d2bc053af 100644 --- a/spec +++ b/spec @@ -641,12 +641,10 @@ beginseg include "$(BUILD_DIR)/src/code/fmodf.o" include "$(BUILD_DIR)/src/code/__osMemset.o" include "$(BUILD_DIR)/src/code/__osMemmove.o" - // For some reason, the data sections of these files are placed here near the - // rodata sections of the other files - include_data_only_within_rodata "$(BUILD_DIR)/src/code/z_message.o" - include_data_only_within_rodata "$(BUILD_DIR)/src/code/z_game_over.o" - include_no_data "$(BUILD_DIR)/src/code/z_message.o" - include_no_data "$(BUILD_DIR)/src/code/z_game_over.o" + // For some reason, the data sections of z_message and z_game_over are + // placed near the rodata sections of other files, so we first build this + // combined object before the final link. + include "$(BUILD_DIR)/src/code/z_message_z_game_over.o" include "$(BUILD_DIR)/src/code/z_construct.o" include "$(BUILD_DIR)/data/audio_tables.rodata.o" include "$(BUILD_DIR)/src/audio/tables/samplebank_table.o" diff --git a/tools/mkldscript.c b/tools/mkldscript.c index 199c77eb74..586a684b92 100644 --- a/tools/mkldscript.c +++ b/tools/mkldscript.c @@ -64,13 +64,10 @@ static void write_ld_script(FILE *fout) for (j = 0; j < seg->includesCount; j++) { - if (!seg->includes[j].dataOnlyWithinRodata) - { - fprintf(fout, " %s (.text)\n", seg->includes[j].fpath); - if (seg->includes[j].linkerPadding != 0) - fprintf(fout, " . += 0x%X;\n", seg->includes[j].linkerPadding); - fprintf(fout, " . = ALIGN(0x10);\n"); - } + fprintf(fout, " %s (.text)\n", seg->includes[j].fpath); + if (seg->includes[j].linkerPadding != 0) + fprintf(fout, " . += 0x%X;\n", seg->includes[j].linkerPadding); + fprintf(fout, " . = ALIGN(0x10);\n"); } fprintf(fout, " _%sSegmentTextEnd = .;\n", seg->name); @@ -81,9 +78,8 @@ static void write_ld_script(FILE *fout) for (j = 0; j < seg->includesCount; j++) { - if (!seg->includes[j].dataOnlyWithinRodata && !seg->includes[j].noData) - fprintf(fout, " %s (.data)\n" - " . = ALIGN(0x10);\n", seg->includes[j].fpath); + fprintf(fout, " %s (.data)\n" + " . = ALIGN(0x10);\n", seg->includes[j].fpath); } fprintf(fout, " _%sSegmentDataEnd = .;\n", seg->name); @@ -94,10 +90,6 @@ static void write_ld_script(FILE *fout) for (j = 0; j < seg->includesCount; j++) { - if (seg->includes[j].dataOnlyWithinRodata) - fprintf(fout, " %s (.data)\n" - " . = ALIGN(0x10);\n", seg->includes[j].fpath); - // Compilers other than IDO, such as GCC, produce different sections such as // the ones named directly below. These sections do not contain values that // need relocating, but we need to ensure that the base .rodata section @@ -106,12 +98,11 @@ static void write_ld_script(FILE *fout) // the beginning of the entire rodata area in order to remain consistent. // Inconsistencies will lead to various .rodata reloc crashes as a result of // either missing relocs or wrong relocs. - if (!seg->includes[j].dataOnlyWithinRodata) - fprintf(fout, " %s (.rodata)\n" - " %s (.rodata.str*)\n" - " %s (.rodata.cst*)\n" - " . = ALIGN(0x10);\n", - seg->includes[j].fpath, seg->includes[j].fpath, seg->includes[j].fpath); + fprintf(fout, " %s (.rodata)\n" + " %s (.rodata.str*)\n" + " %s (.rodata.cst*)\n" + " . = ALIGN(0x10);\n", + seg->includes[j].fpath, seg->includes[j].fpath, seg->includes[j].fpath); } fprintf(fout, " _%sSegmentRoDataEnd = .;\n", seg->name); @@ -121,17 +112,15 @@ static void write_ld_script(FILE *fout) fprintf(fout, " _%sSegmentSDataStart = .;\n", seg->name); for (j = 0; j < seg->includesCount; j++) - if (!seg->includes[j].dataOnlyWithinRodata) - fprintf(fout, " %s (.sdata)\n" - " . = ALIGN(0x10);\n", seg->includes[j].fpath); + fprintf(fout, " %s (.sdata)\n" + " . = ALIGN(0x10);\n", seg->includes[j].fpath); fprintf(fout, " _%sSegmentSDataEnd = .;\n", seg->name); fprintf(fout, " _%sSegmentOvlStart = .;\n", seg->name); for (j = 0; j < seg->includesCount; j++) - if (!seg->includes[j].dataOnlyWithinRodata) - fprintf(fout, " %s (.ovl)\n", seg->includes[j].fpath); + fprintf(fout, " %s (.ovl)\n", seg->includes[j].fpath); fprintf(fout, " _%sSegmentOvlEnd = .;\n", seg->name); @@ -159,24 +148,20 @@ static void write_ld_script(FILE *fout) seg->name, seg->name, seg->name, seg->name); for (j = 0; j < seg->includesCount; j++) - if (!seg->includes[j].dataOnlyWithinRodata) - fprintf(fout, " %s (.sbss)\n" - " . = ALIGN(0x10);\n", seg->includes[j].fpath); + fprintf(fout, " %s (.sbss)\n" + " . = ALIGN(0x10);\n", seg->includes[j].fpath); for (j = 0; j < seg->includesCount; j++) - if (!seg->includes[j].dataOnlyWithinRodata) - fprintf(fout, " %s (.scommon)\n" - " . = ALIGN(0x10);\n", seg->includes[j].fpath); + fprintf(fout, " %s (.scommon)\n" + " . = ALIGN(0x10);\n", seg->includes[j].fpath); for (j = 0; j < seg->includesCount; j++) - if (!seg->includes[j].dataOnlyWithinRodata) - fprintf(fout, " %s (.bss)\n" - " . = ALIGN(0x10);\n", seg->includes[j].fpath); + fprintf(fout, " %s (.bss)\n" + " . = ALIGN(0x10);\n", seg->includes[j].fpath); for (j = 0; j < seg->includesCount; j++) - if (!seg->includes[j].dataOnlyWithinRodata) - fprintf(fout, " %s (COMMON)\n" - " . = ALIGN(0x10);\n", seg->includes[j].fpath); + fprintf(fout, " %s (COMMON)\n" + " . = ALIGN(0x10);\n", seg->includes[j].fpath); fprintf(fout, " . = ALIGN(0x10);\n" " _%sSegmentBssEnd = .;\n" diff --git a/tools/spec.c b/tools/spec.c index b13455867c..962cf4bb25 100644 --- a/tools/spec.c +++ b/tools/spec.c @@ -136,8 +136,6 @@ static const char *const stmtNames[] = [STMT_entry] = "entry", [STMT_flags] = "flags", [STMT_include] = "include", - [STMT_include_data_only_within_rodata] = "include_data_only_within_rodata", - [STMT_include_no_data] = "include_no_data", [STMT_name] = "name", [STMT_number] = "number", [STMT_romalign] = "romalign", @@ -159,8 +157,7 @@ STMTId get_stmt_id_by_stmt_name(const char *stmtName, int lineNum) { bool parse_segment_statement(struct Segment *currSeg, STMTId stmt, char* args, int lineNum) { // ensure no duplicates (except for 'include' or 'pad_text') - if (stmt != STMT_include && stmt != STMT_include_data_only_within_rodata && - stmt != STMT_include_no_data && stmt != STMT_pad_text && + if (stmt != STMT_include && stmt != STMT_pad_text && (currSeg->fields & (1 << stmt))) util_fatal_error("line %i: duplicate '%s' statement", lineNum, stmtNames[stmt]); @@ -213,8 +210,6 @@ bool parse_segment_statement(struct Segment *currSeg, STMTId stmt, char* args, i util_fatal_error("line %i: alignment is not a power of two", lineNum); break; case STMT_include: - case STMT_include_data_only_within_rodata: - case STMT_include_no_data: currSeg->includesCount++; currSeg->includes = realloc(currSeg->includes, currSeg->includesCount * sizeof(*currSeg->includes)); @@ -222,8 +217,6 @@ bool parse_segment_statement(struct Segment *currSeg, STMTId stmt, char* args, i util_fatal_error("line %i: invalid filename", lineNum); currSeg->includes[currSeg->includesCount - 1].linkerPadding = 0; - currSeg->includes[currSeg->includesCount - 1].dataOnlyWithinRodata = (stmt == STMT_include_data_only_within_rodata); - currSeg->includes[currSeg->includesCount - 1].noData = (stmt == STMT_include_no_data); break; case STMT_increment: if (!parse_number(args, &currSeg->increment)) diff --git a/tools/spec.h b/tools/spec.h index 6b01b34755..734b1ba8c3 100644 --- a/tools/spec.h +++ b/tools/spec.h @@ -14,8 +14,6 @@ typedef enum { STMT_entry, STMT_flags, STMT_include, - STMT_include_data_only_within_rodata, - STMT_include_no_data, STMT_name, STMT_number, STMT_romalign, @@ -35,8 +33,6 @@ enum { struct Include { char* fpath; int linkerPadding; - bool dataOnlyWithinRodata; - bool noData; }; typedef struct Segment { From 6bc6cedaf8a26b4b73be748b635308fb059c61f1 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 19 Aug 2024 22:17:41 +0200 Subject: [PATCH 25/33] [ntsc-1.2] Match boot_main.c, logutils.c, z_locale.c (text) (#2053) * Match boot_main.c, logutils.c, z_locale.c (text) * review * review 2 --- Makefile | 2 +- include/cic6105.h | 2 ++ include/functions.h | 10 +++++++++- src/boot/boot_main.c | 9 +++++++-- src/boot/logutils.c | 16 +++++++++++----- src/boot/z_locale.c | 21 +++++++++++++++++++-- tools/disasm/ntsc-1.2/functions.txt | 4 ++-- undefined_syms.txt | 8 ++++++++ 8 files changed, 59 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 72b1509f91..a97bb3b3c5 100644 --- a/Makefile +++ b/Makefile @@ -399,6 +399,7 @@ $(shell mkdir -p $(foreach dir, \ endif ifeq ($(COMPILER),ido) +$(BUILD_DIR)/src/boot/logutils.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/boot/stackcheck.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/__osMalloc.o: OPTFLAGS := -O2 @@ -410,7 +411,6 @@ $(BUILD_DIR)/src/code/jpegutils.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/jpegdecoder.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/load.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/loadfragment2.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/logutils.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/mtxuty-cvt.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/padsetup.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/padutils.o: OPTFLAGS := -O2 diff --git a/include/cic6105.h b/include/cic6105.h index ab004d63a3..78b82ca272 100644 --- a/include/cic6105.h +++ b/include/cic6105.h @@ -5,4 +5,6 @@ extern u32 B_80008EE0; +void func_80001720(void); + #endif diff --git a/include/functions.h b/include/functions.h index a28a9e68fb..d9ef5170c4 100644 --- a/include/functions.h +++ b/include/functions.h @@ -4,7 +4,6 @@ #include "z64.h" #include "macros.h" -void cleararena(void); void bootproc(void); void Main_ThreadEntry(void* arg); void Idle_ThreadEntry(void* arg); @@ -47,6 +46,15 @@ s32 osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 flag); void osStopThread(OSThread* thread); void osViExtendVStart(u32 value); s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag); +#if PLATFORM_N64 +void osInitialize(void); +#else +#define osInitialize() \ +{ \ + __osInitialize_common(); \ + __osInitialize_autodetect(); \ +} +#endif void __osInitialize_common(void); void __osInitialize_autodetect(void); void __osEnqueueAndYield(OSThread**); diff --git a/src/boot/boot_main.c b/src/boot/boot_main.c index 23b8495f8f..2f09bbd778 100644 --- a/src/boot/boot_main.c +++ b/src/boot/boot_main.c @@ -1,5 +1,8 @@ #include "global.h" #include "boot.h" +#if PLATFORM_N64 +#include "cic6105.h" +#endif StackEntry sBootThreadInfo; OSThread sIdleThread; @@ -15,9 +18,11 @@ void bootproc(void) { StackCheck_Init(&sBootThreadInfo, sBootThreadStack, STACK_TOP(sBootThreadStack), 0, -1, "boot"); osMemSize = osGetMemSize(); +#if PLATFORM_N64 + func_80001720(); +#endif bootclear(); - __osInitialize_common(); - __osInitialize_autodetect(); + osInitialize(); gCartHandle = osCartRomInit(); osDriveRomInit(); diff --git a/src/boot/logutils.c b/src/boot/logutils.c index 68fcda21a4..ba43fbe7f4 100644 --- a/src/boot/logutils.c +++ b/src/boot/logutils.c @@ -1,16 +1,18 @@ #include "global.h" #include "terminal.h" -#if OOT_DEBUG +#if PLATFORM_N64 || OOT_DEBUG f32 LogUtils_CheckFloatRange(const char* exp, int line, const char* valueName, f32 value, const char* minName, f32 min, const char* maxName, f32 max) { if (value < min || max < value) { - PRINTF("%s %d: range error %s(%f) < %s(%f) < %s(%f)\n", exp, line, minName, min, valueName, value, maxName, - max); + osSyncPrintf("%s %d: range error %s(%f) < %s(%f) < %s(%f)\n", exp, line, minName, min, valueName, value, + maxName, max); } return value; } +#endif +#if OOT_DEBUG s32 LogUtils_CheckIntRange(const char* exp, int line, const char* valueName, s32 value, const char* minName, s32 min, const char* maxName, s32 max) { if (value < min || max < value) { @@ -105,11 +107,15 @@ void LogUtils_LogThreadId(const char* name, int line) { void LogUtils_HungupThread(const char* name, int line) { OSId threadId = osGetThreadId(NULL); - PRINTF("*** HungUp in thread %d, [%s:%d] ***\n", threadId, name, line); +#if PLATFORM_N64 || OOT_DEBUG + osSyncPrintf("*** HungUp in thread %d, [%s:%d] ***\n", threadId, name, line); +#endif Fault_AddHungupAndCrash(name, line); } void LogUtils_ResetHungup(void) { - PRINTF("*** Reset ***\n"); +#if PLATFORM_N64 || OOT_DEBUG + osSyncPrintf("*** Reset ***\n"); +#endif Fault_AddHungupAndCrash("Reset", 0); } diff --git a/src/boot/z_locale.c b/src/boot/z_locale.c index 72e1831717..2474986f0d 100644 --- a/src/boot/z_locale.c +++ b/src/boot/z_locale.c @@ -3,13 +3,26 @@ #include "terminal.h" s32 gCurrentRegion = 0; -LocaleCartInfo sCartInfo; void Locale_Init(void) { +#if PLATFORM_N64 + ALIGNED(4) u8 regionInfo[4]; + u8 countryCode; + + osEPiReadIo(gCartHandle, 0x3C, (u32*)regionInfo); + + countryCode = regionInfo[2]; +#else + static LocaleCartInfo sCartInfo; + u8 countryCode; + osEPiReadIo(gCartHandle, 0x38, &sCartInfo.mediaFormat); osEPiReadIo(gCartHandle, 0x3C, &sCartInfo.regionInfo); - switch (sCartInfo.countryCode) { + countryCode = sCartInfo.countryCode; +#endif + + switch (countryCode) { case 'J': // "NTSC-J (Japan)" gCurrentRegion = REGION_JP; break; @@ -22,7 +35,11 @@ void Locale_Init(void) { default: PRINTF(VT_COL(RED, WHITE)); PRINTF("z_locale_init: 日本用かアメリカ用か判別できません\n"); +#if PLATFORM_N64 + LogUtils_HungupThread("../z_locale.c", 101); +#else LogUtils_HungupThread("../z_locale.c", 118); +#endif PRINTF(VT_RST); break; } diff --git a/tools/disasm/ntsc-1.2/functions.txt b/tools/disasm/ntsc-1.2/functions.txt index 34f49890b1..9d28a69647 100644 --- a/tools/disasm/ntsc-1.2/functions.txt +++ b/tools/disasm/ntsc-1.2/functions.txt @@ -1,5 +1,5 @@ entrypoint = 0x80000400; // type:func -cleararena = 0x80000460; // type:func +bootclear = 0x80000460; // type:func bootproc = 0x80000498; // type:func Main_ThreadEntry = 0x800005A0; // type:func Idle_ThreadEntry = 0x8000063C; // type:func @@ -27,7 +27,7 @@ func_800015E8_unknown = 0x800015E8; // type:func func_8000161C_unknown = 0x8000161C; // type:func func_80001640_unknown = 0x80001640; // type:func func_80001714_unknown = 0x80001714; // type:func -func_80001720_unknown = 0x80001720; // type:func +func_80001720 = 0x80001720; // type:func osSyncPrintfUnused = 0x80001750; // type:func osSyncPrintf = 0x8000176C; // type:func rmonPrintf = 0x80001788; // type:func diff --git a/undefined_syms.txt b/undefined_syms.txt index deba8affd0..c6d194e0cb 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -9,3 +9,11 @@ D_0F000000 = 0x0F000000; // z_bg_mjin D_06000000 = 0x06000000; + +#if PLATFORM_N64 + +// boot_main.c +func_80001720 = 0x80001720; +osInitialize = 0x80003230; + +#endif From d191e8714e0b05ab8305951adff89542eb83e7c8 Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 19 Aug 2024 14:58:31 -0700 Subject: [PATCH 26/33] Allow building the Debug ROM without debug features (#2052) * Allow building the Debug ROM without debug features * Fix bss * Add comment * Reword again * Fix bss --- include/segment_symbols.h | 5 +++-- src/code/main.c | 2 +- src/code/z_actor.c | 2 +- src/code/z_demo.c | 2 +- src/code/z_message.c | 2 ++ src/code/z_play.c | 2 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 2 ++ src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 2 ++ src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- src/overlays/actors/ovl_player_actor/z_player.c | 6 +++--- 10 files changed, 17 insertions(+), 10 deletions(-) diff --git a/include/segment_symbols.h b/include/segment_symbols.h index 21fd52f0ab..4e0ce0bbd4 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -648,7 +648,9 @@ DECLARE_ROM_SEGMENT(spot20_room_0) DECLARE_ROM_SEGMENT(ganon_tou_room_0) -#if OOT_DEBUG +// Room symbols for compiling test scenes, these are not wrapped in an `#if OOT_DEBUG` +// so that debug ROMs (including gc-eu-mq-dbg) can be built with OOT_DEBUG=0. + DECLARE_ROM_SEGMENT(test01_room_0) DECLARE_ROM_SEGMENT(besitu_room_0) @@ -670,6 +672,5 @@ DECLARE_ROM_SEGMENT(testroom_room_1) DECLARE_ROM_SEGMENT(testroom_room_2) DECLARE_ROM_SEGMENT(testroom_room_3) DECLARE_ROM_SEGMENT(testroom_room_4) -#endif #endif diff --git a/src/code/main.c b/src/code/main.c index 3dada11023..6ba4e17af1 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -7,7 +7,7 @@ s32 gScreenWidth = SCREEN_WIDTH; s32 gScreenHeight = SCREEN_HEIGHT; u32 gSystemHeapSize = 0; -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0" +#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" PreNmiBuff* gAppNmiBufferPtr; Scheduler gScheduler; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 89dd9400c7..0be5916674 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -8,7 +8,7 @@ #include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "assets/objects/object_bdoor/object_bdoor.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0" +#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" static CollisionPoly* sCurCeilingPoly; static s32 sCurCeilingBgId; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 5d7dd7f3e8..36ae51e991 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -120,7 +120,7 @@ u16 gCamAtSplinePointsAppliedFrame; u16 gCamEyePointAppliedFrame; u16 gCamAtPointAppliedFrame; -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" // Cam ID to return to when a scripted cutscene is finished s16 sReturnToCamId; diff --git a/src/code/z_message.c b/src/code/z_message.c index 620a6d0868..2266cd1f9f 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -3,6 +3,8 @@ #include "terminal.h" #include "assets/textures/parameter_static/parameter_static.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" + s16 sTextFade = false; // original name: key_off_flag ? u8 D_8014B2F4 = 0; diff --git a/src/code/z_play.c b/src/code/z_play.c index 5323a2c692..135f24c75e 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -4,7 +4,7 @@ #include "z64frame_advance.h" -#pragma increment_block_number "gc-eu:24 gc-eu-mq:24 gc-jp:24 gc-jp-ce:24 gc-jp-mq:24 gc-us:24 gc-us-mq:24" +#pragma increment_block_number "gc-eu:252 gc-eu-mq:252 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0" TransitionTile gTransitionTile; s32 gTransitionTileState; diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index e5f79ee068..b579b60429 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -10,6 +10,8 @@ #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "terminal.h" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" + #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) #define MO_WATER_LEVEL(play) play->colCtx.colHeader->waterBoxes[0].ySurface diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index d4b3b38d23..67f804e26a 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -10,6 +10,8 @@ #include "overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.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" + #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_10) #define vParity actionVar diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 0f94da285a..943a999520 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -14,7 +14,7 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:197 gc-eu-mq:197 gc-jp:199 gc-jp-ce:199 gc-jp-mq:199 gc-us:199 gc-us-mq:199" +#pragma increment_block_number "gc-eu:171 gc-eu-mq:171 gc-jp:173 gc-jp-ce:173 gc-jp-mq:173 gc-us:173 gc-us-mq:173" #define FLAGS ACTOR_FLAG_4 diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index a1894e51ad..368c8f2e61 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -354,19 +354,19 @@ void Player_Action_CsAction(Player* this, PlayState* play); // .bss part 1 -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0" +#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" static s32 D_80858AA0; // TODO: There's probably a way to match BSS ordering with less padding by spreading the variables out and moving // data around. It would be easier if we had more options for controlling BSS ordering in debug. -#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" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" static s32 D_80858AA4; static Vec3f sInteractWallCheckResult; static Input* sControlInput; -#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" +#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" // .data From ebbc820ef65b11eec5edb797edd9f2e66670549b Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 19 Aug 2024 23:58:41 +0200 Subject: [PATCH 27/33] Add "disasm sym_info.py" script (#2054) * Add "disasm sym_info.py" script for investigating the expected memory layout * review * add friendly error if context.csv is missing * rom as hexadecimal * require spimdisasm 1.28.1 (technically not *required* but may as well) * some fixups on symbol lookup logic --- requirements.txt | 2 +- tools/disasm/disasm.py | 10 +- tools/disasm/sym_info.py | 229 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 239 insertions(+), 2 deletions(-) create mode 100755 tools/disasm/sym_info.py diff --git a/requirements.txt b/requirements.txt index 3d10e8edfd..45c122f0ec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,4 +18,4 @@ toml mapfile-parser>=2.3.5,<3.0.0 pyelftools==0.30 rabbitizer>=1.0.0,<2.0.0 -spimdisasm>=1.21.0,<2.0.0 +spimdisasm>=1.28.1,<2.0.0 diff --git a/tools/disasm/disasm.py b/tools/disasm/disasm.py index d0affdd485..95775ad5ed 100755 --- a/tools/disasm/disasm.py +++ b/tools/disasm/disasm.py @@ -85,6 +85,11 @@ def main(): args = parser.parse_args() + if spimdisasm.__version_info__ < (1, 28, 1): + print(f"Error: spimdisasm>=1.28.1 is required (you have {spimdisasm.__version__})") + print("Hint: run `make setup` to update the venv.") + exit(1) + context = spimdisasm.common.Context() context.parseArgs(args) context.changeGlobalSegmentRanges(0x00000000, 0x01000000, 0x8000000, 0x81000000) @@ -117,9 +122,12 @@ def main(): print() print("Analyzing done.") - print("Writing disassembled sections...") output_dir: Path = args.output_dir output_dir.mkdir(parents=True, exist_ok=True) + + context.saveContextToFile(output_dir / "context.csv") + + print("Writing disassembled sections...") for i, file_splits in enumerate(all_file_splits): f = i / len(all_file_splits) spimdisasm.common.Utils.printQuietless( diff --git a/tools/disasm/sym_info.py b/tools/disasm/sym_info.py new file mode 100755 index 0000000000..a13a4afaa1 --- /dev/null +++ b/tools/disasm/sym_info.py @@ -0,0 +1,229 @@ +#!/usr/bin/env python3 +# SPDX-FileCopyrightText: © 2024 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import argparse +import csv +import dataclasses +from pathlib import Path +from typing import Optional + + +@dataclasses.dataclass +class Sym: + name: str + value: int + type: Optional[str] + size: Optional[int] + vrom: int + + +@dataclasses.dataclass +class FileSection: + file: str + section: str + syms: list[Sym] + vma_start: int + + +LABELS_TYPES = {"@branchlabel", "@jumptablelabel"} + + +def main(): + parser = argparse.ArgumentParser( + description="Print informations on a symbol/address" + " (and possibly surrounding symbols)" + " from the spimdisasm disassembly context saved in" + " expected/build/VERSION/context.csv" + ) + parser.add_argument("sym_or_vma") + default_version = "ntsc-1.2" + parser.add_argument( + "--version", + "-v", + default=default_version, + help=f"oot version (default: {default_version})", + ) + parser.add_argument( + "--around", + "-n", + type=int, + default=0, + help="how many symbols to show around the target (at least)", + ) + parser.add_argument( + "--range", + "-r", + type=lambda v: int(v, 0), + default=0, + help="show symbols within this range around the target (at least)", + ) + parser.add_argument( + "--file", + "-f", + action="store_true", + help="show symbols within the same file and section as the target (at least)", + ) + parser.add_argument( + "--labels", + "-l", + action="store_true", + help="also show branch and jump table labels symbols", + ) + args = parser.parse_args() + + sym_or_vma = args.sym_or_vma + if "_" in sym_or_vma: + # special case to avoid parsing e.g. `D_80123456` as hexadecimal 0xD80123456 + sym_or_vma_is_sym = True + else: + try: + target_sym_name = None + target_vma = int(sym_or_vma, 16) + sym_or_vma_is_sym = False + except ValueError: + sym_or_vma_is_sym = True + if sym_or_vma_is_sym: + target_sym_name = sym_or_vma + target_vma = None + + syms_by_section_by_file = dict[str, dict[str, list[Sym]]]() + + context_csv_p = Path(f"expected/build/{args.version}/context.csv") + if not context_csv_p.exists(): + print(f"Context file does not exist: {context_csv_p}") + print(f"Hint: run `make VERSION={args.version} disasm`") + exit(1) + + with context_csv_p.open() as f: + for e in csv.DictReader(f): + if e["category"] != "symbol": + continue + sym_name = e["getName"] + sym_value = e["address"] + sym_type = e["getType"] + sym_size = e["getSize"] + sym_vrom = e["getVrom"] + sym_section = e["sectionType"] + sym_file = e["parentFileName"] + + if sym_file == "None": + sym_file = None + + if not sym_section or not sym_file: + continue + + sym_value_int = int(sym_value, 0) + sym_size_int = int(sym_size, 0) if sym_size else None + sym_vrom_int = int(sym_vrom, 0) + + syms_by_section_by_file.setdefault(sym_file, dict()).setdefault( + sym_section, list() + ).append( + Sym( + sym_name, + sym_value_int, + sym_type if sym_type else None, + sym_size_int, + sym_vrom_int, + ) + ) + + if sym_name == target_sym_name: + target_vma = sym_value_int + + if target_vma is None: + parser.error(f"No symbol '{target_sym_name}'") + else: + if target_sym_name is not None: + print(f"{target_sym_name} = 0x{target_vma:08X}") + + del target_sym_name + + filesections = list[FileSection]() + + for file, syms_by_section in syms_by_section_by_file.items(): + for section, syms in syms_by_section.items(): + syms.sort(key=lambda sym: sym.value) + vma_start = syms[0].value + filesections.append(FileSection(file, section, syms, vma_start)) + + filesections.sort(key=lambda fs: fs.vma_start) + + def get_first_print_sym(): + prev_syms = list[Sym]() + for fs in filesections: + for sym in fs.syms: + if not args.labels and sym.type in LABELS_TYPES: + continue + if target_vma < sym.value: + return prev_syms[0] + prev_syms.append(sym) + while ( + len(prev_syms) - 1 > args.around + and prev_syms[0].value < target_vma - args.range + ): + prev_syms.pop(0) + + first_print_sym = get_first_print_sym() + + def get_last_print_sym(): + min_skip_count = args.around + for fs in filesections: + for sym in fs.syms: + if not args.labels and sym.type in LABELS_TYPES: + continue + if target_vma <= sym.value: + min_skip_count -= 1 + if min_skip_count < 0 and sym.value >= args.range + target_vma: + return sym + + last_print_sym = get_last_print_sym() + + is_near_target = False + + indent = " " * 4 + + for i_fs, fs in enumerate(filesections): + fs_printed = False + is_first_fs_sym = True + fs_printed_end_ellipsis = False + for sym in fs.syms: + if not args.labels and sym.type in LABELS_TYPES: + continue + + if sym == first_print_sym: + is_near_target = True + + print_sym = is_near_target or ( + args.file + and fs.vma_start <= target_vma + and ( + target_vma < filesections[i_fs + 1].vma_start + if i_fs + 1 < len(filesections) + else True + ) + ) + if not print_sym and fs_printed: + if not fs_printed_end_ellipsis: + print(f"{indent}...") + fs_printed_end_ellipsis = True + if print_sym: + if not fs_printed: + print(fs.file, fs.section) + fs_printed = True + if not is_first_fs_sym: + print(f"{indent}...") + print( + f"{indent}{sym.name} 0x{sym.value:X} ROM:0x{sym.vrom:X}" + + (f" ({sym.type})" if sym.type else "") + + (f" (sz=0x{sym.size:X})" if sym.size else "") + ) + is_first_fs_sym = False + + if sym == last_print_sym: + is_near_target = False + + +if __name__ == "__main__": + main() From aba1bb88a3ed369ab450345a65f0176ceb0e482c Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 19 Aug 2024 16:15:14 -0700 Subject: [PATCH 28/33] Fix missing DEG_TO_BINANG2 (#2059) --- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index ef8cb8cc89..746a7b882f 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -438,7 +438,7 @@ void func_80A4F13C(EnGs* this, PlayState* play) { } } if (this->unk_19F == 4) { - tmpf1 = Math_SmoothStepToF(&this->unk_1E8, this->unk_1EC, 0.8f, DEG_TO_BINANG2(90.0f), 3640.0f); + tmpf1 = Math_SmoothStepToF(&this->unk_1E8, this->unk_1EC, 0.8f, DEG_TO_BINANG2(90.0f), DEG_TO_BINANG2(20.0f)); this->unk_1A0[0].y += (s16)this->unk_1E8; if (tmpf1 == 0.0f) { From ec70295357c198c48660e2ab5670c15ef6a661cf Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 19 Aug 2024 22:15:24 -0700 Subject: [PATCH 29/33] Move non-libultra libc functions to src/libc/ (#2055) * Move non-libultra libc functions to src/libc/ * Add explicit nops in delay slots * Don't rely on CPP expanding undefined macros to 0 * Delete old Makefile rules * Fix type of memset() --- Makefile | 16 ++--------- include/functions.h | 4 +-- spec | 18 +++++++----- src/code/__osMalloc.c | 12 ++++---- src/code/code_80069420.c | 2 +- src/code/z_camera.c | 2 +- src/code/z_lib.c | 2 +- src/code/z_quake.c | 2 +- src/code/z_view.c | 2 +- src/gcc_fix/missing_gcc_functions.c | 32 ---------------------- src/libc/absf.s | 15 ++++++++++ src/{code => libc}/fmodf.c | 0 src/{code/__osMemmove.c => libc/memmove.c} | 2 +- src/{code/__osMemset.c => libc/memset.c} | 4 +-- src/libc/sqrt.s | 15 ++++++++++ src/libultra/libc/absf.c | 9 ------ src/libultra/libc/sqrt.c | 9 ------ tools/disasm/ntsc-1.2/files_code.csv | 8 +++--- tools/disasm/ntsc-1.2/functions.txt | 4 +-- 19 files changed, 65 insertions(+), 93 deletions(-) create mode 100644 src/libc/absf.s rename src/{code => libc}/fmodf.c (100%) rename src/{code/__osMemmove.c => libc/memmove.c} (91%) rename src/{code/__osMemset.c => libc/memset.c} (76%) create mode 100644 src/libc/sqrt.s delete mode 100644 src/libultra/libc/absf.c delete mode 100644 src/libultra/libc/sqrt.c diff --git a/Makefile b/Makefile index a97bb3b3c5..4728b9665f 100644 --- a/Makefile +++ b/Makefile @@ -426,13 +426,9 @@ $(BUILD_DIR)/src/code/fault_drawer.o: OPTFLAGS := -O2 -g3 $(BUILD_DIR)/src/code/ucode_disas.o: OPTFLAGS := -O2 -g3 ifeq ($(DEBUG),1) -$(BUILD_DIR)/src/code/fmodf.o: OPTFLAGS := -g -$(BUILD_DIR)/src/code/__osMemset.o: OPTFLAGS := -g -$(BUILD_DIR)/src/code/__osMemmove.o: OPTFLAGS := -g +$(BUILD_DIR)/src/libc/%.o: OPTFLAGS := -g else -$(BUILD_DIR)/src/code/fmodf.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/__osMemset.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/__osMemmove.o: OPTFLAGS := -O2 +$(BUILD_DIR)/src/libc/%.o: OPTFLAGS := -O2 endif $(BUILD_DIR)/src/audio/%.o: OPTFLAGS := -O2 @@ -444,14 +440,6 @@ $(BUILD_DIR)/src/audio/general.o: CFLAGS += -signed $(BUILD_DIR)/src/audio/sfx.o: CFLAGS += -use_readwrite_const $(BUILD_DIR)/src/audio/sequence.o: CFLAGS += -use_readwrite_const -ifeq ($(DEBUG),1) -$(BUILD_DIR)/src/libultra/libc/absf.o: OPTFLAGS := -O2 -g3 -$(BUILD_DIR)/src/libultra/libc/sqrt.o: OPTFLAGS := -O2 -g3 -else -$(BUILD_DIR)/src/libultra/libc/absf.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/libultra/libc/sqrt.o: OPTFLAGS := -O2 -endif - $(BUILD_DIR)/src/libultra/libc/ll.o: OPTFLAGS := -O1 $(BUILD_DIR)/src/libultra/libc/ll.o: MIPS_VERSION := -mips3 -32 $(BUILD_DIR)/src/libultra/libc/llcvt.o: OPTFLAGS := -O1 diff --git a/include/functions.h b/include/functions.h index d9ef5170c4..6837b57d9b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1740,8 +1740,8 @@ void guMtxF2L(MtxF* m1, Mtx* m2); void* osViGetCurrentFramebuffer(void); s32 __osSpSetPc(void* pc); f32 absf(f32); -void* __osMemset(void* dest, s32 val, size_t len); -void* __osMemmove(void* dest, const void* src, size_t len); +void* memset(void* dest, int val, size_t len); +void* memmove(void* dest, const void* src, size_t len); void Message_UpdateOcarinaMemoryGame(PlayState* play); u8 Message_ShouldAdvance(PlayState* play); void Message_CloseTextbox(PlayState*); diff --git a/spec b/spec index 9d2bc053af..b91d55a22a 100644 --- a/spec +++ b/spec @@ -69,7 +69,7 @@ beginseg #endif include "$(BUILD_DIR)/src/libultra/os/unmaptlball.o" include "$(BUILD_DIR)/src/libultra/io/epidma.o" -#if OOT_DEBUG || COMPILER_GCC +#if OOT_DEBUG || defined(COMPILER_GCC) include "$(BUILD_DIR)/src/libultra/libc/string.o" #endif include "$(BUILD_DIR)/src/libultra/os/invalicache.o" @@ -128,6 +128,8 @@ beginseg include "$(BUILD_DIR)/src/libultra/os/setwatchlo.o" include "$(BUILD_DIR)/data/rsp_boot.text.o" #ifdef COMPILER_GCC + include "$(BUILD_DIR)/src/libc/memset.o" + include "$(BUILD_DIR)/src/libc/memmove.o" include "$(BUILD_DIR)/src/gcc_fix/missing_gcc_functions.o" #endif endseg @@ -577,7 +579,7 @@ beginseg #if !OOT_DEBUG include "$(BUILD_DIR)/src/libultra/libc/xprintf.o" #endif -#if !OOT_DEBUG && !COMPILER_GCC +#if !OOT_DEBUG && !defined(COMPILER_GCC) include "$(BUILD_DIR)/src/libultra/libc/string.o" #endif include "$(BUILD_DIR)/src/libultra/io/sp.o" @@ -636,11 +638,13 @@ beginseg include "$(BUILD_DIR)/src/libultra/libc/llcvt.o" include "$(BUILD_DIR)/src/libultra/io/vigetcurrframebuf.o" include "$(BUILD_DIR)/src/libultra/io/spsetpc.o" - include "$(BUILD_DIR)/src/libultra/libc/sqrt.o" - include "$(BUILD_DIR)/src/libultra/libc/absf.o" - include "$(BUILD_DIR)/src/code/fmodf.o" - include "$(BUILD_DIR)/src/code/__osMemset.o" - include "$(BUILD_DIR)/src/code/__osMemmove.o" + include "$(BUILD_DIR)/src/libc/sqrt.o" + include "$(BUILD_DIR)/src/libc/absf.o" + include "$(BUILD_DIR)/src/libc/fmodf.o" +#ifndef COMPILER_GCC + include "$(BUILD_DIR)/src/libc/memset.o" + include "$(BUILD_DIR)/src/libc/memmove.o" +#endif // For some reason, the data sections of z_message and z_game_over are // placed near the rodata sections of other files, so we first build this // combined object before the final link. diff --git a/src/code/__osMalloc.c b/src/code/__osMalloc.c index 5c4a423d2c..bcd0132dbd 100644 --- a/src/code/__osMalloc.c +++ b/src/code/__osMalloc.c @@ -25,15 +25,15 @@ #define FILL_ALLOC_BLOCK(arena, alloc, size) \ if ((arena)->flag & FILL_ALLOC_BLOCK_FLAG) \ - __osMemset(alloc, BLOCK_ALLOC_MAGIC, size) + memset(alloc, BLOCK_ALLOC_MAGIC, size) #define FILL_FREE_BLOCK_HEADER(arena, node) \ if ((arena)->flag & FILL_FREE_BLOCK_FLAG) \ - __osMemset(node, BLOCK_FREE_MAGIC, sizeof(ArenaNode)) + memset(node, BLOCK_FREE_MAGIC, sizeof(ArenaNode)) #define FILL_FREE_BLOCK_CONTENTS(arena, node) \ if ((arena)->flag & FILL_FREE_BLOCK_FLAG) \ - __osMemset((void*)((u32)(node) + sizeof(ArenaNode)), BLOCK_FREE_MAGIC, (node)->size) + memset((void*)((u32)(node) + sizeof(ArenaNode)), BLOCK_FREE_MAGIC, (node)->size) #define CHECK_FREE_BLOCK(arena, node) \ if ((arena)->flag & CHECK_FREE_BLOCK_FLAG) \ @@ -179,7 +179,7 @@ void __osMallocAddBlock(Arena* arena, void* start, s32 size) { if (size2 > (s32)sizeof(ArenaNode)) { #if OOT_DEBUG - __osMemset(firstNode, BLOCK_UNINIT_MAGIC, size2); + memset(firstNode, BLOCK_UNINIT_MAGIC, size2); #endif firstNode->next = NULL; firstNode->prev = NULL; @@ -210,7 +210,7 @@ void ArenaImpl_RemoveAllBlocks(Arena* arena) { iter = arena->head; while (iter != NULL) { next = NODE_GET_NEXT(iter); - __osMemset(iter, BLOCK_UNINIT_MAGIC, iter->size + sizeof(ArenaNode)); + memset(iter, BLOCK_UNINIT_MAGIC, iter->size + sizeof(ArenaNode)); iter = next; } @@ -635,7 +635,7 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) { } node->next = newNext; node->size = newSize; - __osMemmove(node->next, next, sizeof(ArenaNode)); + memmove(node->next, next, sizeof(ArenaNode)); } else { // "Allocate a new memory block and move the contents" osSyncPrintf("新たにメモリブロックを確保して内容を移動します\n"); diff --git a/src/code/code_80069420.c b/src/code/code_80069420.c index 9a190edcf3..a08567dd65 100644 --- a/src/code/code_80069420.c +++ b/src/code/code_80069420.c @@ -27,7 +27,7 @@ void* MemCpy(void* dest, const void* src, s32 len) { /** * memset: sets `len` bytes to `val` starting at address `dest`. * - * @see There are two other memsets in this codebase, Lib_MemSet(), __osMemset(). + * @see There are two other memsets in this codebase, Lib_MemSet(), memset(). * This one is unused. * * @param dest address to start at diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 019a4a8951..9597e7c19d 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -7449,7 +7449,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState s16 curUID; s16 j; - __osMemset(camera, 0, sizeof(Camera)); + memset(camera, 0, sizeof(Camera)); if (sInitRegs) { s32 i; diff --git a/src/code/z_lib.c b/src/code/z_lib.c index 5eba9346f5..d5f59a2a86 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -16,7 +16,7 @@ * - the arguments are in a different order, * - `val` is a `u8` instead of the standard `s32`. * - * @see There are two other memsets in this codebase, __osMemset(), MemSet() + * @see There are two other memsets in this codebase, memset(), MemSet() * * @param dest address to start at * @param len number of bytes to write diff --git a/src/code/z_quake.c b/src/code/z_quake.c index 317d053477..4c318b9386 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -170,7 +170,7 @@ QuakeRequest* Quake_RequestImpl(Camera* camera, u32 type) { s16 index = Quake_GetFreeIndex(); QuakeRequest* req = &sQuakeRequests[index]; - __osMemset(req, 0, sizeof(QuakeRequest)); + memset(req, 0, sizeof(QuakeRequest)); req->cam = camera; req->camId = camera->camId; diff --git a/src/code/z_view.c b/src/code/z_view.c index 31563b959a..780fd7f400 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -24,7 +24,7 @@ View* View_New(GraphicsContext* gfxCtx) { View* view = SYSTEM_ARENA_MALLOC(sizeof(View), "../z_view.c", 285); if (view != NULL) { - __osMemset(view, 0, sizeof(View)); + memset(view, 0, sizeof(View)); View_Init(view, gfxCtx); } diff --git a/src/gcc_fix/missing_gcc_functions.c b/src/gcc_fix/missing_gcc_functions.c index b955569372..76bf8e9db6 100644 --- a/src/gcc_fix/missing_gcc_functions.c +++ b/src/gcc_fix/missing_gcc_functions.c @@ -26,38 +26,6 @@ int memcmp(const void* s1, const void* s2, size_t n) { return 0; } -void* memset(void* str, int c, size_t n) { - u8* m = str; - size_t i; - - for (i = 0; i < n; i++) { - m[i] = c; - } - - return str; -} - -void* memmove(void* dest, const void* src, size_t len) { - u8* d = dest; - const u8* s = src; - - if (d == s) { - return dest; - } - if (d < s) { - while (len--) { - *d++ = *s++; - } - } else { - d += len - 1; - s += len - 1; - while (len--) { - *d-- = *s--; - } - } - return dest; -} - // Conversions involving 64-bit integer types required by the O32 MIPS ABI. // f32 -> u64, negative values become 0 diff --git a/src/libc/absf.s b/src/libc/absf.s new file mode 100644 index 0000000000..9df0c0a380 --- /dev/null +++ b/src/libc/absf.s @@ -0,0 +1,15 @@ +#include "ultra64/asm.h" + +#if OOT_DEBUG +.set noreorder +#endif + +.section .text + +.balign 16 + +LEAF(absf) + abs.s $f0, $f12 + jr $ra + nop +END(absf) diff --git a/src/code/fmodf.c b/src/libc/fmodf.c similarity index 100% rename from src/code/fmodf.c rename to src/libc/fmodf.c diff --git a/src/code/__osMemmove.c b/src/libc/memmove.c similarity index 91% rename from src/code/__osMemmove.c rename to src/libc/memmove.c index 892fee5eeb..8ff5ec5f6c 100644 --- a/src/code/__osMemmove.c +++ b/src/libc/memmove.c @@ -11,7 +11,7 @@ * * @return dest */ -void* __osMemmove(void* dest, const void* src, size_t len) { +void* memmove(void* dest, const void* src, size_t len) { u8* d = dest; const u8* s = src; diff --git a/src/code/__osMemset.c b/src/libc/memset.c similarity index 76% rename from src/code/__osMemset.c rename to src/libc/memset.c index 703d3a8c1e..ec699c7ce3 100644 --- a/src/code/__osMemset.c +++ b/src/libc/memset.c @@ -6,12 +6,12 @@ * @see There are two other memsets in this codebase, Lib_MemSet(), MemSet() * * @param dest address to start at - * @param val value to write (s32, but interpreted as u8) + * @param val value to write (int, but interpreted as u8) * @param len number of bytes to write * * @return dest */ -void* __osMemset(void* dest, s32 val, size_t len) { +void* memset(void* dest, int val, size_t len) { u8* ptr = dest; while (len--) { diff --git a/src/libc/sqrt.s b/src/libc/sqrt.s new file mode 100644 index 0000000000..b4246ec865 --- /dev/null +++ b/src/libc/sqrt.s @@ -0,0 +1,15 @@ +#include "ultra64/asm.h" + +#if OOT_DEBUG +.set noreorder +#endif + +.section .text + +.balign 16 + +LEAF(sqrt) + sqrt.d $f0, $f12 + jr $ra + nop +END(sqrt) diff --git a/src/libultra/libc/absf.c b/src/libultra/libc/absf.c deleted file mode 100644 index 73c99f4602..0000000000 --- a/src/libultra/libc/absf.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "global.h" - -float absf(float n) { -#ifndef __GNUC__ - return fabsf(n); -#else - return __builtin_fabsf(n); -#endif -} diff --git a/src/libultra/libc/sqrt.c b/src/libultra/libc/sqrt.c deleted file mode 100644 index a9a4403a33..0000000000 --- a/src/libultra/libc/sqrt.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "global.h" - -double sqrt(double f) { -#ifndef __GNUC__ - return sqrt(f); -#else - return __builtin_sqrt(f); -#endif -} diff --git a/tools/disasm/ntsc-1.2/files_code.csv b/tools/disasm/ntsc-1.2/files_code.csv index 47a07ef54c..1a5d6d05c3 100644 --- a/tools/disasm/ntsc-1.2/files_code.csv +++ b/tools/disasm/ntsc-1.2/files_code.csv @@ -195,10 +195,10 @@ C4A80,800D6160,src/libultra/os/getcurrfaultedthread C4A90,800D6170,src/libultra/libc/llcvt C4CA0,800D6380,src/libultra/io/vigetcurrframebuf C4CE0,800D63C0,src/libultra/io/spsetpc -C4D20,800D6400,src/libultra/libc/sqrt -C4D30,800D6410,src/code/fmodf -C4D80,800D6460,src/code/__osMemset -C4DB0,800D6490,src/code/__osMemmove +C4D20,800D6400,src/libc/sqrt +C4D30,800D6410,src/libc/fmodf +C4D80,800D6460,src/libc/memset +C4DB0,800D6490,src/libc/memset C4E40,800D6520,src/code/z_message D0620,800E1D00,src/code/z_game_over D0B60,800E2240,src/code/z_construct diff --git a/tools/disasm/ntsc-1.2/functions.txt b/tools/disasm/ntsc-1.2/functions.txt index 9d28a69647..2a9b367e7e 100644 --- a/tools/disasm/ntsc-1.2/functions.txt +++ b/tools/disasm/ntsc-1.2/functions.txt @@ -3054,8 +3054,8 @@ osViGetCurrentFramebuffer = 0x800D6380; // type:func __osSpSetPc = 0x800D63C0; // type:func sqrt = 0x800D6400; // type:func fmodf = 0x800D6410; // type:func -__osMemset = 0x800D6460; // type:func -__osMemmove = 0x800D6490; // type:func +memset = 0x800D6460; // type:func +memmove = 0x800D6490; // type:func Message_ResetOcarinaNoteState = 0x800D6520; // type:func Message_UpdateOcarinaMemoryGame = 0x800D661C; // type:func Message_ShouldAdvance = 0x800D6740; // type:func From 3e516f48f3d9af02909ccab8092743a4e1e8323d Mon Sep 17 00:00:00 2001 From: cadmic Date: Tue, 20 Aug 2024 13:22:05 -0700 Subject: [PATCH 30/33] Match more ntsc-1.2 overlay draw functions (#2061) * Match more overlay draw functions * Review --- include/functions.h | 4 +-- src/code/z_actor.c | 8 ++--- .../ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c | 17 ++++----- .../ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c | 19 +++++----- src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c | 2 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 26 +++++++------- src/overlays/actors/ovl_Demo_6K/z_demo_6k.c | 23 +++++------- src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c | 3 +- .../ovl_En_Ganon_Organ/z_en_ganon_organ.c | 9 ++--- src/overlays/actors/ovl_Fishing/z_fishing.c | 35 +++++++++---------- src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c | 4 +-- .../ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c | 8 +++-- 12 files changed, 73 insertions(+), 85 deletions(-) diff --git a/include/functions.h b/include/functions.h index 6837b57d9b..4efaf978fc 100644 --- a/include/functions.h +++ b/include/functions.h @@ -460,8 +460,8 @@ f32 Rand_CenteredFloat(f32 f); void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type); void func_8003424C(PlayState* play, Vec3f* arg1); void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 bufFlag, s16 duration); -Hilite* func_800342EC(Vec3f* object, PlayState* play); -Hilite* func_8003435C(Vec3f* object, PlayState* play); +void func_800342EC(Vec3f* object, PlayState* play); +void func_8003435C(Vec3f* object, PlayState* play); s32 Npc_UpdateTalking(PlayState* play, Actor* actor, s16* talkState, f32 interactRange, NpcGetTextIdFunc getTextId, NpcUpdateTalkStateFunc updateTalkState); s16 Npc_GetTrackingPresetMaxPlayerYaw(s16 presetIndex); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 0be5916674..f531ba6d67 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3832,24 +3832,24 @@ void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s1 actor->colorFilterTimer = duration; } -Hilite* func_800342EC(Vec3f* object, PlayState* play) { +void func_800342EC(Vec3f* object, PlayState* play) { Vec3f lightDir; lightDir.x = play->envCtx.dirLight1.params.dir.x; lightDir.y = play->envCtx.dirLight1.params.dir.y; lightDir.z = play->envCtx.dirLight1.params.dir.z; - return func_8002EABC(object, &play->view.eye, &lightDir, play->state.gfxCtx); + func_8002EABC(object, &play->view.eye, &lightDir, play->state.gfxCtx); } -Hilite* func_8003435C(Vec3f* object, PlayState* play) { +void func_8003435C(Vec3f* object, PlayState* play) { Vec3f lightDir; lightDir.x = play->envCtx.dirLight1.params.dir.x; lightDir.y = play->envCtx.dirLight1.params.dir.y; lightDir.z = play->envCtx.dirLight1.params.dir.z; - return func_8002EB44(object, &play->view.eye, &lightDir, play->state.gfxCtx); + func_8002EB44(object, &play->view.eye, &lightDir, play->state.gfxCtx); } /** diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c index 8f91b00005..d0b7310bff 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c @@ -295,9 +295,9 @@ void BgHidanSekizou_Update(Actor* thisx, PlayState* play2) { } } -Gfx* func_8088D9F4(PlayState* play, BgHidanSekizou* this, s16 arg2, MtxF* arg3, f32 arg4, f32 arg5, s16 arg6, +Gfx* func_8088D9F4(PlayState* play, BgHidanSekizou* this, s16 arg2, MtxF* mtx, f32 arg4, f32 arg5, s16 arg6, Gfx* arg7) { - f32 temp_f0; + MtxF* mtx2; f32 temp_f2; f32 phi_f12; @@ -312,14 +312,15 @@ Gfx* func_8088D9F4(PlayState* play, BgHidanSekizou* this, s16 arg2, MtxF* arg3, gDPSetPrimColor(arg7++, 0, 1, 255, 255, 0, 150); gDPSetEnvColor(arg7++, 255, 0, 0, 255); - arg3->xx = arg3->yy = arg3->zz = (0.7f * phi_f12) + 0.5f; + mtx2 = mtx; + mtx2->xx = mtx2->yy = mtx2->zz = (0.7f * phi_f12) + 0.5f; - temp_f2 = (arg3->xx * 10.0f * phi_f12) + 20.0f; - arg3->xw = (temp_f2 * arg4) + this->dyna.actor.world.pos.x; - arg3->yw = this->dyna.actor.world.pos.y + 30.0f + (.7f * phi_f12); - arg3->zw = (temp_f2 * arg5) + this->dyna.actor.world.pos.z; + temp_f2 = ((mtx2->xx * 10.0f) * phi_f12) + 20.0f; + mtx2->xw = (temp_f2 * arg4) + this->dyna.actor.world.pos.x; + mtx2->yw = this->dyna.actor.world.pos.y + 30.0f + (.7f * phi_f12); + mtx2->zw = (temp_f2 * arg5) + this->dyna.actor.world.pos.z; gSPMatrix(arg7++, - Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(arg3, "../z_bg_hidan_sekizou.c", 711), + Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(mtx2, "../z_bg_hidan_sekizou.c", 711), GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx))), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c index 6b0a4a401e..61cd9da383 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c +++ b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c @@ -15,11 +15,11 @@ void BgTokiHikari_Update(Actor* thisx, PlayState* play); void BgTokiHikari_Draw(Actor* thisx, PlayState* play); void BgTokiHikari_DoNothing(BgTokiHikari* this, PlayState* play); -void func_808BA018(BgTokiHikari* this, PlayState* play); +void func_808BA018(Actor* thisx, PlayState* play); void func_808BA204(BgTokiHikari* this, PlayState* play); void func_808BA22C(BgTokiHikari* this, PlayState* play); void func_808BA274(BgTokiHikari* this, PlayState* play); -void func_808BA2CC(BgTokiHikari* this, PlayState* play); +void func_808BA2CC(Actor* thisx, PlayState* play); ActorProfile Bg_Toki_Hikari_Profile = { /**/ ACTOR_BG_TOKI_HIKARI, @@ -69,19 +69,17 @@ void BgTokiHikari_Update(Actor* thisx, PlayState* play) { } void BgTokiHikari_Draw(Actor* thisx, PlayState* play) { - BgTokiHikari* this = (BgTokiHikari*)thisx; - - switch (this->actor.params) { + switch (thisx->params) { case 0: - func_808BA018(this, play); + func_808BA018(thisx, play); break; case 1: - func_808BA2CC(this, play); + func_808BA2CC(thisx, play); break; } } -void func_808BA018(BgTokiHikari* this, PlayState* play) { +void func_808BA018(Actor* thisx, PlayState* play) { PlayState* play2 = (PlayState*)play; OPEN_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 246); @@ -130,8 +128,9 @@ void func_808BA274(BgTokiHikari* this, PlayState* play) { } } -void func_808BA2CC(BgTokiHikari* this, PlayState* play) { - s32 pad[2]; +void func_808BA2CC(Actor* thisx, PlayState* play) { + BgTokiHikari* this = (BgTokiHikari*)thisx; + s32 pad; OPEN_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 350); Matrix_Translate(0.0f, 276.0f, 1122.0f, MTXMODE_NEW); diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index 2baad32059..3ccc68cbee 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -1959,7 +1959,7 @@ void BossFd_DrawBody(PlayState* play, BossFd* this) { SkelAnime_DrawOpa(play, this->skelAnimeHead.skeleton, this->skelAnimeHead.jointTable, BossFd_OverrideHeadDraw, BossFd_PostHeadDraw, &this->actor); PRINTF("SK\n"); - { + if (1) { Vec3f spB0 = { 0.0f, 1700.0f, 7000.0f }; Vec3f spA4 = { -1000.0f, 700.0f, 7000.0f }; diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 20bad19bad..c33fcb52bb 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -4805,17 +4805,20 @@ static void* sLightningTextures[] = { gGanondorfLightning12Tex, }; -static u8 sLightningPrimColors[] = { - 0, 0, 0, 255, 255, 255, 231, 250, 231, 208, 245, 208, 185, 240, 185, 162, 235, 162, 139, 230, - 139, 115, 225, 115, 92, 220, 92, 69, 215, 69, 46, 210, 46, 23, 205, 23, 0, 200, 0, +static u8 sLightningPrimColors[13][3] = { + { 0, 0, 0 }, { 255, 255, 255 }, { 231, 250, 231 }, { 208, 245, 208 }, { 185, 240, 185 }, + { 162, 235, 162 }, { 139, 230, 139 }, { 115, 225, 115 }, { 92, 220, 92 }, { 69, 215, 69 }, + { 46, 210, 46 }, { 23, 205, 23 }, { 0, 200, 0 }, }; -static u8 sLightningEnvColors[] = { - 0, 0, 0, 255, 255, 0, 240, 231, 23, 226, 208, 46, 212, 185, 69, 198, 162, 92, - 184, 139, 115, 170, 115, 139, 156, 92, 162, 142, 69, 185, 128, 46, 208, 114, 23, 231, - 100, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +static u8 sLightningEnvColors[13][3] = { + { 0, 0, 0 }, { 255, 255, 0 }, { 240, 231, 23 }, { 226, 208, 46 }, { 212, 185, 69 }, + { 198, 162, 92 }, { 184, 139, 115 }, { 170, 115, 139 }, { 156, 92, 162 }, { 142, 69, 185 }, + { 128, 46, 208 }, { 114, 23, 231 }, { 100, 0, 255 }, }; +static s32 sUnknown[3] = { 0 }; + void BossGanon_DrawEffects(PlayState* play) { u8 materialFlag = 0; s16 i; @@ -4926,11 +4929,10 @@ void BossGanon_DrawEffects(PlayState* play) { for (i = 0; i < 150; i++, eff++) { if (eff->type == GDF_EFF_LIGHTNING) { gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, sLightningPrimColors[(eff->timer * 3) + 0], - sLightningPrimColors[(eff->timer * 3) + 1], sLightningPrimColors[(eff->timer * 3) + 2], - 255); - gDPSetEnvColor(POLY_XLU_DISP++, sLightningEnvColors[(eff->timer * 3) + 0], - sLightningEnvColors[(eff->timer * 3) + 1], sLightningEnvColors[(eff->timer * 3) + 2], 0); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, sLightningPrimColors[eff->timer][0], + sLightningPrimColors[eff->timer][1], sLightningPrimColors[eff->timer][2], 255); + gDPSetEnvColor(POLY_XLU_DISP++, sLightningEnvColors[eff->timer][0], sLightningEnvColors[eff->timer][1], + sLightningEnvColors[eff->timer][2], 0); Matrix_Translate(sGanondorf->unk_260.x, sGanondorf->unk_260.y, sGanondorf->unk_260.z, MTXMODE_NEW); Matrix_RotateY(eff->unk_48, MTXMODE_APPLY); Matrix_RotateZ(eff->unk_3C, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index fcd116ffee..d3c65de390 100644 --- a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -571,27 +571,23 @@ void func_80967FFC(Actor* thisx, PlayState* play) { { s32 i; - s32 pad; - Color_RGB8 colors[6][2] = { - { { 255, 170, 255 }, { 255, 0, 100 } }, { { 255, 255, 170 }, { 0, 255, 0 } }, - { { 255, 255, 170 }, { 255, 255, 0 } }, { { 255, 170, 255 }, { 50, 0, 255 } }, - { { 255, 255, 170 }, { 255, 100, 0 } }, { { 170, 255, 255 }, { 0, 100, 255 } }, + s32 j; + Color_RGB8 colors[12] = { + { 255, 170, 255 }, { 255, 0, 100 }, { 255, 255, 170 }, { 0, 255, 0 }, { 255, 255, 170 }, { 255, 255, 0 }, + { 255, 170, 255 }, { 50, 0, 255 }, { 255, 255, 170 }, { 255, 100, 0 }, { 170, 255, 255 }, { 0, 100, 255 }, }; Matrix_RotateZ(-M_PI / 2, MTXMODE_APPLY); - for (i = 0; i < 6; i++) { + for (i = 0, j = 0; i < 6; i++, j += 2) { Matrix_RotateZ(M_PI / 3, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_6k.c", 1115), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, colors[i][0].r, colors[i][0].g, colors[i][0].b, 255); - gDPSetEnvColor(POLY_XLU_DISP++, colors[i][1].r, colors[i][1].g, colors[i][1].b, 255); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, colors[j + 0].r, colors[j + 0].g, colors[j + 0].b, 255); + gDPSetEnvColor(POLY_XLU_DISP++, colors[j + 1].r, colors[j + 1].g, colors[j + 1].b, 255); gSPDisplayList(POLY_XLU_DISP++, object_demo_6k_DL_0022B0); } - - // required to avoid optimizing out i - if ((s16)i) {} } CLOSE_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1127); @@ -725,8 +721,6 @@ void func_80968B70(Actor* thisx, PlayState* play) { u8 primColor[4]; u8 envColor[3]; - if (1) {} - OPEN_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1316); Gfx_SetupDL_25Xlu(play->state.gfxCtx); @@ -785,10 +779,9 @@ void func_80968FB0(Actor* thisx, PlayState* play) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, displayList); gDPPipeSync(displayList++); - if (displayList) {} gDPSetPrimColor(displayList++, 0, 0x80, 255, 255, 255, this->unk_293); gDPSetRenderMode(displayList++, G_RM_PASS, G_RM_ZB_CLD_SURF2); - gSPEndDisplayList(displayList++); + gSPEndDisplayList(displayList); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 255); gSPDisplayList(POLY_XLU_DISP++, gGlowCircleSmallDL); diff --git a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c index b2376abff2..94bda4604b 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c @@ -191,6 +191,7 @@ void DemoExt_DrawVortex(Actor* thisx, PlayState* play) { s16* curScroll; Vec3f* scale; + curScroll = this->curScroll; scale = &this->scale; gfxCtx = play->state.gfxCtx; mtx = GRAPH_ALLOC(gfxCtx, sizeof(Mtx)); @@ -206,8 +207,6 @@ void DemoExt_DrawVortex(Actor* thisx, PlayState* play) { gDPSetPrimColor(POLY_XLU_DISP++, 0, kREG(33) + 128, kREG(25) + 140, kREG(26) + 80, kREG(27) + 140, this->primAlpha); gDPSetEnvColor(POLY_XLU_DISP++, kREG(29) + 90, kREG(30) + 50, kREG(31) + 95, this->envAlpha); - - curScroll = this->curScroll; gSPSegment( POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(gfxCtx, 0, curScroll[0], curScroll[1], 0x40, 0x40, 1, curScroll[2], curScroll[3], 0x40, 0x40)); diff --git a/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c b/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c index 8d81044e80..572152575c 100644 --- a/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c +++ b/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c @@ -65,11 +65,9 @@ Gfx* func_80A280BC(GraphicsContext* gfxCtx, BossGanon* dorf) { displayList = GRAPH_ALLOC(gfxCtx, 4 * sizeof(Gfx)); displayListHead = displayList; gDPPipeSync(displayListHead++); - if (1) {} - if (1) {} gDPSetEnvColor(displayListHead++, 25, 20, 0, dorf->organAlpha); gDPSetRenderMode(displayListHead++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2); - gSPEndDisplayList(displayListHead); + gSPEndDisplayList(displayListHead++); return displayList; } @@ -79,13 +77,10 @@ Gfx* func_80A28148(GraphicsContext* gfxCtx, BossGanon* dorf) { displayList = GRAPH_ALLOC(gfxCtx, 4 * sizeof(Gfx)); displayListHead = displayList; - gDPPipeSync(displayListHead++); - if (1) {} - if (1) {} gDPSetEnvColor(displayListHead++, 0, 0, 0, dorf->organAlpha); gDPSetRenderMode(displayListHead++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2); - gSPEndDisplayList(displayListHead); + gSPEndDisplayList(displayListHead++); return displayList; } diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 943a999520..4bb27c2a63 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -4770,25 +4770,23 @@ void Fishing_DrawGroupFishes(PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 8048); for (i = 0; i < GROUP_FISH_COUNT; i++, fish++) { - if (fish->type == FS_GROUP_FISH_NONE) { - continue; - } + if (fish->type != FS_GROUP_FISH_NONE) { + if (!materialFlag) { + gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishMaterialDL); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 155, 155, 155, 255); + materialFlag++; + } - if (!materialFlag) { - gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishMaterialDL); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 155, 155, 155, 255); - materialFlag++; - } + if (fish->shouldDraw) { + Matrix_Translate(fish->pos.x, fish->pos.y, fish->pos.z, MTXMODE_NEW); + Matrix_RotateY(BINANG_TO_RAD_ALT2((f32)fish->unk_3E), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD_ALT2(-(f32)fish->unk_3C), MTXMODE_APPLY); + Matrix_Scale(fish->scaleX * scale, scale, scale, MTXMODE_APPLY); - if (fish->shouldDraw) { - Matrix_Translate(fish->pos.x, fish->pos.y, fish->pos.z, MTXMODE_NEW); - Matrix_RotateY(BINANG_TO_RAD_ALT2((f32)fish->unk_3E), MTXMODE_APPLY); - Matrix_RotateX(BINANG_TO_RAD_ALT2(-(f32)fish->unk_3C), MTXMODE_APPLY); - Matrix_Scale(fish->scaleX * scale, scale, scale, MTXMODE_APPLY); - - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_fishing.c", 8093), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishModelDL); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_fishing.c", 8093), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishModelDL); + } } } @@ -5830,8 +5828,7 @@ void Fishing_DrawOwner(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - if ((this->actor.projectedPos.z < 1500.0f) && - (fabsf(this->actor.projectedPos.x) < (100.0f + this->actor.projectedPos.z))) { + if ((thisx->projectedPos.z < 1500.0f) && (fabsf(thisx->projectedPos.x) < (100.0f + thisx->projectedPos.z))) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sFishingOwnerEyeTexs[this->unk_160])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, diff --git a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c index dbfbe678a9..981b869447 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -472,7 +472,7 @@ void MirRay_Draw(Actor* thisx, PlayState* play) { Player* player = GET_PLAYER(play); s32 i; MirRayShieldReflection reflection[6]; - s32 temp; + s32 pad; this->reflectIntensity = 0.0f; if ((D_80B8E670 == 0) && !this->unLit && Player_HasMirrorShieldSetToDraw(play)) { @@ -485,7 +485,7 @@ void MirRay_Draw(Actor* thisx, PlayState* play) { Matrix_Scale(1.0f, 1.0f, this->reflectIntensity * 5.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_mir_ray.c", 972), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 150, (s16)(temp = this->reflectIntensity * 100.0f)); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 150, (s32)(this->reflectIntensity * 100.0f) & 0xFF); gSPDisplayList(POLY_XLU_DISP++, gShieldBeamGlowDL); MirRay_SetupReflectionPolys(this, play, reflection); MirRay_RemoveSimilarReflections(reflection); diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c index 8fd5f7d1e3..b6f5868b99 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c @@ -68,6 +68,7 @@ void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this) { f32 scale; s16 camYaw; s32 pad[3]; + s16 intensity; s16 redGreen; OPEN_DISPS(gfxCtx, "../z_eff_en_fire.c", 169); @@ -81,12 +82,13 @@ void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_eff_en_fire.c", 180), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - redGreen = this->life - 5; + intensity = this->life - 5; - if (redGreen < 0) { - redGreen = 0; + if (intensity < 0) { + intensity = 0; } + redGreen = intensity; Gfx_SetupDL_25Xlu(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, redGreen * 12.7f, 0, 0, 0); gDPSetPrimColor(POLY_XLU_DISP++, 0x0, 0x80, redGreen * 12.7f, redGreen * 12.7f, 0, 255); From ac2224f095367073c53f9fd719eee3884d7b67ab Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Tue, 20 Aug 2024 23:19:16 +0200 Subject: [PATCH 31/33] Add versions.h (#2060) --- include/macros.h | 10 ---------- include/versions.h | 15 +++++++++++++++ src/boot/build.c | 2 +- src/code/z_common_data.c | 1 + src/code/z_message.c | 1 + src/code/z_play.c | 1 + src/overlays/actors/ovl_En_Mag/z_en_mag.c | 1 + .../gamestates/ovl_file_choose/z_file_choose.c | 1 + src/overlays/gamestates/ovl_title/z_title.c | 1 + 9 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 include/versions.h diff --git a/include/macros.h b/include/macros.h index c5ce822ae2..595b6729f8 100644 --- a/include/macros.h +++ b/include/macros.h @@ -1,16 +1,6 @@ #ifndef MACROS_H #define MACROS_H -// OOT versions in build order -#define OOT_GC_JP 1 -#define OOT_GC_JP_MQ 2 -#define OOT_GC_US 3 -#define OOT_GC_US_MQ 4 -#define OOT_GC_EU_MQ_DBG 5 -#define OOT_GC_EU 6 -#define OOT_GC_EU_MQ 7 -#define OOT_GC_JP_CE 8 - #ifndef AVOID_UB #define BAD_RETURN(type) type #else diff --git a/include/versions.h b/include/versions.h new file mode 100644 index 0000000000..f2c2ea4a3f --- /dev/null +++ b/include/versions.h @@ -0,0 +1,15 @@ +#ifndef VERSIONS_H +#define VERSIONS_H + +// OOT versions in build order +#define OOT_NTSC_1_2 1 +#define OOT_GC_JP 2 +#define OOT_GC_JP_MQ 3 +#define OOT_GC_US 4 +#define OOT_GC_US_MQ 5 +#define OOT_GC_EU_MQ_DBG 6 +#define OOT_GC_EU 7 +#define OOT_GC_EU_MQ 8 +#define OOT_GC_JP_CE 9 + +#endif diff --git a/src/boot/build.c b/src/boot/build.c index 47facdaa96..9f60b54bd7 100644 --- a/src/boot/build.c +++ b/src/boot/build.c @@ -1,4 +1,4 @@ -#include "macros.h" +#include "versions.h" #if PLATFORM_N64 const char gBuildTeam[] = "zelda@srd44"; diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index 08e0184951..f3432db458 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -1,5 +1,6 @@ #include "global.h" #include "region.h" +#include "versions.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/z_message.c b/src/code/z_message.c index 2266cd1f9f..e5b7bbc700 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -2,6 +2,7 @@ #include "message_data_static.h" #include "terminal.h" #include "assets/textures/parameter_static/parameter_static.h" +#include "versions.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/z_play.c b/src/code/z_play.c index 135f24c75e..6088ca2e68 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1,6 +1,7 @@ #include "global.h" #include "quake.h" #include "terminal.h" +#include "versions.h" #include "z64frame_advance.h" diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 16c2103107..732b21405c 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -6,6 +6,7 @@ #include "z_en_mag.h" #include "assets/objects/object_mag/object_mag.h" +#include "versions.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 56e09ba275..e52c5c5de1 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1,5 +1,6 @@ #include "file_select.h" #include "terminal.h" +#include "versions.h" #include "assets/textures/title_static/title_static.h" #include "assets/textures/parameter_static/parameter_static.h" diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index ad8f3d884a..3d1ea7a35d 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -6,6 +6,7 @@ #include "global.h" #include "alloca.h" +#include "versions.h" #include "assets/textures/nintendo_rogo_static/nintendo_rogo_static.h" #if OOT_DEBUG From 942df4589221f03d054d09d6d91fb981e13af6f1 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 21 Aug 2024 01:20:11 +0200 Subject: [PATCH 32/33] Match n64dd text in code (#2058) * match n64dd text * format * fixups * add n64dd segment using baserom * cleanup syms 1 * cleanup symbols 2 * cleanup D_800FF4B0 * fix declaration usage and linking for D_800FF4B0 --- include/n64dd.h | 34 ++++++++++- spec | 9 +++ src/code/code_n64dd_800AD410.c | 31 ++++++++++ src/code/code_n64dd_800AD4C0.c | 87 +++++++++++++++++++++++++++++ tools/disasm/ntsc-1.2/functions.txt | 16 +++--- tools/disasm/ntsc-1.2/variables.txt | 10 ++++ undefined_syms.txt | 10 ++++ 7 files changed, 189 insertions(+), 8 deletions(-) diff --git a/include/n64dd.h b/include/n64dd.h index d2bf02c1c6..8c756ce692 100644 --- a/include/n64dd.h +++ b/include/n64dd.h @@ -3,16 +3,48 @@ #include "z64scene.h" +struct RegEditor; +struct SaveContext; + +// TODO Use the specific pointer types instead of void* +typedef struct n64ddStruct_800FF4B0_pointers { + void* unk_00; + void* unk_04; + struct RegEditor* unk_08; + void* unk_0C[31]; + struct SaveContext* unk_88; + void* unk_8C[9]; +} n64ddStruct_800FF4B0_pointers; // size = 0xB0 + +struct n64ddStruct_80121AF0; struct PlayState; typedef struct n64ddStruct_80121AF0 { - char unk_00[0x3C]; + void (*unk_00)(n64ddStruct_800FF4B0_pointers*, struct n64ddStruct_80121AF0*); + void (*unk_04)(void); + char unk_08[0x34]; void (*unk_3C)(void); void (*unk_40)(void); char unk_44[0x28]; void (*unk_6C)(struct PlayState*, SceneDrawConfigFunc*); } n64ddStruct_80121AF0; // size = ? +void func_800ADA80(void); +void func_800ADAF8(void); +n64ddStruct_80121AF0* func_800ADB30(n64ddStruct_80121AF0* arg0); +void func_800ADB8C(void); +n64ddStruct_800FF4B0_pointers* func_800ADBD0(void); +void func_800ADC00(void); +void func_800ADC08(s32 arg0, s32 arg1, s32 arg2); + +extern n64ddStruct_800FF4B0_pointers D_800FF4B0; extern n64ddStruct_80121AF0* B_80121AF0; +extern u8 B_80121AE0; +extern s8 B_80121AE1; +extern u8 B_80121AE2; + +extern char D_801DA410; // type ? +extern char D_801E8090; // type ? + #endif diff --git a/spec b/spec index b91d55a22a..fd724b9c61 100644 --- a/spec +++ b/spec @@ -656,6 +656,15 @@ beginseg include "$(BUILD_DIR)/data/rsp.rodata.o" endseg +#if PLATFORM_N64 +beginseg + // TODO + name "n64dd" + address 0x801C7740 + include "$(BUILD_DIR)/baserom/n64dd.o" +endseg +#endif + beginseg name "buffers" flags NOLOAD diff --git a/src/code/code_n64dd_800AD410.c b/src/code/code_n64dd_800AD410.c index 8b13789179..330b99bb59 100644 --- a/src/code/code_n64dd_800AD410.c +++ b/src/code/code_n64dd_800AD410.c @@ -1 +1,32 @@ +#include "ultra64.h" +#include "z64dma.h" +#include "segment_symbols.h" +#include "n64dd.h" +DECLARE_SEGMENT(n64dd) +DECLARE_ROM_SEGMENT(n64dd) +DECLARE_BSS_SEGMENT(n64dd) + +s8 func_801C7740_unknown(void); + +u8 B_80121AE0; +s8 B_80121AE1; +u8 B_80121AE2; + +void func_800ADA80(void) { + if (!B_80121AE0) { + DmaMgr_RequestSync(_n64ddSegmentStart, (uintptr_t)_n64ddSegmentRomStart, + _n64ddSegmentRomEnd - _n64ddSegmentRomStart); + // TODO use _n64ddSegmentBssStart, _n64ddSegmentBssEnd + bzero(&D_801DA410, &D_801E8090 - &D_801DA410); + B_80121AE0 = true; + B_80121AE1 = func_801C7740_unknown(); + if (B_80121AE1) {} + } +} + +void func_800ADAF8(void) { + if (B_80121AE0 && (B_80121AE2 == 0)) { + B_80121AE0 = false; + } +} diff --git a/src/code/code_n64dd_800AD4C0.c b/src/code/code_n64dd_800AD4C0.c index f75d79f5ef..858348d2bf 100644 --- a/src/code/code_n64dd_800AD4C0.c +++ b/src/code/code_n64dd_800AD4C0.c @@ -1,3 +1,90 @@ +#include "global.h" #include "n64dd.h" +// TODO functions of unknown prototype +extern char func_801C8510_unknown[]; +extern char func_800AE170_unknown[]; +extern char func_800ADCD8_unknown[]; +extern char osGetIntMask[]; +extern char osSetTime[]; + +n64ddStruct_800FF4B0_pointers D_800FF4B0 = { + func_801C8510_unknown, + NULL, + NULL, + Fault_RemoveClient, + Fault_AddClient, + func_800AE170_unknown, + func_800ADCD8_unknown, + Fault_AddHungupAndCrashImpl, + Fault_AddHungupAndCrash, + func_800ADC08, + _Printf, + osCreateThread, + osDestroyThread, + osYieldThread, + osStartThread, + osStopThread, + osGetThreadId, + osSetThreadPri, + osGetThreadPri, + osCreateMesgQueue, + osSendMesg, + osJamMesg, + osRecvMesg, + osSetEventMesg, + osGetIntMask, + osSetIntMask, + osInvalDCache, + osInvalICache, + osWritebackDCache, + osWritebackDCacheAll, + osGetTime, + osSetTime, + osSetTimer, + osStopTimer, + &gSaveContext, + DmaMgr_RequestAsync, + DmaMgr_RequestSync, + DmaMgr_DmaFromDriveRom, + Cutscene_HandleEntranceTriggers, + gSegments, + Flags_GetEventChkInf, + Flags_SetEventChkInf, + NULL, // TODO possibly file padding + NULL, +}; + n64ddStruct_80121AF0* B_80121AF0; + +n64ddStruct_80121AF0* func_800ADB30(n64ddStruct_80121AF0* arg0) { + n64ddStruct_800FF4B0_pointers* temp_a0 = func_800ADBD0(); + + if (arg0 != NULL && arg0->unk_00 != NULL) { + arg0->unk_00(temp_a0, arg0); + } + B_80121AF0 = arg0; + return B_80121AF0; +} + +void func_800ADB8C(void) { + if (B_80121AF0 != NULL) { + if (B_80121AF0->unk_04 != NULL) { + B_80121AF0->unk_04(); + } + } + B_80121AF0 = NULL; +} + +n64ddStruct_800FF4B0_pointers* func_800ADBD0(void) { + D_800FF4B0.unk_04 = 0; + D_800FF4B0.unk_08 = gRegEditor; + D_800FF4B0.unk_88 = &gSaveContext; + return &D_800FF4B0; +} + +void func_800ADC00(void) { +} + +void func_800ADC08(s32 arg0, s32 arg1, s32 arg2) { +} diff --git a/tools/disasm/ntsc-1.2/functions.txt b/tools/disasm/ntsc-1.2/functions.txt index 2a9b367e7e..75ffeb36b0 100644 --- a/tools/disasm/ntsc-1.2/functions.txt +++ b/tools/disasm/ntsc-1.2/functions.txt @@ -2304,13 +2304,13 @@ IrqMgr_HandlePreNMI500 = 0x800AD808; // type:func IrqMgr_HandleRetrace = 0x800AD82C; // type:func IrqMgr_ThreadEntry = 0x800AD8E4; // type:func IrqMgr_Init = 0x800AD9B8; // type:func -func_800ADA80_unknown = 0x800ADA80; // type:func -func_800ADAF8_unknown = 0x800ADAF8; // type:func -func_800ADB30_unknown = 0x800ADB30; // type:func -func_800ADB8C_unknown = 0x800ADB8C; // type:func -func_800ADBD0_unknown = 0x800ADBD0; // type:func -func_800ADC00_unknown = 0x800ADC00; // type:func -func_800ADC08_unknown = 0x800ADC08; // type:func +func_800ADA80 = 0x800ADA80; // type:func +func_800ADAF8 = 0x800ADAF8; // type:func +func_800ADB30 = 0x800ADB30; // type:func +func_800ADB8C = 0x800ADB8C; // type:func +func_800ADBD0 = 0x800ADBD0; // type:func +func_800ADC00 = 0x800ADC00; // type:func +func_800ADC08 = 0x800ADC08; // type:func Fault_SleepImpl = 0x800ADC20; // type:func func_800ADC5C_unknown = 0x800ADC5C; // type:func func_800ADCD8_unknown = 0x800ADCD8; // type:func @@ -3097,6 +3097,8 @@ Message_Init = 0x800E2660; // type:func Regs_InitDataImpl = 0x800E2704; // type:func Regs_InitData = 0x800E35D0; // type:func njpgdspMainTextStart = 0x800E7200; // type:func +func_801C7740_unknown = 0x801C7740; // type:func +func_801C8510_unknown = 0x801C8510; // type:func n64dd_SetDiskVersion = 0x801C8808; // type:func ConsoleLogo_Calc = 0x80800000; // type:func ConsoleLogo_SetupView = 0x8080009C; // type:func diff --git a/tools/disasm/ntsc-1.2/variables.txt b/tools/disasm/ntsc-1.2/variables.txt index 29faa9c929..b949848748 100644 --- a/tools/disasm/ntsc-1.2/variables.txt +++ b/tools/disasm/ntsc-1.2/variables.txt @@ -12,3 +12,13 @@ gSaveContext = 0x8011AC80; // size:0x1428 type:SaveContext gRegEditor = 0x8011C0B0; // size:0x4 type:RegEditor* gSegments = 0x80121508; // size:0x40 _string_n64dd_c = 0x801D9680; // size:0x1 type:char +B_80121AF0 = 0x80121AF0; // size:0x4 type:n64ddStruct_80121AF0* +B_80121AE0 = 0x80121AE0; // size:0x1 type:u8 +B_80121AE1 = 0x80121AE1; // size:0x1 type:s8 +B_80121AE2 = 0x80121AE2; // size:0x1 type:u8 +_n64ddSegmentStart = 0x801C7740; +_n64ddSegmentRomStart = 0x00B8ADA0; +_n64ddSegmentRomEnd = 0x00B9DA70; +D_801DA410 = 0x801DA410; +D_801E8090 = 0x801E8090; +D_800FF4B0 = 0x800FF4B0; // size:0xB0 type:n64ddStruct_800FF4B0_pointers diff --git a/undefined_syms.txt b/undefined_syms.txt index c6d194e0cb..10eb929100 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -16,4 +16,14 @@ D_06000000 = 0x06000000; func_80001720 = 0x80001720; osInitialize = 0x80003230; +// code_n64dd_800AD410.c +func_800ADCD8_unknown = 0x800ADCD8; +func_800AE170_unknown = 0x800AE170; +osGetIntMask = 0x800CFBB0; +osSetTime = 0x800D3660; +func_801C7740_unknown = 0x801C7740; +func_801C8510_unknown = 0x801C8510; +D_801DA410 = 0x801DA410; +D_801E8090 = 0x801E8090; + #endif From 5a08f144493d4ea50b6a4eef8ed3b4ef1a07e75e Mon Sep 17 00:00:00 2001 From: cadmic Date: Tue, 20 Aug 2024 19:43:33 -0700 Subject: [PATCH 33/33] Fix memmove file splits (#2063) --- tools/disasm/ntsc-1.2/files_code.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/disasm/ntsc-1.2/files_code.csv b/tools/disasm/ntsc-1.2/files_code.csv index 1a5d6d05c3..9e18dc0246 100644 --- a/tools/disasm/ntsc-1.2/files_code.csv +++ b/tools/disasm/ntsc-1.2/files_code.csv @@ -198,7 +198,7 @@ C4CE0,800D63C0,src/libultra/io/spsetpc C4D20,800D6400,src/libc/sqrt C4D30,800D6410,src/libc/fmodf C4D80,800D6460,src/libc/memset -C4DB0,800D6490,src/libc/memset +C4DB0,800D6490,src/libc/memmove C4E40,800D6520,src/code/z_message D0620,800E1D00,src/code/z_game_over D0B60,800E2240,src/code/z_construct